noalyss  Version-6.7.2
 All Data Structures Namespaces Files Functions Variables Enumerations
ledger_detail_ach.php
Go to the documentation of this file.
00001 <?php
00002 //This file is part of NOALYSS and is under GPL 
00003 //see licence.txt
00004 ?><?php require_once('template/ledger_detail_top.php'); ?>
00005 <div class="content" style="padding:0;">
00006     <?php
00007     require_once('class_own.php');
00008     $owner = new Own($cn);
00009     ?>
00010 
00011     <?php if ($access == 'W') : ?>
00012         <form  class="print" onsubmit="return op_save(this);">
00013         <?php endif; ?>
00014 
00015         <?php echo HtmlInput::hidden('whatdiv', $div) . HtmlInput::hidden('jr_id', $jr_id) . dossier::hidden(); ?>
00016         <table style="width:100%">
00017             <tr><td>
00018                     <table>
00019                             <td></td>
00020                         <?php
00021                         $date = new IDate('p_date');
00022                         $date->value = format_date($obj->det->jr_date);
00023                         echo td(_('Date')) . td($date->input());
00024                         ?>
00025                         <tr>
00026                             <td></td>
00027                             <?php
00028                             $date_ech = new IDate('p_ech');
00029                             $date_ech->value = format_date($obj->det->jr_ech);
00030                             echo td(_('Echeance')) . td($date_ech->input());
00031                             ?>
00032                         </tr>
00033                         <tr>
00034                             <td></td>
00035                             <td>
00036                                 <?php echo _("Date paiement")?>
00037                             </td>
00038                             <td>
00039                                 <?php
00040                                 $date_paid = new IDate('p_date_paid');
00041                                 $date_paid->value = format_date($obj->det->jr_date_paid);
00042                                 echo $date_paid->input();
00043                                 ?>
00044                             </td>
00045                         </tr>
00046 
00047                         <tr><td>
00048                                 <?php
00049                                 $bk = new Fiche($cn, $obj->det->array[0]['qp_supplier']);
00050                                 echo td(_('Fournisseur'));
00051 
00052                                 $view_card_detail = HtmlInput::card_detail($bk->get_quick_code(), h($bk->getName()), ' class="line" ');
00053                                 echo td($view_card_detail);
00054                                 ?>
00055                             </td>
00056                         </tr>
00057                         <tr>
00058                             <td>
00059                                 <?php
00060                                 $itext = new IText('npj');
00061                                 $itext->value = strip_tags($obj->det->jr_pj_number);
00062                                 echo td(_('Pièce')) . td($itext->input());
00063                                 ?>
00064                             </td>
00065                         <tr>
00066                             <td>
00067                                 <?php
00068                                 $itext = new IText('lib');
00069                                 $itext->value = strip_tags($obj->det->jr_comment);
00070                                 $itext->size = 40;
00071                                 echo td(_('Libellé')) . td($itext->input(), ' colspan="2" ');
00072                                 ?>
00073                             </td>
00074                         </tr>
00075                         <tr>
00076                             <td></td>
00077                             <td>Payé</td>
00078                             <td>
00079                                 <?php
00080                                 $ipaid = new ICheckBox("ipaid", 'paid');
00081                                 $ipaid->selected = ($obj->det->jr_rapt == 'paid');
00082                                 echo $ipaid->input();
00083                                 ?>
00084                             </td>
00085                         </tr>
00086 
00087                     </table>
00088                 </td><td>
00089                     <table style="border:solid 1px yellow">
00090                         <tr>
00091                             <td>
00092                                 Note
00093                             </td></tr>
00094                         <tr>
00095                             <td>
00096                                 <?php
00097                                 $inote = new ITextarea('jrn_note');
00098                                 $inote->width = 25;
00099                                 $inote->heigh = 5;
00100                                 $inote->value = strip_tags($obj->det->note);
00101                                 echo $inote->input();
00102                                 ?>
00103 
00104                             </td>
00105                         </tr>
00106                     </table>
00107                 </td>
00108             </tr>
00109 
00110         </table>
00111         <div class="myfieldset">
00112             <h1 class="legend"><?php echo _('Détail') ?></h1>
00113             <table class="result">
00114                 <?php
00115                 bcscale(2);
00116                 $total_htva = 0;
00117                 $total_tvac = 0;
00118                 echo th(_('Quick Code'));
00119                 echo th(_('Description'));
00120                 if ($owner->MY_TVA_USE == 'Y')
00121                 {
00122                     echo th(_('Taux TVA'), 'style="text-align:right"');
00123                 } else
00124                 {
00125                     echo th('');
00126                 }
00127                 echo th(_('Prix/Un.'), 'style="text-align:right"');
00128                 echo th(_('Quantité'), 'style="text-align:right"');
00129                 echo th(_('Non ded'), 'style="text-align:right"');
00130 
00131                 if ($owner->MY_TVA_USE == 'Y')
00132                 {
00133                     echo th(_('HTVA'), 'style="text-align:right"');
00134                     echo th(_('TVA ND'), 'style="text-align:right"');
00135                     echo th(_('TVA'), 'style="text-align:right"');
00136                     echo th(_('TVAC'), 'style="text-align:right"');
00137                 } else
00138                     echo th(_('Total'), 'style="text-align:right"');
00139 
00140                 if ($owner->MY_ANALYTIC != 'nu' && $div == 'popup')
00141                 {
00142                     $anc = new Anc_Plan($cn);
00143                     $a_anc = $anc->get_list(' order by pa_id ');
00144                     $x = count($a_anc);
00145                     /* set the width of the col */
00146                     echo '<th colspan="' . $x . '">' . _('Compt. Analytique') . '</th>';
00147 
00148                     /* add hidden variables pa[] to hold the value of pa_id */
00149                     echo Anc_Plan::hidden($a_anc);
00150                 }
00151                 echo '</tr>';
00152                 for ($e = 0; $e < count($obj->det->array); $e++)
00153                 {
00154                     $row = '';
00155                     $q = $obj->det->array[$e];
00156                     $fiche = new Fiche($cn, $q['qp_fiche']);
00157                     $view_card_detail = HtmlInput::card_detail($fiche->strAttribut(ATTR_DEF_QUICKCODE), "", ' class="line" ');
00158                     $row = td($view_card_detail);
00159                     $sym_tva = '';
00160 
00161                     if ($owner->MY_TVA_USE == 'Y' && $q['qp_vat_code'] != '')
00162                     {
00163                         /* retrieve TVA symbol */
00164                         $tva = new Acc_Tva($cn, $q['qp_vat_code']);
00165                         $tva->load();
00166                         $sym_tva = h($tva->get_parameter('label'));
00167                     }
00168                     if ($owner->MY_UPDLAB == 'Y')
00169                     {
00170                         $l_lib = ($q['j_text'] == '') ? $fiche->strAttribut(ATTR_DEF_NAME) : $q['j_text'];
00171                         $hidden = HtmlInput::hidden("j_id[]", $q['j_id']);
00172                         $input = new IText("e_march" . $q['j_id'] . "_label", $l_lib);
00173                         $input->css_size = "100%";
00174                     } else
00175                     {
00176                         $input = new ISpan("e_march" . $q['j_id'] . "_label");
00177                         $hidden = HtmlInput::hidden("j_id[]", $q['j_id']);
00178                         $input->value = $fiche->strAttribut(ATTR_DEF_NAME);
00179                     }
00180                     $row.=td($input->input() . $hidden);
00181                     $row.=td($sym_tva, 'style="text-align:center"');
00182                     $pu = 0;
00183                     if ($q['qp_quantite'] != 0)
00184                         $pu = bcdiv($q['qp_price'], $q['qp_quantite']);
00185                     $row.=td(nbm($pu), 'class="num"');
00186                     $row.=td(nbm($q['qp_quantite']), 'class="num"');
00187 
00188                     $no_ded = bcadd($q['qp_dep_priv'], $q['qp_nd_amount']);
00189                     $row.=td(nbm($no_ded), ' style="text-align:right"');
00190                     $htva = $q['qp_price'];
00191 
00192 
00193                     $row.=td(nbm($htva), 'class="num"');
00194                     $tvac = bcadd($htva, $q['qp_vat']);
00195                     $tvac = bcadd($tvac, $q['qp_nd_tva']);
00196                     $tvac = bcadd($tvac, $q['qp_nd_tva_recup']);
00197 
00198 
00199                     if ($owner->MY_TVA_USE == 'Y')
00200                     {
00201                         $tva_amount_nd = bcadd($q['qp_nd_tva_recup'], $q['qp_nd_tva']);
00202                         $class = "";
00203                         if ($q['qp_vat_sided'] <> 0)
00204                         {
00205                             $class = ' style="text-decoration:line-through"';
00206                             $tvac = bcsub($tvac, $q['qp_vat']);
00207                         }
00208                         $row.=td(nbm($tva_amount_nd), 'class="num" ' . $class);
00209                         $row.=td(nbm($q['qp_vat']), 'class="num" ' . $class);
00210                         $row.=td(nbm($tvac), 'class="num"');
00211                     }
00212                     $total_tvac+=$tvac;
00213                     $total_htva+=$htva;
00214                     /* Analytic accountancy */
00215                     if ($owner->MY_ANALYTIC != "nu" && $div == 'popup')
00216                     {
00217                         $poste = $fiche->strAttribut(ATTR_DEF_ACCOUNT);
00218                         if (preg_match('/^(6|7)/', $poste))
00219                         {
00220                             $anc_op = new Anc_Operation($cn);
00221                             $anc_op->j_id = $q['j_id'];
00222                             echo HtmlInput::hidden('op[]', $anc_op->j_id);
00223                             /* compute total price */
00224                             bcscale(2);
00225 
00226                             $row.=$anc_op->display_table(1, $htva, $div);
00227                         } else
00228                         {
00229                             $row.=td('');
00230                         }
00231                     }
00232                      $class=($e%2==0)?' class="even"':'class="odd"';
00233                      echo tr($row,$class);
00234                 }
00235                 if ($owner->MY_TVA_USE == 'Y')
00236                     $row = td(_('Total'), ' style="font-style:italic;text-align:right;font-weight: bolder;width:auto" colspan="6"');
00237                 else
00238                     $row = td(_('Total'), ' style="font-style:italic;text-align:right;font-weight: bolder;width:auto" colspan="6"');
00239                 $row.=td(nbm($total_htva), 'class="num" style="font-style:italic;font-weight: bolder;"');
00240                 if ($owner->MY_TVA_USE == 'Y')
00241                     $row.=td("") . td("").td(nbm($total_tvac), 'class="num" style="font-style:italic;font-weight: bolder;"');
00242                 echo tr($row);
00243                 ?>
00244             </table>
00245 
00246 
00247         </div>
00248         <div class="myfieldset">
00249             <h1 class="legend"><?php echo _('Ecritures comptables') ?></h1>
00250 
00251 
00252             <?php
00253             /* if it is not in a popup, the details are hidden */
00254             if ($div != 'popup')
00255             {
00256                 $ib = new IButton("a" . $div);
00257                 $ib->label = 'Afficher';
00258                 $ib->javascript = "g('detail_" . $div . "').style.display='block';g('a" . $div . "').style.display='none';";
00259                 echo $ib->input();
00260                 echo '<div id="detail_' . $div . '" class="content" style="display:none">';
00261                 $ib = new IButton("h" . $div);
00262                 $ib->label = 'Cacher';
00263                 $ib->javascript = "g('detail_" . $div . "').style.display='none';g('a" . $div . "').style.display='block';";
00264                 echo $ib->input();
00265             } else
00266                 echo '<div class="content">';
00267             $detail = new Acc_Misc($cn, $obj->jr_id);
00268             $detail->get();
00269             ?>
00270             <table class="result">
00271                 <tr>
00272                     <?php
00273                     echo th(_('Poste Comptable'));
00274                     echo th(_('Quick Code'));
00275                     echo th(_('Libellé'));
00276                     echo th(_('Débit'), ' style="text-align:right"');
00277                     echo th(_('Crédit'), ' style="text-align:right"');
00278                     echo '</tr>';
00279                     for ($e = 0; $e < count($detail->det->array); $e++)
00280                     {
00281                         $row = '';
00282                         $q = $detail->det->array;
00283                         $view_history = sprintf('<A class="detail" style="text-decoration:underline" HREF="javascript:view_history_account(\'%s\',\'%s\')" >%s</A>', $q[$e]['j_poste'], $gDossier, $q[$e]['j_poste']);
00284 
00285                         $row.=td($view_history);
00286                         if ($q[$e]['j_qcode'] != '')
00287                         {
00288                             $fiche = new Fiche($cn);
00289                             $fiche->get_by_qcode($q[$e]['j_qcode']);
00290                             $view_history = sprintf('<A class="detail" style="text-decoration:underline" HREF="javascript:view_history_card(\'%s\',\'%s\')" >%s</A>', $fiche->id, $gDossier, $q[$e]['j_qcode']);
00291                         } else
00292                             $view_history = '';
00293                         $row.=td($view_history);
00294                         
00295                         if ($q[$e]['j_text']=="")
00296                         {
00297                             if ($q[$e]['j_qcode'] != '')
00298                             {
00299                             // nom de la fiche
00300                                 $ff = new Fiche($cn);
00301                                 $ff->get_by_qcode($q[$e]['j_qcode']);
00302                                 $row.=td($ff->strAttribut(h(ATTR_DEF_NAME)));
00303                             } else
00304                             {
00305                                 // libellé du compte
00306                                 $name = $cn->get_value('select pcm_lib from tmp_pcmn where pcm_val=$1', array($q[$e]['j_poste']));
00307                                 $row.=td(h($name));
00308                             }
00309                         }
00310                         else 
00311                             $row.=td(h($q[$e]['j_text']));
00312                         
00313                         $montant = td(nbm($q[$e]['j_montant']), 'class="num"');
00314                         $row.=($q[$e]['j_debit'] == 't') ? $montant : td('');
00315                         $row.=($q[$e]['j_debit'] == 'f') ? $montant : td('');
00316                         $class=($e%2==0)?' class="even"':'class="odd"';
00317 
00318                         echo tr($row,$class);
00319                     }
00320                     ?>
00321             </table>
00322         </div>
00323 </div>
00324 
00325 <?php
00326 require_once('ledger_detail_bottom.php');
00327 ?>
00328 </div>
 All Data Structures Namespaces Files Functions Variables Enumerations