Skip to main content
10 events
when toggle format what by license comment
Feb 8, 2018 at 15:34 vote accept Code Poet
Feb 2, 2018 at 3:06 comment added Code Poet @EvanCarroll There's the case of restaurants levying a service charge over an above the Net+GST (example in case 3 above). So you got you bill Rs.100. You have 5% GST on that. So, net + GST = 105. Now, service charge (say 10%) is legally supposed to be levied on 105, not 100 (the net) and it's supposed to come last in the calculation order.
Feb 2, 2018 at 3:02 comment added Code Poet @RDFozz This is a real case, though I doubt there will ever be more than one applicable tax for these. So, perhaps leaving order might simplify things.
Feb 1, 2018 at 21:54 comment added RDFozz @CodePoet - Presumably, your item 3 represents a case where the tax is not applied to the specified amount (or, with Evan's model, the gross or the net), but to the amount plus any other taxes being charged. If this is a real thing, you would presumably need a separate column to indicate this (similar to the net vs gross indicator), and then to add the appropriate calculation. Note that, if there were more than one applicable tax rate for these, it might indeed become necessary to provide some way to correct apply them in order. I'd confirm that this is needed before worrying about it.
Feb 1, 2018 at 20:10 comment added Evan Carroll @CodePoet provide some sample input sample output, and explain.
Feb 1, 2018 at 19:58 comment added Code Poet Sorry, but I'm having trouble understanding how this is taking care of my case (3.3) where a tax is being applied on Net + Tax computation of the previous row?
Feb 1, 2018 at 19:47 comment added Evan Carroll @CodePoet you'd need another category for cess, or what not. All the same schema though. It's just data. The querying method is what gets more complex. Feel free to simplify the query with a function, even a simple SQL one that just produces the result from the input rows.
Feb 1, 2018 at 19:42 comment added Code Poet BTW, love the "They're puzzles to confuse working class folks so rich capitalist...".
Feb 1, 2018 at 19:41 comment added Code Poet By user-defined taxes, I meant to cover surcharges or cess, that some regions will levy over and above the regular taxes for a region. This usually comes as a tax on tax. e.g. 2% Educational Cess on 5% GST. This would increase ones GST liability by 2% to 5.1% and would need to be tracked as the amount payable to "Education Cess" authority. I want to provide, when defining the "Education Cess" tax an option for specifying it's rate as 2% and what it applies to for eg. GST. From there on, the logic would be generic.
Feb 1, 2018 at 18:40 history answered Evan Carroll CC BY-SA 3.0