From 660f463aeadd9d083bc3cf888e0486ff99cb7f79 Mon Sep 17 00:00:00 2001
From: Patrick Fic <>
Date: Thu, 14 Oct 2021 10:52:08 -0700
Subject: [PATCH 1/2] IO-1468 Resolve line markup for MCE.
---
.../job-detail-lines/job-lines.component.jsx | 6 +-
.../jobs-available-table.container.jsx | 6 ++
server/job/job-totals.js | 99 +++++++++++--------
3 files changed, 70 insertions(+), 41 deletions(-)
diff --git a/client/src/components/job-detail-lines/job-lines.component.jsx b/client/src/components/job-detail-lines/job-lines.component.jsx
index 1b1964664..08834e7bb 100644
--- a/client/src/components/job-detail-lines/job-lines.component.jsx
+++ b/client/src/components/job-detail-lines/job-lines.component.jsx
@@ -162,7 +162,11 @@ export function JobLinesComponent({
ellipsis: true,
render: (text, record) => (
<>
- {record.act_price}
+
+ {record.db_ref === "900510" || record.db_ref === "900511"
+ ? record.prt_dsmk_m
+ : record.act_price}
+
{record.prt_dsmk_p && record.prt_dsmk_p !== 0 ? (
0 ? 1 : -1)
+ ? Dinero({ amount: Math.round(value.prt_dsmk_m * 100) })
+ : Dinero({
+ amount: Math.round(value.act_price * 100),
+ })
+ .multiply(value.part_qty || 0)
+ .percentage(Math.abs(value.prt_dsmk_p || 0))
+ .multiply(value.prt_dsmk_p > 0 ? 1 : -1)
),
- list: {
- ...acc.parts.list,
- [value.part_type]:
- acc.parts.list[value.part_type] &&
- acc.parts.list[value.part_type].total
- ? {
- total: acc.parts.list[value.part_type].total.add(
- Dinero({
- amount: Math.round((value.act_price || 0) * 100),
- }).multiply(value.part_qty || 0)
- ),
- }
- : {
- total: Dinero({
- amount: Math.round((value.act_price || 0) * 100),
- }).multiply(value.part_qty || 0),
- },
- },
+ ...(value.part_type
+ ? {
+ list: {
+ ...acc.parts.list,
+ [value.part_type]:
+ acc.parts.list[value.part_type] &&
+ acc.parts.list[value.part_type].total
+ ? {
+ total: acc.parts.list[
+ value.part_type
+ ].total.add(
+ Dinero({
+ amount: Math.round(
+ (value.act_price || 0) * 100
+ ),
+ }).multiply(value.part_qty || 0)
+ ),
+ }
+ : {
+ total: Dinero({
+ amount: Math.round(
+ (value.act_price || 0) * 100
+ ),
+ }).multiply(value.part_qty || 0),
+ },
+ },
+ }
+ : {}),
subtotal: acc.parts.subtotal
.add(
Dinero({
@@ -325,13 +340,13 @@ function CalculatePartsTotals(jobLines) {
)
.add(
value.prt_dsmk_m && value.prt_dsmk_m !== 0
- ? Dinero({ amount: Math.round(value.prt_dsmk_m * 100) })
- : Dinero({
- amount: Math.round(value.act_price * 100),
- })
- .multiply(value.part_qty || 0)
- .percentage(Math.abs(value.prt_dsmk_p || 0))
- .multiply(value.prt_dsmk_p > 0 ? 1 : -1)
+ ? Dinero({ amount: Math.round(value.prt_dsmk_m * 100) })
+ : Dinero({
+ amount: Math.round(value.act_price * 100),
+ })
+ .multiply(value.part_qty || 0)
+ .percentage(Math.abs(value.prt_dsmk_p || 0))
+ .multiply(value.prt_dsmk_p > 0 ? 1 : -1)
),
},
};
@@ -465,13 +480,13 @@ function CalculateTaxesTotals(job, otherTotals) {
.multiply(val.part_qty || 0)
.add(
val.prt_dsmk_m && val.prt_dsmk_m !== 0
- ? Dinero({ amount: Math.round(val.prt_dsmk_m * 100) })
- : Dinero({
- amount: Math.round(val.act_price * 100),
- })
- .multiply(val.part_qty || 0)
- .percentage(Math.abs(val.prt_dsmk_p || 0))
- .multiply(val.prt_dsmk_p > 0 ? 1 : -1)
+ ? Dinero({ amount: Math.round(val.prt_dsmk_m * 100) })
+ : Dinero({
+ amount: Math.round(val.act_price * 100),
+ })
+ .multiply(val.part_qty || 0)
+ .percentage(Math.abs(val.prt_dsmk_p || 0))
+ .multiply(val.prt_dsmk_p > 0 ? 1 : -1)
)
.percentage(
((job.parts_tax_rates &&
@@ -481,6 +496,10 @@ function CalculateTaxesTotals(job, otherTotals) {
val.part_type.startsWith("PAG") &&
BackupGlassTax &&
BackupGlassTax.prt_tax_rt) ||
+ (!val.part_type &&
+ val.db_ref === "900510" &&
+ job.parts_tax_rates["PAN"] &&
+ job.parts_tax_rates["PAN"].prt_tax_rt) ||
0) * 100
)
);
From 1d210a9e5261cbcf7b81499562d7fc618edb5009 Mon Sep 17 00:00:00 2001
From: Patrick Fic
Date: Thu, 14 Oct 2021 11:21:06 -0700
Subject: [PATCH 2/2] IO-1468 QB and CDK Updates for MCE Markup
---
bodyshop_translations.babel | 23 ++++++++-
.../jobs-available-table.container.jsx | 2 +-
.../jobs-close-lines.component.jsx | 15 +++++-
client/src/graphql/jobs.queries.js | 2 +-
client/src/translations/en_us/common.json | 3 +-
client/src/translations/es/common.json | 1 +
client/src/translations/fr/common.json | 1 +
logs/oAuthClient-log.log | 47 +++++++++++++++++++
server/accounting/qb-receivables-lines.js | 4 +-
9 files changed, 91 insertions(+), 7 deletions(-)
create mode 100644 logs/oAuthClient-log.log
diff --git a/bodyshop_translations.babel b/bodyshop_translations.babel
index 81517d230..15e3f0071 100644
--- a/bodyshop_translations.babel
+++ b/bodyshop_translations.babel
@@ -1,4 +1,4 @@
-
+