- my ($tmpnetamount, $tmptaxamount) = $form->calculate_tax($form->{"amount_$i"}, 0.19, $form->{taxincluded}, 2);
+ my $tax = SL::DB::Manager::Tax->get_first( where => [id => $form->{"tax_id_$i"}, '!reverse_charge_chart_id' => undef ]);
+ next unless ref $tax eq 'SL::DB::Tax';
+
+ # gl booking
+ my ($credit, $debit);
+ $credit = SL::DB::Manager::Chart->find_by(id => $tax->chart_id);
+ $debit = SL::DB::Manager::Chart->find_by(id => $tax->reverse_charge_chart_id);
+
+ croak("No such Chart ID" . $tax->chart_id) unless ref $credit eq 'SL::DB::Chart';
+ croak("No such Chart ID" . $tax->reverse_chart_id) unless ref $debit eq 'SL::DB::Chart';
+
+ my ($tmpnetamount, $tmptaxamount) = $form->calculate_tax($form->{"amount_$i"}, $tax->rate, $form->{taxincluded}, 2);