IO-1125 Add Mapa & Mash for jobs that don't have it.
This commit is contained in:
@@ -1,4 +1,4 @@
|
|||||||
<babeledit_project version="1.2" be_version="2.7.1">
|
<babeledit_project be_version="2.7.1" version="1.2">
|
||||||
<!--
|
<!--
|
||||||
|
|
||||||
BabelEdit project file
|
BabelEdit project file
|
||||||
@@ -28739,6 +28739,27 @@
|
|||||||
</translation>
|
</translation>
|
||||||
</translations>
|
</translations>
|
||||||
</concept_node>
|
</concept_node>
|
||||||
|
<concept_node>
|
||||||
|
<name>parts_label_single</name>
|
||||||
|
<definition_loaded>false</definition_loaded>
|
||||||
|
<description></description>
|
||||||
|
<comment></comment>
|
||||||
|
<default_text></default_text>
|
||||||
|
<translations>
|
||||||
|
<translation>
|
||||||
|
<language>en-US</language>
|
||||||
|
<approved>false</approved>
|
||||||
|
</translation>
|
||||||
|
<translation>
|
||||||
|
<language>es-MX</language>
|
||||||
|
<approved>false</approved>
|
||||||
|
</translation>
|
||||||
|
<translation>
|
||||||
|
<language>fr-CA</language>
|
||||||
|
<approved>false</approved>
|
||||||
|
</translation>
|
||||||
|
</translations>
|
||||||
|
</concept_node>
|
||||||
<concept_node>
|
<concept_node>
|
||||||
<name>parts_list</name>
|
<name>parts_list</name>
|
||||||
<definition_loaded>false</definition_loaded>
|
<definition_loaded>false</definition_loaded>
|
||||||
@@ -30798,27 +30819,6 @@
|
|||||||
</translation>
|
</translation>
|
||||||
</translations>
|
</translations>
|
||||||
</concept_node>
|
</concept_node>
|
||||||
<concept_node>
|
|
||||||
<name>job_costing_ro_estimator</name>
|
|
||||||
<definition_loaded>false</definition_loaded>
|
|
||||||
<description></description>
|
|
||||||
<comment></comment>
|
|
||||||
<default_text></default_text>
|
|
||||||
<translations>
|
|
||||||
<translation>
|
|
||||||
<language>en-US</language>
|
|
||||||
<approved>false</approved>
|
|
||||||
</translation>
|
|
||||||
<translation>
|
|
||||||
<language>es-MX</language>
|
|
||||||
<approved>false</approved>
|
|
||||||
</translation>
|
|
||||||
<translation>
|
|
||||||
<language>fr-CA</language>
|
|
||||||
<approved>false</approved>
|
|
||||||
</translation>
|
|
||||||
</translations>
|
|
||||||
</concept_node>
|
|
||||||
<concept_node>
|
<concept_node>
|
||||||
<name>job_costing_ro_date_detail</name>
|
<name>job_costing_ro_date_detail</name>
|
||||||
<definition_loaded>false</definition_loaded>
|
<definition_loaded>false</definition_loaded>
|
||||||
@@ -30861,6 +30861,27 @@
|
|||||||
</translation>
|
</translation>
|
||||||
</translations>
|
</translations>
|
||||||
</concept_node>
|
</concept_node>
|
||||||
|
<concept_node>
|
||||||
|
<name>job_costing_ro_estimator</name>
|
||||||
|
<definition_loaded>false</definition_loaded>
|
||||||
|
<description></description>
|
||||||
|
<comment></comment>
|
||||||
|
<default_text></default_text>
|
||||||
|
<translations>
|
||||||
|
<translation>
|
||||||
|
<language>en-US</language>
|
||||||
|
<approved>false</approved>
|
||||||
|
</translation>
|
||||||
|
<translation>
|
||||||
|
<language>es-MX</language>
|
||||||
|
<approved>false</approved>
|
||||||
|
</translation>
|
||||||
|
<translation>
|
||||||
|
<language>fr-CA</language>
|
||||||
|
<approved>false</approved>
|
||||||
|
</translation>
|
||||||
|
</translations>
|
||||||
|
</concept_node>
|
||||||
<concept_node>
|
<concept_node>
|
||||||
<name>job_costing_ro_source</name>
|
<name>job_costing_ro_source</name>
|
||||||
<definition_loaded>false</definition_loaded>
|
<definition_loaded>false</definition_loaded>
|
||||||
|
|||||||
@@ -92,16 +92,6 @@ export function JobsCloseComponent({ job, bodyshop, jobRO }) {
|
|||||||
disabled={!!job.date_exported || jobRO}
|
disabled={!!job.date_exported || jobRO}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
{
|
|
||||||
// <Button
|
|
||||||
// loading={loading}
|
|
||||||
// onClick={() => form.submit()}
|
|
||||||
// disabled={jobRO}
|
|
||||||
// >
|
|
||||||
// {t("general.actions.save")}
|
|
||||||
// </Button>
|
|
||||||
}
|
|
||||||
|
|
||||||
<Popconfirm
|
<Popconfirm
|
||||||
onConfirm={() => form.submit()}
|
onConfirm={() => form.submit()}
|
||||||
disabled={jobRO}
|
disabled={jobRO}
|
||||||
@@ -115,9 +105,6 @@ export function JobsCloseComponent({ job, bodyshop, jobRO }) {
|
|||||||
</Popconfirm>
|
</Popconfirm>
|
||||||
|
|
||||||
<JobsScoreboardAdd job={job} disabled={false} />
|
<JobsScoreboardAdd job={job} disabled={false} />
|
||||||
{
|
|
||||||
// <JobsCloseExportButton jobId={job.id} disabled={job.date_exported} />
|
|
||||||
}
|
|
||||||
</Space>
|
</Space>
|
||||||
<FormsFieldChanged form={form} />
|
<FormsFieldChanged form={form} />
|
||||||
<JobsCloseLines job={job} />
|
<JobsCloseLines job={job} />
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -296,6 +296,14 @@ export const TemplateList = (type, context) => {
|
|||||||
disabled: false,
|
disabled: false,
|
||||||
group: "post",
|
group: "post",
|
||||||
},
|
},
|
||||||
|
parts_label_single: {
|
||||||
|
title: i18n.t("printcenter.jobs.parts_label_single"),
|
||||||
|
description: "Thank You Letter by RO",
|
||||||
|
key: "parts_label_single",
|
||||||
|
subject: i18n.t("printcenter.jobs.parts_label_single"),
|
||||||
|
disabled: false,
|
||||||
|
group: "post",
|
||||||
|
},
|
||||||
}
|
}
|
||||||
: {}),
|
: {}),
|
||||||
...(!type || type === "job_special"
|
...(!type || type === "job_special"
|
||||||
|
|||||||
@@ -177,7 +177,7 @@ const generateJobQbxml = (
|
|||||||
.end({ pretty: true });
|
.end({ pretty: true });
|
||||||
|
|
||||||
const jobQbxml_Full = QbXmlUtils.addQbxmlHeader(jobQbxml_partial);
|
const jobQbxml_Full = QbXmlUtils.addQbxmlHeader(jobQbxml_partial);
|
||||||
console.log("jobQbxml_Full", jobQbxml_Full);
|
|
||||||
return jobQbxml_Full;
|
return jobQbxml_Full;
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -192,10 +192,23 @@ const generateInvoiceQbxml = (
|
|||||||
const InvoiceLineAdd = [];
|
const InvoiceLineAdd = [];
|
||||||
const responsibilityCenters = bodyshop.md_responsibility_centers;
|
const responsibilityCenters = bodyshop.md_responsibility_centers;
|
||||||
|
|
||||||
const invoiceLineHash = {};
|
const invoiceLineHash = {}; //The hash of cost and profit centers based on the center name.
|
||||||
|
|
||||||
|
//Determine if there are MAPA and MASH lines already on the estimate.
|
||||||
|
//If there are, don't do anything extra (mitchell estimate)
|
||||||
|
//Otherwise, calculate them and add them to the default MAPA and MASH centers.
|
||||||
|
let hasMapaLine = false;
|
||||||
|
let hasMashLine = false;
|
||||||
|
|
||||||
//Create the invoice lines mapping.
|
//Create the invoice lines mapping.
|
||||||
jobs_by_pk.joblines.map((jobline) => {
|
jobs_by_pk.joblines.map((jobline) => {
|
||||||
//Parts Lines
|
//Parts Lines
|
||||||
|
if (jobline.db_ref === "936008") { //If either of these DB REFs change, they also need to change in job-totals calculations.
|
||||||
|
hasMapaLine = true;
|
||||||
|
}
|
||||||
|
if (jobline.db_ref === "936007") {
|
||||||
|
hasMashLine = true;
|
||||||
|
}
|
||||||
|
|
||||||
if (jobline.profitcenter_part && jobline.act_price) {
|
if (jobline.profitcenter_part && jobline.act_price) {
|
||||||
const DineroAmount = Dinero({
|
const DineroAmount = Dinero({
|
||||||
@@ -216,18 +229,15 @@ const generateInvoiceQbxml = (
|
|||||||
Desc: account.accountdesc,
|
Desc: account.accountdesc,
|
||||||
Quantity: 1, //jobline.part_qty,
|
Quantity: 1, //jobline.part_qty,
|
||||||
Amount: DineroAmount, //.toFormat(DineroQbFormat),
|
Amount: DineroAmount, //.toFormat(DineroQbFormat),
|
||||||
//Amount: DineroAmount.toFormat(DineroQbFormat),
|
|
||||||
SalesTaxCodeRef: {
|
SalesTaxCodeRef: {
|
||||||
FullName: "E",
|
FullName: "E",
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
} else {
|
} else {
|
||||||
invoiceLineHash[account.name].Amount = invoiceLineHash[
|
invoiceLineHash[account.name].Amount =
|
||||||
account.name
|
invoiceLineHash[account.name].Amount.add(DineroAmount);
|
||||||
].Amount.add(DineroAmount);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Labor Lines
|
// Labor Lines
|
||||||
if (
|
if (
|
||||||
jobline.profitcenter_labor &&
|
jobline.profitcenter_labor &&
|
||||||
@@ -260,14 +270,64 @@ const generateInvoiceQbxml = (
|
|||||||
},
|
},
|
||||||
};
|
};
|
||||||
} else {
|
} else {
|
||||||
invoiceLineHash[account.name].Amount = invoiceLineHash[
|
invoiceLineHash[account.name].Amount =
|
||||||
account.name
|
invoiceLineHash[account.name].Amount.add(DineroAmount);
|
||||||
].Amount.add(DineroAmount);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
// console.log("Done creating hash", JSON.stringify(invoiceLineHash));
|
// console.log("Done creating hash", JSON.stringify(invoiceLineHash));
|
||||||
|
|
||||||
|
if (!hasMapaLine) {
|
||||||
|
console.log("Adding MAPA Line Manually.");
|
||||||
|
const mapaAccountName = responsibilityCenters.defaults.profits.MAPA;
|
||||||
|
|
||||||
|
const mapaAccount = responsibilityCenters.profits.find(
|
||||||
|
(c) => c.name === mapaAccountName
|
||||||
|
);
|
||||||
|
|
||||||
|
if (mapaAccount) {
|
||||||
|
InvoiceLineAdd.push({
|
||||||
|
ItemRef: { FullName: mapaAccount.accountitem },
|
||||||
|
Desc: mapaAccount.accountdesc,
|
||||||
|
Quantity: 1,
|
||||||
|
Amount: Dinero(jobs_by_pk.job_totals.rates.mapa.total).toFormat(
|
||||||
|
DineroQbFormat
|
||||||
|
),
|
||||||
|
SalesTaxCodeRef: {
|
||||||
|
FullName: "E",
|
||||||
|
},
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
console.log("NO MAPA ACCOUNT FOUND!!");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!hasMashLine) {
|
||||||
|
console.log("Adding MASH Line Manually.");
|
||||||
|
|
||||||
|
const mashAccountName = responsibilityCenters.defaults.profits.MASH;
|
||||||
|
|
||||||
|
const mashAccount = responsibilityCenters.profits.find(
|
||||||
|
(c) => c.name === mashAccountName
|
||||||
|
);
|
||||||
|
|
||||||
|
if (mashAccount) {
|
||||||
|
InvoiceLineAdd.push({
|
||||||
|
ItemRef: { FullName: mashAccount.accountitem },
|
||||||
|
Desc: mashAccount.accountdesc,
|
||||||
|
Quantity: 1,
|
||||||
|
Amount: Dinero(jobs_by_pk.job_totals.rates.mash.total).toFormat(
|
||||||
|
DineroQbFormat
|
||||||
|
),
|
||||||
|
SalesTaxCodeRef: {
|
||||||
|
FullName: "E",
|
||||||
|
},
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
console.log("NO MASH ACCOUNT FOUND!!");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//Convert the hash to an array.
|
//Convert the hash to an array.
|
||||||
Object.keys(invoiceLineHash).forEach((key) => {
|
Object.keys(invoiceLineHash).forEach((key) => {
|
||||||
InvoiceLineAdd.push({
|
InvoiceLineAdd.push({
|
||||||
@@ -370,7 +430,6 @@ const generateInvoiceQbxml = (
|
|||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
console.log(JSON.stringify(invoiceQbxmlObj, null, 2));
|
|
||||||
var invoiceQbxml_partial = builder
|
var invoiceQbxml_partial = builder
|
||||||
.create(invoiceQbxmlObj, {
|
.create(invoiceQbxmlObj, {
|
||||||
version: "1.30",
|
version: "1.30",
|
||||||
@@ -380,7 +439,6 @@ const generateInvoiceQbxml = (
|
|||||||
.end({ pretty: true });
|
.end({ pretty: true });
|
||||||
|
|
||||||
const invoiceQbxml_Full = QbXmlUtils.addQbxmlHeader(invoiceQbxml_partial);
|
const invoiceQbxml_Full = QbXmlUtils.addQbxmlHeader(invoiceQbxml_partial);
|
||||||
console.log("invoiceQbxml_Full", invoiceQbxml_Full);
|
|
||||||
|
|
||||||
return invoiceQbxml_Full;
|
return invoiceQbxml_Full;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -100,6 +100,7 @@ query QUERY_JOBS_FOR_RECEIVABLES_EXPORT($ids: [uuid!]!) {
|
|||||||
op_code_desc
|
op_code_desc
|
||||||
profitcenter_labor
|
profitcenter_labor
|
||||||
profitcenter_part
|
profitcenter_part
|
||||||
|
db_ref
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
bodyshops(where: {associations: {active: {_eq: true}}}) {
|
bodyshops(where: {associations: {active: {_eq: true}}}) {
|
||||||
|
|||||||
@@ -165,7 +165,7 @@ function CalculateRatesTotals(ratesList) {
|
|||||||
if (item.mod_lbr_ty === "LAR") {
|
if (item.mod_lbr_ty === "LAR") {
|
||||||
ret.mapa.hours = ret.mapa.hours + item.mod_lb_hrs;
|
ret.mapa.hours = ret.mapa.hours + item.mod_lb_hrs;
|
||||||
} else {
|
} else {
|
||||||
ret.mash.hours = ret.mash.hours + item.mod_lb_hrs;
|
ret.mash.hours = ret.mash.hours + item.mod_lb_hrs; //Apparently there may be an exclusion for glass hours in BC.
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user