Add massaging of data to CCC import.
This commit is contained in:
@@ -10,4 +10,5 @@ REACT_APP_FIREBASE_PUBLIC_VAPID_KEY='BG3tzU7L2BXlGZ_3VLK4PNaRceoEXEnmHfxcVbRMF5o
|
||||
REACT_APP_STRIPE_PUBLIC_KEY=pk_test_51GqB4TJl3nQjrZ0wCQWAxAhlNF8jKe0tipIa6ExBaxwJGitwvFsIZUEua4dUzaMIAuXp4qwYHXx7lgjyQSwP0Pe900vzm38C7g
|
||||
REACT_APP_AXIOS_BASE_API_URL=https://api.imex.online/
|
||||
REACT_APP_REPORTS_SERVER_URL=https://reports3.test.imex.online
|
||||
REACT_APP_SPLIT_API=ts615lqgnmk84thn72uk18uu5pgce6e0l4rc
|
||||
REACT_APP_SPLIT_API=ts615lqgnmk84thn72uk18uu5pgce6e0l4rc
|
||||
REACT_APP_COUNTRY=USA
|
||||
@@ -27,7 +27,7 @@ module.exports = {
|
||||
lessOptions: {
|
||||
modifyVars: {
|
||||
...(process.env.NODE_ENV === "development"
|
||||
? { "@primary-color": "#a51d1d" }
|
||||
? { "@primary-color": "#B22234" }
|
||||
: {
|
||||
//"@primary-color": "#1DA57A"
|
||||
}),
|
||||
|
||||
@@ -39,6 +39,7 @@ import OwnerFindModalContainer from "../owner-find-modal/owner-find-modal.contai
|
||||
import { GetSupplementDelta } from "./jobs-available-supplement.estlines.util";
|
||||
import HeaderFields from "./jobs-available-supplement.headerfields";
|
||||
import JobsAvailableTableComponent from "./jobs-available-table.component";
|
||||
import _ from "lodash";
|
||||
|
||||
const mapStateToProps = createStructuredSelector({
|
||||
bodyshop: selectBodyshop,
|
||||
@@ -99,9 +100,13 @@ export function JobsAvailableContainer({
|
||||
});
|
||||
return;
|
||||
}
|
||||
// if (process.env.REACT_APP_COUNTRY === "USA") {
|
||||
//Massage the CCC file set to remove duplicate UNQ_SEQ.
|
||||
await ResolveCCCLineIssues(estData.est_data, bodyshop);
|
||||
// } else {
|
||||
//IO-539 Check for Parts Rate on PAL for SGI use case.
|
||||
await CheckTaxRates(estData.est_data, bodyshop);
|
||||
|
||||
// }
|
||||
const newTotals = (
|
||||
await Axios.post("/job/totals", {
|
||||
job: {
|
||||
@@ -509,3 +514,37 @@ async function CheckTaxRates(estData, bodyshop) {
|
||||
});
|
||||
//}
|
||||
}
|
||||
|
||||
async function ResolveCCCLineIssues(estData, bodyshop) {
|
||||
//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(
|
||||
(key) => unqSeqHash[key].length > 1
|
||||
);
|
||||
|
||||
duplicatedUnqSeq.forEach((unq_seq) => {
|
||||
//Keys are strings, convert to int.
|
||||
const int_unq_seq = parseInt(unq_seq);
|
||||
|
||||
//When line splitting, the first line is always the non-refinish line. We will keep it as is.
|
||||
//We will cleanse the second line, which is always the next line.
|
||||
const nonRefLineIndex = estData.joblines.data.findIndex(
|
||||
(line) => line.unq_seq === int_unq_seq
|
||||
);
|
||||
estData.joblines.data[nonRefLineIndex + 1] = {
|
||||
...estData.joblines.data[nonRefLineIndex + 1],
|
||||
act_price: null,
|
||||
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;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -2305,18 +2305,6 @@
|
||||
shallowequal "^1.1.0"
|
||||
unfetch "^4.2.0"
|
||||
|
||||
"@stripe/react-stripe-js@^1.9.0":
|
||||
version "1.9.0"
|
||||
resolved "https://registry.yarnpkg.com/@stripe/react-stripe-js/-/react-stripe-js-1.9.0.tgz#74809a274d7db110c3daf6f68ca4d62c6e6559c7"
|
||||
integrity sha512-Fn49X+Gu5fOTxhPOita1cPMi0jw+0v4xfJ3FCXbbvmfuuDl3M7ZvpRkoijBjql11NXsaXO3TMm3rkN3mEolJzw==
|
||||
dependencies:
|
||||
prop-types "^15.7.2"
|
||||
|
||||
"@stripe/stripe-js@^1.32.0":
|
||||
version "1.32.0"
|
||||
resolved "https://registry.yarnpkg.com/@stripe/stripe-js/-/stripe-js-1.32.0.tgz#4ecdd298db61ad9b240622eafed58da974bd210e"
|
||||
integrity sha512-7EvBnbBfS1aynfLRmBFcuumHNGjKxnNkO47rorFBktqDYHwo7Yw6pfDW2iqq0R8r7i7XiJEdWPvvEgQAiDrx3A==
|
||||
|
||||
"@surma/rollup-plugin-off-main-thread@^1.1.1":
|
||||
version "1.4.2"
|
||||
resolved "https://registry.yarnpkg.com/@surma/rollup-plugin-off-main-thread/-/rollup-plugin-off-main-thread-1.4.2.tgz#e6786b6af5799f82f7ab3a82e53f6182d2b91a58"
|
||||
|
||||
@@ -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),
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user