Refactored job closing to be line based instead of totals based. BOD-383
This commit is contained in:
@@ -149,3 +149,30 @@ export const GET_JOB_LINES_TO_ENTER_INVOICE = gql`
|
||||
// act_price: {
|
||||
// _gt: "0";
|
||||
// }
|
||||
|
||||
export const generateJobLinesUpdatesForInvoicing = (joblines) => {
|
||||
console.log("generateJobLinesUpdatesForInvoicing -> joblines", joblines);
|
||||
const updates = joblines.reduce((acc, jl, idx) => {
|
||||
return (
|
||||
acc +
|
||||
`a${idx}:update_joblines(where: {id: {_eq: "${
|
||||
jl.id
|
||||
}"}}, _set: {profitcenter_labor: "${
|
||||
jl.profitcenter_labor || ""
|
||||
}", profitcenter_part: "${jl.profitcenter_part || ""}"}) {
|
||||
returning {
|
||||
line_desc
|
||||
profitcenter_part
|
||||
profitcenter_labor
|
||||
id
|
||||
}
|
||||
}`
|
||||
);
|
||||
}, "");
|
||||
|
||||
return gql`
|
||||
mutation UPDATE_JOBLINES_FOR_INVOICING{
|
||||
${updates}
|
||||
}
|
||||
`;
|
||||
};
|
||||
|
||||
@@ -1062,20 +1062,8 @@ export const QUERY_JOB_CLOSE_DETAILS = gql`
|
||||
query QUERY_JOB_CLOSE_DETAILS($id: uuid!) {
|
||||
jobs_by_pk(id: $id) {
|
||||
ro_number
|
||||
clm_total
|
||||
inproduction
|
||||
plate_no
|
||||
v_vin
|
||||
v_model_yr
|
||||
v_model_desc
|
||||
v_make_desc
|
||||
v_color
|
||||
invoice_allocation
|
||||
ins_co_id
|
||||
policy_no
|
||||
clm_no
|
||||
ins_co_nm
|
||||
regie_number
|
||||
id
|
||||
ded_amt
|
||||
ded_status
|
||||
@@ -1096,16 +1084,6 @@ export const QUERY_JOB_CLOSE_DETAILS = gql`
|
||||
tax_levies_rt
|
||||
parts_tax_rates
|
||||
job_totals
|
||||
ownr_fn
|
||||
ownr_ln
|
||||
ownr_ea
|
||||
ownr_addr1
|
||||
ownr_addr2
|
||||
ownr_city
|
||||
ownr_st
|
||||
ownr_zip
|
||||
ownr_ctry
|
||||
ownr_ph1
|
||||
rate_la1
|
||||
rate_la2
|
||||
rate_la3
|
||||
@@ -1130,10 +1108,10 @@ export const QUERY_JOB_CLOSE_DETAILS = gql`
|
||||
rate_mash
|
||||
rate_matd
|
||||
status
|
||||
owner_owing
|
||||
date_exported
|
||||
joblines {
|
||||
id
|
||||
removed
|
||||
tax_part
|
||||
line_desc
|
||||
prt_dsmk_p
|
||||
@@ -1149,6 +1127,8 @@ export const QUERY_JOB_CLOSE_DETAILS = gql`
|
||||
lbr_op
|
||||
lbr_amt
|
||||
op_code_desc
|
||||
profitcenter_labor
|
||||
profitcenter_part
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user