X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=httemplate%2Fmisc%2Fbatch-cust_pay.html;h=c5ed6d85280e7bb69e76b86cabaa505ab418d881;hb=f7e5e7625b04164ce2e0aac77a85bc03a7d48a6f;hp=505f2d0ff915856b7d0337150c1f312a1d0ba63f;hpb=fed83c5c6c86a9ab00bb30481f5bf3937910da54;p=freeside.git diff --git a/httemplate/misc/batch-cust_pay.html b/httemplate/misc/batch-cust_pay.html index 505f2d0ff..c5ed6d852 100644 --- a/httemplate/misc/batch-cust_pay.html +++ b/httemplate/misc/batch-cust_pay.html @@ -13,23 +13,63 @@ function warnUnload() { } } window.onbeforeunload = warnUnload; + +function select_discount_term(row, prefix) { + var custnum_obj = document.getElementById('custnum'+prefix+row); + var select_obj = document.getElementById('discount_term'+prefix+row); + + var value = ''; + if (select_obj.type == 'hidden') { + value = select_obj.value; + } + + var term_select = document.createElement('SELECT'); + term_select.setAttribute('name', 'discount_term'+row); + term_select.setAttribute('id', 'discount_term'+row); + term_select.setAttribute('rownum', row); + term_select.style.display = ''; + select_obj.parentNode.replaceChild(term_select, select_obj); + opt(term_select, '', '1 month'); + + function select_discount_term_update(discount_terms) { + + var termArray = eval('(' + discount_terms + ')'); + for ( var t = 0; t < termArray.length; t++ ) { + opt(term_select, termArray[t][0], termArray[t][1]); + if (termArray[t][0] == value) { + term_select.selectedIndex = t+1; + } + } + + } + + discount_terms(custnum_obj.value, select_discount_term_update); + +} +<% include('/elements/xmlhttp.html', + 'url' => $p. 'misc/xmlhttp-cust_main-discount_terms.cgi', + 'subs' => [qw( discount_terms )], + ) +%> +
<% include( "/elements/customer-table.html", name_singular => 'payment', - header => [ '', 'Amount', 'Check #', '' ], - fields => [ sub {'$'}, 'paid', 'payinfo', 'error', ], - types => [ 'immutable', '', '', 'immutable', ], - align => [ 'c', 'r', 'r', 'l' ], - sizes => [ 0, 8, 10, 0, ], - colors => [ '', '', '', '#ff0000' ], - param => { () }, - footer => [ '$', '_TOTAL', '', '' ], - footer_align => [ 'c', 'r', 'r', '' ], + header => \@header, + fields => \@fields, + types => \@types, + align => \@align, + sizes => \@sizes, + colors => \@colors, + param => \%param, + footer => \@footer, + footer_align => \@footer_align, + custnum_update_callback => $custnum_update_callback, ) %> @@ -41,6 +81,14 @@ window.onbeforeunload = warnUnload;
+%if ( $cgi->param('error') ) { + +%} + <% include('/elements/footer.html') %> <%init> @@ -48,4 +96,38 @@ window.onbeforeunload = warnUnload; die "access denied" unless $FS::CurrentUser::CurrentUser->access_right('Post payment batch'); +my @header = ( '', 'Amount', 'Check #' ); +my @fields = ( sub {'$'}, 'paid', 'payinfo' ); +my @types = ( 'immutable', '', '' ); +my @align = ( 'c', 'r', 'r' ); +my @sizes = ( 0, 8, 10 ); +my @colors = ( '', '', '' ); +my %param = (); +my @footer = ( '$', '_TOTAL', '' ); +my @footer_align = ( 'c', 'r', 'r' ); +my $custnum_update_callback = ''; + +if ( FS::Record->scalar_sql('SELECT COUNT(*) FROM part_pkg_discount') ) { + push @header, ''; + push @fields, 'discount_term'; + push @types, 'immutable'; + push @align, 'r'; + push @sizes, '0'; + push @colors, ''; + push @footer, ''; + push @footer_align, ''; + $custnum_update_callback = 'select_discount_term'; +} + +push @header, ''; +push @fields, 'error'; +push @types, 'immutable'; +push @align, 'l'; +push @sizes, '0'; +push @colors, '#ff0000'; +push @footer, ''; +push @footer_align, ''; + +$m->comp('/elements/handle_uri_query'); +