summaryrefslogtreecommitdiff
path: root/httemplate
diff options
context:
space:
mode:
authorivan <ivan>2002-02-10 02:16:47 +0000
committerivan <ivan>2002-02-10 02:16:47 +0000
commitc828daa905491e65deb30a2ed34af609cdb96b99 (patch)
tree3716828b64701eceeea4e2f95ba44a3ff60c49cf /httemplate
parent298b8d9a262265fe7106da1ff552ce6778237034 (diff)
pro-rating w/ web interface, tested (closes: Bug#313).
view/cust_bill.cgi invoice view shows invoice events! fix bug where adding events with no name silently failed instead of giving an error add new comission plans
Diffstat (limited to 'httemplate')
-rwxr-xr-xhttemplate/browse/part_bill_event.cgi4
-rwxr-xr-xhttemplate/edit/part_pkg.cgi88
-rwxr-xr-xhttemplate/edit/process/part_bill_event.cgi1
-rwxr-xr-xhttemplate/edit/process/part_pkg.cgi4
-rwxr-xr-xhttemplate/view/cust_bill.cgi15
5 files changed, 97 insertions, 15 deletions
diff --git a/httemplate/browse/part_bill_event.cgi b/httemplate/browse/part_bill_event.cgi
index 7ec8a181a..81228f2ea 100755
--- a/httemplate/browse/part_bill_event.cgi
+++ b/httemplate/browse/part_bill_event.cgi
@@ -1,4 +1,4 @@
-<!-- $Id: part_bill_event.cgi,v 1.3 2002-01-30 18:22:54 ivan Exp $ -->
+<!-- $Id: part_bill_event.cgi,v 1.4 2002-02-10 02:16:46 ivan Exp $ -->
<%
my %search;
@@ -66,7 +66,7 @@ my $total = scalar(@part_bill_event);
<% } %>
<TR>
- <TD COLSPAN=8><A HREF="<%= $p %>edit/part_bill_event.cgi"><I>Add a new billing event</I></A></TD>
+ <TD COLSPAN=8><A HREF="<%= $p %>edit/part_bill_event.cgi"><I>Add a new invoice event</I></A></TD>
</TR>
</TABLE>
</BODY>
diff --git a/httemplate/edit/part_pkg.cgi b/httemplate/edit/part_pkg.cgi
index ea3f62aa2..bead1410a 100755
--- a/httemplate/edit/part_pkg.cgi
+++ b/httemplate/edit/part_pkg.cgi
@@ -1,4 +1,4 @@
-<!-- $Id: part_pkg.cgi,v 1.9 2002-01-29 16:33:16 ivan Exp $ -->
+<!-- $Id: part_pkg.cgi,v 1.10 2002-02-10 02:16:47 ivan Exp $ -->
<%
@@ -175,8 +175,44 @@ tie my %plans, 'Tie::IxHash',
'recur' => 'what.recur_fee.value',
},
+ 'prorate' => {
+ 'name' => 'First month pro-rated, then flat-rate',
+ 'fields' => {
+ 'setup_fee' => { 'name' => 'Setup fee for this package',
+ 'default' => 0,
+ },
+ 'recur_fee' => { 'name' => 'Recurring fee for this package',
+ 'default' => 0,
+ },
+ },
+ 'fieldorder' => [ 'setup_fee', 'recur_fee' ],
+ 'setup' => 'what.setup_fee.value',
+ '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) ; \'',
+ },
+
+ 'flat_comission_cust' => {
+ 'name' => 'Flat rate with recurring comission 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)',
+ 'default' => 0,
+ },
+ 'comission_depth' => { 'name' => 'Number of layers',
+ 'default' => 1,
+ },
+ },
+ 'fieldorder' => [ 'setup_fee', 'recur_fee', 'comission_depth', 'comission_amount' ],
+ 'setup' => 'what.setup_fee.value',
+ '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 + \';\'',
+ },
+
'flat_comission' => {
- 'name' => 'Flat rate with recurring referral comission as credit',
+ 'name' => 'Flat rate with recurring comission per active package',
'fields' => {
'setup_fee' => { 'name' => 'Setup fee for this package',
'default' => 0,
@@ -184,7 +220,7 @@ tie my %plans, 'Tie::IxHash',
'recur_fee' => { 'name' => 'Recurring fee for this package',
'default' => 0,
},
- 'comission_amount' => { 'name' => 'Comission amount',
+ 'comission_amount' => { 'name' => 'Comission amount per month (per active package)',
'default' => 0,
},
'comission_depth' => { 'name' => 'Number of layers',
@@ -196,6 +232,36 @@ tie my %plans, 'Tie::IxHash',
'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 + \';\'',
},
+ 'flat_comission_pkg' => {
+ 'name' => 'Flat rate with recurring comission per active (selected) 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)',
+ 'default' => 0,
+ },
+ 'comission_depth' => { 'name' => 'Number of layers',
+ 'default' => 1,
+ },
+ 'comission_pkgpart' => { 'name' => 'Applicable packages<BR><FONT SIZE="-1">(hold <b>ctrl</b> to select multiple packages)</FONT>',
+ 'type' => 'select_multiple',
+ 'select_table' => 'part_pkg',
+ 'select_hash' => { 'disabled' => '' } ,
+ 'select_key' => 'pkgpart',
+ 'select_label' => 'pkg',
+ },
+ },
+ 'fieldorder' => [ 'setup_fee', 'recur_fee', 'comission_depth', 'comission_amount', 'comission_pkgpart' ],
+ 'setup' => 'what.setup_fee.value',
+ '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 + \';\'',
+ },
+
+
+
'sesmon_hour' => {
'name' => 'Base charge plus charge per-hour from the session monitor',
'fields' => {
@@ -345,9 +411,21 @@ if ( $cgi->param('pkgnum') ) {
: keys %{ $href }
) {
%>
-<TR><TD ALIGN="right"><%= $href->{$field}{'name'} %></TD>
-<TD><INPUT TYPE="text" NAME="<%= $field %>" VALUE="<%= exists($plandata{$field}) ? $plandata{$field} : $href->{$field}{'default'} %>" onChange="fchanged(this)"></TD></TR>
+ <TR><TD ALIGN="right"><%= $href->{$field}{'name'} %></TD>
+ <TD>
+ <% if ( ! exists($href->{$field}{'type'}) ) { %>
+ <INPUT TYPE="text" NAME="<%= $field %>" VALUE="<%= exists($plandata{$field}) ? $plandata{$field} : $href->{$field}{'default'} %>" onChange="fchanged(this)">
+ <% } elsif ( $href->{$field}{'type'} eq 'select_multiple' ) { %>
+ <SELECT MULTIPLE NAME="<%= $field %>" onChange="fchanged(this)">
+ <% foreach $record ( qsearch( $href->{$field}{'select_table'}, $href->{$field}{'select_hash'} ) ) {
+ my $value = $record->getfield($href->{$field}{'select_key'}); %>
+ <OPTION VALUE="<%= $value %>"<%= $plandata{$field} =~ /(^|, *)$value *(,|$)/ ? ' SELECTED' : '' %>><%= $record->getfield($href->{$field}{'select_label'}) %>
+ <% } %>
+ </SELECT>
+ <% } %>
+ </TD></TR>
<% } %>
+
</TABLE>
<INPUT TYPE="hidden" NAME="plandata" VALUE="<%= join(',', keys %{ $href } ) %>">
<BR><BR>
diff --git a/httemplate/edit/process/part_bill_event.cgi b/httemplate/edit/process/part_bill_event.cgi
index 7c0b54d0d..1716c71b9 100755
--- a/httemplate/edit/process/part_bill_event.cgi
+++ b/httemplate/edit/process/part_bill_event.cgi
@@ -34,7 +34,6 @@ if ( ! $cgi->param('plan_weight_eventcode') ) {
} fields('part_bill_event'),
} );
- my $error;
if ( $eventpart ) {
$error = $new->replace($old);
} else {
diff --git a/httemplate/edit/process/part_pkg.cgi b/httemplate/edit/process/part_pkg.cgi
index 5240d8cc2..9ad1527a1 100755
--- a/httemplate/edit/process/part_pkg.cgi
+++ b/httemplate/edit/process/part_pkg.cgi
@@ -1,4 +1,4 @@
-<!-- $Id: part_pkg.cgi,v 1.8 2002-02-09 18:24:01 ivan Exp $ -->
+<!-- $Id: part_pkg.cgi,v 1.9 2002-02-10 02:16:47 ivan Exp $ -->
<%
my $dbh = dbh;
@@ -11,7 +11,7 @@ my $old = qsearchs('part_pkg',{'pkgpart'=>$pkgpart}) if $pkgpart;
my $plandata = $cgi->param('plandata');
my @plandata = split(',', $plandata);
$cgi->param('plandata',
- join('', map { "$_=". $cgi->param($_). "\n" } @plandata )
+ join('', map { "$_=". join(', ', $cgi->param($_)). "\n" } @plandata )
);
foreach (qw( setuptax recurtax disabled )) {
diff --git a/httemplate/view/cust_bill.cgi b/httemplate/view/cust_bill.cgi
index 6bc156816..5860ffd11 100755
--- a/httemplate/view/cust_bill.cgi
+++ b/httemplate/view/cust_bill.cgi
@@ -1,4 +1,4 @@
-<!-- $Id: cust_bill.cgi,v 1.7 2002-02-04 16:44:47 ivan Exp $ -->
+<!-- $Id: cust_bill.cgi,v 1.8 2002-02-10 02:16:47 ivan Exp $ -->
<%
#untaint invnum
@@ -20,10 +20,15 @@ print header('Invoice View', menubar(
print qq!<A HREF="${p}edit/cust_pay.cgi?$invnum">Enter payments (check/cash) against this invoice</A> | !
if $cust_bill->owed > 0;
-print qq!<A HREF="${p}misc/print-invoice.cgi?$invnum">Reprint this invoice</A>!.
-# "<BR><BR>(Printed $printed times)".
-#print cust_bill_events
- '<PRE>'.
+print qq!<A HREF="${p}misc/print-invoice.cgi?$invnum">Reprint this invoice</A>!. '<BR><BR>';
+
+foreach my $cust_bill_event (
+ sort { $a->_date <=> $b->_date } $cust_bill->cust_bill_event
+) {
+ print time2str("%a %b %e %T %Y", $cust_bill_event->_date). ' - '.
+ $cust_bill_event->part_bill_event->event. '<BR>';
+}
+print '<BR><PRE>';
print $cust_bill->print_text;