Merged in feature/IO-2506-Federal-Tax-Exempt-on-Bill-Entry (pull request #1108)

IO-2506 Federal Tax Exempt on Bill Entry

Approved-by: Dave Richer
This commit is contained in:
Allan Carr
2023-12-19 16:34:38 +00:00
committed by Dave Richer
5 changed files with 31 additions and 5 deletions

View File

@@ -79,6 +79,18 @@ export function BillFormComponent({
});
};
const handleFederalTaxExemptSwitchToggle = (checked) => {
if (checked) {
const values = form.getFieldsValue("billlines");
if (values && values.billlines && values.billlines.length > 0) {
values.billlines.forEach((b) => {
b.applicable_taxes.federal = false;
});
}
form.setFieldsValue({ billlines: values.billlines });
}
};
useEffect(() => {
if (job) form.validateFields(["is_credit_memo"]);
}, [job, form]);
@@ -387,7 +399,16 @@ export function BillFormComponent({
>
<CurrencyInput min={0} />
</Form.Item>
<Form.Item shouldUpdate span={15}>
{bodyshop.pbs_serialnumber || bodyshop.cdk_dealerid ? (
<Form.Item
span={2}
label={t("bills.labels.federal_tax_exempt")}
name="federal_tax_exempt"
>
<Switch onChange={handleFederalTaxExemptSwitchToggle} />
</Form.Item>
) : null}
<Form.Item shouldUpdate span={13}>
{() => {
const values = form.getFieldsValue([
"billlines",
@@ -405,7 +426,7 @@ export function BillFormComponent({
totals = CalculateBillTotal(values);
if (!!totals)
return (
<div>
<div align="right">
<Space wrap>
<Statistic
title={t("bills.labels.subtotal")}

View File

@@ -1,14 +1,15 @@
import { DeleteFilled, DollarCircleFilled } from "@ant-design/icons";
import { useTreatments } from "@splitsoftware/splitio-react";
import {
Button, Form,
Button,
Form,
Input,
InputNumber,
Select,
Space,
Switch,
Table,
Tooltip
Tooltip,
} from "antd";
import React from "react";
import { useTranslation } from "react-i18next";
@@ -466,7 +467,8 @@ export function BillEnterModalLinesComponent({
return {
key: `${field.index}fedtax`,
valuePropName: "checked",
initialValue: true,
initialValue:
form.getFieldValue("federal_tax_exempt") === true ? false : true,
name: [field.name, "applicable_taxes", "federal"],
};
},

View File

@@ -203,6 +203,7 @@
"entered_total": "Total of Entered Lines",
"enteringcreditmemo": "You are entering a credit memo. Please ensure you are also entering positive values.",
"federal_tax": "Federal Tax",
"federal_tax_exempt": "Federal Tax Exempt?",
"generatepartslabel": "Generate Parts Labels after Saving?",
"iouexists": "An IOU exists that is associated to this RO.",
"local_tax": "Local Tax",

View File

@@ -203,6 +203,7 @@
"entered_total": "",
"enteringcreditmemo": "",
"federal_tax": "",
"federal_tax_exempt": "",
"generatepartslabel": "",
"iouexists": "",
"local_tax": "",

View File

@@ -203,6 +203,7 @@
"entered_total": "",
"enteringcreditmemo": "",
"federal_tax": "",
"federal_tax_exempt": "",
"generatepartslabel": "",
"iouexists": "",
"local_tax": "",