summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJonathan Prykop <jonathan@freeside.biz>2016-03-02 15:11:04 -0600
committerJonathan Prykop <jonathan@freeside.biz>2016-03-08 13:18:39 -0600
commit7cccefa1dca60909499b11dff96124a793c4c92d (patch)
treeb3cecba9513fe5adf410f9bca6a968348ff8089f
parent77f5d80f4178f976efbc0be027656e396cecc1cb (diff)
RT#38733: Sales forecasting using quotes
-rw-r--r--FS/FS/Schema.pm2
-rw-r--r--FS/FS/quotation.pm9
-rw-r--r--httemplate/edit/process/quotation.html4
-rw-r--r--httemplate/edit/quotation.html10
-rwxr-xr-xhttemplate/search/quotation.html12
-rwxr-xr-xhttemplate/view/quotation.html31
6 files changed, 63 insertions, 5 deletions
diff --git a/FS/FS/Schema.pm b/FS/FS/Schema.pm
index 738dc53..aa0bcd7 100644
--- a/FS/FS/Schema.pm
+++ b/FS/FS/Schema.pm
@@ -1925,6 +1925,8 @@ sub tables_hashref {
'_date', @date_type, '', '',
'disabled', 'char', 'NULL', 1, '', '',
'usernum', 'int', 'NULL', '', '', '',
+ 'close_date', @date_type, '', '',
+ 'confidence', 'int', 'NULL', '', '', '',
#'total', @money_type, '', '',
#'quotation_term', 'varchar', 'NULL', $char_d, '', '',
],
diff --git a/FS/FS/quotation.pm b/FS/FS/quotation.pm
index cb3d80b..db8b0fc 100644
--- a/FS/FS/quotation.pm
+++ b/FS/FS/quotation.pm
@@ -69,6 +69,13 @@ disabled
usernum
+=item close_date
+
+projected date when the quotation will be closed
+
+=item confidence
+
+projected confidence (expressed as integer) that quotation will close
=back
@@ -122,6 +129,8 @@ sub check {
|| $self->ut_numbern('_date')
|| $self->ut_enum('disabled', [ '', 'Y' ])
|| $self->ut_numbern('usernum')
+ || $self->ut_numbern('close_date')
+ || $self->ut_numbern('confidence')
;
return $error if $error;
diff --git a/httemplate/edit/process/quotation.html b/httemplate/edit/process/quotation.html
index a695665..1cda30f 100644
--- a/httemplate/edit/process/quotation.html
+++ b/httemplate/edit/process/quotation.html
@@ -8,4 +8,8 @@
die "access denied"
unless $FS::CurrentUser::CurrentUser->access_right('Generate quotation');
+my $close_date = $cgi->param('close_date');
+$close_date = parse_datetime($close_date);
+$cgi->param('close_date',$close_date);
+
</%init>
diff --git a/httemplate/edit/quotation.html b/httemplate/edit/quotation.html
index cc95d87..4372840 100644
--- a/httemplate/edit/quotation.html
+++ b/httemplate/edit/quotation.html
@@ -7,13 +7,17 @@
'prospectnum' => 'Prospect',
'custnum' => 'Customer',
'_date' => 'Date',
- 'disabled' => 'Disabled',
+ 'close_date' => 'Close Date',
+ 'confidence' => 'Confidence',
+ ($can_disable ? ('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'},
+ { field=>'close_date', type=>'input-date-field' },
+ { field=>'confidence', type=>'text', size=>6 },
+ ($can_disable ? { field=>'disabled', type=>'checkbox', value=>'Y'} : ()),
],
#XXX some way to disable the "view all"
'new_callback' => sub { my( $cgi, $quotation) = @_;
@@ -28,4 +32,6 @@
die "access denied"
unless $FS::CurrentUser::CurrentUser->access_right('Generate quotation');
+my $can_disable = $FS::CurrentUser::CurrentUser->access_right('Disable quotation');
+
</%init>
diff --git a/httemplate/search/quotation.html b/httemplate/search/quotation.html
index 55c60f0..2eba71c 100755
--- a/httemplate/search/quotation.html
+++ b/httemplate/search/quotation.html
@@ -15,6 +15,8 @@
emt('Date'),
emt('Prospect'),
emt('Customer'),
+ emt('Confidence'),
+ emt('Close date'),
],
'fields' => [
'quotationnum',
@@ -27,6 +29,10 @@
sub { my $cust_main = shift->cust_main;
$cust_main ? $cust_main->name : '';
},
+ 'confidence',
+ sub { my $quot = shift;
+ $quot->close_date ? time2str('%b %d %Y', $quot->close_date) : '';
+ },
#\&FS::UI::Web::cust_fields,
],
'sort_fields' => [
@@ -36,8 +42,10 @@
'_date',
'',
'',
+ 'confidence',
+ 'close_date',
],
- 'align' => 'rrrrll', #.FS::UI::Web::cust_aligns(),
+ 'align' => 'rrrrllrr', #.FS::UI::Web::cust_aligns(),
'links' => [
$link,
$link,
@@ -45,6 +53,8 @@
$link,
$prospect_link,
$cust_link,
+ $link,
+ $link,
#( map { $_ ne 'Cust. Status' ? $cust_link : '' }
# FS::UI::Web::cust_header()
#),
diff --git a/httemplate/view/quotation.html b/httemplate/view/quotation.html
index 1862509..484bedd 100755
--- a/httemplate/view/quotation.html
+++ b/httemplate/view/quotation.html
@@ -11,20 +11,31 @@ function areyousure(href, message) {
% unless ( $quotation->disabled eq 'Y' ) {
+% my $inrow = 0;
% if ( $curuser->access_right('Order customer package') ) {
<& /elements/order_pkg_link.html,
'label' => emt('Add package'),
'actionlabel' => emt('Add package'),
map { $_ => $quotation->$_ } qw( quotationnum custnum prospectnum )
&>
+% $inrow++;
% }
% if ( $curuser->access_right('One-time charge') ) {
- | <& /elements/one_time_charge_link.html,
+ <% $inrow ? ' | ' : '' %>
+ <& /elements/one_time_charge_link.html,
map { $_ => $quotation->$_ } qw( quotationnum custnum prospectnum )
&>
+% $inrow++;
% }
- <BR><BR>
+
+% if ( $can_generate_quotation ) {
+ <% $inrow ? ' | ' : '' %>
+ <A HREF="<%$p%>edit/quotation.html?quotationnum=<% $quotation->quotationnum %>">Edit quotation fields</A>
+% $inrow++;
+% }
+
+ <% $inrow ? '<BR><BR>' : '' %>
% if ( 1 ) { #if ( $curuser->access_right('Send quotations') )
@@ -76,6 +87,22 @@ function areyousure(href, message) {
<DIV CLASS="error"><% emt('Error calculating quotation: [_1]', $error) %></DIV>
% }
+% my $close_date = $quotation->close_date;
+% my $confidence = $quotation->confidence;
+% if ($close_date or length($confidence)) {
+<TABLE>
+% if ($close_date) {
+<TR>
+ <TH STYLE="text-align: right;">Close Date:</TH>
+ <TD><% time2str($conf->config('date_format') || '%m/%d/%Y',$close_date) %></TD>
+</TR>
+% }
+% if (length($confidence)) {
+<TR><TH STYLE="text-align: right;">Confidence:</TH><TD><% $confidence %></TD></TR>
+% }
+</TABLE>
+% }
+
% if ( $conf->exists('quotation_html') ) {
<% join('', $quotation->print_html( preref_callback=>$preref_callback )) %>
% } else {