Maya Jewlery original code for basketcharge_insert
<mvt:if expr="s.remote_addr EQ '207.114.171.26'">
<!-- Check if customer is from CA -->
<!-- &mvt:global:ShipState; / &mvt:global:basket:ship_state; / &mvt:global:basket:subtotal; -->
<mvt:if expr="(g.ShipState EQ 'CA') OR (g.basket:ship_state EQ 'CA') OR ('RDMCPN' CIN g.Action AND g.basket:ship_state EQ 'CA') OR ('REDEEMCERT' CIN g.Action AND g.basket:ship_state EQ 'CA')">
<!-- wholesale account check -->
<mvt:item name="toolkit" param="agroup|acount" />
<mvt:if expr="g.acount GT 0">
<mvt:foreach iterator="customer_agroup" array="customer_agroups">
<mvt:if expr="l.settings:customer_agroup:name EQ 'Wholesale'">
<mvt:item name="toolkit" param="sassign|availWholesaleCheck|1" />
</mvt:if>
</mvt:foreach>
</mvt:if>
<mvt:item name="toolkit" param="pgroup|pcount" />
<mvt:if expr="g.pcount GT 0">
<mvt:foreach iterator="customer_pgroup" array="customer_pgroups">
<mvt:if expr="l.settings:customer_pgroup:name EQ 'Wholesale'">
<mvt:item name="toolkit" param="sassign|pgroupWholesaleCheck|1" />
</mvt:if>
</mvt:foreach>
</mvt:if>
<!-- Availability Check: &mvt:global:availWholesaleCheck; / Price Group Check: &mvt:global:pgroupWholesaleCheck; -->
<mvt:if expr="g.availWholesaleCheck EQ '1' OR pgroupWholesaleCheck EQ '1'">
<mvt:else>
<mvt:assign name="l.basketcharge:basket_id" value="g.basket:basket_id" />
<mvt:assign name="l.basketcharge:module_id" value="l.settings:store:tax_mod:id" />
<mvt:assign name="l.basketcharge:type" value="'TAX'" />
<mvt:assign name="l.basketcharge:descrip" value="'CA Sales Tax'" />
<mvt:assign name="l.basketcharge:amount" value="g.basket:subtotal * 0.0875" />
<mvt:assign name="l.basketcharge:disp_amt" value="g.basket:subtotal * 0.0875" />
<mvt:assign name="l.basketcharge:tax_exempt" value="0" />
<mvt:do file="g.Module_Library_DB" name="g.null" value="BasketCharge_Insert( l.basketcharge )" />
</mvt:if>
</mvt:if>
</mvt:if>
<!-- Serailize an array and print to page -->
<mvt:assign name="g.var" value="miva_array_serialize(l.settings:basket:charges)" />
<!-- @@ &mvt:global:var; -->
<!-- @@ &mvt:global:null; -->
OPAY*******************
<mvt:if expr="s.remote_addr EQ '207.114.171.26'">
<mvt:assign name="l.settings:query:query" value="'SELECT * FROM s01_BasketCharges where basket_id = ' $ g.basket:basket_id $' AND type = \'TAX\''" />
<mvt:item name="sql" param="l.settings:query" />
<mvt:assign name="l.basketcharge:basket_id" value="l.settings:query:results[1]:basket_id " />
<mvt:assign name="l.basketcharge:charge_id " value="l.settings:query:results[1]:charge_id " />
<mvt:assign name="l.basketcharge:module_id " value="l.settings:query:results[1]:module_id " />
<mvt:assign name="l.basketcharge:type" value="l.settings:query:results[1]:type " />
<mvt:assign name="l.basketcharge:descrip" value="l.settings:query:results[1]:descrip " />
<mvt:assign name="l.basketcharge:amount" value="g.basket:subtotal * 0.0875" />
<mvt:assign name="l.basketcharge:disp_amt" value="g.basket:subtotal * 0.0875" />
<mvt:assign name="l.basketcharge:tax_exempt" value="0" />
<mvt:do file="g.Module_Library_DB" name="g.null" value="BasketCharge_Update( l.basketcharge )" />
</mvt:if>