diff options
Diffstat (limited to 'httemplate/edit/process/quick-charge.cgi')
-rw-r--r-- | httemplate/edit/process/quick-charge.cgi | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/httemplate/edit/process/quick-charge.cgi b/httemplate/edit/process/quick-charge.cgi new file mode 100644 index 000000000..024a281e0 --- /dev/null +++ b/httemplate/edit/process/quick-charge.cgi @@ -0,0 +1,47 @@ +% +% my $error = ''; +% my $param = $cgi->Vars; +% +% my @description = (); +% for ( my $row = 0; exists($param->{"description$row"}); $row++ ) { +% push @description, $param->{"description$row"} +% if ($param->{"description$row"} =~ /\S/); +% } +% +% $param->{"custnum"} =~ /^(\d+)$/ +% or $error .= "Illegal customer number " . $param->{"custnum"} . " "; +% my $custnum = $1; +% +% $param->{"amount"} =~ /^\s*(\d+(\.\d{1,2})?)\s*$/ +% or $error .= "Illegal amount " . $param->{"amount"} . " "; +% my $amount = $1; +% +% if ( $param->{'taxclass'} eq '(select)' ) { +% $error .= "Must select a tax class. "; +% } +% +% unless ( $error ) { +% my $cust_main = qsearchs('cust_main', { 'custnum' => $custnum } ) +% or $error .= "Unknown customer number $custnum. "; +% +% $error ||= $cust_main->charge({ 'amount' => $amount, +% 'pkg' => $cgi->param('pkg'), +% 'taxclass' => $cgi->param('taxclass'), +% 'additional' => \@description, +% } +% ); +% } +% +% if ( $error ) { +% +% $cgi->param('error', "$error" ); +% +<% $cgi->redirect($p.'quick-charge.html?'. $cgi->query_string) %> +% +% } +<% header("One-time charge added") %> + <SCRIPT TYPE="text/javascript"> + window.top.location.reload(); + </SCRIPT> + </BODY></HTML> + |