From d14a91ec4beae6c02225cdfd4fc3acbc3d66981b Mon Sep 17 00:00:00 2001 From: Ivan Kohler Date: Sun, 18 Aug 2013 20:12:48 -0700 Subject: continue sales person work: customer and package selection, commissions, reporting. RT#23402 --- httemplate/browse/sales.html | 14 ++++ httemplate/edit/process/cust_main.cgi | 1 + httemplate/edit/sales.html | 10 ++- httemplate/view/cust_main/packages/package.html | 100 ++++++++++++++++++------ httemplate/view/cust_main/packages/section.html | 3 + 5 files changed, 98 insertions(+), 30 deletions(-) (limited to 'httemplate') diff --git a/httemplate/browse/sales.html b/httemplate/browse/sales.html index 6fac058f9..d2b6cfef5 100644 --- a/httemplate/browse/sales.html +++ b/httemplate/browse/sales.html @@ -16,6 +16,8 @@ my $curuser = $FS::CurrentUser::CurrentUser; die "access denied" unless $curuser->access_right('Edit sales people'); +my $conf = new FS::Conf; + #Sales people bring in business.

my @header = ( 'Sales person' ); @@ -28,6 +30,18 @@ if ( $curuser->access_right('Configuration') ) { push @links, [ $p.'edit/agent.cgi?', 'agentnum' ]; } +push @header, 'Master Customer'; +push @fields, sub { + my $sales = shift; + return '' unless $sales->sales_custnum; + include('/elements/small_custview.html', + $sales->sales_custnum, + scalar($conf->config('countrydefault')), + 1, #show balance + ); +}; +push @links, ''; + push @header, 'Commissions'; push @fields, sub { diff --git a/httemplate/edit/process/cust_main.cgi b/httemplate/edit/process/cust_main.cgi index 621de24bf..ff8be1a71 100755 --- a/httemplate/edit/process/cust_main.cgi +++ b/httemplate/edit/process/cust_main.cgi @@ -213,6 +213,7 @@ if ( $new->custnum eq '' or $duplicate_of ) { #later 'custnum' => $custnum, 'pkgpart' => $pkgpart, 'locationnum' => scalar($cgi->param('locationnum')), + 'salesnum' => scalar($cgi->param('salesnum')), } ); diff --git a/httemplate/edit/sales.html b/httemplate/edit/sales.html index 763f86124..90f651dda 100755 --- a/httemplate/edit/sales.html +++ b/httemplate/edit/sales.html @@ -3,12 +3,14 @@ 'table' => 'sales', 'fields' => [ 'salesperson', { field=>'agentnum', type=>'select-agent', disable_empty=>1, }, + { field=>'sales_custnum', type=>'search-cust_main', }, { field=>'disabled', type=>'checkbox', value=>'Y', }, ], - 'labels' => { 'salesnum' => 'Sales Person', - 'salesperson' => 'Name', - 'agentnum' => 'Agent', - 'disabled' => 'Disabled', + 'labels' => { 'salesnum' => 'Sales Person', + 'salesperson' => 'Name', + 'agentnum' => 'Agent', + 'sales_custnum' => 'Master customer', + 'disabled' => 'Disabled', }, 'viewall_dir' => 'browse', 'agent_virt' => 1, diff --git a/httemplate/view/cust_main/packages/package.html b/httemplate/view/cust_main/packages/package.html index 5fad2d668..b29fedcbd 100644 --- a/httemplate/view/cust_main/packages/package.html +++ b/httemplate/view/cust_main/packages/package.html @@ -1,5 +1,7 @@ > + + -% if ( $cust_pkg->quantity > 1 ) { - - - -% } + + + + + + + + + + + % my $editi = $curuser->access_right('Edit customer package invoice details'); % my $editc = $curuser->access_right('Edit customer package comments'); % my @cust_pkg_detail = $cust_pkg->cust_pkg_detail; @@ -188,24 +236,11 @@ % } -% if ( $curuser->access_right('Change customer package') -% && ! $cust_pkg->get('cancel') -% && ! $supplemental -% && $part_pkg->freq ne '0' -% && ! $opt{no_links} -% ) -% { - -% # yeah, I guess we'll let you do this on a future change package -% if ( FS::Conf->new->exists('invoice-unitprice') ) { - -% } - -% } + + % }
<% $opt{before_pkg_callback} @@ -14,14 +16,6 @@
-       <% mt('Quantity:') |h %> - <% $cust_pkg->quantity %> -
@@ -86,6 +80,60 @@
+ +% my $change_quan_label = 'Change quantity'; +% if ( $cust_pkg->quantity > 1 ) { +% $change_quan_label = 'change'; +       <% mt('Quantity:') |h %> + <% $cust_pkg->quantity %> +% } + +% if ( $curuser->access_right('Change customer package') +% && ! $cust_pkg->get('cancel') +% && ! $supplemental +% && $part_pkg->freq ne '0' +% && ! $opt{no_links} +% && $opt{'invoice-unitprice'} +% ) +% { + + ( <% pkg_change_quantity_link($cust_pkg, $change_quan_label) %> ) + +% } + +
+ +% my $change_sales_label = 'Change sales person'; +% if ( $cust_pkg->salesnum ) { +% $change_sales_label = 'change'; +       <% mt('Sales Person:') |h %> + <% $cust_pkg->salesperson %> +% } + +% if ( $curuser->access_right('Change customer package') +% && ! $cust_pkg->get('cancel') +% && ! $supplemental +% #&& $part_pkg->freq ne '0' +% && ! $opt{no_links} +% ) +% { + + ( <% pkg_change_salesnum_link($cust_pkg, $change_sales_label) %> ) + +% } + +
- ( <% pkg_change_quantity_link($cust_pkg) %> ) -
+ % if ( @cust_pkg_usage ) { @@ -309,11 +344,24 @@ sub pkg_change_location_link { } sub pkg_change_quantity_link { + my( $cust_pkg, $label ) = @_; include( '/elements/popup_link-cust_pkg.html', 'action' => $p. 'edit/cust_pkg_quantity.html?', - 'label' => emt('Change quantity'), + 'label' => emt($label), 'actionlabel' => emt('Change'), - 'cust_pkg' => shift, + 'cust_pkg' => $cust_pkg, + 'width' => 390, + 'height' => 220, + ); +} + +sub pkg_change_salesnum_link { + my( $cust_pkg, $label ) = @_; + include( '/elements/popup_link-cust_pkg.html', + 'action' => $p. 'edit/cust_pkg_salesnum.html?', + 'label' => emt($label), + 'actionlabel' => emt('Change'), + 'cust_pkg' => $cust_pkg, 'width' => 390, 'height' => 220, ); diff --git a/httemplate/view/cust_main/packages/section.html b/httemplate/view/cust_main/packages/section.html index 0383fe892..152ccaa5d 100755 --- a/httemplate/view/cust_main/packages/section.html +++ b/httemplate/view/cust_main/packages/section.html @@ -77,6 +77,9 @@ my $pkg_attached = ( scalar(keys %change_custnum) == 1 my $countrydefault = scalar($conf->config('countrydefault')) || 'US'; my %conf_opt = ( + #for package.html + 'invoice-unitprice' => $conf->exists('invoice-unitprice'), + #for services.html and status.html 'cust_pkg-display_times' => ($conf->exists('cust_pkg-display_times') || $curuser->option('cust_pkg-display_times')), -- cgit v1.2.1
<% mt('Included usage') %>