Total bill level discounts are distributed by weight to the products and modifiers within the transaction
Terminology and definitions
Sample DineIn Transaction with GST inclusive
Terms  Definitions  Calculations 
Net sales  Total product & modifier price minus total discounts given  Total product & modifier price: Cheese burger ($10.90) + Onsen Egg ($1) + Add Rice ($0.5) + Cheese burger ($10.9) + Egg ($1) + Patty ($5) = $29.30
Total discounts given: ($12.40 x 10%) + $2 + ($26.06 x 20%) + $5 = $13.45
Net sales: $29.30  $13.45 = $15.85 
Total GST [SG] Total SST [MY]  Sum of all GST for all transactions *Note: GST is always calculated on the final discounted price + service fee (if applicable)  Based on the above example, if there is only 1 transaction then Total GST will be $1.14
How GST excl is calculated: (Total product and modifier price  total discount given) x 7%
How GST incl is calculated: (Total product and modifier price  total discount given) x 0.07/1.07 
Gross Sales  For GST exclusive and nonGST transactions: Gross sale = Total product & modifier price
For GST inclusive transactions: Gross sale = Total product & modifier price  total GST  Total product & modifier price: Cheese burger ($10.90) + Onsen Egg ($1) + Add Rice ($0.5) + Cheese burger ($10.9) + Egg ($1) + Patty ($5) = $29.30
Total GST: $1.14
Gross sales: $29.30  $1.14 = $28.16 
Total discounts given  Total item level discount + total bill level discounts  Total discounts given: ($12.40 x 10%) + $2 + ($26.06 x 20%) + $5 = $13.45 
Gross profit  Net sales  GST (inclusive only)  total cost  Gross profit: $15.85  $1.14  $4 (total cost) = $10.71 
How to calculate the total received amount
For GST exclusive transactions:
Net sales + total service fee + Total GST = Total received amount
For GST inclusive transactions:
Net sales + total service fee = Total received amount
For nonGST transactions:
Net sales = Total received amount
OR
Gross sales  total discount given = Total received amount
How to calculate category/product/modifier level gross sales
Example product: the first cheeseburger in the above sample transaction
Cheeseburger original price = $10.90
After item level discount = $10.90  10% = $9.81
After total bill level discount = $9.81  20%  ($9.81/$26.06 x $5) = $5.97
Inclusive GST of Cheeseburger = $5.97 x 0.07/1.07 = $0.39
Gross sales for Cheeseburger = $10.90  $0.39 = $10.51
How bill level dollar discounts are distributed to individual products and modifiers
We use product price over total price to calculate the weight of the product in order to distribute the total bill level dollar discount.
Example product: the first cheeseburger in the above sample transaction
Cheeseburger original price = $10.90
After item level discount = $10.90  10% = $9.81
Total bill after item discounts = $26.06
Total bill level dollar discount = $5
Bill level dollar discount for cheeseburger = $9.81/$26.06 x $5 = $1.88
In the end, all bill level dollar discount for products and modifiers should equal to the total bill level dollar discount ($5).
Product/ modifier  Original price  Price after item level discount  Bill level dollar discount 
Cheese burger 1  $10.90  $9.81  $1.88 
Onsen Egg  $1  $0.90  $0.9/$26.06 x $5 = $0.17 
Add Rice  $0.50  $0.45  $0.45/$26.06 x $5 = $0.09 
Cheese burger 2  $10.90  $10.90  $1.29 = $9.61  $9.61/$26.06 x $5 = $1.84 
Egg  $1  $1  $0.12 = $0.88  $0.88/$26.06 x $5 = $0.17 
Patty  $5  $5  $0.59 = $4.41  $4.41/$26.06 x $5 = $0.85 

 Total bill level dollar discount  $5 