stray closing /TABLE in the no-ticket case
[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"></TH>
18       </TR>
19       </THEAD>
20 %     foreach my $quotation (@quotations) {
21 %       if ( $bgcolor eq $bgcolor1 ) {
22 %         $bgcolor = $bgcolor2;
23 %       } else {
24 %         $bgcolor = $bgcolor1;
25 %       }
26 %       my $a = qq(<A HREF="$p/view/quotation.html?quotationnum=). #"
27 %               $quotation->quotationnum. '">';
28         <TR>
29           <TD CLASS="grid" BGCOLOR="<% $bgcolor %>"><% $a %><% $quotation->quotationnum %></A></TD>
30           <TD CLASS="grid" BGCOLOR="<% $bgcolor %>"><% $a %><% time2str($date_format, $quotation->_date) |h %></A></TD>
31           <TD CLASS="grid" BGCOLOR="<% $bgcolor %>"><% $a %><% $quotation->total_setup |h %></A></TD>
32           <TD CLASS="grid" BGCOLOR="<% $bgcolor %>"><% $a %><% $quotation->total_recur |h %></A></TD>
33           <TD CLASS="grid" BGCOLOR="<% $bgcolor %>"><A HREF="<%$p%>edit/process/quotation_convert.html?quotationnum=<% $quotation->quotationnum %>"><% $opt{convert_label} || 'Convert to customer' %></A></TD>
34         </TR>
35 %     }
36     </TABLE>
37 % }
38     <BR><BR>
39
40 % }
41 <%init>
42
43 my $curuser = $FS::CurrentUser::CurrentUser;
44
45 #die "access denied"
46 #  unless $curuser->access_right('Generate quotation');
47
48 my $conf = new FS::Conf;
49
50 my $date_format = $conf->config('date_format') || '%m/%d/%Y';
51
52 my %opt = @_;
53
54 my $new_query;
55 my @quotations;
56 if ( $opt{cust_main} ) {
57   $new_query = 'custnum='. $opt{cust_main}->custnum;
58   @quotations = $opt{cust_main}->quotation;
59 } elsif ( $opt{prospect_main} ) {
60   $new_query = 'prospectnum='. $opt{prospect_main}->prospectnum;
61   @quotations = $opt{prospect_main}->quotation;
62 } else {
63   die 'guru meditation #&&: neither cust_main nor prospect_main specified';
64 }
65
66 @quotations = grep ! $_->disabled, @quotations;
67
68 </%init>