1 <% include("/elements/header.html",'Customer package - Edit dates') %>
4 %# "View this customer (#$custnum)" => popurl(2). "view/cust_main.cgi?$custnum",
5 %# 'Main Menu' => popurl(2)
8 <LINK REL="stylesheet" TYPE="text/css" HREF="../elements/calendar-win2k-2.css" TITLE="win2k-2">
9 <SCRIPT TYPE="text/javascript" SRC="../elements/calendar_stripped.js"></SCRIPT>
10 <SCRIPT TYPE="text/javascript" SRC="../elements/calendar-en.js"></SCRIPT>
11 <SCRIPT TYPE="text/javascript" SRC="../elements/calendar-setup.js"></SCRIPT>
13 <FORM NAME="formname" ACTION="process/REAL_cust_pkg.cgi" METHOD="POST">
14 <INPUT TYPE="hidden" NAME="pkgnum" VALUE="<% $pkgnum %>">
17 <FONT SIZE="+1" COLOR="#ff0000">Error: <% $error %></FONT>
20 <% ntable("#cccccc",2) %>
23 <TD ALIGN="right">Package number</TD>
24 <TD BGCOLOR="#ffffff"><% $cust_pkg->pkgnum %></TD>
28 <TD ALIGN="right">Package</TD>
29 <TD BGCOLOR="#ffffff"><% $cust_pkg->pkg %></TD>
33 <TD ALIGN="right">Comment</TD>
34 <TD BGCOLOR="#ffffff"><% $cust_pkg->comment %></TD>
38 <TD ALIGN="right">Order taker</TD>
39 <TD BGCOLOR="#ffffff"><% $cust_pkg->otaker %></TD>
42 <& .row_edit, cust_pkg=>$cust_pkg, column=>'setup', label=>'Setup' &>
43 <& .row_edit, cust_pkg=>$cust_pkg, column=>'last_bill', label=>$last_bill_or_renewed &>
44 <& .row_edit, cust_pkg=>$cust_pkg, column=>'bill', label=>$next_bill_or_prepaid_until &>
45 <& .row_edit, cust_pkg=>$cust_pkg, column=>'adjourn', label=>'Adjournment', note=>'(will <b>suspend</b> this package when the date is reached)' &>
46 <& .row_display, cust_pkg=>$cust_pkg, column=>'susp', label=>'Suspension' &>
48 <& .row_edit, cust_pkg=>$cust_pkg, column=>'expire', label=>'Expiration', note=>'(will <b>cancel</b> this package when the date is reached)' &>
49 <& .row_display, cust_pkg=>$cust_pkg, column=>'cancel', label=>'Cancellation' &>
58 % my $value = $cust_pkg->get($column);
59 % $value = $value ? time2str($format, $value) : "";
62 <TD ALIGN="right"><% $label %> date</TD>
65 NAME = "<% $column %>"
67 ID = "<% $column %>_text"
68 VALUE = "<% $value %>"
70 <IMG SRC = "../images/calendar.png"
71 ID = "<% $column %>_button"
72 STYLE = "cursor: pointer"
76 <BR><FONT SIZE=-1><% $note %></FONT>
81 <SCRIPT TYPE="text/javascript">
83 inputField: "<% $column %>_text",
85 button: "<% $column %>_button",
98 % if ( $cust_pkg->get($column) ) {
100 <TD ALIGN="right"><% $label %> date</TD>
101 <TD BGCOLOR="#ffffff"><% time2str($format,$cust_pkg->get($column)) %></TD>
109 <INPUT TYPE="submit" VALUE="Apply Changes">
112 <% include('/elements/footer.html') %>
116 #my $format = "%c %z (%Z)";
117 my $format = "%m/%d/%Y %T %z (%Z)";
119 #false laziness w/view/cust_main/packages.html
120 #my( $billed_or_prepaid,
126 my( $pkgnum, $cust_pkg );
128 if ( $cgi->param('error') ) {
130 $error = $cgi->param('error');
131 $pkgnum = $cgi->param('pkgnum');
132 if ( $error eq '_bill_areyousure' ) {
133 if ( $cgi->param('bill') =~ /^([\s\d\/\:\-\(\w\)]*)$/ ) {
135 $error = "You are attempting to set the next bill date to $bill, which is
136 in the past. This will charge the customer for the interval
137 from $bill until now. Are you sure you want to do this? ".
138 '<INPUT TYPE="checkbox" NAME="bill_areyousure" VALUE="1">';
143 $cust_pkg = qsearchs('cust_pkg',{'pkgnum'=>$pkgnum});
144 die "No package!" unless $cust_pkg;
146 foreach my $col (qw( setup last_bill bill adjourn expire )) {
147 my $value = $cgi->param($col);
148 $cust_pkg->set( $col, $value ? str2time($value) : '' );
153 my($query) = $cgi->keywords;
154 $query =~ /^(\d+)$/ or die "no pkgnum";
158 $cust_pkg = qsearchs('cust_pkg',{'pkgnum'=>$pkgnum});
159 die "No package!" unless $cust_pkg;
163 my $part_pkg = qsearchs( 'part_pkg', { 'pkgpart' => $cust_pkg->pkgpart } );
165 my( $last_bill_or_renewed, $next_bill_or_prepaid_until );
166 unless ( $part_pkg->is_prepaid ) {
167 #$billed_or_prepaid = 'billed';
168 $last_bill_or_renewed = 'Last bill';
169 $next_bill_or_prepaid_until = 'Next bill';
171 #$billed_or_prepaid = 'prepaid';
172 $last_bill_or_renewed = 'Renewed';
173 $next_bill_or_prepaid_until = 'Prepaid until';