- # check if debit and credit balances
- for $i (1 .. $form->{rowcount}) {
- if ($form->{"debit_$i"} && $form->{"credit_$i"}) {
- return -1;
- }
-
- $form->{"debit_$i"} = $form->parse_amount($myconfig, $form->{"debit_$i"});
- $form->{"credit_$i"} = $form->parse_amount($myconfig, $form->{"credit_$i"});
-
- $debit += $form->{"debit_$i"};
- $credit += $form->{"credit_$i"};
- }
-
- $debit = $form->round_amount($debit, 2);
- $credit = $form->round_amount($credit, 2);
-
- if ($debit != $credit) {
- return -2;
- }