change one-time charge UI to a full page to avoid conflict with taxproducts, #71394
[freeside.git] / httemplate / view / quotation.html
1 <& /elements/header.html, mt('Quotation View'), $menubar &>
2
3 <& /elements/init_overlib.html &>
4
5 <SCRIPT TYPE="text/javascript">
6 function areyousure(href, message) {
7   if (confirm(message) == true)
8     window.location.href = href;
9 }
10 </SCRIPT>
11
12 % unless ( $quotation->disabled eq 'Y' ) {
13
14 %   my $inrow = 0;
15 %   if ( $curuser->access_right('Order customer package') ) {
16       <& /elements/order_pkg_link.html,
17            'label'       => emt('Add package'),
18            'actionlabel' => emt('Add package'),
19            map { $_ => $quotation->$_ } qw( quotationnum custnum prospectnum )
20       &>
21 %     $inrow++;
22 %   }
23
24 %   if ( $curuser->access_right('One-time charge') ) {
25       <% $inrow ? ' | ' : '' %>
26 %     my $query = 'quotationnum=' . $quotation->get('quotationnum');
27 %     if ($quotation->custnum) {
28 %       $query .= ';custnum=' . $quotation->custnum;
29 %     } else {
30 %       $query .= ';prospectnum=' . $quotation->prospectnum;
31 %     }
32       <A HREF="<% $fsurl . 'edit/quick-charge.html?' . $query %>"><% emt('One-time charge') %></A>
33 %     $inrow++;
34 %   }
35
36 %   if ( $can_generate_quotation ) {
37       <% $inrow ? ' | ' : '' %>
38       <A HREF="<%$p%>edit/quotation.html?quotationnum=<% $quotation->quotationnum %>">Edit quotation fields</A>
39 %     $inrow++;
40 %   }
41
42     <% $inrow ? '<BR><BR>' : '' %>
43
44 %   if ( 1 ) { #if ( $curuser->access_right('Send quotations') )
45
46       <& /elements/popup_link.html,
47            'action'      => "${p}misc/email-quotation.html".
48                               "?quotationnum=$quotationnum",
49            'label'       => emt('Email this quotation'),
50            'actionlabel' => emt('Select recipients'),
51            #'width'       => 540,
52            #'height'      => 336,
53       &>
54
55 %#      <A HREF="<% $p %>misc/send-invoice.cgi?method=print;<% $link %>"><% mt('Re-print this invoice') |h %></A>
56
57 %#%     if ( $conf->exists('hylafax') && length($cust_bill->cust_main->fax) ) { 
58 %#           | <A HREF="<% $p %>misc/send-invoice.cgi?method=fax;<% $link %>"><% mt('Re-fax this invoice') |h %></A>
59 %#%     } 
60
61 %   }
62
63 %   if ( $conf->exists('quotation_latex') ) { 
64       | <A HREF="<% $p %>view/quotation-pdf.cgi?<% $link %>"><% mt('View typeset quotation PDF') |h %></A>
65 %   }
66
67     <BR><BR>
68
69 %   if ( $curuser->access_right('New customer') && $quotation->quotation_pkg ) {
70       <A HREF="<%$p%>edit/process/quotation_convert.html?quotationnum=<% $quotation->quotationnum %>">Place order</A>
71       <BR><BR>
72 %   }
73
74 % }
75
76 % if ( $curuser->access_right('Disable quotation') ) {
77 %   if ( $quotation->disabled eq 'Y' ) {
78       <A HREF="<%$p%>misc/enable-quotation.html?quotationnum=<% $quotation->quotationnum %>" TITLE="<% emt('Enable this quotation') %>"><% emt('Enable this quotation') %></A>
79 %   } else {
80       <% areyousure_link(
81            "${p}misc/disable-quotation.html?quotationnum=". $quotation->quotationnum,
82            emt('Are you sure you want to disable this quotation?'),
83            emt('Disable this quotation'), #tooltip
84            emt('Disable this quotation'), #link
85       ) %>
86 %   }
87   <BR><BR>
88 % }
89
90 % if ( $error ) {
91 <DIV CLASS="error"><% emt('Error calculating quotation: [_1]', $error) %></DIV>
92 % }
93
94 % my $close_date = $quotation->close_date;
95 % my $confidence = $quotation->confidence;
96 % if ($close_date or length($confidence)) {
97 <TABLE>
98 %   if ($close_date) {
99 <TR>
100   <TH STYLE="text-align: right;">Close Date:</TH>
101   <TD><% time2str($conf->config('date_format') || '%m/%d/%Y',$close_date) %></TD>
102 </TR>
103 %   }
104 %   if (length($confidence)) {
105 <TR><TH STYLE="text-align: right;">Confidence:</TH><TD><% $confidence %>%</TD></TR>
106 %   }
107 </TABLE>
108 % }
109
110 % if ( $conf->exists('quotation_html') ) { 
111     <% join('', $quotation->print_html( preref_callback=>$preref_callback )) %>
112 % } else { 
113 %   die "quotation_html config missing";
114 % }
115 % #plaintext quotations? <PRE><% join('', $quotation->print_text() ) %></PRE>
116
117 <& /elements/footer.html &>
118 <%init>
119
120 my $curuser = $FS::CurrentUser::CurrentUser;
121
122 #die "access denied"
123 #  unless $curuser->access_right('View quotations');
124
125 my $can_generate_quotation = $curuser->access_right('Generate quotation');
126
127 my $quotationnum;
128 my($query) = $cgi->keywords;
129 if ( $query =~ /^(\d+)$/ ) {
130   $quotationnum = $1;
131 } else {
132   $quotationnum = $cgi->param('quotationnum');
133 }
134
135 my $conf = new FS::Conf;
136
137 my $quotation = qsearchs({
138   'select'    => 'quotation.*',
139   'table'     => 'quotation',
140   #'addl_from' => 'LEFT JOIN cust_main USING ( custnum )',
141   'hashref'   => { 'quotationnum' => $quotationnum },
142   #'extra_sql' => ' AND '. $curuser->agentnums_sql,
143 });
144 die "Quotation #$quotationnum not found!" unless $quotation;
145
146 my $error = $quotation->estimate;
147
148 my $menubar = menubar( $quotation->cust_or_prospect_label_link($p) );
149
150 my $link = "quotationnum=$quotationnum";
151 #$link .= ';template='. uri_escape($template) if $template;
152 #$link .= ';notice_name='. $notice_name if $notice_name;
153
154 my $preref_callback = sub {
155   my $quotation_pkg = shift;
156   $can_generate_quotation ?
157   areyousure_link("${p}misc/delete-quotation_pkg.html?". $quotation_pkg->quotationpkgnum,
158                   emt('Are you sure you want to remove this package from the quotation?'),
159                   emt('Remove this package'), #tooltip
160                   qq(<img src="${p}images/cross.png">), #link
161                  ) .
162   include('/elements/popup_link.html',
163     action      => "${p}edit/quotation_pkg_detail.html?pkgnum=" .
164                    $quotation_pkg->quotationpkgnum,
165     html_label  => qq(<IMG SRC="${p}images/Actions-document-edit-icon.png">),
166     title       => emt('Edit quotation details'),
167     actionlabel => emt('Edit quotation details'),
168     color       => '#333399',
169     width       => 763,
170   )
171   : '';
172 };
173
174 sub areyousure_link {
175     my ($url,$msg,$title,$label) = (shift,shift,shift,shift);
176     '<A HREF="javascript:areyousure(\''.$url.'\',\''.$msg.'\')" TITLE="'.$title.'">'.$label.'</A>';
177 }
178
179 </%init>