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 ==
'' ? (!
getDolGlobalString(
'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;
536 $errors = $hookmanager->errors;
537 if (empty($reshook)) {
541 $sql =
'SELECT f.rowid as facid, f.ref, f.ref_supplier, f.type, f.total_ht, f.total_ttc,';
542 $sql .=
' f.multicurrency_code, f.multicurrency_tx, f.multicurrency_total_ht, f.multicurrency_total_tva, f.multicurrency_total_ttc,';
543 $sql .=
' f.datef as df, f.date_lim_reglement as dlr,';
544 $sql .=
' SUM(pf.amount) as am, SUM(pf.multicurrency_amount) as multicurrency_am';
545 $sql .=
' FROM '.MAIN_DB_PREFIX.
'facture_fourn as f';
546 $sql .=
' LEFT JOIN '.MAIN_DB_PREFIX.
'paiementfourn_facturefourn as pf ON pf.fk_facturefourn = f.rowid';
547 $sql .=
" WHERE f.entity = ".((int) $conf->entity);
548 $sql .=
' AND f.fk_soc = '.((int) $object->socid);
549 $sql .=
' AND f.paye = 0';
550 $sql .=
' AND f.fk_statut = 1';
552 $sql .=
' AND f.type IN (0,1,3,5)';
554 $sql .=
' AND f.type = 2';
557 $sql .=
' GROUP BY f.datef, f.ref, f.ref_supplier, f.rowid, f.type, f.total_ht, f.total_ttc,';
558 $sql .=
' f.multicurrency_code, f.multicurrency_tx, f.multicurrency_total_ht, f.multicurrency_total_tva, f.multicurrency_total_ttc,';
559 $sql .=
' f.datef, f.date_lim_reglement';
561 $sql .=
' ORDER BY f.datef ASC, f.ref ASC';
563 $resql = $db->query($sql);
565 $num = $db->num_rows($resql);
570 if (!empty($conf->use_javascript_ajax)) {
572 print
"\n".
'<script type="text/javascript">';
573 print
' $(document).ready(function () {';
574 print
' $(".AutoFillAmout").on(\'click touchstart\', function(){
575 $("input[name="+$(this).data(\'rowname\')+"]").val($(this).data("value"));
578 print
' </script>'.
"\n";
581 print
'<div class="div-table-responsive-no-min">';
582 print
'<table class="tagtable liste'.($moreforfilter ?
" listwithfilterbefore" :
"").
'">'.
"\n";
584 print
'<tr class="liste_titre">';
585 print
'<td>'.$langs->trans(
'Invoice').
'</td>';
586 print
'<td>'.$langs->trans(
'RefSupplier').
'</td>';
587 print
'<td class="center">'.$langs->trans(
'Date').
'</td>';
588 print
'<td class="center">'.$langs->trans(
'DateMaxPayment').
'</td>';
589 if (isModEnabled(
"multicurrency")) {
590 print
'<td>'.$langs->trans(
'Currency').
'</td>';
591 print
'<td class="right">'.$langs->trans(
'MulticurrencyAmountTTC').
'</td>';
592 print
'<td class="right">'.$langs->trans(
'MulticurrencyAlreadyPaid').
'</td>';
593 print
'<td class="right">'.$langs->trans(
'MulticurrencyRemainderToPay').
'</td>';
594 print
'<td class="center">'.$langs->trans(
'MulticurrencyPaymentAmount').
'</td>';
596 print
'<td class="right">'.$langs->trans(
'AmountTTC').
'</td>';
597 print
'<td class="right">'.$langs->trans(
'AlreadyPaid').
'</td>';
598 print
'<td class="right">'.$langs->trans(
'RemainderToPay').
'</td>';
599 print
'<td class="center">'.$langs->trans(
'PaymentAmount').
'</td>';
605 $totalrecucreditnote = 0;
606 $totalrecudeposits = 0;
608 $objp = $db->fetch_object($resql);
616 $invoice->fetch($objp->facid);
618 $invoicesupplierstatic->ref = $objp->ref;
619 $invoicesupplierstatic->id = $objp->facid;
621 $paiement = $invoice->getSommePaiement();
622 $creditnotes = $invoice->getSumCreditNotesUsed();
623 $deposits = $invoice->getSumDepositsUsed();
624 $alreadypayed =
price2num($paiement + $creditnotes + $deposits,
'MT');
625 $remaintopay =
price2num($invoice->total_ttc - $paiement - $creditnotes - $deposits,
'MT');
628 if (isModEnabled(
"multicurrency")) {
629 $multicurrency_payment = $invoice->getSommePaiement(1);
630 $multicurrency_creditnotes = $invoice->getSumCreditNotesUsed(1);
631 $multicurrency_deposits = $invoice->getSumDepositsUsed(1);
632 $multicurrency_alreadypayed =
price2num($multicurrency_payment + $multicurrency_creditnotes + $multicurrency_deposits,
'MT');
633 $multicurrency_remaintopay =
price2num($invoice->multicurrency_total_ttc - $multicurrency_payment - $multicurrency_creditnotes - $multicurrency_deposits,
'MT');
636 print
'<tr class="oddeven'.(($invoice->id == $facid) ?
' highlight' :
'').
'">';
639 print
'<td class="nowraponall">';
640 print $invoicesupplierstatic->getNomUrl(1);
644 print
'<td>'.$objp->ref_supplier.
'</td>';
648 print
'<td class="center nowraponall">';
651 print
'<td class="center"><b>!!!</b></td>';
655 if ($objp->dlr > 0) {
656 print
'<td class="center nowraponall">';
659 if ($invoice->hasDelay()) {
665 print
'<td class="center"><b>--</b></td>';
669 if (isModEnabled(
"multicurrency")) {
671 print
'<td class="center">'.$objp->multicurrency_code.
"</td>\n";
673 print
'<td class="right">';
674 if ($objp->multicurrency_code && $objp->multicurrency_code != $conf->currency) {
675 print
price($objp->multicurrency_total_ttc);
679 print
'<td class="right">';
680 if ($objp->multicurrency_code && $objp->multicurrency_code != $conf->currency) {
681 print
price($sign * $multicurrency_payment);
682 if ($multicurrency_creditnotes) {
683 print
'+'.price($multicurrency_creditnotes);
685 if ($multicurrency_deposits) {
686 print
'+'.price($multicurrency_deposits);
691 print
'<td class="right">';
692 if ($objp->multicurrency_code && $objp->multicurrency_code != $conf->currency) {
693 print
price($sign * $multicurrency_remaintopay);
697 print
'<td class="right">';
699 $namef =
'multicurrency_amount_'.$objp->facid;
700 $nameRemain =
'multicurrency_remain_'.$objp->facid;
701 if ($objp->multicurrency_code && $objp->multicurrency_code != $conf->currency) {
702 if ($action !=
'add_paiement') {
703 if (!empty($conf->use_javascript_ajax)) {
704 print
img_picto(
"Auto fill",
'rightarrow',
"class='AutoFillAmout' data-rowname='".$namef.
"' data-value='".($sign * $multicurrency_remaintopay).
"'");
706 print
'<input type=hidden class="multicurrency_remain" name="'.$nameRemain.
'" value="'.$multicurrency_remaintopay.
'">';
707 print
'<input type="text" size="8" class="multicurrency_amount" name="'.$namef.
'" value="'.
GETPOST($namef).
'">';
709 print
'<input type="text" size="8" name="'.$namef.
'_disabled" value="'.
GETPOST($namef).
'" disabled>';
710 print
'<input type="hidden" name="'.$namef.
'" value="'.
GETPOST($namef).
'">';
716 print
'<td class="right">'.price($sign * $objp->total_ttc).
'</td>';
718 print
'<td class="right">'.price($sign * $objp->am);
720 print
'+'.price($creditnotes);
723 print
'+'.price($deposits);
727 print
'<td class="right">';
728 print
price($sign * $remaintopay);
729 if (isModEnabled(
'paymentbybanktransfer')) {
730 $numdirectdebitopen = 0;
731 $totaldirectdebit = 0;
732 $sql =
"SELECT COUNT(pfd.rowid) as nb, SUM(pfd.amount) as amount";
733 $sql .=
" FROM ".MAIN_DB_PREFIX.
"prelevement_demande as pfd";
734 $sql .=
" WHERE fk_facture_fourn = ".((int) $objp->facid);
735 $sql .=
" AND pfd.traite = 0";
736 $sql .=
" AND pfd.ext_payment_id IS NULL";
738 $result_sql = $db->query($sql);
740 $obj = $db->fetch_object($result_sql);
741 $numdirectdebitopen = $obj->nb;
742 $totaldirectdebit = $obj->amount;
746 if ($numdirectdebitopen) {
747 $langs->load(
"withdrawals");
748 print
img_warning($langs->trans(
"WarningSomeCreditTransferAlreadyExists", $numdirectdebitopen,
price(
price2num($totaldirectdebit,
'MT'), 0, $langs, 1, -1, -1, $conf->currency)),
'',
'classfortooltip');
754 print
'<td class="center nowraponall">';
756 $namef =
'amount_'.$objp->facid;
757 $nameRemain =
'remain_'.$objp->facid;
759 if ($action !=
'add_paiement') {
760 if (!empty($conf->use_javascript_ajax)) {
761 print
img_picto(
"Auto fill",
'rightarrow',
"class='AutoFillAmout' data-rowname='".$namef.
"' data-value='".($sign * $remaintopay).
"'");
763 print
'<input type="hidden" class="remain" name="'.$nameRemain.
'" value="'.$remaintopay.
'">';
766 print
'<input type="text" size="8" name="'.$namef.
'_disabled" value="'.
dol_escape_htmltag(
GETPOST($namef)).
'" disabled>';
772 $total += $objp->total_ht;
773 $total_ttc += $objp->total_ttc;
774 $totalrecu += $objp->am;
775 $totalrecucreditnote += $creditnotes;
776 $totalrecudeposits += $deposits;
781 print
'<tr class="liste_total">';
782 print
'<td colspan="4" class="left">'.$langs->trans(
'TotalTTC').
':</td>';
783 if (isModEnabled(
"multicurrency")) {
784 print
'<td> </td>';
785 print
'<td> </td>';
786 print
'<td> </td>';
787 print
'<td> </td>';
788 print
'<td class="right" id="multicurrency_result" style="font-weight: bold;"></td>';
790 print
'<td class="right"><b>'.price($sign * $total_ttc).
'</b></td>';
791 print
'<td class="right"><b>'.price($sign * $totalrecu);
792 if ($totalrecucreditnote) {
793 print
'+'.price($totalrecucreditnote);
795 if ($totalrecudeposits) {
796 print
'+'.price($totalrecudeposits);
799 print
'<td class="right"><b>'.price($sign *
price2num($total_ttc - $totalrecu - $totalrecucreditnote - $totalrecudeposits,
'MT')).
'</b></td>';
800 print
'<td class="center" id="result" style="font-weight: bold;"></td>';
814 if ($action !=
'add_paiement') {
815 print
'<br><div class="center">';
816 print
'<input type="checkbox" checked id="closepaidinvoices" name="closepaidinvoices"> <label for="closepaidinvoices">'.$langs->trans(
"ClosePaidInvoicesAutomatically").
'</label><br>';
817 print
'<input type="submit" class="button" value="'.$langs->trans(
'ToMakePayment').
'">';
818 print
' <input type="submit" class="button button-cancel" name="cancel" value="'.$langs->trans(
"Cancel").
'">';
823 if ($action ==
'add_paiement') {
824 $preselectedchoice = $addwarning ?
'no' :
'yes';
827 if (!empty($totalpayment)) {
828 $text = $langs->trans(
'ConfirmSupplierPayment',
price($totalpayment), $langs->transnoentitiesnoconv(
"Currency".$conf->currency));
830 if (!empty($multicurrency_totalpayment)) {
831 $text .=
'<br>'.$langs->trans(
'ConfirmSupplierPayment',
price($multicurrency_totalpayment), $langs->transnoentitiesnoconv(
"paymentInInvoiceCurrency"));
833 if (
GETPOST(
'closepaidinvoices')) {
834 $text .=
'<br>'.$langs->trans(
"AllCompletelyPayedInvoiceWillBeClosed");
835 print
'<input type="hidden" name="closepaidinvoices" value="'.GETPOST(
'closepaidinvoices').
'">';
837 print $form->formconfirm($_SERVER[
'PHP_SELF'].
'?facid='.$object->id.
'&socid='.$object->socid.
'&type='.$object->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.
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...