Sum of the components do not add up to the header line for a kit template
Description
Environment
Activity
Mike Sheen 16 April 2025 at 06:42
Nah.
https://jiwa.atlassian.net/browse/DEV-8412 was for 7.2.1 and passed testing. That was cloned into V8 as https://jiwa.atlassian.net/browse/DEV-8414 and that too passed testing.
Those issues were relating to the changing of the quantity of a kit header type template is changing the component prices - and that has been fixed, and remains fixed in both v7 and v8.
The issue this ticket is about is explained by Scott in his comment before subsequently rejecting this issue, and that explanation still holds up and is valid for Kit Templates.
You simply cannot have the sum of the component prices always add up and match the kit header price UNLESS you increase the decimal precision being used.
Monica Holliday 16 April 2025 at 06:09
A fix was introduced for 07.02.01 on https://jiwa.atlassian.net/browse/DEV-8412 that somehow has now been overwritten. As per the ticket (dev-8412), when changing the qty on the header only the component qty’s should be updated not the component prices.
As per our documentation:
Template is a type of kit. It means the header record is used as a grouping mechanism only. Any pricing on the header template inventory item is ignored and the price of the header is the sum of the components. The price of the header can't be edited in sales orders or quotes. You can only influence the header price by editing the price of a component.
Scott Pearce 12 March 2025 at 03:41
Caused by rounding (loss of precision). You probably want to use kits instead of kit templates to achieve the behavior you want, because kits add a kit rounding line.
Total is calculated like this on a per line basis:
Total = (Price Ex.* Quantity This Delivery) + Total Tax
So, when, say, Quantity This Delivery is changed for any line (kit header or component), then every line (kit header and components) will have its prices and totals updated. So as per the steps to reproduce, when the Quantity This Delivery is set to 5 for the kit header the following happens:
Component1:
Unit Tax Amount | = (Price Ex. * (Tax Rate / 100) |
| = (113.64 * (.1) |
| = 11.364 |
| = 11.36 <--Rounding loss |
Total Tax | = (Price Ex. * Quantity This Delivery) * (Tax Rate / 100) |
| = (113.64 * 9.55) * (.1) |
| = (1085.262) * (.1) |
| = 108.5262 |
| = 108.53 <--Rounding gain |
Price Inc | = Price Ex. + Unit Tax Amount |
| = 113.64 + 11.36 |
| = 125.00 |
Total | = (Price Ex. * Quantity This Delivery) + Total Tax |
| = (113.64 * 9.55) + 108.53 |
| = (1085.262) + 108.53 |
| = 1193.792 |
| = 1193.79 <--Rounding loss |
Component2:
Unit Tax Amount | = (Price Ex. * (Tax Rate / 100) |
| = (1.00 * (.1) |
| = .1 |
Total Tax | = (Price Ex. * Quantity This Delivery) * (Tax Rate / 100) |
| = (1.00 * 5.65) * (.1) |
| = (5.65) * (.1) |
| = .565 |
| = .57 <--Rounding gain |
Price Inc | = Price Ex. + Unit Tax Amount |
| = 1.00 + 0.10 |
| = 1.10 |
Total | = (Price Ex. * Quantity This Delivery) + Total Tax |
| = (1.00 * 5.65) + 0.57 |
| = (5.65) + 0.57 |
| = 6.22 |
KitTemplate:
Unit Tax Amount | = (Price Ex. * (Tax Rate / 100) |
| = (218.18 * (.1) |
| = 21.818 |
| = 21.82 <--Rounding gain |
Total Tax | = (Price Ex. * Quantity This Delivery) * (Tax Rate / 100) |
| = (218.18 * 5) * (.1) |
| = (1090.90) * (.1) |
| = 109.09 |
Price Inc | = Price Ex. + Unit Tax Amount |
| = 218.18 + 21.82 |
| = 240.00 |
Total | = (Price Ex. * Quantity This Delivery) + Total Tax |
| = (218.18 * 5) + 109.09 |
| = (1090.90) + 109.09 |
| = 1199.99 |
So, all the math makes sense, but you are never going to get the kit header total to be the exact sum of the component totals in every case - there will sometimes be rounding adjustments made.
Steps to reproduce:
Fresh demo data
Set “Statement Discount Percentage” and “Statement Discount On Invoices” to 0 for debtor 1001.
New inventory item
PartNo = Component1, Non-physical, Decimals = 2, Sell Price = 113.64
PartNo = Component2, Non-physical, Decimals = 2, Sell Price = 1
PartNo = KitTemplate, Kit Style = Template, Sell Price = 1, Add Components:
Component1, Quantity = 1.91
Component2, Quantity = 1.13
New sales order for 1001
Add KitTemplate, set Quantity Ordered = 5. Save
Error: The sum of the kit components “Total” does not add up to the “Total” of the kit header. Screen shows 1193.79 + 6.22 = 1199.99, BUT 1193.79 + 6.22 = 1200.01
Note: Same thing happens in quotes (you may have to ensure Disc% is set to 0 for all lines).