If this is your first visit, check our documentation. To post, register or login.
Forums / Code Matters / Bug Reports / Discounts formats on invoice and when stored in orders_total

Discounts formats on invoice and when stored in orders_total

Started by oldngrey on 3 May 2023, 6:14 AM · Views: 787

Results 1 to 2 of 2
3 May 2023, 6:14 AM
#1
oldngrey avatar

oldngrey

Zen Follower

Join Date:
Apr 2008
Location:
Qld, Australia
Posts:
433
Plugin Contributions:
0

Post #1 by oldngrey

Zc157 and zc158, PHP7.4 to 8.2
I use Group Discounts, Coupons and Payment module Fee all of which show on the invoice as Negative amounts and are correctly deducted when calculating the invoice total.
When the values are written to the orders_total table the
ot_paymentmodulefee is correct [text=$-0.88; value=-0.8760]

ot_coupon is incorrect [ text=-$10.00; value=10.0000]
ot_group_pricing is incorrect [text=-$0.88; value=0.8800]

The invoice displayed on checkout is correct and the invoice displayed in the admin is correctly displayed but in admin the details screen does not show the negative for Group Discount or Discount Coupon.

and in details the dreaded one cent rounding rears its ugly head again.

This has bugged me for a long time but I'm updating export orders plugin to correctly sum up discounts so thought that it should be posted here.

OldNGrey
ZC222 PHP 8.4.27
MySQL 11.8.5-MariaDB

6 May 2023, 12:21 AM
#2
oldngrey avatar

oldngrey

Zen Follower

Join Date:
Apr 2008
Location:
Qld, Australia
Posts:
433
Plugin Contributions:
0

Post #2 by oldngrey

To update my previous post in case anyone reads this.
Examining the contents of the orders_total table reveals a lot of inconsistencies with discounts and in the 15 years of data it holds

To report correctly on discounts in export orders I will copy the logic from Sales Report II.

OldNGrey
ZC222 PHP 8.4.27
MySQL 11.8.5-MariaDB