+my $total = $input->param('total') || '';
+if ( $check == 0 ) {
+ if ( $total ne '' ) {
+ recordpayment( $borrowernumber, $total );
+ }
+
+ my ( $total, $accts, $numaccts) = GetMemberAccountRecords( $borrowernumber );
+
+ my @allfile;
+ my @notify = NumberNotifyId($borrowernumber);
+
+ my $numberofnotify = scalar(@notify);
+ for ( my $j = 0 ; $j < scalar(@notify) ; $j++ ) {
+ my @loop_pay;
+ my ( $total , $accts, $numaccts) =
+ GetBorNotifyAcctRecord( $borrowernumber, $notify[$j] );
+ for ( my $i = 0 ; $i < $numaccts ; $i++ ) {
+ my %line;
+ if ( $accts->[$i]{'amountoutstanding'} != 0 ) {
+ $accts->[$i]{'amount'} += 0.00;
+ $accts->[$i]{'amountoutstanding'} += 0.00;
+ $line{i} = $j . "" . $i;
+ $line{itemnumber} = $accts->[$i]{'itemnumber'};
+ $line{accounttype} = $accts->[$i]{'accounttype'};
+ $line{amount} = sprintf( "%.2f", $accts->[$i]{'amount'} );
+ $line{amountoutstanding} =
+ sprintf( "%.2f", $accts->[$i]{'amountoutstanding'} );
+ $line{borrowernumber} = $borrowernumber;
+ $line{accountno} = $accts->[$i]{'accountno'};
+ $line{description} = $accts->[$i]{'description'};
+ $line{note} = $accts->[$i]{'note'};
+ $line{title} = $accts->[$i]{'title'};
+ $line{notify_id} = $accts->[$i]{'notify_id'};
+ $line{notify_level} = $accts->[$i]{'notify_level'};
+ $line{net_balance} = 1 if($accts->[$i]{'amountoutstanding'} > 0); # you can't pay a credit.
+ push( @loop_pay, \%line );
+ }
+ }
+
+ my $totalnotify = AmountNotify( $notify[$j], $borrowernumber );
+ ( $totalnotify = '0' ) if ( $totalnotify =~ /^0.00/ );
+ push @allfile,
+ {
+ 'loop_pay' => \@loop_pay,
+ 'notify' => $notify[$j],
+ 'total' => sprintf( "%.2f",$totalnotify),
+
+ };
+ }