Add massaging of data to CCC import.

This commit is contained in:
Patrick Fic
2023-01-16 15:54:23 -08:00
parent 76025b5db1
commit 392b405978
5 changed files with 68 additions and 22 deletions

View File

@@ -508,11 +508,18 @@ function IsAdditionalCost(jobLine) {
const isPaintOrShopMat =
jobLine.db_ref === "936008" || jobLine.db_ref === "936007";
return (
(jobLine.lbr_op === "OP13" || //Added to resolve manual job lines coming into other totals because they have no reference.
(jobLine.db_ref && jobLine.db_ref.startsWith("9360"))) &&
!isPaintOrShopMat
);
if (process.env.COUNTRY === "USA") {
return (
jobLine.lbr_op === "OP13" || //Added to resolve manual job lines coming into other totals because they have no reference.
(jobLine.part_type === null && (jobLine.act_price || 0 > 0))
);
} else {
return (
(jobLine.lbr_op === "OP13" || //Added to resolve manual job lines coming into other totals because they have no reference.
(jobLine.db_ref && jobLine.db_ref.startsWith("9360"))) && //This ref works in Canada, but DB_REFS in the US do not fill in.
!isPaintOrShopMat
);
}
}
function CalculateAdditional(job) {
@@ -640,7 +647,7 @@ function CalculateTaxesTotals(job, otherTotals) {
);
}
});
let ret = {
subtotal: subtotal,
federal_tax: subtotal
@@ -666,7 +673,18 @@ function CalculateTaxesTotals(job, otherTotals) {
.add(
otherTotals.additional.storage.percentage((job.tax_str_rt || 0) * 100)
)
.add(additionalItemsTax),
.add(additionalItemsTax)
.add(
process.env.COUNTRY === "USA"
? otherTotals.rates.mapa.total
.percentage((job.tax_paint_mat_rt || 0) * 100)
.add(
otherTotals.rates.mash.total.percentage(
(job.tax_paint_mat_rt || 0) * 100
)
)
: Dinero()
),
// .add(otherTotals.additional.pvrt),
local_tax: subtotal.percentage((job.local_tax_rate || 0) * 100),
};