noalyss Version-9
acc_ledger_history_sale_detail.php
Go to the documentation of this file.
1<?php
2
3/*
4 * This file is part of NOALYSS.
5 *
6 * PhpCompta is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * NOALYSS is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with PhpCompta; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 */
20// Copyright (2018) Author Dany De Bontridder <dany@alchimerys.be>
21
22if (!defined('ALLOWED'))
23 die('Appel direct ne sont pas permis');
24
25/**
26 * @file
27 * @brief from Acc_Ledger_History_Sale::export_html_oneline
28 * @todo prévoir aussi pour les non assujetti : faire disparaître les montants TVA
29 */
30
31echo \HtmlInput::filter_table("tb_print_ledger", "0,1,2,3,4,5,6", 1);
32?>
33<TABLE class="result">
34 <tr>
35 <th><?php echo _("Pièce")?></th>
36 <th><?php echo _("Date")?></th>
37 <th><?php echo _("Paiement")?></th>
38 <th><?php echo _("Ref")?></th>
39 <th><?php echo _("Client")?></th>
40 <th><?php echo _("Description")?></th>
41 <th style="text-align:right">HTVA</th>
42
43
44<?php
45$col_tva="";
46
47 if ( $own->MY_TVA_USE=='Y')
48 {
49 $a_Tva=$this->db->get_array("select tva_id,tva_label from tva_rate where tva_rate != 0.0000 order by tva_id");
50 foreach($a_Tva as $line_tva)
51 {
52 $col_tva.='<th style="text-align:right">Tva '.$line_tva['tva_label'].'</th>';
53 }
54 }
55echo $col_tva;
56?>
57 <th style="text-align:right">TVAC</th>
58 <th><?php echo _("Opérations rapprochées")?></th>
59 </tr>
60<?php
61$i = 0;
62$tot['htva']=0;
63$tot['dep_priv']=0;
64$tot['dna']=0;
65$tot['tva_nd']=0;
66$tot['tvac']=0;
67$tot['tva']=array();
68bcscale(4);
69foreach ($this->data as $line) {
70 $i++;
71 /*
72 * Get date of reconcile operation
73 */
74 $ret_reconcile=$this->db->execute('reconcile_date',array($line['jr_id']));
75 $class = ($i % 2 == 0) ? ' class="even" ' : ' class="odd" ';
76 echo "<tr $class>";
77
78 // Receipt number
79 echo "<TD>" . h($line['jr_pj_number']) . "</TD>";
80
81 // Date
82 echo "<TD>" . smaller_date($line['str_date']) . "</TD>";
83 echo "<TD>" . smaller_date($line['str_date_paid']) . "</TD>";
84
85 // Internal with detail
86 echo "<TD>" . HtmlInput::detail_op($line['jr_id'], $line['jr_internal']) . "</TD>";
87
88 // find the tiers (normally in $this->data !
89 $tiers =HtmlInput::history_card($line['qs_client'],h($line['name'].' '.$line['first_name'])."[{$line['qcode']}]");
90
91 echo td($tiers);
92
93 // Label
94 echo "<TD>" . h($line['jr_comment']) . "</TD>";
95
96
97 // HTVA amount
98 echo "<TD class=\"num\">" . nbm(round($line['novat'],2),2) . "</TD>";
99 $tot['htva']=bcadd($tot['htva'], round(floatval($line['novat']),2));
100
101 //--------------------------------------------------------------------------
102 // If VAT then display it
103 //--------------------------------------------------------------------------
104 if ($own->MY_TVA_USE == 'Y' )
105 {
106 $a_tva_amount=array();
107
108 foreach ($line['detail_vat'] as $lineTVA)
109 {
110 foreach ($a_Tva as $idx=>$line_tva)
111 {
112
113 if ($line_tva['tva_id'] == $lineTVA['qs_vat_code'])
114 {
115 $a=$line_tva['tva_id'];
116 $a_tva_amount[$a]=$lineTVA["vat_amount"];
117 }
118 }
119 }
120 foreach ($a_Tva as $line_tva)
121 {
122 $a=$line_tva['tva_id'];
123 if ( isset($a_tva_amount[$a]) && $a_tva_amount[$a] != 0) {
124 echo '<td class="num">'.nbm(round($a_tva_amount[$a],2)).'</td>';
125 $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);
126 }
127 else
128 printf("<td class=\"num\"></td>");
129 }
130 }
131
132 echo '<td class="num">'.nbm($line['tvac'],2).'</td>';
133 $tot['tvac']=bcadd($tot['tvac'], round(floatval($line['tvac']),2));
134 /*
135 * If reconcile print them
136 */
137 echo '<td>';
139 if ($max > 0) {
140 $sep="";
141 for ($e=0;$e<$max;$e++) {
143 $msg=( $row['qcode_bank'] != "")?"[".$row['qcode_bank']."]":$row['jr_internal'];
144 echo $sep.HtmlInput::detail_op($row['jr_id'],$row['jr_date'].' '. $msg);
145 $sep=' ,';
146 }
147 }
148 echo '</td>';
149 echo "</tr>";
150}
151/**
152 * summary
153 */
154?>
155 <tr class="highlight">
156 <td>
157 <?php echo _('Totaux')?>
158 </td>
159 <td></td>
160 <td></td>
161 <td></td>
162 <td></td>
163 <td></td>
164 <td class="num"><?php echo nbm($tot['htva']); ?></td>
165 <?php if ($own->MY_TVA_USE == 'Y' ): ?>
166 <?php foreach ($a_Tva as $line_tva) :
167 $a=$line_tva['tva_id'];
168 if ( isset($tot['tva'][$a])) :
169 ?>
170 <td class="num"><?php echo nbm($tot['tva'][$a])?></td>
171 <?php else : ?>
172 <td>
173
174 </td>
175 <?php endif; ?>
176 <?php endforeach;?>
177 <?php endif; ?>
178 <td class="num"><?php echo nbm($tot['tvac'])?></td>
179 <td></td>
180 </tr>
181
182
183</table>
th($p_string, $p_extra='', $raw='')
Definition: ac_common.php:58
smaller_date($p_date)
shrink the date, make a date shorter for the printing
Definition: ac_common.php:837
tr($p_string, $p_extra='')
Definition: ac_common.php:88
td($p_string='', $p_extra='')
surround the string with td
Definition: ac_common.php:83
nbm($p_number, $p_dec=2)
format the number with a sep.
Definition: ac_common.php:137
if( $own->MY_TVA_USE=='Y')( $a_Tva as $line_tva) if(isset($tot['tva'][$a]))($tot['tva'][$a])?></td ><?php else endforeach
if(!headers_sent()) else
h( $row[ 'oa_description'])
$idx
$opd_description style
$class
static fetch_array($ret, $p_indice=0, $p_mode=PGSQL_ASSOC)
wrapper for the function pg_fetch_array
static num_row($ret)
wrapper for the function pg_num_rows
static detail_op($p_jr_id, $p_mesg)
return a string containing the html code for calling the modifyOperation
static history_card($f_id, $p_mesg, $p_style="", $p_exercice="")
display a div with the history of the card
$all table
$SecUser db