Merged in development (pull request #58)

Development
This commit is contained in:
Patrick Fic
2021-05-18 18:29:43 +00:00
15 changed files with 32460 additions and 9391 deletions

View File

@@ -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>

24321
client/package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@@ -75,8 +75,8 @@
"start": "craco start", "start": "craco start",
"build": "REACT_APP_GIT_SHA=`git rev-parse --short HEAD` craco build", "build": "REACT_APP_GIT_SHA=`git rev-parse --short HEAD` craco build",
"build:test": "env-cmd -f .env.test npm run build", "build:test": "env-cmd -f .env.test npm run build",
"build-deploy:test": "npm run build:test && s3cmd sync build/* s3://imex-online-test && echo '🚀 TESTING Deployed!'",
"buildcra": "REACT_APP_GIT_SHA=`git rev-parse --short HEAD` react-scripts build", "buildcra": "REACT_APP_GIT_SHA=`git rev-parse --short HEAD` react-scripts build",
"build-deploy": "REACT_APP_GIT_SHA=`git rev-parse --short HEAD` craco build && s3cmd sync build/* s3://imex-online-production && echo '🚀 Deployed!'",
"test": "craco test", "test": "craco test",
"eject": "react-scripts eject", "eject": "react-scripts eject",
"madge": "madge --image ./madge-graph.svg --extensions js,jsx,ts,tsx --circular ." "madge": "madge --image ./madge-graph.svg --extensions js,jsx,ts,tsx --circular ."

View File

@@ -1,8 +1,6 @@
import { Alert } from "antd"; import { Alert } from "antd";
import React from "react"; import React from "react";
import { logImEXEvent } from "../../firebase/firebase.utils";
export default function AlertComponent(props) { export default function AlertComponent(props) {
if (props.type === "error") logImEXEvent("alert_render", { ...props });
return <Alert {...props} />; return <Alert {...props} />;
} }

View File

@@ -66,7 +66,7 @@ export function JobsDetailLaborContainer({
timetickets={timetickets} timetickets={timetickets}
refetch={refetch} refetch={refetch}
techConsole={techConsole} techConsole={techConsole}
disabled={jobRO || !job.converted} disabled={jobRO || (job && !job.converted)}
jobId={jobId} jobId={jobId}
/> />
</Col> </Col>

View File

@@ -45,6 +45,7 @@ export const GET_LINE_TICKET_BY_PK = gql`
jobs_by_pk(id: $id) { jobs_by_pk(id: $id) {
id id
lbr_adjustments lbr_adjustments
converted
} }
joblines(where: { jobid: { _eq: $id }, removed: { _eq: false } }) { joblines(where: { jobid: { _eq: $id }, removed: { _eq: false } }) {
id id

View File

@@ -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} />

View File

@@ -1720,6 +1720,7 @@
"invoice_total_payable": "Invoice (Total Payable)", "invoice_total_payable": "Invoice (Total Payable)",
"job_costing_ro": "Job Costing", "job_costing_ro": "Job Costing",
"job_notes": "Job Notes", "job_notes": "Job Notes",
"parts_label_single": "Parts Label - Single",
"parts_list": "Parts List", "parts_list": "Parts List",
"parts_order": "Parts Order Confirmation", "parts_order": "Parts Order Confirmation",
"parts_order_confirmation": "", "parts_order_confirmation": "",
@@ -1848,9 +1849,9 @@
"hours_sold_summary_closed_source": "Hours Sold Summary - Closed by Source", "hours_sold_summary_closed_source": "Hours Sold Summary - Closed by Source",
"hours_sold_summary_open": "Hours Sold Summary - Open", "hours_sold_summary_open": "Hours Sold Summary - Open",
"hours_sold_summary_open_source": "Hours Sold Summary - Open by Source", "hours_sold_summary_open_source": "Hours Sold Summary - Open by Source",
"job_costing_ro_estimator": "Job Costing by Estimator",
"job_costing_ro_date_detail": "Job Costing by RO - Detail", "job_costing_ro_date_detail": "Job Costing by RO - Detail",
"job_costing_ro_date_summary": "Job Costing by RO - Summary", "job_costing_ro_date_summary": "Job Costing by RO - Summary",
"job_costing_ro_estimator": "Job Costing by Estimator",
"job_costing_ro_source": "Job Costing by RO Source", "job_costing_ro_source": "Job Costing by RO Source",
"open_orders": "Open Orders by Date", "open_orders": "Open Orders by Date",
"payments_by_date_type": "Payments by Date Range", "payments_by_date_type": "Payments by Date Range",

View File

@@ -1720,6 +1720,7 @@
"invoice_total_payable": "", "invoice_total_payable": "",
"job_costing_ro": "", "job_costing_ro": "",
"job_notes": "", "job_notes": "",
"parts_label_single": "",
"parts_list": "", "parts_list": "",
"parts_order": "", "parts_order": "",
"parts_order_confirmation": "", "parts_order_confirmation": "",
@@ -1848,9 +1849,9 @@
"hours_sold_summary_closed_source": "", "hours_sold_summary_closed_source": "",
"hours_sold_summary_open": "", "hours_sold_summary_open": "",
"hours_sold_summary_open_source": "", "hours_sold_summary_open_source": "",
"job_costing_ro_estimator": "",
"job_costing_ro_date_detail": "", "job_costing_ro_date_detail": "",
"job_costing_ro_date_summary": "", "job_costing_ro_date_summary": "",
"job_costing_ro_estimator": "",
"job_costing_ro_source": "", "job_costing_ro_source": "",
"open_orders": "", "open_orders": "",
"payments_by_date_type": "", "payments_by_date_type": "",

View File

@@ -1720,6 +1720,7 @@
"invoice_total_payable": "", "invoice_total_payable": "",
"job_costing_ro": "", "job_costing_ro": "",
"job_notes": "", "job_notes": "",
"parts_label_single": "",
"parts_list": "", "parts_list": "",
"parts_order": "", "parts_order": "",
"parts_order_confirmation": "", "parts_order_confirmation": "",
@@ -1848,9 +1849,9 @@
"hours_sold_summary_closed_source": "", "hours_sold_summary_closed_source": "",
"hours_sold_summary_open": "", "hours_sold_summary_open": "",
"hours_sold_summary_open_source": "", "hours_sold_summary_open_source": "",
"job_costing_ro_estimator": "",
"job_costing_ro_date_detail": "", "job_costing_ro_date_detail": "",
"job_costing_ro_date_summary": "", "job_costing_ro_date_summary": "",
"job_costing_ro_estimator": "",
"job_costing_ro_source": "", "job_costing_ro_source": "",
"open_orders": "", "open_orders": "",
"payments_by_date_type": "", "payments_by_date_type": "",

View File

@@ -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"

File diff suppressed because it is too large Load Diff

View File

@@ -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;
}; };

View File

@@ -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}}}) {

View File

@@ -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.
} }
} }
}); });
@@ -274,7 +274,9 @@ function IsAdditionalCost(jobLine) {
jobLine.db_ref === "936008" || jobLine.db_ref === "936007"; jobLine.db_ref === "936008" || jobLine.db_ref === "936007";
return ( return (
!jobLine.db_ref || (jobLine.db_ref.startsWith("9360") && !isPaintOrShopMat) (jobLine.lbr_op === "OP13" || //Added to resolve manual job lines coming into other totals because they have no reference.
(jobLine.db_ref && jobLine.db_ref.startsWith("9360"))) &&
!isPaintOrShopMat
); );
} }