1 % if ( $quotation->custnum ) {
2 <& /elements/header-cust_main.html, view=>'quotations', custnum=>$quotation->custnum &>
3 <h2>Quotation #<% $quotationnum %></h2>
4 % } else { #eventually, header-prospect_main.html
5 <& /elements/header.html, mt('Quotation View'), $menubar &>
6 <& /elements/init_overlib.html &>
8 <SCRIPT TYPE="text/javascript">
9 function areyousure(href, message) {
10 if (confirm(message) == true)
11 window.location.href = href;
17 % unless ( $quotation->disabled eq 'Y' ) {
20 % if ( $curuser->access_right('Order customer package') ) {
21 <& /elements/order_pkg_link.html,
22 'label' => emt('Add package'),
23 'actionlabel' => emt('Add package'),
24 map { $_ => $quotation->$_ } qw( quotationnum custnum prospectnum )
29 % if ( $curuser->access_right('One-time charge') ) {
30 <% $inrow ? ' | ' : '' %>
31 % my $query = 'quotationnum=' . $quotation->get('quotationnum');
32 % if ($quotation->custnum) {
33 % $query .= ';custnum=' . $quotation->custnum;
35 % $query .= ';prospectnum=' . $quotation->prospectnum;
37 <A HREF="<% $fsurl . 'edit/quick-charge.html?' . $query %>"><% emt('One-time charge') %></A>
41 % if ( $can_generate_quotation ) {
42 <% $inrow ? ' | ' : '' %>
43 <A HREF="<%$p%>edit/quotation.html?quotationnum=<% $quotation->quotationnum %>">Edit quotation fields</A>
47 <% $inrow ? '<BR><BR>' : '' %>
49 % if ( 1 ) { #if ( $curuser->access_right('Send quotations') )
51 <& /elements/popup_link.html,
52 'action' => "${p}misc/email-quotation.html".
53 "?quotationnum=$quotationnum",
54 'label' => emt('Email this quotation'),
55 'actionlabel' => emt('Select recipients'),
60 %# <A HREF="<% $p %>misc/send-invoice.cgi?method=print;<% $link %>"><% mt('Re-print this invoice') |h %></A>
62 %#% if ( $conf->exists('hylafax') && length($cust_bill->cust_main->fax) ) {
63 %# | <A HREF="<% $p %>misc/send-invoice.cgi?method=fax;<% $link %>"><% mt('Re-fax this invoice') |h %></A>
68 % if ( $conf->exists('quotation_latex') ) {
69 | <A HREF="<% $p %>view/quotation-pdf.cgi?<% $link %>"><% mt('View typeset quotation PDF') |h %></A>
74 % if ( $curuser->access_right('New customer') && $quotation->quotation_pkg ) {
75 % # if we end up with more than one option, combine these links and add an interstitial screen
76 <A HREF="<%$p%>edit/process/quotation_convert.html?quotationnum=<% $quotation->quotationnum %>">Place order</A>
77 | <A HREF="<%$p%>edit/process/quotation_convert.html?quotationnum=<% $quotation->quotationnum %>&onhold=1">Order on hold</A>
83 % if ( $curuser->access_right('Disable quotation') ) {
84 % if ( $quotation->disabled eq 'Y' ) {
85 <A HREF="<%$p%>misc/enable-quotation.html?quotationnum=<% $quotation->quotationnum %>" TITLE="<% emt('Enable this quotation') %>"><% emt('Enable this quotation') %></A>
88 "${p}misc/disable-quotation.html?quotationnum=". $quotation->quotationnum,
89 emt('Are you sure you want to disable this quotation?'),
90 emt('Disable this quotation'), #tooltip
91 emt('Disable this quotation'), #link
98 <DIV CLASS="error"><% emt('Error calculating quotation: [_1]', $error) %></DIV>
101 % my $close_date = $quotation->close_date;
102 % my $confidence = $quotation->confidence;
103 % if ($close_date or length($confidence)) {
107 <TH STYLE="text-align: right;">Close Date:</TH>
108 <TD><% time2str($conf->config('date_format') || '%m/%d/%Y',$close_date) %></TD>
111 % if (length($confidence)) {
112 <TR><TH STYLE="text-align: right;">Confidence:</TH><TD><% $confidence %>%</TD></TR>
117 % if ( $conf->exists('quotation_html') ) {
118 <% join('', $quotation->print_html( preref_callback=>$preref_callback )) %>
120 % die "quotation_html config missing";
122 % #plaintext quotations? <PRE><% join('', $quotation->print_text() ) %></PRE>
124 % if ( $quotation->custnum ) {
125 <& /elements/footer-cust_main.html &>
127 <& /elements/footer.html &>
131 my $curuser = $FS::CurrentUser::CurrentUser;
134 # unless $curuser->access_right('View quotations');
136 my $can_generate_quotation = $curuser->access_right('Generate quotation');
139 my($query) = $cgi->keywords;
140 if ( $query =~ /^(\d+)$/ ) {
143 $quotationnum = $cgi->param('quotationnum');
146 my $conf = new FS::Conf;
148 my $quotation = qsearchs({
149 'select' => 'quotation.*',
150 'table' => 'quotation',
151 #'addl_from' => 'LEFT JOIN cust_main USING ( custnum )',
152 'hashref' => { 'quotationnum' => $quotationnum },
153 #'extra_sql' => ' AND '. $curuser->agentnums_sql,
155 die "Quotation #$quotationnum not found!" unless $quotation;
157 my $error = $quotation->estimate;
159 my $menubar = menubar( $quotation->cust_or_prospect_label_link($p) );
161 my $link = "quotationnum=$quotationnum";
162 #$link .= ';template='. uri_escape($template) if $template;
163 #$link .= ';notice_name='. $notice_name if $notice_name;
165 my $preref_callback = sub {
166 my $quotation_pkg = shift;
167 $can_generate_quotation ?
168 areyousure_link("${p}misc/delete-quotation_pkg.html?". $quotation_pkg->quotationpkgnum,
169 emt('Are you sure you want to remove this package from the quotation?'),
170 emt('Remove this package'), #tooltip
171 qq(<img src="${p}images/cross.png">), #link
173 include('/elements/popup_link.html',
174 action => "${p}edit/quotation_pkg_detail.html?pkgnum=" .
175 $quotation_pkg->quotationpkgnum,
176 html_label => qq(<IMG SRC="${p}images/Actions-document-edit-icon.png">),
177 title => emt('Edit quotation details'),
178 actionlabel => emt('Edit quotation details'),
185 sub areyousure_link {
186 my ($url,$msg,$title,$label) = (shift,shift,shift,shift);
187 '<A HREF="javascript:areyousure(\''.$url.'\',\''.$msg.'\')" TITLE="'.$title.'">'.$label.'</A>';