summaryrefslogtreecommitdiff
path: root/FS
diff options
context:
space:
mode:
authorIvan Kohler <ivan@freeside.biz>2017-04-03 17:23:57 -0700
committerIvan Kohler <ivan@freeside.biz>2017-04-03 17:23:57 -0700
commit1d61483cd82a5d2dd59a2218ea85b4f8773e177e (patch)
tree156833300340d64fa789c8c59fb90665f6940fdc /FS
parente362627ff1bd9b78074cfd1c9deac9f6210eaab5 (diff)
discounts on one-time charges< RT#75448
Diffstat (limited to 'FS')
-rw-r--r--FS/FS/cust_main.pm21
-rw-r--r--FS/FS/quotation.pm19
2 files changed, 27 insertions, 13 deletions
diff --git a/FS/FS/cust_main.pm b/FS/FS/cust_main.pm
index 806db00bd..f4990a418 100644
--- a/FS/FS/cust_main.pm
+++ b/FS/FS/cust_main.pm
@@ -3267,6 +3267,7 @@ sub charge {
my $cust_pkg_ref = '';
my ( $bill_now, $invoice_terms ) = ( 0, '' );
my $locationnum;
+ my ( $discountnum, $discountnum_amount, $discountnum_percent ) = ( '','','' );
if ( ref( $_[0] ) ) {
$amount = $_[0]->{amount};
$setup_cost = $_[0]->{setup_cost};
@@ -3287,6 +3288,9 @@ sub charge {
$invoice_terms = exists($_[0]->{invoice_terms}) ? $_[0]->{invoice_terms} : '';
$locationnum = $_[0]->{locationnum} || $self->ship_locationnum;
$separate_bill = $_[0]->{separate_bill} || '';
+ $discountnum = $_[0]->{setup_discountnum};
+ $discountnum_amount = $_[0]->{setup_discountnum_amount};
+ $discountnum_percent = $_[0]->{setup_discountnum_percent};
} else { # yuck
$amount = shift;
$setup_cost = '';
@@ -3350,13 +3354,16 @@ sub charge {
}
my $cust_pkg = new FS::cust_pkg ( {
- 'custnum' => $self->custnum,
- 'pkgpart' => $pkgpart,
- 'quantity' => $quantity,
- 'start_date' => $start_date,
- 'no_auto' => $no_auto,
- 'separate_bill' => $separate_bill,
- 'locationnum'=> $locationnum,
+ 'custnum' => $self->custnum,
+ 'pkgpart' => $pkgpart,
+ 'quantity' => $quantity,
+ 'start_date' => $start_date,
+ 'no_auto' => $no_auto,
+ 'separate_bill' => $separate_bill,
+ 'locationnum' => $locationnum,
+ 'setup_discountnum' => $discountnum,
+ 'setup_discountnum_amount' => $discountnum_amount,
+ 'setup_discountnum_percent' => $discountnum_percent,
} );
$error = $cust_pkg->insert;
diff --git a/FS/FS/quotation.pm b/FS/FS/quotation.pm
index c61e001c6..2f95425cc 100644
--- a/FS/FS/quotation.pm
+++ b/FS/FS/quotation.pm
@@ -510,6 +510,7 @@ sub charge {
my $cust_pkg_ref = '';
my ( $bill_now, $invoice_terms ) = ( 0, '' );
my $locationnum;
+ my ( $discountnum, $discountnum_amount, $discountnum_percent ) = ( '','','' );
if ( ref( $_[0] ) ) {
$amount = $_[0]->{amount};
$setup_cost = $_[0]->{setup_cost};
@@ -529,6 +530,9 @@ sub charge {
$bill_now = exists($_[0]->{bill_now}) ? $_[0]->{bill_now} : '';
$invoice_terms = exists($_[0]->{invoice_terms}) ? $_[0]->{invoice_terms} : '';
$locationnum = $_[0]->{locationnum};
+ $discountnum = $_->{setup_discountnum};
+ $discountnum_amount = $_->{setup_discountnum_amount};
+ $discountnum_percent = $_->{setup_discountnum_percent};
} else {
$amount = shift;
$setup_cost = '';
@@ -599,12 +603,15 @@ sub charge {
# of ordering a customer package, no "bill now")
my $quotation_pkg = new FS::quotation_pkg ( {
- 'quotationnum' => $self->quotationnum,
- 'pkgpart' => $pkgpart,
- 'quantity' => $quantity,
- #'start_date' => $start_date,
- #'no_auto' => $no_auto,
- 'locationnum'=> $locationnum,
+ 'quotationnum' => $self->quotationnum,
+ 'pkgpart' => $pkgpart,
+ 'quantity' => $quantity,
+ #'start_date' => $start_date,
+ #'no_auto' => $no_auto,
+ 'locationnum' => $locationnum,
+ 'setup_discountnum' => $discountnum,
+ 'setup_discountnum_amount' => $discountnum_amount,
+ 'setup_discountnum_percent' => $discountnum_percent,
} );
$error = $quotation_pkg->insert;