Compare commits
16 Commits
feature/IO
...
feature/IO
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
cc623b7cbb | ||
|
|
9b1488ac3b | ||
|
|
7bab9bf4cb | ||
|
|
8278242e6f | ||
|
|
aa81cddcf1 | ||
|
|
85e60dcd6b | ||
|
|
a005f1bb45 | ||
|
|
f904fa4e18 | ||
|
|
27ffee0c7a | ||
|
|
187938286d | ||
|
|
6ad0272135 | ||
|
|
86db96f47d | ||
|
|
ac8c84543a | ||
|
|
78a2ff0fa1 | ||
|
|
dac1ed42df | ||
|
|
bc5f9f88d1 |
@@ -96,6 +96,7 @@ export function BillEnterModalLinesComponent({
|
|||||||
|
|
||||||
// Only fill actual_cost when the user forward-tabs out of Retail (actual_price)
|
// Only fill actual_cost when the user forward-tabs out of Retail (actual_price)
|
||||||
const autofillActualCost = (index) => {
|
const autofillActualCost = (index) => {
|
||||||
|
if (bodyshop.accountingconfig?.disableBillCostCalculation) return;
|
||||||
Promise.resolve().then(() => {
|
Promise.resolve().then(() => {
|
||||||
const retailRaw = form.getFieldValue(["billlines", index, "actual_price"]);
|
const retailRaw = form.getFieldValue(["billlines", index, "actual_price"]);
|
||||||
const actualRaw = form.getFieldValue(["billlines", index, "actual_cost"]);
|
const actualRaw = form.getFieldValue(["billlines", index, "actual_cost"]);
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ import { createStructuredSelector } from "reselect";
|
|||||||
import { INSERT_NEW_JOB } from "../../graphql/jobs.queries";
|
import { INSERT_NEW_JOB } from "../../graphql/jobs.queries";
|
||||||
import { selectBodyshop, selectCurrentUser } from "../../redux/user/user.selectors";
|
import { selectBodyshop, selectCurrentUser } from "../../redux/user/user.selectors";
|
||||||
import { useNotification } from "../../contexts/Notifications/notificationContext.jsx";
|
import { useNotification } from "../../contexts/Notifications/notificationContext.jsx";
|
||||||
|
import InstanceRenderManager from "../../utils/instanceRenderMgr.js";
|
||||||
|
|
||||||
const mapStateToProps = createStructuredSelector({
|
const mapStateToProps = createStructuredSelector({
|
||||||
//currentUser: selectCurrentUser
|
//currentUser: selectCurrentUser
|
||||||
@@ -156,104 +157,127 @@ export function ContractConvertToRo({ bodyshop, currentUser, contract, disabled
|
|||||||
joblines: {
|
joblines: {
|
||||||
data: billingLines
|
data: billingLines
|
||||||
},
|
},
|
||||||
parts_tax_rates: {
|
...InstanceRenderManager({
|
||||||
PAA: {
|
imex: {
|
||||||
prt_type: "PAA",
|
parts_tax_rates: {
|
||||||
prt_discp: 0,
|
PAA: {
|
||||||
prt_mktyp: false,
|
prt_type: "PAA",
|
||||||
prt_mkupp: 0,
|
prt_discp: 0,
|
||||||
prt_tax_in: true,
|
prt_mktyp: false,
|
||||||
prt_tax_rt: bodyshop.bill_tax_rates.state_tax_rate / 100
|
prt_mkupp: 0,
|
||||||
|
prt_tax_in: true,
|
||||||
|
prt_tax_rt: bodyshop.bill_tax_rates.state_tax_rate / 100
|
||||||
|
},
|
||||||
|
PAC: {
|
||||||
|
prt_type: "PAC",
|
||||||
|
prt_discp: 0,
|
||||||
|
prt_mktyp: false,
|
||||||
|
prt_mkupp: 0,
|
||||||
|
prt_tax_in: true,
|
||||||
|
prt_tax_rt: bodyshop.bill_tax_rates.state_tax_rate / 100
|
||||||
|
},
|
||||||
|
PAL: {
|
||||||
|
prt_type: "PAL",
|
||||||
|
prt_discp: 0,
|
||||||
|
prt_mktyp: false,
|
||||||
|
prt_mkupp: 0,
|
||||||
|
prt_tax_in: true,
|
||||||
|
prt_tax_rt: bodyshop.bill_tax_rates.state_tax_rate / 100
|
||||||
|
},
|
||||||
|
PAM: {
|
||||||
|
prt_type: "PAM",
|
||||||
|
prt_discp: 0,
|
||||||
|
prt_mktyp: false,
|
||||||
|
prt_mkupp: 0,
|
||||||
|
prt_tax_in: true,
|
||||||
|
prt_tax_rt: bodyshop.bill_tax_rates.state_tax_rate / 100
|
||||||
|
},
|
||||||
|
PAN: {
|
||||||
|
prt_type: "PAN",
|
||||||
|
prt_discp: 0,
|
||||||
|
prt_mktyp: false,
|
||||||
|
prt_mkupp: 0,
|
||||||
|
prt_tax_in: true,
|
||||||
|
prt_tax_rt: bodyshop.bill_tax_rates.state_tax_rate / 100
|
||||||
|
},
|
||||||
|
PAR: {
|
||||||
|
prt_type: "PAR",
|
||||||
|
prt_discp: 0,
|
||||||
|
prt_mktyp: false,
|
||||||
|
prt_mkupp: 0,
|
||||||
|
prt_tax_in: true,
|
||||||
|
prt_tax_rt: bodyshop.bill_tax_rates.state_tax_rate / 100
|
||||||
|
},
|
||||||
|
PAS: {
|
||||||
|
prt_type: "PAS",
|
||||||
|
prt_discp: 0,
|
||||||
|
prt_mktyp: false,
|
||||||
|
prt_mkupp: 0,
|
||||||
|
prt_tax_in: true,
|
||||||
|
prt_tax_rt: bodyshop.bill_tax_rates.state_tax_rate / 100
|
||||||
|
},
|
||||||
|
CCDR: {
|
||||||
|
prt_type: "CCDR",
|
||||||
|
prt_discp: 0,
|
||||||
|
prt_mktyp: false,
|
||||||
|
prt_mkupp: 0,
|
||||||
|
prt_tax_in: true,
|
||||||
|
prt_tax_rt: bodyshop.bill_tax_rates.state_tax_rate / 100
|
||||||
|
},
|
||||||
|
CCF: {
|
||||||
|
prt_type: "CCF",
|
||||||
|
prt_discp: 0,
|
||||||
|
prt_mktyp: false,
|
||||||
|
prt_mkupp: 0,
|
||||||
|
prt_tax_in: true,
|
||||||
|
prt_tax_rt: bodyshop.bill_tax_rates.state_tax_rate / 100
|
||||||
|
},
|
||||||
|
CCM: {
|
||||||
|
prt_type: "CCM",
|
||||||
|
prt_discp: 0,
|
||||||
|
prt_mktyp: false,
|
||||||
|
prt_mkupp: 0,
|
||||||
|
prt_tax_in: true,
|
||||||
|
prt_tax_rt: bodyshop.bill_tax_rates.state_tax_rate / 100
|
||||||
|
},
|
||||||
|
CCC: {
|
||||||
|
prt_type: "CCC",
|
||||||
|
prt_discp: 0,
|
||||||
|
prt_mktyp: false,
|
||||||
|
prt_mkupp: 0,
|
||||||
|
prt_tax_in: true,
|
||||||
|
prt_tax_rt: bodyshop.bill_tax_rates.state_tax_rate / 100
|
||||||
|
},
|
||||||
|
CCD: {
|
||||||
|
prt_type: "CCD",
|
||||||
|
prt_discp: 0,
|
||||||
|
prt_mktyp: false,
|
||||||
|
prt_mkupp: 0,
|
||||||
|
prt_tax_in: true,
|
||||||
|
prt_tax_rt: bodyshop.bill_tax_rates.state_tax_rate / 100
|
||||||
|
}
|
||||||
|
}
|
||||||
},
|
},
|
||||||
PAC: {
|
rome: {
|
||||||
prt_type: "PAC",
|
cieca_pft: {
|
||||||
prt_discp: 0,
|
...bodyshop.md_responsibility_centers.taxes.tax_ty1,
|
||||||
prt_mktyp: false,
|
...bodyshop.md_responsibility_centers.taxes.tax_ty2,
|
||||||
prt_mkupp: 0,
|
...bodyshop.md_responsibility_centers.taxes.tax_ty3,
|
||||||
prt_tax_in: true,
|
...bodyshop.md_responsibility_centers.taxes.tax_ty4,
|
||||||
prt_tax_rt: bodyshop.bill_tax_rates.state_tax_rate / 100
|
...bodyshop.md_responsibility_centers.taxes.tax_ty5
|
||||||
},
|
},
|
||||||
PAL: {
|
materials: bodyshop.md_responsibility_centers.cieca_pfm,
|
||||||
prt_type: "PAL",
|
cieca_pfl: bodyshop.md_responsibility_centers.cieca_pfl,
|
||||||
prt_discp: 0,
|
parts_tax_rates: bodyshop.md_responsibility_centers.parts_tax_rates,
|
||||||
prt_mktyp: false,
|
tax_tow_rt: bodyshop.md_responsibility_centers.tax_tow_rt,
|
||||||
prt_mkupp: 0,
|
tax_str_rt: bodyshop.md_responsibility_centers.tax_str_rt,
|
||||||
prt_tax_in: true,
|
tax_paint_mat_rt: bodyshop.md_responsibility_centers.tax_paint_mat_rt,
|
||||||
prt_tax_rt: bodyshop.bill_tax_rates.state_tax_rate / 100
|
tax_shop_mat_rt: bodyshop.md_responsibility_centers.tax_shop_mat_rt,
|
||||||
},
|
tax_sub_rt: bodyshop.md_responsibility_centers.tax_sub_rt,
|
||||||
PAM: {
|
tax_lbr_rt: bodyshop.md_responsibility_centers.tax_lbr_rt,
|
||||||
prt_type: "PAM",
|
tax_levies_rt: bodyshop.md_responsibility_centers.tax_levies_rt
|
||||||
prt_discp: 0,
|
|
||||||
prt_mktyp: false,
|
|
||||||
prt_mkupp: 0,
|
|
||||||
prt_tax_in: true,
|
|
||||||
prt_tax_rt: bodyshop.bill_tax_rates.state_tax_rate / 100
|
|
||||||
},
|
|
||||||
PAN: {
|
|
||||||
prt_type: "PAN",
|
|
||||||
prt_discp: 0,
|
|
||||||
prt_mktyp: false,
|
|
||||||
prt_mkupp: 0,
|
|
||||||
prt_tax_in: true,
|
|
||||||
prt_tax_rt: bodyshop.bill_tax_rates.state_tax_rate / 100
|
|
||||||
},
|
|
||||||
PAR: {
|
|
||||||
prt_type: "PAR",
|
|
||||||
prt_discp: 0,
|
|
||||||
prt_mktyp: false,
|
|
||||||
prt_mkupp: 0,
|
|
||||||
prt_tax_in: true,
|
|
||||||
prt_tax_rt: bodyshop.bill_tax_rates.state_tax_rate / 100
|
|
||||||
},
|
|
||||||
PAS: {
|
|
||||||
prt_type: "PAS",
|
|
||||||
prt_discp: 0,
|
|
||||||
prt_mktyp: false,
|
|
||||||
prt_mkupp: 0,
|
|
||||||
prt_tax_in: true,
|
|
||||||
prt_tax_rt: bodyshop.bill_tax_rates.state_tax_rate / 100
|
|
||||||
},
|
|
||||||
CCDR: {
|
|
||||||
prt_type: "CCDR",
|
|
||||||
prt_discp: 0,
|
|
||||||
prt_mktyp: false,
|
|
||||||
prt_mkupp: 0,
|
|
||||||
prt_tax_in: true,
|
|
||||||
prt_tax_rt: bodyshop.bill_tax_rates.state_tax_rate / 100
|
|
||||||
},
|
|
||||||
CCF: {
|
|
||||||
prt_type: "CCF",
|
|
||||||
prt_discp: 0,
|
|
||||||
prt_mktyp: false,
|
|
||||||
prt_mkupp: 0,
|
|
||||||
prt_tax_in: true,
|
|
||||||
prt_tax_rt: bodyshop.bill_tax_rates.state_tax_rate / 100
|
|
||||||
},
|
|
||||||
CCM: {
|
|
||||||
prt_type: "CCM",
|
|
||||||
prt_discp: 0,
|
|
||||||
prt_mktyp: false,
|
|
||||||
prt_mkupp: 0,
|
|
||||||
prt_tax_in: true,
|
|
||||||
prt_tax_rt: bodyshop.bill_tax_rates.state_tax_rate / 100
|
|
||||||
},
|
|
||||||
CCC: {
|
|
||||||
prt_type: "CCC",
|
|
||||||
prt_discp: 0,
|
|
||||||
prt_mktyp: false,
|
|
||||||
prt_mkupp: 0,
|
|
||||||
prt_tax_in: true,
|
|
||||||
prt_tax_rt: bodyshop.bill_tax_rates.state_tax_rate / 100
|
|
||||||
},
|
|
||||||
CCD: {
|
|
||||||
prt_type: "CCD",
|
|
||||||
prt_discp: 0,
|
|
||||||
prt_mktyp: false,
|
|
||||||
prt_mkupp: 0,
|
|
||||||
prt_tax_in: true,
|
|
||||||
prt_tax_rt: bodyshop.bill_tax_rates.state_tax_rate / 100
|
|
||||||
}
|
}
|
||||||
}
|
})
|
||||||
};
|
};
|
||||||
|
|
||||||
if (currentUser?.email) {
|
if (currentUser?.email) {
|
||||||
@@ -287,7 +311,7 @@ export function ContractConvertToRo({ bodyshop, currentUser, contract, disabled
|
|||||||
notification.success({
|
notification.success({
|
||||||
title: t("jobs.successes.created"),
|
title: t("jobs.successes.created"),
|
||||||
onClick: () => {
|
onClick: () => {
|
||||||
history.push(`/manage/jobs/${result.data.insert_jobs.returning[0].id}`);
|
history(`/manage/jobs/${result.data.insert_jobs.returning[0].id}`);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ import { setModalContext } from "../../redux/modals/modals.actions";
|
|||||||
import { store } from "../../redux/store";
|
import { store } from "../../redux/store";
|
||||||
import CurrencyFormatter from "../../utils/CurrencyFormatter";
|
import CurrencyFormatter from "../../utils/CurrencyFormatter";
|
||||||
import { TimeFormatter } from "../../utils/DateFormatter";
|
import { TimeFormatter } from "../../utils/DateFormatter";
|
||||||
import PhoneFormatter from "../../utils/PhoneFormatter";
|
import PhoneNumberFormatter from "../../utils/PhoneFormatter";
|
||||||
import { onlyUnique } from "../../utils/arrayHelper";
|
import { onlyUnique } from "../../utils/arrayHelper";
|
||||||
import InstanceRenderManager from "../../utils/instanceRenderMgr";
|
import InstanceRenderManager from "../../utils/instanceRenderMgr";
|
||||||
import { alphaSort, dateSort, statusSort } from "../../utils/sorters";
|
import { alphaSort, dateSort, statusSort } from "../../utils/sorters";
|
||||||
@@ -28,6 +28,7 @@ import ProductionListColumnCategory from "./production-list-columns.status.categ
|
|||||||
import ProductionListColumnStatus from "./production-list-columns.status.component";
|
import ProductionListColumnStatus from "./production-list-columns.status.component";
|
||||||
import ProductionListColumnTouchTime from "./prodution-list-columns.touchtime.component";
|
import ProductionListColumnTouchTime from "./prodution-list-columns.touchtime.component";
|
||||||
import ShareToTeamsButton from "../share-to-teams/share-to-teams.component.jsx";
|
import ShareToTeamsButton from "../share-to-teams/share-to-teams.component.jsx";
|
||||||
|
import ChatOpenButton from "../chat-open-button/chat-open-button.component.jsx";
|
||||||
|
|
||||||
const getEmployeeName = (employeeId, employees) => {
|
const getEmployeeName = (employeeId, employees) => {
|
||||||
const employee = employees.find((e) => e.id === employeeId);
|
const employee = employees.find((e) => e.id === employeeId);
|
||||||
@@ -271,14 +272,24 @@ const productionListColumnsData = ({ technician, state, activeStatuses, data, bo
|
|||||||
dataIndex: "ownr_ph1",
|
dataIndex: "ownr_ph1",
|
||||||
key: "ownr_ph1",
|
key: "ownr_ph1",
|
||||||
ellipsis: true,
|
ellipsis: true,
|
||||||
render: (text, record) => <PhoneFormatter type={record.ownr_ph1_ty}>{record.ownr_ph1}</PhoneFormatter>
|
render: (text, record) =>
|
||||||
|
technician ? (
|
||||||
|
<PhoneNumberFormatter type={record.ownr_ph1_ty}>{record.ownr_ph1}</PhoneNumberFormatter>
|
||||||
|
) : (
|
||||||
|
<ChatOpenButton type={record.ownr_ph1_ty} phone={record.ownr_ph1} jobid={record.id} />
|
||||||
|
)
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: i18n.t("jobs.fields.ownr_ph2"),
|
title: i18n.t("jobs.fields.ownr_ph2"),
|
||||||
dataIndex: "ownr_ph2",
|
dataIndex: "ownr_ph2",
|
||||||
key: "ownr_ph2",
|
key: "ownr_ph2",
|
||||||
ellipsis: true,
|
ellipsis: true,
|
||||||
render: (text, record) => <PhoneFormatter type={record.ownr_ph2_ty}>{record.ownr_ph2}</PhoneFormatter>
|
render: (text, record) =>
|
||||||
|
technician ? (
|
||||||
|
<PhoneNumberFormatter type={record.ownr_ph2_ty}>{record.ownr_ph2}</PhoneNumberFormatter>
|
||||||
|
) : (
|
||||||
|
<ChatOpenButton type={record.ownr_ph2_ty} phone={record.ownr_ph2} jobid={record.id} />
|
||||||
|
)
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: i18n.t("jobs.fields.specialcoveragepolicy"),
|
title: i18n.t("jobs.fields.specialcoveragepolicy"),
|
||||||
|
|||||||
@@ -316,9 +316,8 @@ export function ShopEmployeesFormComponent({ bodyshop }) {
|
|||||||
<LayoutFormRow grow>
|
<LayoutFormRow grow>
|
||||||
<Form.Item
|
<Form.Item
|
||||||
label={t("employees.fields.cost_center")}
|
label={t("employees.fields.cost_center")}
|
||||||
key={`${index}`}
|
key={`${field.key}-cost_center`}
|
||||||
name={[field.name, "cost_center"]}
|
name={[field.name, "cost_center"]}
|
||||||
valuePropName="value"
|
|
||||||
rules={[
|
rules={[
|
||||||
{
|
{
|
||||||
required: true
|
required: true
|
||||||
@@ -343,7 +342,7 @@ export function ShopEmployeesFormComponent({ bodyshop }) {
|
|||||||
</Form.Item>
|
</Form.Item>
|
||||||
<Form.Item
|
<Form.Item
|
||||||
label={t("employees.fields.rate")}
|
label={t("employees.fields.rate")}
|
||||||
key={`${index}`}
|
key={`${field.key}-rate`}
|
||||||
name={[field.name, "rate"]}
|
name={[field.name, "rate"]}
|
||||||
rules={[
|
rules={[
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -342,6 +342,14 @@ export function ShopInfoResponsibilityCenterComponent({ bodyshop, form }) {
|
|||||||
valuePropName="checked"
|
valuePropName="checked"
|
||||||
>
|
>
|
||||||
<Switch />
|
<Switch />
|
||||||
|
</Form.Item>,
|
||||||
|
<Form.Item
|
||||||
|
key="disableBillCostCalculation"
|
||||||
|
name={["accountingconfig", "disableBillCostCalculation"]}
|
||||||
|
label={t("bodyshop.fields.disableBillCostCalculation")}
|
||||||
|
valuePropName="checked"
|
||||||
|
>
|
||||||
|
<Switch />
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
]
|
]
|
||||||
: []),
|
: []),
|
||||||
|
|||||||
@@ -152,7 +152,7 @@ export function VendorsFormComponent({ bodyshop, form, formLoading, handleDelete
|
|||||||
{!isPartsEntry && (
|
{!isPartsEntry && (
|
||||||
<>
|
<>
|
||||||
<Form.Item label={t("vendors.fields.discount")} name="discount">
|
<Form.Item label={t("vendors.fields.discount")} name="discount">
|
||||||
<InputNumber min={0} max={1} precision={2} step={0.01} />
|
<InputNumber min={0} max={1} precision={3} step={0.01} />
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
|
|
||||||
<Form.Item label={t("vendors.fields.due_date")} name="due_date">
|
<Form.Item label={t("vendors.fields.due_date")} name="due_date">
|
||||||
|
|||||||
@@ -339,6 +339,7 @@
|
|||||||
"require_actual_delivery_date": "Require Actual Delivery",
|
"require_actual_delivery_date": "Require Actual Delivery",
|
||||||
"templates": "Delivery Templates"
|
"templates": "Delivery Templates"
|
||||||
},
|
},
|
||||||
|
"disableBillCostCalculation": "Disable Automatic Bill Cost Calculation",
|
||||||
"dms": {
|
"dms": {
|
||||||
"apcontrol": "AP Control Number",
|
"apcontrol": "AP Control Number",
|
||||||
"appostingaccount": "AP Posting Account",
|
"appostingaccount": "AP Posting Account",
|
||||||
|
|||||||
@@ -339,6 +339,7 @@
|
|||||||
"require_actual_delivery_date": "",
|
"require_actual_delivery_date": "",
|
||||||
"templates": ""
|
"templates": ""
|
||||||
},
|
},
|
||||||
|
"disableBillCostCalculation": "",
|
||||||
"dms": {
|
"dms": {
|
||||||
"apcontrol": "",
|
"apcontrol": "",
|
||||||
"appostingaccount": "",
|
"appostingaccount": "",
|
||||||
|
|||||||
@@ -339,6 +339,7 @@
|
|||||||
"require_actual_delivery_date": "",
|
"require_actual_delivery_date": "",
|
||||||
"templates": ""
|
"templates": ""
|
||||||
},
|
},
|
||||||
|
"disableBillCostCalculation": "",
|
||||||
"dms": {
|
"dms": {
|
||||||
"apcontrol": "",
|
"apcontrol": "",
|
||||||
"appostingaccount": "",
|
"appostingaccount": "",
|
||||||
|
|||||||
@@ -885,6 +885,8 @@ function CalculateTaxesTotals(job, otherTotals) {
|
|||||||
STOR: Dinero()
|
STOR: Dinero()
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const pfp = job.parts_tax_rates;
|
||||||
|
|
||||||
//For each line, determine if it's taxable, and if it is, add the line amount to the taxable amounts total.
|
//For each line, determine if it's taxable, and if it is, add the line amount to the taxable amounts total.
|
||||||
job.joblines
|
job.joblines
|
||||||
.filter((jl) => !jl.removed)
|
.filter((jl) => !jl.removed)
|
||||||
@@ -916,7 +918,17 @@ function CalculateTaxesTotals(job, otherTotals) {
|
|||||||
})
|
})
|
||||||
.multiply(val.part_qty || 0)
|
.multiply(val.part_qty || 0)
|
||||||
.add(discMarkupAmount);
|
.add(discMarkupAmount);
|
||||||
taxableAmounts[typeOfPart] = taxableAmounts[typeOfPart].add(partAmount);
|
if (taxableAmounts[typeOfPart]) {
|
||||||
|
taxableAmounts[typeOfPart] = taxableAmounts[typeOfPart].add(partAmount);
|
||||||
|
} else {
|
||||||
|
const isTaxableCustomType =
|
||||||
|
IsTrueOrYes(pfp?.[typeOfPart]?.prt_tax_in) || pfp?.[typeOfPart]?.prt_tax_in === true;
|
||||||
|
|
||||||
|
if (isTaxableCustomType) {
|
||||||
|
if (!taxableAmounts[typeOfPart]) taxableAmounts[typeOfPart] = Dinero();
|
||||||
|
taxableAmounts[typeOfPart] = taxableAmounts[typeOfPart].add(partAmount);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -969,13 +981,15 @@ function CalculateTaxesTotals(job, otherTotals) {
|
|||||||
})
|
})
|
||||||
);
|
);
|
||||||
|
|
||||||
const pfp = job.parts_tax_rates;
|
|
||||||
|
|
||||||
//For any profile level markups/discounts, add them in now as well.
|
//For any profile level markups/discounts, add them in now as well.
|
||||||
Object.keys(otherTotals.parts.adjustments).forEach((key) => {
|
Object.keys(otherTotals.parts.adjustments).forEach((key) => {
|
||||||
const adjustmentAmount = otherTotals.parts.adjustments[key];
|
const adjustmentAmount = otherTotals.parts.adjustments[key];
|
||||||
if (adjustmentAmount.getAmount() !== 0 && pfp[key]?.prt_tax_in) {
|
if (adjustmentAmount.getAmount() !== 0 && pfp[key]?.prt_tax_in) {
|
||||||
taxableAmounts[key] = taxableAmounts[key].add(adjustmentAmount);
|
if (taxableAmounts[key]) {
|
||||||
|
taxableAmounts[key] = taxableAmounts[key].add(adjustmentAmount);
|
||||||
|
} else {
|
||||||
|
taxableAmounts[key] = Dinero().add(adjustmentAmount);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -1072,6 +1086,21 @@ function CalculateTaxesTotals(job, otherTotals) {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
} else if (pfp[key]) {
|
||||||
|
//Custom part types (e.g. CC*) should flow through taxableAmountsByTier too.
|
||||||
|
let assignedToTier = false;
|
||||||
|
for (let tyCounter = 1; tyCounter <= 5; tyCounter++) {
|
||||||
|
if (IsTrueOrYes(pfp[key][`prt_tx_in${tyCounter}`])) {
|
||||||
|
taxableAmountsByTier[`ty${tyCounter}Tax`] = taxableAmountsByTier[`ty${tyCounter}Tax`].add(
|
||||||
|
taxableAmounts[key]
|
||||||
|
);
|
||||||
|
assignedToTier = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!assignedToTier && (IsTrueOrYes(pfp[key].prt_tax_in) || pfp[key].prt_tax_in === true)) {
|
||||||
|
taxableAmountsByTier.ty1Tax = taxableAmountsByTier.ty1Tax.add(taxableAmounts[key]);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
logger.log("job-totals-USA Key with issue", "warn", null, job.id, {
|
logger.log("job-totals-USA Key with issue", "warn", null, job.id, {
|
||||||
|
|||||||
Reference in New Issue
Block a user