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
@@ -28739,6 +28739,27 @@
</translation>
</translations>
</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>
<name>parts_list</name>
<definition_loaded>false</definition_loaded>
@@ -30798,27 +30819,6 @@
</translation>
</translations>
</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>
<name>job_costing_ro_date_detail</name>
<definition_loaded>false</definition_loaded>
@@ -30861,6 +30861,27 @@
</translation>
</translations>
</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>
<name>job_costing_ro_source</name>
<definition_loaded>false</definition_loaded>

24409
client/package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@@ -75,8 +75,8 @@
"start": "craco start",
"build": "REACT_APP_GIT_SHA=`git rev-parse --short HEAD` craco 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",
"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",
"eject": "react-scripts eject",
"madge": "madge --image ./madge-graph.svg --extensions js,jsx,ts,tsx --circular ."

View File

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

View File

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

View File

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

View File

@@ -92,16 +92,6 @@ export function JobsCloseComponent({ job, bodyshop, jobRO }) {
disabled={!!job.date_exported || jobRO}
/>
{
// <Button
// loading={loading}
// onClick={() => form.submit()}
// disabled={jobRO}
// >
// {t("general.actions.save")}
// </Button>
}
<Popconfirm
onConfirm={() => form.submit()}
disabled={jobRO}
@@ -115,9 +105,6 @@ export function JobsCloseComponent({ job, bodyshop, jobRO }) {
</Popconfirm>
<JobsScoreboardAdd job={job} disabled={false} />
{
// <JobsCloseExportButton jobId={job.id} disabled={job.date_exported} />
}
</Space>
<FormsFieldChanged form={form} />
<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

View File

@@ -296,6 +296,14 @@ export const TemplateList = (type, context) => {
disabled: false,
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"

File diff suppressed because it is too large Load Diff

View File

@@ -177,7 +177,7 @@ const generateJobQbxml = (
.end({ pretty: true });
const jobQbxml_Full = QbXmlUtils.addQbxmlHeader(jobQbxml_partial);
console.log("jobQbxml_Full", jobQbxml_Full);
return jobQbxml_Full;
};
@@ -192,10 +192,23 @@ const generateInvoiceQbxml = (
const InvoiceLineAdd = [];
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.
jobs_by_pk.joblines.map((jobline) => {
//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) {
const DineroAmount = Dinero({
@@ -216,18 +229,15 @@ const generateInvoiceQbxml = (
Desc: account.accountdesc,
Quantity: 1, //jobline.part_qty,
Amount: DineroAmount, //.toFormat(DineroQbFormat),
//Amount: DineroAmount.toFormat(DineroQbFormat),
SalesTaxCodeRef: {
FullName: "E",
},
};
} else {
invoiceLineHash[account.name].Amount = invoiceLineHash[
account.name
].Amount.add(DineroAmount);
invoiceLineHash[account.name].Amount =
invoiceLineHash[account.name].Amount.add(DineroAmount);
}
}
// Labor Lines
if (
jobline.profitcenter_labor &&
@@ -260,14 +270,64 @@ const generateInvoiceQbxml = (
},
};
} else {
invoiceLineHash[account.name].Amount = invoiceLineHash[
account.name
].Amount.add(DineroAmount);
invoiceLineHash[account.name].Amount =
invoiceLineHash[account.name].Amount.add(DineroAmount);
}
}
});
// 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.
Object.keys(invoiceLineHash).forEach((key) => {
InvoiceLineAdd.push({
@@ -370,7 +430,6 @@ const generateInvoiceQbxml = (
},
};
console.log(JSON.stringify(invoiceQbxmlObj, null, 2));
var invoiceQbxml_partial = builder
.create(invoiceQbxmlObj, {
version: "1.30",
@@ -380,7 +439,6 @@ const generateInvoiceQbxml = (
.end({ pretty: true });
const invoiceQbxml_Full = QbXmlUtils.addQbxmlHeader(invoiceQbxml_partial);
console.log("invoiceQbxml_Full", invoiceQbxml_Full);
return invoiceQbxml_Full;
};

View File

@@ -100,6 +100,7 @@ query QUERY_JOBS_FOR_RECEIVABLES_EXPORT($ids: [uuid!]!) {
op_code_desc
profitcenter_labor
profitcenter_part
db_ref
}
}
bodyshops(where: {associations: {active: {_eq: true}}}) {

View File

@@ -165,7 +165,7 @@ function CalculateRatesTotals(ratesList) {
if (item.mod_lbr_ty === "LAR") {
ret.mapa.hours = ret.mapa.hours + item.mod_lb_hrs;
} 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";
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
);
}