39require
'../../main.inc.php';
40require_once DOL_DOCUMENT_ROOT.
'/fourn/class/fournisseur.class.php';
41require_once DOL_DOCUMENT_ROOT.
'/fourn/class/fournisseur.facture.class.php';
42require_once DOL_DOCUMENT_ROOT.
'/fourn/class/paiementfourn.class.php';
43require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formother.class.php';
44require_once DOL_DOCUMENT_ROOT.
'/core/lib/date.lib.php';
45require_once DOL_DOCUMENT_ROOT.
'/core/lib/files.lib.php';
48$langs->loadLangs(array(
'companies',
'bills',
'banks',
'compta'));
50$action =
GETPOST(
'action',
'alpha');
51$confirm =
GETPOST(
'confirm',
'alpha');
52$optioncss =
GETPOST(
'optioncss',
'alpha');
53$cancel =
GETPOST(
'cancel',
'alpha');
54$backtopage =
GETPOST(
'backtopage',
'alpha');
55$backtopageforcancel =
GETPOST(
'backtopageforcancel',
'alpha');
64$search_ref =
GETPOST(
'search_ref',
'alpha');
65$search_account =
GETPOST(
'search_account',
'alpha');
66$search_paymenttype =
GETPOST(
'search_paymenttype');
67$search_amount =
GETPOST(
'search_amount',
'alpha');
68$search_company =
GETPOST(
'search_company',
'alpha');
69$search_payment_num =
GETPOST(
'search_payment_num',
'alpha');
72$sortfield =
GETPOST(
'sortfield',
'aZ09comma');
73$sortorder =
GETPOST(
'sortorder',
'aZ09comma');
75if (empty($page) || $page == -1) {
78$offset = $limit * $page;
85 $sortfield =
"p.rowid";
89$amountsresttopay = array();
92$multicurrency_amounts = array();
93$multicurrency_amountsresttopay = array();
96if ($user->socid > 0) {
97 $socid = $user->socid;
103$hookmanager->initHooks(array(
'paymentsupplierlist'));
107$extrafields->fetch_name_optionals_label(
$object->table_element);
109$search_array_options = $extrafields->getOptionalsFromPost(
$object->table_element,
'',
'search_');
111$arrayfields = array();
120 if (!empty($backtopageforcancel)) {
121 header(
"Location: ".$backtopageforcancel);
123 } elseif (!empty($backtopage)) {
124 header(
"Location: ".$backtopage);
127 header(
"Location: ".DOL_URL_ROOT.
'/fourn/facture/list.php');
131if (
GETPOST(
'button_removefilter_x',
'alpha') ||
GETPOST(
'button_removefilter.x',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')) {
133 $search_account =
"";
135 $search_paymenttype =
"";
136 $search_payment_num =
"";
137 $search_company =
"";
141 $search_array_options = array();
144$parameters = array(
'socid' => $socid);
145$reshook = $hookmanager->executeHooks(
'doActions', $parameters, $object, $action);
150if (empty($reshook)) {
151 if ($action ==
'add_paiement' || ($action ==
'confirm_paiement' && $confirm ==
'yes')) {
157 $atleastonepaymentnotnull = 0;
158 $multicurrency_totalpayment = 0;
159 $formquestion = array();
163 foreach ($_POST as $key => $value) {
164 if (substr($key, 0, 7) ==
'amount_') {
165 $cursorfacid = substr($key, 7);
167 if (!empty($amounts[$cursorfacid])) {
168 $atleastonepaymentnotnull++;
169 if (is_numeric($amounts[$cursorfacid])) {
170 $totalpayment += (float) $amounts[$cursorfacid];
175 $result = $tmpinvoice->fetch($cursorfacid);
179 $amountsresttopay[$cursorfacid] =
price2num($tmpinvoice->total_ttc - $tmpinvoice->getSommePaiement());
180 if ($amounts[$cursorfacid]) {
182 if ($amounts[$cursorfacid] && (abs((
float) $amounts[$cursorfacid]) > abs((
float) $amountsresttopay[$cursorfacid]))) {
184 $formquestion[
'text'] =
img_warning($langs->trans(
"PaymentHigherThanReminderToPaySupplier")).
' '.$langs->trans(
"HelpPaymentHigherThanReminderToPaySupplier");
187 if ($datepaye && ($datepaye < $tmpinvoice->date)) {
188 $langs->load(
"errors");
194 $formquestion[$i++] = array(
'type' =>
'hidden',
'name' => $key,
'value' =>
GETPOST($key));
195 } elseif (substr($key, 0, 21) ==
'multicurrency_amount_') {
196 $cursorfacid = substr($key, 21);
198 $multicurrency_totalpayment += $multicurrency_amounts[$cursorfacid];
199 if (!empty($multicurrency_amounts[$cursorfacid])) {
200 $atleastonepaymentnotnull++;
202 $result = $tmpinvoice->fetch($cursorfacid);
206 $multicurrency_amountsresttopay[$cursorfacid] =
price2num($tmpinvoice->multicurrency_total_ttc - $tmpinvoice->getSommePaiement(1));
207 if ($multicurrency_amounts[$cursorfacid]) {
209 if ($multicurrency_amounts[$cursorfacid] && (abs((
float) $multicurrency_amounts[$cursorfacid]) > abs((
float) $multicurrency_amountsresttopay[$cursorfacid]))) {
211 $formquestion[
'text'] =
img_warning($langs->trans(
"PaymentHigherThanReminderToPaySupplier")).
' '.$langs->trans(
"HelpPaymentHigherThanReminderToPaySupplier");
214 if ($datepaye && ($datepaye < $tmpinvoice->date)) {
215 $langs->load(
"errors");
221 $formquestion[$i++] = array(
'type' =>
'hidden',
'name' => $key,
'value' =>
GETPOSTINT($key));
226 if (
GETPOST(
'paiementid') <= 0) {
227 setEventMessages($langs->transnoentities(
'ErrorFieldRequired', $langs->transnoentities(
'PaymentMode')),
null,
'errors');
231 if (isModEnabled(
"bank")) {
233 if (
GETPOST(
'accountid') <= 0) {
234 setEventMessages($langs->transnoentities(
'ErrorFieldRequired', $langs->transnoentities(
'AccountToCredit')),
null,
'errors');
239 if (empty($totalpayment) && empty($multicurrency_totalpayment) && empty($atleastonepaymentnotnull)) {
240 setEventMessages($langs->transnoentities(
'ErrorFieldRequired', $langs->trans(
'PaymentAmount')),
null,
'errors');
244 if (empty($datepaye)) {
245 setEventMessages($langs->transnoentities(
'ErrorFieldRequired', $langs->transnoentities(
'Date')),
null,
'errors');
250 if ($totalpayment > 0 && $multicurrency_totalpayment > 0) {
251 setEventMessages($langs->transnoentities(
'ErrorPaymentInBothCurrency'),
null,
'errors');
259 if ($action ==
'add_paiement') {
270 if ($action ==
'confirm_paiement' && $confirm ==
'yes') {
275 $multicurrency_code = array();
276 $multicurrency_tx = array();
279 foreach ($amounts as $key => $value) {
281 $tmpinvoice->fetch($key);
284 $amounts[$key] = - abs((
float) $newvalue);
286 $multicurrency_code[$key] = $tmpinvoice->multicurrency_code;
287 $multicurrency_tx[$key] = $tmpinvoice->multicurrency_tx;
290 foreach ($multicurrency_amounts as $key => $value) {
292 $tmpinvoice->fetch($key);
295 $multicurrency_amounts[$key] = - abs((
float) $newvalue);
297 $multicurrency_code[$key] = $tmpinvoice->multicurrency_code;
298 $multicurrency_tx[$key] = $tmpinvoice->multicurrency_tx;
308 $thirdparty =
new Societe($db);
310 $thirdparty->fetch($socid);
315 $paiement->datepaye = $datepaye;
317 $correctedAmounts = [];
318 foreach ($amounts as $key => $value) {
319 $correctedAmounts[$key] = (float) $value;
322 $paiement->amounts = $correctedAmounts;
323 $paiement->multicurrency_amounts = $multicurrency_amounts;
324 $paiement->multicurrency_code = $multicurrency_code;
325 $paiement->multicurrency_tx = $multicurrency_tx;
326 $paiement->paiementid =
GETPOSTINT(
'paiementid');
327 $paiement->num_payment =
GETPOST(
'num_paiement',
'alphanohtml');
328 $paiement->note_private =
GETPOST(
'comment',
'alpha');
329 $paiement->fk_account =
GETPOSTINT(
'accountid');
335 $paiement_id = $paiement->create($user, (
GETPOST(
'closepaidinvoices') ==
'on' ? 1 : 0), $thirdparty);
336 if ($paiement_id < 0) {
343 $result = $paiement->addPaymentToBank($user,
'payment_supplier',
'(SupplierInvoicePayment)', $accountid,
GETPOST(
'chqemetteur'),
GETPOST(
'chqbank'));
355 foreach ($paiement->amounts as $key => $amount) {
357 if (is_numeric($amount) && $amount != 0) {
358 if ($invoiceid != 0) {
365 if ($invoiceid > 0) {
366 $loc = DOL_URL_ROOT.
'/fourn/facture/card.php?facid='.$invoiceid;
368 $loc = DOL_URL_ROOT.
'/fourn/paiement/card.php?id='.$paiement_id;
370 header(
'Location: '.$loc);
384$form =
new Form($db);
387$supplierstatic =
new Societe($db);
390llxHeader(
'', $langs->trans(
'ListPayment'));
392if ($action ==
'create' || $action ==
'confirm_paiement' || $action ==
'add_paiement') {
394 $result =
$object->fetch($facid);
397 $dateinvoice = ($datefacture ==
'' ? (!
getDolGlobalString(
'MAIN_AUTOFILL_DATE') ? -1 :
'') : $datefacture);
399 $sql =
'SELECT s.nom as name, s.rowid as socid,';
400 $sql .=
' f.rowid, f.ref, f.ref_supplier, f.total_ttc as total, f.fk_mode_reglement, f.fk_account';
401 if (!$user->hasRight(
"societe",
"client",
"voir") && !$socid) {
402 $sql .=
", sc.fk_soc, sc.fk_user ";
404 $sql .=
' FROM '.MAIN_DB_PREFIX.
'societe as s, '.MAIN_DB_PREFIX.
'facture_fourn as f';
405 if (!$user->hasRight(
"societe",
"client",
"voir") && !$socid) {
406 $sql .=
", ".MAIN_DB_PREFIX.
"societe_commerciaux as sc";
408 $sql .=
' WHERE f.fk_soc = s.rowid';
409 $sql .=
' AND f.rowid = '.((int) $facid);
410 if (!$user->hasRight(
"societe",
"client",
"voir") && !$socid) {
411 $sql .=
" AND s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $user->id);
413 $resql = $db->query($sql);
415 $num = $db->num_rows($resql);
417 $obj = $db->fetch_object($resql);
418 $total = $obj->total;
423 if (!empty($conf->use_javascript_ajax)) {
424 print
"\n".
'<script type="text/javascript">';
425 print
'$(document).ready(function () {
427 function _elemToJson(selector)
430 $.map(selector.serializeArray(), function(n,i)
432 subJson[n["name"]] = n["value"];
437 function callForResult(imgId)
439 console.log("callForResult Calculate total of payment");
441 var form = $("#payment_form");
443 json["invoice_type"] = $("#invoice_type").val();
444 json["amountPayment"] = $("#amountpayment").attr("value");
445 json["amounts"] = _elemToJson(form.find("input.amount"));
446 json["remains"] = _elemToJson(form.find("input.remain"));
447 json["token"] = "'.currentToken().
'";
449 json["imgClicked"] = imgId;
452 $.post("'.DOL_URL_ROOT.
'/compta/ajaxpayment.php", json, function(data)
454 json = $.parseJSON(data);
458 for (var key in json)
460 if (key == "result") {
461 if (json["makeRed"]) {
462 $("#"+key).addClass("error");
464 $("#"+key).removeClass("error");
466 json[key]=json["label"]+" "+json[key];
467 $("#"+key).text(json[key]);
468 } else {console.log(key);
469 form.find("input[name*=\""+key+"\"]").each(function() {
470 $(this).attr("value", json[key]);
477 $("#payment_form").find("input.amount").change(function() {
480 $("#payment_form").find("input.amount").keyup(function() {
488 print
' $(document).ready(function () {';
489 print
' $(".AutoFillAmount").on(\'click touchstart\', function(){
490 $("input[name="+$(this).data(\'rowname\')+"]").val($(this).data("value")).trigger("change");
494 print
' </script>'.
"\n";
497 print
'<form id="payment_form" name="addpaiement" action="'.$_SERVER[
"PHP_SELF"].
'" method="POST">';
498 print
'<input type="hidden" name="token" value="'.newToken().
'">';
499 print
'<input type="hidden" name="action" value="add_paiement">';
500 print
'<input type="hidden" name="facid" value="'.$facid.
'">';
501 print
'<input type="hidden" name="ref_supplier" value="'.$obj->ref_supplier.
'">';
502 print
'<input type="hidden" name="socid" value="'.$obj->socid.
'">';
503 print
'<input type="hidden" name="type" id="invoice_type" value="'.$object->type.
'">';
504 print
'<input type="hidden" name="societe" value="'.$obj->name.
'">';
508 print
'<table class="border centpercent">';
510 print
'<tr><td class="fieldrequired titlefieldcreate">'.$langs->trans(
'Company').
'</td><td>';
511 $supplierstatic->id = $obj->socid;
512 $supplierstatic->name = $obj->name;
513 print $supplierstatic->getNomUrl(1,
'supplier');
516 print
'<tr><td class="fieldrequired">'.$langs->trans(
'Date').
'</td><td>';
518 $adddateof = array(array(
'adddateof' =>
$object->date));
519 $adddateof[] = array(
'adddateof' =>
$object->date_echeance,
'labeladddateof' => $langs->transnoentities(
'DateDue'));
520 print $form->selectDate($dateinvoice,
'', 0, 0, 0,
"addpaiement", 1, 1, 0,
'',
'', $adddateof);
522 print
'<tr><td class="fieldrequired">'.$langs->trans(
'PaymentMode').
'</td><td>';
523 $form->select_types_paiements(!
GETPOST(
'paiementid') ? $obj->fk_mode_reglement :
GETPOST(
'paiementid'),
'paiementid');
525 if (isModEnabled(
"bank")) {
526 print
'<tr><td class="fieldrequired">'.$langs->trans(
'Account').
'</td><td>';
527 print
img_picto(
'',
'bank_account',
'class="pictofixedwidth"');
528 print $form->select_comptes(empty($accountid) ? $obj->fk_account : $accountid,
'accountid', 0,
'', 2,
'', 0,
'widthcentpercentminusx maxwidth500', 1);
531 print
'<tr><td> </td></tr>';
533 print
'<tr><td>'.$langs->trans(
'Numero').
'</td><td><input name="num_paiement" type="text" value="'.(!
GETPOST(
'num_paiement') ?
'' :
GETPOST(
'num_paiement')).
'"></td></tr>';
534 print
'<tr><td>'.$langs->trans(
'Comments').
'</td>';
535 print
'<td class="tdtop">';
536 print
'<textarea name="comment" wrap="soft" class="quatrevingtpercent" rows="'.ROWS_3.
'">'.(!
GETPOST(
'comment') ?
'' :
GETPOST(
'comment')).
'</textarea></td></tr>';
541 $parameters = array(
'facid' => $facid,
'ref' => $ref,
'objcanvas' => $objcanvas);
542 $reshook = $hookmanager->executeHooks(
'paymentsupplierinvoices', $parameters, $object, $action);
543 $error = $hookmanager->error;
544 $errors = $hookmanager->errors;
545 if (empty($reshook)) {
549 $sql =
'SELECT f.rowid as facid, f.ref, f.ref_supplier, f.type, f.total_ht, f.total_ttc,';
550 $sql .=
' f.multicurrency_code, f.multicurrency_tx, f.multicurrency_total_ht, f.multicurrency_total_tva, f.multicurrency_total_ttc,';
551 $sql .=
' f.datef as df, f.date_lim_reglement as dlr,';
552 $sql .=
' SUM(pf.amount) as am, SUM(pf.multicurrency_amount) as multicurrency_am';
553 $sql .=
' FROM '.MAIN_DB_PREFIX.
'facture_fourn as f';
554 $sql .=
' LEFT JOIN '.MAIN_DB_PREFIX.
'paiementfourn_facturefourn as pf ON pf.fk_facturefourn = f.rowid';
555 $sql .=
" WHERE f.entity = ".((int) $conf->entity);
556 $sql .=
' AND f.fk_soc = '.((int)
$object->socid);
557 $sql .=
' AND f.paye = 0';
558 $sql .=
' AND f.fk_statut = 1';
560 $sql .=
' AND f.type IN (0,1,3,5)';
562 $sql .=
' AND f.type = 2';
565 $sql .=
' GROUP BY f.datef, f.ref, f.ref_supplier, f.rowid, f.type, f.total_ht, f.total_ttc,';
566 $sql .=
' f.multicurrency_code, f.multicurrency_tx, f.multicurrency_total_ht, f.multicurrency_total_tva, f.multicurrency_total_ttc,';
567 $sql .=
' f.datef, f.date_lim_reglement';
569 $sql .=
' ORDER BY f.datef ASC, f.ref ASC';
571 $resql = $db->query($sql);
573 $num = $db->num_rows($resql);
578 if (!empty($conf->use_javascript_ajax)) {
580 print
"\n".
'<script type="text/javascript">';
581 print
' $(document).ready(function () {';
582 print
' $(".AutoFillAmount").on(\'click touchstart\', function(){
583 $("input[name="+$(this).data(\'rowname\')+"]").val($(this).data("value"));
586 print
' </script>'.
"\n";
589 print
'<div class="div-table-responsive-no-min">';
590 print
'<table class="tagtable liste'.($moreforfilter ?
" listwithfilterbefore" :
"").
'">'.
"\n";
592 print
'<tr class="liste_titre">';
593 print
'<td>'.$langs->trans(
'Invoice').
'</td>';
594 print
'<td>'.$langs->trans(
'RefSupplier').
'</td>';
595 print
'<td class="center">'.$langs->trans(
'Date').
'</td>';
596 print
'<td class="center">'.$langs->trans(
'DateMaxPayment').
'</td>';
597 if (isModEnabled(
"multicurrency")) {
598 print
'<td>'.$langs->trans(
'Currency').
'</td>';
599 print
'<td class="right">'.$langs->trans(
'MulticurrencyAmountTTC').
'</td>';
600 print
'<td class="right">'.$langs->trans(
'MulticurrencyAlreadyPaid').
'</td>';
601 print
'<td class="right">'.$langs->trans(
'MulticurrencyRemainderToPay').
'</td>';
602 print
'<td class="center">'.$langs->trans(
'MulticurrencyPaymentAmount').
'</td>';
604 print
'<td class="right">'.$langs->trans(
'AmountTTC').
'</td>';
605 print
'<td class="right">'.$langs->trans(
'AlreadyPaid').
'</td>';
606 print
'<td class="right">'.$langs->trans(
'RemainderToPay').
'</td>';
607 print
'<td class="center">'.$langs->trans(
'PaymentAmount').
'</td>';
613 $totalrecucreditnote = 0;
614 $totalrecudeposits = 0;
616 $objp = $db->fetch_object($resql);
624 $invoice->fetch($objp->facid);
626 $invoicesupplierstatic->ref = $objp->ref;
627 $invoicesupplierstatic->id = $objp->facid;
629 $paiement = $invoice->getSommePaiement();
630 $creditnotes = $invoice->getSumCreditNotesUsed();
631 $deposits = $invoice->getSumDepositsUsed();
632 $alreadypayed =
price2num($paiement + $creditnotes + $deposits,
'MT');
633 $remaintopay =
price2num($invoice->total_ttc - $paiement - $creditnotes - $deposits,
'MT');
636 if (isModEnabled(
"multicurrency")) {
637 $multicurrency_payment = $invoice->getSommePaiement(1);
638 $multicurrency_creditnotes = $invoice->getSumCreditNotesUsed(1);
639 $multicurrency_deposits = $invoice->getSumDepositsUsed(1);
640 $multicurrency_alreadypayed =
price2num($multicurrency_payment + $multicurrency_creditnotes + $multicurrency_deposits,
'MT');
641 $multicurrency_remaintopay =
price2num($invoice->multicurrency_total_ttc - $multicurrency_payment - $multicurrency_creditnotes - $multicurrency_deposits,
'MT');
644 print
'<tr class="oddeven'.(($invoice->id == $facid) ?
' highlight' :
'').
'">';
647 print
'<td class="nowraponall">';
648 print $invoicesupplierstatic->getNomUrl(1);
652 print
'<td>'.$objp->ref_supplier.
'</td>';
656 print
'<td class="center nowraponall">';
659 print
'<td class="center"><b>!!!</b></td>';
663 if ($objp->dlr > 0) {
664 print
'<td class="center nowraponall">';
667 if ($invoice->hasDelay()) {
673 print
'<td class="center"><b>--</b></td>';
677 if (isModEnabled(
"multicurrency")) {
679 print
'<td class="center">'.$objp->multicurrency_code.
"</td>\n";
681 print
'<td class="right">';
682 if ($objp->multicurrency_code && $objp->multicurrency_code != $conf->currency) {
683 print
price($objp->multicurrency_total_ttc);
687 print
'<td class="right">';
688 if ($objp->multicurrency_code && $objp->multicurrency_code != $conf->currency) {
689 print
price($sign * $multicurrency_payment);
690 if ($multicurrency_creditnotes) {
691 print
'+'.price($multicurrency_creditnotes);
693 if ($multicurrency_deposits) {
694 print
'+'.price($multicurrency_deposits);
699 print
'<td class="right">';
700 if ($objp->multicurrency_code && $objp->multicurrency_code != $conf->currency) {
701 print
price($sign * (
float) $multicurrency_remaintopay);
705 print
'<td class="right">';
707 $namef =
'multicurrency_amount_'.$objp->facid;
708 $nameRemain =
'multicurrency_remain_'.$objp->facid;
709 if ($objp->multicurrency_code && $objp->multicurrency_code != $conf->currency) {
710 if ($action !=
'add_paiement') {
711 if (!empty($conf->use_javascript_ajax)) {
712 print
img_picto(
"Auto fill",
'rightarrow',
"class='AutoFillAmount' data-rowname='".$namef.
"' data-value='".($sign * (
float) $multicurrency_remaintopay).
"'");
714 print
'<input type=hidden class="multicurrency_remain" name="'.$nameRemain.
'" value="'.$multicurrency_remaintopay.
'">';
715 print
'<input type="text" size="8" class="multicurrency_amount" name="'.$namef.
'" value="'.
GETPOST($namef).
'">';
717 print
'<input type="text" size="8" name="'.$namef.
'_disabled" value="'.
GETPOST($namef).
'" disabled>';
718 print
'<input type="hidden" name="'.$namef.
'" value="'.
GETPOST($namef).
'">';
724 print
'<td class="right">'.price($sign * $objp->total_ttc).
'</td>';
726 print
'<td class="right">'.price($sign * $objp->am);
728 print
'+'.price($creditnotes);
731 print
'+'.price($deposits);
735 print
'<td class="right">';
736 print
price($sign * (
float) $remaintopay);
737 if (isModEnabled(
'paymentbybanktransfer')) {
738 $numdirectdebitopen = 0;
739 $totaldirectdebit = 0;
740 $sql =
"SELECT COUNT(pfd.rowid) as nb, SUM(pfd.amount) as amount";
741 $sql .=
" FROM ".MAIN_DB_PREFIX.
"prelevement_demande as pfd";
742 $sql .=
" WHERE fk_facture_fourn = ".((int) $objp->facid);
743 $sql .=
" AND pfd.traite = 0";
744 $sql .=
" AND pfd.ext_payment_id IS NULL";
746 $result_sql = $db->query($sql);
748 $obj = $db->fetch_object($result_sql);
749 $numdirectdebitopen = $obj->nb;
750 $totaldirectdebit = $obj->amount;
754 if ($numdirectdebitopen) {
755 $langs->load(
"withdrawals");
756 print
img_warning($langs->trans(
"WarningSomeCreditTransferAlreadyExists", $numdirectdebitopen,
price(
price2num($totaldirectdebit,
'MT'), 0, $langs, 1, -1, -1, $conf->currency)),
'',
'classfortooltip');
762 print
'<td class="center nowraponall">';
764 $namef =
'amount_'.$objp->facid;
765 $nameRemain =
'remain_'.$objp->facid;
767 if ($action !=
'add_paiement') {
768 if (!empty($conf->use_javascript_ajax)) {
769 print
img_picto(
"Auto fill",
'rightarrow',
"class='AutoFillAmount' data-rowname='".$namef.
"' data-value='".($sign * (
float) $remaintopay).
"'");
771 print
'<input type="hidden" class="remain" name="'.$nameRemain.
'" value="'.$remaintopay.
'">';
774 print
'<input type="text" size="8" name="'.$namef.
'_disabled" value="'.
dol_escape_htmltag(
GETPOST($namef)).
'" disabled>';
780 $total += $objp->total_ht;
781 $total_ttc += $objp->total_ttc;
782 $totalrecu += $objp->am;
783 $totalrecucreditnote += $creditnotes;
784 $totalrecudeposits += $deposits;
789 print
'<tr class="liste_total">';
790 print
'<td colspan="4" class="left">'.$langs->trans(
'TotalTTC').
':</td>';
791 if (isModEnabled(
"multicurrency")) {
792 print
'<td> </td>';
793 print
'<td> </td>';
794 print
'<td> </td>';
795 print
'<td> </td>';
796 print
'<td class="right" id="multicurrency_result" style="font-weight: bold;"></td>';
798 print
'<td class="right"><b>'.price($sign * $total_ttc).
'</b></td>';
799 print
'<td class="right"><b>'.price($sign * $totalrecu);
800 if ($totalrecucreditnote) {
801 print
'+'.price($totalrecucreditnote);
803 if ($totalrecudeposits) {
804 print
'+'.price($totalrecudeposits);
807 print
'<td class="right"><b>'.price($sign * (
float)
price2num($total_ttc - $totalrecu - $totalrecucreditnote - $totalrecudeposits,
'MT')).
'</b></td>';
808 print
'<td class="center" id="result" style="font-weight: bold;"></td>';
822 if ($action !=
'add_paiement') {
823 print
'<br><div class="center">';
824 print
'<input type="checkbox" checked id="closepaidinvoices" name="closepaidinvoices"> <label for="closepaidinvoices">'.$langs->trans(
"ClosePaidInvoicesAutomatically").
'</label><br>';
825 print
'<input type="submit" class="button" value="'.$langs->trans(
'ToMakePayment').
'">';
826 print
' <input type="submit" class="button button-cancel" name="cancel" value="'.$langs->trans(
"Cancel").
'">';
831 if ($action ==
'add_paiement') {
832 $preselectedchoice = $addwarning ?
'no' :
'yes';
835 if (!empty($totalpayment)) {
836 $text = $langs->trans(
'ConfirmSupplierPayment',
price($totalpayment), $langs->transnoentitiesnoconv(
"Currency".$conf->currency));
838 if (!empty($multicurrency_totalpayment)) {
839 $text .=
'<br>'.$langs->trans(
'ConfirmSupplierPayment',
price($multicurrency_totalpayment), $langs->transnoentitiesnoconv(
"paymentInInvoiceCurrency"));
841 if (
GETPOST(
'closepaidinvoices')) {
842 $text .=
'<br>'.$langs->trans(
"AllCompletelyPayedInvoiceWillBeClosed");
843 print
'<input type="hidden" name="closepaidinvoices" value="'.GETPOST(
'closepaidinvoices').
'">';
845 print $form->formconfirm($_SERVER[
'PHP_SELF'].
'?facid='.
$object->id.
'&socid='.
$object->socid.
'&type='.
$object->type, $langs->trans(
'PayedSuppliersPayments'), $text,
'confirm_paiement', $formquestion, $preselectedchoice);
if( $user->socid > 0) if(! $user->hasRight('accounting', 'chartofaccount')) $object
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...)
dol_mktime($hour, $minute, $second, $month, $day, $year, $gm='auto', $check=1)
Return a timestamp date built from detailed information (by default a local PHP server timestamp) Rep...
load_fiche_titre($title, $morehtmlright='', $picto='generic', $pictoisfullpath=0, $id='', $morecssontable='', $morehtmlcenter='')
Load a title with picto.
img_warning($titlealt='default', $moreatt='', $morecss='pictowarning')
Show warning logo.
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=0, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2)
Show picto whatever it's its name (generic function)
GETPOSTINT($paramname, $method=0)
Return the value of a $_GET or $_POST supervariable, converted into integer.
dol_get_fiche_head($links=array(), $active='', $title='', $notab=0, $picto='', $pictoisfullpath=0, $morehtmlright='', $morecss='', $limittoshow=0, $moretabssuffix='', $dragdropfile=0)
Show tabs of a record.
price2num($amount, $rounding='', $option=0)
Function that return a number with universal decimal format (decimal separator is '.
dol_get_fiche_end($notab=0)
Return tab footer of a card.
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=null, $encodetooutput=false)
Output date in a string format according to outputlangs (or langs if not defined).
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='', $noduplicate=0)
Set event messages in dol_events session object.
dol_print_error($db=null, $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
getDolGlobalString($key, $default='')
Return dolibarr global constant string value.
dol_escape_htmltag($stringtoescape, $keepb=0, $keepn=0, $noescapetags='', $escapeonlyhtmltags=0, $cleanalsojavascript=0)
Returns text escaped for inclusion in HTML alt or title or value tags, or into values of HTML input f...