1 <& /elements/header-popup.html, {
2 'title' => $quotationnum ? mt('Add package to quotation')
3 : mt('Order new package'),
8 <& /elements/xmlhttp.html,
9 'url' => $p.'misc/xmlhttp-part_pkg_usageprice.html',
10 'subs' => [ 'get_part_pkg_usageprice' ],
14 <LINK REL="stylesheet" TYPE="text/css" HREF="../elements/calendar-win2k-2.css" TITLE="win2k-2">
15 <SCRIPT TYPE="text/javascript" SRC="../elements/calendar_stripped.js"></SCRIPT>
16 <SCRIPT TYPE="text/javascript" SRC="../elements/calendar-en.js"></SCRIPT>
17 <SCRIPT TYPE="text/javascript" SRC="../elements/calendar-setup.js"></SCRIPT>
19 <SCRIPT TYPE="text/javascript" SRC="../elements/order_pkg.js"></SCRIPT>
21 <& /elements/error.html &>
23 <FORM NAME="OrderPkgForm" ACTION="<% $p %>edit/process/quick-cust_pkg.cgi" METHOD="POST">
25 <INPUT TYPE="hidden" NAME="custnum" VALUE="<% $cust_main ? $cust_main->custnum : '' %>">
26 <INPUT TYPE="hidden" NAME="prospectnum" VALUE="<% $prospect_main ? $prospect_main->prospectnum : '' %>">
27 <INPUT TYPE="hidden" NAME="qualnum" VALUE="<% scalar($cgi->param('qualnum')) |h %>">
28 <INPUT TYPE="hidden" NAME="quotationnum" VALUE="<% $quotationnum %>">
30 <INPUT TYPE="hidden" NAME="svcpart" VALUE="<% $svcpart %>">
33 % my $num_sales = $agent->num_sales;
34 % my $conf_pkg_referral = $conf->exists('pkg_referral');
35 % my $show_sales = $num_sales && $conf_pkg_referral;
36 % my $show_sales_table = $num_sales || $conf_pkg_referral;
38 % if ( $show_sales ) {
39 <FONT CLASS="fsinnerbox-title"><% mt('Sales') |h %></FONT>
41 % if ( $show_sales_table ) {
42 <% ntable("#cccccc") %>
45 <& /elements/tr-select-sales.html,
46 'curr_value' => scalar($cgi->param('salesnum')),
47 'agentnum' => $agent->agentnum,
51 % if ( $conf->exists('pkg_referral') ) {
52 <& /elements/tr-select-part_referral.html,
53 'curr_value' => scalar( $cgi->param('refnum') ), #get rid of empty_label first# || $cust_main->refnum,
55 'multiple' => $conf->exists('pkg_referral-multiple'),
60 % if ( $show_sales_table ) {
64 <FONT CLASS="fsinnerbox-title"><% mt('Package') |h %></FONT>
65 <% ntable("#cccccc") %>
68 <INPUT TYPE="hidden" NAME="pkgpart" VALUE="<% $part_pkg->pkgpart %>">
70 <TH ALIGN="right"><% mt('Package') |h %></TH>
71 <TD COLSPAN=6><% $part_pkg->pkg_comment |h %></TD>
74 <& /elements/tr-select-cust-part_pkg.html,
75 'curr_value' => $pkgpart,
77 'cust_main' => $cust_main,
78 'prospect_main' => $prospect_main,
82 <& /elements/tr-input-pkg-quantity.html, curr_value => $quantity &>
84 % if ( $cust_main && $cust_main->payby =~ /^(CARD|CHEK)$/ ) {
85 % my $what = lc(FS::payby->shortname($cust_main->payby));
87 <TH ALIGN="right"><% mt("Disable automatic $what charge") |h %> </TH>
88 <TD COLSPAN=6><INPUT TYPE="checkbox" NAME="no_auto" VALUE="Y"></TD>
93 <TH ALIGN="right"><% mt('Start date') |h %> </TD>
95 <& /elements/input-date-field.html,{
96 'name' => 'start_date',
97 'format' => $date_format,
101 <IMG SRC = "<%$fsurl%>images/calendar-disabled.png"
102 ID = "start_date_button_disabled"
103 STYLE = "display:none">
104 <FONT SIZE=-1>(<% mt('leave blank to start immediately') |h %>)</FONT>
109 <TH ALIGN="right"><% mt('Contract end date') |h %> </TD>
111 <& /elements/input-date-field.html,{
112 'name' => 'contract_end',
113 'format' => $date_format,
123 %# - hide until you selecdt a pacakge with add-ons
124 %# -lookup and display the available add-ons when
125 %# -add them to the (recur if there is one, otherwise setup) price and display magically like processing fees do on edit/cust_pay.cgi
128 <FONT CLASS = "fsinnerbox-title"
129 ID = "cust_pkg_usageprice_title"
130 STYLE = "display:none"
131 ><% mt('Usage add-ons') |h %></FONT>
132 <TABLE BGCOLOR="#cccccc" BORDER=0 CELLSPACING=0 ID="cust_pkg_usageprice_table">
137 % my $discount_cust_pkg = $curuser->access_right('Discount customer package');
138 % my $waive_setup_fee = $curuser->access_right('Waive setup fee');
140 % if ( $discount_cust_pkg || $waive_setup_fee ) {
141 <FONT CLASS="fsinnerbox-title"><% mt('Discounting') |h %></FONT>
142 <% ntable("#cccccc") %>
144 % if ( $waive_setup_fee ) {
146 <TH ALIGN="right"><% mt('Waive setup fee') |h %> </TH>
147 <TD COLSPAN=6><INPUT TYPE="checkbox" NAME="waive_setup" VALUE="Y"></TD>
151 % if ( $discount_cust_pkg ) {
152 <& /elements/tr-select-discount.html,
153 'element_etc' => 'DISABLED',
164 % my $lock_locationnum = scalar($cgi->param('lock_locationnum'));
165 % my $contact_title = $lock_locationnum ? 'Contact'
166 % : 'Contact and Location';
167 <FONT CLASS="fsinnerbox-title"><% mt($contact_title) |h %></FONT>
168 <% ntable("#cccccc") %>
170 <& /elements/tr-select-contact.html,
172 'cust_main' => $cust_main,
173 'prospect_main' => $prospect_main,
176 % if ( $cgi->param('lock_locationnum') ) {
178 <INPUT TYPE = "hidden"
181 VALUE = "<% scalar($cgi->param('lock_locationnum')) |h %>"
186 <& /elements/tr-select-cust_location.html,
188 'cust_main' => $cust_main,
189 'prospect_main' => $prospect_main,
196 % unless ( $cgi->param('lock_locationnum') ) {
198 <& /elements/standardize_locations.html,
199 'form' => "OrderPkgForm",
200 'callback' => 'document.OrderPkgForm.submit()',
202 'with_census_functions' => 1,
208 % my $onclick = $cgi->param('lock_locationnum')
209 % ? 'document.OrderPkgForm.submit()'
210 % : 'standardize_new_location()';
211 <INPUT NAME = "submitButton"
213 VALUE = "<% mt("Order Package") |h %>"
214 onClick = "this.disabled=true; <% $onclick %>;"
215 <% $pkgpart ? '' : 'DISABLED' %>
223 my $curuser = $FS::CurrentUser::CurrentUser;
226 unless $curuser->access_right('Order customer package');
228 my $conf = new FS::Conf;
229 my $date_format = $conf->config('date_format') || '%m/%d/%Y';
232 if ( $cgi->param('custnum') =~ /^(\d+)$/ ) {
234 $cust_main = qsearchs({
235 'table' => 'cust_main',
236 'hashref' => { 'custnum' => $custnum },
237 'extra_sql' => ' AND '. $curuser->agentnums_sql,
241 my $prospect_main = '';
242 if ( $cgi->param('prospectnum') =~ /^(\d+)$/ ) {
243 my $prospectnum = $1;
244 $prospect_main = qsearchs({
245 'table' => 'prospect_main',
246 'hashref' => { 'prospectnum' => $prospectnum },
247 'extra_sql' => ' AND '. $curuser->agentnums_sql,
251 my $quotationnum = '';
252 if ( $cgi->param('quotationnum') =~ /^(\d+)$/ ) {
256 die 'no custnum or prospectnum' unless $cust_main || $prospect_main;
258 my $agent = $cust_main ? $cust_main->agent
259 : $prospect_main->agent;
262 if ( $cgi->param('lock_pkgpart') ) {
263 $part_pkg = qsearchs({
264 'table' => 'part_pkg',
265 'hashref' => { 'pkgpart' => scalar($cgi->param('lock_pkgpart')) },
266 'extra_sql' => ' AND '. FS::part_pkg->agent_pkgs_sql($agent),
268 or die "unknown pkgpart ". $cgi->param('lock_pkgpart');
271 my $pkgpart = $part_pkg ? $part_pkg->pkgpart : scalar($cgi->param('pkgpart'));
274 if ( $cgi->param('quantity') =~ /^\s*(\d+)\s*$/ ) {
278 my $format = $date_format. ' %T %z (%Z)'; #false laziness w/REAL_cust_pkg.cgi?
280 my $svcpart = scalar($cgi->param('svcpart'));