feature/IO-3255-simplified-parts-management - Checkpoint
This commit is contained in:
@@ -94,6 +94,7 @@ const partsManagementVehicleDamageEstimateAddRq = async (req, res) => {
|
|||||||
|
|
||||||
// ── PARTS TAX RATES STRUCTURE ───────────────────────────────────────────────
|
// ── PARTS TAX RATES STRUCTURE ───────────────────────────────────────────────
|
||||||
// Known rate types that map to your parts_tax_rates keys
|
// Known rate types that map to your parts_tax_rates keys
|
||||||
|
// If this has become an issue, default it to an empty object for version 1
|
||||||
const knownPartRateTypes = [
|
const knownPartRateTypes = [
|
||||||
"PAA",
|
"PAA",
|
||||||
"PAC",
|
"PAC",
|
||||||
@@ -269,27 +270,41 @@ const partsManagementVehicleDamageEstimateAddRq = async (req, res) => {
|
|||||||
|
|
||||||
// ── DAMAGE LINES → joblinesData ────────────────────────────────────────────
|
// ── DAMAGE LINES → joblinesData ────────────────────────────────────────────
|
||||||
const damageLines = Array.isArray(rq.DamageLineInfo) ? rq.DamageLineInfo : [rq.DamageLineInfo];
|
const damageLines = Array.isArray(rq.DamageLineInfo) ? rq.DamageLineInfo : [rq.DamageLineInfo];
|
||||||
const joblinesData = damageLines.map((line) => ({
|
const joblinesData = damageLines.map((line) => {
|
||||||
line_no: parseInt(line.LineNum, 10),
|
const jobLine = {
|
||||||
unq_seq: parseInt(line.UniqueSequenceNum, 10),
|
line_no: parseInt(line.LineNum, 10),
|
||||||
status: line.LineStatusCode || null,
|
unq_seq: parseInt(line.UniqueSequenceNum, 10),
|
||||||
line_desc: line.LineDesc || null,
|
status: line.LineStatusCode || null,
|
||||||
|
line_desc: line.LineDesc || null,
|
||||||
|
|
||||||
// parts
|
// parts
|
||||||
part_type: line.PartInfo?.PartType || null,
|
part_type: line.PartInfo?.PartType || null,
|
||||||
part_qty: parseFloat(line.PartInfo?.Quantity || 0),
|
part_qty: parseFloat(line.PartInfo?.Quantity || 0),
|
||||||
oem_partno: line.PartInfo?.OEMPartNum || null,
|
oem_partno: line.PartInfo?.OEMPartNum || null,
|
||||||
db_price: parseFloat(line.PartInfo?.PartPrice || 0),
|
db_price: parseFloat(line.PartInfo?.PartPrice || 0),
|
||||||
act_price: parseFloat(line.PartInfo?.PartPrice || 0),
|
act_price: parseFloat(line.PartInfo?.PartPrice || 0),
|
||||||
|
|
||||||
// labor
|
// labor
|
||||||
mod_lbr_ty: line.LaborInfo?.LaborType || null,
|
mod_lbr_ty: line.LaborInfo?.LaborType || null,
|
||||||
mod_lb_hrs: parseFloat(line.LaborInfo?.LaborHours || 0),
|
mod_lb_hrs: parseFloat(line.LaborInfo?.LaborHours || 0),
|
||||||
lbr_op: line.LaborInfo?.LaborOperation || null,
|
lbr_op: line.LaborInfo?.LaborOperation || null,
|
||||||
lbr_amt: parseFloat(line.LaborInfo?.LaborAmt || 0),
|
lbr_amt: parseFloat(line.LaborInfo?.LaborAmt || 0),
|
||||||
|
|
||||||
notes: line.LineMemo || null
|
notes: line.LineMemo || null
|
||||||
}));
|
};
|
||||||
|
|
||||||
|
// TODO: Commented out as not clear if needed for version 1, this only applies to Imex and not rome on the front
|
||||||
|
// end
|
||||||
|
|
||||||
|
// if ((jobLine.part_type === "PASL" || jobLine.part_type === "PAS") && jobLine.lbr_op !== "OP11") {
|
||||||
|
// jobLine.tax_part = true;
|
||||||
|
// }
|
||||||
|
// if (line.db_ref === "900510") {
|
||||||
|
// jobLine.tax_part = true;
|
||||||
|
// }
|
||||||
|
|
||||||
|
return jobLine;
|
||||||
|
});
|
||||||
|
|
||||||
const ownerInput = {
|
const ownerInput = {
|
||||||
shopid: shopId,
|
shopid: shopId,
|
||||||
@@ -308,6 +323,7 @@ const partsManagementVehicleDamageEstimateAddRq = async (req, res) => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
let ownerid = null;
|
let ownerid = null;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const { insert_owners_one } = await client.request(INSERT_OWNER, { owner: ownerInput });
|
const { insert_owners_one } = await client.request(INSERT_OWNER, { owner: ownerInput });
|
||||||
ownerid = insert_owners_one?.id;
|
ownerid = insert_owners_one?.id;
|
||||||
|
|||||||
Reference in New Issue
Block a user