noalyss
Version-9
include
template
acc_ledger_history_sale_extended.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
22
23
/**
24
* @file
25
* @brief detail of the list of operation with VAT and items
26
*/
27
bcscale(2);
28
29
30
?>
31
<
table
class
=
"result"
id
=
"tb_print_ledger"
>
32
<
tr
>
33
<
th
>
34
<?=_(
'Date'
)?>
35
</
th
>
36
<
th
>
37
<?=_(
'Date paiement'
)?>
38
</
th
>
39
<
th
>
40
<?=_(
'Pièce'
)?>
41
</
th
>
42
<
th
>
43
<?=_(
'Interne'
)?>
44
</
th
>
45
<
th
>
46
<?=_(
'Client'
)?>
47
</
th
>
48
<
th
>
49
<?=_(
'Description'
)?>
50
</
th
>
51
<
th
class
=
"num"
>
52
<?=_(
'Devise TVAC'
)?>
53
</
th
>
54
<
th
class
=
"num"
>
55
<?=_(
'HTVA'
)?>
56
</
th
>
57
<
th
class
=
"num"
>
58
<?=_(
'TVA'
)?>
59
</
th
>
60
<
th
class
=
"num"
>
61
<?=_(
'TVAC'
)?>
62
</
th
>
63
</
tr
>
64
<?php
65
$nb_data
=count($this->data);
66
$tot_amount_novat
=0;
67
$tot_amount_vat
=0;
68
$tot_amount_tvac
=0;
69
for
(
$i
=0;
$i
<
$nb_data
;
$i
++):
70
$odd=
' class="odd" '
;
71
$tot_amount_novat
=bcadd(
$tot_amount_novat
,$this->data[
$i
][
'novat'
]);
72
$tot_amount_vat
=bcadd(
$tot_amount_vat
,$this->data[
$i
][
'vat'
]);
73
$tot_amount_vat
=bcsub(
$tot_amount_vat
,$this->data[
$i
][
'tva_sided'
]);
74
$tot_amount_tvac
=bcadd(
$tot_amount_tvac
,$this->data[
$i
][
'tvac'
]);
75
$supp_tax
=$this->data[
$i
][
'supp_tax'
];
76
$tot_other_tax
=array_sum(array_column(
$supp_tax
,
'j_montant'
));
77
$all_tax
=bcadd(
$tot_other_tax
,$this->data[
$i
][
'vat'
]);
78
?>
79
<tr <?=$odd?> >
80
<
td
>
81
<?=$this->data[
$i
][
'str_date'
]?>
82
</
td
>
83
<
td
>
84
<?=$this->data[
$i
][
'str_date_paid'
]?>
85
</
td
>
86
<
td
>
87
<?=$this->data[
$i
][
'jr_pj_number'
]?>
88
</
td
>
89
<
td
>
90
<?=
HtmlInput::detail_op
($this->data[
$i
][
'jr_id'
], $this->data[
$i
][
'jr_internal'
])?>
91
</
td
>
92
<
td
>
93
<?=
HtmlInput::history_card
($this->data[
$i
][
'qs_client'
],
h
($this->data[
$i
][
'name'
].
' '
.$this->data[
$i
][
'first_name'
]))?>
94
</
td
>
95
<
td
>
96
<?=
h
($this->data[
$i
][
'jr_comment'
])?>
97
</
td
>
98
<
td
class
=
"num"
>
99
<?php
if
($this->data[
$i
][
'currency_id'
] !=0) : ?>
100
<?=
nbm
(bcadd($this->data[
$i
][
'sum_oc_amount'
],$this->data[
$i
][
'sum_oc_vat_amount'
],4),2)?>
101
<?=$this->data[
$i
][
'cr_code_iso'
]?>
102
<?php
endif
;?>
103
</
td
>
104
<
td
class
=
"num"
>
105
<?=
nbm
($this->data[
$i
][
'novat'
])?>
106
</
td
>
107
<
td
class
=
"num"
>
108
<?=
nbm
(bcsub(
$all_tax
,$this->data[
$i
][
'tva_sided'
]),2)?>
109
110
</
td
>
111
<
td
class
=
"num"
>
112
<?=
nbm
(bcadd($this->data[
$i
][
'tvac'
],
$tot_other_tax
))?>
113
114
</
td
>
115
<
td
>
116
117
<?php
118
$ret_reconcile
=$this->
db
->execute(
'reconcile_date'
,array($this->data[
$i
][
'jr_id'
]));
119
$max
=
Database::num_row
(
$ret_reconcile
);
120
if
(
$max
> 0) {
121
$sep
=
""
;
122
for
(
$e
=0;
$e
<
$max
;
$e
++) {
123
$row
=
Database::fetch_array
(
$ret_reconcile
,
$e
);
124
$msg
=(
$row
[
'qcode_bank'
] !=
""
)?
"["
.
$row
[
'qcode_bank'
].
"]"
:
$row
[
'jr_internal'
];
125
echo
$sep
.HtmlInput::detail_op(
$row
[
'jr_id'
],
$row
[
'jr_date'
].
' '
.
$msg
);
126
127
$sep
=
' ,'
;
128
}
129
} ?>
130
</
td
>
131
</
tr
>
132
<
tr
>
133
<
td
></
td
>
134
<
td
></
td
>
135
<
td
class
=
"width:auto"
colspan=
"8"
style
=
"border-style: solid;border-width:1px;border-color: blue"
>
136
<?php
137
/// Detail opération
138
$det
=$this->
db
->execute(
"detail_sale"
,array($this->data[
$i
][
'jr_internal'
]));
139
$a_detail
=
Database::fetch_all
(
$det
);
140
?>
141
<
table
style
=
"width: 100%"
>
142
<
tr
>
143
<
th
><?=_(
"Item"
)?></
th
>
144
<
th
class
=
"num"
><?=_(
"Prix Uni"
)?></
th
>
145
<
th
class
=
"num"
><?=_(
"Quantité"
)?></
th
>
146
<
th
class
=
"num"
><?=_(
"HTVA"
)?></
th
>
147
<
th
class
=
"num"
><?=_(
"TVA"
)?></
th
>
148
<
th
class
=
"num"
><?=_(
"Code TVA"
)?></
th
>
149
<
th
class
=
"num"
><?=_(
"TVAC"
)?></
th
>
150
</
tr
>
151
<?php
152
$nb_detail
=count(
$a_detail
);
153
for
($j=0;$j<
$nb_detail
;$j++):
154
155
156
157
?>
158
<
tr
>
159
<
td
><?=
$a_detail
[$j][
'qcode'
]?>
160
<?=
$a_detail
[$j][
'name'
]?> </
td
>
161
<
td
class
=
"num"
style
=
"width:10%"
><?=
$a_detail
[$j][
'qs_quantite'
]?> </
td
>
162
<
td
class
=
"num"
style
=
"width:10%"
><?=
$a_detail
[$j][
'qs_unit'
]?> </
td
>
163
<
td
class
=
"num"
style
=
"width:10%"
><?=
nbm
(
$a_detail
[$j][
'qs_price'
])?> </
td
>
164
<
td
class
=
"num"
style
=
"width:10%"
><?=
nbm
(
$a_detail
[$j][
'qs_vat'
])?> </
td
>
165
<
td
class
=
"num"
style
=
"width:10%"
><?=
$a_detail
[$j][
'tva_label'
]?> </
td
>
166
<
td
class
=
"num"
style
=
"width:10%"
><?=
nbm
(
$a_detail
[$j][
'tvac'
])?> </
td
>
167
</
tr
>
168
<?php
169
endfor
;
170
?>
171
<?php
172
// print additional tax if any
173
$nb_supp_tax
=count($this->data[
$i
][
'supp_tax'
]);
174
for
($j=0;$j<
$nb_supp_tax
;$j++):
175
?>
176
<
tr
>
177
<
td
><?=$this->data[
$i
][
'supp_tax'
][$j][
'j_poste'
]?>
178
<?=$this->data[
$i
][
'supp_tax'
][$j][
'ac_label'
]?>
179
</
td
>
180
<
td
></
td
>
181
<
td
></
td
>
182
<
td
></
td
>
183
<
td
></
td
>
184
<
td
></
td
>
185
<
td
class
=
"num"
><?=
nbm
($this->data[
$i
][
'supp_tax'
][$j][
'j_montant'
])?></
td
>
186
</
tr
>
187
<?php
188
endfor
;
189
?>
190
191
</
table
>
192
</
td
>
193
</
tr
>
194
<?php
195
endfor
;
196
?>
197
<tfoot>
198
<
tr
class
=
"highlight"
>
199
<
td
>
200
<?=_(
"Totaux"
)?>
201
</
td
>
202
<
td
></
td
>
203
<
td
></
td
>
204
<
td
></
td
>
205
<
td
></
td
>
206
<
td
></
td
>
207
<
td
><?=
nbm
(
$tot_amount_novat
)?></
td
>
208
<
td
><?=
nbm
(
$tot_amount_vat
)?></
td
>
209
<
td
><?=
nbm
(
$tot_amount_tvac
)?></
td
>
210
<
td
></
td
>
211
<
td
></
td
>
212
</
tr
>
213
</tfoot>
214
</
table
>
th
th($p_string, $p_extra='', $raw='')
Definition:
ac_common.php:58
tr
tr($p_string, $p_extra='')
Definition:
ac_common.php:88
td
td($p_string='', $p_extra='')
surround the string with td
Definition:
ac_common.php:83
nbm
nbm($p_number, $p_dec=2)
format the number with a sep.
Definition:
ac_common.php:137
$sep
$sep
Definition:
acc_ledger-input_extra_info.php:52
$det
if($max > 0) $det
Detail opération.
Definition:
acc_ledger_history_sale_extended.php:138
$tot_amount_novat
$tot_amount_novat
Definition:
acc_ledger_history_sale_extended.php:66
$tot_other_tax
$tot_other_tax
Definition:
acc_ledger_history_sale_extended.php:76
$supp_tax
$supp_tax
Definition:
acc_ledger_history_sale_extended.php:75
$nb_supp_tax
$nb_supp_tax
Definition:
acc_ledger_history_sale_extended.php:173
$nb_detail
$nb_detail
Definition:
acc_ledger_history_sale_extended.php:152
$max
$max
Definition:
acc_ledger_history_sale_extended.php:119
$tot_amount_vat
$tot_amount_vat
Definition:
acc_ledger_history_sale_extended.php:67
endif
if( $this->data[ $i][ 'currency_id'] !=0)(bcadd( $this->data[ $i][ 'sum_oc_amount'], $this->data[ $i][ 'sum_oc_vat_amount'], 4), 2)?><? endif
Definition:
acc_ledger_history_sale_extended.php:99
$all_tax
$all_tax
Definition:
acc_ledger_history_sale_extended.php:77
$a_detail
$a_detail
Definition:
acc_ledger_history_sale_extended.php:139
endfor
for( $j=0; $j< $nb_detail; $j++)( $a_detail[ $j][ 'qs_price'])?></td >< td class endfor
Definition:
acc_ledger_history_sale_extended.php:166
$nb_data
$nb_data
Definition:
acc_ledger_history_sale_extended.php:65
$ret_reconcile
$ret_reconcile
Definition:
acc_ledger_history_sale_extended.php:118
$tot_amount_tvac
$tot_amount_tvac
Definition:
acc_ledger_history_sale_extended.php:68
$i
$i
Definition:
action_document_type_mtable_input.php:83
h
h( $row[ 'oa_description'])
Definition:
ajax_anc_detail_operation.php:46
$row
$row
Definition:
ajax_anc_detail_operation.php:33
$msg
$msg
Definition:
ajax_create_menu.php:10
style
$opd_description style
Definition:
ajax_mod_predf_op.php:52
DatabaseCore\fetch_all
static fetch_all($ret)
wrapper for the function pg_fetch_all
Definition:
database_core.class.php:768
DatabaseCore\fetch_array
static fetch_array($ret, $p_indice=0, $p_mode=PGSQL_ASSOC)
wrapper for the function pg_fetch_array
Definition:
database_core.class.php:757
DatabaseCore\num_row
static num_row($ret)
wrapper for the function pg_num_rows
Definition:
database_core.class.php:744
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:289
HtmlInput\history_card
static history_card($f_id, $p_mesg, $p_style="", $p_exercice="")
display a div with the history of the card
Definition:
html_input.class.php:329
table
$all table
Definition:
company.inc.php:142
db
$SecUser db
Definition:
export_security_pdf.php:118
$e
$e
Definition:
result_cat_card_summary.php:26