Member-only story
How to Coda with VAT — Part VI
Combining product promotions and reduction on total
How to permit a user without any affinity with Coding to apply reductions on products and — or — over the total in an easy way?
We start with what we have, the dynamic reductions on product level and we integrate the learnings from part 4. We add a button that permits to use the same buttons to calculate the total reduction. Once I saw this design option the code part was not too difficult anymore.
The reduction
The first step is to get the reduction right. We reuse the product logic and replace for the percentage logic the base price per row — thisRow.BasePrice — by the sum per list: — thisTable.NewBasePrice.Sum(). This results in the reduction over the total.
The redistribution of VAT per VAT type
We have a column in our table about VAT, checked means VAT excl, unchecked VAT incl. We use this logic to duplicate the steps we described in part IV with a little extra, see below the IF statement we use. No additional columns needed.
