From 4c4d3623485e4fc24921035982f069637778f8cf Mon Sep 17 00:00:00 2001 From: Jay Yeo Date: Fri, 17 Dec 2021 14:31:06 +0700 Subject: [PATCH 1/3] NEW : add margin in paiement/card.php --- htdocs/compta/paiement/card.php | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/htdocs/compta/paiement/card.php b/htdocs/compta/paiement/card.php index ab6f0f5e574..3595de67759 100644 --- a/htdocs/compta/paiement/card.php +++ b/htdocs/compta/paiement/card.php @@ -35,6 +35,9 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/payments.lib.php'; if (!empty($conf->banque->enabled)) { require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php'; } +if (!empty($conf->margin->enabled)) { + require_once DOL_DOCUMENT_ROOT.'/core/class/html.formmargin.class.php'; +} // Load translation files required by the page $langs->loadLangs(array('bills', 'banks', 'companies')); @@ -359,10 +362,15 @@ if ($resql) { print ''; print ''.$langs->trans('Bill').''; + print ''.$langs->trans('Company').''; if (!empty($conf->multicompany->enabled) && !empty($conf->global->MULTICOMPANY_INVOICE_SHARING_ENABLED)) { print ''.$langs->trans('Entity').''; } + //Add Margin + if (!empty($conf->margin->enabled)) { + print ''.$langs->trans('Margin').''; + } print ''.$langs->trans('ExpectedToPay').''; print ''.$langs->trans('PayedByThisPayment').''; print ''.$langs->trans('RemainderToPay').''; @@ -378,6 +386,14 @@ if ($resql) { $invoice = new Facture($db); $invoice->fetch($objp->facid); + // Add Margin + if (!empty($conf->margin->enabled)) { + $formmargin = new FormMargin($db); + $marginInfo = array(); + $invoice->fetch_lines(); + $marginInfo = $formmargin->getMarginInfosArray($invoice); + } + $paiement = $invoice->getSommePaiement(); $creditnotes = $invoice->getSumCreditNotesUsed(); $deposits = $invoice->getSumDepositsUsed(); @@ -403,6 +419,12 @@ if ($resql) { print $mc->label; print ''; } + + // Add margin + if (!empty($conf->margin->enabled)) { + print ''.price($marginInfo['total_margin']).''; + } + // Expected to pay print ''.price($objp->total_ttc).''; From 492fe288bdea427c60acd6e1aed51caa7a835cf3 Mon Sep 17 00:00:00 2001 From: Jay Yeo Date: Fri, 17 Dec 2021 14:44:47 +0700 Subject: [PATCH 2/3] NEW : add margin in paiement/card.php --- htdocs/compta/paiement/card.php | 1 - 1 file changed, 1 deletion(-) diff --git a/htdocs/compta/paiement/card.php b/htdocs/compta/paiement/card.php index 3595de67759..3609c10bfd1 100644 --- a/htdocs/compta/paiement/card.php +++ b/htdocs/compta/paiement/card.php @@ -362,7 +362,6 @@ if ($resql) { print ''; print ''.$langs->trans('Bill').''; - print ''.$langs->trans('Company').''; if (!empty($conf->multicompany->enabled) && !empty($conf->global->MULTICOMPANY_INVOICE_SHARING_ENABLED)) { print ''.$langs->trans('Entity').''; From b73f746f57327b31ba37e6902fc1e7a4fbd1a25c Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 1 Apr 2023 13:42:45 +0200 Subject: [PATCH 3/3] Update card.php --- htdocs/compta/paiement/card.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/compta/paiement/card.php b/htdocs/compta/paiement/card.php index 3609c10bfd1..ee75a51ac43 100644 --- a/htdocs/compta/paiement/card.php +++ b/htdocs/compta/paiement/card.php @@ -367,7 +367,7 @@ if ($resql) { print ''.$langs->trans('Entity').''; } //Add Margin - if (!empty($conf->margin->enabled)) { + if (!empty($conf->margin->enabled) && getDolGlobalInt('MARGIN_SHOW_MARGIN_ON_PAYMENT')) { print ''.$langs->trans('Margin').''; } print ''.$langs->trans('ExpectedToPay').''; @@ -386,7 +386,7 @@ if ($resql) { $invoice->fetch($objp->facid); // Add Margin - if (!empty($conf->margin->enabled)) { + if (!empty($conf->margin->enabled) && getDolGlobalInt('MARGIN_SHOW_MARGIN_ON_PAYMENT')) { $formmargin = new FormMargin($db); $marginInfo = array(); $invoice->fetch_lines(); @@ -420,7 +420,7 @@ if ($resql) { } // Add margin - if (!empty($conf->margin->enabled)) { + if (!empty($conf->margin->enabled) && getDolGlobalInt('MARGIN_SHOW_MARGIN_ON_PAYMENT')) { print ''.price($marginInfo['total_margin']).''; }