noalyss  Version-9
print_ledger_simple.php
Go to the documentation of this file.
1 <?php
2 //This file is part of NOALYSS and is under GPL
3 //see licence.txt
4 ?><TABLE class="result">
5  <tr>
6  <th><?php echo _("Pièce")?></th>
7  <th><?php echo _("Date")?></th>
8  <th><?php echo _("Paiement")?></th>
9  <th><?php echo _("Ref")?></th>
10  <th><?php echo _("Client")."/"._("Fournisseur")?></th>
11  <th><?php echo _("Description")?></th>
12  <th style="text-align:right">HTVA</th>
13  <th style="text-align:right">Privé</th>
14  <th style="text-align:right">DNA</th>
15 
16 
17 <?php
18 $col_tva="";
19 
20  if ( $own->MY_TVA_USE=='Y')
21  {
22  echo '<th style="text-align:right">TVA ND</th>';
23  $a_Tva=$cn->get_array("select tva_id,tva_label from tva_rate where tva_rate != 0.0000 order by tva_rate");
24  foreach($a_Tva as $line_tva)
25  {
26  $col_tva.='<th style="text-align:right">Tva '.$line_tva['tva_label'].'</th>';
27  }
28  }
29 echo $col_tva;
30 ?>
31  <th style="text-align:right">TVAC</th>
32  <th><?php echo _("Opérations rapprochées")?></th>
33  </tr>
34 <?php
35 $i = 0;
36 $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)');
37 $tot['htva']=0;
38 $tot['dep_priv']=0;
39 $tot['dna']=0;
40 $tot['tva_nd']=0;
41 $tot['tvac']=0;
42 $tot['tva']=array();
43 bcscale(4);
44 foreach ($Row as $line) {
45  $i++;
46  /*
47  * Get date of reconcile operation
48  */
49  $ret_reconcile=$cn->execute('reconcile_date',array($line['jr_id']));
50  $class = ($i % 2 == 0) ? ' class="even" ' : ' class="odd" ';
51  echo "<tr $class>";
52 
53  // Receipt number
54  echo "<TD>" . h($line['jr_pj_number']) . "</TD>";
55 
56  // Date
57  echo "<TD>" . smaller_date($line['date']) . "</TD>";
58  echo "<TD>" . smaller_date($line['date_paid']) . "</TD>";
59 
60  // Internal with detail
61  echo "<TD>" . HtmlInput::detail_op($line['jr_id'], $line['jr_internal']) . "</TD>";
62 
63  // find the tiers (normally in $Row !
64  $tiers = $Jrn->get_tiers($line['jrn_def_type'], $line['jr_id']);
65  echo td($tiers);
66 
67  // Label
68  echo "<TD>" . h($line['comment']) . "</TD>";
69 
70  // Private expense
71  $dep_priv=($line['dep_priv']==0)?"":nbm(round($line['dep_priv'],2),2);
72  $tot['dep_priv']=bcadd($tot['dep_priv'], floatval($line['dep_priv']));
73 
74  // No deductible
75  $dna=($line['dna']==0)?"":nbm(round($line['dna'],2),2);
76  $tot['dna']=bcadd($tot['dna'],round(floatval($line['dna'])),2);
77 
78  // HTVA amount
79  echo "<TD class=\"num\">" . nbm(round($line['HTVA'],2),2) . "</TD>";
80  $tot['htva']=bcadd($tot['htva'], round(floatval($line['HTVA']),2));
81 
82  echo "<TD class=\"num\">" .$dep_priv . "</TD>";
83  echo "<TD class=\"num\">" . $dna . "</TD>";
84 
85  //--------------------------------------------------------------------------
86  // If VAT then display it
87  //--------------------------------------------------------------------------
88  if ($own->MY_TVA_USE == 'Y' )
89  {
90  $tva_dna=($line['tva_dna']==0)?"":nbm(round($line['tva_dna']),2);
91  $tot['tva_nd']=bcadd($tot['tva_nd'], round(floatval($line['tva_dna']),2));
92  echo "<TD class=\"num\">" . $tva_dna. "</TD>";
93  $a_tva_amount=array();
94 
95  foreach ($line['TVA'] as $lineTVA)
96  {
97  foreach ($a_Tva as $idx=>$line_tva)
98  {
99 
100  if ($line_tva['tva_id'] == $lineTVA[1][0])
101  {
102  $a=$line_tva['tva_id'];
103  $a_tva_amount[$a]=$lineTVA[1][2];
104  }
105  }
106  }
107  foreach ($a_Tva as $line_tva)
108  {
109  $a=$line_tva['tva_id'];
110  if ( isset($a_tva_amount[$a]) && $a_tva_amount[$a] != 0) {
111  echo '<td class="num">'.nb(round($a_tva_amount[$a],2)).'</td>';
112  $tot['tva'][$a]=(isset($tot['tva'][$a]))?bcadd($tot['tva'][$a],round(floatval($a_tva_amount[$a]),2)):round(floatval($a_tva_amount[$a]),2);
113  }
114  else
115  printf("<td class=\"num\"></td>");
116  }
117  }
118 
119  echo '<td class="num">'.round($line['TVAC'],2).'</td>';
120  $tot['tvac']=bcadd($tot['tvac'], round(floatval($line['TVAC']),2));
121  /*
122  * If reconcile print them
123  */
124  echo '<td>';
126  if ($max > 0) {
127  $sep="";
128  for ($e=0;$e<$max;$e++) {
130  echo $sep.HtmlInput::detail_op($row['jr_id'],$row['jr_date'].' '. $row['jr_internal']);
131  $sep=' ,';
132  }
133  }
134  echo '</td>';
135  echo "</tr>";
136 }
137 /**
138  * summary
139  */
140 ?>
141  <tr class="highlight">
142  <td>
143  <?php echo _('Totaux')?>
144  </td>
145  <td></td>
146  <td></td>
147  <td></td>
148  <td></td>
149  <td></td>
150  <td class="num"><?php echo nbm($tot['htva']); ?></td>
151  <td class="num"><?php echo nbm($tot['dep_priv']) ?></td>
152  <td class="num"><?php echo nbm($tot['dna'])?></td>
153  <?php if ($own->MY_TVA_USE == 'Y' ): ?>
154  <td><?php echo nbm($tot['tva_nd']) ?></td>
155  <?php foreach ($a_Tva as $line_tva) :
156  $a=$line_tva['tva_id'];
157  if ( isset($tot['tva'][$a])) :
158  ?>
159  <td class="num"><?php echo nbm($tot['tva'][$a])?></td>
160  <?php else : ?>
161  <td>
162 
163  </td>
164  <?php endif; ?>
165  <?php endforeach;?>
166  <?php endif; ?>
167  <td class="num"><?php echo nbm($tot['tvac'])?></td>
168  <td></td>
169  </tr>
170 
171 
172 </table>
nbm
nbm($p_number, $p_dec=2)
format the number with a sep.
Definition: ac_common.php:137
$class
$class
Definition: cfgplugin.inc.php:128
h
h( $row[ 'oa_description'])
Definition: ajax_anc_detail_operation.php:46
$e
$e
Definition: result_cat_card_summary.php:26
style
$opd_description style
Definition: ajax_mod_predf_op.php:52
$max
$max
Definition: ajax_boxcard_search.php:40
tr
tr($p_string, $p_extra='')
Definition: ac_common.php:88
endif
endif
Definition: print_ledger_simple.php:166
DatabaseCore\fetch_array
static fetch_array($ret, $p_indice=0)
wrapper for the function pg_fetch_array
Definition: database_core.class.php:745
$sep
$sep
Definition: acc_ledger-input_extra_info.php:52
endforeach
if(isset( $tot[ 'tva'][ $a]))($tot['tva'][$a])?></td ><?php else endforeach
Definition: print_ledger_simple.php:157
$own
$own
Definition: export_ledger_pdf.php:51
$i
$i
Definition: action_document_type_mtable_input.php:83
$a
$a
Definition: ajax_add_concerned_card.php:108
DatabaseCore\num_row
static num_row($ret)
wrapper for the function pg_num_rows
Definition: database_core.class.php:734
smaller_date
smaller_date($p_date)
shrink the date, make a date shorter for the printing
Definition: ac_common.php:830
else
if(!headers_sent()) else
Definition: ajax_add_concerned_card.php:147
$tot
$tot['htva']
Definition: print_ledger_simple.php:37
$Jrn
$Jrn
Definition: export_ledger_csv.php:88
$idx
$idx
Definition: ajax_bookmark.php:79
$line
$line
Definition: ajax_display_letter.php:88
$cn
$cn
Definition: ajax_anc_accounting.php:30
table
$all table
Definition: company.inc.php:138
th
th($p_string, $p_extra='', $raw='')
Definition: ac_common.php:58
td
td($p_string='', $p_extra='')
surround the string with td
Definition: ac_common.php:83
$tiers
$tiers
Definition: ajax_search_operation.php:39
$row
$row
Definition: ajax_anc_detail_operation.php:33
$ret_reconcile
$ret_reconcile
Definition: acc_ledger_history_financial_oneline.php:83
HtmlInput\detail_op
static detail_op($p_jr_id, $p_mesg)
return a string containing the html code for calling the modifyOperation
Definition: html_input.class.php:271