
How to Coda with VAT — Part VI
Combining product promotions and reduction on total
How to permit a user without any affinity with Coding Coda 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.

Below the steps we made resulting in a new VAT and a new Reduced Based Price. The new base price is the one generated via a button based on product promotions.
Our next step is to define how the VAT is distributed over the price without VAT (New Base Price) and the price VAT incl (end price).

We continu by looking at how per VAT group the prices are distributed:

The last and final step in the table you find below:

With the reduced base price we can create the templates. Not unimportant, the previously created reset button is updated to also un check the boxes you see above.
Templating the outcomes
The promotions per product are visible in the table and you can decide to add a promoton over the total on top. If so, the column is checked and the values are taken into account. Below the code we developed (many thx to Joostmineur!).

Templating is not our focus in this blog, we repeat the logic we showed in blog Part IV.
As said before, in this case the choice is between two states: promotion on total or not. If not, you still see the promotions on products reflected in the price and VAT.
Designing documents is difficult. I proposed the following. Two main buttons and a few options.

Conclusion
I hope you enjoyed this article. If you have questions feel free to reach out. Though this article is for free, my work (including advice) won’t be, but there is always room for a chat to see what can be done. Besides you find my (for free) contributions to the Coda Community and on Twitter
My name is Christiaan Huizer and I am the owner of Huizer Automation. A company specialized in serving SME in harvesting data and keeping it aligned. I am a Coda Consultant & Expert and rely mainly on Coda, Mailjet, Zapier & Paperform to get the job done.
