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 == 1 ) {
208 update_customer(searchrow, customerArrayArray[0]);
209 % if ( $opt{custnum_update_callback} ) {
210 <% $opt{custnum_update_callback} %>(searchrow, '<% $opt{prefix} %>')
215 custnum_obj.value = 'Multiple'; // or something
216 custnum_obj.style.color = '#ff0000';
218 //blank the current list
219 customer_select.options.length = 0;
221 opt(customer_select, '', 'Multiple customers match "' + custnum + '" - select one', '#ff0000');
222 //add the multiple customers
223 for ( var s = 0; s < customerArrayArray.length; s++ ) {
225 JSON.stringify(customerArrayArray[s]),
226 customerArrayArray[s][1],
230 opt(customer_select, 'cancel', '(Edit search string)', '#000000');
232 customer_obj.style.display = 'none';
234 customer_select.style.display = '';
240 custnum_search(custnum, search_custnum_update );
244 function <% $opt{prefix} %>search_customer() {
246 var customer_obj = this;
247 var searchrow = this.getAttribute('rownum');
248 var customer = this.value;
250 if ( customer == 'searching...' || customer == 'Not found' || customer == '' )
253 if ( this.getAttribute('magic') == 'nosearch' ) {
254 this.setAttribute('magic', '');
258 if ( ( <% $opt{prefix} %>rownum - searchrow ) == 1 ) {
259 <% $opt{prefix} %>addRow();
262 var invnum = document.getElementById('invnum'+searchrow);
265 var custnum_obj = document.getElementById('custnum'+searchrow);
266 custnum_obj.value = 'searching...';
267 custnum_obj.disabled = true;
268 custnum_obj.style.color = '#000000';
269 custnum_obj.style.backgroundColor = '#dddddd';
271 var customer_select = document.getElementById('cust_select'+searchrow);
273 function search_customer_update(customers) {
275 var customerArrayArray = eval('(' + customers + ')') || [ [] ];
277 custnum_obj.disabled = false;
278 custnum_obj.style.backgroundColor = '#ffffff';
280 if ( customerArrayArray.length == 1 ) {
282 update_customer(searchrow, customerArrayArray[0]);
283 % if ( $opt{custnum_update_callback} ) {
284 <% $opt{custnum_update_callback} %>(searchrow, '<% $opt{prefix} %>')
289 custnum_obj.value = 'Multiple'; // or something
290 custnum_obj.style.color = '#ff0000';
292 //blank the current list
293 customer_select.options.length = 0;
295 opt(customer_select, '', 'Multiple customers match "' + customer + '" - select one', '#ff0000');
296 //add the multiple customers
297 for ( var s = 0; s < customerArrayArray.length; s++ ) {
299 JSON.stringify(customerArrayArray[s]),
300 customerArrayArray[s][1],
304 opt(customer_select, 'cancel', '(Edit search string)', '#000000');
306 customer_obj.style.display = 'none';
308 customer_select.style.display = '';
314 smart_search( customer, search_customer_update );
318 function select_customer() {
320 var custnum_balance_status = this.options[this.selectedIndex].value;
321 var customer = this.options[this.selectedIndex].text;
323 var searchrow = this.getAttribute('rownum');
324 var custnum_obj = document.getElementById('custnum'+searchrow);
325 var customer_obj = document.getElementById('customer'+searchrow);
326 var balance_obj = document.getElementById('balance'+searchrow);
327 var status_obj = document.getElementById('status'+searchrow);
329 if ( custnum_balance_status == '' ) {
331 } else if ( custnum_balance_status == 'cancel' ) {
333 custnum_obj.value = '';
334 custnum_obj.style.color = '#000000';
336 this.style.display = 'none';
337 customer_obj.style.display = '';
338 customer_obj.focus();
342 update_customer(searchrow, JSON.parse(custnum_balance_status));
344 % if ( $opt{custnum_update_callback} ) {
345 <% $opt{custnum_update_callback} %>(searchrow, '<% $opt{prefix} %>')
352 function opt(what,value,text,color) {
353 var optionName = new Option(text, value, false, false);
354 optionName.style.color = color;
355 var length = what.length;
356 what.options[length] = optionName;
359 function update_status_text(rownum, newval) {
360 document.getElementById('status'+rownum).value = newval;
361 document.getElementById('status'+rownum+'_text').innerHTML = newval;
364 function update_status_color(rownum, newval) {
365 document.getElementById('statuscolor'+rownum).value = newval;
366 document.getElementById('status'+rownum+'_text').style.color = newval;
369 function update_balance_text(rownum, newval) {
370 document.getElementById('balance'+rownum).value = newval;
371 document.getElementById('balance'+rownum+'_text').innerHTML = newval;
374 function update_num_open(rownum, newval) {
375 num_open_invoices[rownum] = newval;
381 <TABLE ID="<% $opt{prefix} %>OneTrueTable" BGCOLOR="#cccccc" BORDER=0 CELLSPACING=0>
389 % foreach my $header ( @{$opt{header}} ) {
390 <TH><% $header %></TH>
394 % for ( $row = 0; exists($param->{"custnum$row"}); $row++ ) {
396 <TR id="row<%$row%>" rownum="<%$row%>">
399 NAME = "invnum<% $row %>"
400 ID = "invnum<% $row %>"
403 STYLE = "text-align:right;"
404 VALUE = "<% $param->{"invnum$row"} %>"
405 rownum = "<% $row %>"
407 <SCRIPT TYPE="text/javascript">
408 var invnum_input<% $row %> = document.getElementById("invnum<% $row %>");
409 invnum_input<% $row %>.onfocus = clearhint_invnum;
410 invnum_input<% $row %>.onchange = <% $opt{prefix} %>search_invnum;
416 NAME = "custnum<% $row %>"
417 ID = "custnum<% $row %>"
420 STYLE = "text-align:right;"
421 VALUE = "<% $param->{"custnum$row"} %>"
422 rownum = "<% $row %>"
424 <SCRIPT TYPE="text/javascript">
425 var custnum_input<% $row %> = document.getElementById("custnum<% $row %>");
426 custnum_input<% $row %>.onfocus = clearhint_custnum;
427 custnum_input<% $row %>.onchange = <% $opt{prefix} %>search_custnum;
431 <TD STYLE="text-align: center">
433 ID = "status<% $row %>_text"
434 rownum = "<% $row %>"
435 STYLE = "font-weight: bold;
436 color: <%$param->{"statuscolor$row"} || '#000000'%>"
438 ><% $param->{"status$row"} %></SPAN>
439 <INPUT TYPE = "hidden"
440 NAME = "status<% $row %>"
441 ID = "status<% $row %>"
442 VALUE = "<% $param->{"status$row"} %>"
443 rownum = "<% $row %>"
445 <INPUT TYPE = "hidden"
446 NAME = "statuscolor<% $row %>"
447 ID = "statuscolor<% $row %>"
448 VALUE = "<% $param->{"statuscolor$row"} %>"
449 rownum = "<% $row %>"
454 <INPUT TYPE="text" NAME="customer<% $row %>" ID="customer<% $row %>" SIZE=64 VALUE="<% $param->{"customer$row"} %>" rownum="<% $row %>">
455 <SCRIPT TYPE="text/javascript">
456 var customer_input<% $row %> = document.getElementById("customer<% $row %>");
457 customer_input<% $row %>.onfocus = clearhint_customer;
458 customer_input<% $row %>.onclick = clearhint_customer;
459 customer_input<% $row %>.onchange = <% $opt{prefix} %>search_customer;
461 <SELECT NAME="cust_select<% $row %>" ID="cust_select<% $row %>" rownum="<% $row %>" STYLE="color:#ff0000; display:none">
463 <SCRIPT TYPE="text/javascript">
464 var customer_select<% $row %> = document.getElementById("cust_select<% $row %>");
465 customer_select<% $row %>.onchange = select_customer;
469 <TD STYLE="text-align:right">
472 ID = "balance<% $row %>_text"
473 rownum = "<% $row %>"
474 ><% $param->{"balance$row"} %></SPAN>
476 <INPUT TYPE = "hidden"
477 NAME = "balance<% $row %>"
478 ID = "balance<% $row %>"
479 VALUE = "<% $param->{"balance$row"} %>"
480 rownum = "<% $row %>"
485 % foreach my $field ( @{$opt{fields}} ) {
487 % if ( ref($field) eq 'CODE' ) {
488 % $value = &{$field}($row,$param);
490 % $value = $param->{"$field$row"};
492 % my $name = (ref($field) eq 'CODE') ? "column${col}_$row" : "$field$row";
493 % my $align = $align{ $opt{align}->[$col] || 'l' };
494 % my $size = $sizes->[$col] || 10;
495 % my $color = $opt{color}->[$col];
496 % my $font = $color ? qq(<FONT COLOR="$color">) : '';
498 % if ( $opt{onchange}->[$col] ) {
499 % $onchange = 'onchange="'.$opt{onchange}->[$col].'"';
501 % elsif ( $opt{footer}->[$col] eq '_TOTAL' ) {
502 % $total[$col] += $value;
503 % $onchange = $opt{prefix}. "calc_total$col();";
504 % $onchange = qq(onchange="$onchange" onkeyup="$onchange");
506 <TD ALIGN="<% $align %>">
507 % my $type = $types->[$col] || 'text';
508 % if ($type eq 'text' or $type eq 'checkbox') {
509 <INPUT TYPE = "<% $type %>"
513 STYLE = "text-align: <% $align %>;"
514 VALUE = "<% $value %>"
515 rownum = "<% $row %>"
518 % } elsif ($types->[$col] eq 'immutable') {
519 <% $font %><% $value %><% $font ? '</FONT>' : '' %>
520 <INPUT TYPE="hidden" ID="<% $name %>" NAME="<% $name %>" VALUE="<% $value %>" >
522 Cannot represent unknown type: <% $types->[$col] %>
531 <TH COLSPAN=5 ID="<% $opt{'prefix'} %>_TOTAL_TOTAL">
532 Total <% $row ? $row-1 : 0 %>
533 <% PL($opt{name_singular} || 'customer', ( $row ? $row-1 : 0 ) ) %>
536 % foreach my $footer ( @{$opt{footer}} ) {
537 % my $align = $align{ $opt{'footer_align'}->[$col] || 'c' };
538 % if ($footer eq '_TOTAL' ) {
539 % my $id = $opt{'fields'}->[$col];
540 % $id = ref($id) ? "column${col}_TOTAL" : "${id}_TOTAL";
541 <TH ALIGN="<% $align %>" ID="<% $id %>"> <% sprintf('%.2f', $total[$col] ) %></TH>
543 <TH ALIGN="<% $align %>"><% $footer %></TH>
551 <SCRIPT TYPE="text/javascript">
553 % foreach my $footer ( @{$opt{footer}} ) {
554 % if ($footer eq '_TOTAL' ) {
555 % my $name = $opt{fields}->[$col];
556 % $name = ref($name) ? "column$col" : $name;
557 var <% $opt{prefix}.$name %>_CACHE = new Array ();
558 var <% $opt{prefix} %>th_el = document.getElementById("<%$name%>_TOTAL");
559 function <% $opt{prefix} %>calc_total<% $col %>() {
564 ( <% $opt{prefix}.$name%>_CACHE[row] =
565 <% $opt{prefix}.$name%>_CACHE[row]
566 || document.getElementById("<%$name%>"+row)
572 var value = <%$name%>_CACHE[row].value;
573 value = parseFloat(value);
574 if ( ! isNaN(value) ) {
575 total = total + value;
578 <% $opt{prefix} %>th_el.innerHTML = ' ' + total.toFixed(2);
586 <% include('/elements/xmlhttp.html',
587 'url' => $p. 'misc/xmlhttp-cust_main-search.cgi',
588 'subs' => [qw( custnum_search smart_search invnum_search )],
592 <SCRIPT TYPE="text/javascript">
594 var <% $opt{prefix} %>total_el =
595 document.getElementById("<% $opt{'prefix'} %>_TOTAL_TOTAL");
597 var <% $opt{prefix} %>rownum = <% $row %>;
599 function <% $opt{prefix} %>addRow() {
601 var table = document.getElementById('<% $opt{prefix} %>OneTrueTable');
602 var tablebody = table.getElementsByTagName('tbody').item(0);
604 var row = table.insertRow(table.rows.length - 1);
605 row.setAttribute('id', 'row'+rownum);
607 var invnum_cell = document.createElement('TD');
609 var invnum_input = document.createElement('INPUT');
610 invnum_input.setAttribute('name', 'invnum'+<% $opt{prefix} %>rownum);
611 invnum_input.setAttribute('id', 'invnum'+<% $opt{prefix} %>rownum);
612 invnum_input.style.textAlign = 'right';
613 invnum_input.setAttribute('size', 8);
614 invnum_input.setAttribute('maxlength', 12);
615 invnum_input.setAttribute('rownum', <% $opt{prefix} %>rownum);
616 invnum_input.onfocus = clearhint_invnum;
617 invnum_input.onchange = <% $opt{prefix} %>search_invnum;
618 invnum_cell.appendChild(invnum_input);
620 row.appendChild(invnum_cell);
622 var custnum_cell = document.createElement('TD');
624 var custnum_input = document.createElement('INPUT');
625 custnum_input.setAttribute('name', 'custnum'+<% $opt{prefix} %>rownum);
626 custnum_input.setAttribute('id', 'custnum'+<% $opt{prefix} %>rownum);
627 custnum_input.style.textAlign = 'right';
628 custnum_input.setAttribute('size', 8);
629 custnum_input.setAttribute('maxlength', 12);
630 custnum_input.setAttribute('rownum', <% $opt{prefix} %>rownum);
631 custnum_input.onfocus = clearhint_custnum;
632 custnum_input.onchange = <% $opt{prefix} %>search_custnum;
633 custnum_cell.appendChild(custnum_input);
635 row.appendChild(custnum_cell);
637 var status_cell = document.createElement('TD');
638 status_cell.style.textAlign = 'center';
640 var status_span = document.createElement('SPAN');
641 status_span.setAttribute('id', 'status'+<% $opt{prefix} %>rownum+'_text');
642 status_span.style.fontWeight = 'bold';
643 status_span.setAttribute('rownum', <% $opt{prefix} %>rownum);
644 status_cell.appendChild(status_span);
646 var status_input = document.createElement('INPUT');
647 status_input.setAttribute('type', 'hidden');
648 status_input.setAttribute('name', 'status'+<% $opt{prefix} %>rownum);
649 status_input.setAttribute('id', 'status'+<% $opt{prefix} %>rownum);
650 status_input.setAttribute('rownum', <% $opt{prefix} %>rownum);
651 status_cell.appendChild(status_input);
653 var statuscolor_input = document.createElement('INPUT');
654 statuscolor_input.setAttribute('type', 'hidden');
655 statuscolor_input.setAttribute('name', 'statuscolor'+<% $opt{prefix} %>rownum);
656 statuscolor_input.setAttribute('id', 'statuscolor'+<% $opt{prefix} %>rownum);
657 statuscolor_input.setAttribute('rownum', <% $opt{prefix} %>rownum);
658 status_cell.appendChild(statuscolor_input);
660 row.appendChild(status_cell);
662 var customer_cell = document.createElement('TD');
664 var customer_input = document.createElement('INPUT');
665 customer_input.setAttribute('name', 'customer'+<% $opt{prefix} %>rownum);
666 customer_input.setAttribute('id', 'customer'+<% $opt{prefix} %>rownum);
667 customer_input.setAttribute('size', 64);
668 customer_input.setAttribute('value', '(last name or company)' );
669 customer_input.setAttribute('rownum', <% $opt{prefix} %>rownum);
670 customer_input.onfocus = clearhint_customer;
671 customer_input.onclick = clearhint_customer;
672 customer_input.onchange = <% $opt{prefix} %>search_customer;
673 customer_cell.appendChild(customer_input);
675 var customer_select = document.createElement('SELECT');
676 customer_select.setAttribute('name', 'cust_select'+<% $opt{prefix} %>rownum);
677 customer_select.setAttribute('id', 'cust_select'+<% $opt{prefix} %>rownum);
678 customer_select.setAttribute('rownum', <% $opt{prefix} %>rownum);
679 customer_select.style.color = '#ff0000';
680 customer_select.style.display = 'none';
681 customer_select.onchange = select_customer;
682 customer_cell.appendChild(customer_select);
684 row.appendChild(customer_cell);
686 var balance_cell = document.createElement('TD');
688 balance_cell.style.textAlign = 'right';
689 balance_cell.appendChild(document.createTextNode('<%$money_char%>'));
691 var balance_span = document.createElement('SPAN');
692 balance_span.setAttribute('id', 'balance'+<% $opt{prefix} %>rownum+'_text');
693 balance_span.setAttribute('rownum', <% $opt{prefix} %>rownum);
694 balance_cell.appendChild(balance_span);
696 balance_cell.appendChild(
697 document.createTextNode(String.fromCharCode(160)) //
700 var balance_input = document.createElement('INPUT');
701 balance_input.setAttribute('type', 'hidden');
702 balance_input.setAttribute('name', 'balance'+<% $opt{prefix} %>rownum);
703 balance_input.setAttribute('id', 'balance'+<% $opt{prefix} %>rownum);
704 balance_input.setAttribute('rownum', <% $opt{prefix} %>rownum);
705 balance_cell.appendChild(balance_input);
707 row.appendChild(balance_cell);
710 % foreach my $field ( @{$opt{fields}} ) {
712 var my_cell = document.createElement('TD');
713 my_cell.setAttribute('align', '<% $align{ $opt{align}->[$col] || 'l' } %>');
715 % if ($types->[$col] eq 'immutable') {
717 % if ( ref($field) eq 'CODE' ) {
718 % $value = &{$field}($row,$param);
720 % $value = $param->{"$field$row"};
722 var my_text = document.createTextNode(<% $value |js_string %>);
723 my_cell.appendChild(my_text);
726 % my $name = (ref($field) eq 'CODE') ? "column${col}_" : $field;
727 var my_input = document.createElement('INPUT');
728 my_input.setAttribute('name', '<% $name %>'+<% $opt{prefix} %>rownum);
729 my_input.setAttribute('id', '<% $name %>'+<% $opt{prefix} %>rownum);
730 my_input.style.textAlign = '<% $align{ $opt{align}->[$col] || 'l' } %>';
731 my_input.setAttribute('size', <% $sizes->[$col] || 10 %>);
732 my_input.setAttribute('rownum', <% $opt{prefix} %>rownum);
733 % if ( $types->[$col] eq 'immutable' ) {
734 my_input.setAttribute('type', 'hidden');
736 % elsif ( $types->[$col] eq 'checkbox' ) {
737 my_input.setAttribute('type', 'checkbox');
739 % if ( $opt{onchange}->[$col] ) {
740 my_input.onchange = <% $opt{onchange}->[$col] %>;
742 % elsif ( $opt{footer}->[$col] eq '_TOTAL' ) {
743 my_input.onchange = <% $opt{prefix} %>calc_total<%$col%>;
744 my_input.onkeyup = <% $opt{prefix} %>calc_total<%$col%>;
746 my_cell.appendChild(my_input);
748 row.appendChild(my_cell);
753 //update the total # of rows display
754 if ( <% $opt{prefix} %>rownum == 1 ) {
755 <% $opt{prefix} %>total_el.innerHTML =
757 + <% $opt{prefix} %>rownum
758 + ' <% $opt{name_singular} || 'customer' %>';
760 <% $opt{prefix} %>total_el.innerHTML =
762 + <% $opt{prefix} %>rownum
763 + ' <% PL($opt{name_singular} || 'customer') %>';
766 % if ( $opt{add_row_callback} ) {
767 <% $opt{add_row_callback} %>(<% $opt{prefix} %>rownum,
768 '<% $opt{prefix} %>');
771 <% $opt{prefix} %>rownum++;
775 % unless ($cgi->param('error')) {
776 <% $opt{prefix} %>addRow();
783 my $conf = new FS::Conf;
785 $opt{prefix} = '' unless defined $opt{prefix};
786 $opt{prefix} .= '_' if $opt{prefix};
788 my $types = $opt{'type'} ? [ @{$opt{'type'}} ] : [];
789 my $sizes = $opt{'size'} ? [ @{$opt{'size'}} ] : [];
791 my $param = $opt{param};
792 $param = $cgi->Vars if $cgi->param('error');
794 $opt{$_} ||= [] foreach qw(align color footer footer_align);
796 my @total = map 0, @{$opt{footer}};
804 my $money_char = $conf->config('money_char') || '$';