IO-3515 add client side polling for now, cost centers.
This commit is contained in:
@@ -162,6 +162,9 @@ async function generateBillFormData({ processedData, jobid, bodyshopid, partsord
|
||||
bodyshop{
|
||||
id
|
||||
md_responsibility_centers
|
||||
cdk_dealerid
|
||||
pbs_serialnumber
|
||||
rr_dealerid
|
||||
}
|
||||
joblines {
|
||||
id
|
||||
@@ -171,6 +174,7 @@ async function generateBillFormData({ processedData, jobid, bodyshopid, partsord
|
||||
db_price
|
||||
oem_partno
|
||||
alt_partno
|
||||
part_type
|
||||
}
|
||||
}
|
||||
parts_orders_by_pk(id: $partsorderid) {
|
||||
@@ -186,6 +190,7 @@ async function generateBillFormData({ processedData, jobid, bodyshopid, partsord
|
||||
act_price
|
||||
oem_partno
|
||||
alt_partno
|
||||
part_type
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -325,13 +330,21 @@ async function generateBillFormData({ processedData, jobid, bodyshopid, partsord
|
||||
}
|
||||
}
|
||||
|
||||
const responsibilityCenters = job.bodyshop.md_responsibility_centers
|
||||
//TODO: Do we need to verify the lines to see if it is a unit price or total price (i.e. quantity * price)
|
||||
const lineObject = {
|
||||
"line_desc": matchToUse?.item?.line_desc || textractLineItem.ITEM?.value || "NO DESCRIPTION",
|
||||
"quantity": textractLineItem.QUANTITY?.value, // convert to integer?
|
||||
"actual_price": normalizePrice(actualPrice),
|
||||
"actual_cost": normalizePrice(actualCost),
|
||||
"cost_center": "SETBYCLIENT", //Needs to get set by client side.
|
||||
"cost_center": matchToUse?.item?.part_type
|
||||
? bodyshopHasDmsKey(job.bodyshop)
|
||||
? matchToUse?.item?.part_type !== "PAE"
|
||||
? matchToUse?.item?.part_type
|
||||
: null
|
||||
: responsibilityCenters.defaults &&
|
||||
(responsibilityCenters.defaults.costs[matchToUse?.item?.part_type] || null)
|
||||
: null, //Needs to get set by client side.
|
||||
"applicable_taxes": { //Not sure what to do with these?
|
||||
"federal": false,
|
||||
"state": false,
|
||||
@@ -579,6 +592,10 @@ function joblineFuzzySearch({ fuseToSearch, processedData }) {
|
||||
return matches
|
||||
}
|
||||
|
||||
const bodyshopHasDmsKey = (bodyshop) =>
|
||||
bodyshop.cdk_dealerid || bodyshop.pbs_serialnumber || bodyshop.rr_dealerid;
|
||||
|
||||
|
||||
module.exports = {
|
||||
generateBillFormData
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user