forked from Wavyzz/dolibarr
Fix total retained warranty
This commit is contained in:
@@ -4566,9 +4566,20 @@ else if ($id > 0 || ! empty($ref))
|
|||||||
|
|
||||||
// Retained warranty : usualy use on construction industry
|
// Retained warranty : usualy use on construction industry
|
||||||
if(!empty($object->situation_final) && !empty($object->retained_warranty) && $displayWarranty){
|
if(!empty($object->situation_final) && !empty($object->retained_warranty) && $displayWarranty){
|
||||||
|
|
||||||
// Billed - retained warranty
|
// Billed - retained warranty
|
||||||
|
if($object->type == Facture::TYPE_SITUATION)
|
||||||
|
{
|
||||||
|
$retainedWarranty = $total_global_ttc * $object->retained_warranty / 100;
|
||||||
|
$billedWithRetainedWarranty = $total_global_ttc - $retainedWarranty ;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// Because one day retained warranty could be used on standard invoices
|
||||||
$retainedWarranty = $object->total_ttc * $object->retained_warranty / 100;
|
$retainedWarranty = $object->total_ttc * $object->retained_warranty / 100;
|
||||||
$billedWithRetainedWarranty = $object->total_ttc - $retainedWarranty ;
|
$billedWithRetainedWarranty = $object->total_ttc - $retainedWarranty ;
|
||||||
|
}
|
||||||
|
|
||||||
print '<tr><td colspan="' . $nbcols . '" align="right">' . $langs->trans("ToPayOn", dol_print_date($object->date_lim_reglement, 'day')) . ' :</td><td align="right">' . price($billedWithRetainedWarranty) . '</td><td> </td></tr>';
|
print '<tr><td colspan="' . $nbcols . '" align="right">' . $langs->trans("ToPayOn", dol_print_date($object->date_lim_reglement, 'day')) . ' :</td><td align="right">' . price($billedWithRetainedWarranty) . '</td><td> </td></tr>';
|
||||||
|
|
||||||
// retained warranty
|
// retained warranty
|
||||||
|
|||||||
@@ -173,7 +173,7 @@ $arrayfields=array(
|
|||||||
|
|
||||||
if($conf->global->INVOICE_USE_SITUATION && $conf->global->INVOICE_USE_SITUATION_RETAINED_WARRANTY)
|
if($conf->global->INVOICE_USE_SITUATION && $conf->global->INVOICE_USE_SITUATION_RETAINED_WARRANTY)
|
||||||
{
|
{
|
||||||
$arrayfields['f.retained_warranty'] = array('label'=>$langs->trans("RetainedWarranty"), 'checked'=>0, 'position'=>2000);
|
$arrayfields['f.retained_warranty'] = array('label'=>$langs->trans("RetainedWarranty"), 'checked'=>0);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Extra fields
|
// Extra fields
|
||||||
|
|||||||
Reference in New Issue
Block a user