From 17dcc2efd8c27d6d09dbc5369d2220380f869c00 Mon Sep 17 00:00:00 2001 From: Patrick Fic Date: Mon, 5 Jul 2021 10:35:45 -0700 Subject: [PATCH 1/4] IO-1239 Resolve extra lines on glass claim export --- .../jobs-admin-change.status.component.jsx | 57 +++++++++++++++++++ .../src/pages/jobs-admin/jobs-admin.page.jsx | 3 + server/accounting/qbxml/qbxml-receivables.js | 4 +- 3 files changed, 62 insertions(+), 2 deletions(-) create mode 100644 client/src/components/jobs-admin-change-status/jobs-admin-change.status.component.jsx diff --git a/client/src/components/jobs-admin-change-status/jobs-admin-change.status.component.jsx b/client/src/components/jobs-admin-change-status/jobs-admin-change.status.component.jsx new file mode 100644 index 000000000..a20c6ea20 --- /dev/null +++ b/client/src/components/jobs-admin-change-status/jobs-admin-change.status.component.jsx @@ -0,0 +1,57 @@ +import { DownCircleFilled } from "@ant-design/icons"; +import { useMutation } from "@apollo/client"; +import { Button, Dropdown, Menu, notification } from "antd"; +import React from "react"; +import { useTranslation } from "react-i18next"; +import { connect } from "react-redux"; +import { createStructuredSelector } from "reselect"; +import { UPDATE_JOB_STATUS } from "../../graphql/jobs.queries"; +import { selectBodyshop } from "../../redux/user/user.selectors"; + +const mapStateToProps = createStructuredSelector({ + bodyshop: selectBodyshop, +}); +const mapDispatchToProps = (dispatch) => ({ + //setUserLanguage: language => dispatch(setUserLanguage(language)) +}); +export default connect(mapStateToProps, mapDispatchToProps)(JobsAdminStatus); + +export function JobsAdminStatus({ bodyshop, job }) { + const { t } = useTranslation(); + + const [mutationUpdateJobstatus] = useMutation(UPDATE_JOB_STATUS); + const updateJobStatus = (status) => { + mutationUpdateJobstatus({ + variables: { jobId: job.id, status: status }, + }) + .then((r) => { + notification["success"]({ message: t("jobs.successes.save") }); + // refetch(); + }) + .catch((error) => { + notification["error"]({ message: t("jobs.errors.saving") }); + }); + }; + + const statusmenu = ( + { + updateJobStatus(e.key); + }} + > + {bodyshop.md_ro_statuses.statuses.map((item) => ( + {item} + ))} + + ); + + return ( + + + + ); +} diff --git a/client/src/pages/jobs-admin/jobs-admin.page.jsx b/client/src/pages/jobs-admin/jobs-admin.page.jsx index d4bf941f8..b133e314e 100644 --- a/client/src/pages/jobs-admin/jobs-admin.page.jsx +++ b/client/src/pages/jobs-admin/jobs-admin.page.jsx @@ -15,6 +15,8 @@ import JobAdminOwnerReassociate from "../../components/jobs-admin-owner-reassoci import JobsAdminUnvoid from "../../components/jobs-admin-unvoid/jobs-admin-unvoid.component"; import JobAdminVehicleReassociate from "../../components/jobs-admin-vehicle-reassociate/jobs-admin-vehicle-reassociate.component"; import LoadingSpinner from "../../components/loading-spinner/loading-spinner.component"; +import JobsAdminStatus from "../../components/jobs-admin-change-status/jobs-admin-change.status.component"; + import NotFound from "../../components/not-found/not-found.component"; import RbacWrapper from "../../components/rbac-wrapper/rbac-wrapper.component"; import { GET_JOB_BY_PK } from "../../graphql/jobs.queries"; @@ -96,6 +98,7 @@ export function JobsCloseContainer({ setBreadcrumbs, setSelectedHeader }) { + diff --git a/server/accounting/qbxml/qbxml-receivables.js b/server/accounting/qbxml/qbxml-receivables.js index 4d2c58672..0bb763a18 100644 --- a/server/accounting/qbxml/qbxml-receivables.js +++ b/server/accounting/qbxml/qbxml-receivables.js @@ -288,7 +288,7 @@ const generateInvoiceQbxml = ( }); // console.log("Done creating hash", JSON.stringify(invoiceLineHash)); - if (!hasMapaLine) { + if (!hasMapaLine && jobs_by_pk.job_totals.rates.mapa.total.amount > 0) { console.log("Adding MAPA Line Manually."); const mapaAccountName = responsibilityCenters.defaults.profits.MAPA; @@ -313,7 +313,7 @@ const generateInvoiceQbxml = ( } } - if (!hasMashLine) { + if (!hasMashLine && jobs_by_pk.job_totals.rates.mash.total.amount > 0) { console.log("Adding MASH Line Manually."); const mashAccountName = responsibilityCenters.defaults.profits.MASH; From 2c1f5a9f3493375a400d9a6af5bccf1daaa8d3a7 Mon Sep 17 00:00:00 2001 From: Patrick Fic <> Date: Tue, 6 Jul 2021 09:45:02 -0700 Subject: [PATCH 2/4] IO-1241 Supplement Merge with discarded changes. --- .../jobs-available-supplement.estlines.util.js | 6 +++++- client/src/graphql/jobs-lines.queries.js | 13 ------------- 2 files changed, 5 insertions(+), 14 deletions(-) diff --git a/client/src/components/jobs-available-table/jobs-available-supplement.estlines.util.js b/client/src/components/jobs-available-table/jobs-available-supplement.estlines.util.js index 43db00226..b424d2217 100644 --- a/client/src/components/jobs-available-table/jobs-available-supplement.estlines.util.js +++ b/client/src/components/jobs-available-table/jobs-available-supplement.estlines.util.js @@ -11,6 +11,7 @@ export const GetSupplementDelta = async (client, jobId, newLines) => { query: GET_ALL_JOBLINES_BY_PK, variables: { id: jobId }, }); + const existingLines = _.cloneDeep(existingLinesFromDb); const linesToInsert = []; const linesToUpdate = []; @@ -19,11 +20,14 @@ export const GetSupplementDelta = async (client, jobId, newLines) => { const matchingIndex = existingLines.findIndex( (eL) => eL.unq_seq === newLine.unq_seq ); + + //Should do a check to make sure there is only 1 matching unq sequence number. + if (matchingIndex >= 0) { //Found a relevant matching line. Add it to lines to update. linesToUpdate.push({ id: existingLines[matchingIndex].id, - newData: newLine, + newData: { ...newLine, removed: false }, }); //Splice out item we found for performance. diff --git a/client/src/graphql/jobs-lines.queries.js b/client/src/graphql/jobs-lines.queries.js index 90086e27c..2aeac31d8 100644 --- a/client/src/graphql/jobs-lines.queries.js +++ b/client/src/graphql/jobs-lines.queries.js @@ -23,19 +23,6 @@ export const GET_ALL_JOBLINES_BY_PK = gql` notes location tax_part - parts_order_lines { - id - parts_order { - id - order_number - order_date - user_email - vendor { - id - name - } - } - } } } `; From e9cda93898efa4a95084f611d09f3976a7a37ac5 Mon Sep 17 00:00:00 2001 From: Patrick Fic <> Date: Wed, 7 Jul 2021 15:04:56 -0700 Subject: [PATCH 3/4] IO-1245 Resolve QB Consistency Issue --- server/accounting/qbxml/qbxml-utils.js | 21 +++++++++++---------- server/graphql-client/queries.js | 1 + 2 files changed, 12 insertions(+), 10 deletions(-) diff --git a/server/accounting/qbxml/qbxml-utils.js b/server/accounting/qbxml/qbxml-utils.js index cd47eced8..b012c9baf 100644 --- a/server/accounting/qbxml/qbxml-utils.js +++ b/server/accounting/qbxml/qbxml-utils.js @@ -17,12 +17,13 @@ exports.generateOwnerTier = (jobs_by_pk, isThreeTier, twotierpref) => { if (isThreeTier) { //It's always gonna be the owner now. Same as 2 tier by name return jobs_by_pk.ownr_co_nm - ? `${jobs_by_pk.ownr_co_nm} - ${jobs_by_pk.ownr_ln || ""} ${ - jobs_by_pk.ownr_fn || "" - } #${jobs_by_pk.owner.accountingid || ""}` - : `${jobs_by_pk.ownr_ln || ""} ${jobs_by_pk.ownr_fn || ""} #${ + ? `${jobs_by_pk.ownr_co_nm.substring(0, 30)} #${ jobs_by_pk.owner.accountingid || "" - }`; + }` + : `${`${jobs_by_pk.ownr_ln || ""} ${jobs_by_pk.ownr_fn || ""}`.substring( + 0, + 30 + )} #${jobs_by_pk.owner.accountingid || ""}`; } else { //What's the 2 tier pref? if (twotierpref === "source") { @@ -31,12 +32,12 @@ exports.generateOwnerTier = (jobs_by_pk, isThreeTier, twotierpref) => { } else { //Same as 3 tier return jobs_by_pk.ownr_co_nm - ? `${jobs_by_pk.ownr_co_nm} - ${jobs_by_pk.ownr_ln || ""} ${ - jobs_by_pk.ownr_fn || "" - } #${jobs_by_pk.owner.accountingid || ""}` - : `${jobs_by_pk.ownr_ln || ""} ${jobs_by_pk.ownr_fn || ""} #${ + ? `${jobs_by_pk.ownr_co_nm.substring(0, 30)} #${ jobs_by_pk.owner.accountingid || "" - }`; + }` + : `${`${jobs_by_pk.ownr_ln || ""} ${ + jobs_by_pk.ownr_fn || "" + }`.substring(0, 30)} #${jobs_by_pk.owner.accountingid || ""}`; } } }; diff --git a/server/graphql-client/queries.js b/server/graphql-client/queries.js index ef0501f62..32db12ae6 100644 --- a/server/graphql-client/queries.js +++ b/server/graphql-client/queries.js @@ -57,6 +57,7 @@ query QUERY_JOBS_FOR_RECEIVABLES_EXPORT($ids: [uuid!]!) { ownerid ownr_ln ownr_fn + ownr_co_nm ownr_addr1 ownr_addr2 ownr_zip From 1360a73028f2d0a444abec8011b888d51eacddb3 Mon Sep 17 00:00:00 2001 From: Patrick Fic <> Date: Wed, 7 Jul 2021 16:30:05 -0700 Subject: [PATCH 4/4] IO-1245 Change Address 1 --- server/accounting/qbxml/qbxml-receivables.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/server/accounting/qbxml/qbxml-receivables.js b/server/accounting/qbxml/qbxml-receivables.js index 0bb763a18..aeb948ed9 100644 --- a/server/accounting/qbxml/qbxml-receivables.js +++ b/server/accounting/qbxml/qbxml-receivables.js @@ -424,9 +424,11 @@ const generateInvoiceQbxml = ( TxnDate: moment(jobs_by_pk.date_invoiced).format("YYYY-MM-DD"), RefNumber: jobs_by_pk.ro_number, ShipAddress: { - Addr1: `${jobs_by_pk.ownr_fn || ""} ${jobs_by_pk.ownr_ln || ""} ${ - jobs_by_pk.ownr_co_nm || "" - }`, + Addr1: jobs_by_pk.ownr_co_nm + ? jobs_by_pk.ownr_co_nm.substring(0, 30) + : `${`${jobs_by_pk.ownr_ln || ""} ${ + jobs_by_pk.ownr_fn || "" + }`.substring(0, 30)}`, Addr2: jobs_by_pk.ownr_addr1, Addr3: jobs_by_pk.ownr_addr2, City: jobs_by_pk.ownr_city,