2004-10-19 22:35:36 +02:00
|
|
|
<?php
|
2018-09-09 09:36:12 +02:00
|
|
|
/* Copyright (C) 2004-2014 Laurent Destailleur <eldy@users.sourceforge.net>
|
|
|
|
|
* Copyright (C) 2016-2018 Frédéric France <frederic.france@netlogic.fr>
|
2022-06-14 09:13:53 +02:00
|
|
|
* Copyright (C) 2022 Alexandre Spangaro <aspangaro@open-dsi.fr>
|
2004-06-08 16:02:43 +02:00
|
|
|
*
|
|
|
|
|
* This program is free software; you can redistribute it and/or modify
|
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
2013-01-16 15:36:08 +01:00
|
|
|
* the Free Software Foundation; either version 3 of the License, or
|
2004-06-08 16:02:43 +02:00
|
|
|
* (at your option) any later version.
|
|
|
|
|
*
|
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
|
*
|
|
|
|
|
* You should have received a copy of the GNU General Public License
|
2019-09-23 21:55:30 +02:00
|
|
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
2004-06-08 16:02:43 +02:00
|
|
|
*/
|
2004-11-18 00:15:40 +01:00
|
|
|
|
2005-05-08 21:38:59 +02:00
|
|
|
/**
|
2018-09-09 09:36:12 +02:00
|
|
|
* \file htdocs/compta/paiement_charge.php
|
|
|
|
|
* \ingroup tax
|
|
|
|
|
* \brief Page to add payment of a tax
|
2010-02-10 18:07:25 +01:00
|
|
|
*/
|
2004-11-18 00:15:40 +01:00
|
|
|
|
2012-08-22 23:24:21 +02:00
|
|
|
require '../main.inc.php';
|
2012-08-22 23:11:24 +02:00
|
|
|
require_once DOL_DOCUMENT_ROOT.'/compta/sociales/class/chargesociales.class.php';
|
|
|
|
|
require_once DOL_DOCUMENT_ROOT.'/compta/sociales/class/paymentsocialcontribution.class.php';
|
|
|
|
|
require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
|
2004-06-08 16:02:43 +02:00
|
|
|
|
2018-05-27 09:27:09 +02:00
|
|
|
// Load translation files required by the page
|
2007-02-03 13:44:44 +01:00
|
|
|
$langs->load("bills");
|
|
|
|
|
|
2020-04-10 10:59:32 +02:00
|
|
|
$chid = GETPOST("id", 'int');
|
2020-09-16 19:39:50 +02:00
|
|
|
$action = GETPOST('action', 'aZ09');
|
2021-03-25 16:59:47 +01:00
|
|
|
$cancel = GETPOST('cancel');
|
|
|
|
|
|
2010-09-09 03:26:07 +02:00
|
|
|
$amounts = array();
|
2004-06-08 16:02:43 +02:00
|
|
|
|
2010-09-09 03:26:07 +02:00
|
|
|
// Security check
|
2020-04-10 10:59:32 +02:00
|
|
|
$socid = 0;
|
2021-02-23 21:09:01 +01:00
|
|
|
if ($user->socid > 0) {
|
2019-10-31 20:46:31 +01:00
|
|
|
$socid = $user->socid;
|
2007-01-30 22:20:05 +01:00
|
|
|
}
|
|
|
|
|
|
2020-07-09 23:18:19 +02:00
|
|
|
$charge = new ChargeSociales($db);
|
|
|
|
|
|
2007-01-30 22:20:05 +01:00
|
|
|
|
2005-05-08 21:38:59 +02:00
|
|
|
/*
|
2011-07-13 16:25:49 +02:00
|
|
|
* Actions
|
2005-05-08 21:38:59 +02:00
|
|
|
*/
|
2011-07-13 16:25:49 +02:00
|
|
|
|
2021-02-23 21:09:01 +01:00
|
|
|
if ($action == 'add_payment' || ($action == 'confirm_paiement' && $confirm == 'yes')) {
|
2019-11-14 12:09:15 +01:00
|
|
|
$error = 0;
|
2010-12-27 19:46:45 +01:00
|
|
|
|
2021-03-25 16:59:47 +01:00
|
|
|
if ($cancel) {
|
2016-08-22 13:43:49 +02:00
|
|
|
$loc = DOL_URL_ROOT.'/compta/sociales/card.php?id='.$chid;
|
2012-08-31 05:58:38 +02:00
|
|
|
header("Location: ".$loc);
|
2007-02-03 13:44:44 +01:00
|
|
|
exit;
|
|
|
|
|
}
|
2008-07-12 12:16:48 +02:00
|
|
|
|
2021-03-25 16:59:47 +01:00
|
|
|
$datepaye = dol_mktime(12, 0, 0, GETPOST("remonth", "int"), GETPOST("reday", "int"), GETPOST("reyear", "int"));
|
2009-03-03 00:09:03 +01:00
|
|
|
|
2021-03-25 16:59:47 +01:00
|
|
|
if (!(GETPOST("paiementtype") > 0)) {
|
2019-01-27 11:55:16 +01:00
|
|
|
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentities("PaymentMode")), null, 'errors');
|
2010-02-10 18:07:25 +01:00
|
|
|
$error++;
|
2020-10-31 14:32:18 +01:00
|
|
|
$action = 'create';
|
2010-02-10 18:07:25 +01:00
|
|
|
}
|
2021-02-23 21:09:01 +01:00
|
|
|
if ($datepaye == '') {
|
2019-01-27 11:55:16 +01:00
|
|
|
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentities("Date")), null, 'errors');
|
2010-02-10 18:07:25 +01:00
|
|
|
$error++;
|
2020-10-31 14:32:18 +01:00
|
|
|
$action = 'create';
|
|
|
|
|
}
|
2022-08-29 11:25:30 +02:00
|
|
|
if (isModEnabled('banque') && !(GETPOST("accountid") > 0)) {
|
2020-10-31 14:32:18 +01:00
|
|
|
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentities("AccountToCredit")), null, 'errors');
|
|
|
|
|
$error++;
|
|
|
|
|
$action = 'create';
|
2010-02-10 18:07:25 +01:00
|
|
|
}
|
|
|
|
|
|
2021-02-23 21:09:01 +01:00
|
|
|
if (!$error) {
|
2010-05-22 08:38:26 +02:00
|
|
|
$paymentid = 0;
|
2010-02-10 18:07:25 +01:00
|
|
|
|
|
|
|
|
// Read possible payments
|
2021-02-23 21:09:01 +01:00
|
|
|
foreach ($_POST as $key => $value) {
|
|
|
|
|
if (substr($key, 0, 7) == 'amount_') {
|
2019-01-27 11:55:16 +01:00
|
|
|
$other_chid = substr($key, 7);
|
2022-02-22 23:44:56 +01:00
|
|
|
$amounts[$other_chid] = price2num(GETPOST($key));
|
2010-02-10 18:07:25 +01:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2021-02-23 21:09:01 +01:00
|
|
|
if (count($amounts) <= 0) {
|
2020-10-31 14:32:18 +01:00
|
|
|
$error++;
|
|
|
|
|
setEventMessages($langs->trans("ErrorNoPaymentDefined"), null, 'errors');
|
|
|
|
|
$action = 'create';
|
|
|
|
|
}
|
|
|
|
|
|
2021-02-23 21:09:01 +01:00
|
|
|
if (!$error) {
|
2020-10-31 14:32:18 +01:00
|
|
|
$db->begin();
|
|
|
|
|
|
|
|
|
|
// Create a line of payments
|
|
|
|
|
$paiement = new PaymentSocialContribution($db);
|
|
|
|
|
$paiement->chid = $chid;
|
|
|
|
|
$paiement->datepaye = $datepaye;
|
|
|
|
|
$paiement->amounts = $amounts; // Amount list
|
|
|
|
|
$paiement->paiementtype = GETPOST("paiementtype", 'alphanohtml');
|
|
|
|
|
$paiement->num_payment = GETPOST("num_payment", 'alphanohtml');
|
|
|
|
|
$paiement->note = GETPOST("note", 'restricthtml');
|
|
|
|
|
$paiement->note_private = GETPOST("note", 'restricthtml');
|
|
|
|
|
|
2021-02-23 21:09:01 +01:00
|
|
|
if (!$error) {
|
2020-10-31 14:32:18 +01:00
|
|
|
$paymentid = $paiement->create($user, (GETPOST('closepaidcontrib') == 'on' ? 1 : 0));
|
2021-02-23 21:09:01 +01:00
|
|
|
if ($paymentid < 0) {
|
2020-10-31 14:32:18 +01:00
|
|
|
$error++;
|
|
|
|
|
setEventMessages($paiement->error, null, 'errors');
|
|
|
|
|
$action = 'create';
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2021-02-23 21:09:01 +01:00
|
|
|
if (!$error) {
|
2020-10-31 14:32:18 +01:00
|
|
|
$result = $paiement->addPaymentToBank($user, 'payment_sc', '(SocialContributionPayment)', GETPOST('accountid', 'int'), '', '');
|
2021-02-23 21:09:01 +01:00
|
|
|
if (!($result > 0)) {
|
2020-10-31 14:32:18 +01:00
|
|
|
$error++;
|
|
|
|
|
setEventMessages($paiement->error, null, 'errors');
|
|
|
|
|
$action = 'create';
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2021-02-23 21:09:01 +01:00
|
|
|
if (!$error) {
|
2020-10-31 14:32:18 +01:00
|
|
|
$db->commit();
|
|
|
|
|
$loc = DOL_URL_ROOT.'/compta/sociales/card.php?id='.$chid;
|
|
|
|
|
header('Location: '.$loc);
|
|
|
|
|
exit;
|
|
|
|
|
} else {
|
|
|
|
|
$db->rollback();
|
|
|
|
|
}
|
|
|
|
|
}
|
2010-02-10 18:07:25 +01:00
|
|
|
}
|
2004-06-08 16:02:43 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
2011-07-13 16:25:49 +02:00
|
|
|
* View
|
2004-06-08 16:02:43 +02:00
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
llxHeader();
|
|
|
|
|
|
2019-11-14 12:09:15 +01:00
|
|
|
$form = new Form($db);
|
2005-03-28 15:52:40 +02:00
|
|
|
|
|
|
|
|
|
2020-10-14 18:26:05 +02:00
|
|
|
// Form of charge payment creation
|
2021-02-23 21:09:01 +01:00
|
|
|
if ($action == 'create') {
|
2010-02-10 18:07:25 +01:00
|
|
|
$charge->fetch($chid);
|
2020-10-31 14:32:18 +01:00
|
|
|
$charge->accountid = $charge->fk_account ? $charge->fk_account : $charge->accountid;
|
|
|
|
|
$charge->paiementtype = $charge->mode_reglement_id ? $charge->mode_reglement_id : $charge->paiementtype;
|
2004-06-08 16:02:43 +02:00
|
|
|
|
2010-02-10 18:07:25 +01:00
|
|
|
$total = $charge->amount;
|
2021-02-23 21:09:01 +01:00
|
|
|
if (!empty($conf->use_javascript_ajax)) {
|
2021-11-29 15:09:18 +01:00
|
|
|
print "\n".'<script type="text/javascript">';
|
2017-10-15 13:33:48 +02:00
|
|
|
|
2019-10-26 14:42:25 +02:00
|
|
|
//Add js for AutoFill
|
|
|
|
|
print ' $(document).ready(function () {';
|
|
|
|
|
print ' $(".AutoFillAmount").on(\'click touchstart\', function(){
|
|
|
|
|
var amount = $(this).data("value");
|
|
|
|
|
document.getElementById($(this).data(\'rowid\')).value = amount ;
|
|
|
|
|
});';
|
|
|
|
|
print ' });'."\n";
|
2017-10-15 13:33:48 +02:00
|
|
|
|
2019-10-26 14:42:25 +02:00
|
|
|
print ' </script>'."\n";
|
|
|
|
|
}
|
2004-06-08 16:02:43 +02:00
|
|
|
|
2015-09-24 18:33:48 +02:00
|
|
|
print load_fiche_titre($langs->trans("DoPayment"));
|
2010-02-10 18:07:25 +01:00
|
|
|
print "<br>\n";
|
2004-06-13 22:56:04 +02:00
|
|
|
|
2021-02-23 21:09:01 +01:00
|
|
|
if ($mesg) {
|
2007-02-03 13:44:44 +01:00
|
|
|
print "<div class=\"error\">$mesg</div>";
|
|
|
|
|
}
|
|
|
|
|
|
2010-12-27 19:46:45 +01:00
|
|
|
print '<form name="add_payment" action="'.$_SERVER['PHP_SELF'].'" method="post">';
|
2019-12-18 23:12:31 +01:00
|
|
|
print '<input type="hidden" name="token" value="'.newToken().'">';
|
2014-05-06 23:19:48 +02:00
|
|
|
print '<input type="hidden" name="id" value="'.$chid.'">';
|
|
|
|
|
print '<input type="hidden" name="chid" value="'.$chid.'">';
|
2010-12-27 19:46:45 +01:00
|
|
|
print '<input type="hidden" name="action" value="add_payment">';
|
2009-03-03 00:09:03 +01:00
|
|
|
|
2020-10-22 22:50:03 +02:00
|
|
|
print dol_get_fiche_head('', '');
|
2015-06-29 21:58:38 +02:00
|
|
|
|
2019-11-05 21:24:41 +01:00
|
|
|
print '<table class="border centpercent">';
|
2004-06-08 16:02:43 +02:00
|
|
|
|
2017-10-16 20:53:23 +02:00
|
|
|
print '<tr><td class="titlefieldcreate">'.$langs->trans("Ref").'</td><td><a href="'.DOL_URL_ROOT.'/compta/sociales/card.php?id='.$chid.'">'.$chid.'</a></td></tr>';
|
2021-04-11 13:07:00 +02:00
|
|
|
print '<tr><td>'.$langs->trans("Label").'</td><td>'.$charge->label."</td></tr>\n";
|
2019-11-02 11:12:57 +01:00
|
|
|
print '<tr><td>'.$langs->trans("Type")."</td><td>".$charge->type_label."</td></tr>\n";
|
2019-01-27 11:55:16 +01:00
|
|
|
print '<tr><td>'.$langs->trans("Period")."</td><td>".dol_print_date($charge->periode, 'day')."</td></tr>\n";
|
2017-10-16 20:53:23 +02:00
|
|
|
/*print '<tr><td>'.$langs->trans("DateDue")."</td><td>".dol_print_date($charge->date_ech,'day')."</td></tr>\n";
|
|
|
|
|
print '<tr><td>'.$langs->trans("Amount")."</td><td>".price($charge->amount,0,$outputlangs,1,-1,-1,$conf->currency).'</td></tr>';*/
|
2010-02-10 18:07:25 +01:00
|
|
|
|
|
|
|
|
$sql = "SELECT sum(p.amount) as total";
|
2019-11-14 12:09:15 +01:00
|
|
|
$sql .= " FROM ".MAIN_DB_PREFIX."paiementcharge as p";
|
2021-03-30 17:53:25 +02:00
|
|
|
$sql .= " WHERE p.fk_charge = ".((int) $chid);
|
2010-02-10 18:07:25 +01:00
|
|
|
$resql = $db->query($sql);
|
2021-02-23 21:09:01 +01:00
|
|
|
if ($resql) {
|
2019-11-14 12:09:15 +01:00
|
|
|
$obj = $db->fetch_object($resql);
|
2010-02-10 18:07:25 +01:00
|
|
|
$sumpaid = $obj->total;
|
2022-05-15 22:29:19 +02:00
|
|
|
$db->free($resql);
|
2010-02-10 18:07:25 +01:00
|
|
|
}
|
2017-10-16 20:53:23 +02:00
|
|
|
/*print '<tr><td>'.$langs->trans("AlreadyPaid").'</td><td>'.price($sumpaid,0,$outputlangs,1,-1,-1,$conf->currency).'</td></tr>';
|
|
|
|
|
print '<tr><td class="tdtop">'.$langs->trans("RemainderToPay").'</td><td>'.price($total-$sumpaid,0,$outputlangs,1,-1,-1,$conf->currency).'</td></tr>';*/
|
2010-02-10 18:07:25 +01:00
|
|
|
|
2016-06-19 18:53:19 +02:00
|
|
|
print '<tr><td class="fieldrequired">'.$langs->trans("Date").'</td><td>';
|
2020-11-30 14:47:07 +01:00
|
|
|
$datepaye = dol_mktime(12, 0, 0, GETPOST("remonth", 'int'), GETPOST("reday", 'int'), GETPOST("reyear", 'int'));
|
2021-01-19 10:59:42 +01:00
|
|
|
$datepayment = empty($conf->global->MAIN_AUTOFILL_DATE) ? (GETPOSTISSET("remonth") ? $datepaye : -1) : '';
|
2020-07-09 23:18:19 +02:00
|
|
|
print $form->selectDate($datepayment, '', '', '', 0, "add_payment", 1, 1, 0, '', '', $charge->date_ech, '', 1, $langs->trans("DateOfSocialContribution"));
|
2010-02-10 18:07:25 +01:00
|
|
|
print "</td>";
|
2014-05-06 23:19:48 +02:00
|
|
|
print '</tr>';
|
2010-02-10 18:07:25 +01:00
|
|
|
|
2016-06-19 18:53:19 +02:00
|
|
|
print '<tr><td class="fieldrequired">'.$langs->trans("PaymentMode").'</td><td>';
|
2020-11-30 14:47:07 +01:00
|
|
|
$form->select_types_paiements(GETPOSTISSET("paiementtype") ? GETPOST("paiementtype") : $charge->paiementtype, "paiementtype");
|
2010-02-10 18:07:25 +01:00
|
|
|
print "</td>\n";
|
2014-05-06 23:19:48 +02:00
|
|
|
print '</tr>';
|
2010-02-10 18:07:25 +01:00
|
|
|
|
|
|
|
|
print '<tr>';
|
2010-12-27 19:46:45 +01:00
|
|
|
print '<td class="fieldrequired">'.$langs->trans('AccountToDebit').'</td>';
|
2016-06-19 18:53:19 +02:00
|
|
|
print '<td>';
|
2021-04-11 13:07:00 +02:00
|
|
|
print img_picto('', 'bank_account', 'class="pictofixedwidth"');
|
2021-01-19 10:59:42 +01:00
|
|
|
$form->select_comptes(GETPOSTISSET("accountid") ? GETPOST("accountid", 'int') : $charge->accountid, "accountid", 0, '', 2); // Show opend bank account list
|
2010-02-10 18:07:25 +01:00
|
|
|
print '</td></tr>';
|
|
|
|
|
|
2014-03-25 21:35:52 +01:00
|
|
|
// Number
|
2010-02-10 18:07:25 +01:00
|
|
|
print '<tr><td>'.$langs->trans('Numero');
|
|
|
|
|
print ' <em>('.$langs->trans("ChequeOrTransferNumber").')</em>';
|
2014-05-06 23:58:17 +02:00
|
|
|
print '</td>';
|
2020-03-16 19:23:18 +01:00
|
|
|
print '<td><input name="num_payment" type="text" value="'.GETPOST('num_payment', 'alphanohtml').'"></td></tr>'."\n";
|
2014-05-06 23:19:48 +02:00
|
|
|
|
|
|
|
|
print '<tr>';
|
2017-01-22 12:13:32 +01:00
|
|
|
print '<td class="tdtop">'.$langs->trans("Comments").'</td>';
|
2021-03-10 14:15:03 +01:00
|
|
|
print '<td class="tdtop"><textarea name="note" wrap="soft" cols="60" rows="'.ROWS_3.'">'.GETPOST('note', 'alphanohtml').'</textarea></td>';
|
2014-05-06 23:19:48 +02:00
|
|
|
print '</tr>';
|
|
|
|
|
|
|
|
|
|
print '</table>';
|
|
|
|
|
|
2020-10-27 18:19:31 +01:00
|
|
|
print dol_get_fiche_end();
|
2010-02-10 18:07:25 +01:00
|
|
|
|
|
|
|
|
/*
|
2021-02-23 21:09:01 +01:00
|
|
|
* Other unpaid charges
|
2010-02-10 18:07:25 +01:00
|
|
|
*/
|
|
|
|
|
$num = 1;
|
|
|
|
|
$i = 0;
|
2010-07-27 01:00:39 +02:00
|
|
|
|
2019-11-05 21:24:41 +01:00
|
|
|
print '<table class="noborder centpercent">';
|
2010-02-10 18:07:25 +01:00
|
|
|
print '<tr class="liste_titre">';
|
|
|
|
|
//print '<td>'.$langs->trans("SocialContribution").'</td>';
|
2019-01-18 10:18:18 +01:00
|
|
|
print '<td class="left">'.$langs->trans("DateDue").'</td>';
|
2019-02-14 16:54:53 +01:00
|
|
|
print '<td class="right">'.$langs->trans("Amount").'</td>';
|
|
|
|
|
print '<td class="right">'.$langs->trans("AlreadyPaid").'</td>';
|
|
|
|
|
print '<td class="right">'.$langs->trans("RemainderToPay").'</td>';
|
2019-12-12 10:31:08 +01:00
|
|
|
print '<td class="center">'.$langs->trans("Amount").'</td>';
|
2010-02-10 18:07:25 +01:00
|
|
|
print "</tr>\n";
|
|
|
|
|
|
2019-11-14 12:09:15 +01:00
|
|
|
$total = 0;
|
2022-06-14 09:13:53 +02:00
|
|
|
$total_ttc = 0;
|
2019-11-14 12:09:15 +01:00
|
|
|
$totalrecu = 0;
|
2010-02-10 18:07:25 +01:00
|
|
|
|
2021-02-23 21:09:01 +01:00
|
|
|
while ($i < $num) {
|
2010-02-10 18:07:25 +01:00
|
|
|
$objp = $charge;
|
|
|
|
|
|
2017-04-14 11:22:48 +02:00
|
|
|
print '<tr class="oddeven">';
|
2010-02-10 18:07:25 +01:00
|
|
|
|
2021-02-23 21:09:01 +01:00
|
|
|
if ($objp->date_ech > 0) {
|
2019-02-15 17:38:35 +01:00
|
|
|
print '<td class="left">'.dol_print_date($objp->date_ech, 'day').'</td>'."\n";
|
2020-05-21 15:05:19 +02:00
|
|
|
} else {
|
2010-02-10 18:07:25 +01:00
|
|
|
print "<td align=\"center\"><b>!!!</b></td>\n";
|
|
|
|
|
}
|
|
|
|
|
|
2021-03-29 13:00:17 +02:00
|
|
|
print '<td class="right"><span class="amount">'.price($objp->amount)."</span></td>";
|
2010-02-10 18:07:25 +01:00
|
|
|
|
2021-03-29 13:00:17 +02:00
|
|
|
print '<td class="right"><span class="amount">'.price($sumpaid)."</span></td>";
|
2010-02-10 18:07:25 +01:00
|
|
|
|
2021-03-29 13:00:17 +02:00
|
|
|
print '<td class="right"><span class="amount">'.price($objp->amount - $sumpaid)."</span></td>";
|
2010-02-10 18:07:25 +01:00
|
|
|
|
2019-12-12 10:31:08 +01:00
|
|
|
print '<td class="center">';
|
2021-02-23 21:09:01 +01:00
|
|
|
if ($sumpaid < $objp->amount) {
|
2010-02-10 18:07:25 +01:00
|
|
|
$namef = "amount_".$objp->id;
|
2017-10-15 13:33:48 +02:00
|
|
|
$nameRemain = "remain_".$objp->id;
|
2021-02-23 21:09:01 +01:00
|
|
|
if (!empty($conf->use_javascript_ajax)) {
|
2019-01-27 11:55:16 +01:00
|
|
|
print img_picto("Auto fill", 'rightarrow', "class='AutoFillAmount' data-rowid='".$namef."' data-value='".($objp->amount - $sumpaid)."'");
|
2021-02-23 21:09:01 +01:00
|
|
|
}
|
2019-11-14 12:09:15 +01:00
|
|
|
$remaintopay = $objp->amount - $sumpaid;
|
2017-10-15 13:33:48 +02:00
|
|
|
print '<input type=hidden class="sum_remain" name="'.$nameRemain.'" value="'.$remaintopay.'">';
|
2021-03-10 15:29:05 +01:00
|
|
|
print '<input type="text" size="8" name="'.$namef.'" id="'.$namef.'" value="'.GETPOST('amount_'.$objp->id, 'alpha').'">';
|
2020-05-21 15:05:19 +02:00
|
|
|
} else {
|
2010-02-10 18:07:25 +01:00
|
|
|
print '-';
|
|
|
|
|
}
|
|
|
|
|
print "</td>";
|
|
|
|
|
|
|
|
|
|
print "</tr>\n";
|
2019-11-14 12:09:15 +01:00
|
|
|
$total += $objp->total;
|
|
|
|
|
$total_ttc += $objp->total_ttc;
|
2022-05-21 18:11:34 +02:00
|
|
|
$totalrecu += $objp->amount;
|
2010-02-10 18:07:25 +01:00
|
|
|
$i++;
|
|
|
|
|
}
|
2021-02-23 21:09:01 +01:00
|
|
|
if ($i > 1) {
|
2010-02-10 18:07:25 +01:00
|
|
|
// Print total
|
2018-06-17 14:33:29 +02:00
|
|
|
print '<tr class="oddeven">';
|
2019-02-14 16:54:53 +01:00
|
|
|
print '<td colspan="2" class="left">'.$langs->trans("Total").':</td>';
|
|
|
|
|
print '<td class="right"><b>'.price($total_ttc).'</b></td>';
|
|
|
|
|
print '<td class="right"><b>'.price($totalrecu).'</b></td>';
|
|
|
|
|
print '<td class="right"><b>'.price($total_ttc - $totalrecu).'</b></td>';
|
2010-02-10 18:07:25 +01:00
|
|
|
print '<td align="center"> </td>';
|
|
|
|
|
print "</tr>\n";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
print "</table>";
|
|
|
|
|
|
2020-10-14 18:26:05 +02:00
|
|
|
// Save payment button
|
2016-08-22 14:31:15 +02:00
|
|
|
print '<br><div class="center"><input type="checkbox" checked name="closepaidcontrib"> '.$langs->trans("ClosePaidContributionsAutomatically");
|
|
|
|
|
print '<br><input type="submit" class="button" name="save" value="'.$langs->trans('ToMakePayment').'">';
|
2014-11-25 20:13:43 +01:00
|
|
|
print ' ';
|
2020-11-23 15:12:52 +01:00
|
|
|
print '<input type="submit" class="button button-cancel" name="cancel" value="'.$langs->trans("Cancel").'">';
|
2014-11-25 20:13:43 +01:00
|
|
|
print '</div>';
|
2014-03-25 21:35:52 +01:00
|
|
|
|
2010-02-10 18:07:25 +01:00
|
|
|
print "</form>\n";
|
2009-03-03 00:09:03 +01:00
|
|
|
}
|
2004-06-08 16:02:43 +02:00
|
|
|
|
2011-08-27 16:24:16 +02:00
|
|
|
llxFooter();
|
2015-12-11 14:19:38 +01:00
|
|
|
$db->close();
|