30 require
'../../main.inc.php';
31 require_once DOL_DOCUMENT_ROOT.
'/core/lib/report.lib.php';
32 require_once DOL_DOCUMENT_ROOT.
'/core/lib/tax.lib.php';
33 require_once DOL_DOCUMENT_ROOT.
'/core/lib/date.lib.php';
34 require_once DOL_DOCUMENT_ROOT.
'/compta/tva/class/tva.class.php';
35 require_once DOL_DOCUMENT_ROOT.
'/compta/localtax/class/localtax.class.php';
36 require_once DOL_DOCUMENT_ROOT.
'/compta/facture/class/facture.class.php';
37 require_once DOL_DOCUMENT_ROOT.
'/product/class/product.class.php';
38 require_once DOL_DOCUMENT_ROOT.
'/compta/paiement/class/paiement.class.php';
39 require_once DOL_DOCUMENT_ROOT.
'/fourn/class/fournisseur.facture.class.php';
40 require_once DOL_DOCUMENT_ROOT.
'/fourn/class/paiementfourn.class.php';
41 require_once DOL_DOCUMENT_ROOT.
'/expensereport/class/expensereport.class.php';
42 require_once DOL_DOCUMENT_ROOT.
'/expensereport/class/paymentexpensereport.class.php';
45 $langs->loadLangs(array(
"other",
"compta",
"banks",
"bills",
"companies",
"product",
"trips",
"admin"));
49 if (empty($conf->global->SOCIETE_FISCAL_MONTH_START)) $conf->global->SOCIETE_FISCAL_MONTH_START = 1;
55 $year_current = $current_date[
'year'];
56 $year_start = $year_current;
58 $year_current = $year;
64 if (empty($date_start) || empty($date_end))
70 if (empty($conf->global->MAIN_INFO_VAT_RETURN) || $conf->global->MAIN_INFO_VAT_RETURN == 2) {
71 $date_start =
dol_time_plus_duree(
dol_get_first_day($year_start, $current_date[
'mon'],
false), -3 - (($current_date[
'mon'] - $conf->global->SOCIETE_FISCAL_MONTH_START) % 3),
'm');
73 } elseif ($conf->global->MAIN_INFO_VAT_RETURN == 3) {
74 if ($current_date[
'mon'] < $conf->global->SOCIETE_FISCAL_MONTH_START) {
75 if (($conf->global->SOCIETE_FISCAL_MONTH_START - $current_date[
'mon']) > 6) {
79 if (($current_date[
'mon'] - $conf->global->SOCIETE_FISCAL_MONTH_START) < 6) {
83 $date_start =
dol_get_first_day($year_start, $conf->global->SOCIETE_FISCAL_MONTH_START,
false);
85 } elseif ($conf->global->MAIN_INFO_VAT_RETURN == 1) {
99 if (empty($min)) $min = 0;
103 $modetax = $conf->global->TAX_MODE;
105 if (empty($modetax)) $modetax = 0;
108 $socid =
GETPOST(
'socid',
'int');
109 if ($user->socid) $socid = $user->socid;
118 $form =
new Form($db);
119 $company_static =
new Societe($db);
120 $invoice_customer =
new Facture($db);
123 $product_static =
new Product($db);
124 $payment_static =
new Paiement($db);
128 $morequerystring =
'';
129 $listofparams = array(
'date_startmonth',
'date_startyear',
'date_startday',
'date_endmonth',
'date_endyear',
'date_endday');
130 foreach ($listofparams as $param)
132 if (
GETPOST($param) !=
'') $morequerystring .= ($morequerystring ?
'&' :
'').$param.
'='.
GETPOST($param);
136 llxHeader(
'', $title,
'',
'', 0, 0,
'',
'', $morequerystring);
142 $fsearch =
'<!-- hidden fields for form -->';
143 $fsearch .=
'<input type="hidden" name="token" value="'.newToken().
'">';
144 $fsearch .=
'<input type="hidden" name="modetax" value="'.$modetax.
'">';
150 $name = $langs->trans(
"VATReportByRates");
152 if ($modetax == 0) $calcmode = $langs->trans(
'OptionVATDefault');
153 if ($modetax == 1) $calcmode = $langs->trans(
'OptionVATDebitOption');
154 if ($modetax == 2) $calcmode = $langs->trans(
'OptionPaymentForProductAndServices');
155 $calcmode .=
' <span class="opacitymedium">('.$langs->trans(
"TaxModuleSetupToModifyRules", DOL_URL_ROOT.
'/admin/taxes.php').
')</span>';
157 $period = $form->selectDate($date_start,
'date_start', 0, 0, 0,
'', 1, 0).
' - '.$form->selectDate($date_end,
'date_end', 0, 0, 0,
'', 1, 0);
158 $prevyear = $year_start; $prevquarter = $q;
159 if ($prevquarter > 1) {
165 $nextyear = $year_start;
167 if ($nextquarter < 4) {
173 $description .= $fsearch;
176 if ($conf->global->TAX_MODE_SELL_PRODUCT ==
'invoice') $description .= $langs->trans(
"RulesVATDueProducts");
177 if ($conf->global->TAX_MODE_SELL_PRODUCT ==
'payment') $description .= $langs->trans(
"RulesVATInProducts");
178 if ($conf->global->TAX_MODE_SELL_SERVICE ==
'invoice') $description .=
'<br>'.$langs->trans(
"RulesVATDueServices");
179 if ($conf->global->TAX_MODE_SELL_SERVICE ==
'payment') $description .=
'<br>'.$langs->trans(
"RulesVATInServices");
180 if (!empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) {
181 $description .=
'<br>'.$langs->trans(
"DepositsAreNotIncluded");
183 if (!empty($conf->global->MAIN_MODULE_ACCOUNTING)) $description .=
'<br>'.$langs->trans(
"ThisIsAnEstimatedValue");
186 $elementcust = $langs->trans(
"CustomersInvoices");
187 $productcust = $langs->trans(
"ProductOrService");
188 $amountcust = $langs->trans(
"AmountHT");
189 $vatcust = $langs->trans(
"VATReceived");
190 $namecust = $langs->trans(
"Name");
191 if ($mysoc->tva_assuj) {
192 $vatcust .=
' ('.$langs->trans(
"VATToPay").
')';
196 $elementsup = $langs->trans(
"SuppliersInvoices");
197 $productsup = $productcust;
198 $amountsup = $amountcust;
199 $vatsup = $langs->trans(
"VATPaid");
200 $namesup = $namecust;
201 if ($mysoc->tva_assuj) {
202 $vatsup .=
' ('.$langs->trans(
"ToGetBack").
')';
205 $optioncss =
GETPOST(
'optioncss');
206 if ($optioncss !=
"print") {
207 report_header($name,
'', $period, $periodlink, $description, $builddate, $exportlink, array(), $calcmode);
210 $vatcust = $langs->trans(
"VATReceived");
211 $vatsup = $langs->trans(
"VATPaid");
212 $vatexpensereport = $langs->trans(
"VATPaid");
216 print '<div class="div-table-responsive">';
217 print '<table class="noborder centpercent">';
225 $x_coll =
tax_by_rate(
'vat', $db, 0, 0, $date_start, $date_end, $modetax,
'sell');
226 $x_paye =
tax_by_rate(
'vat', $db, 0, 0, $date_start, $date_end, $modetax,
'buy');
228 if (!is_array($x_coll) || !is_array($x_paye))
230 $langs->load(
"errors");
232 print '<tr><td colspan="'.$columns.
'">'.$langs->trans(
"ErrorNoAccountancyModuleLoaded").
'</td></tr>';
233 } elseif ($x_coll == -2) {
234 print '<tr><td colspan="'.$columns.
'">'.$langs->trans(
"FeatureNotYetAvailable").
'</td></tr>';
236 print '<tr><td colspan="'.$columns.
'">'.$langs->trans(
"Error").
'</td></tr>';
241 foreach (array_keys($x_coll) as $my_coll_rate)
243 $x_both[$my_coll_rate][
'coll'][
'totalht'] = $x_coll[$my_coll_rate][
'totalht'];
244 $x_both[$my_coll_rate][
'coll'][
'vat'] = $x_coll[$my_coll_rate][
'vat'];
245 $x_both[$my_coll_rate][
'paye'][
'totalht'] = 0;
246 $x_both[$my_coll_rate][
'paye'][
'vat'] = 0;
247 $x_both[$my_coll_rate][
'coll'][
'links'] =
'';
248 $x_both[$my_coll_rate][
'coll'][
'detail'] = array();
249 foreach ($x_coll[$my_coll_rate][
'facid'] as $id=>$dummy) {
250 $invoice_customer->id = $x_coll[$my_coll_rate][
'facid'][$id];
251 $invoice_customer->ref = $x_coll[$my_coll_rate][
'facnum'][$id];
252 $invoice_customer->type = $x_coll[$my_coll_rate][
'type'][$id];
253 $company_static->fetch($x_coll[$my_coll_rate][
'company_id'][$id]);
254 $x_both[$my_coll_rate][
'coll'][
'detail'][] = array(
255 'id' =>$x_coll[$my_coll_rate][
'facid'][$id],
256 'descr' =>$x_coll[$my_coll_rate][
'descr'][$id],
257 'pid' =>$x_coll[$my_coll_rate][
'pid'][$id],
258 'pref' =>$x_coll[$my_coll_rate][
'pref'][$id],
259 'ptype' =>$x_coll[$my_coll_rate][
'ptype'][$id],
260 'payment_id'=>$x_coll[$my_coll_rate][
'payment_id'][$id],
261 'payment_amount'=>$x_coll[$my_coll_rate][
'payment_amount'][$id],
262 'ftotal_ttc'=>$x_coll[$my_coll_rate][
'ftotal_ttc'][$id],
263 'dtotal_ttc'=>$x_coll[$my_coll_rate][
'dtotal_ttc'][$id],
264 'dtype' =>$x_coll[$my_coll_rate][
'dtype'][$id],
265 'datef' =>$x_coll[$my_coll_rate][
'datef'][$id],
266 'datep' =>$x_coll[$my_coll_rate][
'datep'][$id],
267 'company_link'=>$company_static->getNomUrl(1,
'', 20),
268 'ddate_start'=>$x_coll[$my_coll_rate][
'ddate_start'][$id],
269 'ddate_end' =>$x_coll[$my_coll_rate][
'ddate_end'][$id],
270 'totalht' =>$x_coll[$my_coll_rate][
'totalht_list'][$id],
271 'vat' =>$x_coll[$my_coll_rate][
'vat_list'][$id],
272 'link' =>$invoice_customer->getNomUrl(1,
'', 12)
277 foreach (array_keys($x_paye) as $my_paye_rate) {
278 $x_both[$my_paye_rate][
'paye'][
'totalht'] = $x_paye[$my_paye_rate][
'totalht'];
279 $x_both[$my_paye_rate][
'paye'][
'vat'] = $x_paye[$my_paye_rate][
'vat'];
280 if (!isset($x_both[$my_paye_rate][
'coll'][
'totalht'])) {
281 $x_both[$my_paye_rate][
'coll'][
'totalht'] = 0;
282 $x_both[$my_paye_rate][
'coll'][
'vat'] = 0;
284 $x_both[$my_paye_rate][
'paye'][
'links'] =
'';
285 $x_both[$my_paye_rate][
'paye'][
'detail'] = array();
287 foreach ($x_paye[$my_paye_rate][
'facid'] as $id=>$dummy)
290 if ($x_paye[$my_paye_rate][
'ptype'][$id] ==
'ExpenseReportPayment')
292 $expensereport->id = $x_paye[$my_paye_rate][
'facid'][$id];
293 $expensereport->ref = $x_paye[$my_paye_rate][
'facnum'][$id];
294 $expensereport->type = $x_paye[$my_paye_rate][
'type'][$id];
296 $x_both[$my_paye_rate][
'paye'][
'detail'][] = array(
297 'id' =>$x_paye[$my_paye_rate][
'facid'][$id],
298 'descr' =>$x_paye[$my_paye_rate][
'descr'][$id],
299 'pid' =>$x_paye[$my_paye_rate][
'pid'][$id],
300 'pref' =>$x_paye[$my_paye_rate][
'pref'][$id],
301 'ptype' =>$x_paye[$my_paye_rate][
'ptype'][$id],
302 'payment_id' =>$x_paye[$my_paye_rate][
'payment_id'][$id],
303 'payment_amount' =>$x_paye[$my_paye_rate][
'payment_amount'][$id],
304 'ftotal_ttc' =>
price2num($x_paye[$my_paye_rate][
'ftotal_ttc'][$id]),
305 'dtotal_ttc' =>
price2num($x_paye[$my_paye_rate][
'dtotal_ttc'][$id]),
306 'dtype' =>$x_paye[$my_paye_rate][
'dtype'][$id],
307 'ddate_start' =>$x_paye[$my_paye_rate][
'ddate_start'][$id],
308 'ddate_end' =>$x_paye[$my_paye_rate][
'ddate_end'][$id],
309 'totalht' =>
price2num($x_paye[$my_paye_rate][
'totalht_list'][$id]),
310 'vat' =>$x_paye[$my_paye_rate][
'vat_list'][$id],
311 'link' =>$expensereport->getNomUrl(1)
314 $invoice_supplier->id = $x_paye[$my_paye_rate][
'facid'][$id];
315 $invoice_supplier->ref = $x_paye[$my_paye_rate][
'facnum'][$id];
316 $invoice_supplier->type = $x_paye[$my_paye_rate][
'type'][$id];
317 $company_static->fetch($x_paye[$my_paye_rate][
'company_id'][$id]);
318 $x_both[$my_paye_rate][
'paye'][
'detail'][] = array(
319 'id' =>$x_paye[$my_paye_rate][
'facid'][$id],
320 'descr' =>$x_paye[$my_paye_rate][
'descr'][$id],
321 'pid' =>$x_paye[$my_paye_rate][
'pid'][$id],
322 'pref' =>$x_paye[$my_paye_rate][
'pref'][$id],
323 'ptype' =>$x_paye[$my_paye_rate][
'ptype'][$id],
324 'payment_id'=>$x_paye[$my_paye_rate][
'payment_id'][$id],
325 'payment_amount'=>$x_paye[$my_paye_rate][
'payment_amount'][$id],
326 'ftotal_ttc'=>
price2num($x_paye[$my_paye_rate][
'ftotal_ttc'][$id]),
327 'dtotal_ttc'=>
price2num($x_paye[$my_paye_rate][
'dtotal_ttc'][$id]),
328 'dtype' =>$x_paye[$my_paye_rate][
'dtype'][$id],
329 'datef' =>$x_paye[$my_paye_rate][
'datef'][$id],
330 'datep' =>$x_paye[$my_paye_rate][
'datep'][$id],
331 'company_link'=>$company_static->getNomUrl(1,
'', 20),
332 'ddate_start'=>$x_paye[$my_paye_rate][
'ddate_start'][$id],
333 'ddate_end' =>$x_paye[$my_paye_rate][
'ddate_end'][$id],
334 'totalht' =>
price2num($x_paye[$my_paye_rate][
'totalht_list'][$id]),
335 'vat' =>$x_paye[$my_paye_rate][
'vat_list'][$id],
336 'link' =>$invoice_supplier->getNomUrl(1,
'', 12)
352 if ($modetax != 1) $span += 2;
357 print '<tr class="liste_titre">';
358 print '<td class="left">'.$elementcust.
'</td>';
359 print '<td class="left">'.$langs->trans(
"DateInvoice").
'</td>';
360 if ($conf->global->TAX_MODE_SELL_PRODUCT ==
'payment' || $conf->global->TAX_MODE_SELL_SERVICE ==
'payment')
print '<td class="left">'.$langs->trans(
"DatePayment").
'</td>';
361 else print '<td></td>';
362 print '<td class="left">'.$namecust.
'</td>';
363 print '<td class="left">'.$productcust.
'</td>';
366 print '<td class="right">'.$amountcust.
'</td>';
367 print '<td class="right">'.$langs->trans(
"Payment").
' ('.$langs->trans(
"PercentOfInvoice").
')</td>';
369 print '<td class="right">'.$langs->trans(
"AmountHTVATRealReceived").
'</td>';
370 print '<td class="right">'.$vatcust.
'</td>';
373 $action =
"tvadetail";
374 $parameters[
"mode"] = $modetax;
375 $parameters[
"start"] = $date_start;
376 $parameters[
"end"] = $date_end;
377 $parameters[
"type"] =
'vat';
379 $object = array(&$x_coll, &$x_paye, &$x_both);
381 $hookmanager->initHooks(array(
'externalbalance'));
382 $reshook = $hookmanager->executeHooks(
'addVatLine', $parameters, $object, $action);
384 foreach (array_keys($x_coll) as $rate) {
385 $subtot_coll_total_ht = 0;
386 $subtot_coll_vat = 0;
388 if (is_array($x_both[$rate][
'coll'][
'detail']))
392 print '<td class="tax_rate">'.$langs->trans(
"Rate").
': '.
vatrate($rate).
'%</td><td colspan="'.($span + 1).
'"></td>';
395 foreach ($x_both[$rate][
'coll'][
'detail'] as $index => $fields) {
398 $type = (isset($fields[
'dtype']) ? $fields[
'dtype'] : $fields[
'ptype']);
401 if (!empty($fields[
'ddate_start'])) {
404 if (!empty($fields[
'ddate_end'])) {
409 print '<tr class="oddeven">';
412 print '<td class="nowrap left">'.$fields[
'link'].
'</td>';
415 print '<td class="left">'.dol_print_date($fields[
'datef'],
'day').
'</td>';
418 if ($conf->global->TAX_MODE_SELL_PRODUCT ==
'payment' || $conf->global->TAX_MODE_SELL_SERVICE ==
'payment')
print '<td class="left">'.dol_print_date($fields[
'datep'],
'day').
'</td>';
419 else print '<td></td>';
422 print '<td class="left">'.$fields[
'company_link'].
'</td>';
425 print '<td class="left">';
428 $product_static->id = $fields[
'pid'];
429 $product_static->ref = $fields[
'pref'];
430 $product_static->type = $fields[
'dtype'];
431 print $product_static->getNomUrl(1);
437 $text =
img_object($langs->trans(
'Service'),
'service');
439 $text =
img_object($langs->trans(
'Product'),
'product');
441 if (preg_match(
'/^\((.*)\)$/', $fields[
'descr'], $reg)) {
442 if ($reg[1] ==
'DEPOSIT') {
443 $fields[
'descr'] = $langs->transnoentitiesnoconv(
'Deposit');
444 } elseif ($reg[1] ==
'CREDIT_NOTE') {
445 $fields[
'descr'] = $langs->transnoentitiesnoconv(
'CreditNote');
447 $fields[
'descr'] = $langs->transnoentitiesnoconv($reg[1]);
460 print '<td class="nowrap right">';
465 $ratiolineinvoice = ($fields[
'dtotal_ttc'] / $fields[
'ftotal_ttc']);
472 $ratiopaymentinvoice = 1;
475 print '<td class="nowrap right">';
477 if ($fields[
'payment_amount'] && $fields[
'ftotal_ttc'])
479 $payment_static->id = $fields[
'payment_id'];
480 print $payment_static->getNomUrl(2);
482 if (($type == 0 && $conf->global->TAX_MODE_SELL_PRODUCT ==
'invoice')
483 || ($type == 1 && $conf->global->TAX_MODE_SELL_SERVICE ==
'invoice'))
485 print $langs->trans(
"NA");
487 if (isset($fields[
'payment_amount']) &&
price2num($fields[
'ftotal_ttc'])) {
488 $ratiopaymentinvoice = ($fields[
'payment_amount'] / $fields[
'ftotal_ttc']);
491 if (isset($fields[
'payment_amount'])) {
492 print ' ('.round($ratiopaymentinvoice * 100, 2).
'%)';
499 print '<td class="nowrap right">';
500 $temp_ht = $fields[
'totalht'] * $ratiopaymentinvoice;
505 print '<td class="nowrap right">';
506 $temp_vat = $fields[
'vat'] * $ratiopaymentinvoice;
512 $subtot_coll_total_ht += $temp_ht;
513 $subtot_coll_vat += $temp_vat;
514 $x_coll_sum += $temp_vat;
518 print '<tr class="liste_total">';
519 print '<td colspan="4"></td>';
520 print '<td class="right">'.$langs->trans(
"Total").
':</td>';
522 print '<td class="nowrap right"> </td>';
523 print '<td class="right"> </td>';
525 print '<td class="right">'.price(
price2num($subtot_coll_total_ht,
'MT')).
'</td>';
526 print '<td class="nowrap right">'.price(
price2num($subtot_coll_vat,
'MT')).
'</td>';
530 if (count($x_coll) == 0)
532 print '<tr class="liste_total">';
533 print '<td colspan="4"></td>';
534 print '<td class="right">'.$langs->trans(
"Total").
':</td>';
536 print '<td class="nowrap right"> </td>';
537 print '<td class="right"> </td>';
540 print '<td class="nowrap right">'.price(
price2num(0,
'MT')).
'</td>';
545 print '<tr><td colspan="'.($span + 2).
'"> </td></tr>';
548 print '<tr class="liste_titre liste_titre_topborder">';
549 print
'<td class="left">'.$elementsup.
'</td>';
550 print
'<td class="left">'.$langs->trans(
"DateInvoice").
'</td>';
551 if ($conf->global->TAX_MODE_BUY_PRODUCT ==
'payment' || $conf->global->TAX_MODE_BUY_SERVICE ==
'payment') print
'<td class="left">'.$langs->trans(
"DatePayment").
'</td>';
552 else print
'<td></td>';
553 print
'<td class="left">'.$namesup.
'</td>';
554 print
'<td class="left">'.$productsup.
'</td>';
556 print
'<td class="right">'.$amountsup.
'</td>';
557 print
'<td class="right">'.$langs->trans(
"Payment").
' ('.$langs->trans(
"PercentOfInvoice").
')</td>';
559 print
'<td class="right">'.$langs->trans(
"AmountHTVATRealPaid").
'</td>';
560 print
'<td class="right">'.$vatsup.
'</td>';
563 foreach (array_keys($x_paye) as $rate)
565 $subtot_paye_total_ht = 0;
566 $subtot_paye_vat = 0;
568 if (is_array($x_both[$rate][
'paye'][
'detail']))
571 print
'<td class="tax_rate">'.$langs->trans(
"Rate").
': '.
vatrate($rate).
'%</td><td colspan="'.($span + 1).
'"></td>';
574 foreach ($x_both[$rate][
'paye'][
'detail'] as $index=>$fields) {
577 $type = (isset($fields[
'dtype']) ? $fields[
'dtype'] : $fields[
'ptype']);
580 if (!empty($fields[
'ddate_start'])) {
583 if (!empty($fields[
'ddate_end'])) {
588 print
'<tr class="oddeven">';
591 print
'<td class="nowrap left">'.$fields[
'link'].
'</td>';
594 print
'<td class="left">'.dol_print_date($fields[
'datef'],
'day').
'</td>';
597 if ($conf->global->TAX_MODE_BUY_PRODUCT ==
'payment' || $conf->global->TAX_MODE_BUY_SERVICE ==
'payment') print
'<td class="left">'.dol_print_date($fields[
'datep'],
'day').
'</td>';
598 else print
'<td></td>';
601 print
'<td class="left">'.$fields[
'company_link'].
'</td>';
604 print
'<td class="left">';
607 $product_static->id = $fields[
'pid'];
608 $product_static->ref = $fields[
'pref'];
609 $product_static->type = $fields[
'dtype'];
610 print $product_static->getNomUrl(1);
616 $text =
img_object($langs->trans(
'Service'),
'service');
618 $text =
img_object($langs->trans(
'Product'),
'product');
620 if (preg_match(
'/^\((.*)\)$/', $fields[
'descr'], $reg)) {
621 if ($reg[1] ==
'DEPOSIT') {
622 $fields[
'descr'] = $langs->transnoentitiesnoconv(
'Deposit');
623 } elseif ($reg[1] ==
'CREDIT_NOTE') {
624 $fields[
'descr'] = $langs->transnoentitiesnoconv(
'CreditNote');
626 $fields[
'descr'] = $langs->transnoentitiesnoconv($reg[1]);
639 print
'<td class="nowrap right">';
640 print
price($fields[
'totalht']);
644 $ratiolineinvoice = ($fields[
'dtotal_ttc'] / $fields[
'ftotal_ttc']);
651 $ratiopaymentinvoice = 1;
654 print
'<td class="nowrap right">';
655 if ($fields[
'payment_amount'] && $fields[
'ftotal_ttc'])
657 $paymentfourn_static->id = $fields[
'payment_id'];
658 print $paymentfourn_static->getNomUrl(2);
661 if (($type == 0 && $conf->global->TAX_MODE_BUY_PRODUCT ==
'invoice')
662 || ($type == 1 && $conf->global->TAX_MODE_BUY_SERVICE ==
'invoice'))
664 print $langs->trans(
"NA");
666 if (isset($fields[
'payment_amount']) && $fields[
'ftotal_ttc']) {
667 $ratiopaymentinvoice = ($fields[
'payment_amount'] / $fields[
'ftotal_ttc']);
670 if (isset($fields[
'payment_amount'])) {
671 print
' ('.round($ratiopaymentinvoice * 100, 2).
'%)';
678 print
'<td class="nowrap right">';
679 $temp_ht = $fields[
'totalht'] * $ratiopaymentinvoice;
684 print
'<td class="nowrap right">';
685 $temp_vat = $fields[
'vat'] * $ratiopaymentinvoice;
691 $subtot_paye_total_ht += $temp_ht;
692 $subtot_paye_vat += $temp_vat;
693 $x_paye_sum += $temp_vat;
697 print
'<tr class="liste_total">';
698 print
'<td colspan="4"></td>';
699 print
'<td class="right">'.$langs->trans(
"Total").
':</td>';
701 print
'<td class="nowrap right"> </td>';
702 print
'<td class="right"> </td>';
704 print
'<td class="right">'.price(
price2num($subtot_paye_total_ht,
'MT')).
'</td>';
705 print
'<td class="nowrap right">'.price(
price2num($subtot_paye_vat,
'MT')).
'</td>';
709 if (count($x_paye) == 0) {
710 print
'<tr class="liste_total">';
711 print
'<td colspan="4"></td>';
712 print
'<td class="right">'.$langs->trans(
"Total").
':</td>';
714 print
'<td class="nowrap right"> </td>';
715 print
'<td class="right"> </td>';
717 print
'<td class="right">'.price(
price2num(0,
'MT')).
'</td>';
718 print
'<td class="nowrap right">'.price(
price2num(0,
'MT')).
'</td>';
727 print
'<table class="noborder centpercent">';
728 $diff = $x_coll_sum - $x_paye_sum;
729 print
'<tr class="liste_total">';
730 print
'<td class="liste_total" colspan="'.$span.
'">'.$langs->trans(
"TotalToPay").($q ?
', '.$langs->trans(
"Quadri").
' '.$q :
'').
'</td>';
731 print
'<td class="liste_total nowrap right"><b>'.price(
price2num($diff,
'MT')).
"</b></td>\n";
GETPOST($paramname, $check= 'alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
dol_string_nohtmltag($stringtoclean, $removelinefeed=1, $pagecodeto= 'UTF-8', $strip_tags=0, $removedoublespaces=1)
Clean a string from all HTML tags and entities.
dol_mktime($hour, $minute, $second, $month, $day, $year, $gm= 'auto', $check=1)
Return a timestamp date built from detailed informations (by default a local PHP server timestamp) Re...
Class to manage products or services.
dol_now($mode= 'auto')
Return date for now.
report_header($reportname, $notused, $period, $periodlink, $description, $builddate, $exportlink= '', $moreparam=array(), $calcmode= '', $varlink= '')
Show header of a report.
dol_get_first_day($year, $month=1, $gm=false)
Return GMT time for first day of a month or year.
Class to manage suppliers invoices.
price($amount, $form=0, $outlangs= '', $trunc=1, $rounding=-1, $forcerounding=-1, $currency_code= '')
Function to format a value into an amount for visual output Function used into PDF and HTML pages...
tax_by_rate($type, $db, $y, $q, $date_start, $date_end, $modetax, $direction, $m=0)
Gets Tax to collect for the given year (and given quarter or month) The function gets the Tax in spli...
GETPOSTISSET($paramname)
Return true if we are in a context of submitting the parameter $paramname.
Class to manage third parties objects (customers, suppliers, prospects...)
price2num($amount, $rounding= '', $option=0)
Function that return a number with universal decimal format (decimal separator is '...
Class to manage payments of customer invoices.
dol_getdate($timestamp, $fast=false, $forcetimezone= '')
Return an array with locale date info.
img_object($titlealt, $picto, $moreatt= '', $pictoisfullpath=false, $srconly=0, $notitle=0)
Show a picto called object_picto (generic function)
restrictedArea($user, $features, $objectid=0, $tableandshare= '', $feature2= '', $dbt_keyfield= 'fk_soc', $dbt_select= 'rowid', $isdraft=0)
Check permissions of a user to show a page and an object.
Class to manage Trips and Expenses.
vatrate($rate, $addpercent=false, $info_bits=0, $usestarfornpr=0)
Return a string with VAT rate label formated for view output Used into pdf and HTML pages...
dol_get_last_day($year, $month=12, $gm=false)
Return GMT time for last day of a month or year.
print
Draft customers invoices.
dol_print_date($time, $format= '', $tzoutput= 'auto', $outputlangs= '', $encodetooutput=false)
Output date in a string format according to outputlangs (or langs if not defined).
Class to manage payments of expense report.
dol_trunc($string, $size=40, $trunc= 'right', $stringencoding= 'UTF-8', $nodot=0, $display=0)
Truncate a string to a particular length adding '...' if string larger than length.
print_date_range($date_start, $date_end, $format= '', $outputlangs= '')
Format output for start and end date.
Class to manage invoices.
Class to manage payments for supplier invoices.
dol_time_plus_duree($time, $duration_value, $duration_unit)
Add a delay to a date.