diff options
author | Ivan Kohler <ivan@freeside.biz> | 2012-07-03 18:51:51 -0700 |
---|---|---|
committer | Ivan Kohler <ivan@freeside.biz> | 2012-07-03 18:51:51 -0700 |
commit | 81978af92ecdaaefeff5156d9ab3b4f99586df1c (patch) | |
tree | 19a4e6bbcc6648c506c48e304418001294ed7485 /httemplate | |
parent | 7abce2207dbee012fd442940dc42070f45ef8a16 (diff) |
quotations, RT#16996
Diffstat (limited to 'httemplate')
-rw-r--r-- | httemplate/edit/process/quotation.html | 2 | ||||
-rw-r--r-- | httemplate/edit/quotation.html | 15 | ||||
-rw-r--r-- | httemplate/elements/tr-fixed-cust_main.html | 15 | ||||
-rw-r--r-- | httemplate/elements/tr-fixed-date.html | 13 | ||||
-rw-r--r-- | httemplate/elements/tr-fixed-prospect_main.html | 15 | ||||
-rw-r--r-- | httemplate/view/prospect_main.html | 31 | ||||
-rwxr-xr-x | httemplate/view/quotation.html | 25 |
7 files changed, 105 insertions, 11 deletions
diff --git a/httemplate/edit/process/quotation.html b/httemplate/edit/process/quotation.html index 7671c3694..a69566581 100644 --- a/httemplate/edit/process/quotation.html +++ b/httemplate/edit/process/quotation.html @@ -1,6 +1,6 @@ <% include( 'elements/process.html', 'table' => 'quotation', - 'redirect' => $p.'view/quotation.html?', + 'redirect' => popurl(3).'view/quotation.html?', ) %> <%init> diff --git a/httemplate/edit/quotation.html b/httemplate/edit/quotation.html index f70642544..8b6062355 100644 --- a/httemplate/edit/quotation.html +++ b/httemplate/edit/quotation.html @@ -3,8 +3,23 @@ 'table' => 'quotation', 'labels' => { 'quotationnum' => 'Quotation number', + 'prospectnum' => 'Prospect', + 'custnum' => 'Customer', + '_date' => 'Date', + 'disabled' => 'Disabled', }, + 'fields' => [ + { field=>'prospectnum', type=>'fixed-prospect_main' }, + { field=>'custnum', type=>'fixed-cust_main' }, + { field=>'_date', type=>'fixed-date' }, + { field=>'disabled', type=>'checkbox', value=>'Y'}, + ], #XXX some way to disable the "view all" + 'new_callback' => sub { my( $cgi, $quotation) = @_; + $quotation->$_( $cgi->param($_) ) + foreach qw( prospectnum custnum ); + $quotation->_date(time); + }, ) %> <%init> diff --git a/httemplate/elements/tr-fixed-cust_main.html b/httemplate/elements/tr-fixed-cust_main.html new file mode 100644 index 000000000..00bcb66d8 --- /dev/null +++ b/httemplate/elements/tr-fixed-cust_main.html @@ -0,0 +1,15 @@ +% if ( $cust_main ) { + <% include('tr-fixed.html', %opt ) %> +% } +<%init> + +my %opt = @_; + +my $value = $opt{'curr_value'} || $opt{'value'}; + +my $cust_main = $value ? qsearchs('cust_main', {custnum=>$value} ) + : ''; + +$opt{'formatted_value'} = $cust_main->name if $cust_main; + +</%init> diff --git a/httemplate/elements/tr-fixed-date.html b/httemplate/elements/tr-fixed-date.html new file mode 100644 index 000000000..716e5ceb8 --- /dev/null +++ b/httemplate/elements/tr-fixed-date.html @@ -0,0 +1,13 @@ +<% include('tr-fixed.html', %opt ) %> +<%init> + +my %opt = @_; + +my $value = $opt{'curr_value'} || $opt{'value'}; + +my $conf = new FS::Conf; +my $date_format = $conf->config('date_format') || '%m/%d/%Y'; + +$opt{'formatted_value'} = time2str($date_format, $value); + +</%init> diff --git a/httemplate/elements/tr-fixed-prospect_main.html b/httemplate/elements/tr-fixed-prospect_main.html new file mode 100644 index 000000000..8da0ffb84 --- /dev/null +++ b/httemplate/elements/tr-fixed-prospect_main.html @@ -0,0 +1,15 @@ +% if ( $prospect_main ) { + <% include('tr-fixed.html', %opt ) %> +% } +<%init> + +my %opt = @_; + +my $value = $opt{'curr_value'} || $opt{'value'}; + +my $prospect_main = $value ? qsearchs('prospect_main', {prospectnum=>$value} ) + : ''; + +$opt{'formatted_value'} = $prospect_main->name if $prospect_main; + +</%init> diff --git a/httemplate/view/prospect_main.html b/httemplate/view/prospect_main.html index 9e85348af..801d64bda 100644 --- a/httemplate/view/prospect_main.html +++ b/httemplate/view/prospect_main.html @@ -64,6 +64,31 @@ <BR> +% if ( $curuser->access_right('Generate quotation') ) { + <FONT CLASS="fsinnerbox-title"><% mt( 'Quotations' ) |h %></FONT> + <A HREF="<%$p%>edit/quotation.html?prospectnum=<% $prospectnum %>">New quotation</A> +% my @quotations = $prospect_main->quotation; +% if ( @quotations ) { + <& /elements/table-grid.html &> +% my $bgcolor1 = '#eeeeee'; +% my $bgcolor2 = '#ffffff'; +% my $bgcolor = ''; + <TR> + <TH CLASS="grid" BGCOLOR="#cccccc">#</TH> + <TH CLASS="grid" BGCOLOR="#cccccc"><% mt('Date') |h %></TH> + </TR> +% foreach my $quotation (@quotations) { + <TR> + <TD CLASS="grid" BGCOLOR="#cccccc"><% $quotation->quotationnum %></TD> + <TD CLASS="grid" BGCOLOR="#cccccc"><% time2str($date_format, $quotation->_date) |h %></TD> + </TR> +% } + </TABLE> +% } + <BR><BR> +% } + + % if ( $curuser->access_right('Qualify service') ) { <% include( '/elements/popup_link-prospect_main.html', 'action' => $p. 'misc/qual.html', @@ -80,6 +105,7 @@ <BR><BR> % } +<!-- <% ntable("#cccccc") %> <TR> @@ -87,6 +113,7 @@ </TR> </TABLE> +--> <%init> @@ -95,6 +122,10 @@ my $curuser = $FS::CurrentUser::CurrentUser; die "access denied" unless $curuser->access_right('View prospect'); +my $conf = new FS::Conf; + +my $date_format = $conf->config('date_format') || '%m/%d/%Y'; + my $prospectnum; if ( $cgi->param('prospectnum') =~ /^(\d+)$/ ) { $prospectnum = $1; diff --git a/httemplate/view/quotation.html b/httemplate/view/quotation.html index 2c2c6b7ca..866ade2c2 100755 --- a/httemplate/view/quotation.html +++ b/httemplate/view/quotation.html @@ -22,21 +22,20 @@ XXX resending quotations % } -XXX view typset quotation +</%doc> -% if ( $conf->exists('invoice_latex') ) { +% if ( $conf->exists('quotation_latex') ) { - <A HREF="<% $p %>view/cust_bill-pdf.cgi?<% $link %>"><% mt('View typeset invoice PDF') |h %></A> + <A HREF="<% $p %>view/quotation-pdf.cgi?<% $link %>"><% mt('View typeset quotation PDF') |h %></A> <BR><BR> % } -XXX actually show the quotation - -% if ( $conf->exists('invoice_html') ) { - <% join('', $cust_bill->print_html(\%opt) ) %> +% if ( $conf->exists('quotation_html') ) { + <% join('', $quotation->print_html() ) %> % } else { - <PRE><% join('', $cust_bill->print_text(\%opt) ) %></PRE> -% } +% die "quotation_html config missing"; +% } +% #plaintext quotations? <PRE><% join('', $quotation->print_text() ) %></PRE> </%doc> @@ -56,7 +55,7 @@ if ( $query =~ /^(\d+)$/ ) { $quotationnum = $cgi->param('quotationnum'); } -#my $conf = new FS::Conf; +my $conf = new FS::Conf; my $quotation = qsearchs({ 'select' => 'quotation.*', @@ -67,6 +66,7 @@ my $quotation = qsearchs({ }); die "Quotation #$quotationnum not found!" unless $quotation; +my $menubar; if ( my $custnum = $quotation->custnum ) { my $display_custnum = $quotation->cust_main->display_custnum; $menubar = menubar( @@ -78,4 +78,9 @@ if ( my $custnum = $quotation->custnum ) { ); } +my $link = "quotationnum=$quotationnum"; +#$link .= ';template='. uri_escape($template) if $template; +#$link .= ';notice_name='. $notice_name if $notice_name; + + </%init> |