summaryrefslogtreecommitdiff
path: root/httemplate/edit/part_bill_event.cgi
diff options
context:
space:
mode:
Diffstat (limited to 'httemplate/edit/part_bill_event.cgi')
-rwxr-xr-xhttemplate/edit/part_bill_event.cgi131
1 files changed, 131 insertions, 0 deletions
diff --git a/httemplate/edit/part_bill_event.cgi b/httemplate/edit/part_bill_event.cgi
new file mode 100755
index 000000000..41d6666dc
--- /dev/null
+++ b/httemplate/edit/part_bill_event.cgi
@@ -0,0 +1,131 @@
+<!-- $Id: part_bill_event.cgi,v 1.1 2002-01-29 16:33:16 ivan Exp $ -->
+
+<%
+
+if ( $cgi->param('eventnum') && $cgi->param('eventnum') =~ /^(\d+)$/ ) {
+ $cgi->param('eventnum', $1);
+} else {
+ $cgi->param('eventnum', '');
+}
+
+my ($query) = $cgi->keywords;
+my $action = '';
+my $part_bill_event = '';
+if ( $cgi->param('error') ) {
+ $part_bill_event = new FS::part_bill_event ( {
+ map { $_, scalar($cgi->param($_)) } fields('part_bill_event')
+ } );
+}
+if ( $query && $query =~ /^(\d+)$/ ) {
+ $part_bill_event ||= qsearchs('part_bill_event',{'eventpart'=>$1});
+} else {
+ $part_bill_event ||= new FS::part_bill_event {};
+}
+$action ||= $part_bill_event->pkgpart ? 'Edit' : 'Add';
+my $hashref = $part_bill_event->hashref;
+
+print header("$action Invoice Event Definition", menubar(
+ 'Main Menu' => popurl(2),
+ 'View all invoice events' => popurl(2). 'browse/part_bill_event.cgi',
+));
+
+print qq!<FONT SIZE="+1" COLOR="#ff0000">Error: !, $cgi->param('error'),
+ "</FONT>"
+ if $cgi->param('error');
+
+print '<FORM ACTION="', popurl(1), 'process/part_bill_event.cgi" METHOD=POST>';
+
+print "Invoice Event #", $hashref->{eventpart} ? $hashref->{eventpart} : "(NEW)";
+
+print ntable("#cccccc",2), <<END;
+<TR><TD ALIGN="right">Payby</TD><TD><SELECT NAME="payby">
+END
+
+for (qw(CARD BILL COMP)) {
+ print qq!<OPTION VALUE="$_"!;
+ if ($part_bill_event->payby eq $_) {
+ print " SELECTED> $_</OPTION>";
+ } else {
+ print ">$_</OPTION>";
+ }
+}
+
+my $days = $hashref->{seconds}/3600;
+
+print <<END;
+</SELECT></TD></TR>
+<TR><TD ALIGN="right">Event</TD><TD><INPUT TYPE="text" NAME="event" VALUE="$hashref->{event}"></TD></TR>
+<TR><TD ALIGN="right">After</TD><TD><INPUT TYPE="text" NAME="days" VALUE="$days"> days</TD></TR>
+END
+
+print '<TR><TD ALIGN="right">Disabled</TD><TD>';
+print '<INPUT TYPE="checkbox" NAME="disabled" VALUE="Y"';
+print ' CHECKED' if $hashref->{disabled} eq "Y";
+print '>';
+print '</TD></TR>';
+
+print '<TR><TD ALIGN="right">Action</TD><TD>';
+
+#print ntable();
+
+#this is pretty kludgy right here.
+tie my %events, 'Tie::IxHash',
+
+ 'Charge a fee' => {
+ 'code' => '$cust_main->charge( %%%charge%%%, \'%%%reason%%%\' );',
+ 'html' => 'Amount <INPUT TYPE="text" SIZE="7" NAME="charge"><BR>'.
+ 'Reason <INPUT TYPE="text" NAME="reason">',
+ },
+ 'Suspend accounts' => {
+ 'code' => '$cust_main->suspend();',
+ },
+ 'Cancel accounts' => {
+ 'code' => '$cust_main->cancel();',
+ },
+
+ 'Add postal invoicing' => {
+ 'code' => '$cust_main->invoicing_list_addpost();',
+ 'pad' => 10,
+ },
+
+ 'Generate invoices' => {
+ 'code' => '$cust_main->bill();',
+ 'pad' => 20,
+ },
+
+ 'Apply unapplied payments and credits' => {
+ 'code' => '$cust_main->apply_payments; $cust_main->apply_credits;',
+ 'pad' => 30,
+ },
+
+ 'Collect on invoices' => {
+ 'code' => '$cust_main->collect();',
+ 'pad' => 40,
+ },
+
+;
+
+foreach my $event ( keys %events ) {
+ print ntable( "#cccccc", 2). qq!<TR><TD><INPUT TYPE="radio" NAME="eventcode" VALUE="!.
+ encode_entities($events{$event}{code}). qq!">$event</TD>!;
+ print '<TD>'. $events{$event}{html}. '</TD>' if exists $events{$event}{html};
+ print qq!</TR>!;
+ print '</TABLE>';
+}
+
+#print '</TABLE>';
+
+print <<END;
+</TD></TR>
+</TABLE>
+END
+
+print qq!<INPUT TYPE="submit" VALUE="!,
+ $hashref->{pkgpart} ? "Apply changes" : "Add invoice event",
+ qq!">!;
+%>
+
+ </FORM>
+ </BODY>
+</HTML>
+