print "Package Part #", $hashref->{pkgpart} ? $hashref->{pkgpart} : "(NEW)";
print ntable("#cccccc",2), <<END;
-<TR><TD ALIGN="right">Package (customer-visable)</TD><TD><INPUT TYPE="text" NAME="pkg" SIZE=32 VALUE="$hashref->{pkg}"></TD></TR>
+<TR><TD ALIGN="right">Package (customer-visible)</TD><TD><INPUT TYPE="text" NAME="pkg" SIZE=32 VALUE="$hashref->{pkg}"></TD></TR>
<TR><TD ALIGN="right">Comment (customer-hidden)</TD><TD><INPUT TYPE="text" NAME="comment" SIZE=32 VALUE="$hashref->{comment}"></TD></TR>
-<TR><TD ALIGN="right">Frequency (months) of recurring fee</TD><TD><INPUT TYPE="text" NAME="freq" VALUE="$hashref->{freq}" SIZE=3></TD></TR>
+<TR><TD ALIGN="right">Frequency (months) of recurring fee</TD><TD><INPUT TYPE="text" NAME="freq" VALUE="$hashref->{freq}" SIZE=3> <I>0=no recurring fee, 1=monthly, 3=quarterly, 12=yearly</TD></TR>
<TR><TD ALIGN="right">Setup fee tax exempt</TD><TD>
END
print '</TD></TR>';
+my $conf = new FS::Conf;
+#false laziness w/ view/cust_main.cgi quick order
+if ( $conf->exists('enable_taxclasses') ) {
+ print '<TR><TD ALIGN="right">Tax class</TD><TD><SELECT NAME="taxclass">';
+ my $sth = dbh->prepare('SELECT DISTINCT taxclass FROM cust_main_county')
+ or die dbh->errstr;
+ $sth->execute or die $sth->errstr;
+ foreach my $taxclass ( map $_->[0], @{$sth->fetchall_arrayref} ) {
+ print qq!<OPTION VALUE="$taxclass"!;
+ print ' SELECTED' if $taxclass eq $hashref->{taxclass};
+ print qq!>$taxclass</OPTION>!;
+ }
+ print '</SELECT></TD></TR>';
+} else {
+ print
+ '<INPUT TYPE="hidden" NAME="taxclass" VALUE="'. $hashref->{taxclass}. '">';
+}
+
print '<TR><TD ALIGN="right">Disable new orders</TD><TD>';
print '<INPUT TYPE="checkbox" NAME="disabled" VALUE="Y"';
print ' CHECKED' if $hashref->{disabled} eq "Y";
'recur' => 'what.recur_fee.value',
},
+ 'flat_delayed' => {
+ 'name' => 'Free for X days, then flat rate (anniversary billing)',
+ 'fields' => {
+ 'free_days' => { 'name' => 'Initial free days',
+ 'default' => 0,
+ },
+ 'setup_fee' => { 'name' => 'Setup fee for this package',
+ 'default' => 0,
+ },
+ 'recur_fee' => { 'name' => 'Recurring fee for this package',
+ 'default' => 0,
+ },
+ },
+ 'fieldorder' => [ 'free_days', 'setup_fee', 'recur_fee' ],
+ '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',
+ 'recur' => 'what.recur_fee.value',
+ },
+
'prorate' => {
'name' => 'First partial month pro-rated, then flat-rate (1st of month billing)',
'fields' => {
},
'flat_comission_cust' => {
- 'name' => 'Flat rate with recurring comission per active customer',
+ 'name' => 'Flat rate with recurring commission per active customer',
'fields' => {
'setup_fee' => { 'name' => 'Setup fee for this package',
'default' => 0,
'recur_fee' => { 'name' => 'Recurring fee for this package',
'default' => 0,
},
- 'comission_amount' => { 'name' => 'Comission amount per month (per active customer)',
+ 'comission_amount' => { 'name' => 'Commission amount per month (per active customer)',
'default' => 0,
},
'comission_depth' => { 'name' => 'Number of layers',
},
'flat_comission' => {
- 'name' => 'Flat rate with recurring comission per (any) active package',
+ 'name' => 'Flat rate with recurring commission per (any) active package',
'fields' => {
'setup_fee' => { 'name' => 'Setup fee for this package',
'default' => 0,
'recur_fee' => { 'name' => 'Recurring fee for this package',
'default' => 0,
},
- 'comission_amount' => { 'name' => 'Comission amount per month (per active package)',
+ 'comission_amount' => { 'name' => 'Commission amount per month (per active package)',
'default' => 0,
},
'comission_depth' => { 'name' => 'Number of layers',
},
'flat_comission_pkg' => {
- 'name' => 'Flat rate with recurring comission per (selected) active package',
+ 'name' => 'Flat rate with recurring commission per (selected) active package',
'fields' => {
'setup_fee' => { 'name' => 'Setup fee for this package',
'default' => 0,
'recur_fee' => { 'name' => 'Recurring fee for this package',
'default' => 0,
},
- 'comission_amount' => { 'name' => 'Comission amount per month (per uncancelled package)',
+ 'comission_amount' => { 'name' => 'Commission amount per month (per uncancelled package)',
'default' => 0,
},
'comission_depth' => { 'name' => 'Number of layers',
},
+ 'sqlradacct_hour' => {
+ 'name' => 'Base charge plus charge per-hour from an external sqlradius radacct table',
+ 'fields' => {
+ 'setup_fee' => { 'name' => 'Setup fee for this package',
+ 'default' => 0,
+ },
+ 'recur_flat' => { 'name' => 'Base monthly charge for this package',
+ 'default' => 0,
+ },
+ 'recur_included_hours' => { 'name' => 'Hours included',
+ 'default' => 0,
+ },
+ 'recur_hourly_charge' => { 'name' => 'Additional charge per hour',
+ 'default' => 0,
+ },
+ },
+ 'fieldorder' => [ 'setup_fee', 'recur_flat', 'recur_included_hours', 'recur_hourly_charge' ],
+ 'setup' => 'what.setup_fee.value',
+ 'recur' => '\'my $hours = $cust_pkg->seconds_since_sqlradacct($cust_pkg->last_bill, $sdate ) / 3600 - \' + what.recur_included_hours.value + \'; $hours = 0 if $hours < 0; \' + what.recur_flat.value + \' + \' + what.recur_hourly_charge.value + \' * $hours;\'',
+ },
+
+
;
my %plandata = map { /^(\w+)=(.*)$/; ( $1 => $2 ); }
tie my %options, 'Tie::IxHash', map { $_=>$plans{$_}->{'name'} } keys %plans;
+my @form_select = ();
+if ( $conf->exists('enable_taxclasses') ) {
+ push @form_select, 'taxclass';
+} else {
+ push @fixups, 'taxclass'; #hidden
+}
+
+
my $widget = new HTML::Widgets::SelectLayers(
'selected_layer' => $part_pkg->plan,
'options' => \%options,
'form_action' => 'process/part_pkg.cgi',
'form_text' => [ qw(pkg comment freq clone pkgnum pkgpart), @fixups ],
'form_checkbox' => [ qw(setuptax recurtax disabled) ],
+ 'form_select' => [ @form_select ],
'fixup_callback' => sub {
#my $ = @_;
my $html = '';