1 <& /elements/header-popup.html, {
2 'title' => $quotationnum ? mt('Add package to quotation')
3 : mt('Order new package'),
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 <SCRIPT TYPE="text/javascript" SRC="../elements/order_pkg.js"></SCRIPT>
15 <& /elements/error.html &>
17 <FORM NAME="OrderPkgForm" ACTION="<% $p %>edit/process/quick-cust_pkg.cgi" METHOD="POST">
19 <INPUT TYPE="hidden" NAME="custnum" VALUE="<% $cust_main ? $cust_main->custnum : '' %>">
20 <INPUT TYPE="hidden" NAME="prospectnum" VALUE="<% $prospect_main ? $prospect_main->prospectnum : '' %>">
21 <INPUT TYPE="hidden" NAME="qualnum" VALUE="<% scalar($cgi->param('qualnum')) |h %>">
22 <INPUT TYPE="hidden" NAME="quotationnum" VALUE="<% $quotationnum %>">
24 <INPUT TYPE="hidden" NAME="svcpart" VALUE="<% $svcpart %>">
27 % my $num_sales = $agent->num_sales;
28 % my $conf_pkg_referral = $conf->exists('pkg_referral');
29 % my $show_sales = $num_sales && $conf_pkg_referral;
30 % my $show_sales_table = $num_sales || $conf_pkg_referral;
32 % if ( $show_sales ) {
33 <FONT CLASS="fsinnerbox-title"><% mt('Sales') |h %></FONT>
35 % if ( $show_sales_table ) {
36 <% ntable("#cccccc") %>
39 <& /elements/tr-select-sales.html,
40 'curr_value' => scalar($cgi->param('salesnum')),
41 'agentnum' => $agent->agentnum,
45 % if ( $conf->exists('pkg_referral') ) {
46 <& /elements/tr-select-part_referral.html,
47 'curr_value' => scalar( $cgi->param('refnum') ), #get rid of empty_label first# || $cust_main->refnum,
49 'multiple' => $conf->exists('pkg_referral-multiple'),
54 % if ( $show_sales_table ) {
58 <FONT CLASS="fsinnerbox-title"><% mt('Package') |h %></FONT>
59 <% ntable("#cccccc") %>
62 <INPUT TYPE="hidden" NAME="pkgpart" VALUE="<% $part_pkg->pkgpart %>">
64 <TH ALIGN="right"><% mt('Package') |h %></TH>
65 <TD COLSPAN=6><% $part_pkg->pkg_comment |h %></TD>
68 <& /elements/tr-select-cust-part_pkg.html,
69 'curr_value' => $pkgpart,
71 'cust_main' => $cust_main,
72 'prospect_main' => $prospect_main,
76 <& /elements/tr-input-pkg-quantity.html, curr_value => $quantity &>
78 % if ( $cust_main && $cust_main->payby =~ /^(CARD|CHEK)$/ ) {
79 % my $what = lc(FS::payby->shortname($cust_main->payby));
81 <TH ALIGN="right"><% mt("Disable automatic $what charge") |h %> </TH>
82 <TD COLSPAN=6><INPUT TYPE="checkbox" NAME="no_auto" VALUE="Y"></TD>
87 <TH ALIGN="right"><% mt('Start') |h %> </TD>
89 <INPUT TYPE="radio" NAME="start" ID="start_now" VALUE="" <% $cgi->param('start') eq '' ? 'CHECKED' : ''%>>Now
91 <INPUT TYPE="radio" NAME="start" ID="start_on_hold" VALUE="on_hold" <% $cgi->param('start') eq 'on_hold' ? 'CHECKED' : ''%>>On hold
93 <INPUT TYPE="radio" NAME="start" ID="start_on_date" VALUE="on_date" <% $cgi->param('start') eq 'date' ? 'CHECKED' : ''%>>On date
95 <& /elements/input-date-field.html,{
96 'name' => 'start_date',
97 'format' => $date_format,
105 <TH ALIGN="right"><% mt('Contract end date') |h %> </TD>
107 <& /elements/input-date-field.html,{
108 'name' => 'contract_end',
109 'format' => $date_format,
118 % my $discount_cust_pkg = $curuser->access_right('Discount customer package');
119 % my $waive_setup_fee = $curuser->access_right('Waive setup fee');
121 % if ( $discount_cust_pkg || $waive_setup_fee ) {
122 <FONT CLASS="fsinnerbox-title"><% mt('Discounting') |h %></FONT>
123 <% ntable("#cccccc") %>
125 % if ( $waive_setup_fee ) {
127 <TH ALIGN="right"><% mt('Waive setup fee') |h %> </TH>
128 <TD COLSPAN=6><INPUT TYPE="checkbox" NAME="waive_setup" VALUE="Y"></TD>
132 % if ( $discount_cust_pkg ) {
133 <& /elements/tr-select-discount.html,
134 'element_etc' => 'DISABLED',
145 % my $lock_locationnum = scalar($cgi->param('lock_locationnum'));
146 % my $contact_title = $lock_locationnum ? 'Contact'
147 % : 'Contact and Location';
148 <FONT CLASS="fsinnerbox-title"><% mt($contact_title) |h %></FONT>
149 <% ntable("#cccccc") %>
151 <& /elements/tr-select-contact.html,
153 'cust_main' => $cust_main,
154 'prospect_main' => $prospect_main,
157 % if ( $cgi->param('lock_locationnum') ) {
159 <INPUT TYPE = "hidden"
162 VALUE = "<% scalar($cgi->param('lock_locationnum')) |h %>"
167 <& /elements/tr-select-cust_location.html,
169 'cust_main' => $cust_main,
170 'prospect_main' => $prospect_main,
177 % unless ( $cgi->param('lock_locationnum') ) {
179 <& /elements/standardize_locations.html,
180 'form' => "OrderPkgForm",
181 'callback' => 'document.OrderPkgForm.submit()',
183 'with_census_functions' => 1,
189 % my $onclick = $cgi->param('lock_locationnum')
190 % ? 'document.OrderPkgForm.submit()'
191 % : 'standardize_new_location()';
192 <INPUT NAME = "submitButton"
194 VALUE = "<% mt("Order Package") |h %>"
195 onClick = "this.disabled=true; <% $onclick %>;"
196 <% $pkgpart ? '' : 'DISABLED' %>
204 my $curuser = $FS::CurrentUser::CurrentUser;
207 unless $curuser->access_right('Order customer package');
209 my $conf = new FS::Conf;
210 my $date_format = $conf->config('date_format') || '%m/%d/%Y';
213 if ( $cgi->param('custnum') =~ /^(\d+)$/ ) {
215 $cust_main = qsearchs({
216 'table' => 'cust_main',
217 'hashref' => { 'custnum' => $custnum },
218 'extra_sql' => ' AND '. $curuser->agentnums_sql,
222 my $prospect_main = '';
223 if ( $cgi->param('prospectnum') =~ /^(\d+)$/ ) {
224 my $prospectnum = $1;
225 $prospect_main = qsearchs({
226 'table' => 'prospect_main',
227 'hashref' => { 'prospectnum' => $prospectnum },
228 'extra_sql' => ' AND '. $curuser->agentnums_sql,
232 my $quotationnum = '';
233 if ( $cgi->param('quotationnum') =~ /^(\d+)$/ ) {
237 die 'no custnum or prospectnum' unless $cust_main || $prospect_main;
239 my $agent = $cust_main ? $cust_main->agent
240 : $prospect_main->agent;
243 if ( $cgi->param('lock_pkgpart') ) {
244 $part_pkg = qsearchs({
245 'table' => 'part_pkg',
246 'hashref' => { 'pkgpart' => scalar($cgi->param('lock_pkgpart')) },
247 'extra_sql' => ' AND '. FS::part_pkg->agent_pkgs_sql($agent),
249 or die "unknown pkgpart ". $cgi->param('lock_pkgpart');
252 my $pkgpart = $part_pkg ? $part_pkg->pkgpart : scalar($cgi->param('pkgpart'));
255 if ( $cgi->param('quantity') =~ /^\s*(\d+)\s*$/ ) {
259 my $format = $date_format. ' %T %z (%Z)'; #false laziness w/REAL_cust_pkg.cgi?
261 my $svcpart = scalar($cgi->param('svcpart'));