PVRT Handling IO-736

This commit is contained in:
Patrick Fic
2021-03-03 15:41:54 -08:00
parent 57f6eec9e4
commit 574f8bab89
21 changed files with 1796 additions and 20 deletions

View File

@@ -84,6 +84,7 @@ query QUERY_JOBS_FOR_RECEIVABLES_EXPORT($ids: [uuid!]!) {
rate_mash
rate_matd
class
ca_bc_pvrt
owner {
accountingid
}

View File

@@ -226,17 +226,28 @@ function CalculateAdditional(job) {
Dinero({
amount: Math.round((job.storage_payable || 0) * 100),
})
)
.add(
Dinero({
amount: Math.round((job.ca_bc_pvrt || 0) * 100),
})
);
return ret;
}
function CalculateTaxesTotals(job, otherTotals) {
console.log(
"🚀 ~ file: job-totals.js ~ line 240 ~ otherTotals",
JSON.stringify(otherTotals)
);
const subtotal = otherTotals.parts.parts.subtotal
.add(otherTotals.parts.sublets.subtotal)
.add(otherTotals.rates.rates_subtotal)
.add(otherTotals.additional)
.add(Dinero({ amount: (job.towing_payable || 0) * 100 }))
.add(Dinero({ amount: (job.storage_payable || 0) * 100 }));
.add(otherTotals.additional);
// .add(Dinero({ amount: (job.towing_payable || 0) * 100 }))
// .add(Dinero({ amount: (job.storage_payable || 0) * 100 }));
//Potential issue here with Sublet Calculation. Sublets are calculated under labor in Mitchell, but it's done in IO
//Under the parts rates.
@@ -247,7 +258,7 @@ function CalculateTaxesTotals(job, otherTotals) {
job.joblines
.filter((jl) => !jl.removed)
.forEach((val) => {
if (!!!val.tax_part || !!!val.part_type || IsAdditionalCost(val)) {
if (!val.tax_part || !val.part_type || IsAdditionalCost(val)) {
additionalItemsTax = additionalItemsTax.add(
Dinero({ amount: Math.round((val.act_price || 0) * 100) })
.multiply(val.part_qty || 1)