% if ( $curuser->access_right('Generate quotation') ) { <% mt( 'Quotations' ) |h %> Create new quotation % if ( @quotations ) { <& /elements/table-grid.html &> % my $bgcolor1 = '#eeeeee'; % my $bgcolor2 = '#ffffff'; % my $bgcolor = ''; # <% mt('Setup') |h %> <% mt('Recurring') |h %> <% mt('Date') |h %> <% mt('Description') |h %> <% mt('Close date') |h %> <% mt('Confidence') |h %> % foreach my $quotation (@quotations) { % if ( $bgcolor eq $bgcolor1 ) { % $bgcolor = $bgcolor2; % } else { % $bgcolor = $bgcolor1; % } % my $a = qq(quotationnum. '">'; <% $a %><% $quotation->quotationnum %> <% $a %><% $money_char.$quotation->total_setup |h %> <% $a %><% $money_char.$quotation->total_recur |h %> <% $a %><% time2str('%b %d %Y', $quotation->_date) |h %> <% $a %><% $quotation->quotation_description |h %> <% $a %><% $quotation->close_date ? time2str('%b %d %Y', $quotation->close_date) : '' |h %> <% $a %><% length($quotation->confidence) ? $quotation->confidence . '%' : '' |h %> <% $opt{convert_label} || 'Convert to customer' %> % } % }

% } <%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;