diff options
author | Ivan Kohler <ivan@freeside.biz> | 2012-07-04 19:09:26 -0700 |
---|---|---|
committer | Ivan Kohler <ivan@freeside.biz> | 2012-07-04 19:09:26 -0700 |
commit | 391a92928c191127a1dabba0caa92b839c06d102 (patch) | |
tree | e42b250af3cd6f8bb86ec1e567405c5585deb8e8 | |
parent | cfaa68d87335cca3d998717b8653fdba60f4e6bc (diff) |
quotations, RT#16996
-rw-r--r-- | FS/FS/quotation_pkg.pm | 35 |
1 files changed, 34 insertions, 1 deletions
diff --git a/FS/FS/quotation_pkg.pm b/FS/FS/quotation_pkg.pm index 48d59065e..3d40bb03a 100644 --- a/FS/FS/quotation_pkg.pm +++ b/FS/FS/quotation_pkg.pm @@ -2,7 +2,7 @@ package FS::quotation_pkg; use strict; use base qw( FS::Record ); -use FS::Record; # qw( qsearch qsearchs ); +use FS::Record qw( qsearchs ); #qsearch use FS::part_pkg; use FS::cust_location; @@ -119,6 +119,39 @@ sub check { $self->SUPER::check; } +sub part_pkg { + my $self = shift; + qsearchs('part_pkg', { 'pkgpart' => $self->pkgpart } ); +} + +sub desc { + my $self = shift; + $self->part_pkg->pkg; +} + +sub setup { + my $self = shift; + return '0.00' if $self->waive_setup eq 'Y'; + my $part_pkg = $self->part_pkg; + #my $setup = $part_pkg->can('base_setup') ? $part_pkg->base_setup + # : $part_pkg->option('setup_fee'); + my $setup = $part_pkg->option('setup_fee'); + #XXX discounts + $setup *= $self->quantity if $self->quantity; + sprintf('%.2f', $setup); + +} + +sub recur { + my $self = shift; + my $part_pkg = $self->part_pkg; + my $recur = $part_pkg->can('base_recur') ? $part_pkg->base_recur + : $part_pkg->option('recur_fee'); + #XXX discounts + $recur *= $self->quantity if $self->quantity; + sprintf('%.2f', $recur); +} + =back =head1 BUGS |