Additional changes for CCC calculations.

This commit is contained in:
Patrick Fic
2023-01-19 08:58:23 -08:00
parent 392b405978
commit cccd007ba6
10 changed files with 242 additions and 103 deletions

View File

@@ -516,6 +516,17 @@ async function CheckTaxRates(estData, bodyshop) {
}
async function ResolveCCCLineIssues(estData, bodyshop) {
//Find all misc amounts, populate them to the act price.
//TODO Ensure that this doesnt get violated
//This needs to be done before cleansing unq_seq since some misc prices could move over.
estData.joblines.data.forEach((line) => {
if (line.misc_amt && line.misc_amt > 0) {
line.act_price = line.misc_amt;
line.part_type = "PAS";
line.tax_part = line.misc_tax;
}
});
//Generate the list of duplicated UNQ_SEQ that will feed into the next section to scrub the lines.
const unqSeqHash = _.groupBy(estData.joblines.data, "unq_seq");
const duplicatedUnqSeq = Object.keys(unqSeqHash).filter(
@@ -537,14 +548,4 @@ async function ResolveCCCLineIssues(estData, bodyshop) {
db_price: null,
};
});
//Find all misc amounts, populate them to the act price.
//TODO Ensure that this doesnt get violated
estData.joblines.data.forEach((line) => {
if (line.misc_amt && line.misc_amt > 0) {
line.act_price = line.misc_amt;
line.part_type = "PAS";
line.tax_part = line.misc_tax;
}
});
}