Added sales tax codes & resolved no tax codes on payables export IO-453
This commit is contained in:
@@ -2537,6 +2537,27 @@
|
||||
</translation>
|
||||
</translations>
|
||||
</concept_node>
|
||||
<concept_node>
|
||||
<name>newsalestaxcode</name>
|
||||
<definition_loaded>false</definition_loaded>
|
||||
<description></description>
|
||||
<comment></comment>
|
||||
<default_text></default_text>
|
||||
<translations>
|
||||
<translation>
|
||||
<language>en-US</language>
|
||||
<approved>false</approved>
|
||||
</translation>
|
||||
<translation>
|
||||
<language>es-MX</language>
|
||||
<approved>false</approved>
|
||||
</translation>
|
||||
<translation>
|
||||
<language>fr-CA</language>
|
||||
<approved>false</approved>
|
||||
</translation>
|
||||
</translations>
|
||||
</concept_node>
|
||||
<concept_node>
|
||||
<name>newstatus</name>
|
||||
<definition_loaded>false</definition_loaded>
|
||||
@@ -5091,6 +5112,137 @@
|
||||
</translation>
|
||||
</translations>
|
||||
</concept_node>
|
||||
<concept_node>
|
||||
<name>refund</name>
|
||||
<definition_loaded>false</definition_loaded>
|
||||
<description></description>
|
||||
<comment></comment>
|
||||
<default_text></default_text>
|
||||
<translations>
|
||||
<translation>
|
||||
<language>en-US</language>
|
||||
<approved>false</approved>
|
||||
</translation>
|
||||
<translation>
|
||||
<language>es-MX</language>
|
||||
<approved>false</approved>
|
||||
</translation>
|
||||
<translation>
|
||||
<language>fr-CA</language>
|
||||
<approved>false</approved>
|
||||
</translation>
|
||||
</translations>
|
||||
</concept_node>
|
||||
<folder_node>
|
||||
<name>sales_tax_codes</name>
|
||||
<children>
|
||||
<concept_node>
|
||||
<name>code</name>
|
||||
<definition_loaded>false</definition_loaded>
|
||||
<description></description>
|
||||
<comment></comment>
|
||||
<default_text></default_text>
|
||||
<translations>
|
||||
<translation>
|
||||
<language>en-US</language>
|
||||
<approved>false</approved>
|
||||
</translation>
|
||||
<translation>
|
||||
<language>es-MX</language>
|
||||
<approved>false</approved>
|
||||
</translation>
|
||||
<translation>
|
||||
<language>fr-CA</language>
|
||||
<approved>false</approved>
|
||||
</translation>
|
||||
</translations>
|
||||
</concept_node>
|
||||
<concept_node>
|
||||
<name>description</name>
|
||||
<definition_loaded>false</definition_loaded>
|
||||
<description></description>
|
||||
<comment></comment>
|
||||
<default_text></default_text>
|
||||
<translations>
|
||||
<translation>
|
||||
<language>en-US</language>
|
||||
<approved>false</approved>
|
||||
</translation>
|
||||
<translation>
|
||||
<language>es-MX</language>
|
||||
<approved>false</approved>
|
||||
</translation>
|
||||
<translation>
|
||||
<language>fr-CA</language>
|
||||
<approved>false</approved>
|
||||
</translation>
|
||||
</translations>
|
||||
</concept_node>
|
||||
<concept_node>
|
||||
<name>federal</name>
|
||||
<definition_loaded>false</definition_loaded>
|
||||
<description></description>
|
||||
<comment></comment>
|
||||
<default_text></default_text>
|
||||
<translations>
|
||||
<translation>
|
||||
<language>en-US</language>
|
||||
<approved>false</approved>
|
||||
</translation>
|
||||
<translation>
|
||||
<language>es-MX</language>
|
||||
<approved>false</approved>
|
||||
</translation>
|
||||
<translation>
|
||||
<language>fr-CA</language>
|
||||
<approved>false</approved>
|
||||
</translation>
|
||||
</translations>
|
||||
</concept_node>
|
||||
<concept_node>
|
||||
<name>local</name>
|
||||
<definition_loaded>false</definition_loaded>
|
||||
<description></description>
|
||||
<comment></comment>
|
||||
<default_text></default_text>
|
||||
<translations>
|
||||
<translation>
|
||||
<language>en-US</language>
|
||||
<approved>false</approved>
|
||||
</translation>
|
||||
<translation>
|
||||
<language>es-MX</language>
|
||||
<approved>false</approved>
|
||||
</translation>
|
||||
<translation>
|
||||
<language>fr-CA</language>
|
||||
<approved>false</approved>
|
||||
</translation>
|
||||
</translations>
|
||||
</concept_node>
|
||||
<concept_node>
|
||||
<name>state</name>
|
||||
<definition_loaded>false</definition_loaded>
|
||||
<description></description>
|
||||
<comment></comment>
|
||||
<default_text></default_text>
|
||||
<translations>
|
||||
<translation>
|
||||
<language>en-US</language>
|
||||
<approved>false</approved>
|
||||
</translation>
|
||||
<translation>
|
||||
<language>es-MX</language>
|
||||
<approved>false</approved>
|
||||
</translation>
|
||||
<translation>
|
||||
<language>fr-CA</language>
|
||||
<approved>false</approved>
|
||||
</translation>
|
||||
</translations>
|
||||
</concept_node>
|
||||
</children>
|
||||
</folder_node>
|
||||
<concept_node>
|
||||
<name>state_tax</name>
|
||||
<definition_loaded>false</definition_loaded>
|
||||
|
||||
@@ -1,5 +1,13 @@
|
||||
import { DeleteFilled } from "@ant-design/icons";
|
||||
import { Button, Form, Input, InputNumber, Select } from "antd";
|
||||
import {
|
||||
Button,
|
||||
Form,
|
||||
Input,
|
||||
InputNumber,
|
||||
Select,
|
||||
Switch,
|
||||
Typography,
|
||||
} from "antd";
|
||||
import React, { useState } from "react";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import styled from "styled-components";
|
||||
@@ -1536,6 +1544,99 @@ export default function ShopInfoResponsibilityCenterComponent({ form }) {
|
||||
<Input />
|
||||
</Form.Item>
|
||||
</LayoutFormRow>
|
||||
<Typography.Title level={4}>
|
||||
{t("bodyshop.labels.responsibilitycenters.sales_tax_codes")}
|
||||
</Typography.Title>
|
||||
<Form.List name={["md_responsibility_centers", "sales_tax_codes"]}>
|
||||
{(fields, { add, remove }) => {
|
||||
return (
|
||||
<div>
|
||||
{fields.map((field, index) => (
|
||||
<Form.Item key={field.key}>
|
||||
<LayoutFormRow>
|
||||
<Form.Item
|
||||
label={t(
|
||||
"bodyshop.fields.responsibilitycenters.sales_tax_codes.description"
|
||||
)}
|
||||
key={`${index}description`}
|
||||
name={[field.name, "description"]}
|
||||
rules={[
|
||||
{
|
||||
required: true,
|
||||
message: t("general.validation.required"),
|
||||
},
|
||||
]}
|
||||
>
|
||||
<Input />
|
||||
</Form.Item>
|
||||
<Form.Item
|
||||
label={t(
|
||||
"bodyshop.fields.responsibilitycenters.sales_tax_codes.code"
|
||||
)}
|
||||
key={`${index}code`}
|
||||
name={[field.name, "code"]}
|
||||
rules={[
|
||||
{
|
||||
required: true,
|
||||
message: t("general.validation.required"),
|
||||
},
|
||||
]}
|
||||
>
|
||||
<Input />
|
||||
</Form.Item>
|
||||
<Form.Item
|
||||
label={t(
|
||||
"bodyshop.fields.responsibilitycenters.sales_tax_codes.federal"
|
||||
)}
|
||||
key={`${index}federal`}
|
||||
name={[field.name, "federal"]}
|
||||
valuePropName="checked"
|
||||
>
|
||||
<Switch />
|
||||
</Form.Item>
|
||||
<Form.Item
|
||||
label={t(
|
||||
"bodyshop.fields.responsibilitycenters.sales_tax_codes.state"
|
||||
)}
|
||||
key={`${index}state`}
|
||||
name={[field.name, "state"]}
|
||||
valuePropName="checked"
|
||||
>
|
||||
<Switch />
|
||||
</Form.Item>
|
||||
<Form.Item
|
||||
label={t(
|
||||
"bodyshop.fields.responsibilitycenters.sales_tax_codes.local"
|
||||
)}
|
||||
key={`${index}local`}
|
||||
name={[field.name, "local"]}
|
||||
valuePropName="checked"
|
||||
>
|
||||
<Switch />
|
||||
</Form.Item>
|
||||
<DeleteFilled
|
||||
onClick={() => {
|
||||
remove(field.name);
|
||||
}}
|
||||
/>
|
||||
</LayoutFormRow>
|
||||
</Form.Item>
|
||||
))}
|
||||
<Form.Item>
|
||||
<Button
|
||||
type="dashed"
|
||||
onClick={() => {
|
||||
add();
|
||||
}}
|
||||
style={{ width: "100%" }}
|
||||
>
|
||||
{t("bodyshop.actions.newsalestaxcode")}
|
||||
</Button>
|
||||
</Form.Item>
|
||||
</div>
|
||||
);
|
||||
}}
|
||||
</Form.List>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -171,6 +171,7 @@
|
||||
"addspeedprint": "Add Speed Print",
|
||||
"addtemplate": "Add Template",
|
||||
"newlaborrate": "New Labor Rate",
|
||||
"newsalestaxcode": "New Sales Tax Code",
|
||||
"newstatus": "Add Status",
|
||||
"testrender": "Test Render"
|
||||
},
|
||||
@@ -334,6 +335,14 @@
|
||||
"pap": "OEM Partial",
|
||||
"par": "Recored",
|
||||
"pas": "Sublet",
|
||||
"refund": "Refund",
|
||||
"sales_tax_codes": {
|
||||
"code": "Code",
|
||||
"description": "Description",
|
||||
"federal": "Federal Tax Applies",
|
||||
"local": "Local Tax Applies",
|
||||
"state": "State Tax Applies"
|
||||
},
|
||||
"state_tax": "State Tax",
|
||||
"tow": "Towing"
|
||||
},
|
||||
|
||||
@@ -171,6 +171,7 @@
|
||||
"addspeedprint": "",
|
||||
"addtemplate": "",
|
||||
"newlaborrate": "",
|
||||
"newsalestaxcode": "",
|
||||
"newstatus": "",
|
||||
"testrender": ""
|
||||
},
|
||||
@@ -334,6 +335,14 @@
|
||||
"pap": "",
|
||||
"par": "",
|
||||
"pas": "",
|
||||
"refund": "",
|
||||
"sales_tax_codes": {
|
||||
"code": "",
|
||||
"description": "",
|
||||
"federal": "",
|
||||
"local": "",
|
||||
"state": ""
|
||||
},
|
||||
"state_tax": "",
|
||||
"tow": ""
|
||||
},
|
||||
|
||||
@@ -171,6 +171,7 @@
|
||||
"addspeedprint": "",
|
||||
"addtemplate": "",
|
||||
"newlaborrate": "",
|
||||
"newsalestaxcode": "",
|
||||
"newstatus": "",
|
||||
"testrender": ""
|
||||
},
|
||||
@@ -334,6 +335,14 @@
|
||||
"pap": "",
|
||||
"par": "",
|
||||
"pas": "",
|
||||
"refund": "",
|
||||
"sales_tax_codes": {
|
||||
"code": "",
|
||||
"description": "",
|
||||
"federal": "",
|
||||
"local": "",
|
||||
"state": ""
|
||||
},
|
||||
"state_tax": "",
|
||||
"tow": ""
|
||||
},
|
||||
|
||||
@@ -91,6 +91,10 @@ const generateBill = (bill) => {
|
||||
};
|
||||
|
||||
const generateBillLine = (billLine, responsibilityCenters) => {
|
||||
console.log(
|
||||
" findTaxCode(billLine, responsibilityCenters.sales_tax_codes)",
|
||||
findTaxCode(billLine, responsibilityCenters.sales_tax_codes)
|
||||
);
|
||||
return {
|
||||
AccountRef: {
|
||||
FullName: responsibilityCenters.costs.find(
|
||||
@@ -100,6 +104,9 @@ const generateBillLine = (billLine, responsibilityCenters) => {
|
||||
Amount: Dinero({
|
||||
amount: Math.round(billLine.actual_cost * 100),
|
||||
}).toFormat(DineroQbFormat),
|
||||
SalesTaxCodeRef: {
|
||||
FullName: findTaxCode(billLine, responsibilityCenters.sales_tax_codes),
|
||||
},
|
||||
};
|
||||
};
|
||||
|
||||
@@ -109,3 +116,20 @@ const generateBillLine = (billLine, responsibilityCenters) => {
|
||||
// Amount: invoice.amount,
|
||||
// },
|
||||
// ],
|
||||
|
||||
const findTaxCode = (billLine, taxcode) => {
|
||||
const {
|
||||
applicable_taxes: { local, state, federal },
|
||||
} = billLine;
|
||||
const t = taxcode.filter(
|
||||
(t) => t.local === local && t.state === state && t.federal === federal
|
||||
);
|
||||
if (t.length === 1) {
|
||||
console.log(t);
|
||||
return t[0].code;
|
||||
} else if (t.length > 1) {
|
||||
return "Multiple Tax Codes Match";
|
||||
} else {
|
||||
return "No Tax Code Matches";
|
||||
}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user