From b37970a6df88062fbd5e2a98a7ed7af063c5e185 Mon Sep 17 00:00:00 2001
From: Patrick Fic <>
Date: Wed, 11 Aug 2021 13:50:37 -0700
Subject: [PATCH 01/11] IO-1300 Line Desc Null for Job costing
---
server/job/job-costing.js | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/server/job/job-costing.js b/server/job/job-costing.js
index e9de9b5ff..dfd547175 100644
--- a/server/job/job-costing.js
+++ b/server/job/job-costing.js
@@ -605,7 +605,7 @@ const formatGpPercent = (gppercent) => {
const getAdditionalCostCenter = (jl, profitCenters) => {
console.log("Checking additional cost center", jl.line_desc);
if (!jl.part_type && !jl.mod_lbr_ty) {
- const lineDesc = jl.line_desc.toLowerCase();
+ const lineDesc = jl.line_desc ? jl.line_desc.toLowerCase() : "";
//This logic is covered prior and assigned based on the labor type of the lines
// if (lineDesc.includes("shop materials")) {
// return profitCenters["MASH"];
From dd59f3d02638261b80d47b0e35452543bd84f52c Mon Sep 17 00:00:00 2001
From: Patrick Fic <>
Date: Thu, 12 Aug 2021 09:46:50 -0700
Subject: [PATCH 02/11] IO-1286 Retry Supplement Importing fix.
---
.../jobs-available-table.container.jsx | 14 ++++++++------
1 file changed, 8 insertions(+), 6 deletions(-)
diff --git a/client/src/components/jobs-available-table/jobs-available-table.container.jsx b/client/src/components/jobs-available-table/jobs-available-table.container.jsx
index 01bf3203e..07f8aa75e 100644
--- a/client/src/components/jobs-available-table/jobs-available-table.container.jsx
+++ b/client/src/components/jobs-available-table/jobs-available-table.container.jsx
@@ -187,7 +187,9 @@ export function JobsAvailableContainer({
setJobModalVisible(false);
setInsertLoading(true);
- const estData = replaceEmpty(estDataRaw.data.available_jobs_by_pk);
+
+ const estData = estDataRaw.data.available_jobs_by_pk;
+
if (!(estData && estData.est_data)) {
//We don't have the right data. Error!
setInsertLoading(false);
@@ -196,7 +198,7 @@ export function JobsAvailableContainer({
});
} else {
//create upsert job
- let supp = _.cloneDeep(estData.est_data);
+ let supp = replaceEmpty({ ...estData.est_data });
delete supp.owner;
delete supp.vehicle;
@@ -208,7 +210,7 @@ export function JobsAvailableContainer({
let suppDelta = await GetSupplementDelta(
client,
selectedJob,
- estData.est_data.joblines.data
+ supp.joblines.data
);
delete supp.joblines;
@@ -380,10 +382,10 @@ export default connect(
)(JobsAvailableContainer);
function replaceEmpty(someObj, replaceValue = null) {
- const replacer = (key, value) => (value === "" ? replaceValue : value);
+ const replacer = (key, value) =>
+ value === "" ? replaceValue || null : value;
//^ because you seem to want to replace (strings) "null" or "undefined" too
- console.log(someObj);
const temp = JSON.stringify(someObj, replacer);
- console.log(`temp`, temp);
+ console.log("Parsed", JSON.parse(temp));
return JSON.parse(temp);
}
From c1d7168260631108cc6fdfdf98eb94d52beeb117 Mon Sep 17 00:00:00 2001
From: Patrick Fic <>
Date: Thu, 12 Aug 2021 09:52:44 -0700
Subject: [PATCH 03/11] Resolve CI issue.
---
.../jobs-available-table/jobs-available-table.container.jsx | 1 -
1 file changed, 1 deletion(-)
diff --git a/client/src/components/jobs-available-table/jobs-available-table.container.jsx b/client/src/components/jobs-available-table/jobs-available-table.container.jsx
index 07f8aa75e..5eef71012 100644
--- a/client/src/components/jobs-available-table/jobs-available-table.container.jsx
+++ b/client/src/components/jobs-available-table/jobs-available-table.container.jsx
@@ -8,7 +8,6 @@ import {
import { Col, notification, Row } from "antd";
import Axios from "axios";
import Dinero from "dinero.js";
-import _ from "lodash";
import moment from "moment";
import queryString from "query-string";
import React, { useCallback, useEffect, useState } from "react";
From 12f6206f882f3b49bd7fb009ecd133468bd1c9cb Mon Sep 17 00:00:00 2001
From: Patrick Fic <>
Date: Fri, 13 Aug 2021 15:48:12 -0700
Subject: [PATCH 04/11] IO-1224 IO-1297 IO-1298 Adjust decimal place displays
in various locations
---
.../labor-allocations-table.component.jsx | 4 ++--
.../scoreboard-chart.component.jsx | 21 +++++++++++--------
...p-info.responsibilitycenters.component.jsx | 16 ++++++++------
.../time-ticket-list.component.jsx | 10 ++++++---
4 files changed, 31 insertions(+), 20 deletions(-)
diff --git a/client/src/components/labor-allocations-table/labor-allocations-table.component.jsx b/client/src/components/labor-allocations-table/labor-allocations-table.component.jsx
index 304eabe84..50144f157 100644
--- a/client/src/components/labor-allocations-table/labor-allocations-table.component.jsx
+++ b/client/src/components/labor-allocations-table/labor-allocations-table.component.jsx
@@ -10,7 +10,7 @@ import { alphaSort } from "../../utils/sorters";
import LaborAllocationsAdjustmentEdit from "../labor-allocations-adjustment-edit/labor-allocations-adjustment-edit.component";
import "./labor-allocations-table.styles.scss";
import { CalculateAllocationsTotals } from "./labor-allocations-table.utility";
-
+import _ from "lodash";
const mapStateToProps = createStructuredSelector({
bodyshop: selectBodyshop,
technician: selectTechnician,
@@ -113,7 +113,7 @@ export function LaborAllocationsTable({
color: record.difference >= 0 ? "green" : "red",
}}
>
- {record.difference}
+ {_.round(record.difference, 1)}
),
},
diff --git a/client/src/components/scoreboard-chart/scoreboard-chart.component.jsx b/client/src/components/scoreboard-chart/scoreboard-chart.component.jsx
index ec7c8fd37..0c9d9bb7a 100644
--- a/client/src/components/scoreboard-chart/scoreboard-chart.component.jsx
+++ b/client/src/components/scoreboard-chart/scoreboard-chart.component.jsx
@@ -17,7 +17,7 @@ import {
import { createStructuredSelector } from "reselect";
import { selectBodyshop } from "../../redux/user/user.selectors";
import * as Utils from "../scoreboard-targets-table/scoreboard-targets-table.util";
-
+import _ from "lodash";
const mapStateToProps = createStructuredSelector({
bodyshop: selectBodyshop,
});
@@ -52,17 +52,20 @@ export function ScoreboardChart({ sbEntriesByDate, bodyshop }) {
const theValue = {
date: moment(val).format("D dd"),
- paintHrs: dayhrs.painthrs,
- bodyHrs: dayhrs.bodyhrs,
- accTargetHrs: Utils.AsOfDateTargetHours(
- bodyshop.scoreboard_target.dailyBodyTarget +
- bodyshop.scoreboard_target.dailyPaintTarget,
- val
+ paintHrs: _.round(dayhrs.painthrs, 1),
+ bodyHrs: _.round(dayhrs.bodyhrs),
+ accTargetHrs: _.round(
+ Utils.AsOfDateTargetHours(
+ bodyshop.scoreboard_target.dailyBodyTarget +
+ bodyshop.scoreboard_target.dailyPaintTarget,
+ val
+ )
),
- accHrs:
+ accHrs: _.round(
acc.length > 0
? acc[acc.length - 1].accHrs + dayhrs.painthrs + dayhrs.bodyhrs
- : dayhrs.painthrs + dayhrs.bodyhrs,
+ : dayhrs.painthrs + dayhrs.bodyhrs
+ ),
};
return [...acc, theValue];
diff --git a/client/src/components/shop-info/shop-info.responsibilitycenters.component.jsx b/client/src/components/shop-info/shop-info.responsibilitycenters.component.jsx
index ff0b4f2af..37a9213fa 100644
--- a/client/src/components/shop-info/shop-info.responsibilitycenters.component.jsx
+++ b/client/src/components/shop-info/shop-info.responsibilitycenters.component.jsx
@@ -40,17 +40,21 @@ export function ShopInfoResponsibilityCenterComponent({ bodyshop, form }) {
const [costOptions, setCostOptions] = useState(
[
- ...(form
- .getFieldValue(["md_responsibility_centers", "costs"])
- .map((i) => i && i.name) || []),
+ ...((form.getFieldValue(["md_responsibility_centers", "costs"]) &&
+ form
+ .getFieldValue(["md_responsibility_centers", "costs"])
+ .map((i) => i && i.name)) ||
+ []),
] || []
);
const [profitOptions, setProfitOptions] = useState(
[
- ...(form
- .getFieldValue(["md_responsibility_centers", "profits"])
- .map((i) => i && i.name) || []),
+ ...((form.getFieldValue(["md_responsibility_centers", "profits"]) &&
+ form
+ .getFieldValue(["md_responsibility_centers", "profits"])
+ .map((i) => i && i.name)) ||
+ []),
] || []
);
diff --git a/client/src/components/time-ticket-list/time-ticket-list.component.jsx b/client/src/components/time-ticket-list/time-ticket-list.component.jsx
index 6a7bf6b11..804f69fcf 100644
--- a/client/src/components/time-ticket-list/time-ticket-list.component.jsx
+++ b/client/src/components/time-ticket-list/time-ticket-list.component.jsx
@@ -17,7 +17,7 @@ import RbacWrapper, {
} from "../rbac-wrapper/rbac-wrapper.component";
import TimeTicketEnterButton from "../time-ticket-enter-button/time-ticket-enter-button.component";
import { Link } from "react-router-dom";
-
+import _ from "lodash";
const mapStateToProps = createStructuredSelector({
bodyshop: selectBodyshop,
authLevel: selectAuthLevel,
@@ -268,8 +268,12 @@ export function TimeTicketList({
- {totals.productivehrs}
- {totals.actualhrs}
+
+ {_.round(totals.productivehrs, 1)}
+
+
+ {_.round(totals.actualhrs, 1)}
+
{totals.actualhrs === 0 || !totals.actualhrs
? "∞"
From dba648aea25649c58c031e969141adb7ff7f974f Mon Sep 17 00:00:00 2001
From: Patrick Fic <>
Date: Fri, 13 Aug 2021 15:52:02 -0700
Subject: [PATCH 05/11] IO-1303 Adjust jobline status alignment.
---
.../job-line-status-popup/job-line-status-popup.component.jsx | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/client/src/components/job-line-status-popup/job-line-status-popup.component.jsx b/client/src/components/job-line-status-popup/job-line-status-popup.component.jsx
index e948aadd8..dc91995de 100644
--- a/client/src/components/job-line-status-popup/job-line-status-popup.component.jsx
+++ b/client/src/components/job-line-status-popup/job-line-status-popup.component.jsx
@@ -72,7 +72,7 @@ export function JobLineStatusPopup({ bodyshop, jobline, disabled }) {
);
return (
!disabled && setEditing(true)}
>
{jobline.status}
From 58d1859640f44e2b95a290c7102ad2970be4a0c2 Mon Sep 17 00:00:00 2001
From: Patrick Fic <>
Date: Fri, 13 Aug 2021 16:17:16 -0700
Subject: [PATCH 06/11] IO-1306 Show Export Attempts on export screens.
---
bodyshop_translations.babel | 26 +++++++++++++++++++
.../accounting-payables-table.component.jsx | 11 ++++++++
.../accounting-payments-table.component.jsx | 10 +++++++
...accounting-receivables-table.component.jsx | 12 ++++++++-
.../jobs-close-auto-allocate.component.jsx | 2 +-
client/src/graphql/accounting.queries.js | 12 +++++++++
client/src/translations/en_us/common.json | 3 +++
client/src/translations/es/common.json | 3 +++
client/src/translations/fr/common.json | 3 +++
9 files changed, 80 insertions(+), 2 deletions(-)
diff --git a/bodyshop_translations.babel b/bodyshop_translations.babel
index 9533a47db..d2694e8ff 100644
--- a/bodyshop_translations.babel
+++ b/bodyshop_translations.babel
@@ -12906,6 +12906,32 @@
+
+ labels
+
+
+ attempts
+ false
+
+
+
+
+
+ en-US
+ false
+
+
+ es-MX
+ false
+
+
+ fr-CA
+ false
+
+
+
+
+
diff --git a/client/src/components/accounting-payables-table/accounting-payables-table.component.jsx b/client/src/components/accounting-payables-table/accounting-payables-table.component.jsx
index c28c95ca1..64e335833 100644
--- a/client/src/components/accounting-payables-table/accounting-payables-table.component.jsx
+++ b/client/src/components/accounting-payables-table/accounting-payables-table.component.jsx
@@ -109,6 +109,17 @@ export default function AccountingPayablesTableComponent({ loading, bills }) {
),
},
+ {
+ title: t("exportlogs.labels.attempts"),
+ dataIndex: "attempts",
+ key: "attempts",
+
+ render: (text, record) => {
+ const success = record.exportlogs.filter((e) => e.successful).length;
+ const attempts = record.exportlogs.length;
+ return `${success}/${attempts}`;
+ },
+ },
{
title: t("general.labels.actions"),
dataIndex: "actions",
diff --git a/client/src/components/accounting-payments-table/accounting-payments-table.component.jsx b/client/src/components/accounting-payments-table/accounting-payments-table.component.jsx
index be98297b6..2edc4a0a4 100644
--- a/client/src/components/accounting-payments-table/accounting-payments-table.component.jsx
+++ b/client/src/components/accounting-payments-table/accounting-payments-table.component.jsx
@@ -108,7 +108,17 @@ export default function AccountingPayablesTableComponent({
{record.exportedat}
),
},
+ {
+ title: t("exportlogs.labels.attempts"),
+ dataIndex: "attempts",
+ key: "attempts",
+ render: (text, record) => {
+ const success = record.exportlogs.filter((e) => e.successful).length;
+ const attempts = record.exportlogs.length;
+ return `${success}/${attempts}`;
+ },
+ },
{
title: t("general.labels.actions"),
dataIndex: "actions",
diff --git a/client/src/components/accounting-receivables-table/accounting-receivables-table.component.jsx b/client/src/components/accounting-receivables-table/accounting-receivables-table.component.jsx
index 5492e83ec..da2e4885c 100644
--- a/client/src/components/accounting-receivables-table/accounting-receivables-table.component.jsx
+++ b/client/src/components/accounting-receivables-table/accounting-receivables-table.component.jsx
@@ -114,11 +114,21 @@ export default function AccountingReceivablesTableComponent({ loading, jobs }) {
);
},
},
+ {
+ title: t("exportlogs.labels.attempts"),
+ dataIndex: "attempts",
+ key: "attempts",
+
+ render: (text, record) => {
+ const success = record.exportlogs.filter((e) => e.successful).length;
+ const attempts = record.exportlogs.length;
+ return `${success}/${attempts}`;
+ },
+ },
{
title: t("general.labels.actions"),
dataIndex: "actions",
key: "actions",
- sorter: (a, b) => a.clm_total - b.clm_total,
render: (text, record) => (
diff --git a/client/src/components/jobs-close-auto-allocate/jobs-close-auto-allocate.component.jsx b/client/src/components/jobs-close-auto-allocate/jobs-close-auto-allocate.component.jsx
index cbdca4501..ede82520d 100644
--- a/client/src/components/jobs-close-auto-allocate/jobs-close-auto-allocate.component.jsx
+++ b/client/src/components/jobs-close-auto-allocate/jobs-close-auto-allocate.component.jsx
@@ -61,7 +61,7 @@ export function JobsCloseAutoAllocate({ bodyshop, joblines, form, disabled }) {
);
};
- const overlay = (
+ const overlay = bodyshop.cdk_dealerid && (
+
+ scoredboard
+
+
+ successes
+
+
+ updated
+ false
+
+
+
+
+
+ en-US
+ false
+
+
+ es-MX
+ false
+
+
+ fr-CA
+ false
+
+
+
+
+
+
+
tech
diff --git a/client/src/graphql/scoreboard.queries.js b/client/src/graphql/scoreboard.queries.js
index fc3627ac2..1132fd65d 100644
--- a/client/src/graphql/scoreboard.queries.js
+++ b/client/src/graphql/scoreboard.queries.js
@@ -2,7 +2,10 @@ import { gql } from "@apollo/client";
export const SUBSCRIPTION_SCOREBOARD = gql`
subscription SUBSCRIPTION_SCOREBOARD($start: date!, $end: date!) {
- scoreboard(where: { _and: { date: { _gte: $start, _lte: $end } } }) {
+ scoreboard(
+ where: { _and: { date: { _gte: $start, _lte: $end } } }
+ order_by: { date: asc }
+ ) {
id
painthrs
bodyhrs
diff --git a/client/src/translations/en_us/common.json b/client/src/translations/en_us/common.json
index e0d383298..e29ff3cbf 100644
--- a/client/src/translations/en_us/common.json
+++ b/client/src/translations/en_us/common.json
@@ -2112,6 +2112,11 @@
"updated": "Scoreboard updated."
}
},
+ "scoredboard": {
+ "successes": {
+ "updated": "Scoreboard entry updated."
+ }
+ },
"tech": {
"fields": {
"employeeid": "Employee ID",
diff --git a/client/src/translations/es/common.json b/client/src/translations/es/common.json
index 10257da69..f40d9dd17 100644
--- a/client/src/translations/es/common.json
+++ b/client/src/translations/es/common.json
@@ -2112,6 +2112,11 @@
"updated": ""
}
},
+ "scoredboard": {
+ "successes": {
+ "updated": ""
+ }
+ },
"tech": {
"fields": {
"employeeid": "",
diff --git a/client/src/translations/fr/common.json b/client/src/translations/fr/common.json
index b170e2669..54818c3f3 100644
--- a/client/src/translations/fr/common.json
+++ b/client/src/translations/fr/common.json
@@ -2112,6 +2112,11 @@
"updated": ""
}
},
+ "scoredboard": {
+ "successes": {
+ "updated": ""
+ }
+ },
"tech": {
"fields": {
"employeeid": "",
From 0190e737c14cc6c0d5b31c6970721e08973099dd Mon Sep 17 00:00:00 2001
From: Patrick Fic <>
Date: Wed, 18 Aug 2021 12:58:26 -0700
Subject: [PATCH 09/11] IO-1297 resolve decimal issue on time ticket list.
---
.../scoreboard-chart/scoreboard-chart.component.jsx | 8 +++++---
.../time-ticket-list/time-ticket-list.component.jsx | 9 ++++-----
2 files changed, 9 insertions(+), 8 deletions(-)
diff --git a/client/src/components/scoreboard-chart/scoreboard-chart.component.jsx b/client/src/components/scoreboard-chart/scoreboard-chart.component.jsx
index 0c9d9bb7a..b39d70d5b 100644
--- a/client/src/components/scoreboard-chart/scoreboard-chart.component.jsx
+++ b/client/src/components/scoreboard-chart/scoreboard-chart.component.jsx
@@ -53,18 +53,20 @@ export function ScoreboardChart({ sbEntriesByDate, bodyshop }) {
const theValue = {
date: moment(val).format("D dd"),
paintHrs: _.round(dayhrs.painthrs, 1),
- bodyHrs: _.round(dayhrs.bodyhrs),
+ bodyHrs: _.round(dayhrs.bodyhrs, 1),
accTargetHrs: _.round(
Utils.AsOfDateTargetHours(
bodyshop.scoreboard_target.dailyBodyTarget +
bodyshop.scoreboard_target.dailyPaintTarget,
val
- )
+ ),
+ 1
),
accHrs: _.round(
acc.length > 0
? acc[acc.length - 1].accHrs + dayhrs.painthrs + dayhrs.bodyhrs
- : dayhrs.painthrs + dayhrs.bodyhrs
+ : dayhrs.painthrs + dayhrs.bodyhrs,
+ 1
),
};
diff --git a/client/src/components/time-ticket-list/time-ticket-list.component.jsx b/client/src/components/time-ticket-list/time-ticket-list.component.jsx
index 804f69fcf..46e9462c3 100644
--- a/client/src/components/time-ticket-list/time-ticket-list.component.jsx
+++ b/client/src/components/time-ticket-list/time-ticket-list.component.jsx
@@ -1,9 +1,10 @@
-import { Card, Space, Table } from "antd";
import { EditFilled } from "@ant-design/icons";
+import { Card, Space, Table } from "antd";
import moment from "moment";
import React, { useMemo, useState } from "react";
import { useTranslation } from "react-i18next";
import { connect } from "react-redux";
+import { Link } from "react-router-dom";
import { createStructuredSelector } from "reselect";
import {
selectAuthLevel,
@@ -16,8 +17,6 @@ import RbacWrapper, {
HasRbacAccess,
} from "../rbac-wrapper/rbac-wrapper.component";
import TimeTicketEnterButton from "../time-ticket-enter-button/time-ticket-enter-button.component";
-import { Link } from "react-router-dom";
-import _ from "lodash";
const mapStateToProps = createStructuredSelector({
bodyshop: selectBodyshop,
authLevel: selectAuthLevel,
@@ -269,10 +268,10 @@ export function TimeTicketList({
- {_.round(totals.productivehrs, 1)}
+ {totals.productivehrs.toFixed(1)}
- {_.round(totals.actualhrs, 1)}
+ {totals.actualhrs.toFixed(1)}
{totals.actualhrs === 0 || !totals.actualhrs
From ba5400d04ae4b4dde4c5f0a4a0c92f7741d2a6b5 Mon Sep 17 00:00:00 2001
From: Patrick Fic
Date: Wed, 18 Aug 2021 13:18:30 -0700
Subject: [PATCH 10/11] IO-1307 Resolve selection issues on export tables.
---
.../jobs-close-export-button.component.jsx | 2 +-
.../payable-export-button/payable-export-button.component.jsx | 2 +-
.../payment-export-button/payment-export-button.component.jsx | 2 +-
3 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/client/src/components/jobs-close-export-button/jobs-close-export-button.component.jsx b/client/src/components/jobs-close-export-button/jobs-close-export-button.component.jsx
index d790328ff..c49c0f3fe 100644
--- a/client/src/components/jobs-close-export-button/jobs-close-export-button.component.jsx
+++ b/client/src/components/jobs-close-export-button/jobs-close-export-button.component.jsx
@@ -150,7 +150,7 @@ export function JobsCloseExportButton({
}
if (setSelectedJobs) {
setSelectedJobs((selectedJobs) => {
- return selectedJobs.filter((i) => i.id !== jobId);
+ return selectedJobs.filter((i) => i !== jobId);
});
}
}
diff --git a/client/src/components/payable-export-button/payable-export-button.component.jsx b/client/src/components/payable-export-button/payable-export-button.component.jsx
index a25361256..d531b308f 100644
--- a/client/src/components/payable-export-button/payable-export-button.component.jsx
+++ b/client/src/components/payable-export-button/payable-export-button.component.jsx
@@ -145,7 +145,7 @@ export function PayableExportButton({
}
if (setSelectedBills) {
setSelectedBills((selectedBills) => {
- return selectedBills.filter((i) => i.id !== billId);
+ return selectedBills.filter((i) => i !== billId);
});
}
}
diff --git a/client/src/components/payment-export-button/payment-export-button.component.jsx b/client/src/components/payment-export-button/payment-export-button.component.jsx
index f05c839d2..e6fbacb1e 100644
--- a/client/src/components/payment-export-button/payment-export-button.component.jsx
+++ b/client/src/components/payment-export-button/payment-export-button.component.jsx
@@ -145,7 +145,7 @@ export function PaymentExportButton({
if (setSelectedPayments) {
setSelectedPayments((selectedBills) => {
- return selectedBills.filter((i) => i.id !== paymentId);
+ return selectedBills.filter((i) => i !== paymentId);
});
}
}
From d2b2a5399de3836d5939c483201a0fb95b504adb Mon Sep 17 00:00:00 2001
From: Patrick Fic <>
Date: Fri, 20 Aug 2021 08:07:01 -0700
Subject: [PATCH 11/11] IO-1327 Resolve dinero error on bill posting
---
.../components/bill-form/bill-form.totals.utility.js | 12 +++---------
1 file changed, 3 insertions(+), 9 deletions(-)
diff --git a/client/src/components/bill-form/bill-form.totals.utility.js b/client/src/components/bill-form/bill-form.totals.utility.js
index 11cb7c481..df84ec86e 100644
--- a/client/src/components/bill-form/bill-form.totals.utility.js
+++ b/client/src/components/bill-form/bill-form.totals.utility.js
@@ -1,13 +1,8 @@
import Dinero from "dinero.js";
export const CalculateBillTotal = (invoice) => {
- const {
- total,
- billlines,
- federal_tax_rate,
- local_tax_rate,
- state_tax_rate,
- } = invoice;
+ const { total, billlines, federal_tax_rate, local_tax_rate, state_tax_rate } =
+ invoice;
//TODO Determine why this recalculates so many times.
let subtotal = Dinero({ amount: 0 });
@@ -20,8 +15,7 @@ export const CalculateBillTotal = (invoice) => {
billlines.forEach((i) => {
if (!!i) {
const itemTotal = Dinero({
- amount:
- Math.round(((i.actual_cost || 0) * 100 + Number.EPSILON) * 100) / 100,
+ amount: Math.round((i.actual_cost || 0) * 100),
}).multiply(i.quantity || 1);
subtotal = subtotal.add(itemTotal);