X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=FS%2FFS%2Fcust_credit_bill_pkg.pm;h=64f1f297e23a9f943c8b765bc4804ba827b528bb;hb=b49c1bd5510a5f10b05bffacc6cc8b6a1b2153e8;hp=158fc73a734651dff469829f8fe98b58c9056f40;hpb=624b2d44625f69d71175c3348cae635d580c890b;p=freeside.git diff --git a/FS/FS/cust_credit_bill_pkg.pm b/FS/FS/cust_credit_bill_pkg.pm index 158fc73a7..64f1f297e 100644 --- a/FS/FS/cust_credit_bill_pkg.pm +++ b/FS/FS/cust_credit_bill_pkg.pm @@ -106,7 +106,10 @@ sub insert { my $payable = $self->cust_bill_pkg->payable($self->setuprecur); my $taxable = $self->_is_taxable ? $payable : 0; my $part_pkg = $self->cust_bill_pkg->part_pkg; - my $freq = $part_pkg ? $part_pkg->freq || 1 : 1;# assume unchanged + my $freq = $self->cust_bill_pkg->freq; + unless ($freq) { + $freq = $part_pkg ? ($part_pkg->freq || 1) : 1;#fallback.. assumes unchanged + } my $taxable_per_month = sprintf("%.2f", $taxable / $freq ); my $credit_per_month = sprintf("%.2f", $self->amount / $freq ); #pennies? @@ -131,7 +134,7 @@ sub insert { my $cust_tax_exempt_pkg = new FS::cust_tax_exempt_pkg { 'billpkgnum' => $self->billpkgnum, 'creditbillpkgnum' => $self->creditbillpkgnum, - 'amount' => 0-$amount, + 'amount' => sprintf('%.2f', 0-$amount), map { $_ => $exemption->$_ } split(',', $groupby) }; my $error = $cust_tax_exempt_pkg->insert; @@ -334,13 +337,13 @@ sub cust_bill_pkg_tax_Xlocation { B field is a kludge to compensate for cust_bill_pkg having separate setup and recur fields. It should be removed once that's fixed. -B method assumes that the frequency of the package associated with the -associated line item remains unchanged during the lifetime of the system. -It may get the tax exemption adjustments wrong if package definitions change -frequency. The presense of delete methods in FS::cust_main_county and -FS::tax_rate makes crediting of old "texas tax" unreliable in the presense of -changing taxes. Explicit tax credit requests? Carry 'taxable' onto line -items? +B method used to assume that the frequency of the package associated +with the associated line item remained unchanged during the lifetime of the +system. That is still used as a fallback. It may get the tax exemption +adjustments wrong if package definitions change frequency. The presense of +delete methods in FS::cust_main_county and FS::tax_rate makes crediting of +old "texas tax" unreliable in the presense of changing taxes. Explicit tax +credit requests? Carry 'taxable' onto line items? =head1 SEE ALSO