36 require
'../../main.inc.php';
37 require_once DOL_DOCUMENT_ROOT.
'/fourn/class/fournisseur.class.php';
38 require_once DOL_DOCUMENT_ROOT.
'/fourn/class/fournisseur.facture.class.php';
39 require_once DOL_DOCUMENT_ROOT.
'/fourn/class/paiementfourn.class.php';
40 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formother.class.php';
41 require_once DOL_DOCUMENT_ROOT.
'/core/lib/date.lib.php';
42 require_once DOL_DOCUMENT_ROOT.
'/core/lib/files.lib.php';
45 $langs->loadLangs(array(
'companies',
'bills',
'banks',
'compta'));
47 $action =
GETPOST(
'action',
'alpha');
48 $confirm =
GETPOST(
'confirm',
'alpha');
49 $optioncss =
GETPOST(
'optioncss',
'alpha');
50 $cancel =
GETPOST(
'cancel',
'alpha');
51 $backtopage =
GETPOST(
'backtopage',
'alpha');
52 $backtopageforcancel =
GETPOST(
'backtopageforcancel',
'alpha');
54 $facid =
GETPOST(
'facid',
'int');
55 $socid =
GETPOST(
'socid',
'int');
56 $accountid =
GETPOST(
'accountid',
'int');
58 $month =
GETPOST(
'month',
'int');
61 $search_ref =
GETPOST(
'search_ref',
'alpha');
62 $search_account =
GETPOST(
'search_account',
'int');
63 $search_paymenttype =
GETPOST(
'search_paymenttype');
64 $search_amount =
GETPOST(
'search_amount',
'alpha');
65 $search_company =
GETPOST(
'search_company',
'alpha');
66 $search_payment_num =
GETPOST(
'search_payment_num',
'alpha');
68 $limit =
GETPOST(
'limit',
'int') ?
GETPOST(
'limit',
'int') : $conf->liste_limit;
69 $sortfield =
GETPOST(
'sortfield',
'aZ09comma');
70 $sortorder =
GETPOST(
'sortorder',
'aZ09comma');
72 if (empty($page) || $page == -1) {
75 $offset = $limit * $page;
76 $pageprev = $page - 1;
77 $pagenext = $page + 1;
82 $sortfield =
"p.rowid";
86 $amountsresttopay = array();
89 $multicurrency_amounts = array();
90 $multicurrency_amountsresttopay = array();
93 if ($user->socid > 0) {
94 $socid = $user->socid;
100 $hookmanager->initHooks(array(
'paymentsupplierlist'));
104 $extrafields->fetch_name_optionals_label($object->table_element);
106 $search_array_options = $extrafields->getOptionalsFromPost($object->table_element,
'',
'search_');
108 $arrayfields = array();
117 if (!empty($backtopageforcancel)) {
118 header(
"Location: ".$backtopageforcancel);
120 } elseif (!empty($backtopage)) {
121 header(
"Location: ".$backtopage);
124 header(
"Location: ".DOL_URL_ROOT.
'/fourn/facture/list.php');
128 if (
GETPOST(
'button_removefilter_x',
'alpha') ||
GETPOST(
'button_removefilter.x',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')) {
130 $search_account =
"";
132 $search_paymenttype =
"";
133 $search_payment_num =
"";
134 $search_company =
"";
138 $search_array_options = array();
141 $parameters = array(
'socid'=>$socid);
142 $reshook = $hookmanager->executeHooks(
'doActions', $parameters, $object, $action);
147 if (empty($reshook)) {
148 if ($action ==
'add_paiement' || ($action ==
'confirm_paiement' && $confirm ==
'yes')) {
154 $atleastonepaymentnotnull = 0;
155 $multicurrency_totalpayment = 0;
159 foreach ($_POST as $key => $value) {
160 if (substr($key, 0, 7) ==
'amount_') {
161 $cursorfacid = substr($key, 7);
163 if (!empty($amounts[$cursorfacid])) {
164 $atleastonepaymentnotnull++;
165 if (is_numeric($amounts[$cursorfacid])) {
166 $totalpayment = $totalpayment + $amounts[$cursorfacid];
171 $result = $tmpinvoice->fetch($cursorfacid);
175 $amountsresttopay[$cursorfacid] =
price2num($tmpinvoice->total_ttc - $tmpinvoice->getSommePaiement());
176 if ($amounts[$cursorfacid]) {
178 if ($amounts[$cursorfacid] && (abs($amounts[$cursorfacid]) > abs($amountsresttopay[$cursorfacid]))) {
180 $formquestion[
'text'] =
img_warning($langs->trans(
"PaymentHigherThanReminderToPaySupplier")).
' '.$langs->trans(
"HelpPaymentHigherThanReminderToPaySupplier");
183 if ($datepaye && ($datepaye < $tmpinvoice->date)) {
184 $langs->load(
"errors");
190 $formquestion[$i++] = array(
'type' =>
'hidden',
'name' => $key,
'value' =>
GETPOST($key));
191 } elseif (substr($key, 0, 21) ==
'multicurrency_amount_') {
192 $cursorfacid = substr($key, 21);
194 $multicurrency_totalpayment += $multicurrency_amounts[$cursorfacid];
195 if (!empty($multicurrency_amounts[$cursorfacid])) {
196 $atleastonepaymentnotnull++;
198 $result = $tmpinvoice->fetch($cursorfacid);
202 $multicurrency_amountsresttopay[$cursorfacid] =
price2num($tmpinvoice->multicurrency_total_ttc - $tmpinvoice->getSommePaiement(1));
203 if ($multicurrency_amounts[$cursorfacid]) {
205 if ($multicurrency_amounts[$cursorfacid] && (abs($multicurrency_amounts[$cursorfacid]) > abs($multicurrency_amountsresttopay[$cursorfacid]))) {
207 $formquestion[
'text'] =
img_warning($langs->trans(
"PaymentHigherThanReminderToPaySupplier")).
' '.$langs->trans(
"HelpPaymentHigherThanReminderToPaySupplier");
210 if ($datepaye && ($datepaye < $tmpinvoice->date)) {
211 $langs->load(
"errors");
217 $formquestion[$i++] = array(
'type' =>
'hidden',
'name' => $key,
'value' =>
GETPOST($key,
'int'));
222 if (
GETPOST(
'paiementid') <= 0) {
223 setEventMessages($langs->transnoentities(
'ErrorFieldRequired', $langs->transnoentities(
'PaymentMode')),
null,
'errors');
227 if (!empty($conf->banque->enabled)) {
229 if (
GETPOST(
'accountid') <= 0) {
230 setEventMessages($langs->transnoentities(
'ErrorFieldRequired', $langs->transnoentities(
'AccountToCredit')),
null,
'errors');
235 if (empty($totalpayment) && empty($multicurrency_totalpayment) && empty($atleastonepaymentnotnull)) {
236 setEventMessages($langs->transnoentities(
'ErrorFieldRequired', $langs->trans(
'PaymentAmount')),
null,
'errors');
240 if (empty($datepaye)) {
241 setEventMessages($langs->transnoentities(
'ErrorFieldRequired', $langs->transnoentities(
'Date')),
null,
'errors');
246 if ($totalpayment > 0 && $multicurrency_totalpayment > 0) {
247 setEventMessages($langs->transnoentities(
'ErrorPaymentInBothCurrency'),
null,
'errors');
255 if ($action ==
'add_paiement') {
266 if ($action ==
'confirm_paiement' && $confirm ==
'yes') {
271 $multicurrency_code = array();
274 foreach ($amounts as $key => $value) {
276 $tmpinvoice->fetch($key);
279 $amounts[$key] = - abs($newvalue);
281 $multicurrency_code[$key] = $tmpinvoice->multicurrency_code;
284 foreach ($multicurrency_amounts as $key => $value) {
286 $tmpinvoice->fetch($key);
289 $multicurrency_amounts[$key] = - abs($newvalue);
291 $multicurrency_code[$key] = $tmpinvoice->multicurrency_code;
301 $thirdparty =
new Societe($db);
303 $thirdparty->fetch($socid);
308 $paiement->datepaye = $datepaye;
309 $paiement->amounts = $amounts;
310 $paiement->multicurrency_amounts = $multicurrency_amounts;
311 $paiement->multicurrency_code = $multicurrency_code;
312 $paiement->paiementid =
GETPOST(
'paiementid',
'int');
313 $paiement->num_payment =
GETPOST(
'num_paiement',
'alphanohtml');
314 $paiement->note_private =
GETPOST(
'comment',
'alpha');
315 $paiement->fk_account =
GETPOST(
'accountid',
'int');
321 $paiement_id = $paiement->create($user, (
GETPOST(
'closepaidinvoices') ==
'on' ? 1 : 0), $thirdparty);
322 if ($paiement_id < 0) {
329 $result = $paiement->addPaymentToBank($user,
'payment_supplier',
'(SupplierInvoicePayment)', $accountid,
GETPOST(
'chqemetteur'),
GETPOST(
'chqbank'));
341 foreach ($paiement->amounts as $key => $amount) {
343 if (is_numeric($amount) && $amount <> 0) {
344 if ($invoiceid != 0) {
351 if ($invoiceid > 0) {
352 $loc = DOL_URL_ROOT.
'/fourn/facture/card.php?facid='.$invoiceid;
354 $loc = DOL_URL_ROOT.
'/fourn/paiement/card.php?id='.$paiement_id;
356 header(
'Location: '.$loc);
373 $supplierstatic =
new Societe($db);
376 llxHeader(
'', $langs->trans(
'ListPayment'));
378 if ($action ==
'create' || $action ==
'confirm_paiement' || $action ==
'add_paiement') {
380 $result = $object->fetch($facid);
383 $dateinvoice = ($datefacture ==
'' ? (empty($conf->global->MAIN_AUTOFILL_DATE) ?-1 :
'') : $datefacture);
385 $sql =
'SELECT s.nom as name, s.rowid as socid,';
386 $sql .=
' f.rowid, f.ref, f.ref_supplier, f.total_ttc as total, f.fk_mode_reglement, f.fk_account';
387 if (empty($user->rights->societe->client->voir) && !$socid) {
388 $sql .=
", sc.fk_soc, sc.fk_user ";
390 $sql .=
' FROM '.MAIN_DB_PREFIX.
'societe as s, '.MAIN_DB_PREFIX.
'facture_fourn as f';
391 if (empty($user->rights->societe->client->voir) && !$socid) {
392 $sql .=
", ".MAIN_DB_PREFIX.
"societe_commerciaux as sc";
394 $sql .=
' WHERE f.fk_soc = s.rowid';
395 $sql .=
' AND f.rowid = '.((int) $facid);
396 if (empty($user->rights->societe->client->voir) && !$socid) {
397 $sql .=
" AND s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $user->id);
399 $resql = $db->query($sql);
401 $num = $db->num_rows(
$resql);
403 $obj = $db->fetch_object(
$resql);
404 $total = $obj->total;
409 if (!empty($conf->use_javascript_ajax)) {
410 print
"\n".
'<script type="text/javascript">';
411 print
'$(document).ready(function () {
413 function _elemToJson(selector)
416 $.map(selector.serializeArray(), function(n,i)
418 subJson[n["name"]] = n["value"];
423 function callForResult(imgId)
425 console.log("callForResult Calculate total of payment");
427 var form = $("#payment_form");
429 json["invoice_type"] = $("#invoice_type").val();
430 json["amountPayment"] = $("#amountpayment").attr("value");
431 json["amounts"] = _elemToJson(form.find("input.amount"));
432 json["remains"] = _elemToJson(form.find("input.remain"));
433 json["token"] = "'.currentToken().
'";
435 json["imgClicked"] = imgId;
438 $.post("'.DOL_URL_ROOT.
'/compta/ajaxpayment.php", json, function(data)
440 json = $.parseJSON(data);
444 for (var key in json)
446 if (key == "result") {
447 if (json["makeRed"]) {
448 $("#"+key).addClass("error");
450 $("#"+key).removeClass("error");
452 json[key]=json["label"]+" "+json[key];
453 $("#"+key).text(json[key]);
454 } else {console.log(key);
455 form.find("input[name*=\""+key+"\"]").each(function() {
456 $(this).attr("value", json[key]);
463 $("#payment_form").find("input.amount").change(function() {
466 $("#payment_form").find("input.amount").keyup(function() {
474 print
' $(document).ready(function () {';
475 print
' $(".AutoFillAmout").on(\'click touchstart\', function(){
476 $("input[name="+$(this).data(\'rowname\')+"]").val($(this).data("value")).trigger("change");
480 print
' </script>'.
"\n";
483 print
'<form id="payment_form" name="addpaiement" action="'.$_SERVER[
"PHP_SELF"].
'" method="POST">';
484 print
'<input type="hidden" name="token" value="'.newToken().
'">';
485 print
'<input type="hidden" name="action" value="add_paiement">';
486 print
'<input type="hidden" name="facid" value="'.$facid.
'">';
487 print
'<input type="hidden" name="ref_supplier" value="'.$obj->ref_supplier.
'">';
488 print
'<input type="hidden" name="socid" value="'.$obj->socid.
'">';
489 print
'<input type="hidden" name="type" id="invoice_type" value="'.$object->type.
'">';
490 print
'<input type="hidden" name="societe" value="'.$obj->name.
'">';
494 print
'<table class="border centpercent">';
496 print
'<tr><td class="fieldrequired titlefieldcreate">'.$langs->trans(
'Company').
'</td><td>';
497 $supplierstatic->id = $obj->socid;
498 $supplierstatic->name = $obj->name;
499 print $supplierstatic->getNomUrl(1,
'supplier');
501 print
'<tr><td class="fieldrequired">'.$langs->trans(
'Date').
'</td><td>';
502 print
$form->selectDate($dateinvoice,
'',
'',
'', 0,
"addpaiement", 1, 1, 0,
'',
'', $object->date);
504 print
'<tr><td class="fieldrequired">'.$langs->trans(
'PaymentMode').
'</td><td>';
505 $form->select_types_paiements(!
GETPOST(
'paiementid') ? $obj->fk_mode_reglement :
GETPOST(
'paiementid'),
'paiementid');
507 if (!empty($conf->banque->enabled)) {
508 print
'<tr><td class="fieldrequired">'.$langs->trans(
'Account').
'</td><td>';
509 print
img_picto(
'',
'bank_account',
'class="pictofixedwidth"');
510 print
$form->select_comptes(empty($accountid) ? $obj->fk_account : $accountid,
'accountid', 0,
'', 2,
'', 0,
'widthcentpercentminusx maxwidth500', 1);
513 print
'<tr><td> </td></tr>';
515 print
'<tr><td>'.$langs->trans(
'Numero').
'</td><td><input name="num_paiement" type="text" value="'.(!
GETPOST(
'num_paiement') ?
'' :
GETPOST(
'num_paiement')).
'"></td></tr>';
516 print
'<tr><td>'.$langs->trans(
'Comments').
'</td>';
517 print
'<td class="tdtop">';
518 print
'<textarea name="comment" wrap="soft" class="quatrevingtpercent" rows="'.ROWS_3.
'">'.(!
GETPOST(
'comment') ?
'' :
GETPOST(
'comment')).
'</textarea></td></tr>';
523 $parameters = array(
'facid'=>$facid,
'ref'=>$ref,
'objcanvas'=>$objcanvas);
524 $reshook = $hookmanager->executeHooks(
'paymentsupplierinvoices', $parameters, $object, $action);
525 $error = $hookmanager->error; $errors = $hookmanager->errors;
526 if (empty($reshook)) {
530 $sql =
'SELECT f.rowid as facid, f.ref, f.ref_supplier, f.type, f.total_ht, f.total_ttc,';
531 $sql .=
' f.multicurrency_code, f.multicurrency_tx, f.multicurrency_total_ht, f.multicurrency_total_tva, f.multicurrency_total_ttc,';
532 $sql .=
' f.datef as df, f.date_lim_reglement as dlr,';
533 $sql .=
' SUM(pf.amount) as am, SUM(pf.multicurrency_amount) as multicurrency_am';
534 $sql .=
' FROM '.MAIN_DB_PREFIX.
'facture_fourn as f';
535 $sql .=
' LEFT JOIN '.MAIN_DB_PREFIX.
'paiementfourn_facturefourn as pf ON pf.fk_facturefourn = f.rowid';
536 $sql .=
" WHERE f.entity = ".((int) $conf->entity);
537 $sql .=
' AND f.fk_soc = '.((int) $object->socid);
538 $sql .=
' AND f.paye = 0';
539 $sql .=
' AND f.fk_statut = 1';
541 $sql .=
' AND f.type IN (0,1,3,5)';
543 $sql .=
' AND f.type = 2';
546 $sql .=
' GROUP BY f.datef, f.ref, f.ref_supplier, f.rowid, f.type, f.total_ht, f.total_ttc,';
547 $sql .=
' f.multicurrency_code, f.multicurrency_tx, f.multicurrency_total_ht, f.multicurrency_total_tva, f.multicurrency_total_ttc,';
548 $sql .=
' f.datef, f.date_lim_reglement';
550 $sql .=
' ORDER BY f.datef ASC, f.ref ASC';
552 $resql = $db->query($sql);
554 $num = $db->num_rows(
$resql);
559 if (!empty($conf->use_javascript_ajax)) {
561 print
"\n".
'<script type="text/javascript">';
562 print
' $(document).ready(function () {';
563 print
' $(".AutoFillAmout").on(\'click touchstart\', function(){
564 $("input[name="+$(this).data(\'rowname\')+"]").val($(this).data("value"));
567 print
' </script>'.
"\n";
570 print
'<div class="div-table-responsive-no-min">';
571 print
'<table class="tagtable liste'.($moreforfilter ?
" listwithfilterbefore" :
"").
'">'.
"\n";
573 print
'<tr class="liste_titre">';
574 print
'<td>'.$langs->trans(
'Invoice').
'</td>';
575 print
'<td>'.$langs->trans(
'RefSupplier').
'</td>';
576 print
'<td class="center">'.$langs->trans(
'Date').
'</td>';
577 print
'<td class="center">'.$langs->trans(
'DateMaxPayment').
'</td>';
578 if (!empty($conf->multicurrency->enabled)) {
579 print
'<td>'.$langs->trans(
'Currency').
'</td>';
580 print
'<td class="right">'.$langs->trans(
'MulticurrencyAmountTTC').
'</td>';
581 print
'<td class="right">'.$langs->trans(
'MulticurrencyAlreadyPaid').
'</td>';
582 print
'<td class="right">'.$langs->trans(
'MulticurrencyRemainderToPay').
'</td>';
583 print
'<td class="center">'.$langs->trans(
'MulticurrencyPaymentAmount').
'</td>';
585 print
'<td class="right">'.$langs->trans(
'AmountTTC').
'</td>';
586 print
'<td class="right">'.$langs->trans(
'AlreadyPaid').
'</td>';
587 print
'<td class="right">'.$langs->trans(
'RemainderToPay').
'</td>';
588 print
'<td class="center">'.$langs->trans(
'PaymentAmount').
'</td>';
595 $objp = $db->fetch_object(
$resql);
603 $invoice->fetch($objp->facid);
605 $invoicesupplierstatic->ref = $objp->ref;
606 $invoicesupplierstatic->id = $objp->facid;
608 $paiement = $invoice->getSommePaiement();
609 $creditnotes = $invoice->getSumCreditNotesUsed();
610 $deposits = $invoice->getSumDepositsUsed();
611 $alreadypayed =
price2num($paiement + $creditnotes + $deposits,
'MT');
612 $remaintopay =
price2num($invoice->total_ttc - $paiement - $creditnotes - $deposits,
'MT');
615 if (!empty($conf->multicurrency->enabled)) {
616 $multicurrency_payment = $invoice->getSommePaiement(1);
617 $multicurrency_creditnotes = $invoice->getSumCreditNotesUsed(1);
618 $multicurrency_deposits = $invoice->getSumDepositsUsed(1);
619 $multicurrency_alreadypayed =
price2num($multicurrency_payment + $multicurrency_creditnotes + $multicurrency_deposits,
'MT');
620 $multicurrency_remaintopay =
price2num($invoice->multicurrency_total_ttc - $multicurrency_payment - $multicurrency_creditnotes - $multicurrency_deposits,
'MT');
623 print
'<tr class="oddeven'.(($invoice->id == $facid) ?
' highlight' :
'').
'">';
626 print
'<td class="nowraponall">';
627 print $invoicesupplierstatic->getNomUrl(1);
631 print
'<td>'.$objp->ref_supplier.
'</td>';
635 print
'<td class="center nowraponall">';
638 print
'<td class="center"><b>!!!</b></td>';
642 if ($objp->dlr > 0) {
643 print
'<td class="center nowraponall">';
646 if ($invoice->hasDelay()) {
652 print
'<td class="center"><b>--</b></td>';
656 if (!empty($conf->multicurrency->enabled)) {
658 print
'<td class="center">'.$objp->multicurrency_code.
"</td>\n";
660 print
'<td class="right">';
661 if ($objp->multicurrency_code && $objp->multicurrency_code != $conf->currency) {
662 print
price($objp->multicurrency_total_ttc);
666 print
'<td class="right">';
667 if ($objp->multicurrency_code && $objp->multicurrency_code != $conf->currency) {
668 print
price($sign * $multicurrency_payment);
669 if ($multicurrency_creditnotes) {
670 print
'+'.price($multicurrency_creditnotes);
672 if ($multicurrency_deposits) {
673 print
'+'.price($multicurrency_deposits);
678 print
'<td class="right">';
679 if ($objp->multicurrency_code && $objp->multicurrency_code != $conf->currency) {
680 print
price($sign * $multicurrency_remaintopay);
684 print
'<td class="right">';
686 $namef =
'multicurrency_amount_'.$objp->facid;
687 $nameRemain =
'multicurrency_remain_'.$objp->facid;
688 if ($objp->multicurrency_code && $objp->multicurrency_code != $conf->currency) {
689 if ($action !=
'add_paiement') {
690 if (!empty($conf->use_javascript_ajax)) {
691 print
img_picto(
"Auto fill",
'rightarrow',
"class='AutoFillAmout' data-rowname='".$namef.
"' data-value='".($sign * $multicurrency_remaintopay).
"'");
693 print
'<input type=hidden class="multicurrency_remain" name="'.$nameRemain.
'" value="'.$multicurrency_remaintopay.
'">';
694 print
'<input type="text" size="8" class="multicurrency_amount" name="'.$namef.
'" value="'.
GETPOST($namef).
'">';
696 print
'<input type="text" size="8" name="'.$namef.
'_disabled" value="'.
GETPOST($namef).
'" disabled>';
697 print
'<input type="hidden" name="'.$namef.
'" value="'.
GETPOST($namef).
'">';
703 print
'<td class="right">'.price($sign * $objp->total_ttc).
'</td>';
705 print
'<td class="right">'.price($sign * $objp->am);
707 print
'+'.price($creditnotes);
710 print
'+'.price($deposits);
714 print
'<td class="right">';
715 print
price($sign * $remaintopay);
716 if (!empty($conf->paymentbybanktransfer->enabled)) {
717 $numdirectdebitopen = 0;
718 $totaldirectdebit = 0;
719 $sql =
"SELECT COUNT(pfd.rowid) as nb, SUM(pfd.amount) as amount";
720 $sql .=
" FROM ".MAIN_DB_PREFIX.
"prelevement_facture_demande as pfd";
721 $sql .=
" WHERE fk_facture_fourn = ".((int) $objp->facid);
722 $sql .=
" AND pfd.traite = 0";
723 $sql .=
" AND pfd.ext_payment_id IS NULL";
725 $result_sql = $db->query($sql);
727 $obj = $db->fetch_object($result_sql);
728 $numdirectdebitopen = $obj->nb;
729 $totaldirectdebit = $obj->amount;
733 if ($numdirectdebitopen) {
734 $langs->load(
"withdrawals");
735 print
img_warning($langs->trans(
"WarningSomeCreditTransferAlreadyExists", $numdirectdebitopen,
price(
price2num($totaldirectdebit,
'MT'), 0, $langs, 1, -1, -1, $conf->currency)),
'',
'classfortooltip');
741 print
'<td class="center nowraponall">';
743 $namef =
'amount_'.$objp->facid;
744 $nameRemain =
'remain_'.$objp->facid;
746 if ($action !=
'add_paiement') {
747 if (!empty($conf->use_javascript_ajax)) {
748 print
img_picto(
"Auto fill",
'rightarrow',
"class='AutoFillAmout' data-rowname='".$namef.
"' data-value='".($sign * $remaintopay).
"'");
750 print
'<input type="hidden" class="remain" name="'.$nameRemain.
'" value="'.$remaintopay.
'">';
753 print
'<input type="text" size="8" name="'.$namef.
'_disabled" value="'.
dol_escape_htmltag(
GETPOST($namef)).
'" disabled>';
759 $total += $objp->total_ht;
760 $total_ttc += $objp->total_ttc;
761 $totalrecu += $objp->am;
762 $totalrecucreditnote += $creditnotes;
763 $totalrecudeposits += $deposits;
768 print
'<tr class="liste_total">';
769 print
'<td colspan="4" class="left">'.$langs->trans(
'TotalTTC').
':</td>';
770 if (!empty($conf->multicurrency->enabled)) {
771 print
'<td> </td>';
772 print
'<td> </td>';
773 print
'<td> </td>';
774 print
'<td> </td>';
775 print
'<td class="right" id="multicurrency_result" style="font-weight: bold;"></td>';
777 print
'<td class="right"><b>'.price($sign * $total_ttc).
'</b></td>';
778 print
'<td class="right"><b>'.price($sign * $totalrecu);
779 if ($totalrecucreditnote) {
780 print
'+'.price($totalrecucreditnote);
782 if ($totalrecudeposits) {
783 print
'+'.price($totalrecudeposits);
786 print
'<td class="right"><b>'.price($sign *
price2num($total_ttc - $totalrecu - $totalrecucreditnote - $totalrecudeposits,
'MT')).
'</b></td>';
787 print
'<td class="center" id="result" style="font-weight: bold;"></td>';
801 if ($action !=
'add_paiement') {
802 print
'<br><div class="center">';
803 print
'<input type="checkbox" checked id="closepaidinvoices" name="closepaidinvoices"> <label for="closepaidinvoices">'.$langs->trans(
"ClosePaidInvoicesAutomatically").
'</label><br>';
804 print
'<input type="submit" class="button" value="'.$langs->trans(
'ToMakePayment').
'">';
805 print
' <input type="submit" class="button button-cancel" name="cancel" value="'.$langs->trans(
"Cancel").
'">';
810 if ($action ==
'add_paiement') {
811 $preselectedchoice = $addwarning ?
'no' :
'yes';
814 if (!empty($totalpayment)) {
815 $text = $langs->trans(
'ConfirmSupplierPayment',
price($totalpayment), $langs->trans(
"Currency".$conf->currency));
817 if (!empty($multicurrency_totalpayment)) {
818 $text .=
'<br>'.$langs->trans(
'ConfirmSupplierPayment',
price($multicurrency_totalpayment), $langs->trans(
"paymentInInvoiceCurrency"));
820 if (
GETPOST(
'closepaidinvoices')) {
821 $text .=
'<br>'.$langs->trans(
"AllCompletelyPayedInvoiceWillBeClosed");
822 print
'<input type="hidden" name="closepaidinvoices" value="'.GETPOST(
'closepaidinvoices').
'">';
824 print
$form->formconfirm($_SERVER[
'PHP_SELF'].
'?facid='.$facture->id.
'&socid='.$facture->socid.
'&type='.$facture->type, $langs->trans(
'PayedSuppliersPayments'), $text,
'confirm_paiement', $formquestion, $preselectedchoice);