1 <% include('/elements/header.html', 'Quick payment entry') %>
3 <% include('/elements/error.html') %>
5 <SCRIPT TYPE="text/javascript">
6 function warnUnload() {
7 if(document.getElementById("OneTrueTable").rows.length > 3 &&
8 !document.OneTrueForm.btnsubmit.disabled) {
9 return "The current batch will be lost.";
15 window.onbeforeunload = warnUnload;
17 function select_discount_term(row, prefix) {
18 var custnum_obj = document.getElementById('custnum'+prefix+row);
19 var select_obj = document.getElementById('discount_term'+prefix+row);
22 if (select_obj.type == 'hidden') {
23 value = select_obj.value;
26 var term_select = document.createElement('SELECT');
27 term_select.setAttribute('name', 'discount_term'+row);
28 term_select.setAttribute('id', 'discount_term'+row);
29 term_select.setAttribute('rownum', row);
30 term_select.style.display = '';
31 select_obj.parentNode.replaceChild(term_select, select_obj);
32 opt(term_select, '', '1 month');
34 function select_discount_term_update(discount_terms) {
36 var termArray = eval('(' + discount_terms + ')');
37 for ( var t = 0; t < termArray.length; t++ ) {
38 opt(term_select, termArray[t][0], termArray[t][1]);
39 if (termArray[t][0] == value) {
40 term_select.selectedIndex = t+1;
46 discount_terms(custnum_obj.value, select_discount_term_update);
51 <% include('/elements/xmlhttp.html',
52 'url' => $p. 'misc/xmlhttp-cust_main-discount_terms.cgi',
53 'subs' => [qw( discount_terms )],
57 <FORM ACTION="process/batch-cust_pay.cgi" NAME="OneTrueForm" METHOD="POST" onsubmit="document.OneTrueForm.btnsubmit.disabled=true;window.onbeforeunload = null;">
59 <!-- <B>Batch</B> <INPUT TYPE="text" NAME="paybatch"><BR><BR> -->
61 <% include( "/elements/customer-table.html",
62 name_singular => 'payment',
71 footer_align => \@footer_align,
72 custnum_update_callback => $custnum_update_callback,
77 <INPUT TYPE="button" VALUE="Post payment batch" name="btnsubmit" onclick="window.onbeforeunload = null; document.OneTrueForm.submit(); this.disabled = true;">
81 %if ( $cgi->param('error') ) {
82 <SCRIPT TYPE="text/javascript">
83 % for ( my $row = 0; defined($cgi->param("custnum$row")); $row++ ) {
84 select_discount_term(<% $row %>, '');
89 <% include('/elements/footer.html') %>
94 unless $FS::CurrentUser::CurrentUser->access_right('Post payment batch');
96 my $conf = new FS::Conf;
97 my $money_char = $conf->config('money_char') || '$';
99 my @header = ( '', 'Amount', 'Check #' );
100 my @fields = ( sub { "$money_char" }, 'paid', 'payinfo' );
101 my @types = ( 'immutable', '', '' );
102 my @align = ( 'c', 'r', 'r' );
103 my @sizes = ( 0, 8, 10 );
104 my @colors = ( '', '', '' );
106 my @footer = ( "$money_char", '_TOTAL', '' );
107 my @footer_align = ( 'c', 'r', 'r' );
108 my $custnum_update_callback = '';
110 if ( FS::Record->scalar_sql('SELECT COUNT(*) FROM part_pkg_discount') ) {
112 push @fields, 'discount_term';
113 push @types, 'immutable';
118 push @footer_align, '';
119 $custnum_update_callback = 'select_discount_term';
123 push @fields, 'error';
124 push @types, 'immutable';
127 push @colors, '#ff0000';
129 push @footer_align, '';
131 $m->comp('/elements/handle_uri_query');