IO-2023 Resolve hours paid as part for MPI.

This commit is contained in:
Patrick Fic
2022-08-16 16:18:50 -07:00
parent b744720efe
commit fe6e85e993
3 changed files with 41 additions and 34 deletions

View File

@@ -82,7 +82,11 @@ exports.default = function ({
state: state:
jobs_by_pk.state_tax_rate === 0 jobs_by_pk.state_tax_rate === 0
? false ? false
: jobline.db_ref === "900511" || jobline.db_ref === "900510" : jobline.db_ref === "900511" ||
jobline.db_ref === "900510" ||
(jobline.mod_lb_hrs === 0 && //Extending IO-1375 as a part of IO-2023
jobline.act_price > 0 &&
jobline.lbr_op === "OP14")
? true ? true
: jobline.tax_part, : jobline.tax_part,
}, },

View File

@@ -211,6 +211,7 @@ query QUERY_JOBS_FOR_RECEIVABLES_EXPORT($ids: [uuid!]!) {
tax_part tax_part
line_ref line_ref
unq_seq unq_seq
lbr_op
} }
} }
bodyshops(where: {associations: {active: {_eq: true}}}) { bodyshops(where: {associations: {active: {_eq: true}}}) {

View File

@@ -309,7 +309,8 @@ function GenerateCostingData(job) {
job.bodyshop.md_responsibility_centers.defaults.profits; job.bodyshop.md_responsibility_centers.defaults.profits;
const allCenters = _.union( const allCenters = _.union(
job.bodyshop.md_responsibility_centers.profits.map((p) => p.name), job.bodyshop.md_responsibility_centers.profits.map((p) => p.name),
job.bodyshop.md_responsibility_centers.costs.map((p) => p.name) job.bodyshop.md_responsibility_centers.costs.map((p) => p.name),
["Unknown"]
); );
const materialsHours = { mapaHrs: 0, mashHrs: 0 }; const materialsHours = { mapaHrs: 0, mashHrs: 0 };
@@ -331,9 +332,11 @@ function GenerateCostingData(job) {
} }
if (val.mod_lbr_ty) { if (val.mod_lbr_ty) {
const laborProfitCenter = const laborProfitCenter =
val.profitcenter_labor || defaultProfits[val.mod_lbr_ty] || "?"; val.profitcenter_labor ||
defaultProfits[val.mod_lbr_ty] ||
"Unknown";
if (laborProfitCenter === "?") if (laborProfitCenter === "Unknown")
console.log("Unknown type", val.line_desc, val.mod_lbr_ty); console.log("Unknown type", val.line_desc, val.mod_lbr_ty);
const rateName = `rate_${(val.mod_lbr_ty || "").toLowerCase()}`; const rateName = `rate_${(val.mod_lbr_ty || "").toLowerCase()}`;
@@ -374,9 +377,9 @@ function GenerateCostingData(job) {
val.part_type !== "PASL" val.part_type !== "PASL"
) { ) {
const partsProfitCenter = const partsProfitCenter =
val.profitcenter_part || defaultProfits[val.part_type] || "?"; val.profitcenter_part || defaultProfits[val.part_type] || "Unknown";
if (partsProfitCenter === "?") if (partsProfitCenter === "Unknown")
console.log("Unknown type", val.line_desc, val.part_type); console.log("Unknown type", val.line_desc, val.part_type);
if (!partsProfitCenter) if (!partsProfitCenter)
@@ -414,9 +417,9 @@ function GenerateCostingData(job) {
(val.part_type === "PAS" || val.part_type === "PASL") (val.part_type === "PAS" || val.part_type === "PASL")
) { ) {
const partsProfitCenter = const partsProfitCenter =
val.profitcenter_part || defaultProfits[val.part_type] || "?"; val.profitcenter_part || defaultProfits[val.part_type] || "Unknown";
if (partsProfitCenter === "?") if (partsProfitCenter === "Unknown")
console.log("Unknown type", val.line_desc, val.part_type); console.log("Unknown type", val.line_desc, val.part_type);
if (!partsProfitCenter) if (!partsProfitCenter)
@@ -456,11 +459,11 @@ function GenerateCostingData(job) {
const partsProfitCenter = const partsProfitCenter =
val.profitcenter_part || val.profitcenter_part ||
getAdditionalCostCenter(val, defaultProfits) || getAdditionalCostCenter(val, defaultProfits) ||
"?"; "Unknown";
if (partsProfitCenter === "?") { if (partsProfitCenter === "Unknown") {
console.log("Unknown type", val.line_desc, val.part_type); console.log("Unknown type", val.line_desc, val.part_type);
} else { }
const partsAmount = Dinero({ const partsAmount = Dinero({
amount: Math.round((val.act_price || 0) * 100), amount: Math.round((val.act_price || 0) * 100),
}) })
@@ -485,7 +488,6 @@ function GenerateCostingData(job) {
acc.additional[partsProfitCenter] = acc.additional[partsProfitCenter] =
acc.additional[partsProfitCenter].add(partsAmount); acc.additional[partsProfitCenter].add(partsAmount);
} }
}
return acc; return acc;
}, },