v 13.1.0
I am a new user; some experience in programming; including SQL.
In New Zealand a manfacturer of alcohol products must pay ‘excise tax’ to the govt Customs Dept. This is exclusive of GST (aka VAT). The tax is paid periodically. We must account for the tax when product exits our premisis.
The tax is a fixed rate. for example, the tax on 1 litre of vodka is $55.777. The tax is calculated as [rate] x [alcohol percentage of product] x [product size in mils]. So for example, a 750ml bottle of 40ABV vodka will be $57.777 x .40 x.750 =$16.73.
I would like to specifiy the tax as a calculated field in applicable products records in the product table and be able to recall and total that field to calculate the payment of excise tax.
I am struggling to find a work-around or solution. Can anyone help with this please?
Kind regards
Richard
Ok… so I’ve created a two new complementary attributes in the products module setup; called excise tax (price) and ABV (float 4.2). This is a computed field. So now I want to reference the volume field with my two new fields; to make the formula var = [excise_tax] * [vol] * [abv]. Can someone help me out with coding this because I am unsure how to reference the fields. It seems to be $object-> id … but I can’t find id’s for the data fields?
Further progress. I can use the standard fields (for example - ‘volume’ by referencing $object->volume. But I cannot seem to reference a complimentary attribute in my formuala. For example: $object-> volume * $object.abv does not work. $object->volume * $object->array_options[options_ex_rate] does not work either. Can anyone give me help with referencing a complimentary attribute in a computed field?
SOLVED: $object->volume * $object->array_options[‘options_abv’] * $object->array_options[‘options_ex_rate’]
WARNING; Do not make my mistake of working between two browser tabs to modify setup and check results on a sample record… does not work