joelbrock / NOFC_CORE

CORE branch for the New Orleans Food Co-op
nolafood.coop
GNU General Public License v2.0
1 stars 1 forks source link

LA Sales Tax Holidays #8

Open joelbrock opened 9 years ago

joelbrock commented 9 years ago

In a little over a week there will be a sales tax holiday in Lousiana. The 4.5% state tax will be forgiven for 2 days, while any local/city taxes will remain.

I want to be able to script the changes: Wondering if my approach of editing the translog.taxrates table would be effective?
UPDATE translog.taxrates SET rate = rate - 0.04 WHERE id IN(1,2); Does editing this table require rebuilding any views in order for the changes to take effect? like lttsubtotals, others? Is there an API call I can use to specifically target an individualy table / view to get dropped and rebuilt after editing taxrates?

@gohanman

gohanman commented 9 years ago

Unfortunately the answer is it depends. Since Aug. 15, 2013 (or v. 0.9.0) taxes are calculated dynamically based on the current values of translog.taxrates. Prior to that they were encoded into lttsummary / lttsubtotals / subtotals views and those would need to be dropped and re-generated.

You're basically looking for this: using Database::LineItemTaxes instead of the values returned by select * from subtotals. https://github.com/CORE-POS/IS4C/blob/master/pos/is4c-nf/lib/Database.php#L243-L261

If their code base includes these lines or something similar, what you're suggesting will work fine. If not, the views do have to be rebuilt. There are functions in pos/is4c-nf/install/buildLTTViews.php that will do this but they're not attached to any API class. You'd have to piece together a PHP script to include the file and call the function.

joelbrock commented 9 years ago

that is all soooo helpful! thank you!! Sounds like either way, what I want to do is do-able. I'll just need to explore their code to figure out which approach i'll need to use.