Skip to content
This repository has been archived by the owner on Feb 10, 2022. It is now read-only.

Commit

Permalink
updated frontdata for the react app
Browse files Browse the repository at this point in the history
  • Loading branch information
Camel Aissani committed Feb 27, 2021
1 parent bb6d263 commit aa80c18
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions backend/managers/frontdata.js
Original file line number Diff line number Diff line change
Expand Up @@ -305,6 +305,9 @@ function toOccupantData(inputOccupant) {
guaranty: occupant.guaranty ? Number(occupant.guaranty) : 0,
vatRatio: occupant.vatRatio ? Number(occupant.vatRatio) : 0,
discount: occupant.discount ? Number(occupant.discount) : 0,
rental: 0,
expenses: 0,
total: 0
}
);

Expand Down Expand Up @@ -354,7 +357,15 @@ function toOccupantData(inputOccupant) {
occupant.office.expense += property.expense;
}
}
occupant.rental += property.price || 0;
occupant.expenses += property.expense || 0;
});
occupant.preTaxTotal = occupant.rental + occupant.expenses - occupant.discount;
occupant.total = occupant.preTaxTotal;
if (occupant.vatRatio) {
occupant.vat = occupant.preTaxTotal * occupant.vatRatio;
occupant.total = occupant.preTaxTotal + occupant.vat;
}
if (occupant.office) {
occupant.office.m2Price = occupant.office.price / occupant.office.surface;
occupant.office.m2Expense = occupant.office.expense / occupant.office.surface;
Expand Down

0 comments on commit aa80c18

Please sign in to comment.