diff --git a/bodyshop_translations.babel b/bodyshop_translations.babel index fbc0f76cb..4d4b34426 100644 --- a/bodyshop_translations.babel +++ b/bodyshop_translations.babel @@ -2537,6 +2537,27 @@ + + newsalestaxcode + false + + + + + + en-US + false + + + es-MX + false + + + fr-CA + false + + + newstatus false @@ -5091,6 +5112,137 @@ + + refund + false + + + + + + en-US + false + + + es-MX + false + + + fr-CA + false + + + + + sales_tax_codes + + + code + false + + + + + + en-US + false + + + es-MX + false + + + fr-CA + false + + + + + description + false + + + + + + en-US + false + + + es-MX + false + + + fr-CA + false + + + + + federal + false + + + + + + en-US + false + + + es-MX + false + + + fr-CA + false + + + + + local + false + + + + + + en-US + false + + + es-MX + false + + + fr-CA + false + + + + + state + false + + + + + + en-US + false + + + es-MX + false + + + fr-CA + false + + + + + state_tax false 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 0d9f8ce1c..80f2bc33d 100644 --- a/client/src/components/shop-info/shop-info.responsibilitycenters.component.jsx +++ b/client/src/components/shop-info/shop-info.responsibilitycenters.component.jsx @@ -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 }) { + + {t("bodyshop.labels.responsibilitycenters.sales_tax_codes")} + + + {(fields, { add, remove }) => { + return ( +
+ {fields.map((field, index) => ( + + + + + + + + + + + + + + + + + + { + remove(field.name); + }} + /> + + + ))} + + + +
+ ); + }} +
diff --git a/client/src/translations/en_us/common.json b/client/src/translations/en_us/common.json index 00f8f8708..4a1d5c9bc 100644 --- a/client/src/translations/en_us/common.json +++ b/client/src/translations/en_us/common.json @@ -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" }, diff --git a/client/src/translations/es/common.json b/client/src/translations/es/common.json index eb4a2650e..8be8c1397 100644 --- a/client/src/translations/es/common.json +++ b/client/src/translations/es/common.json @@ -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": "" }, diff --git a/client/src/translations/fr/common.json b/client/src/translations/fr/common.json index f0ba5a32e..614ff696a 100644 --- a/client/src/translations/fr/common.json +++ b/client/src/translations/fr/common.json @@ -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": "" }, diff --git a/server/accounting/qbxml/qbxml-payables.js b/server/accounting/qbxml/qbxml-payables.js index 0e392eed2..622315936 100644 --- a/server/accounting/qbxml/qbxml-payables.js +++ b/server/accounting/qbxml/qbxml-payables.js @@ -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"; + } +};