5 include( '/elements/customer-table.html',
12 'header' => [ '#', 'Item' ],
15 sub { my ($row,$param) = @_;
16 $param->{"column$row"};
24 'name_singular' => 'customer', #label
25 'custnum_update_callback' => 'name_of_js_callback' #passed a rownum
28 'types' => ['immutable', ''], # immutable or ''/text
29 'align' => [ 'c', 'l', 'r', '' ],
30 'size' => [], # sizes ignored for immutable
32 'footer' => ['string', '_TOTAL'], # strings or the special
34 'footer_align' => [ 'c', 'l', 'r', '' ],
36 'param' => { column0 => 1 }, # preset column of row 0 to 1
42 <SCRIPT TYPE="text/javascript">
44 var num_open_invoices = new Array;
46 function clearhint_invnum() {
48 if ( this.value == 'Not found' || this.value == 'Multiple' ) {
50 this.style.color = '#000000';
55 function clearhint_custnum() {
57 if ( this.value == 'Not found' || this.value == 'Multiple' ) {
59 this.style.color = '#000000';
64 function clearhint_customer() {
66 this.style.color = '#000000';
68 if ( this.value == '(last name or company)' || this.value == 'Not found' )
73 function update_customer(searchrow, customerArray) {
75 var custnum_obj = document.getElementById('custnum'+searchrow);
76 var customer = document.getElementById('customer'+searchrow);
77 var customer_select = document.getElementById('cust_select'+searchrow);
79 custnum_obj.disabled = false;
80 custnum_obj.style.backgroundColor = '#ffffff';
81 customer.disabled = false;
82 customer.style.backgroundColor = '#ffffff';
84 if ( customerArray.length == 0 ) {
86 custnum_obj.value = 'Not found';
87 customer.value = 'Not found';
88 custnum_obj.style.color = '#ff0000';
89 customer.style.color = '#ff0000';
91 customer.style.display = '';
92 customer_select.style.display = 'none';
95 } else if ( customerArray.length == 6 ) {
97 custnum_obj.value = customerArray[0];
98 custnum_obj.style.color = '#000000';
99 customer.value = customerArray[1];
101 update_balance_text(searchrow, customerArray[2]);
102 update_status_text( searchrow, customerArray[3]);
103 update_status_color(searchrow, '#'+customerArray[4]);
104 update_num_open(searchrow, customerArray[5]);
106 customer.style.display = '';
107 customer_select.style.display = 'none';
112 function <% $opt{prefix} %>search_invnum() {
114 this.style.color = '#000000'
116 var invnum_obj = this;
117 var searchrow = this.getAttribute('rownum');
118 var invnum = this.value;
120 if ( invnum == 'searching...' || invnum == 'Not found' || invnum == '' )
123 if ( this.getAttribute('magic') == 'nosearch' ) {
124 this.setAttribute('magic', '');
128 if ( ( <% $opt{prefix} %>rownum - searchrow ) == 1 ) {
129 <% $opt{prefix} %>addRow();
131 var customer = document.getElementById('customer'+searchrow);
132 customer.value = 'searching...';
133 customer.disabled = true;
134 customer.style.color = '#000000';
135 customer.style.backgroundColor = '#dddddd';
137 var customer_select = document.getElementById('cust_select'+searchrow);
139 customer.style.display = '';
140 customer_select.style.display = 'none';
142 var custnum_obj = document.getElementById('custnum'+searchrow);
143 update_balance_text(searchrow, '');
144 update_status_text(searchrow, '');
145 update_status_color(searchrow, '#000000');
146 update_num_open(searchrow, 0);
148 function search_invnum_update(customers) {
150 var customerArray = eval('(' + customers + ')');
151 update_customer(searchrow, customerArray);
153 % if ( $opt{invnum_update_callback} ) {
154 <% $opt{invnum_update_callback} %>(searchrow, '<% $opt{prefix} %>')
159 invnum_search( invnum, search_invnum_update );
163 function <% $opt{prefix} %>search_custnum() {
165 this.style.color = '#000000'
167 var custnum_obj = this;
168 var searchrow = this.getAttribute('rownum');
169 var custnum = this.value;
171 if ( custnum == 'searching...' || custnum == 'Not found' || custnum == '' )
174 if ( this.getAttribute('magic') == 'nosearch' ) {
175 this.setAttribute('magic', '');
179 if ( ( <% $opt{prefix} %>rownum - searchrow ) == 1 ) {
180 <% $opt{prefix} %>addRow();
183 var customer_obj = document.getElementById('customer'+searchrow);
184 customer_obj.value = 'searching...';
185 customer_obj.disabled = true;
186 customer_obj.style.color = '#000000';
187 customer_obj.style.backgroundColor = '#dddddd';
189 var customer_select = document.getElementById('cust_select'+searchrow);
191 customer_obj.style.display = '';
192 customer_select.style.display = 'none';
194 var invnum = document.getElementById('invnum'+searchrow);
197 update_balance_text(searchrow, '');
198 update_status_text( searchrow, '');
199 update_status_color(searchrow, '#000000');
200 update_num_open(searchrow, 0);
202 function search_custnum_update(customers) {
204 var customerArrayArray = eval('(' + customers + ')') || [];
206 if ( customerArrayArray.length == 0 ) {
208 update_customer(searchrow, []);
210 } else if ( customerArrayArray.length == 1 ) {
212 update_customer(searchrow, customerArrayArray[0]);
213 % if ( $opt{custnum_update_callback} ) {
214 <% $opt{custnum_update_callback} %>(searchrow, '<% $opt{prefix} %>')
219 custnum_obj.value = 'Multiple'; // or something
220 custnum_obj.style.color = '#ff0000';
222 //blank the current list
223 customer_select.options.length = 0;
225 opt(customer_select, '', 'Multiple customers match "' + custnum + '" - select one', '#ff0000');
226 //add the multiple customers
227 for ( var s = 0; s < customerArrayArray.length; s++ ) {
229 JSON.stringify(customerArrayArray[s]),
230 customerArrayArray[s][1],
234 opt(customer_select, 'cancel', '(Edit search string)', '#000000');
236 customer_obj.style.display = 'none';
238 customer_select.style.display = '';
244 custnum_search(custnum, search_custnum_update );
248 function <% $opt{prefix} %>search_customer() {
250 var customer_obj = this;
251 var searchrow = this.getAttribute('rownum');
252 var customer = this.value;
254 if ( customer == 'searching...' || customer == 'Not found' || customer == '' )
257 if ( this.getAttribute('magic') == 'nosearch' ) {
258 this.setAttribute('magic', '');
262 if ( ( <% $opt{prefix} %>rownum - searchrow ) == 1 ) {
263 <% $opt{prefix} %>addRow();
266 var invnum = document.getElementById('invnum'+searchrow);
269 var custnum_obj = document.getElementById('custnum'+searchrow);
270 custnum_obj.value = 'searching...';
271 custnum_obj.disabled = true;
272 custnum_obj.style.color = '#000000';
273 custnum_obj.style.backgroundColor = '#dddddd';
275 var customer_select = document.getElementById('cust_select'+searchrow);
277 function search_customer_update(customers) {
279 var customerArrayArray = eval('(' + customers + ')') || [ [] ];
281 custnum_obj.disabled = false;
282 custnum_obj.style.backgroundColor = '#ffffff';
284 if ( customerArrayArray.length == 0 ) {
286 update_customer(searchrow, []);
288 } else if ( customerArrayArray.length == 1 ) {
290 update_customer(searchrow, customerArrayArray[0]);
291 % if ( $opt{custnum_update_callback} ) {
292 <% $opt{custnum_update_callback} %>(searchrow, '<% $opt{prefix} %>')
297 custnum_obj.value = 'Multiple'; // or something
298 custnum_obj.style.color = '#ff0000';
300 //blank the current list
301 customer_select.options.length = 0;
303 opt(customer_select, '', 'Multiple customers match "' + customer + '" - select one', '#ff0000');
304 //add the multiple customers
305 for ( var s = 0; s < customerArrayArray.length; s++ ) {
307 JSON.stringify(customerArrayArray[s]),
308 customerArrayArray[s][1],
312 opt(customer_select, 'cancel', '(Edit search string)', '#000000');
314 customer_obj.style.display = 'none';
316 customer_select.style.display = '';
322 smart_search( customer, search_customer_update );
326 function select_customer() {
328 var custnum_balance_status = this.options[this.selectedIndex].value;
329 var customer = this.options[this.selectedIndex].text;
331 var searchrow = this.getAttribute('rownum');
332 var custnum_obj = document.getElementById('custnum'+searchrow);
333 var customer_obj = document.getElementById('customer'+searchrow);
334 var balance_obj = document.getElementById('balance'+searchrow);
335 var status_obj = document.getElementById('status'+searchrow);
337 if ( custnum_balance_status == '' ) {
339 } else if ( custnum_balance_status == 'cancel' ) {
341 custnum_obj.value = '';
342 custnum_obj.style.color = '#000000';
344 this.style.display = 'none';
345 customer_obj.style.display = '';
346 customer_obj.focus();
350 update_customer(searchrow, JSON.parse(custnum_balance_status));
352 % if ( $opt{custnum_update_callback} ) {
353 <% $opt{custnum_update_callback} %>(searchrow, '<% $opt{prefix} %>')
360 function opt(what,value,text,color) {
361 var optionName = new Option(text, value, false, false);
362 optionName.style.color = color;
363 var length = what.length;
364 what.options[length] = optionName;
367 function update_status_text(rownum, newval) {
368 document.getElementById('status'+rownum).value = newval;
369 document.getElementById('status'+rownum+'_text').innerHTML = newval;
372 function update_status_color(rownum, newval) {
373 document.getElementById('statuscolor'+rownum).value = newval;
374 document.getElementById('status'+rownum+'_text').style.color = newval;
377 function update_balance_text(rownum, newval) {
378 document.getElementById('balance'+rownum).value = newval;
379 document.getElementById('balance'+rownum+'_text').innerHTML = newval;
382 function update_num_open(rownum, newval) {
383 num_open_invoices[rownum] = newval;
389 <TABLE ID="<% $opt{prefix} %>OneTrueTable" BGCOLOR="#cccccc" BORDER=0 CELLSPACING=0>
397 % foreach my $header ( @{$opt{header}} ) {
398 <TH><% $header %></TH>
402 % for ( $row = 0; exists($param->{"custnum$row"}); $row++ ) {
404 <TR id="row<%$row%>" rownum="<%$row%>">
407 NAME = "invnum<% $row %>"
408 ID = "invnum<% $row %>"
411 STYLE = "text-align:right;"
412 VALUE = "<% $param->{"invnum$row"} %>"
413 rownum = "<% $row %>"
415 <SCRIPT TYPE="text/javascript">
416 var invnum_input<% $row %> = document.getElementById("invnum<% $row %>");
417 invnum_input<% $row %>.onfocus = clearhint_invnum;
418 invnum_input<% $row %>.onchange = <% $opt{prefix} %>search_invnum;
424 NAME = "custnum<% $row %>"
425 ID = "custnum<% $row %>"
428 STYLE = "text-align:right;"
429 VALUE = "<% $param->{"custnum$row"} %>"
430 rownum = "<% $row %>"
432 <SCRIPT TYPE="text/javascript">
433 var custnum_input<% $row %> = document.getElementById("custnum<% $row %>");
434 custnum_input<% $row %>.onfocus = clearhint_custnum;
435 custnum_input<% $row %>.onchange = <% $opt{prefix} %>search_custnum;
439 <TD STYLE="text-align: center">
441 ID = "status<% $row %>_text"
442 rownum = "<% $row %>"
443 STYLE = "font-weight: bold;
444 color: <%$param->{"statuscolor$row"} || '#000000'%>"
446 ><% $param->{"status$row"} %></SPAN>
447 <INPUT TYPE = "hidden"
448 NAME = "status<% $row %>"
449 ID = "status<% $row %>"
450 VALUE = "<% $param->{"status$row"} %>"
451 rownum = "<% $row %>"
453 <INPUT TYPE = "hidden"
454 NAME = "statuscolor<% $row %>"
455 ID = "statuscolor<% $row %>"
456 VALUE = "<% $param->{"statuscolor$row"} %>"
457 rownum = "<% $row %>"
462 <INPUT TYPE="text" NAME="customer<% $row %>" ID="customer<% $row %>" SIZE=64 VALUE="<% $param->{"customer$row"} %>" rownum="<% $row %>">
463 <SCRIPT TYPE="text/javascript">
464 var customer_input<% $row %> = document.getElementById("customer<% $row %>");
465 customer_input<% $row %>.onfocus = clearhint_customer;
466 customer_input<% $row %>.onclick = clearhint_customer;
467 customer_input<% $row %>.onchange = <% $opt{prefix} %>search_customer;
469 <SELECT NAME="cust_select<% $row %>" ID="cust_select<% $row %>" rownum="<% $row %>" STYLE="color:#ff0000; display:none">
471 <SCRIPT TYPE="text/javascript">
472 var customer_select<% $row %> = document.getElementById("cust_select<% $row %>");
473 customer_select<% $row %>.onchange = select_customer;
477 <TD STYLE="text-align:right">
480 ID = "balance<% $row %>_text"
481 rownum = "<% $row %>"
482 ><% $param->{"balance$row"} %></SPAN>
484 <INPUT TYPE = "hidden"
485 NAME = "balance<% $row %>"
486 ID = "balance<% $row %>"
487 VALUE = "<% $param->{"balance$row"} %>"
488 rownum = "<% $row %>"
493 % foreach my $field ( @{$opt{fields}} ) {
495 % if ( ref($field) eq 'CODE' ) {
496 % $value = &{$field}($row,$param);
498 % $value = $param->{"$field$row"};
500 % my $name = (ref($field) eq 'CODE') ? "column${col}_$row" : "$field$row";
501 % my $align = $align{ $opt{align}->[$col] || 'l' };
502 % my $size = $sizes->[$col] || 10;
503 % my $color = $opt{color}->[$col];
504 % my $font = $color ? qq(<FONT COLOR="$color">) : '';
506 % if ( $opt{onchange}->[$col] ) {
507 % $onchange = 'onchange="'.$opt{onchange}->[$col].'"';
509 % elsif ( $opt{footer}->[$col] eq '_TOTAL' ) {
510 % $total[$col] += $value;
511 % $onchange = $opt{prefix}. "calc_total$col();";
512 % $onchange = qq(onchange="$onchange" onkeyup="$onchange");
514 <TD ALIGN="<% $align %>">
515 % my $type = $types->[$col] || 'text';
516 % if ($type eq 'text' or $type eq 'checkbox') {
517 <INPUT TYPE = "<% $type %>"
521 STYLE = "text-align: <% $align %>;"
522 VALUE = "<% $value %>"
523 rownum = "<% $row %>"
526 % } elsif ($types->[$col] eq 'immutable') {
527 <% $font %><% $value %><% $font ? '</FONT>' : '' %>
528 <INPUT TYPE="hidden" ID="<% $name %>" NAME="<% $name %>" VALUE="<% $value %>" >
530 Cannot represent unknown type: <% $types->[$col] %>
539 <TH COLSPAN=5 ID="<% $opt{'prefix'} %>_TOTAL_TOTAL">
540 Total <% $row ? $row-1 : 0 %>
541 <% PL($opt{name_singular} || 'customer', ( $row ? $row-1 : 0 ) ) %>
544 % foreach my $footer ( @{$opt{footer}} ) {
545 % my $align = $align{ $opt{'footer_align'}->[$col] || 'c' };
546 % if ($footer eq '_TOTAL' ) {
547 % my $id = $opt{'fields'}->[$col];
548 % $id = ref($id) ? "column${col}_TOTAL" : "${id}_TOTAL";
549 <TH ALIGN="<% $align %>" ID="<% $id %>"> <% sprintf('%.2f', $total[$col] ) %></TH>
551 <TH ALIGN="<% $align %>"><% $footer %></TH>
559 <SCRIPT TYPE="text/javascript">
561 % foreach my $footer ( @{$opt{footer}} ) {
562 % if ($footer eq '_TOTAL' ) {
563 % my $name = $opt{fields}->[$col];
564 % $name = ref($name) ? "column$col" : $name;
565 var <% $opt{prefix}.$name %>_CACHE = new Array ();
566 var <% $opt{prefix} %>th_el = document.getElementById("<%$name%>_TOTAL");
567 function <% $opt{prefix} %>calc_total<% $col %>() {
572 ( <% $opt{prefix}.$name%>_CACHE[row] =
573 <% $opt{prefix}.$name%>_CACHE[row]
574 || document.getElementById("<%$name%>"+row)
580 var value = <%$name%>_CACHE[row].value;
581 value = parseFloat(value);
582 if ( ! isNaN(value) ) {
583 total = total + value;
586 <% $opt{prefix} %>th_el.innerHTML = ' ' + total.toFixed(2);
594 <% include('/elements/xmlhttp.html',
595 'url' => $p. 'misc/xmlhttp-cust_main-search.cgi',
596 'subs' => [qw( custnum_search smart_search invnum_search )],
600 <SCRIPT TYPE="text/javascript">
602 var <% $opt{prefix} %>total_el =
603 document.getElementById("<% $opt{'prefix'} %>_TOTAL_TOTAL");
605 var <% $opt{prefix} %>rownum = <% $row %>;
607 function <% $opt{prefix} %>addRow() {
609 var table = document.getElementById('<% $opt{prefix} %>OneTrueTable');
610 var tablebody = table.getElementsByTagName('tbody').item(0);
612 var row = table.insertRow(table.rows.length - 1);
613 row.setAttribute('id', 'row'+rownum);
615 var invnum_cell = document.createElement('TD');
617 var invnum_input = document.createElement('INPUT');
618 invnum_input.setAttribute('name', 'invnum'+<% $opt{prefix} %>rownum);
619 invnum_input.setAttribute('id', 'invnum'+<% $opt{prefix} %>rownum);
620 invnum_input.style.textAlign = 'right';
621 invnum_input.setAttribute('size', 8);
622 invnum_input.setAttribute('maxlength', 12);
623 invnum_input.setAttribute('rownum', <% $opt{prefix} %>rownum);
624 invnum_input.onfocus = clearhint_invnum;
625 invnum_input.onchange = <% $opt{prefix} %>search_invnum;
626 invnum_cell.appendChild(invnum_input);
628 row.appendChild(invnum_cell);
630 var custnum_cell = document.createElement('TD');
632 var custnum_input = document.createElement('INPUT');
633 custnum_input.setAttribute('name', 'custnum'+<% $opt{prefix} %>rownum);
634 custnum_input.setAttribute('id', 'custnum'+<% $opt{prefix} %>rownum);
635 custnum_input.style.textAlign = 'right';
636 custnum_input.setAttribute('size', 8);
637 custnum_input.setAttribute('maxlength', 12);
638 custnum_input.setAttribute('rownum', <% $opt{prefix} %>rownum);
639 custnum_input.onfocus = clearhint_custnum;
640 custnum_input.onchange = <% $opt{prefix} %>search_custnum;
641 custnum_cell.appendChild(custnum_input);
643 row.appendChild(custnum_cell);
645 var status_cell = document.createElement('TD');
646 status_cell.style.textAlign = 'center';
648 var status_span = document.createElement('SPAN');
649 status_span.setAttribute('id', 'status'+<% $opt{prefix} %>rownum+'_text');
650 status_span.style.fontWeight = 'bold';
651 status_span.setAttribute('rownum', <% $opt{prefix} %>rownum);
652 status_cell.appendChild(status_span);
654 var status_input = document.createElement('INPUT');
655 status_input.setAttribute('type', 'hidden');
656 status_input.setAttribute('name', 'status'+<% $opt{prefix} %>rownum);
657 status_input.setAttribute('id', 'status'+<% $opt{prefix} %>rownum);
658 status_input.setAttribute('rownum', <% $opt{prefix} %>rownum);
659 status_cell.appendChild(status_input);
661 var statuscolor_input = document.createElement('INPUT');
662 statuscolor_input.setAttribute('type', 'hidden');
663 statuscolor_input.setAttribute('name', 'statuscolor'+<% $opt{prefix} %>rownum);
664 statuscolor_input.setAttribute('id', 'statuscolor'+<% $opt{prefix} %>rownum);
665 statuscolor_input.setAttribute('rownum', <% $opt{prefix} %>rownum);
666 status_cell.appendChild(statuscolor_input);
668 row.appendChild(status_cell);
670 var customer_cell = document.createElement('TD');
672 var customer_input = document.createElement('INPUT');
673 customer_input.setAttribute('name', 'customer'+<% $opt{prefix} %>rownum);
674 customer_input.setAttribute('id', 'customer'+<% $opt{prefix} %>rownum);
675 customer_input.setAttribute('size', 64);
676 customer_input.setAttribute('value', '(last name or company)' );
677 customer_input.setAttribute('rownum', <% $opt{prefix} %>rownum);
678 customer_input.onfocus = clearhint_customer;
679 customer_input.onclick = clearhint_customer;
680 customer_input.onchange = <% $opt{prefix} %>search_customer;
681 customer_cell.appendChild(customer_input);
683 var customer_select = document.createElement('SELECT');
684 customer_select.setAttribute('name', 'cust_select'+<% $opt{prefix} %>rownum);
685 customer_select.setAttribute('id', 'cust_select'+<% $opt{prefix} %>rownum);
686 customer_select.setAttribute('rownum', <% $opt{prefix} %>rownum);
687 customer_select.style.color = '#ff0000';
688 customer_select.style.display = 'none';
689 customer_select.onchange = select_customer;
690 customer_cell.appendChild(customer_select);
692 row.appendChild(customer_cell);
694 var balance_cell = document.createElement('TD');
696 balance_cell.style.textAlign = 'right';
697 balance_cell.appendChild(document.createTextNode('<%$money_char%>'));
699 var balance_span = document.createElement('SPAN');
700 balance_span.setAttribute('id', 'balance'+<% $opt{prefix} %>rownum+'_text');
701 balance_span.setAttribute('rownum', <% $opt{prefix} %>rownum);
702 balance_cell.appendChild(balance_span);
704 balance_cell.appendChild(
705 document.createTextNode(String.fromCharCode(160)) //
708 var balance_input = document.createElement('INPUT');
709 balance_input.setAttribute('type', 'hidden');
710 balance_input.setAttribute('name', 'balance'+<% $opt{prefix} %>rownum);
711 balance_input.setAttribute('id', 'balance'+<% $opt{prefix} %>rownum);
712 balance_input.setAttribute('rownum', <% $opt{prefix} %>rownum);
713 balance_cell.appendChild(balance_input);
715 row.appendChild(balance_cell);
718 % foreach my $field ( @{$opt{fields}} ) {
720 var my_cell = document.createElement('TD');
721 my_cell.setAttribute('align', '<% $align{ $opt{align}->[$col] || 'l' } %>');
723 % if ($types->[$col] eq 'immutable') {
725 % if ( ref($field) eq 'CODE' ) {
726 % $value = &{$field}($row,$param);
728 % $value = $param->{"$field$row"};
730 var my_text = document.createTextNode(<% $value |js_string %>);
731 my_cell.appendChild(my_text);
734 % my $name = (ref($field) eq 'CODE') ? "column${col}_" : $field;
735 var my_input = document.createElement('INPUT');
736 my_input.setAttribute('name', '<% $name %>'+<% $opt{prefix} %>rownum);
737 my_input.setAttribute('id', '<% $name %>'+<% $opt{prefix} %>rownum);
738 my_input.style.textAlign = '<% $align{ $opt{align}->[$col] || 'l' } %>';
739 my_input.setAttribute('size', <% $sizes->[$col] || 10 %>);
740 my_input.setAttribute('rownum', <% $opt{prefix} %>rownum);
741 % if ( $types->[$col] eq 'immutable' ) {
742 my_input.setAttribute('type', 'hidden');
744 % elsif ( $types->[$col] eq 'checkbox' ) {
745 my_input.setAttribute('type', 'checkbox');
747 % if ( $opt{onchange}->[$col] ) {
748 my_input.onchange = <% $opt{onchange}->[$col] %>;
750 % elsif ( $opt{footer}->[$col] eq '_TOTAL' ) {
751 my_input.onchange = <% $opt{prefix} %>calc_total<%$col%>;
752 my_input.onkeyup = <% $opt{prefix} %>calc_total<%$col%>;
754 my_cell.appendChild(my_input);
756 row.appendChild(my_cell);
761 //update the total # of rows display
762 if ( <% $opt{prefix} %>rownum == 1 ) {
763 <% $opt{prefix} %>total_el.innerHTML =
765 + <% $opt{prefix} %>rownum
766 + ' <% $opt{name_singular} || 'customer' %>';
768 <% $opt{prefix} %>total_el.innerHTML =
770 + <% $opt{prefix} %>rownum
771 + ' <% PL($opt{name_singular} || 'customer') %>';
774 % if ( $opt{add_row_callback} ) {
775 <% $opt{add_row_callback} %>(<% $opt{prefix} %>rownum,
776 '<% $opt{prefix} %>');
779 <% $opt{prefix} %>rownum++;
783 % unless ($cgi->param('error')) {
784 <% $opt{prefix} %>addRow();
791 my $conf = new FS::Conf;
793 $opt{prefix} = '' unless defined $opt{prefix};
794 $opt{prefix} .= '_' if $opt{prefix};
796 my $types = $opt{'type'} ? [ @{$opt{'type'}} ] : [];
797 my $sizes = $opt{'size'} ? [ @{$opt{'size'}} ] : [];
799 my $param = $opt{param};
800 $param = $cgi->Vars if $cgi->param('error');
802 $opt{$_} ||= [] foreach qw(align color footer footer_align);
804 my @total = map 0, @{$opt{footer}};
812 my $money_char = $conf->config('money_char') || '$';