From e363dca3f011de19533d80f3742dc48af979248b Mon Sep 17 00:00:00 2001 From: Patrick Fic Date: Fri, 15 Nov 2024 10:56:07 -0800 Subject: [PATCH] IO-3001 Additional tax changes. --- .../job-lines-part-price-change.component.jsx | 41 ++++++++++--------- server/job/job-totals-USA.js | 21 ++++------ 2 files changed, 31 insertions(+), 31 deletions(-) diff --git a/client/src/components/job-detail-lines/job-lines-part-price-change.component.jsx b/client/src/components/job-detail-lines/job-lines-part-price-change.component.jsx index a7548542c..13798eb0e 100644 --- a/client/src/components/job-detail-lines/job-lines-part-price-change.component.jsx +++ b/client/src/components/job-detail-lines/job-lines-part-price-change.component.jsx @@ -1,5 +1,5 @@ import { useMutation } from "@apollo/client"; -import { Button, Form, notification, Popover, Tooltip } from "antd"; +import { Button, Checkbox, Form, notification, Popover, Tooltip } from "antd"; import axios from "axios"; import { t } from "i18next"; import React, { useState } from "react"; @@ -60,27 +60,30 @@ export function JobLinesPartPriceChange({ job, line, refetch, technician }) { } }; - const popcontent = !technician && InstanceRenderManager({ - imex: null, - rome: ( -
- - - - -
- ), - promanager: null - }); + const popcontent = + !technician && + InstanceRenderManager({ + imex: null, + rome: ( +
+ + + + +
+ ), + promanager: null + }); return ( + {import.meta.env.DEV && } {line.db_ref === "900510" || line.db_ref === "900511" ? line.prt_dsmk_m : line.act_price} diff --git a/server/job/job-totals-USA.js b/server/job/job-totals-USA.js index 804cd1885..de1db5802 100644 --- a/server/job/job-totals-USA.js +++ b/server/job/job-totals-USA.js @@ -49,7 +49,7 @@ exports.totalsSsu = async function (req, res) { } catch (error) { logger.log("job-totals-ssu-USA-error", "ERROR", req?.user?.email, id, { jobid: id, - error + error: error.message }); res.status(503).send(); } @@ -75,7 +75,7 @@ async function TotalsServerSide(req, res) { : job.cieca_ttl.data.n_ttl_amt - job.cieca_ttl.data.g_tax; const ttlDifference = emsTotal - ret.totals.subtotal.getAmount() / 100; - if (Math.abs(ttlDifference) > 0.00) { + if (Math.abs(ttlDifference) > 0.0) { //If difference is greater than a pennny, we need to adjust it. ret.totals.ttl_adjustment = Dinero({ amount: Math.round(ttlDifference * 100) }); ret.totals.subtotal = ret.totals.subtotal.add(ret.totals.ttl_adjustment); @@ -97,7 +97,7 @@ async function TotalsServerSide(req, res) { 100; const ttlTaxDifference = emsTaxTotal - totalUsTaxes; - if (Math.abs(ttlTaxDifference) > 0.00) { + if (Math.abs(ttlTaxDifference) > 0.0) { //If difference is greater than a pennny, we need to adjust it. ret.totals.ttl_tax_adjustment = Dinero({ amount: Math.round(ttlTaxDifference * 100) }); ret.totals.total_repairs = ret.totals.total_repairs.add(ret.totals.ttl_tax_adjustment); @@ -998,7 +998,7 @@ function CalculateTaxesTotals(job, otherTotals) { } } } catch (error) { - logger.log("job-totals-USA Key with issue", "error", null, null, { + logger.log("job-totals-USA Key with issue", "error", null, job.id, { key }); } @@ -1028,7 +1028,7 @@ function CalculateTaxesTotals(job, otherTotals) { for (let threshCounter = 1; threshCounter <= 5; threshCounter++) { const thresholdAmount = parseFloat(job.cieca_pft[`ty${tyCounter}_thres${threshCounter}`]) || 0; const thresholdTaxRate = parseFloat(job.cieca_pft[`ty${tyCounter}_rate${threshCounter}`]) || 0; - + // console.log(taxTierKey, tyCounter, threshCounter, thresholdAmount, thresholdTaxRate); let taxableAmountInThisThreshold; if ( thresholdAmount === 9999.99 || @@ -1052,11 +1052,8 @@ function CalculateTaxesTotals(job, otherTotals) { taxableAmountInThisThreshold = Dinero({ amount: Math.round(thresholdAmount * 100) }); - remainingTaxableAmounts[taxTierKey] = remainingTaxableAmounts[taxTierKey].subtract( - Dinero({ - amount: Math.round(taxableAmountInThisThreshold * 100) - }) - ); + remainingTaxableAmounts[taxTierKey] = + remainingTaxableAmounts[taxTierKey].subtract(taxableAmountInThisThreshold); } } @@ -1065,8 +1062,8 @@ function CalculateTaxesTotals(job, otherTotals) { totalTaxByTier[taxTierKey] = totalTaxByTier[taxTierKey].add(taxAmountToAdd); } } catch (error) { - logger.log("job-totals-USA - PFP Calculation Error", "error", null, null, { - error + logger.log("job-totals-USA - PFP Calculation Error", "error", null, job.id, { + error: error.message }); } });