Rounding is handled differently by every system, so totals cannot match perfectly across first-party, third-party, and POS systems. Tax calculations are occasionally off by a cent or two when comparing first-party totals to the POS, for example. This article explains how rounding works in Direct Ordering.
Why Rounding Differences Occur
Rounding differences come from three decisions:
- Where rounding occurs: Rounding at the order, item, or modifier level produces different results. Applying tax at each level, rounding at each level, and then summing is often one or two cents different from taking the order subtotal, applying tax, and rounding once.
- How many decimal places to round to: Rounding to four decimal places at the item or modifier level and two at the order level produces a different total than rounding to two decimal places everywhere.
- Which rounding technique to use: Round half up, half down, half even, and half odd all behave differently. The Rounding Methods reference describes the options.
How Direct Ordering Rounds
Direct Ordering calculates tax wherever there is a price, which means at the item level and the modifier level for each type of tax involved. This approach is used because tax rates can differ between items and because a single item or modifier can carry more than one tax.
Tax is rounded to four decimal places at the item and modifier level and to two decimal places everywhere else, such as surcharges. The round-half-even method is used because it avoids the round-toward-positive-infinity bias of a simple round-up approach. The individual tax contributions are then summed and rounded to two decimal places at the order level, again using round half even. This approach is the most accurate, though it does not always match other systems.
Comments
0 comments
Please sign in to leave a comment.