[freeside-commits] branch master updated. 8b70832328eb02dc9253dab7b436c6479b588162

Jonathan Prykop jonathan at 420.am
Wed Mar 2 13:11:45 PST 2016


The branch, master has been updated
       via  8b70832328eb02dc9253dab7b436c6479b588162 (commit)
      from  96d579596bf4dfbb4cd959bf8dc350ef8dc7fa06 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit 8b70832328eb02dc9253dab7b436c6479b588162
Author: Jonathan Prykop <jonathan at freeside.biz>
Date:   Wed Mar 2 15:11:04 2016 -0600

    RT#38733: Sales forecasting using quotes

diff --git a/FS/FS/Schema.pm b/FS/FS/Schema.pm
index 3d271b7..33fea02 100644
--- a/FS/FS/Schema.pm
+++ b/FS/FS/Schema.pm
@@ -1909,6 +1909,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 { 

-----------------------------------------------------------------------

Summary of changes:
 FS/FS/Schema.pm                        |    2 ++
 FS/FS/quotation.pm                     |    9 +++++++++
 httemplate/edit/process/quotation.html |    4 ++++
 httemplate/edit/quotation.html         |   10 ++++++++--
 httemplate/search/quotation.html       |   12 +++++++++++-
 httemplate/view/quotation.html         |   31 +++++++++++++++++++++++++++++--
 6 files changed, 63 insertions(+), 5 deletions(-)




More information about the freeside-commits mailing list