+/*
+ Main tax procedure splitting transaction item value according to item tax rules applicable:
+ $amount - price/value to be splitted
+ $tax_group - entity tax group
+ $tax_included - whether value includes all taxes
+ $vat_factor - 0-1; tax deduction factor (purchases, not used for now; depends on whthere it is related to exempt or taxed sales)
+ $allow_reverse - option for invoice - whether to honour reverse charging (depends on customer tax status)
+
+ Returned array contains calculated values for GL postings and tax registration:
+ 'Net' - value without tax,
+ 'Tax' - tax sum,
+ 'Cost' - cost value (can be higher then Net value),
+ 'vat_category' - stock tax category
+
+ and (with numeric keys) detailed info for any applicable tax rate:
+ 'tax_type_id' - tax type id
+ 'Value' - charged tax value
+ 'Deductible' - tax deductible (can be lower than Value for special goods or mixed sales structure)
+ 'Payable' - tax payable
+ 'Adjust' - additional adjustment to deductible tax due to sales structure factor
+ 'rate' - tax rate
+ 'sales_gl_code' - sales tax GL account
+ 'purchasing_gl_code' - purchase tax GL account
+ 'tax_type_name' - name of tax type
+
+ Price value is splitted as follows:
+ Tax: sum of Value (for applicable taxes)
+ Net: amount - Tax
+ Cost: Net + sum(Payable-Deductible)
+ for every applicable tax rate:
+ Value: tax calculated or 0
+ Deductible: vat_factor*Value or 0
+ Adjust: Value-Deductible or 0
+ Payable: 0 or Value
+*/
+function split_item_price($stock_id, $amount, $group_id, $tax_included=false, $trans_type=ST_SUPPINVOICE, $vat_factor = 1,
+ $allow_reverse=true)