Compare commits

...

6 Commits

Author SHA1 Message Date
Allan Carr
c97213bc96 IO-3599 Taxable Amount
Signed-off-by: Allan Carr <allan@imexsystems.ca>
2026-03-24 18:12:04 -07:00
Allan Carr
9b1488ac3b Merged in feature/IO-3609-Bill-Cost-Calculation-Toggle (pull request #3151)
IO-3609 Bill Cost Calculation Toggle

Approved-by: Dave Richer
2026-03-24 17:50:06 +00:00
Allan Carr
7bab9bf4cb Merged in feature/IO-3623-Extend-Vendor-Discount (pull request #3152)
IO-3623 Extend Vendor Discount to Precision 3

Approved-by: Dave Richer
2026-03-24 17:49:40 +00:00
Allan Carr
8278242e6f Merged in feature/IO-3622-Employee-Delete-Rate (pull request #3153)
IO-3622 Employee Delete Rate

Approved-by: Dave Richer
2026-03-24 17:49:29 +00:00
Allan Carr
85e60dcd6b IO-3623 Extend Vendor Discount to Precision 3
Signed-off-by: Allan Carr <allan@imexsystems.ca>
2026-03-23 16:00:12 -07:00
Allan Carr
a005f1bb45 IO-3609 Bill Cost Calculation Toggle
Signed-off-by: Allan Carr <allan@imexsystems.ca>
2026-03-23 15:52:49 -07:00
7 changed files with 42 additions and 1 deletions

View File

@@ -96,6 +96,7 @@ export function BillEnterModalLinesComponent({
// Only fill actual_cost when the user forward-tabs out of Retail (actual_price)
const autofillActualCost = (index) => {
if (bodyshop.accountingconfig?.disableBillCostCalculation) return;
Promise.resolve().then(() => {
const retailRaw = form.getFieldValue(["billlines", index, "actual_price"]);
const actualRaw = form.getFieldValue(["billlines", index, "actual_cost"]);

View File

@@ -342,6 +342,14 @@ export function ShopInfoResponsibilityCenterComponent({ bodyshop, form }) {
valuePropName="checked"
>
<Switch />
</Form.Item>,
<Form.Item
key="disableBillCostCalculation"
name={["accountingconfig", "disableBillCostCalculation"]}
label={t("bodyshop.fields.disableBillCostCalculation")}
valuePropName="checked"
>
<Switch />
</Form.Item>
]
: []),

View File

@@ -152,7 +152,7 @@ export function VendorsFormComponent({ bodyshop, form, formLoading, handleDelete
{!isPartsEntry && (
<>
<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 label={t("vendors.fields.due_date")} name="due_date">

View File

@@ -339,6 +339,7 @@
"require_actual_delivery_date": "Require Actual Delivery",
"templates": "Delivery Templates"
},
"disableBillCostCalculation": "Disable Automatic Bill Cost Calculation",
"dms": {
"apcontrol": "AP Control Number",
"appostingaccount": "AP Posting Account",

View File

@@ -339,6 +339,7 @@
"require_actual_delivery_date": "",
"templates": ""
},
"disableBillCostCalculation": "",
"dms": {
"apcontrol": "",
"appostingaccount": "",

View File

@@ -339,6 +339,7 @@
"require_actual_delivery_date": "",
"templates": ""
},
"disableBillCostCalculation": "",
"dms": {
"apcontrol": "",
"appostingaccount": "",

View File

@@ -116,6 +116,32 @@ async function TotalsServerSide(req, res) {
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);
ret.totals.net_repairs = ret.totals.net_repairs.add(ret.totals.ttl_tax_adjustment);
if (Math.abs(totalUsTaxes) === 0) {
const laborRates = Object.values(job.cieca_pfl)
.map((v) => v.lbr_taxp)
.filter((v) => v != null);
const materialRates = Object.values(job.materials)
.map((v) => v.mat_taxp)
.filter((v) => v != null);
const partsRates = Object.values(job.parts_tax_rates)
.map((v) => {
const field = v.prt_tax_rt ?? v.part_tax_rt;
if (field == null) return null;
const raw = typeof field === "object" ? field.parsedValue : field;
return raw != null ? raw * 100 : null;
})
.filter((v) => v != null);
const taxRate = Math.max(...laborRates, ...materialRates, ...partsRates);
const totalTaxes = ret.totals.taxableAmounts.total.multiply(taxRate > 1 ? taxRate / 100 : taxRate);
ret.totals.taxableAmounts.total = ret.totals.taxableAmounts.total
.multiply(emsTaxTotal)
.divide(totalTaxes.toUnit());
} else {
ret.totals.taxableAmounts.total = ret.totals.taxableAmounts.total.multiply(emsTaxTotal).divide(totalUsTaxes);
}
logger.log("job-totals-USA-ttl-tax-adj", "debug", null, job.id, {
adjAmount: ttlTaxDifference
});
@@ -979,6 +1005,8 @@ function CalculateTaxesTotals(job, otherTotals) {
}
});
taxableAmounts.total = Object.values(taxableAmounts).reduce((acc, amount) => acc.add(amount), Dinero({ amount: 0 }));
// console.log("*** Taxable Amounts***");
// console.table(JSON.parse(JSON.stringify(taxableAmounts)));
@@ -1174,6 +1202,7 @@ function CalculateTaxesTotals(job, otherTotals) {
let ret = {
subtotal: subtotal,
taxableAmounts: taxableAmounts,
federal_tax: subtotal
.percentage((job.federal_tax_rate || 0) * 100)
.add(otherTotals.additional.pvrt.percentage((job.federal_tax_rate || 0) * 100)),