- # parsing
- for $i (1 .. $form->{rowcount}) {
- $form->{"amount_$i"} = $form->round_amount($form->parse_amount($myconfig, $form->{"amount_$i"}) * $form->{exchangerate}, 2);
- $form->{amount} += $form->{"amount_$i"};
- $form->{"tax_$i"} = $form->parse_amount($myconfig, $form->{"tax_$i"});
- }
-
- # this is for ar
- $form->{tax} = 0;
- $form->{netamount} = 0;
- $form->{total_tax} = 0;
-
- # taxincluded doesn't make sense if there is no amount
- $form->{taxincluded} = 0 unless $form->{amount};
-
- for $i (1 .. $form->{rowcount}) {
- ($form->{"tax_id_$i"}) = split /--/, $form->{"taxchart_$i"};
-
- $query = qq|SELECT c.accno, t.taxkey, t.rate FROM tax t LEFT JOIN chart c ON (c.id = t.chart_id) WHERE t.id = ? ORDER BY c.accno|;
- ($form->{AR_amounts}{"tax_$i"}, $form->{"taxkey_$i"}, $form->{"taxrate_$i"}) = selectrow_query($form, $dbh, $query, $form->{"tax_id_$i"});