forked from Wavyzz/dolibarr
Merge pull request #19642 from 1ocate/NEW_add_margin_in_paiement/card.php
NEW : add margin in paiement/card.php
This commit is contained in:
@@ -36,6 +36,9 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/payments.lib.php';
|
||||
if (isModEnabled("banque")) {
|
||||
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'));
|
||||
@@ -432,6 +435,10 @@ if ($resql) {
|
||||
if (isModEnabled('multicompany') && !empty($conf->global->MULTICOMPANY_INVOICE_SHARING_ENABLED)) {
|
||||
print '<td>'.$langs->trans('Entity').'</td>';
|
||||
}
|
||||
//Add Margin
|
||||
if (!empty($conf->margin->enabled) && getDolGlobalInt('MARGIN_SHOW_MARGIN_ON_PAYMENT')) {
|
||||
print '<td class="right">'.$langs->trans('Margin').'</td>';
|
||||
}
|
||||
print '<td class="right">'.$langs->trans('ExpectedToPay').'</td>';
|
||||
print '<td class="right">'.$langs->trans('PayedByThisPayment').'</td>';
|
||||
print '<td class="right">'.$langs->trans('RemainderToPay').'</td>';
|
||||
@@ -447,6 +454,14 @@ if ($resql) {
|
||||
$invoice = new Facture($db);
|
||||
$invoice->fetch($objp->facid);
|
||||
|
||||
// Add Margin
|
||||
if (!empty($conf->margin->enabled) && getDolGlobalInt('MARGIN_SHOW_MARGIN_ON_PAYMENT')) {
|
||||
$formmargin = new FormMargin($db);
|
||||
$marginInfo = array();
|
||||
$invoice->fetch_lines();
|
||||
$marginInfo = $formmargin->getMarginInfosArray($invoice);
|
||||
}
|
||||
|
||||
$paiement = $invoice->getSommePaiement();
|
||||
$creditnotes = $invoice->getSumCreditNotesUsed();
|
||||
$deposits = $invoice->getSumDepositsUsed();
|
||||
@@ -472,6 +487,12 @@ if ($resql) {
|
||||
print $mc->label;
|
||||
print '</td>';
|
||||
}
|
||||
|
||||
// Add margin
|
||||
if (!empty($conf->margin->enabled) && getDolGlobalInt('MARGIN_SHOW_MARGIN_ON_PAYMENT')) {
|
||||
print '<td class="right">'.price($marginInfo['total_margin']).'</td>';
|
||||
}
|
||||
|
||||
// Expected to pay
|
||||
print '<td class="right"><span class="amount">'.price($objp->total_ttc).'</span></td>';
|
||||
|
||||
|
||||
Reference in New Issue
Block a user