Skip to content
Snippets Groups Projects
Commit f345ff73 authored by Laurent Destailleur's avatar Laurent Destailleur
Browse files

Fix regression on vat calculation when invoice was not a situation

invoice
parent 1b30c1ad
No related branches found
No related tags found
No related merge requests found
......@@ -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;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment