summaryrefslogtreecommitdiff
path: root/httemplate/elements/quotations.html
blob: b517a5cde0f1472ff78aae51cbcaeeef4104077c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
% if ( $curuser->access_right('Generate quotation') ) { 

  <FONT CLASS="fsinnerbox-title"><% mt( 'Quotations' ) |h %></FONT>
  <A HREF="<%$p%>edit/quotation.html?<% $new_query %>">Create new quotation</A>

% if ( @quotations ) {
    <& /elements/table-grid.html &>
%     my $bgcolor1 = '#eeeeee';
%     my $bgcolor2 = '#ffffff';
%     my $bgcolor = '';
      <THEAD>
      <TR>
        <TH CLASS="grid" BGCOLOR="#cccccc">#</TH>
        <TH CLASS="grid" BGCOLOR="#cccccc"><% mt('Setup') |h %></TH>
        <TH CLASS="grid" BGCOLOR="#cccccc"><% mt('Recurring') |h %></TH>
        <TH CLASS="grid" BGCOLOR="#cccccc"><% mt('Date') |h %></TH>
        <TH CLASS="grid" BGCOLOR="#cccccc"><% mt('Description') |h %></TH>
        <TH CLASS="grid" BGCOLOR="#cccccc"><% mt('Close date') |h %></TH>
        <TH CLASS="grid" BGCOLOR="#cccccc"><% mt('Confidence') |h %></TH>
        <TH CLASS="grid" BGCOLOR="#cccccc"></TH>
      </TR>
      </THEAD>
%     foreach my $quotation (@quotations) {
%       if ( $bgcolor eq $bgcolor1 ) {
%         $bgcolor = $bgcolor2;
%       } else {
%         $bgcolor = $bgcolor1;
%       }
%       my $a = qq(<A HREF="$p/view/quotation.html?quotationnum=). #"
%               $quotation->quotationnum. '">';
        <TR>
          <TD CLASS="grid" BGCOLOR="<% $bgcolor %>"><% $a %><% $quotation->quotationnum %></A></TD>
          <TD CLASS="grid" BGCOLOR="<% $bgcolor %>" ALIGN=right><% $a %><% $money_char.$quotation->total_setup |h %></A></TD>
          <TD CLASS="grid" BGCOLOR="<% $bgcolor %>" ALIGN=right><% $a %><% $money_char.$quotation->total_recur |h %></A></TD>
          <TD CLASS="grid" BGCOLOR="<% $bgcolor %>"><% $a %><% time2str('%b %d %Y', $quotation->_date) |h %></A></TD>
          <TD CLASS="grid" BGCOLOR="<% $bgcolor %>"><% $a %><% $quotation->quotation_description |h %></A></TD>
          <TD CLASS="grid" BGCOLOR="<% $bgcolor %>"><% $a %><% $quotation->close_date ? time2str('%b %d %Y', $quotation->close_date) : '' |h %></A></TD>
          <TD CLASS="grid" BGCOLOR="<% $bgcolor %>" ALIGN=right><% $a %><% length($quotation->confidence) ? $quotation->confidence . '%' : '' |h %></A></TD>
          <TD CLASS="grid" BGCOLOR="<% $bgcolor %>"><A HREF="<%$p%>edit/process/quotation_convert.html?quotationnum=<% $quotation->quotationnum %>"><% $opt{convert_label} || 'Convert to customer' %></A></TD>
        </TR>
%     }
    </TABLE>
% }
    <BR><BR>

% }
<%init>

my $curuser = $FS::CurrentUser::CurrentUser;

#die "access denied"
#  unless $curuser->access_right('Generate quotation');

my $conf = new FS::Conf;

my $money_char = $conf->config('money_char') || '$';

my $date_format = $conf->config('date_format') || '%m/%d/%Y';

my %opt = @_;

my $new_query;
my @quotations;
if ( $opt{cust_main} ) {
  $new_query = 'custnum='. $opt{cust_main}->custnum;
  @quotations = $opt{cust_main}->quotation;
} elsif ( $opt{prospect_main} ) {
  $new_query = 'prospectnum='. $opt{prospect_main}->prospectnum;
  @quotations = $opt{prospect_main}->quotation;
} else {
  die 'guru meditation #&&: neither cust_main nor prospect_main specified';
}

@quotations = grep ! $_->disabled, @quotations;

</%init>