& /elements/header.html, { title => 'Quick payment entry', etc => 'onload="preload()"' } &> <& /elements/error.html &> <% include('/elements/xmlhttp.html', 'url' => $p. 'misc/xmlhttp-cust_main-discount_terms.cgi', 'subs' => [qw( discount_terms )], ) %>
%if ( $cgi->param('error') ) { %} <% include('/elements/footer.html') %> <%init> die "access denied" unless $FS::CurrentUser::CurrentUser->access_right('Post payment batch'); my $conf = new FS::Conf; my $money_char = $conf->config('money_char') || '$'; my @header = ( 'Amount', 'Check #' ); my @fields = ( 'paid', 'payinfo' ); my @types = ( '', '' ); my @align = ( 'r', 'r' ); my @sizes = ( 8, 10 ); my @colors = ( '', '' ); my %param = (); my @footer = ( '_TOTAL', '' ); my @footer_align = ( 'r', 'r' ); my @onchange = ( '', '' );; my $use_discounts = ''; if ( FS::Record->scalar_sql('SELECT COUNT(*) FROM part_pkg_discount') ) { #push @header, 'Discount'; push @header, ''; push @fields, 'discount_term'; push @types, 'immutable'; push @align, 'r'; push @sizes, '0'; push @colors, ''; push @footer, ''; push @footer_align, ''; push @onchange, ''; $use_discounts = 'Y'; } push @header, 'Allocate'; push @fields, 'enable_app'; push @types, 'checkbox'; push @align, 'c'; push @sizes, '0'; push @colors, ''; push @footer, ''; push @footer_align, ''; push @onchange, 'toggle_application_row'; #push @header, 'Error'; push @header, ''; push @fields, 'error'; push @types, 'immutable'; push @align, 'l'; push @sizes, '0'; push @colors, '#ff0000'; push @footer, ''; push @footer_align, ''; push @onchange, ''; $m->comp('/elements/handle_uri_query'); # set up for preloading my @rows; my @row_errors; if ( $cgi->param('error') ) { my $param = $cgi->Vars; my $enum = 0; #errors numbered separately for( my $row = 0; exists($param->{"custnum$row"}); $row++ ) { $rows[$row] = []; $row_errors[$row] = $param->{"error$enum"}; $enum++; for( my $app = 0; exists($param->{"invnum$row.$app"}); $app++ ) { next if !$param->{"invnum$row.$app"}; my %this_app = map { $_ => ($param->{$_.$row.'.'.$app} || '') } qw( invnum amount ); $this_app{'error'} = $param->{"error$enum"} || ''; $param->{"error$enum"} = ''; # don't pass this error through $rows[$row][$app] = \%this_app; $enum++; } } for( my $row = 0; $row < @row_errors; $row++ ) { $param->{"error$row"} = $row_errors[$row]; } } #warn Dumper {rows => \@rows, row_errors => \@row_errors }; %init>