Fix #9961 : deal with supplier credit note refund like with customers
This commit is contained in:
parent
55718cc7da
commit
46b39dd6a9
@ -71,7 +71,7 @@ if (! $sortorder) $sortorder="DESC";
|
|||||||
if (! $sortfield) $sortfield="p.rowid";
|
if (! $sortfield) $sortfield="p.rowid";
|
||||||
$optioncss = GETPOST('optioncss','alpha');
|
$optioncss = GETPOST('optioncss','alpha');
|
||||||
|
|
||||||
$amounts = array();array();
|
$amounts = array();
|
||||||
$amountsresttopay=array();
|
$amountsresttopay=array();
|
||||||
$addwarning=0;
|
$addwarning=0;
|
||||||
|
|
||||||
@ -251,6 +251,22 @@ if (empty($reshook))
|
|||||||
|
|
||||||
$datepaye = dol_mktime(12, 0, 0, GETPOST('remonth'), GETPOST('reday'), GETPOST('reyear'));
|
$datepaye = dol_mktime(12, 0, 0, GETPOST('remonth'), GETPOST('reday'), GETPOST('reyear'));
|
||||||
|
|
||||||
|
// Clean parameters amount if payment is for a credit note
|
||||||
|
if (GETPOST('type') == FactureFournisseur::TYPE_CREDIT_NOTE)
|
||||||
|
{
|
||||||
|
foreach ($amounts as $key => $value) // How payment is dispatch
|
||||||
|
{
|
||||||
|
$newvalue = price2num($value,'MT');
|
||||||
|
$amounts[$key] = -$newvalue;
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach ($multicurrency_amounts as $key => $value) // How payment is dispatch
|
||||||
|
{
|
||||||
|
$newvalue = price2num($value,'MT');
|
||||||
|
$multicurrency_amounts[$key] = -$newvalue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (! $error)
|
if (! $error)
|
||||||
{
|
{
|
||||||
$db->begin();
|
$db->begin();
|
||||||
@ -431,6 +447,7 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie
|
|||||||
print '<input type="hidden" name="facid" value="'.$facid.'">';
|
print '<input type="hidden" name="facid" value="'.$facid.'">';
|
||||||
print '<input type="hidden" name="ref_supplier" value="'.$obj->ref_supplier.'">';
|
print '<input type="hidden" name="ref_supplier" value="'.$obj->ref_supplier.'">';
|
||||||
print '<input type="hidden" name="socid" value="'.$obj->socid.'">';
|
print '<input type="hidden" name="socid" value="'.$obj->socid.'">';
|
||||||
|
print '<input type="hidden" name="type" id="invoice_type" value="'.$object->type.'">';
|
||||||
print '<input type="hidden" name="societe" value="'.$obj->name.'">';
|
print '<input type="hidden" name="societe" value="'.$obj->name.'">';
|
||||||
|
|
||||||
dol_fiche_head(null);
|
dol_fiche_head(null);
|
||||||
@ -600,14 +617,14 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie
|
|||||||
print '</td>';
|
print '</td>';
|
||||||
}
|
}
|
||||||
|
|
||||||
print '<td align="right">'.price($objp->total_ttc).'</td>';
|
print '<td align="right">'.price($sign * $objp->total_ttc).'</td>';
|
||||||
|
|
||||||
print '<td align="right">'.price($objp->am);
|
print '<td align="right">'.price($sign * $objp->am);
|
||||||
if ($creditnotes) print '+'.price($creditnotes);
|
if ($creditnotes) print '+'.price($creditnotes);
|
||||||
if ($deposits) print '+'.price($deposits);
|
if ($deposits) print '+'.price($deposits);
|
||||||
print '</td>';
|
print '</td>';
|
||||||
|
|
||||||
print '<td align="right">'.price($remaintopay).'</td>';
|
print '<td align="right">'.price($sign * $remaintopay).'</td>';
|
||||||
|
|
||||||
// Amount
|
// Amount
|
||||||
print '<td align="center">';
|
print '<td align="center">';
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user