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