CORE-POS/IS4C

View on GitHub
documentation/Reference Code/Wedge/installation/mysql/translog/views/subtotals.viw

Summary

Maintainability
Test Coverage
use translog;
DROP VIEW IF EXISTS `subtotals`;

CREATE view subtotals as

select

LastID,
card_no,
runningTotal,
(runningTotal - transDiscount) as subTotal,
discountableTTL as discountableTotal,
tenderTotal,
chargeTotal,
ccTotal,
paymentTotal,
memChargeTotal,
discountTTL,
memSpecial,
staffSpecial,
refundTotal,
couponTotal,
memCoupon,
0 as madCoupon,
fsEligible,
(case when -1 * fsTendered  >= fsTaxable then -1 * fsTax else fsTendered07 end) as fsTaxExempt,
taxTotal + (case when (fsTendered <> 0 and (-1 * fsTendered)  >= fsTaxable) then (-1 * fsTax) else fsTendered07 end) as taxTotal,
scTaxTotal,
(runningTotal - transDiscount) + taxTotal + (case when (-1 * fsTendered)  >= fsTaxable then (-1 * fsTax) else fsTendered07 end) as AmtDue,
(runningTotal - scTransDiscount) + taxTotal + (case when (-1 * fsTendered)  >= fsTaxable then (-1 * fsTax) else fsTendered07 end) as scAmtDue,
scDiscount,
transDiscount,
scTransDiscount,
percentDiscount

from lttsubtotals