no need for a one-choice "Add new location" location dropdown on prospect add, RT...
[freeside.git] / httemplate / elements / quotations.html
1 % if ( $curuser->access_right('Generate quotation') ) { 
2
3   <FONT CLASS="fsinnerbox-title"><% mt( 'Quotations' ) |h %></FONT>
4   <A HREF="<%$p%>edit/quotation.html?<% $new_query %>">Create new quotation</A>
5
6 % if ( @quotations ) {
7     <& /elements/table-grid.html &>
8 %     my $bgcolor1 = '#eeeeee';
9 %     my $bgcolor2 = '#ffffff';
10 %     my $bgcolor = '';
11       <THEAD>
12       <TR>
13         <TH CLASS="grid" BGCOLOR="#cccccc">#</TH>
14         <TH CLASS="grid" BGCOLOR="#cccccc"><% mt('Date') |h %></TH>
15         <TH CLASS="grid" BGCOLOR="#cccccc"><% mt('Setup') |h %></TH>
16         <TH CLASS="grid" BGCOLOR="#cccccc"><% mt('Recurring') |h %></TH>
17         <TH CLASS="grid" BGCOLOR="#cccccc"><% mt('Description') |h %></TH>
18         <TH CLASS="grid" BGCOLOR="#cccccc"></TH>
19       </TR>
20       </THEAD>
21 %     foreach my $quotation (@quotations) {
22 %       if ( $bgcolor eq $bgcolor1 ) {
23 %         $bgcolor = $bgcolor2;
24 %       } else {
25 %         $bgcolor = $bgcolor1;
26 %       }
27 %       my $a = qq(<A HREF="$p/view/quotation.html?quotationnum=). #"
28 %               $quotation->quotationnum. '">';
29         <TR>
30           <TD CLASS="grid" BGCOLOR="<% $bgcolor %>"><% $a %><% $quotation->quotationnum %></A></TD>
31           <TD CLASS="grid" BGCOLOR="<% $bgcolor %>"><% $a %><% time2str($date_format, $quotation->_date) |h %></A></TD>
32           <TD CLASS="grid" BGCOLOR="<% $bgcolor %>"><% $a %><% $quotation->total_setup |h %></A></TD>
33           <TD CLASS="grid" BGCOLOR="<% $bgcolor %>"><% $a %><% $quotation->total_recur |h %></A></TD>
34           <TD CLASS="grid" BGCOLOR="<% $bgcolor %>"><% $a %><% $quotation->quotation_description |h %></A></TD>
35           <TD CLASS="grid" BGCOLOR="<% $bgcolor %>"><A HREF="<%$p%>edit/process/quotation_convert.html?quotationnum=<% $quotation->quotationnum %>"><% $opt{convert_label} || 'Convert to customer' %></A></TD>
36         </TR>
37 %     }
38     </TABLE>
39 % }
40     <BR><BR>
41
42 % }
43 <%init>
44
45 my $curuser = $FS::CurrentUser::CurrentUser;
46
47 #die "access denied"
48 #  unless $curuser->access_right('Generate quotation');
49
50 my $conf = new FS::Conf;
51
52 my $date_format = $conf->config('date_format') || '%m/%d/%Y';
53
54 my %opt = @_;
55
56 my $new_query;
57 my @quotations;
58 if ( $opt{cust_main} ) {
59   $new_query = 'custnum='. $opt{cust_main}->custnum;
60   @quotations = $opt{cust_main}->quotation;
61 } elsif ( $opt{prospect_main} ) {
62   $new_query = 'prospectnum='. $opt{prospect_main}->prospectnum;
63   @quotations = $opt{prospect_main}->quotation;
64 } else {
65   die 'guru meditation #&&: neither cust_main nor prospect_main specified';
66 }
67
68 @quotations = grep ! $_->disabled, @quotations;
69
70 </%init>