38require
'../../main.inc.php';
39require_once DOL_DOCUMENT_ROOT.
'/fourn/class/fournisseur.class.php';
40require_once DOL_DOCUMENT_ROOT.
'/fourn/class/fournisseur.facture.class.php';
41require_once DOL_DOCUMENT_ROOT.
'/fourn/class/paiementfourn.class.php';
42require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formother.class.php';
43require_once DOL_DOCUMENT_ROOT.
'/core/lib/date.lib.php';
44require_once DOL_DOCUMENT_ROOT.
'/core/lib/files.lib.php';
47$langs->loadLangs(array(
'companies',
'bills',
'banks',
'compta'));
49$action =
GETPOST(
'action',
'alpha');
50$confirm =
GETPOST(
'confirm',
'alpha');
51$optioncss =
GETPOST(
'optioncss',
'alpha');
52$cancel =
GETPOST(
'cancel',
'alpha');
53$backtopage =
GETPOST(
'backtopage',
'alpha');
54$backtopageforcancel =
GETPOST(
'backtopageforcancel',
'alpha');
56$facid =
GETPOST(
'facid',
'int');
57$socid =
GETPOST(
'socid',
'int');
58$accountid =
GETPOST(
'accountid',
'int');
60$month =
GETPOST(
'month',
'int');
63$search_ref =
GETPOST(
'search_ref',
'alpha');
64$search_account =
GETPOST(
'search_account',
'int');
65$search_paymenttype =
GETPOST(
'search_paymenttype');
66$search_amount =
GETPOST(
'search_amount',
'alpha');
67$search_company =
GETPOST(
'search_company',
'alpha');
68$search_payment_num =
GETPOST(
'search_payment_num',
'alpha');
70$limit =
GETPOST(
'limit',
'int') ?
GETPOST(
'limit',
'int') : $conf->liste_limit;
71$sortfield =
GETPOST(
'sortfield',
'aZ09comma');
72$sortorder =
GETPOST(
'sortorder',
'aZ09comma');
73$page = GETPOSTISSET(
'pageplusone') ? (
GETPOST(
'pageplusone') - 1) :
GETPOST(
"page",
'int');
74if (empty($page) || $page == -1) {
77$offset = $limit * $page;
84 $sortfield =
"p.rowid";
88$amountsresttopay = array();
91$multicurrency_amounts = array();
92$multicurrency_amountsresttopay = array();
95if ($user->socid > 0) {
96 $socid = $user->socid;
102$hookmanager->initHooks(array(
'paymentsupplierlist'));
106$extrafields->fetch_name_optionals_label($object->table_element);
108$search_array_options = $extrafields->getOptionalsFromPost($object->table_element,
'',
'search_');
110$arrayfields = array();
119 if (!empty($backtopageforcancel)) {
120 header(
"Location: ".$backtopageforcancel);
122 } elseif (!empty($backtopage)) {
123 header(
"Location: ".$backtopage);
126 header(
"Location: ".DOL_URL_ROOT.
'/fourn/facture/list.php');
130if (
GETPOST(
'button_removefilter_x',
'alpha') ||
GETPOST(
'button_removefilter.x',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')) {
132 $search_account =
"";
134 $search_paymenttype =
"";
135 $search_payment_num =
"";
136 $search_company =
"";
140 $search_array_options = array();
143$parameters = array(
'socid'=>$socid);
144$reshook = $hookmanager->executeHooks(
'doActions', $parameters, $object, $action);
149if (empty($reshook)) {
150 if ($action ==
'add_paiement' || ($action ==
'confirm_paiement' && $confirm ==
'yes')) {
156 $atleastonepaymentnotnull = 0;
157 $multicurrency_totalpayment = 0;
161 foreach ($_POST as $key => $value) {
162 if (substr($key, 0, 7) ==
'amount_') {
163 $cursorfacid = substr($key, 7);
165 if (!empty($amounts[$cursorfacid])) {
166 $atleastonepaymentnotnull++;
167 if (is_numeric($amounts[$cursorfacid])) {
168 $totalpayment = $totalpayment + $amounts[$cursorfacid];
173 $result = $tmpinvoice->fetch($cursorfacid);
177 $amountsresttopay[$cursorfacid] =
price2num($tmpinvoice->total_ttc - $tmpinvoice->getSommePaiement());
178 if ($amounts[$cursorfacid]) {
180 if ($amounts[$cursorfacid] && (abs($amounts[$cursorfacid]) > abs($amountsresttopay[$cursorfacid]))) {
182 $formquestion[
'text'] =
img_warning($langs->trans(
"PaymentHigherThanReminderToPaySupplier")).
' '.$langs->trans(
"HelpPaymentHigherThanReminderToPaySupplier");
185 if ($datepaye && ($datepaye < $tmpinvoice->date)) {
186 $langs->load(
"errors");
192 $formquestion[$i++] = array(
'type' =>
'hidden',
'name' => $key,
'value' =>
GETPOST($key));
193 } elseif (substr($key, 0, 21) ==
'multicurrency_amount_') {
194 $cursorfacid = substr($key, 21);
196 $multicurrency_totalpayment += $multicurrency_amounts[$cursorfacid];
197 if (!empty($multicurrency_amounts[$cursorfacid])) {
198 $atleastonepaymentnotnull++;
200 $result = $tmpinvoice->fetch($cursorfacid);
204 $multicurrency_amountsresttopay[$cursorfacid] =
price2num($tmpinvoice->multicurrency_total_ttc - $tmpinvoice->getSommePaiement(1));
205 if ($multicurrency_amounts[$cursorfacid]) {
207 if ($multicurrency_amounts[$cursorfacid] && (abs($multicurrency_amounts[$cursorfacid]) > abs($multicurrency_amountsresttopay[$cursorfacid]))) {
209 $formquestion[
'text'] =
img_warning($langs->trans(
"PaymentHigherThanReminderToPaySupplier")).
' '.$langs->trans(
"HelpPaymentHigherThanReminderToPaySupplier");
212 if ($datepaye && ($datepaye < $tmpinvoice->date)) {
213 $langs->load(
"errors");
219 $formquestion[$i++] = array(
'type' =>
'hidden',
'name' => $key,
'value' =>
GETPOST($key,
'int'));
224 if (
GETPOST(
'paiementid') <= 0) {
225 setEventMessages($langs->transnoentities(
'ErrorFieldRequired', $langs->transnoentities(
'PaymentMode')),
null,
'errors');
229 if (isModEnabled(
"banque")) {
231 if (
GETPOST(
'accountid') <= 0) {
232 setEventMessages($langs->transnoentities(
'ErrorFieldRequired', $langs->transnoentities(
'AccountToCredit')),
null,
'errors');
237 if (empty($totalpayment) && empty($multicurrency_totalpayment) && empty($atleastonepaymentnotnull)) {
238 setEventMessages($langs->transnoentities(
'ErrorFieldRequired', $langs->trans(
'PaymentAmount')),
null,
'errors');
242 if (empty($datepaye)) {
243 setEventMessages($langs->transnoentities(
'ErrorFieldRequired', $langs->transnoentities(
'Date')),
null,
'errors');
248 if ($totalpayment > 0 && $multicurrency_totalpayment > 0) {
249 setEventMessages($langs->transnoentities(
'ErrorPaymentInBothCurrency'),
null,
'errors');
257 if ($action ==
'add_paiement') {
268 if ($action ==
'confirm_paiement' && $confirm ==
'yes') {
273 $multicurrency_code = array();
274 $multicurrency_tx = array();
277 foreach ($amounts as $key => $value) {
279 $tmpinvoice->fetch($key);
282 $amounts[$key] = - abs($newvalue);
284 $multicurrency_code[$key] = $tmpinvoice->multicurrency_code;
285 $multicurrency_tx[$key] = $tmpinvoice->multicurrency_tx;
288 foreach ($multicurrency_amounts as $key => $value) {
290 $tmpinvoice->fetch($key);
293 $multicurrency_amounts[$key] = - abs($newvalue);
295 $multicurrency_code[$key] = $tmpinvoice->multicurrency_code;
296 $multicurrency_tx[$key] = $tmpinvoice->multicurrency_tx;
306 $thirdparty =
new Societe($db);
308 $thirdparty->fetch($socid);
313 $paiement->datepaye = $datepaye;
314 $paiement->amounts = $amounts;
315 $paiement->multicurrency_amounts = $multicurrency_amounts;
316 $paiement->multicurrency_code = $multicurrency_code;
317 $paiement->multicurrency_tx = $multicurrency_tx;
318 $paiement->paiementid =
GETPOST(
'paiementid',
'int');
319 $paiement->num_payment =
GETPOST(
'num_paiement',
'alphanohtml');
320 $paiement->note_private =
GETPOST(
'comment',
'alpha');
321 $paiement->fk_account =
GETPOST(
'accountid',
'int');
327 $paiement_id = $paiement->create($user, (
GETPOST(
'closepaidinvoices') ==
'on' ? 1 : 0), $thirdparty);
328 if ($paiement_id < 0) {
335 $result = $paiement->addPaymentToBank($user,
'payment_supplier',
'(SupplierInvoicePayment)', $accountid,
GETPOST(
'chqemetteur'),
GETPOST(
'chqbank'));
347 foreach ($paiement->amounts as $key => $amount) {
349 if (is_numeric($amount) && $amount <> 0) {
350 if ($invoiceid != 0) {
357 if ($invoiceid > 0) {
358 $loc = DOL_URL_ROOT.
'/fourn/facture/card.php?facid='.$invoiceid;
360 $loc = DOL_URL_ROOT.
'/fourn/paiement/card.php?id='.$paiement_id;
362 header(
'Location: '.$loc);
376$form =
new Form($db);
379$supplierstatic =
new Societe($db);
382llxHeader(
'', $langs->trans(
'ListPayment'));
384if ($action ==
'create' || $action ==
'confirm_paiement' || $action ==
'add_paiement') {
386 $result = $object->fetch($facid);
389 $dateinvoice = ($datefacture ==
'' ? (empty($conf->global->MAIN_AUTOFILL_DATE) ?-1 :
'') : $datefacture);
391 $sql =
'SELECT s.nom as name, s.rowid as socid,';
392 $sql .=
' f.rowid, f.ref, f.ref_supplier, f.total_ttc as total, f.fk_mode_reglement, f.fk_account';
393 if (!$user->hasRight(
"societe",
"client",
"voir") && !$socid) {
394 $sql .=
", sc.fk_soc, sc.fk_user ";
396 $sql .=
' FROM '.MAIN_DB_PREFIX.
'societe as s, '.MAIN_DB_PREFIX.
'facture_fourn as f';
397 if (!$user->hasRight(
"societe",
"client",
"voir") && !$socid) {
398 $sql .=
", ".MAIN_DB_PREFIX.
"societe_commerciaux as sc";
400 $sql .=
' WHERE f.fk_soc = s.rowid';
401 $sql .=
' AND f.rowid = '.((int) $facid);
402 if (!$user->hasRight(
"societe",
"client",
"voir") && !$socid) {
403 $sql .=
" AND s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $user->id);
405 $resql = $db->query($sql);
407 $num = $db->num_rows($resql);
409 $obj = $db->fetch_object($resql);
410 $total = $obj->total;
415 if (!empty($conf->use_javascript_ajax)) {
416 print
"\n".
'<script type="text/javascript">';
417 print
'$(document).ready(function () {
419 function _elemToJson(selector)
422 $.map(selector.serializeArray(), function(n,i)
424 subJson[n["name"]] = n["value"];
429 function callForResult(imgId)
431 console.log("callForResult Calculate total of payment");
433 var form = $("#payment_form");
435 json["invoice_type"] = $("#invoice_type").val();
436 json["amountPayment"] = $("#amountpayment").attr("value");
437 json["amounts"] = _elemToJson(form.find("input.amount"));
438 json["remains"] = _elemToJson(form.find("input.remain"));
439 json["token"] = "'.currentToken().
'";
441 json["imgClicked"] = imgId;
444 $.post("'.DOL_URL_ROOT.
'/compta/ajaxpayment.php", json, function(data)
446 json = $.parseJSON(data);
450 for (var key in json)
452 if (key == "result") {
453 if (json["makeRed"]) {
454 $("#"+key).addClass("error");
456 $("#"+key).removeClass("error");
458 json[key]=json["label"]+" "+json[key];
459 $("#"+key).text(json[key]);
460 } else {console.log(key);
461 form.find("input[name*=\""+key+"\"]").each(function() {
462 $(this).attr("value", json[key]);
469 $("#payment_form").find("input.amount").change(function() {
472 $("#payment_form").find("input.amount").keyup(function() {
480 print
' $(document).ready(function () {';
481 print
' $(".AutoFillAmout").on(\'click touchstart\', function(){
482 $("input[name="+$(this).data(\'rowname\')+"]").val($(this).data("value")).trigger("change");
486 print
' </script>'.
"\n";
489 print
'<form id="payment_form" name="addpaiement" action="'.$_SERVER[
"PHP_SELF"].
'" method="POST">';
490 print
'<input type="hidden" name="token" value="'.newToken().
'">';
491 print
'<input type="hidden" name="action" value="add_paiement">';
492 print
'<input type="hidden" name="facid" value="'.$facid.
'">';
493 print
'<input type="hidden" name="ref_supplier" value="'.$obj->ref_supplier.
'">';
494 print
'<input type="hidden" name="socid" value="'.$obj->socid.
'">';
495 print
'<input type="hidden" name="type" id="invoice_type" value="'.$object->type.
'">';
496 print
'<input type="hidden" name="societe" value="'.$obj->name.
'">';
500 print
'<table class="border centpercent">';
502 print
'<tr><td class="fieldrequired titlefieldcreate">'.$langs->trans(
'Company').
'</td><td>';
503 $supplierstatic->id = $obj->socid;
504 $supplierstatic->name = $obj->name;
505 print $supplierstatic->getNomUrl(1,
'supplier');
508 print
'<tr><td class="fieldrequired">'.$langs->trans(
'Date').
'</td><td>';
510 $adddateof = array(array(
'adddateof'=>$object->date));
511 $adddateof[] = array(
'adddateof'=>$object->date_echeance,
'labeladddateof'=>$langs->transnoentities(
'DateDue'));
512 print $form->selectDate($dateinvoice,
'',
'',
'', 0,
"addpaiement", 1, 1, 0,
'',
'', $adddateof);
514 print
'<tr><td class="fieldrequired">'.$langs->trans(
'PaymentMode').
'</td><td>';
515 $form->select_types_paiements(!
GETPOST(
'paiementid') ? $obj->fk_mode_reglement :
GETPOST(
'paiementid'),
'paiementid');
517 if (isModEnabled(
"banque")) {
518 print
'<tr><td class="fieldrequired">'.$langs->trans(
'Account').
'</td><td>';
519 print
img_picto(
'',
'bank_account',
'class="pictofixedwidth"');
520 print $form->select_comptes(empty($accountid) ? $obj->fk_account : $accountid,
'accountid', 0,
'', 2,
'', 0,
'widthcentpercentminusx maxwidth500', 1);
523 print
'<tr><td> </td></tr>';
525 print
'<tr><td>'.$langs->trans(
'Numero').
'</td><td><input name="num_paiement" type="text" value="'.(!
GETPOST(
'num_paiement') ?
'' :
GETPOST(
'num_paiement')).
'"></td></tr>';
526 print
'<tr><td>'.$langs->trans(
'Comments').
'</td>';
527 print
'<td class="tdtop">';
528 print
'<textarea name="comment" wrap="soft" class="quatrevingtpercent" rows="'.ROWS_3.
'">'.(!
GETPOST(
'comment') ?
'' :
GETPOST(
'comment')).
'</textarea></td></tr>';
533 $parameters = array(
'facid'=>$facid,
'ref'=>$ref,
'objcanvas'=>$objcanvas);
534 $reshook = $hookmanager->executeHooks(
'paymentsupplierinvoices', $parameters, $object, $action);
535 $error = $hookmanager->error; $errors = $hookmanager->errors;
536 if (empty($reshook)) {
540 $sql =
'SELECT f.rowid as facid, f.ref, f.ref_supplier, f.type, f.total_ht, f.total_ttc,';
541 $sql .=
' f.multicurrency_code, f.multicurrency_tx, f.multicurrency_total_ht, f.multicurrency_total_tva, f.multicurrency_total_ttc,';
542 $sql .=
' f.datef as df, f.date_lim_reglement as dlr,';
543 $sql .=
' SUM(pf.amount) as am, SUM(pf.multicurrency_amount) as multicurrency_am';
544 $sql .=
' FROM '.MAIN_DB_PREFIX.
'facture_fourn as f';
545 $sql .=
' LEFT JOIN '.MAIN_DB_PREFIX.
'paiementfourn_facturefourn as pf ON pf.fk_facturefourn = f.rowid';
546 $sql .=
" WHERE f.entity = ".((int) $conf->entity);
547 $sql .=
' AND f.fk_soc = '.((int) $object->socid);
548 $sql .=
' AND f.paye = 0';
549 $sql .=
' AND f.fk_statut = 1';
551 $sql .=
' AND f.type IN (0,1,3,5)';
553 $sql .=
' AND f.type = 2';
556 $sql .=
' GROUP BY f.datef, f.ref, f.ref_supplier, f.rowid, f.type, f.total_ht, f.total_ttc,';
557 $sql .=
' f.multicurrency_code, f.multicurrency_tx, f.multicurrency_total_ht, f.multicurrency_total_tva, f.multicurrency_total_ttc,';
558 $sql .=
' f.datef, f.date_lim_reglement';
560 $sql .=
' ORDER BY f.datef ASC, f.ref ASC';
562 $resql = $db->query($sql);
564 $num = $db->num_rows($resql);
569 if (!empty($conf->use_javascript_ajax)) {
571 print
"\n".
'<script type="text/javascript">';
572 print
' $(document).ready(function () {';
573 print
' $(".AutoFillAmout").on(\'click touchstart\', function(){
574 $("input[name="+$(this).data(\'rowname\')+"]").val($(this).data("value"));
577 print
' </script>'.
"\n";
580 print
'<div class="div-table-responsive-no-min">';
581 print
'<table class="tagtable liste'.($moreforfilter ?
" listwithfilterbefore" :
"").
'">'.
"\n";
583 print
'<tr class="liste_titre">';
584 print
'<td>'.$langs->trans(
'Invoice').
'</td>';
585 print
'<td>'.$langs->trans(
'RefSupplier').
'</td>';
586 print
'<td class="center">'.$langs->trans(
'Date').
'</td>';
587 print
'<td class="center">'.$langs->trans(
'DateMaxPayment').
'</td>';
588 if (isModEnabled(
"multicurrency")) {
589 print
'<td>'.$langs->trans(
'Currency').
'</td>';
590 print
'<td class="right">'.$langs->trans(
'MulticurrencyAmountTTC').
'</td>';
591 print
'<td class="right">'.$langs->trans(
'MulticurrencyAlreadyPaid').
'</td>';
592 print
'<td class="right">'.$langs->trans(
'MulticurrencyRemainderToPay').
'</td>';
593 print
'<td class="center">'.$langs->trans(
'MulticurrencyPaymentAmount').
'</td>';
595 print
'<td class="right">'.$langs->trans(
'AmountTTC').
'</td>';
596 print
'<td class="right">'.$langs->trans(
'AlreadyPaid').
'</td>';
597 print
'<td class="right">'.$langs->trans(
'RemainderToPay').
'</td>';
598 print
'<td class="center">'.$langs->trans(
'PaymentAmount').
'</td>';
605 $objp = $db->fetch_object($resql);
613 $invoice->fetch($objp->facid);
615 $invoicesupplierstatic->ref = $objp->ref;
616 $invoicesupplierstatic->id = $objp->facid;
618 $paiement = $invoice->getSommePaiement();
619 $creditnotes = $invoice->getSumCreditNotesUsed();
620 $deposits = $invoice->getSumDepositsUsed();
621 $alreadypayed =
price2num($paiement + $creditnotes + $deposits,
'MT');
622 $remaintopay =
price2num($invoice->total_ttc - $paiement - $creditnotes - $deposits,
'MT');
625 if (isModEnabled(
"multicurrency")) {
626 $multicurrency_payment = $invoice->getSommePaiement(1);
627 $multicurrency_creditnotes = $invoice->getSumCreditNotesUsed(1);
628 $multicurrency_deposits = $invoice->getSumDepositsUsed(1);
629 $multicurrency_alreadypayed =
price2num($multicurrency_payment + $multicurrency_creditnotes + $multicurrency_deposits,
'MT');
630 $multicurrency_remaintopay =
price2num($invoice->multicurrency_total_ttc - $multicurrency_payment - $multicurrency_creditnotes - $multicurrency_deposits,
'MT');
633 print
'<tr class="oddeven'.(($invoice->id == $facid) ?
' highlight' :
'').
'">';
636 print
'<td class="nowraponall">';
637 print $invoicesupplierstatic->getNomUrl(1);
641 print
'<td>'.$objp->ref_supplier.
'</td>';
645 print
'<td class="center nowraponall">';
648 print
'<td class="center"><b>!!!</b></td>';
652 if ($objp->dlr > 0) {
653 print
'<td class="center nowraponall">';
656 if ($invoice->hasDelay()) {
662 print
'<td class="center"><b>--</b></td>';
666 if (isModEnabled(
"multicurrency")) {
668 print
'<td class="center">'.$objp->multicurrency_code.
"</td>\n";
670 print
'<td class="right">';
671 if ($objp->multicurrency_code && $objp->multicurrency_code != $conf->currency) {
672 print
price($objp->multicurrency_total_ttc);
676 print
'<td class="right">';
677 if ($objp->multicurrency_code && $objp->multicurrency_code != $conf->currency) {
678 print
price($sign * $multicurrency_payment);
679 if ($multicurrency_creditnotes) {
680 print
'+'.price($multicurrency_creditnotes);
682 if ($multicurrency_deposits) {
683 print
'+'.price($multicurrency_deposits);
688 print
'<td class="right">';
689 if ($objp->multicurrency_code && $objp->multicurrency_code != $conf->currency) {
690 print
price($sign * $multicurrency_remaintopay);
694 print
'<td class="right">';
696 $namef =
'multicurrency_amount_'.$objp->facid;
697 $nameRemain =
'multicurrency_remain_'.$objp->facid;
698 if ($objp->multicurrency_code && $objp->multicurrency_code != $conf->currency) {
699 if ($action !=
'add_paiement') {
700 if (!empty($conf->use_javascript_ajax)) {
701 print
img_picto(
"Auto fill",
'rightarrow',
"class='AutoFillAmout' data-rowname='".$namef.
"' data-value='".($sign * $multicurrency_remaintopay).
"'");
703 print
'<input type=hidden class="multicurrency_remain" name="'.$nameRemain.
'" value="'.$multicurrency_remaintopay.
'">';
704 print
'<input type="text" size="8" class="multicurrency_amount" name="'.$namef.
'" value="'.
GETPOST($namef).
'">';
706 print
'<input type="text" size="8" name="'.$namef.
'_disabled" value="'.
GETPOST($namef).
'" disabled>';
707 print
'<input type="hidden" name="'.$namef.
'" value="'.
GETPOST($namef).
'">';
713 print
'<td class="right">'.price($sign * $objp->total_ttc).
'</td>';
715 print
'<td class="right">'.price($sign * $objp->am);
717 print
'+'.price($creditnotes);
720 print
'+'.price($deposits);
724 print
'<td class="right">';
725 print
price($sign * $remaintopay);
726 if (isModEnabled(
'paymentbybanktransfer')) {
727 $numdirectdebitopen = 0;
728 $totaldirectdebit = 0;
729 $sql =
"SELECT COUNT(pfd.rowid) as nb, SUM(pfd.amount) as amount";
730 $sql .=
" FROM ".MAIN_DB_PREFIX.
"prelevement_demande as pfd";
731 $sql .=
" WHERE fk_facture_fourn = ".((int) $objp->facid);
732 $sql .=
" AND pfd.traite = 0";
733 $sql .=
" AND pfd.ext_payment_id IS NULL";
735 $result_sql = $db->query($sql);
737 $obj = $db->fetch_object($result_sql);
738 $numdirectdebitopen = $obj->nb;
739 $totaldirectdebit = $obj->amount;
743 if ($numdirectdebitopen) {
744 $langs->load(
"withdrawals");
745 print
img_warning($langs->trans(
"WarningSomeCreditTransferAlreadyExists", $numdirectdebitopen,
price(
price2num($totaldirectdebit,
'MT'), 0, $langs, 1, -1, -1, $conf->currency)),
'',
'classfortooltip');
751 print
'<td class="center nowraponall">';
753 $namef =
'amount_'.$objp->facid;
754 $nameRemain =
'remain_'.$objp->facid;
756 if ($action !=
'add_paiement') {
757 if (!empty($conf->use_javascript_ajax)) {
758 print
img_picto(
"Auto fill",
'rightarrow',
"class='AutoFillAmout' data-rowname='".$namef.
"' data-value='".($sign * $remaintopay).
"'");
760 print
'<input type="hidden" class="remain" name="'.$nameRemain.
'" value="'.$remaintopay.
'">';
763 print
'<input type="text" size="8" name="'.$namef.
'_disabled" value="'.
dol_escape_htmltag(
GETPOST($namef)).
'" disabled>';
769 $total += $objp->total_ht;
770 $total_ttc += $objp->total_ttc;
771 $totalrecu += $objp->am;
772 $totalrecucreditnote += $creditnotes;
773 $totalrecudeposits += $deposits;
778 print
'<tr class="liste_total">';
779 print
'<td colspan="4" class="left">'.$langs->trans(
'TotalTTC').
':</td>';
780 if (isModEnabled(
"multicurrency")) {
781 print
'<td> </td>';
782 print
'<td> </td>';
783 print
'<td> </td>';
784 print
'<td> </td>';
785 print
'<td class="right" id="multicurrency_result" style="font-weight: bold;"></td>';
787 print
'<td class="right"><b>'.price($sign * $total_ttc).
'</b></td>';
788 print
'<td class="right"><b>'.price($sign * $totalrecu);
789 if ($totalrecucreditnote) {
790 print
'+'.price($totalrecucreditnote);
792 if ($totalrecudeposits) {
793 print
'+'.price($totalrecudeposits);
796 print
'<td class="right"><b>'.price($sign *
price2num($total_ttc - $totalrecu - $totalrecucreditnote - $totalrecudeposits,
'MT')).
'</b></td>';
797 print
'<td class="center" id="result" style="font-weight: bold;"></td>';
811 if ($action !=
'add_paiement') {
812 print
'<br><div class="center">';
813 print
'<input type="checkbox" checked id="closepaidinvoices" name="closepaidinvoices"> <label for="closepaidinvoices">'.$langs->trans(
"ClosePaidInvoicesAutomatically").
'</label><br>';
814 print
'<input type="submit" class="button" value="'.$langs->trans(
'ToMakePayment').
'">';
815 print
' <input type="submit" class="button button-cancel" name="cancel" value="'.$langs->trans(
"Cancel").
'">';
820 if ($action ==
'add_paiement') {
821 $preselectedchoice = $addwarning ?
'no' :
'yes';
824 if (!empty($totalpayment)) {
825 $text = $langs->trans(
'ConfirmSupplierPayment',
price($totalpayment), $langs->transnoentitiesnoconv(
"Currency".$conf->currency));
827 if (!empty($multicurrency_totalpayment)) {
828 $text .=
'<br>'.$langs->trans(
'ConfirmSupplierPayment',
price($multicurrency_totalpayment), $langs->transnoentitiesnoconv(
"paymentInInvoiceCurrency"));
830 if (
GETPOST(
'closepaidinvoices')) {
831 $text .=
'<br>'.$langs->trans(
"AllCompletelyPayedInvoiceWillBeClosed");
832 print
'<input type="hidden" name="closepaidinvoices" value="'.GETPOST(
'closepaidinvoices').
'">';
834 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...)
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.
img_warning($titlealt='default', $moreatt='', $morecss='pictowarning')
Show warning logo.
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_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.
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.
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='', $noduplicate=0)
Set event messages in dol_events session object.
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...