Fix name of var

This commit is contained in:
Laurent Destailleur 2022-05-22 17:09:08 +02:00
parent 3d5b322d98
commit 8bacb6c755
37 changed files with 172 additions and 155 deletions

View File

@ -153,7 +153,7 @@ if (!empty($conf->tax->enabled) && $user->rights->tax->charges->lire) {
$sql = "SELECT c.id, c.libelle as label,";
$sql .= " cs.rowid, cs.libelle, cs.fk_type as type, cs.periode, cs.date_ech, cs.amount as total,";
$sql .= " pc.rowid as pid, pc.datep, pc.amount as totalpaye, pc.num_paiement as num_payment, pc.fk_bank,";
$sql .= " pc.rowid as pid, pc.datep, pc.amount as totalpaid, pc.num_paiement as num_payment, pc.fk_bank,";
$sql .= " pct.code as payment_code,";
$sql .= " ba.rowid as bid, ba.ref as bref, ba.number as bnumber, ba.account_number, ba.fk_accountancy_journal, ba.label as blabel";
$sql .= " FROM ".MAIN_DB_PREFIX."c_chargesociales as c,";
@ -185,7 +185,7 @@ if (!empty($conf->tax->enabled) && $user->rights->tax->charges->lire) {
$i = 0;
$total = 0;
$totalnb = 0;
$totalpaye = 0;
$totalpaid = 0;
while ($i < min($num, $limit)) {
$obj = $db->fetch_object($resql);
@ -239,15 +239,15 @@ if (!empty($conf->tax->enabled) && $user->rights->tax->charges->lire) {
}
// Paid
print '<td class="right">';
if ($obj->totalpaye) {
print price($obj->totalpaye);
if ($obj->totalpaid) {
print price($obj->totalpaid);
}
print '</td>';
print '</tr>';
$total = $total + $obj->total;
$totalnb = $totalnb + $obj->nb;
$totalpaye = $totalpaye + $obj->totalpaye;
$totalpaid = $totalpaid + $obj->totalpaid;
$i++;
}
print '<tr class="liste_total"><td colspan="3" class="liste_total">'.$langs->trans("Total").'</td>';
@ -258,7 +258,7 @@ if (!empty($conf->tax->enabled) && $user->rights->tax->charges->lire) {
if (!empty($conf->banque->enabled)) {
print '<td></td>';
}
print '<td class="liste_total right">'.price($totalpaye)."</td>";
print '<td class="liste_total right">'.price($totalpaid)."</td>";
print "</tr>";
} else {
dol_print_error($db);

View File

@ -725,14 +725,14 @@ if (empty($reshook)) {
while ($i < $num) {
$objp = $db->fetch_object($result);
$totalpaye += $objp->amount;
$totalpaid += $objp->amount;
$i++;
}
} else {
dol_print_error($db, '');
}
$resteapayer = $object->total_ttc - $totalpaye;
$resteapayer = $object->total_ttc - $totalpaid;
// We check that invlice lines are transferred into accountancy
$ventilExportCompta = $object->getVentilExportCompta();
@ -1255,10 +1255,10 @@ if (empty($reshook)) {
if (GETPOST('invoiceAvoirWithPaymentRestAmount', 'int') == 1 && $id > 0) {
if ($facture_source->fetch($object->fk_facture_source) > 0) {
$totalpaye = $facture_source->getSommePaiement();
$totalpaid = $facture_source->getSommePaiement();
$totalcreditnotes = $facture_source->getSumCreditNotesUsed();
$totaldeposits = $facture_source->getSumDepositsUsed();
$remain_to_pay = abs($facture_source->total_ttc - $totalpaye - $totalcreditnotes - $totaldeposits);
$remain_to_pay = abs($facture_source->total_ttc - $totalpaid - $totalcreditnotes - $totaldeposits);
$object->addline($langs->trans('invoiceAvoirLineWithPaymentRestAmount'), $remain_to_pay, 1, 0, 0, 0, 0, 0, '', '', 'TTC');
}
@ -3899,24 +3899,24 @@ if ($action == 'create') {
}
$selleruserevenustamp = $mysoc->useRevenueStamp();
$totalpaye = $object->getSommePaiement();
$totalpaid = $object->getSommePaiement();
$totalcreditnotes = $object->getSumCreditNotesUsed();
$totaldeposits = $object->getSumDepositsUsed();
//print "totalpaye=".$totalpaye." totalcreditnotes=".$totalcreditnotes." totaldeposts=".$totaldeposits."
//print "totalpaid=".$totalpaid." totalcreditnotes=".$totalcreditnotes." totaldeposts=".$totaldeposits."
// selleruserrevenuestamp=".$selleruserevenustamp;
// We can also use bcadd to avoid pb with floating points
// For example print 239.2 - 229.3 - 9.9; does not return 0.
// $resteapayer=bcadd($object->total_ttc,$totalpaye,$conf->global->MAIN_MAX_DECIMALS_TOT);
// $resteapayer=bcadd($object->total_ttc,$totalpaid,$conf->global->MAIN_MAX_DECIMALS_TOT);
// $resteapayer=bcadd($resteapayer,$totalavoir,$conf->global->MAIN_MAX_DECIMALS_TOT);
$resteapayer = price2num($object->total_ttc - $totalpaye - $totalcreditnotes - $totaldeposits, 'MT');
$resteapayer = price2num($object->total_ttc - $totalpaid - $totalcreditnotes - $totaldeposits, 'MT');
// Multicurrency
if (!empty($conf->multicurrency->enabled)) {
$multicurrency_totalpaye = $object->getSommePaiement(1);
$multicurrency_totalpaid = $object->getSommePaiement(1);
$multicurrency_totalcreditnotes = $object->getSumCreditNotesUsed(1);
$multicurrency_totaldeposits = $object->getSumDepositsUsed(1);
$multicurrency_resteapayer = price2num($object->multicurrency_total_ttc - $multicurrency_totalpaye - $multicurrency_totalcreditnotes - $multicurrency_totaldeposits, 'MT');
$multicurrency_resteapayer = price2num($object->multicurrency_total_ttc - $multicurrency_totalpaid - $multicurrency_totalcreditnotes - $multicurrency_totaldeposits, 'MT');
// Code to fix case of corrupted data
if ($resteapayer == 0 && $multicurrency_resteapayer != 0) {
$resteapayer = price2num($multicurrency_resteapayer / $object->multicurrency_tx, 'MT');
@ -4317,7 +4317,7 @@ if ($action == 'create') {
}
$morehtmlref .= '</div>';
$object->totalpaid = $totalpaye; // To give a chance to dol_banner_tab to use already paid amount to show correct status
$object->totalpaid = $totalpaid; // To give a chance to dol_banner_tab to use already paid amount to show correct status
dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref, '', 0, '', '');
@ -4926,7 +4926,7 @@ if ($action == 'create') {
$total_next_ht = $total_next_ttc = 0;
foreach ($object->tab_next_situation_invoice as $next_invoice) {
$totalpaye = $next_invoice->getSommePaiement();
$totalpaid = $next_invoice->getSommePaiement();
$total_next_ht += $next_invoice->total_ht;
$total_next_ttc += $next_invoice->total_ttc;
@ -4939,7 +4939,7 @@ if ($action == 'create') {
}
print '<td class="right"><span class="amount">'.price($next_invoice->total_ht).'</span></td>';
print '<td class="right"><span class="amount">'.price($next_invoice->total_ttc).'</span></td>';
print '<td class="right">'.$next_invoice->getLibStatut(3, $totalpaye).'</td>';
print '<td class="right">'.$next_invoice->getLibStatut(3, $totalpaid).'</td>';
print '</tr>';
}
@ -5072,7 +5072,7 @@ if ($action == 'create') {
} else {
print $langs->trans('AlreadyPaid');
}
print '</span></td><td class="right'.(($totalpaye > 0) ? ' amountalreadypaid' : '').'">'.price($totalpaye).'</td><td>&nbsp;</td></tr>';
print '</span></td><td class="right'.(($totalpaid > 0) ? ' amountalreadypaid' : '').'">'.price($totalpaid).'</td><td>&nbsp;</td></tr>';
$resteapayeraffiche = $resteapayer;
$cssforamountpaymentcomplete = 'amountpaymentcomplete';
@ -5125,7 +5125,7 @@ if ($action == 'create') {
print '<span class="opacitymedium">';
print $form->textwithpicto($langs->trans("Discount"), $langs->trans("HelpEscompte"), - 1);
print '</span>';
print '</td><td class="right"><span class="amount">'.price(price2num($object->total_ttc - $creditnoteamount - $depositamount - $totalpaye, 'MT')).'</span></td><td>&nbsp;</td></tr>';
print '</td><td class="right"><span class="amount">'.price(price2num($object->total_ttc - $creditnoteamount - $depositamount - $totalpaid, 'MT')).'</span></td><td>&nbsp;</td></tr>';
$resteapayeraffiche = 0;
$cssforamountpaymentcomplete = 'amountpaymentneutral';
}
@ -5135,7 +5135,7 @@ if ($action == 'create') {
print '<span class="opacitymedium">';
print $form->textwithpicto($langs->trans("Abandoned"), $langs->trans("HelpAbandonBadCustomer"), - 1);
print '</span>';
print '</td><td class="right">'.price(price2num($object->total_ttc - $creditnoteamount - $depositamount - $totalpaye, 'MT')).'</td><td>&nbsp;</td></tr>';
print '</td><td class="right">'.price(price2num($object->total_ttc - $creditnoteamount - $depositamount - $totalpaid, 'MT')).'</td><td>&nbsp;</td></tr>';
// $resteapayeraffiche=0;
$cssforamountpaymentcomplete = 'amountpaymentneutral';
}
@ -5145,7 +5145,7 @@ if ($action == 'create') {
print '<span class="opacitymedium">';
print $form->textwithpicto($langs->trans("ProductReturned"), $langs->trans("HelpAbandonProductReturned"), - 1);
print '</span>';
print '</td><td class="right"><span class="amount">'.price(price2num($object->total_ttc - $creditnoteamount - $depositamount - $totalpaye, 'MT')).'</span></td><td>&nbsp;</td></tr>';
print '</td><td class="right"><span class="amount">'.price(price2num($object->total_ttc - $creditnoteamount - $depositamount - $totalpaid, 'MT')).'</span></td><td>&nbsp;</td></tr>';
$resteapayeraffiche = 0;
$cssforamountpaymentcomplete = 'amountpaymentneutral';
}
@ -5159,7 +5159,7 @@ if ($action == 'create') {
print '<span class="opacitymedium">';
print $form->textwithpicto($langs->trans("Abandoned"), $text, - 1);
print '</span>';
print '</td><td class="right"><span class="amount">'.price(price2num($object->total_ttc - $creditnoteamount - $depositamount - $totalpaye, 'MT')).'</span></td><td>&nbsp;</td></tr>';
print '</td><td class="right"><span class="amount">'.price(price2num($object->total_ttc - $creditnoteamount - $depositamount - $totalpaid, 'MT')).'</span></td><td>&nbsp;</td></tr>';
$resteapayeraffiche = 0;
$cssforamountpaymentcomplete = 'amountpaymentneutral';
}
@ -5220,7 +5220,7 @@ if ($action == 'create') {
// Total already paid back
print '<tr><td colspan="'.$nbcols.'" class="right">';
print '<span class="opacitymedium">'.$langs->trans('AlreadyPaidBack').'</span>';
print '</td><td class="right"><span class="amount">'.price($sign * $totalpaye).'</span></td><td>&nbsp;</td></tr>';
print '</td><td class="right"><span class="amount">'.price($sign * $totalpaid).'</span></td><td>&nbsp;</td></tr>';
// Billed
print '<tr><td colspan="'.$nbcols.'" class="right"><span class="opacitymedium">'.$langs->trans("Billed").'</span></td><td class="right">'.price($sign * $object->total_ttc).'</td><td>&nbsp;</td></tr>';
@ -5498,8 +5498,8 @@ if ($action == 'create') {
}
}
$sumofpayment = $totalpaye;
$sumofpaymentall = $totalpaye + $totalcreditnotes + $totaldeposits;
$sumofpayment = $totalpaid;
$sumofpaymentall = $totalpaid + $totalcreditnotes + $totaldeposits;
// Reverse back money or convert to reduction
if ($object->type == Facture::TYPE_CREDIT_NOTE || $object->type == Facture::TYPE_DEPOSIT || $object->type == Facture::TYPE_STANDARD || $object->type == Facture::TYPE_SITUATION) {
@ -5551,7 +5551,7 @@ if ($action == 'create') {
// Classify 'closed not completely paid' (possible if validated and not yet filed paid)
if ($object->statut == Facture::STATUS_VALIDATED && $object->paye == 0 && $resteapayer > 0 && (empty($conf->global->INVOICE_CAN_SET_PAID_EVEN_IF_PARTIALLY_PAID) || $resteapayer != $object->total_ttc) && $usercanissuepayment) {
if ($totalpaye > 0 || $totalcreditnotes > 0) {
if ($totalpaid > 0 || $totalcreditnotes > 0) {
// If one payment or one credit note was linked to this invoice
print '<a class="butAction'.($conf->use_javascript_ajax ? ' reposition' : '').'" href="'.$_SERVER['PHP_SELF'].'?facid='.$object->id.'&amp;action=paid">'.$langs->trans('ClassifyPaidPartially').'</a>';
} else {
@ -5575,7 +5575,7 @@ if ($action == 'create') {
// For situation invoice with excess received
if ($object->statut > Facture::STATUS_DRAFT
&& $object->type == Facture::TYPE_SITUATION
&& ($object->total_ttc - $totalpaye - $totalcreditnotes - $totaldeposits) > 0
&& ($object->total_ttc - $totalpaid - $totalcreditnotes - $totaldeposits) > 0
&& $usercancreate
&& !$objectidnext
&& $object->is_last_in_cycle()

View File

@ -1425,10 +1425,10 @@ class Invoices extends DolibarrApi
}
// Calculate amount to pay
$totalpaye = $this->invoice->getSommePaiement();
$totalpaid = $this->invoice->getSommePaiement();
$totalcreditnotes = $this->invoice->getSumCreditNotesUsed();
$totaldeposits = $this->invoice->getSumDepositsUsed();
$resteapayer = price2num($this->invoice->total_ttc - $totalpaye - $totalcreditnotes - $totaldeposits, 'MT');
$resteapayer = price2num($this->invoice->total_ttc - $totalpaid - $totalcreditnotes - $totaldeposits, 'MT');
$this->db->begin();
@ -1567,10 +1567,10 @@ class Invoices extends DolibarrApi
}
// Calculate amount to pay
$totalpaye = $this->invoice->getSommePaiement($is_multicurrency);
$totalpaid = $this->invoice->getSommePaiement($is_multicurrency);
$totalcreditnotes = $this->invoice->getSumCreditNotesUsed($is_multicurrency);
$totaldeposits = $this->invoice->getSumDepositsUsed($is_multicurrency);
$remainstopay = $amount = price2num($total_ttc - $totalpaye - $totalcreditnotes - $totaldeposits, 'MT');
$remainstopay = $amount = price2num($total_ttc - $totalpaid - $totalcreditnotes - $totaldeposits, 'MT');
if (!$is_multicurrency && $amountarray["amount"] != 'remain') {
$amount = price2num($amountarray["amount"], 'MT');

View File

@ -5214,13 +5214,13 @@ class Facture extends CommonInvoice
$hasDelay = $this->date_lim_reglement < ($now - $conf->facture->client->warning_delay);
if ($hasDelay && !empty($this->retained_warranty) && !empty($this->retained_warranty_date_limit)) {
$totalpaye = $this->getSommePaiement();
$totalpaye = floatval($totalpaye);
$totalpaid = $this->getSommePaiement();
$totalpaid = floatval($totalpaid);
$RetainedWarrantyAmount = $this->getRetainedWarrantyAmount();
if ($totalpaye >= 0 && $RetainedWarrantyAmount >= 0) {
if (($totalpaye < $this->total_ttc - $RetainedWarrantyAmount) && $this->date_lim_reglement < ($now - $conf->facture->client->warning_delay)) {
if ($totalpaid >= 0 && $RetainedWarrantyAmount >= 0) {
if (($totalpaid < $this->total_ttc - $RetainedWarrantyAmount) && $this->date_lim_reglement < ($now - $conf->facture->client->warning_delay)) {
$hasDelay = 1;
} elseif ($totalpaye < $this->total_ttc && $this->retained_warranty_date_limit < ($now - $conf->facture->client->warning_delay)) {
} elseif ($totalpaid < $this->total_ttc && $this->retained_warranty_date_limit < ($now - $conf->facture->client->warning_delay)) {
$hasDelay = 1;
} else {
$hasDelay = 0;

View File

@ -122,7 +122,7 @@ if ($id > 0 || !empty($ref)) {
$head = facture_prepare_head($object);
$totalpaye = $object->getSommePaiement();
$totalpaid = $object->getSommePaiement();
print dol_get_fiche_head($head, 'contact', $langs->trans('InvoiceCustomer'), -1, 'bill');
@ -171,7 +171,7 @@ if ($id > 0 || !empty($ref)) {
}
$morehtmlref .= '</div>';
$object->totalpaid = $totalpaye; // To give a chance to dol_banner_tab to use already paid amount to show correct status
$object->totalpaid = $totalpaid; // To give a chance to dol_banner_tab to use already paid amount to show correct status
dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref, '', 0, '', '', 1);

View File

@ -117,7 +117,7 @@ if ($id > 0 || !empty($ref)) {
$head = facture_prepare_head($object);
print dol_get_fiche_head($head, 'documents', $langs->trans('InvoiceCustomer'), -1, 'bill');
$totalpaye = $object->getSommePaiement();
$totalpaid = $object->getSommePaiement();
// Build file list
$filearray = dol_dir_list($upload_dir, "files", 0, '', '(\.meta|_preview.*\.png)$', $sortfield, (strtolower($sortorder) == 'desc' ?SORT_DESC:SORT_ASC), 1);
@ -172,7 +172,7 @@ if ($id > 0 || !empty($ref)) {
}
$morehtmlref .= '</div>';
$object->totalpaid = $totalpaye; // To give a chance to dol_banner_tab to use already paid amount to show correct status
$object->totalpaid = $totalpaid; // To give a chance to dol_banner_tab to use already paid amount to show correct status
dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref, '', 0);

View File

@ -84,7 +84,7 @@ $object->info($object->id);
$head = facture_prepare_head($object);
print dol_get_fiche_head($head, 'info', $langs->trans("InvoiceCustomer"), -1, 'bill');
$totalpaye = $object->getSommePaiement();
$totalpaid = $object->getSommePaiement();
// Invoice content
@ -131,7 +131,7 @@ if (!empty($conf->projet->enabled)) {
}
$morehtmlref .= '</div>';
$object->totalpaid = $totalpaye; // To give a chance to dol_banner_tab to use already paid amount to show correct status
$object->totalpaid = $totalpaid; // To give a chance to dol_banner_tab to use already paid amount to show correct status
dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref, '', 0);

View File

@ -472,10 +472,10 @@ if ($action == 'makepayment_confirm' && !empty($user->rights->facture->paiement)
$objecttmp = new Facture($db);
$result = $objecttmp->fetch($toselectid);
if ($result > 0) {
$totalpaye = $objecttmp->getSommePaiement();
$totalpaid = $objecttmp->getSommePaiement();
$totalcreditnotes = $objecttmp->getSumCreditNotesUsed();
$totaldeposits = $objecttmp->getSumDepositsUsed();
$objecttmp->resteapayer = price2num($objecttmp->total_ttc - $totalpaye - $totalcreditnotes - $totaldeposits, 'MT');
$objecttmp->resteapayer = price2num($objecttmp->total_ttc - $totalpaid - $totalcreditnotes - $totaldeposits, 'MT');
if ($objecttmp->statut == Facture::STATUS_DRAFT) {
$error++;
setEventMessages($objecttmp->ref.' '.$langs->trans("Draft"), $objecttmp->errors, 'errors');

View File

@ -99,7 +99,7 @@ if ($id > 0 || !empty($ref)) {
$head = facture_prepare_head($object);
$totalpaye = $object->getSommePaiement();
$totalpaid = $object->getSommePaiement();
print dol_get_fiche_head($head, 'note', $langs->trans("InvoiceCustomer"), -1, 'bill');
@ -148,7 +148,7 @@ if ($id > 0 || !empty($ref)) {
}
$morehtmlref .= '</div>';
$object->totalpaid = $totalpaye; // To give a chance to dol_banner_tab to use already paid amount to show correct status
$object->totalpaid = $totalpaid; // To give a chance to dol_banner_tab to use already paid amount to show correct status
dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref, '', 0);

View File

@ -236,16 +236,16 @@ llxHeader('', $title, $helpurl);
if ($object->id > 0) {
$selleruserevenustamp = $mysoc->useRevenueStamp();
$totalpaye = $object->getSommePaiement();
$totalpaid = $object->getSommePaiement();
$totalcreditnotes = $object->getSumCreditNotesUsed();
$totaldeposits = $object->getSumDepositsUsed();
//print "totalpaye=".$totalpaye." totalcreditnotes=".$totalcreditnotes." totaldeposts=".$totaldeposits;
//print "totalpaid=".$totalpaid." totalcreditnotes=".$totalcreditnotes." totaldeposts=".$totaldeposits;
// We can also use bcadd to avoid pb with floating points
// For example print 239.2 - 229.3 - 9.9; does not return 0.
//$resteapayer=bcadd($object->total_ttc,$totalpaye,$conf->global->MAIN_MAX_DECIMALS_TOT);
//$resteapayer=bcadd($object->total_ttc,$totalpaid,$conf->global->MAIN_MAX_DECIMALS_TOT);
//$resteapayer=bcadd($resteapayer,$totalavoir,$conf->global->MAIN_MAX_DECIMALS_TOT);
$resteapayer = price2num($object->total_ttc - $totalpaye - $totalcreditnotes - $totaldeposits, 'MT');
$resteapayer = price2num($object->total_ttc - $totalpaid - $totalcreditnotes - $totaldeposits, 'MT');
if ($object->paye) {
$resteapayer = 0;
@ -384,7 +384,7 @@ if ($object->id > 0) {
}
$morehtmlref .= '</div>';
$object->totalpaid = $totalpaye; // To give a chance to dol_banner_tab to use already paid amount to show correct status
$object->totalpaid = $totalpaid; // To give a chance to dol_banner_tab to use already paid amount to show correct status
dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref, $moreparam, 0, '', '');
@ -667,7 +667,7 @@ if ($object->id > 0) {
// Total with tax
print '<tr><td>'.$langs->trans('AmountTTC').'</td><td class="nowrap">'.price($object->total_ttc, 1, '', 1, - 1, - 1, $conf->currency).'</td></tr>';
$resteapayer = price2num($object->total_ttc - $totalpaye - $totalcreditnotes - $totaldeposits, 'MT');
$resteapayer = price2num($object->total_ttc - $totalpaid - $totalcreditnotes - $totaldeposits, 'MT');
// TODO Replace this by an include with same code to show already done payment visible in invoice card
print '<tr><td>'.$langs->trans('RemainderToPay').'</td><td class="nowrap">'.price($resteapayer, 1, '', 1, - 1, - 1, $conf->currency).'</td></tr>';

View File

@ -293,7 +293,7 @@ $mend = $tmp['mon'];
$total = 0;
$subtotalcoll = 0;
$subtotalpaye = 0;
$subtotalpaid = 0;
$subtotal = 0;
$i = 0;
$mcursor = 0;
@ -536,7 +536,7 @@ while ((($y < $yend) || ($y == $yend && $m <= $mend)) && $mcursor < 1000) { // $
print '<td class="nowrap right">'.price(price2num($x_paye_sum, 'MT')).'</td>';
$subtotalcoll = $subtotalcoll + $x_coll_sum;
$subtotalpaye = $subtotalpaye + $x_paye_sum;
$subtotalpaid = $subtotalpaid + $x_paye_sum;
$diff = $x_coll_sum - $x_paye_sum;
$total = $total + $diff;
@ -552,12 +552,12 @@ while ((($y < $yend) || ($y == $yend && $m <= $mend)) && $mcursor < 1000) { // $
print '<tr class="liste_total">';
print '<td class="right"><a href="quadri_detail.php?leftmenu=tax_vat&q='.round($m / 3).'&year='.$y.'">'.$langs->trans("SubTotal").'</a>:</td>';
print '<td class="nowrap right">'.price(price2num($subtotalcoll, 'MT')).'</td>';
print '<td class="nowrap right">'.price(price2num($subtotalpaye, 'MT')).'</td>';
print '<td class="nowrap right">'.price(price2num($subtotalpaid, 'MT')).'</td>';
print '<td class="nowrap right">'.price(price2num($subtotal, 'MT')).'</td>';
print '<td>&nbsp;</td></tr>';
$i = 0;
$subtotalcoll = 0;
$subtotalpaye = 0;
$subtotalpaid = 0;
$subtotal = 0;
}
}

View File

@ -394,10 +394,10 @@ class BonPrelevement extends CommonObject
$amounts[$fac->id] = $facs[$i][1];
$amountsperthirdparty[$fac->socid][$fac->id] = $facs[$i][1];
$totalpaye = $fac->getSommePaiement();
$totalpaid = $fac->getSommePaiement();
$totalcreditnotes = $fac->getSumCreditNotesUsed();
$totaldeposits = $fac->getSumDepositsUsed();
$alreadypayed = $totalpaye + $totalcreditnotes + $totaldeposits;
$alreadypayed = $totalpaid + $totalcreditnotes + $totaldeposits;
// @TODO Move this after creation of payment
if (price2num($alreadypayed + $facs[$i][1], 'MT') == $fac->total_ttc) {

View File

@ -158,7 +158,7 @@ if ($id > 0) {
print $fac->error."<br>";
continue;
}
$totalpaye = $fac->getSommePaiement();
$totalpaid = $fac->getSommePaiement();
$userstatic->id = $objf->userid;
$userstatic->login = $objf->login;
@ -168,7 +168,7 @@ if ($id > 0) {
'date' => $fac->date,
'datefieldforsort' => $fac->date.'-'.$fac->ref,
'link' => $fac->getNomUrl(1),
'status' => $fac->getLibStatut(2, $totalpaye),
'status' => $fac->getLibStatut(2, $totalpaid),
'amount' => $fac->total_ttc,
'author' => $userstatic->getLoginUrl(1)
);

View File

@ -166,8 +166,8 @@ if ($action == 'setbankaccount' && $user->rights->tax->charges->creer) {
// Delete social contribution
if ($action == 'confirm_delete' && $confirm == 'yes') {
$object->fetch($id);
$totalpaye = $object->getSommePaiement();
if (empty($totalpaye)) {
$totalpaid = $object->getSommePaiement();
if (empty($totalpaid)) {
$result = $object->delete($user);
if ($result > 0) {
header("Location: list.php");
@ -454,7 +454,7 @@ if ($id > 0) {
if ($result > 0) {
$head = tax_prepare_head($object);
$totalpaye = $object->getSommePaiement();
$totalpaid = $object->getSommePaiement();
// Clone confirmation
if ($action === 'clone') {
@ -576,7 +576,7 @@ if ($id > 0) {
$linkback = '<a href="'.DOL_URL_ROOT.'/compta/sociales/list.php?restore_lastsearch_values=1">'.$langs->trans("BackToList").'</a>';
$object->totalpaye = $totalpaye; // To give a chance to dol_banner_tab to use already paid amount to show correct status
$object->totalpaid = $totalpaid; // To give a chance to dol_banner_tab to use already paid amount to show correct status
dol_banner_tab($object, 'id', $linkback, 1, 'rowid', 'ref', $morehtmlref, '', 0, '', $morehtmlright);
@ -690,7 +690,7 @@ if ($id > 0) {
//print $sql;
$resql = $db->query($sql);
if ($resql) {
$totalpaye = 0;
$totalpaid = 0;
$num = $db->num_rows($resql);
$i = 0;
@ -748,7 +748,7 @@ if ($id > 0) {
}
print '<td class="right"><span class="amount">'.price($objp->amount)."</span></td>\n";
print "</tr>";
$totalpaye += $objp->amount;
$totalpaid += $objp->amount;
$i++;
}
} else {
@ -757,10 +757,10 @@ if ($id > 0) {
print '</tr>';
}
print '<tr><td colspan="'.$nbcols.'" class="right">'.$langs->trans("AlreadyPaid").' :</td><td class="right">'.price($totalpaye)."</td></tr>\n";
print '<tr><td colspan="'.$nbcols.'" class="right">'.$langs->trans("AlreadyPaid").' :</td><td class="right">'.price($totalpaid)."</td></tr>\n";
print '<tr><td colspan="'.$nbcols.'" class="right">'.$langs->trans("AmountExpected").' :</td><td class="right">'.price($object->amount)."</td></tr>\n";
$resteapayer = $object->amount - $totalpaye;
$resteapayer = $object->amount - $totalpaid;
$cssforamountpaymentcomplete = 'amountpaymentcomplete';
print '<tr><td colspan="'.$nbcols.'" class="right">'.$langs->trans("RemainderToPay")." :</td>";
@ -820,7 +820,7 @@ if ($id > 0) {
}
// Delete
if ($user->rights->tax->charges->supprimer && empty($totalpaye)) {
if ($user->rights->tax->charges->supprimer && empty($totalpaid)) {
print '<div class="inline-block divButAction"><a class="butActionDelete" href="'.DOL_URL_ROOT.'/compta/sociales/card.php?id='.$object->id.'&action=delete&token='.newToken().'">'.$langs->trans("Delete").'</a></div>';
} else {
print '<div class="inline-block divButAction"><a class="butActionRefused classfortooltip" href="#" title="'.(dol_escape_htmltag($langs->trans("DisabledBecausePayments"))).'">'.$langs->trans("Delete").'</a></div>';

View File

@ -118,6 +118,7 @@ class ChargeSociales extends CommonObject
*/
public $total;
public $totalpaid;
const STATUS_UNPAID = 0;
const STATUS_PAID = 1;

View File

@ -139,7 +139,9 @@ if ($object->id) {
$linkback = '<a href="'.DOL_URL_ROOT.'/compta/sociales/list.php?restore_lastsearch_values=1">'.$langs->trans("BackToList").'</a>';
$object->totalpaye = $totalpaye; // To give a chance to dol_banner_tab to use already paid amount to show correct status
$object->totalpaid = $alreadypayed; // To give a chance to dol_banner_tab to use already paid amount to show correct status
$morehtmlright = '';
dol_banner_tab($object, 'id', $linkback, 1, 'rowid', 'ref', $morehtmlref, '', 0, '', $morehtmlright);

View File

@ -81,6 +81,8 @@ $object->info($id);
$head = tax_prepare_head($object);
$alreadypayed = $object->getSommePaiement();
print dol_get_fiche_head($head, 'info', $langs->trans("SocialContribution"), -1, $object->picto);
$morehtmlref = '<div class="refidno">';
@ -106,8 +108,9 @@ $morehtmlref .= '</div>';
$linkback = '<a href="'.DOL_URL_ROOT.'/compta/sociales/list.php?restore_lastsearch_values=1">'.$langs->trans("BackToList").'</a>';
$object->totalpaye = $totalpaye; // To give a chance to dol_banner_tab to use already paid amount to show correct status
$object->totalpaid = $alreadypayed; // To give a chance to dol_banner_tab to use already paid amount to show correct status
$morehtmlright = '';
dol_banner_tab($object, 'id', $linkback, 1, 'rowid', 'ref', $morehtmlref, '', 0, '', $morehtmlright);
print '<div class="fichecenter">';

View File

@ -113,7 +113,9 @@ if ($id > 0 || !empty($ref)) {
// ------------------------------------------------------------
$linkback = '<a href="'.DOL_URL_ROOT.'/compta/sociales/list.php?restore_lastsearch_values=1">'.$langs->trans("BackToList").'</a>';
//$object->totalpaye = $totalpaye; // To give a chance to dol_banner_tab to use already paid amount to show correct status
//$object->totalpaid = $totalpaid; // To give a chance to dol_banner_tab to use already paid amount to show correct status
$morehtmlright = '';
dol_banner_tab($object, 'id', $linkback, 1, 'rowid', 'ref', $morehtmlref, '', 0, '', $morehtmlright);

View File

@ -137,7 +137,7 @@ print '<input type="hidden" name="page" value="'.$page.'">';
$sql = "SELECT c.id, c.libelle as type_label,";
$sql .= " cs.rowid, cs.libelle as label_sc, cs.fk_type as type, cs.periode, cs.date_ech, cs.amount as total, cs.paye,";
$sql .= " pc.rowid as pid, pc.datep, pc.amount as totalpaye, pc.num_paiement as num_payment, pc.fk_bank,";
$sql .= " pc.rowid as pid, pc.datep, pc.amount as totalpaid, pc.num_paiement as num_payment, pc.fk_bank,";
$sql .= " pct.code as payment_code,";
$sql .= " u.rowid uid, u.lastname, u.firstname, u.email, u.login, u.admin,";
$sql .= " ba.rowid as bid, ba.ref as bref, ba.number as bnumber, ba.account_number, ba.fk_accountancy_journal, ba.label as blabel, ba.iban_prefix as iban, ba.bic, ba.currency_code, ba.clos";
@ -253,7 +253,7 @@ if (!$resql) {
$i = 0;
$total = 0;
$totalnb = 0;
$totalpaye = 0;
$totalpaid = 0;
while ($i < min($num, $limit)) {
$obj = $db->fetch_object($resql);
@ -346,8 +346,8 @@ while ($i < min($num, $limit)) {
// Paid
print '<td class="right">';
if ($obj->totalpaye) {
print '<span class="amount">'.price($obj->totalpaye).'</span>';
if ($obj->totalpaid) {
print '<span class="amount">'.price($obj->totalpaid).'</span>';
}
print '</td>';
@ -357,7 +357,7 @@ while ($i < min($num, $limit)) {
$total = $total + $obj->total;
$totalnb = $totalnb + $obj->nb;
$totalpaye = $totalpaye + $obj->totalpaye;
$totalpaid = $totalpaid + $obj->totalpaid;
$i++;
}
@ -373,7 +373,7 @@ if (!empty($conf->banque->enabled)) {
print '<td></td>';
print '<td></td>';
}
print '<td class="liste_total right">'.price($totalpaye)."</td>";
print '<td class="liste_total right">'.price($totalpaid)."</td>";
print '<td></td>';
print "</tr>";

View File

@ -273,9 +273,9 @@ if ($action == 'add' && !$cancel) {
if ($action == 'confirm_delete' && $confirm == 'yes') {
$result = $object->fetch($id);
$totalpaye = $object->getSommePaiement();
$totalpaid = $object->getSommePaiement();
if (empty($totalpaye)) {
if (empty($totalpaid)) {
$db->begin();
$ret = $object->delete($user);
@ -540,7 +540,7 @@ if ($action == 'create') {
if ($id > 0) {
$head = vat_prepare_head($object);
$totalpaye = $object->getSommePaiement();
$totalpaid = $object->getSommePaiement();
// Clone confirmation
if ($action === 'clone') {
@ -580,7 +580,7 @@ if ($id > 0) {
$linkback = '<a href="'.DOL_URL_ROOT.'/compta/tva/list.php?restore_lastsearch_values=1">'.$langs->trans("BackToList").'</a>';
$object->totalpaye = $totalpaye; // To give a chance to dol_banner_tab to use already paid amount to show correct status
$object->totalpaid = $totalpaid; // To give a chance to dol_banner_tab to use already paid amount to show correct status
dol_banner_tab($object, 'id', $linkback, 1, 'rowid', 'ref', $morehtmlref, '', 0, '', '');
@ -683,7 +683,7 @@ if ($id > 0) {
//print $sql;
$resql = $db->query($sql);
if ($resql) {
$totalpaye = 0;
$totalpaid = 0;
$num = $db->num_rows($resql);
$i = 0;
@ -735,7 +735,7 @@ if ($id > 0) {
}
print '<td class="right"><span class="amount">'.price($objp->amount)."</span></td>\n";
print "</tr>";
$totalpaye += $objp->amount;
$totalpaid += $objp->amount;
$i++;
}
} else {
@ -744,10 +744,10 @@ if ($id > 0) {
print '</tr>';
}
print '<tr><td colspan="'.$nbcols.'" class="right">'.$langs->trans("AlreadyPaid")." :</td><td class=\"right\">".price($totalpaye)."</td></tr>\n";
print '<tr><td colspan="'.$nbcols.'" class="right">'.$langs->trans("AlreadyPaid")." :</td><td class=\"right\">".price($totalpaid)."</td></tr>\n";
print '<tr><td colspan="'.$nbcols.'" class="right">'.$langs->trans("AmountExpected")." :</td><td class=\"right\">".price($object->amount)."</td></tr>\n";
$resteapayer = $object->amount - $totalpaye;
$resteapayer = $object->amount - $totalpaid;
$cssforamountpaymentcomplete = 'amountpaymentcomplete';
print '<tr><td colspan="'.$nbcols.'" class="right">'.$langs->trans("RemainderToPay")." :</td>";
@ -810,7 +810,7 @@ if ($id > 0) {
print '<div class="inline-block divButAction"><a class="butAction" href="'.DOL_URL_ROOT.'/compta/tva/card.php?id='.$object->id.'&token='.newToken().'&action=clone">'.$langs->trans("ToClone")."</a></div>";
}
if (!empty($user->rights->tax->charges->supprimer) && empty($totalpaye)) {
if (!empty($user->rights->tax->charges->supprimer) && empty($totalpaid)) {
print '<div class="inline-block divButAction"><a class="butActionDelete" href="card.php?id='.$object->id.'&action=delete&token='.newToken().'">'.$langs->trans("Delete").'</a></div>';
} else {
print '<div class="inline-block divButAction"><a class="butActionRefused classfortooltip" href="#" title="'.(dol_escape_htmltag($langs->trans("DisabledBecausePayments"))).'">'.$langs->trans("Delete").'</a></div>';

View File

@ -62,6 +62,8 @@ class Tva extends CommonObject
public $type_payment;
public $num_payment;
public $totalpaid;
/**
* @var string label
*/

View File

@ -125,8 +125,9 @@ if ($object->id) {
$linkback = '<a href="'.DOL_URL_ROOT.'/compta/tva/list.php?restore_lastsearch_values=1">'.$langs->trans("BackToList").'</a>';
$object->totalpaye = $totalpaye; // To give a chance to dol_banner_tab to use already paid amount to show correct status
$object->totalpaid = $totalpaid; // To give a chance to dol_banner_tab to use already paid amount to show correct status
$morehtmlright = '';
dol_banner_tab($object, 'id', $linkback, 1, 'rowid', 'ref', $morehtmlref, '', 0, '', $morehtmlright);
print '<div class="fichecenter">';

View File

@ -255,7 +255,7 @@ if ($refresh === true) {
//var_dump($m);
$total = 0;
$subtotalcoll = 0;
$subtotalpaye = 0;
$subtotalpaid = 0;
$subtotal = 0;
$i = 0;
$mcursor = 0;
@ -481,7 +481,7 @@ if ($refresh === true) {
print '<td class="nowrap right"><span class="amount">' . price(price2num($x_paye_sum, 'MT')) . '</span></td>';
$subtotalcoll = $subtotalcoll + $x_coll_sum;
$subtotalpaye = $subtotalpaye + $x_paye_sum;
$subtotalpaid = $subtotalpaid + $x_paye_sum;
$diff = $x_coll_sum - $x_paye_sum;
$total = $total + $diff;
@ -498,12 +498,12 @@ if ($refresh === true) {
print '<tr class="liste_total">';
print '<td class="right"><a href="quadri_detail.php?leftmenu=tax_vat&q=' . round($m / 3) . '&year=' . $y . '">' . $langs->trans("SubTotal") . '</a>:</td>';
print '<td class="nowrap right">' . price(price2num($subtotalcoll, 'MT')) . '</td>';
print '<td class="nowrap right">' . price(price2num($subtotalpaye, 'MT')) . '</td>';
print '<td class="nowrap right">' . price(price2num($subtotalpaid, 'MT')) . '</td>';
print '<td class="nowrap right">' . price(price2num($subtotal, 'MT')) . '</td>';
print '<td>&nbsp;</td></tr>';
$i = 0;
$subtotalcoll = 0;
$subtotalpaye = 0;
$subtotalpaid = 0;
$subtotal = 0;
}
}

View File

@ -141,7 +141,7 @@ if (!empty($conf->tax->enabled) && $user->rights->tax->charges->lire) {
$sql = "SELECT tva.rowid, tva.label as label, b.fk_account, ptva.fk_bank";
$sql .= ", tva.datev";
$sql .= ", tva.amount as total,";
$sql .= " ptva.rowid as pid, ptva.datep, ptva.amount as totalpaye, ptva.num_paiement as num_payment,";
$sql .= " ptva.rowid as pid, ptva.datep, ptva.amount as totalpaid, ptva.num_paiement as num_payment,";
$sql .= " pct.code as payment_code";
$sql .= " FROM ".MAIN_DB_PREFIX."tva as tva,";
$sql .= " ".MAIN_DB_PREFIX."payment_vat as ptva";
@ -175,7 +175,7 @@ if (!empty($conf->tax->enabled) && $user->rights->tax->charges->lire) {
$i = 0;
$total = 0;
$totalnb = 0;
$totalpaye = 0;
$totalpaid = 0;
while ($i < min($num, $limit)) {
$obj = $db->fetch_object($resql);
@ -237,15 +237,15 @@ if (!empty($conf->tax->enabled) && $user->rights->tax->charges->lire) {
print '<td class="right"><span class="amount">'.price($obj->total).'</span></td>';
// Paid
print '<td class="right"><span class="amount">';
if ($obj->totalpaye) {
print price($obj->totalpaye);
if ($obj->totalpaid) {
print price($obj->totalpaid);
}
print '</span></td>';
print '</tr>';
$total = $total + $obj->total;
$totalnb = $totalnb + $obj->nb;
$totalpaye = $totalpaye + $obj->totalpaye;
$totalpaid = $totalpaid + $obj->totalpaid;
$i++;
}
@ -260,7 +260,7 @@ if (!empty($conf->tax->enabled) && $user->rights->tax->charges->lire) {
}
print '<td align="center" class="liste_total">&nbsp;</td>';
print '<td align="center" class="liste_total">&nbsp;</td>';
print '<td class="liste_total right">'.price($totalpaye)."</td>";
print '<td class="liste_total right">'.price($totalpaid)."</td>";
print "</tr>";
} else {
dol_print_error($db);

View File

@ -742,17 +742,17 @@ abstract class CommonInvoice extends CommonObject
if ($row[0] == 0) {
$now = dol_now();
$totalpaye = $this->getSommePaiement();
$totalpaid = $this->getSommePaiement();
$totalcreditnotes = $this->getSumCreditNotesUsed();
$totaldeposits = $this->getSumDepositsUsed();
//print "totalpaye=".$totalpaye." totalcreditnotes=".$totalcreditnotes." totaldeposts=".$totaldeposits;
//print "totalpaid=".$totalpaid." totalcreditnotes=".$totalcreditnotes." totaldeposts=".$totaldeposits;
// We can also use bcadd to avoid pb with floating points
// For example print 239.2 - 229.3 - 9.9; does not return 0.
//$resteapayer=bcadd($this->total_ttc,$totalpaye,$conf->global->MAIN_MAX_DECIMALS_TOT);
//$resteapayer=bcadd($this->total_ttc,$totalpaid,$conf->global->MAIN_MAX_DECIMALS_TOT);
//$resteapayer=bcadd($resteapayer,$totalavoir,$conf->global->MAIN_MAX_DECIMALS_TOT);
if (empty($amount)) {
$amount = price2num($this->total_ttc - $totalpaye - $totalcreditnotes - $totaldeposits, 'MT');
$amount = price2num($this->total_ttc - $totalpaid - $totalcreditnotes - $totaldeposits, 'MT');
}
if (is_numeric($amount) && $amount != 0) {

View File

@ -2115,9 +2115,9 @@ function dol_banner_tab($object, $paramid, $morehtml = '', $shownav = 1, $fieldi
$morehtmlstatus .= '<span class="statusrefbuy">'.$object->getLibStatut(6, 1).'</span>';
}
} elseif (in_array($object->element, array('facture', 'invoice', 'invoice_supplier', 'chargesociales', 'loan', 'tva', 'salary'))) {
$tmptxt = $object->getLibStatut(6, $object->totalpaye);
$tmptxt = $object->getLibStatut(6, $object->totalpaid);
if (empty($tmptxt) || $tmptxt == $object->getLibStatut(3)) {
$tmptxt = $object->getLibStatut(5, $object->totalpaye);
$tmptxt = $object->getLibStatut(5, $object->totalpaid);
}
$morehtmlstatus .= $tmptxt;
} elseif ($object->element == 'contrat' || $object->element == 'contract') {

View File

@ -450,9 +450,9 @@ class SupplierInvoices extends DolibarrApi
}
// Calculate amount to pay
$totalpaye = $this->invoice->getSommePaiement();
$totalpaid = $this->invoice->getSommePaiement();
$totaldeposits = $this->invoice->getSumDepositsUsed();
$resteapayer = price2num($this->invoice->total_ttc - $totalpaye - $totaldeposits, 'MT');
$resteapayer = price2num($this->invoice->total_ttc - $totalpaid - $totaldeposits, 'MT');
$this->db->begin();

View File

@ -880,10 +880,10 @@ if (empty($reshook)) {
if (GETPOST('invoiceAvoirWithPaymentRestAmount', 'int') == 1 && $id > 0) {
$facture_source = new FactureFournisseur($db); // fetch origin object if not previously defined
if ($facture_source->fetch($object->fk_facture_source) > 0) {
$totalpaye = $facture_source->getSommePaiement();
$totalpaid = $facture_source->getSommePaiement();
$totalcreditnotes = $facture_source->getSumCreditNotesUsed();
$totaldeposits = $facture_source->getSumDepositsUsed();
$remain_to_pay = abs($facture_source->total_ttc - $totalpaye - $totalcreditnotes - $totaldeposits);
$remain_to_pay = abs($facture_source->total_ttc - $totalpaid - $totalcreditnotes - $totaldeposits);
$object->addline($langs->trans('invoiceAvoirLineWithPaymentRestAmount'), $remain_to_pay, 0, 0, 0, 1, 0, 0, '', '', 'TTC');
}
@ -1712,8 +1712,8 @@ if (empty($reshook)) {
// Set invoice to draft status
$object->fetch($id);
$totalpaye = $object->getSommePaiement();
$resteapayer = $object->total_ttc - $totalpaye;
$totalpaid = $object->getSommePaiement();
$resteapayer = $object->total_ttc - $totalpaid;
// We check that lines of invoices are exported in accountancy
$ventilExportCompta = $object->getVentilExportCompta();
@ -2597,24 +2597,24 @@ if ($action == 'create') {
$societe = $object->thirdparty;
$totalpaye = $object->getSommePaiement();
$totalpaid = $object->getSommePaiement();
$totalcreditnotes = $object->getSumCreditNotesUsed();
$totaldeposits = $object->getSumDepositsUsed();
// print "totalpaye=".$totalpaye." totalcreditnotes=".$totalcreditnotes." totaldeposts=".$totaldeposits."
// print "totalpaid=".$totalpaid." totalcreditnotes=".$totalcreditnotes." totaldeposts=".$totaldeposits."
// selleruserrevenuestamp=".$selleruserevenustamp;
// We can also use bcadd to avoid pb with floating points
// For example print 239.2 - 229.3 - 9.9; does not return 0.
// $resteapayer=bcadd($object->total_ttc,$totalpaye,$conf->global->MAIN_MAX_DECIMALS_TOT);
// $resteapayer=bcadd($object->total_ttc,$totalpaid,$conf->global->MAIN_MAX_DECIMALS_TOT);
// $resteapayer=bcadd($resteapayer,$totalavoir,$conf->global->MAIN_MAX_DECIMALS_TOT);
$resteapayer = price2num($object->total_ttc - $totalpaye - $totalcreditnotes - $totaldeposits, 'MT');
$resteapayer = price2num($object->total_ttc - $totalpaid - $totalcreditnotes - $totaldeposits, 'MT');
// Multicurrency
if (!empty($conf->multicurrency->enabled)) {
$multicurrency_totalpaye = $object->getSommePaiement(1);
$multicurrency_totalpaid = $object->getSommePaiement(1);
$multicurrency_totalcreditnotes = $object->getSumCreditNotesUsed(1);
$multicurrency_totaldeposits = $object->getSumDepositsUsed(1);
$multicurrency_resteapayer = price2num($object->multicurrency_total_ttc - $multicurrency_totalpaye - $multicurrency_totalcreditnotes - $multicurrency_totaldeposits, 'MT');
$multicurrency_resteapayer = price2num($object->multicurrency_total_ttc - $multicurrency_totalpaid - $multicurrency_totalcreditnotes - $multicurrency_totaldeposits, 'MT');
// Code to fix case of corrupted data
if ($resteapayer == 0 && $multicurrency_resteapayer != 0) {
$resteapayer = price2num($multicurrency_resteapayer / $object->multicurrency_tx, 'MT');
@ -2894,7 +2894,7 @@ if ($action == 'create') {
}
$morehtmlref .= '</div>';
$object->totalpaye = $totalpaye; // To give a chance to dol_banner_tab to use already paid amount to show correct status
$object->totalpaid = $totalpaid; // To give a chance to dol_banner_tab to use already paid amount to show correct status
dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref);
@ -3227,7 +3227,7 @@ if ($action == 'create') {
// List of payments
$totalpaye = 0;
$totalpaid = 0;
$sign = 1;
if ($object->type == FactureFournisseur::TYPE_CREDIT_NOTE) {
@ -3333,7 +3333,7 @@ if ($action == 'create') {
}
print '</td>';
print '</tr>';
$totalpaye += $objp->amount;
$totalpaid += $objp->amount;
$i++;
}
} else {
@ -3343,10 +3343,10 @@ if ($action == 'create') {
/*
if ($object->paye == 0)
{
print '<tr><td colspan="'.$nbcols.'" class="right">'.$langs->trans('AlreadyPaid').' :</td><td class="right">'.price($totalpaye).'</td><td></td></tr>';
print '<tr><td colspan="'.$nbcols.'" class="right">'.$langs->trans('AlreadyPaid').' :</td><td class="right">'.price($totalpaid).'</td><td></td></tr>';
print '<tr><td colspan="'.$nbcols.'" class="right">'.$langs->trans("Billed").' :</td><td class="right">'.price($object->total_ttc).'</td><td></td></tr>';
$resteapayer = $object->total_ttc - $totalpaye;
$resteapayer = $object->total_ttc - $totalpaid;
print '<tr><td colspan="'.$nbcols.'" class="right">'.$langs->trans('RemainderToPay').' :</td>';
print '<td class="right'.($resteapayer?' amountremaintopay':'').'">'.price($resteapayer).'</td><td></td></tr>';
@ -3368,9 +3368,9 @@ if ($action == 'create') {
print $langs->trans('AlreadyPaid');
}
print '</span>';
print '</td><td class="right"'.(($totalpaye > 0) ? ' class="amountalreadypaid"' : '').'>'.price($totalpaye).'</td><td>&nbsp;</td></tr>';
print '</td><td class="right"'.(($totalpaid > 0) ? ' class="amountalreadypaid"' : '').'>'.price($totalpaid).'</td><td>&nbsp;</td></tr>';
//$resteapayer = $object->total_ttc - $totalpaye;
//$resteapayer = $object->total_ttc - $totalpaid;
$resteapayeraffiche = $resteapayer;
$cssforamountpaymentcomplete = 'amountpaymentcomplete';
@ -3422,7 +3422,7 @@ if ($action == 'create') {
print '<span class="opacitymedium">';
print $form->textwithpicto($langs->trans("Discount"), $langs->trans("HelpEscompte"), - 1);
print '</span>';
print '</td><td class="right">'.price($object->total_ttc - $creditnoteamount - $depositamount - $totalpaye).'</td><td>&nbsp;</td></tr>';
print '</td><td class="right">'.price($object->total_ttc - $creditnoteamount - $depositamount - $totalpaid).'</td><td>&nbsp;</td></tr>';
$resteapayeraffiche = 0;
$cssforamountpaymentcomplete = 'amountpaymentneutral';
}
@ -3432,7 +3432,7 @@ if ($action == 'create') {
print '<span class="opacitymedium">';
print $form->textwithpicto($langs->trans("Abandoned"), $langs->trans("HelpAbandonBadCustomer"), - 1);
print '</span>';
print '</td><td class="right">'.price($object->total_ttc - $creditnoteamount - $depositamount - $totalpaye).'</td><td>&nbsp;</td></tr>';
print '</td><td class="right">'.price($object->total_ttc - $creditnoteamount - $depositamount - $totalpaid).'</td><td>&nbsp;</td></tr>';
// $resteapayeraffiche=0;
$cssforamountpaymentcomplete = 'amountpaymentneutral';
}
@ -3442,7 +3442,7 @@ if ($action == 'create') {
print '<span class="opacitymedium">';
print $form->textwithpicto($langs->trans("ProductReturned"), $langs->trans("HelpAbandonProductReturned"), - 1);
print '</span>';
print '</td><td class="right">'.price($object->total_ttc - $creditnoteamount - $depositamount - $totalpaye).'</td><td>&nbsp;</td></tr>';
print '</td><td class="right">'.price($object->total_ttc - $creditnoteamount - $depositamount - $totalpaid).'</td><td>&nbsp;</td></tr>';
$resteapayeraffiche = 0;
$cssforamountpaymentcomplete = 'amountpaymentneutral';
}
@ -3456,7 +3456,7 @@ if ($action == 'create') {
print '<span class="opacitymedium">';
print $form->textwithpicto($langs->trans("Abandoned"), $text, - 1);
print '</span>';
print '</td><td class="right">'.price($object->total_ttc - $creditnoteamount - $depositamount - $totalpaye).'</td><td>&nbsp;</td></tr>';
print '</td><td class="right">'.price($object->total_ttc - $creditnoteamount - $depositamount - $totalpaid).'</td><td>&nbsp;</td></tr>';
$resteapayeraffiche = 0;
$cssforamountpaymentcomplete = 'amountpaymentneutral';
}
@ -3498,7 +3498,7 @@ if ($action == 'create') {
// Total already paid back
print '<tr><td colspan="'.$nbcols.'" class="right">';
print $langs->trans('AlreadyPaidBack');
print ' :</td><td class="right">'.price($sign * $totalpaye).'</td><td>&nbsp;</td></tr>';
print ' :</td><td class="right">'.price($sign * $totalpaid).'</td><td>&nbsp;</td></tr>';
// Billed
print '<tr><td colspan="'.$nbcols.'" class="right">'.$langs->trans("Billed").' :</td><td class="right">'.price($sign * $object->total_ttc).'</td><td>&nbsp;</td></tr>';
@ -3691,7 +3691,7 @@ if ($action == 'create') {
}
// For standard invoice with excess paid
if ($object->type == FactureFournisseur::TYPE_STANDARD && empty($object->paye) && ($object->total_ttc - $totalpaye - $totalcreditnotes - $totaldeposits) < 0 && $usercancreate && empty($discount->id)) {
if ($object->type == FactureFournisseur::TYPE_STANDARD && empty($object->paye) && ($object->total_ttc - $totalpaid - $totalcreditnotes - $totaldeposits) < 0 && $usercancreate && empty($discount->id)) {
print '<a class="butAction'.($conf->use_javascript_ajax ? ' reposition' : '').'" href="'.$_SERVER["PHP_SELF"].'?facid='.$object->id.'&amp;action=converttoreduc">'.$langs->trans('ConvertExcessPaidToReduc').'</a>';
}
// For credit note
@ -3718,7 +3718,7 @@ if ($action == 'create') {
// Classify 'closed not completely paid' (possible if validated and not yet filed paid)
if ($object->statut == FactureFournisseur::STATUS_VALIDATED && $object->paye == 0 && $resteapayer > 0 && (empty($conf->global->SUPPLIER_INVOICE_CAN_SET_PAID_EVEN_IF_PARTIALLY_PAID) || $object->total_ttc != $resteapayer)) {
if ($totalpaye > 0 || $totalcreditnotes > 0) {
if ($totalpaid > 0 || $totalcreditnotes > 0) {
// If one payment or one credit note was linked to this invoice
print '<a class="butAction'.($conf->use_javascript_ajax ? ' reposition' : '').'" href="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'&amp;action=paid">'.$langs->trans('ClassifyPaidPartially').'</a>';
} else {

View File

@ -172,7 +172,7 @@ if ($id > 0 || !empty($ref)) {
}
$morehtmlref .= '</div>';
$object->totalpaye = $alreadypaid; // To give a chance to dol_banner_tab to use already paid amount to show correct status
$object->totalpaid = $alreadypaid; // To give a chance to dol_banner_tab to use already paid amount to show correct status
dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref);

View File

@ -102,7 +102,7 @@ if ($object->id > 0) {
$head = facturefourn_prepare_head($object);
print dol_get_fiche_head($head, 'documents', $langs->trans('SupplierInvoice'), -1, 'supplier_invoice');
$totalpaye = $object->getSommePaiement();
$totalpaid = $object->getSommePaiement();
$linkback = '<a href="'.DOL_URL_ROOT.'/fourn/facture/list.php?restore_lastsearch_values=1'.(!empty($socid) ? '&socid='.$socid : '').'">'.$langs->trans("BackToList").'</a>';
@ -150,7 +150,7 @@ if ($object->id > 0) {
}
$morehtmlref .= '</div>';
$object->totalpaye = $totalpaye; // To give a chance to dol_banner_tab to use already paid amount to show correct status
$object->totalpaid = $totalpaid; // To give a chance to dol_banner_tab to use already paid amount to show correct status
dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref, '', 0);

View File

@ -116,7 +116,7 @@ if (!empty($conf->projet->enabled)) {
}
$morehtmlref .= '</div>';
$object->totalpaye = $alreadypaid; // To give a chance to dol_banner_tab to use already paid amount to show correct status
$object->totalpaid = $alreadypaid; // To give a chance to dol_banner_tab to use already paid amount to show correct status
dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref, '', 0);

View File

@ -323,10 +323,10 @@ if (empty($reshook)) {
$objecttmp = new FactureFournisseur($db);
$result = $objecttmp->fetch($toselectid);
if ($result > 0) {
$totalpaye = $objecttmp->getSommePaiement();
$totalpaid = $objecttmp->getSommePaiement();
$totalcreditnotes = $objecttmp->getSumCreditNotesUsed();
$totaldeposits = $objecttmp->getSumDepositsUsed();
$objecttmp->resteapayer = price2num($objecttmp->total_ttc - $totalpaye - $totalcreditnotes - $totaldeposits, 'MT');
$objecttmp->resteapayer = price2num($objecttmp->total_ttc - $totalpaid - $totalcreditnotes - $totaldeposits, 'MT');
if ($objecttmp->statut == FactureFournisseur::STATUS_DRAFT) {
$error++;
setEventMessages($objecttmp->ref.' '.$langs->trans("Draft"), $objecttmp->errors, 'errors');

View File

@ -144,7 +144,7 @@ if ($object->id > 0) {
}
$morehtmlref .= '</div>';
$object->totalpaye = $alreadypaid; // To give a chance to dol_banner_tab to use already paid amount to show correct status
$object->totalpaid = $alreadypaid; // To give a chance to dol_banner_tab to use already paid amount to show correct status
dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref);

View File

@ -108,14 +108,14 @@ if ($socid > 0) {
print $fac->error."<br>";
continue;
}
$totalpaye = $fac->getSommePaiement();
$totalpaid = $fac->getSommePaiement();
print '<tr class="oddeven">';
print "<td class=\"center\">".dol_print_date($fac->date)."</td>\n";
print '<td class="center">'.dol_print_date($fac->date)."</td>\n";
print "<td><a href=\"facture/card.php?facid=$fac->id\">".img_object($langs->trans("ShowBill"), "bill")." ".$fac->ref."</a></td>\n";
print '<td class="left">'.$fac->getLibStatut(2, $totalpaye).'</td>';
print '<td class="left">'.$fac->getLibStatut(2, $totalpaid).'</td>';
print '<td class="right">'.price($fac->total_ttc)."</td>\n";
$solde = $solde + $fac->total_ttc;

View File

@ -1051,8 +1051,10 @@ if ($ispaymentok) {
include_once DOL_DOCUMENT_ROOT.'/don/class/paymentdonation.class.php';
$paiement = new PaymentDonation($db);
$totalpaid = $FinalPaymentAmt;
if ($currencyCodeType == $conf->currency) {
$paiement->amounts = array($object->id => $FinalPaymentAmt); // Array with all payments dispatching with donation
$paiement->amounts = array($object->id => $totalpaid); // Array with all payments dispatching with donation
} else {
// PaymentDonation does not support multi currency
$postactionmessages[] = 'Payment donation can\'t be payed with diffent currency than '.$conf->currency;
@ -1078,7 +1080,9 @@ if ($ispaymentok) {
$postactionmessages[] = 'Payment created';
$ispostactionok = 1;
if ($totalpayed >= $don->getRemainToPay()) $don->setPaid($don->id);
if ($totalpaid >= $don->getRemainToPay()) {
$don->setPaid($don->id);
}
}
}

View File

@ -323,9 +323,9 @@ if ($action == 'add' && empty($cancel)) {
if ($action == 'confirm_delete') {
$result = $object->fetch($id);
$totalpaye = $object->getSommePaiement();
$totalpaid = $object->getSommePaiement();
if (empty($totalpaye)) {
if (empty($totalpaid)) {
$db->begin();
$ret = $object->delete($user);
@ -827,8 +827,8 @@ if ($id) {
$morehtmlref .= '</div>';
$totalpaye = $object->getSommePaiement();
$object->totalpaye = $totalpaye;
$totalpaid = $object->getSommePaiement();
$object->totalpaid = $totalpaid;
dol_banner_tab($object, 'id', $linkback, 1, 'rowid', 'ref', $morehtmlref, '', 0, '', '');
@ -945,7 +945,7 @@ if ($id) {
//print $sql;
$resql = $db->query($sql);
if ($resql) {
$totalpaye = 0;
$totalpaid = 0;
$num = $db->num_rows($resql);
$i = 0; $total = 0;
@ -994,7 +994,7 @@ if ($id) {
}
print '<td class="right">'.price($objp->amount)."</td>\n";
print "</tr>";
$totalpaye += $objp->amount;
$totalpaid += $objp->amount;
$i++;
}
} else {
@ -1003,10 +1003,10 @@ if ($id) {
print '</tr>';
}
print '<tr><td colspan="'.$nbcols.'" class="right">'.$langs->trans("AlreadyPaid")." :</td><td class=\"right\">".price($totalpaye)."</td></tr>\n";
print '<tr><td colspan="'.$nbcols.'" class="right">'.$langs->trans("AlreadyPaid")." :</td><td class=\"right\">".price($totalpaid)."</td></tr>\n";
print '<tr><td colspan="'.$nbcols.'" class="right">'.$langs->trans("AmountExpected")." :</td><td class=\"right\">".price($object->amount)."</td></tr>\n";
$resteapayer = $object->amount - $totalpaye;
$resteapayer = $object->amount - $totalpaid;
$cssforamountpaymentcomplete = 'amountpaymentcomplete';
print '<tr><td colspan="'.$nbcols.'" class="right">'.$langs->trans("RemainderToPay")." :</td>";
@ -1067,7 +1067,7 @@ if ($id) {
print dolGetButtonAction('', $langs->trans('ToClone'), 'default', $_SERVER["PHP_SELF"].'?action=clone&token='.newToken().'&id='.$object->id, '');
}
if (!empty($user->rights->salaries->delete) && empty($totalpaye)) {
if (!empty($user->rights->salaries->delete) && empty($totalpaid)) {
print dolGetButtonAction('', $langs->trans('Delete'), 'delete', $_SERVER["PHP_SELF"].'?action=delete&token='.newToken().'&id='.$object->id, '');
} else {
print dolGetButtonAction($langs->trans('DisabledBecausePayments'), $langs->trans('Delete'), 'default', $_SERVER['PHP_SELF'].'#', '', false);

View File

@ -175,6 +175,8 @@ class ActionsStripeconnect
$sql .= ' FROM '.MAIN_DB_PREFIX.'paiement_facture as pf';
$sql .= ' WHERE pf.fk_facture = '.((int) $object->id);
$totalpaid = 0;
$result = $this->db->query($sql);
if ($result) {
$i = 0;
@ -182,14 +184,14 @@ class ActionsStripeconnect
while ($i < $num) {
$objp = $this->db->fetch_object($result);
$totalpaye += $objp->amount;
$totalpaid += $objp->amount;
$i++;
}
} else {
dol_print_error($this->db, '');
}
$resteapayer = $object->total_ttc - $totalpaye;
$resteapayer = $object->total_ttc - $totalpaid;
// Request a direct debit order
if ($object->statut > Facture::STATUS_DRAFT && $object->statut < Facture::STATUS_ABANDONED && $object->paye == 0) {
$stripe = new Stripe($this->db);