37 require
'../../main.inc.php';
38 require_once DOL_DOCUMENT_ROOT.
'/fourn/class/fournisseur.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.
'/core/class/html.formother.class.php';
42 require_once DOL_DOCUMENT_ROOT.
'/core/lib/date.lib.php';
43 require_once DOL_DOCUMENT_ROOT.
'/core/lib/files.lib.php';
46 $langs->loadLangs(array(
'companies',
'bills',
'banks',
'compta'));
48 $action =
GETPOST(
'action',
'alpha');
49 $confirm =
GETPOST(
'confirm',
'alpha');
50 $optioncss =
GETPOST(
'optioncss',
'alpha');
51 $cancel =
GETPOST(
'cancel',
'alpha');
52 $backtopage =
GETPOST(
'backtopage',
'alpha');
53 $backtopageforcancel =
GETPOST(
'backtopageforcancel',
'alpha');
55 $facid =
GETPOST(
'facid',
'int');
56 $socid =
GETPOST(
'socid',
'int');
57 $accountid =
GETPOST(
'accountid',
'int');
59 $month =
GETPOST(
'month',
'int');
62 $search_ref =
GETPOST(
'search_ref',
'alpha');
63 $search_account =
GETPOST(
'search_account',
'int');
64 $search_paymenttype =
GETPOST(
'search_paymenttype');
65 $search_amount =
GETPOST(
'search_amount',
'alpha');
66 $search_company =
GETPOST(
'search_company',
'alpha');
67 $search_payment_num =
GETPOST(
'search_payment_num',
'alpha');
69 $limit =
GETPOST(
'limit',
'int') ?
GETPOST(
'limit',
'int') : $conf->liste_limit;
70 $sortfield =
GETPOST(
'sortfield',
'aZ09comma');
71 $sortorder =
GETPOST(
'sortorder',
'aZ09comma');
73 if (empty($page) || $page == -1) {
76 $offset = $limit * $page;
77 $pageprev = $page - 1;
78 $pagenext = $page + 1;
83 $sortfield =
"p.rowid";
87 $amountsresttopay = array();
90 $multicurrency_amounts = array();
91 $multicurrency_amountsresttopay = array();
94 if ($user->socid > 0) {
95 $socid = $user->socid;
101 $hookmanager->initHooks(array(
'paymentsupplierlist'));
105 $extrafields->fetch_name_optionals_label($object->table_element);
107 $search_array_options = $extrafields->getOptionalsFromPost($object->table_element,
'',
'search_');
109 $arrayfields = array();
118 if (!empty($backtopageforcancel)) {
119 header(
"Location: ".$backtopageforcancel);
121 } elseif (!empty($backtopage)) {
122 header(
"Location: ".$backtopage);
125 header(
"Location: ".DOL_URL_ROOT.
'/fourn/facture/list.php');
129 if (
GETPOST(
'button_removefilter_x',
'alpha') ||
GETPOST(
'button_removefilter.x',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')) {
131 $search_account =
"";
133 $search_paymenttype =
"";
134 $search_payment_num =
"";
135 $search_company =
"";
139 $search_array_options = array();
142 $parameters = array(
'socid'=>$socid);
143 $reshook = $hookmanager->executeHooks(
'doActions', $parameters, $object, $action);
148 if (empty($reshook)) {
149 if ($action ==
'add_paiement' || ($action ==
'confirm_paiement' && $confirm ==
'yes')) {
155 $atleastonepaymentnotnull = 0;
156 $multicurrency_totalpayment = 0;
160 foreach ($_POST as $key => $value) {
161 if (substr($key, 0, 7) ==
'amount_') {
162 $cursorfacid = substr($key, 7);
164 if (!empty($amounts[$cursorfacid])) {
165 $atleastonepaymentnotnull++;
166 if (is_numeric($amounts[$cursorfacid])) {
167 $totalpayment = $totalpayment + $amounts[$cursorfacid];
172 $result = $tmpinvoice->fetch($cursorfacid);
176 $amountsresttopay[$cursorfacid] =
price2num($tmpinvoice->total_ttc - $tmpinvoice->getSommePaiement());
177 if ($amounts[$cursorfacid]) {
179 if ($amounts[$cursorfacid] && (abs($amounts[$cursorfacid]) > abs($amountsresttopay[$cursorfacid]))) {
181 $formquestion[
'text'] =
img_warning($langs->trans(
"PaymentHigherThanReminderToPaySupplier")).
' '.$langs->trans(
"HelpPaymentHigherThanReminderToPaySupplier");
184 if ($datepaye && ($datepaye < $tmpinvoice->date)) {
185 $langs->load(
"errors");
191 $formquestion[$i++] = array(
'type' =>
'hidden',
'name' => $key,
'value' =>
GETPOST($key));
192 } elseif (substr($key, 0, 21) ==
'multicurrency_amount_') {
193 $cursorfacid = substr($key, 21);
195 $multicurrency_totalpayment += $multicurrency_amounts[$cursorfacid];
196 if (!empty($multicurrency_amounts[$cursorfacid])) {
197 $atleastonepaymentnotnull++;
199 $result = $tmpinvoice->fetch($cursorfacid);
203 $multicurrency_amountsresttopay[$cursorfacid] =
price2num($tmpinvoice->multicurrency_total_ttc - $tmpinvoice->getSommePaiement(1));
204 if ($multicurrency_amounts[$cursorfacid]) {
206 if ($multicurrency_amounts[$cursorfacid] && (abs($multicurrency_amounts[$cursorfacid]) > abs($multicurrency_amountsresttopay[$cursorfacid]))) {
208 $formquestion[
'text'] =
img_warning($langs->trans(
"PaymentHigherThanReminderToPaySupplier")).
' '.$langs->trans(
"HelpPaymentHigherThanReminderToPaySupplier");
211 if ($datepaye && ($datepaye < $tmpinvoice->date)) {
212 $langs->load(
"errors");
218 $formquestion[$i++] = array(
'type' =>
'hidden',
'name' => $key,
'value' =>
GETPOST($key,
'int'));
223 if (
GETPOST(
'paiementid') <= 0) {
224 setEventMessages($langs->transnoentities(
'ErrorFieldRequired', $langs->transnoentities(
'PaymentMode')),
null,
'errors');
230 if (
GETPOST(
'accountid') <= 0) {
231 setEventMessages($langs->transnoentities(
'ErrorFieldRequired', $langs->transnoentities(
'AccountToCredit')),
null,
'errors');
236 if (empty($totalpayment) && empty($multicurrency_totalpayment) && empty($atleastonepaymentnotnull)) {
237 setEventMessages($langs->transnoentities(
'ErrorFieldRequired', $langs->trans(
'PaymentAmount')),
null,
'errors');
241 if (empty($datepaye)) {
242 setEventMessages($langs->transnoentities(
'ErrorFieldRequired', $langs->transnoentities(
'Date')),
null,
'errors');
247 if ($totalpayment > 0 && $multicurrency_totalpayment > 0) {
248 setEventMessages($langs->transnoentities(
'ErrorPaymentInBothCurrency'),
null,
'errors');
256 if ($action ==
'add_paiement') {
267 if ($action ==
'confirm_paiement' && $confirm ==
'yes') {
272 $multicurrency_code = array();
275 foreach ($amounts as $key => $value) {
277 $tmpinvoice->fetch($key);
280 $amounts[$key] = - abs($newvalue);
282 $multicurrency_code[$key] = $tmpinvoice->multicurrency_code;
285 foreach ($multicurrency_amounts as $key => $value) {
287 $tmpinvoice->fetch($key);
290 $multicurrency_amounts[$key] = - abs($newvalue);
292 $multicurrency_code[$key] = $tmpinvoice->multicurrency_code;
302 $thirdparty =
new Societe($db);
304 $thirdparty->fetch($socid);
309 $paiement->datepaye = $datepaye;
310 $paiement->amounts = $amounts;
311 $paiement->multicurrency_amounts = $multicurrency_amounts;
312 $paiement->multicurrency_code = $multicurrency_code;
313 $paiement->paiementid =
GETPOST(
'paiementid',
'int');
314 $paiement->num_payment =
GETPOST(
'num_paiement',
'alphanohtml');
315 $paiement->note_private =
GETPOST(
'comment',
'alpha');
316 $paiement->fk_account =
GETPOST(
'accountid',
'int');
322 $paiement_id = $paiement->create($user, (
GETPOST(
'closepaidinvoices') ==
'on' ? 1 : 0), $thirdparty);
323 if ($paiement_id < 0) {
330 $result = $paiement->addPaymentToBank($user,
'payment_supplier',
'(SupplierInvoicePayment)', $accountid,
GETPOST(
'chqemetteur'),
GETPOST(
'chqbank'));
342 foreach ($paiement->amounts as $key => $amount) {
344 if (is_numeric($amount) && $amount <> 0) {
345 if ($invoiceid != 0) {
352 if ($invoiceid > 0) {
353 $loc = DOL_URL_ROOT.
'/fourn/facture/card.php?facid='.$invoiceid;
355 $loc = DOL_URL_ROOT.
'/fourn/paiement/card.php?id='.$paiement_id;
357 header(
'Location: '.$loc);
374 $supplierstatic =
new Societe($db);
377 llxHeader(
'', $langs->trans(
'ListPayment'));
379 if ($action ==
'create' || $action ==
'confirm_paiement' || $action ==
'add_paiement') {
381 $result = $object->fetch($facid);
384 $dateinvoice = ($datefacture ==
'' ? (empty($conf->global->MAIN_AUTOFILL_DATE) ?-1 :
'') : $datefacture);
386 $sql =
'SELECT s.nom as name, s.rowid as socid,';
387 $sql .=
' f.rowid, f.ref, f.ref_supplier, f.total_ttc as total, f.fk_mode_reglement, f.fk_account';
388 if (empty($user->rights->societe->client->voir) && !$socid) {
389 $sql .=
", sc.fk_soc, sc.fk_user ";
391 $sql .=
' FROM '.MAIN_DB_PREFIX.
'societe as s, '.MAIN_DB_PREFIX.
'facture_fourn as f';
392 if (empty($user->rights->societe->client->voir) && !$socid) {
393 $sql .=
", ".MAIN_DB_PREFIX.
"societe_commerciaux as sc";
395 $sql .=
' WHERE f.fk_soc = s.rowid';
396 $sql .=
' AND f.rowid = '.((int) $facid);
397 if (empty($user->rights->societe->client->voir) && !$socid) {
398 $sql .=
" AND s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $user->id);
400 $resql = $db->query($sql);
402 $num = $db->num_rows(
$resql);
404 $obj = $db->fetch_object(
$resql);
405 $total = $obj->total;
410 if (!empty($conf->use_javascript_ajax)) {
411 print
"\n".
'<script type="text/javascript">';
412 print
'$(document).ready(function () {
414 function _elemToJson(selector)
417 $.map(selector.serializeArray(), function(n,i)
419 subJson[n["name"]] = n["value"];
424 function callForResult(imgId)
426 console.log("callForResult Calculate total of payment");
428 var form = $("#payment_form");
430 json["invoice_type"] = $("#invoice_type").val();
431 json["amountPayment"] = $("#amountpayment").attr("value");
432 json["amounts"] = _elemToJson(form.find("input.amount"));
433 json["remains"] = _elemToJson(form.find("input.remain"));
434 json["token"] = "'.currentToken().
'";
436 json["imgClicked"] = imgId;
439 $.post("'.DOL_URL_ROOT.
'/compta/ajaxpayment.php", json, function(data)
441 json = $.parseJSON(data);
445 for (var key in json)
447 if (key == "result") {
448 if (json["makeRed"]) {
449 $("#"+key).addClass("error");
451 $("#"+key).removeClass("error");
453 json[key]=json["label"]+" "+json[key];
454 $("#"+key).text(json[key]);
455 } else {console.log(key);
456 form.find("input[name*=\""+key+"\"]").each(function() {
457 $(this).attr("value", json[key]);
464 $("#payment_form").find("input.amount").change(function() {
467 $("#payment_form").find("input.amount").keyup(function() {
475 print
' $(document).ready(function () {';
476 print
' $(".AutoFillAmout").on(\'click touchstart\', function(){
477 $("input[name="+$(this).data(\'rowname\')+"]").val($(this).data("value")).trigger("change");
481 print
' </script>'.
"\n";
484 print
'<form id="payment_form" name="addpaiement" action="'.$_SERVER[
"PHP_SELF"].
'" method="POST">';
485 print
'<input type="hidden" name="token" value="'.newToken().
'">';
486 print
'<input type="hidden" name="action" value="add_paiement">';
487 print
'<input type="hidden" name="facid" value="'.$facid.
'">';
488 print
'<input type="hidden" name="ref_supplier" value="'.$obj->ref_supplier.
'">';
489 print
'<input type="hidden" name="socid" value="'.$obj->socid.
'">';
490 print
'<input type="hidden" name="type" id="invoice_type" value="'.$object->type.
'">';
491 print
'<input type="hidden" name="societe" value="'.$obj->name.
'">';
495 print
'<table class="border centpercent">';
497 print
'<tr><td class="fieldrequired titlefieldcreate">'.$langs->trans(
'Company').
'</td><td>';
498 $supplierstatic->id = $obj->socid;
499 $supplierstatic->name = $obj->name;
500 print $supplierstatic->getNomUrl(1,
'supplier');
502 print
'<tr><td class="fieldrequired">'.$langs->trans(
'Date').
'</td><td>';
503 print
$form->selectDate($dateinvoice,
'',
'',
'', 0,
"addpaiement", 1, 1, 0,
'',
'', $object->date);
505 print
'<tr><td class="fieldrequired">'.$langs->trans(
'PaymentMode').
'</td><td>';
506 $form->select_types_paiements(!
GETPOST(
'paiementid') ? $obj->fk_mode_reglement :
GETPOST(
'paiementid'),
'paiementid');
509 print
'<tr><td class="fieldrequired">'.$langs->trans(
'Account').
'</td><td>';
510 print
img_picto(
'',
'bank_account',
'class="pictofixedwidth"');
511 print
$form->select_comptes(empty($accountid) ? $obj->fk_account : $accountid,
'accountid', 0,
'', 2,
'', 0,
'widthcentpercentminusx maxwidth500', 1);
514 print
'<tr><td> </td></tr>';
516 print
'<tr><td>'.$langs->trans(
'Numero').
'</td><td><input name="num_paiement" type="text" value="'.(!
GETPOST(
'num_paiement') ?
'' :
GETPOST(
'num_paiement')).
'"></td></tr>';
517 print
'<tr><td>'.$langs->trans(
'Comments').
'</td>';
518 print
'<td class="tdtop">';
519 print
'<textarea name="comment" wrap="soft" class="quatrevingtpercent" rows="'.ROWS_3.
'">'.(!
GETPOST(
'comment') ?
'' :
GETPOST(
'comment')).
'</textarea></td></tr>';
524 $parameters = array(
'facid'=>$facid,
'ref'=>$ref,
'objcanvas'=>$objcanvas);
525 $reshook = $hookmanager->executeHooks(
'paymentsupplierinvoices', $parameters, $object, $action);
526 $error = $hookmanager->error; $errors = $hookmanager->errors;
527 if (empty($reshook)) {
531 $sql =
'SELECT f.rowid as facid, f.ref, f.ref_supplier, f.type, f.total_ht, f.total_ttc,';
532 $sql .=
' f.multicurrency_code, f.multicurrency_tx, f.multicurrency_total_ht, f.multicurrency_total_tva, f.multicurrency_total_ttc,';
533 $sql .=
' f.datef as df, f.date_lim_reglement as dlr,';
534 $sql .=
' SUM(pf.amount) as am, SUM(pf.multicurrency_amount) as multicurrency_am';
535 $sql .=
' FROM '.MAIN_DB_PREFIX.
'facture_fourn as f';
536 $sql .=
' LEFT JOIN '.MAIN_DB_PREFIX.
'paiementfourn_facturefourn as pf ON pf.fk_facturefourn = f.rowid';
537 $sql .=
" WHERE f.entity = ".((int) $conf->entity);
538 $sql .=
' AND f.fk_soc = '.((int) $object->socid);
539 $sql .=
' AND f.paye = 0';
540 $sql .=
' AND f.fk_statut = 1';
542 $sql .=
' AND f.type IN (0,1,3,5)';
544 $sql .=
' AND f.type = 2';
547 $sql .=
' GROUP BY f.datef, f.ref, f.ref_supplier, f.rowid, f.type, f.total_ht, f.total_ttc,';
548 $sql .=
' f.multicurrency_code, f.multicurrency_tx, f.multicurrency_total_ht, f.multicurrency_total_tva, f.multicurrency_total_ttc,';
549 $sql .=
' f.datef, f.date_lim_reglement';
551 $sql .=
' ORDER BY f.datef ASC, f.ref ASC';
553 $resql = $db->query($sql);
555 $num = $db->num_rows(
$resql);
560 if (!empty($conf->use_javascript_ajax)) {
562 print
"\n".
'<script type="text/javascript">';
563 print
' $(document).ready(function () {';
564 print
' $(".AutoFillAmout").on(\'click touchstart\', function(){
565 $("input[name="+$(this).data(\'rowname\')+"]").val($(this).data("value"));
568 print
' </script>'.
"\n";
571 print
'<div class="div-table-responsive-no-min">';
572 print
'<table class="tagtable liste'.($moreforfilter ?
" listwithfilterbefore" :
"").
'">'.
"\n";
574 print
'<tr class="liste_titre">';
575 print
'<td>'.$langs->trans(
'Invoice').
'</td>';
576 print
'<td>'.$langs->trans(
'RefSupplier').
'</td>';
577 print
'<td class="center">'.$langs->trans(
'Date').
'</td>';
578 print
'<td class="center">'.$langs->trans(
'DateMaxPayment').
'</td>';
580 print
'<td>'.$langs->trans(
'Currency').
'</td>';
581 print
'<td class="right">'.$langs->trans(
'MulticurrencyAmountTTC').
'</td>';
582 print
'<td class="right">'.$langs->trans(
'MulticurrencyAlreadyPaid').
'</td>';
583 print
'<td class="right">'.$langs->trans(
'MulticurrencyRemainderToPay').
'</td>';
584 print
'<td class="center">'.$langs->trans(
'MulticurrencyPaymentAmount').
'</td>';
586 print
'<td class="right">'.$langs->trans(
'AmountTTC').
'</td>';
587 print
'<td class="right">'.$langs->trans(
'AlreadyPaid').
'</td>';
588 print
'<td class="right">'.$langs->trans(
'RemainderToPay').
'</td>';
589 print
'<td class="center">'.$langs->trans(
'PaymentAmount').
'</td>';
596 $objp = $db->fetch_object(
$resql);
604 $invoice->fetch($objp->facid);
606 $invoicesupplierstatic->ref = $objp->ref;
607 $invoicesupplierstatic->id = $objp->facid;
609 $paiement = $invoice->getSommePaiement();
610 $creditnotes = $invoice->getSumCreditNotesUsed();
611 $deposits = $invoice->getSumDepositsUsed();
612 $alreadypayed =
price2num($paiement + $creditnotes + $deposits,
'MT');
613 $remaintopay =
price2num($invoice->total_ttc - $paiement - $creditnotes - $deposits,
'MT');
617 $multicurrency_payment = $invoice->getSommePaiement(1);
618 $multicurrency_creditnotes = $invoice->getSumCreditNotesUsed(1);
619 $multicurrency_deposits = $invoice->getSumDepositsUsed(1);
620 $multicurrency_alreadypayed =
price2num($multicurrency_payment + $multicurrency_creditnotes + $multicurrency_deposits,
'MT');
621 $multicurrency_remaintopay =
price2num($invoice->multicurrency_total_ttc - $multicurrency_payment - $multicurrency_creditnotes - $multicurrency_deposits,
'MT');
624 print
'<tr class="oddeven'.(($invoice->id == $facid) ?
' highlight' :
'').
'">';
627 print
'<td class="nowraponall">';
628 print $invoicesupplierstatic->getNomUrl(1);
632 print
'<td>'.$objp->ref_supplier.
'</td>';
636 print
'<td class="center nowraponall">';
639 print
'<td class="center"><b>!!!</b></td>';
643 if ($objp->dlr > 0) {
644 print
'<td class="center nowraponall">';
647 if ($invoice->hasDelay()) {
653 print
'<td class="center"><b>--</b></td>';
659 print
'<td class="center">'.$objp->multicurrency_code.
"</td>\n";
661 print
'<td class="right">';
662 if ($objp->multicurrency_code && $objp->multicurrency_code != $conf->currency) {
663 print
price($objp->multicurrency_total_ttc);
667 print
'<td class="right">';
668 if ($objp->multicurrency_code && $objp->multicurrency_code != $conf->currency) {
669 print
price($sign * $multicurrency_payment);
670 if ($multicurrency_creditnotes) {
671 print
'+'.price($multicurrency_creditnotes);
673 if ($multicurrency_deposits) {
674 print
'+'.price($multicurrency_deposits);
679 print
'<td class="right">';
680 if ($objp->multicurrency_code && $objp->multicurrency_code != $conf->currency) {
681 print
price($sign * $multicurrency_remaintopay);
685 print
'<td class="right">';
687 $namef =
'multicurrency_amount_'.$objp->facid;
688 $nameRemain =
'multicurrency_remain_'.$objp->facid;
689 if ($objp->multicurrency_code && $objp->multicurrency_code != $conf->currency) {
690 if ($action !=
'add_paiement') {
691 if (!empty($conf->use_javascript_ajax)) {
692 print
img_picto(
"Auto fill",
'rightarrow',
"class='AutoFillAmout' data-rowname='".$namef.
"' data-value='".($sign * $multicurrency_remaintopay).
"'");
694 print
'<input type=hidden class="multicurrency_remain" name="'.$nameRemain.
'" value="'.$multicurrency_remaintopay.
'">';
695 print
'<input type="text" size="8" class="multicurrency_amount" name="'.$namef.
'" value="'.
GETPOST($namef).
'">';
697 print
'<input type="text" size="8" name="'.$namef.
'_disabled" value="'.
GETPOST($namef).
'" disabled>';
698 print
'<input type="hidden" name="'.$namef.
'" value="'.
GETPOST($namef).
'">';
704 print
'<td class="right">'.price($sign * $objp->total_ttc).
'</td>';
706 print
'<td class="right">'.price($sign * $objp->am);
708 print
'+'.price($creditnotes);
711 print
'+'.price($deposits);
715 print
'<td class="right">';
716 print
price($sign * $remaintopay);
717 if (!empty($conf->paymentbybanktransfer->enabled)) {
718 $numdirectdebitopen = 0;
719 $totaldirectdebit = 0;
720 $sql =
"SELECT COUNT(pfd.rowid) as nb, SUM(pfd.amount) as amount";
721 $sql .=
" FROM ".MAIN_DB_PREFIX.
"prelevement_demande as pfd";
722 $sql .=
" WHERE fk_facture_fourn = ".((int) $objp->facid);
723 $sql .=
" AND pfd.traite = 0";
724 $sql .=
" AND pfd.ext_payment_id IS NULL";
726 $result_sql = $db->query($sql);
728 $obj = $db->fetch_object($result_sql);
729 $numdirectdebitopen = $obj->nb;
730 $totaldirectdebit = $obj->amount;
734 if ($numdirectdebitopen) {
735 $langs->load(
"withdrawals");
736 print
img_warning($langs->trans(
"WarningSomeCreditTransferAlreadyExists", $numdirectdebitopen,
price(
price2num($totaldirectdebit,
'MT'), 0, $langs, 1, -1, -1, $conf->currency)),
'',
'classfortooltip');
742 print
'<td class="center nowraponall">';
744 $namef =
'amount_'.$objp->facid;
745 $nameRemain =
'remain_'.$objp->facid;
747 if ($action !=
'add_paiement') {
748 if (!empty($conf->use_javascript_ajax)) {
749 print
img_picto(
"Auto fill",
'rightarrow',
"class='AutoFillAmout' data-rowname='".$namef.
"' data-value='".($sign * $remaintopay).
"'");
751 print
'<input type="hidden" class="remain" name="'.$nameRemain.
'" value="'.$remaintopay.
'">';
754 print
'<input type="text" size="8" name="'.$namef.
'_disabled" value="'.
dol_escape_htmltag(
GETPOST($namef)).
'" disabled>';
760 $total += $objp->total_ht;
761 $total_ttc += $objp->total_ttc;
762 $totalrecu += $objp->am;
763 $totalrecucreditnote += $creditnotes;
764 $totalrecudeposits += $deposits;
769 print
'<tr class="liste_total">';
770 print
'<td colspan="4" class="left">'.$langs->trans(
'TotalTTC').
':</td>';
772 print
'<td> </td>';
773 print
'<td> </td>';
774 print
'<td> </td>';
775 print
'<td> </td>';
776 print
'<td class="right" id="multicurrency_result" style="font-weight: bold;"></td>';
778 print
'<td class="right"><b>'.price($sign * $total_ttc).
'</b></td>';
779 print
'<td class="right"><b>'.price($sign * $totalrecu);
780 if ($totalrecucreditnote) {
781 print
'+'.price($totalrecucreditnote);
783 if ($totalrecudeposits) {
784 print
'+'.price($totalrecudeposits);
787 print
'<td class="right"><b>'.price($sign *
price2num($total_ttc - $totalrecu - $totalrecucreditnote - $totalrecudeposits,
'MT')).
'</b></td>';
788 print
'<td class="center" id="result" style="font-weight: bold;"></td>';
802 if ($action !=
'add_paiement') {
803 print
'<br><div class="center">';
804 print
'<input type="checkbox" checked id="closepaidinvoices" name="closepaidinvoices"> <label for="closepaidinvoices">'.$langs->trans(
"ClosePaidInvoicesAutomatically").
'</label><br>';
805 print
'<input type="submit" class="button" value="'.$langs->trans(
'ToMakePayment').
'">';
806 print
' <input type="submit" class="button button-cancel" name="cancel" value="'.$langs->trans(
"Cancel").
'">';
811 if ($action ==
'add_paiement') {
812 $preselectedchoice = $addwarning ?
'no' :
'yes';
815 if (!empty($totalpayment)) {
816 $text = $langs->trans(
'ConfirmSupplierPayment',
price($totalpayment), $langs->trans(
"Currency".$conf->currency));
818 if (!empty($multicurrency_totalpayment)) {
819 $text .=
'<br>'.$langs->trans(
'ConfirmSupplierPayment',
price($multicurrency_totalpayment), $langs->trans(
"paymentInInvoiceCurrency"));
821 if (
GETPOST(
'closepaidinvoices')) {
822 $text .=
'<br>'.$langs->trans(
"AllCompletelyPayedInvoiceWillBeClosed");
823 print
'<input type="hidden" name="closepaidinvoices" value="'.GETPOST(
'closepaidinvoices').
'">';
825 print
$form->formconfirm($_SERVER[
'PHP_SELF'].
'?facid='.$facture->id.
'&socid='.$facture->socid.
'&type='.$facture->type, $langs->trans(
'PayedSuppliersPayments'), $text,
'confirm_paiement', $formquestion, $preselectedchoice);
if(!defined('NOREQUIRESOC')) if(!defined('NOREQUIRETRAN')) if(!defined('NOTOKENRENEWAL')) if(!defined('NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined('NOREQUIREAJAX')) llxHeader()
Empty header.
Class to manage suppliers invoices.
const TYPE_CREDIT_NOTE
Credit note invoice.
Class to manage payments for supplier invoices.
Class to manage third parties objects (customers, suppliers, prospects...)
if(isModEnabled('facture') &&!empty($user->rights->facture->lire)) if((isModEnabled('fournisseur') &&empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) && $user->hasRight("fournisseur", "facture", "lire"))||(isModEnabled('supplier_invoice') && $user->hasRight("supplier_invoice", "lire"))) if(isModEnabled('don') &&!empty($user->rights->don->lire)) if(isModEnabled('tax') &&!empty($user->rights->tax->charges->lire)) if(isModEnabled('facture') &&isModEnabled('commande') && $user->hasRight("commande", "lire") &&empty($conf->global->WORKFLOW_DISABLE_CREATE_INVOICE_FROM_ORDER)) $resql
Social contributions to pay.
if($cancel &&! $id) if($action=='add' &&! $cancel) if($action=='delete') if($id) $form
Actions.
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...
load_fiche_titre($titre, $morehtmlright='', $picto='generic', $pictoisfullpath=0, $id='', $morecssontable='', $morehtmlcenter='')
Load a title with picto.
dol_get_fiche_head($links=array(), $active='', $title='', $notab=0, $picto='', $pictoisfullpath=0, $morehtmlright='', $morecss='', $limittoshow=0, $moretabssuffix='')
Show tabs of a record.
img_warning($titlealt='default', $moreatt='', $morecss='pictowarning')
Show warning logo.
dol_escape_htmltag($stringtoescape, $keepb=0, $keepn=0, $noescapetags='', $escapeonlyhtmltags=0)
Returns text escaped for inclusion in HTML alt or title tags, or into values of HTML input fields.
price2num($amount, $rounding='', $option=0)
Function that return a number with universal decimal format (decimal separator is '.
dol_print_error($db='', $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
dol_get_fiche_end($notab=0)
Return tab footer of a card.
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='')
Set event messages in dol_events session object.
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.
dol_print_date($time, $format='', $tzoutput='auto', $outputlangs='', $encodetooutput=false)
Output date in a string format according to outputlangs (or langs if not defined).
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=false, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2)
Show picto whatever it's its name (generic function)
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
GETPOSTISSET($paramname)
Return true if we are in a context of submitting the parameter $paramname from a POST of a form.
isModEnabled($module)
Is Dolibarr module enabled.