Fix regression on vat calculation when invoice was not a situation
invoice
This commit is contained in:
parent
1b30c1adb4
commit
f345ff7300
@ -142,13 +142,14 @@ if ($result) {
|
||||
// Situation invoices handling
|
||||
$line = new FactureLigne($db);
|
||||
$line->fetch($obj->fdid); // id of line
|
||||
$prev_progress = $line->get_prev_progress($obj->rowid); // id of invoice
|
||||
$prev_progress = 0;
|
||||
if ($obj->type == Facture::TYPE_SITUATION) {
|
||||
// Avoid divide by 0
|
||||
// Avoid divide by 0
|
||||
if ($obj->situation_percent == 0) {
|
||||
$situation_ratio = 0;
|
||||
} else {
|
||||
$situation_ratio = ($obj->situation_percent - $prev_progress) / $obj->situation_percent;
|
||||
$prev_progress = $line->get_prev_progress($obj->rowid); // id of invoice
|
||||
$situation_ratio = ($obj->situation_percent - $prev_progress) / $obj->situation_percent;
|
||||
}
|
||||
} else {
|
||||
$situation_ratio = 1;
|
||||
|
||||
@ -167,13 +167,14 @@ if ($result)
|
||||
// Situation invoices handling
|
||||
$line = new FactureLigne($db);
|
||||
$line->fetch($obj->id); // id of line
|
||||
$prev_progress = $line->get_prev_progress($obj->rowid); // id on invoice
|
||||
$prev_progress = 0;
|
||||
if ($obj->type==Facture::TYPE_SITUATION) {
|
||||
// Avoid divide by 0
|
||||
if ($obj->situation_percent == 0) {
|
||||
$situation_ratio = 0;
|
||||
} else {
|
||||
$situation_ratio = ($obj->situation_percent - $prev_progress) / $obj->situation_percent;
|
||||
$prev_progress = $line->get_prev_progress($obj->rowid); // id on invoice
|
||||
$situation_ratio = ($obj->situation_percent - $prev_progress) / $obj->situation_percent;
|
||||
}
|
||||
} else {
|
||||
$situation_ratio = 1;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user