noalyss  Version-6.7.2
 All Data Structures Namespaces Files Functions Variables Enumerations
print_ledger_simple.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 ?><TABLE class="result">
00005     <tr>
00006         <th><?php echo _("Pièce")?></th>
00007         <th><?php echo _("Date")?></th>
00008         <th><?php echo _("Paiement")?></th>
00009         <th><?php echo _("Ref")?></th>
00010         <th><?php echo _("Client")."/"._("Fournisseur")?></th>
00011         <th><?php echo _("Description")?></th>
00012         <th style="text-align:right">HTVA</th>
00013         <th style="text-align:right">Privé</th>
00014         <th style="text-align:right">DNA</th>
00015         <th style="text-align:right">TVA ND</th>
00016         
00017 <?php
00018 $col_tva="";
00019 
00020  if ( $own->MY_TVA_USE=='Y')
00021         {
00022             $a_Tva=$cn->get_array("select tva_id,tva_label from tva_rate where tva_rate != 0.0000 order by tva_rate");
00023             foreach($a_Tva as $line_tva)
00024             {
00025                 $col_tva.='<th style="text-align:right">Tva '.$line_tva['tva_label'].'</th>';
00026             }
00027         }
00028 echo $col_tva;      
00029 ?>
00030         <th style="text-align:right">TVAC</th>
00031         <th><?php echo _("Opérations rapprochées")?></th>
00032     </tr>
00033 <?php
00034 $i = 0;
00035 $cn->prepare('reconcile_date','select * from jrn where jr_id in (select jra_concerned from jrn_rapt where jr_id = $1 union all select jr_id from jrn_rapt where jra_concerned=$1)');
00036 foreach ($Row as $line) {
00037     $i++;
00038     /*
00039      * Get date of reconcile operation
00040      */
00041     $ret_reconcile=$cn->execute('reconcile_date',array($line['jr_id']));
00042    
00043     $class = ($i % 2 == 0) ? ' class="even" ' : ' class="odd" ';
00044     echo "<tr $class>";
00045     echo "<TD>" . h($line['jr_pj_number']) . "</TD>";
00046     echo "<TD>" . smaller_date($line['date']) . "</TD>";
00047     echo "<TD>" . smaller_date($line['date_paid']) . "</TD>";
00048     echo "<TD>" . HtmlInput::detail_op($line['jr_id'], $line['jr_internal']) . "</TD>";
00049     $tiers = $Jrn->get_tiers($line['jrn_def_type'], $line['jr_id']);
00050     echo td($tiers);
00051     echo "<TD>" . h($line['comment']) . "</TD>";
00052     $dep_priv=($line['dep_priv']==0)?"":nbm($line['dep_priv']);
00053     $dna=($line['dna']==0)?"":nbm($line['dna']);
00054     $tva_dna=($line['tva_dna']==0)?"":nbm($line['tva_dna']);
00055     echo "<TD class=\"num\">" . nbm($line['HTVA']) . "</TD>";
00056     echo "<TD class=\"num\">" .$dep_priv . "</TD>";
00057     echo "<TD class=\"num\">" . $dna . "</TD>";
00058     echo "<TD class=\"num\">" . $tva_dna. "</TD>";
00059     if ($own->MY_TVA_USE == 'Y' )
00060     {
00061         $a_tva_amount=array();
00062         foreach ($line['TVA'] as $lineTVA)
00063                 {
00064                     foreach ($a_Tva as $idx=>$line_tva)
00065                     {
00066 
00067                         if ($line_tva['tva_id'] == $lineTVA[1][0])
00068                         {
00069                             $a=$line_tva['tva_id'];
00070                             $a_tva_amount[$a]=$lineTVA[1][2];
00071                         }
00072                     }
00073                 }
00074                     foreach ($a_Tva as $line_tva)
00075                     {
00076                         $a=$line_tva['tva_id'];
00077                         if ( isset($a_tva_amount[$a]))
00078                             echo '<td class="num">'.nb($a_tva_amount[$a]).'</td>';
00079                         else
00080                             printf("<td class=\"num\"></td>");
00081                     }
00082     }
00083     echo '<td class="num">'.$line['TVAC'].'</td>';
00084     /*
00085      * If reconcile print them
00086      */
00087     echo '<td>';
00088     $max=Database::num_row($ret_reconcile);
00089     if ($max > 0) {
00090         $sep="";
00091         for ($e=0;$e<$max;$e++) {
00092             $row=Database::fetch_array($ret_reconcile, $e);
00093             echo $sep.HtmlInput::detail_op($row['jr_id'],$row['jr_date'].' '. $row['jr_internal']);
00094             $sep=' ,';
00095         }
00096     }
00097     echo '</td>';
00098     echo "</tr>";
00099 }
00100 ?>
00101 </table>
 All Data Structures Namespaces Files Functions Variables Enumerations