summaryrefslogtreecommitdiff
path: root/FS/FS/tax_rate_location.pm
diff options
context:
space:
mode:
authorivan <ivan>2011-04-11 07:02:50 +0000
committerivan <ivan>2011-04-11 07:02:50 +0000
commit1bb612df42aec08974f67ff333a5e0d2a2fc3ba3 (patch)
tree9889dea71d9186ceb81bb6dc138c8cf6db59a4da /FS/FS/tax_rate_location.pm
parent3baa02c55101a3ad6c18d294c67a009e33ae6930 (diff)
slight refactor onvendor tax report: add tax_rate_location->location_sql, RT#12320
Diffstat (limited to 'FS/FS/tax_rate_location.pm')
-rw-r--r--FS/FS/tax_rate_location.pm31
1 files changed, 31 insertions, 0 deletions
diff --git a/FS/FS/tax_rate_location.pm b/FS/FS/tax_rate_location.pm
index 218ed97..1a6c47d 100644
--- a/FS/FS/tax_rate_location.pm
+++ b/FS/FS/tax_rate_location.pm
@@ -151,6 +151,37 @@ sub check {
=back
+=head1 CLASS METHODS
+
+=item location_sql KEY => VALUE, ...
+
+Returns an SQL fragment identifying matching tax_rate_location /
+cust_bill_pkg_tax_rate_location records.
+
+Parameters are county, state, city and locationtaxid
+
+=cut
+
+sub location_sql {
+ my($class, %param) = @_;
+
+ my %pn = (
+ 'city' => 'tax_rate_location.city',
+ 'county' => 'tax_rate_location.county',
+ 'state' => 'tax_rate_location.state',
+ 'locationtaxid' => 'cust_bill_pkg_tax_rate_location.locationtaxid',
+ );
+
+ my %ph = map { $pn{$_} => dbh->quote($param{$_}) } keys %pn;
+
+ join( ' AND ',
+ map { "( $_ = $ph{$_} OR $ph{$_} = '' AND $_ IS NULL)" } keys %ph
+ );
+
+}
+
+=back
+
=head1 SUBROUTINES
=over 4