Fixed bug with $routernum and new routers. Navigation cleanup.
[freeside.git] / httemplate / edit / part_pkg.cgi
1 <!-- mason kludge -->
2 <%
3
4 if ( $cgi->param('clone') && $cgi->param('clone') =~ /^(\d+)$/ ) {
5   $cgi->param('clone', $1);
6 } else {
7   $cgi->param('clone', '');
8 }
9 if ( $cgi->param('pkgnum') && $cgi->param('pkgnum') =~ /^(\d+)$/ ) {
10   $cgi->param('pkgnum', $1);
11 } else {
12   $cgi->param('pkgnum', '');
13 }
14
15 my ($query) = $cgi->keywords;
16 my $action = '';
17 my $part_pkg = '';
18 if ( $cgi->param('error') ) {
19   $part_pkg = new FS::part_pkg ( {
20     map { $_, scalar($cgi->param($_)) } fields('part_pkg')
21   } );
22 }
23 if ( $cgi->param('clone') ) {
24   $action='Custom Pricing';
25   my $old_part_pkg =
26     qsearchs('part_pkg', { 'pkgpart' => $cgi->param('clone') } );
27   $part_pkg ||= $old_part_pkg->clone;
28   $part_pkg->disabled('Y');
29 } elsif ( $query && $query =~ /^(\d+)$/ ) {
30   $part_pkg ||= qsearchs('part_pkg',{'pkgpart'=>$1});
31 } else {
32   unless ( $part_pkg ) {
33     $part_pkg = new FS::part_pkg {};
34     $part_pkg->plan('flat');
35   }
36 }
37 unless ( $part_pkg->plan ) { #backwards-compat
38   $part_pkg->plan('flat');
39   $part_pkg->plandata("setup_fee=". $part_pkg->setup. "\n".
40                       "recur_fee=". $part_pkg->recur. "\n");
41 }
42 $action ||= $part_pkg->pkgpart ? 'Edit' : 'Add';
43 my $hashref = $part_pkg->hashref;
44
45
46 print header("$action Package Definition", menubar(
47   'Main Menu' => popurl(2),
48   'View all packages' => popurl(2). 'browse/part_pkg.cgi',
49 ));
50 #), ' onLoad="visualize()"');
51
52 print qq!<FONT SIZE="+1" COLOR="#ff0000">Error: !, $cgi->param('error'),
53       "</FONT>"
54   if $cgi->param('error');
55
56 #print '<FORM ACTION="', popurl(1), 'process/part_pkg.cgi" METHOD=POST>';
57 print '<FORM NAME="dummy">';
58
59 #if ( $cgi->param('clone') ) {
60 #  print qq!<INPUT TYPE="hidden" NAME="clone" VALUE="!, $cgi->param('clone'), qq!">!;
61 #}
62 #if ( $cgi->param('pkgnum') ) {
63 #  print qq!<INPUT TYPE="hidden" NAME="pkgnum" VALUE="!, $cgi->param('pkgnum'), qq!">!;
64 #}
65 #
66 #print qq!<INPUT TYPE="hidden" NAME="pkgpart" VALUE="$hashref->{pkgpart}">!,
67 print "Package Part #", $hashref->{pkgpart} ? $hashref->{pkgpart} : "(NEW)";
68
69 print ntable("#cccccc",2), <<END;
70 <TR><TD ALIGN="right">Package (customer-visible)</TD><TD><INPUT TYPE="text" NAME="pkg" SIZE=32 VALUE="$hashref->{pkg}"></TD></TR>
71 <TR><TD ALIGN="right">Comment (customer-hidden)</TD><TD><INPUT TYPE="text" NAME="comment" SIZE=32 VALUE="$hashref->{comment}"></TD></TR>
72 <TR><TD ALIGN="right">Frequency (months) of recurring fee</TD><TD><INPUT TYPE="text" NAME="freq" VALUE="$hashref->{freq}" SIZE=3>&nbsp;&nbsp;<I>0=no recurring fee, 1=monthly, 3=quarterly, 12=yearly</TD></TR>
73 <TR><TD ALIGN="right">Setup fee tax exempt</TD><TD>
74 END
75
76 print '<INPUT TYPE="checkbox" NAME="setuptax" VALUE="Y"';
77 print ' CHECKED' if $hashref->{setuptax} eq "Y";
78 print '>';
79
80 print <<END;
81 </TD></TR>
82 <TR><TD ALIGN="right">Recurring fee tax exempt</TD><TD>
83 END
84
85 print '<INPUT TYPE="checkbox" NAME="recurtax" VALUE="Y"';
86 print ' CHECKED' if $hashref->{recurtax} eq "Y";
87 print '>';
88
89 print '</TD></TR>';
90
91 my $conf = new FS::Conf;
92 #false laziness w/ view/cust_main.cgi quick order
93 if ( $conf->exists('enable_taxclasses') ) {
94   print '<TR><TD ALIGN="right">Tax class</TD><TD><SELECT NAME="taxclass">';
95   my $sth = dbh->prepare('SELECT DISTINCT taxclass FROM cust_main_county')
96     or die dbh->errstr;
97   $sth->execute or die $sth->errstr;
98   foreach my $taxclass ( map $_->[0], @{$sth->fetchall_arrayref} ) {
99     print qq!<OPTION VALUE="$taxclass"!;
100     print ' SELECTED' if $taxclass eq $hashref->{taxclass};
101     print qq!>$taxclass</OPTION>!;
102   }
103   print '</SELECT></TD></TR>';
104 } else {
105   print
106     '<INPUT TYPE="hidden" NAME="taxclass" VALUE="'. $hashref->{taxclass}. '">';
107 }
108
109 print '<TR><TD ALIGN="right">Disable new orders</TD><TD>';
110 print '<INPUT TYPE="checkbox" NAME="disabled" VALUE="Y"';
111 print ' CHECKED' if $hashref->{disabled} eq "Y";
112 print '>';
113 print '</TD></TR></TABLE>';
114
115 my $thead =  "\n\n". ntable('#cccccc', 2). <<END;
116 <TR><TH BGCOLOR="#dcdcdc"><FONT SIZE=-1>Quan.</FONT></TH><TH BGCOLOR="#dcdcdc">Service</TH></TR>
117 END
118
119 #unless ( $cgi->param('clone') ) {
120 #dunno why...
121 unless ( 0 ) {
122   #print <<END, $thead;
123   print <<END, itable(), '<TR><TD VALIGN="top">', $thead;
124 <BR><BR>Enter the quantity of each service this package includes.<BR><BR>
125 END
126 }
127
128 my @fixups = ();
129 my $count = 0;
130 my $columns = 3;
131 my @part_svc = qsearch( 'part_svc', { 'disabled' => '' } );
132 foreach my $part_svc ( @part_svc ) {
133   my $svcpart = $part_svc->svcpart;
134   my $pkgpart = $cgi->param('clone') || $part_pkg->pkgpart;
135   my $pkg_svc = $pkgpart && qsearchs( 'pkg_svc', {
136     'pkgpart'  => $pkgpart,
137     'svcpart'  => $svcpart,
138   } ) || new FS::pkg_svc ( {
139     'pkgpart'  => $pkgpart,
140     'svcpart'  => $svcpart,
141     'quantity' => 0,
142   });
143   #? #next unless $pkg_svc;
144
145   push @fixups, "pkg_svc$svcpart";
146
147   #unless ( defined ($cgi->param('clone')) && $cgi->param('clone') ) {
148   #dunno why...
149   unless ( 0 ) {
150     print '<TR>'; # if $count == 0 ;
151     print qq!<TD><INPUT TYPE="text" NAME="pkg_svc$svcpart" SIZE=4 MAXLENGTH=3 VALUE="!,
152           $cgi->param("pkg_svc$svcpart") || $pkg_svc->quantity || 0,
153           qq!"></TD><TD><A HREF="part_svc.cgi?!,$part_svc->svcpart,
154           qq!">!, $part_svc->getfield('svc'), "</A></TD></TR>";
155 #    print "</TABLE></TD><TD>$thead" if ++$count == int(scalar(@part_svc) / 2);
156     $count+=1;
157     foreach ( 1 .. $columns-1 ) {
158       print "</TABLE></TD><TD VALIGN=\"top\">$thead"
159         if $count == int( $_ * scalar(@part_svc) / $columns );
160     }
161   } else {
162     print qq!<INPUT TYPE="hidden" NAME="pkg_svc$svcpart" VALUE="!,
163           $cgi->param("pkg_svc$svcpart") || $pkg_svc->quantity || 0, qq!">\n!;
164   }
165 }
166
167 #unless ( $cgi->param('clone') ) {
168 #dunno why...
169 unless ( 0 ) {
170   print "</TR></TABLE></TD></TR></TABLE>";
171   #print "</TR></TABLE>";
172 }
173
174 foreach my $f ( qw( clone pkgnum ) ) {
175   print qq!<INPUT TYPE="hidden" NAME="$f" VALUE="!. $cgi->param($f). '">';
176 }
177 print '<INPUT TYPE="hidden" NAME="pkgpart" VALUE="'. $part_pkg->pkgpart. '">';
178
179 # prolly should be in database
180 tie my %plans, 'Tie::IxHash',
181   'flat' => {
182     'name' => 'Flat rate (anniversary billing)',
183     'fields' => {
184       'setup_fee' => { 'name' => 'Setup fee for this package',
185                        'default' => 0,
186                      },
187       'recur_fee' => { 'name' => 'Recurring fee for this package',
188                        'default' => 0,
189                       },
190     },
191     'fieldorder' => [ 'setup_fee', 'recur_fee' ],
192     'setup' => 'what.setup_fee.value',
193     'recur' => 'what.recur_fee.value',
194   },
195
196   'flat_delayed' => {
197     'name' => 'Free for X days, then flat rate (anniversary billing)',
198     'fields' =>  {
199       'free_days' => { 'name' => 'Initial free days',
200                        'default' => 0,
201                      },
202       'setup_fee' => { 'name' => 'Setup fee for this package',
203                        'default' => 0,
204                      },
205       'recur_fee' => { 'name' => 'Recurring fee for this package',
206                        'default' => 0,
207                       },
208     },
209     'fieldorder' => [ 'free_days', 'setup_fee', 'recur_fee' ],
210     'setup' => '\'my $d = $cust_pkg->bill || $time; $d += 86400 * \' + what.free_days.value + \'; $cust_pkg->bill($d); $cust_pkg_mod_flag=1; \' + what.setup_fee.value',
211     'recur' => 'what.recur_fee.value',
212   },
213
214   'prorate' => {
215     'name' => 'First partial month pro-rated, then flat-rate (1st of month billing)',
216     'fields' =>  {
217       'setup_fee' => { 'name' => 'Setup fee for this package',
218                        'default' => 0,
219                      },
220       'recur_fee' => { 'name' => 'Recurring fee for this package',
221                        'default' => 0,
222                       },
223     },
224     'fieldorder' => [ 'setup_fee', 'recur_fee' ],
225     'setup' => 'what.setup_fee.value',
226     'recur' => '\'my $mnow = $sdate; my ($sec,$min,$hour,$mday,$mon,$year) = (localtime($sdate) )[0,1,2,3,4,5]; my $mstart = timelocal(0,0,0,1,$mon,$year); my $mend = timelocal(0,0,0,1, $mon == 11 ? 0 : $mon+1, $year+($mon==11)); $sdate = $mstart; ( $part_pkg->freq - 1 ) * \' + what.recur_fee.value + \' / $part_pkg->freq + \' + what.recur_fee.value + \' / $part_pkg->freq * ($mend-$mnow) / ($mend-$mstart) ; \'',
227   },
228
229   'subscription' => {
230     'name' => 'First partial month full charge, then flat-rate (1st of month billing)',
231     'fields' => {
232       'setup_fee' => { 'name' => 'Setup fee for this package',
233                        'default' => 0,
234                      },
235       'recur_fee' => { 'name' => 'Recurring fee for this package',
236                        'default' => 0,
237                       },
238     },
239     'fieldorder' => [ 'setup_fee', 'recur_fee' ],
240     'setup' => 'what.setup_fee.value',
241     'recur' => '\'my $mnow = $sdate; my ($sec,$min,$hour,$mday,$mon,$year) = (localtime($sdate) )[0,1,2,3,4,5]; $sdate = timelocal(0,0,0,1,$mon,$year); \' + what.recur_fee.value',
242   },
243
244   'flat_comission_cust' => {
245     'name' => 'Flat rate with recurring commission per active customer',
246     'fields' => {
247       'setup_fee' => { 'name' => 'Setup fee for this package',
248                        'default' => 0,
249                      },
250       'recur_fee' => { 'name' => 'Recurring fee for this package',
251                        'default' => 0,
252                      },
253       'comission_amount' => { 'name' => 'Commission amount per month (per active customer)',
254                               'default' => 0,
255                             },
256       'comission_depth'  => { 'name' => 'Number of layers',
257                               'default' => 1,
258                             },
259     },
260     'fieldorder' => [ 'setup_fee', 'recur_fee', 'comission_depth', 'comission_amount' ],
261     'setup' => 'what.setup_fee.value',
262     'recur' => '\'my $error = $cust_pkg->cust_main->credit( \' + what.comission_amount.value + \' * scalar($cust_pkg->cust_main->referral_cust_main_ncancelled(\' + what.comission_depth.value+ \')), "commission" ); die $error if $error; \' + what.recur_fee.value + \';\'',
263   },
264
265   'flat_comission' => {
266     'name' => 'Flat rate with recurring commission per (any) active package',
267     'fields' => {
268       'setup_fee' => { 'name' => 'Setup fee for this package',
269                        'default' => 0,
270                      },
271       'recur_fee' => { 'name' => 'Recurring fee for this package',
272                        'default' => 0,
273                      },
274       'comission_amount' => { 'name' => 'Commission amount per month (per active package)',
275                               'default' => 0,
276                             },
277       'comission_depth'  => { 'name' => 'Number of layers',
278                               'default' => 1,
279                             },
280     },
281     'fieldorder' => [ 'setup_fee', 'recur_fee', 'comission_depth', 'comission_amount' ],
282     'setup' => 'what.setup_fee.value',
283     'recur' => '\'my $error = $cust_pkg->cust_main->credit( \' + what.comission_amount.value + \' * scalar($cust_pkg->cust_main->referral_cust_pkg(\' + what.comission_depth.value+ \')), "commission" ); die $error if $error; \' + what.recur_fee.value + \';\'',
284   },
285
286   'flat_comission_pkg' => {
287     'name' => 'Flat rate with recurring commission per (selected) active package',
288     'fields' => {
289       'setup_fee' => { 'name' => 'Setup fee for this package',
290                        'default' => 0,
291                      },
292       'recur_fee' => { 'name' => 'Recurring fee for this package',
293                        'default' => 0,
294                      },
295       'comission_amount' => { 'name' => 'Commission amount per month (per uncancelled package)',
296                               'default' => 0,
297                             },
298       'comission_depth'  => { 'name' => 'Number of layers',
299                               'default' => 1,
300                             },
301       'comission_pkgpart' => { 'name' => 'Applicable packages<BR><FONT SIZE="-1">(hold <b>ctrl</b> to select multiple packages)</FONT>',
302                                'type' => 'select_multiple',
303                                'select_table' => 'part_pkg',
304                                'select_hash'  => { 'disabled' => '' } ,
305                                'select_key'   => 'pkgpart',
306                                'select_label' => 'pkg',
307                              },
308     },
309     'fieldorder' => [ 'setup_fee', 'recur_fee', 'comission_depth', 'comission_amount', 'comission_pkgpart' ],
310     'setup' => 'what.setup_fee.value',
311     'recur' => '""; var pkgparts = ""; for ( var c=0; c < document.flat_comission_pkg.comission_pkgpart.options.length; c++ ) { if (document.flat_comission_pkg.comission_pkgpart.options[c].selected) { pkgparts = pkgparts + document.flat_comission_pkg.comission_pkgpart.options[c].value + \', \'; } } what.recur.value = \'my $error = $cust_pkg->cust_main->credit( \' + what.comission_amount.value + \' * scalar( grep { my $pkgpart = $_->pkgpart; grep { $_ == $pkgpart } ( \' + pkgparts + \'  ) } $cust_pkg->cust_main->referral_cust_pkg(\' + what.comission_depth.value+ \')), "commission" ); die $error if $error; \' + what.recur_fee.value + \';\'',
312   },
313
314
315
316   'sesmon_hour' => {
317     'name' => 'Base charge plus charge per-hour from the session monitor',
318     'fields' => {
319       'setup_fee' => { 'name' => 'Setup fee for this package',
320                        'default' => 0,
321                      },
322       'recur_flat' => { 'name' => 'Base monthly charge for this package',
323                         'default' => 0,
324                       },
325       'recur_included_hours' => { 'name' => 'Hours included',
326                                   'default' => 0,
327                                 },
328       'recur_hourly_charge' => { 'name' => 'Additional charge per hour',
329                                  'default' => 0,
330                                },
331     },
332     'fieldorder' => [ 'setup_fee', 'recur_flat', 'recur_included_hours', 'recur_hourly_charge' ],
333     'setup' => 'what.setup_fee.value',
334     'recur' => '\'my $hours = $cust_pkg->seconds_since($cust_pkg->bill || 0) / 3600 - \' + what.recur_included_hours.value + \'; $hours = 0 if $hours < 0; \' + what.recur_flat.value + \' + \' + what.recur_hourly_charge.value + \' * $hours;\'',
335   },
336
337   'sesmon_minute' => {
338     'name' => 'Base charge plus charge per-minute from the session monitor',
339     'fields' => {
340       'setup_fee' => { 'name' => 'Setup fee for this package',
341                        'default' => 0,
342                      },
343       'recur_flat' => { 'name' => 'Base monthly charge for this package',
344                         'default' => 0,
345                       },
346       'recur_included_min' => { 'name' => 'Minutes included',
347                                 'default' => 0,
348                                 },
349       'recur_minly_charge' => { 'name' => 'Additional charge per minute',
350                                 'default' => 0,
351                               },
352     },
353     'fieldorder' => [ 'setup_fee', 'recur_flat', 'recur_included_min', 'recur_minly_charge' ],
354     'setup' => 'what.setup_fee.value',
355     'recur' => '\'my $min = $cust_pkg->seconds_since($cust_pkg->bill || 0) / 60 - \' + what.recur_included_min.value + \'; $min = 0 if $min < 0; \' + what.recur_flat.value + \' + \' + what.recur_minly_charge.value + \' * $min;\'',
356
357   },
358
359   'sqlradacct_hour' => {
360     'name' => 'Base charge plus charge per-hour (and for data) from an external sqlradius radacct table',
361     'fields' => {
362       'setup_fee' => { 'name' => 'Setup fee for this package',
363                        'default' => 0,
364                      },
365       'recur_flat' => { 'name' => 'Base monthly charge for this package',
366                         'default' => 0,
367                       },
368       'recur_included_hours' => { 'name' => 'Hours included',
369                                   'default' => 0,
370                                 },
371       'recur_hourly_charge' => { 'name' => 'Additional charge per hour',
372                                  'default' => 0,
373                                },
374       'recur_included_input' => { 'name' => 'Input megabytes included',
375                                   'default' => 0,
376                                 },
377       'recur_input_charge' => { 'name' =>
378                                         'Additional charge per input megabyte',
379                                 'default' => 0,
380                               },
381       'recur_included_output' => { 'name' => 'Output megabytes included',
382                                    'default' => 0,
383                                 },
384       'recur_output_charge' => { 'name' =>
385                                        'Additional charge per output megabyte',
386                                 'default' => 0,
387                               },
388       'recur_included_total' => { 'name' =>
389                                        'Total input+output megabytes included',
390                                   'default' => 0,
391                                 },
392       'recur_total_charge' => { 'name' =>
393                                  'Additional charge per input+output megabyte',
394                                 'default' => 0,
395                               },
396     },
397     'fieldorder' => [qw( setup_fee recur_flat recur_included_hours recur_hourly_charge recur_included_input recur_input_charge recur_included_output recur_output_charge recur_included_total recur_total_charge )],
398     'setup' => 'what.setup_fee.value',
399     'recur' => '\'my $last_bill = $cust_pkg->last_bill; my $hours = $cust_pkg->seconds_since_sqlradacct($last_bill, $sdate ) / 3600 - \' + what.recur_included_hours.value + \'; $hours = 0 if $hours < 0; my $input = $cust_pkg->attribute_since_sqlradacct($last_bill, $sdate, \"AcctInputOctets\" ) / 1048576; my $output = $cust_pkg->attribute_since_sqlradacct($last_bill, $sdate, \"AcctOutputOctets\" ) / 1048576; my $total = $input + $output - \' + what.recur_included_total.value + \'; $total = 0 if $total < 0; my $input = $input - \' + what.recur_included_input.value + \'; $input = 0 if $input < 0; my $output = $output - \' + what.recur_included_output.value + \'; $output = 0 if $output < 0; my $totalcharge = sprintf(\"%.2f\", \' + what.recur_total_charge.value + \' * $total); my $hourscharge = sprintf(\"%.2f\", \' + what.recur_hourly_charge.value + \' * $hours); push @details, \"Last month\\\'s excess data \". sprintf(\"%.1f\", $total). \" megs: \\\$$totalcharge\", \"Last month\\\'s excess time \". sprintf(\"%.1f\", $hours). \" hours: \\\$$hourscharge\"; \' + what.recur_flat.value + \' + $hourscharge + \' + what.recur_input_charge.value + \' * $input + \' + what.recur_output_charge.value + \' * $output + $totalcharge ;\'',
400   },
401
402 ;
403
404 my %plandata = map { /^(\w+)=(.*)$/; ( $1 => $2 ); }
405                     split("\n", $part_pkg->plandata );
406
407 tie my %options, 'Tie::IxHash', map { $_=>$plans{$_}->{'name'} } keys %plans;
408
409 my @form_select = ();
410 if ( $conf->exists('enable_taxclasses') ) {
411   push @form_select, 'taxclass';
412 } else {
413   push @fixups, 'taxclass'; #hidden
414 }
415
416
417 my $widget = new HTML::Widgets::SelectLayers(
418   'selected_layer' => $part_pkg->plan,
419   'options'        => \%options,
420   'form_name'      => 'dummy',
421   'form_action'    => 'process/part_pkg.cgi',
422   'form_text'      => [ qw(pkg comment freq clone pkgnum pkgpart), @fixups ],
423   'form_checkbox'  => [ qw(setuptax recurtax disabled) ],
424   'form_select'    => [ @form_select ],
425   'fixup_callback' => sub {
426                         #my $ = @_;
427                         my $html = '';
428                         for my $p ( keys %plans ) {
429                           $html .= "if ( what.plan.value == \"$p\" ) {
430                                       what.setup.value = $plans{$p}->{setup} ;
431                                       what.recur.value = $plans{$p}->{recur} ;
432                                     }\n";
433                         }
434                         $html;
435                       },
436   'layer_callback' => sub {
437     my $layer = shift;
438     my $html = qq!<INPUT TYPE="hidden" NAME="plan" VALUE="$layer">!.
439                ntable("#cccccc",2);
440     my $href = $plans{$layer}->{'fields'};
441     foreach my $field ( exists($plans{$layer}->{'fieldorder'})
442                           ? @{$plans{$layer}->{'fieldorder'}}
443                           : keys %{ $href }
444                       ) {
445
446       $html .= '<TR><TD ALIGN="right">'. $href->{$field}{'name'}. '</TD><TD>';
447
448       if ( ! exists($href->{$field}{'type'}) ) {
449         $html .= qq!<INPUT TYPE="text" NAME="$field" VALUE="!.
450                  ( exists($plandata{$field})
451                      ? $plandata{$field}
452                      : $href->{$field}{'default'} ).
453                  qq!" onChange="fchanged(this)">!;
454       } elsif ( $href->{$field}{'type'} eq 'select_multiple' ) {
455         $html .= qq!<SELECT MULTIPLE NAME="$field" onChange="fchanged(this)">!;
456         foreach my $record (
457           qsearch( $href->{$field}{'select_table'},
458                    $href->{$field}{'select_hash'}   )
459         ) {
460           my $value = $record->getfield($href->{$field}{'select_key'});
461           $html .= qq!<OPTION VALUE="$value"!.
462                    (  $plandata{$field} =~ /(^|, *)$value *(,|$)/
463                         ? ' SELECTED'
464                         : ''          ).
465                    '>'. $record->getfield($href->{$field}{'select_label'})
466         }
467         $html .= '</SELECT>';
468       }
469
470       $html .= '</TD></TR>';
471     }
472     $html .= '</TABLE>';
473
474     $html .= '<INPUT TYPE="hidden" NAME="plandata" VALUE="'.
475              join(',', keys %{ $href } ). '">'.
476              '<BR><BR>';
477              
478     $html .= '<INPUT TYPE="submit" VALUE="'.
479              ( $hashref->{pkgpart} ? "Apply changes" : "Add package" ).
480              '" onClick="fchanged(this)">';
481
482     $html .= '<BR><BR>don\'t edit this unless you know what you\'re doing '.
483              '<INPUT TYPE="button" VALUE="refresh expressions" '.
484                'onClick="fchanged(this)">'.
485              ntable("#cccccc",2).
486              '<TR><TD>'.
487              '<FONT SIZE="1">Setup expression<BR>'.
488              '<INPUT TYPE="text" NAME="setup" SIZE="160" VALUE="'.
489                encode_entities($hashref->{setup}). '" onLoad="fchanged(this)">'.
490              '</FONT><BR>'.
491              '<FONT SIZE="1">Recurring espression<BR>'.
492              '<INPUT TYPE="text" NAME="recur" SIZE="160" VALUE="'.
493                encode_entities($hashref->{recur}). '" onLoad="fchanged(this)">'.
494              '</FONT>'.
495              '</TR></TD>'.
496              '</TABLE>';
497
498     $html;
499
500   },
501 );
502
503 %>
504
505 <BR>
506 Price plan <%= $widget->html %>
507   </BODY>
508 </HTML>