projects
/
freeside.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
svc_cable unique serialnum and mac_addr, RT#
[freeside.git]
/
FS
/
FS
/
tax_rate.pm
diff --git
a/FS/FS/tax_rate.pm
b/FS/FS/tax_rate.pm
index
3d37677
..
9e458e2
100644
(file)
--- a/
FS/FS/tax_rate.pm
+++ b/
FS/FS/tax_rate.pm
@@
-371,7
+371,7
@@
sub passtype_name {
$tax_passtypes{$self->passtype};
}
$tax_passtypes{$self->passtype};
}
-=item taxline TAXABLES
, [ OPTIONSHASH ]
+=item taxline TAXABLES
Returns a listref of a name and an amount of tax calculated for the list
of packages/amounts referenced by TAXABLES. If an error occurs, a message
Returns a listref of a name and an amount of tax calculated for the list
of packages/amounts referenced by TAXABLES. If an error occurs, a message
@@
-381,13
+381,13
@@
is returned as a scalar.
sub taxline {
my $self = shift;
sub taxline {
my $self = shift;
+ # this used to accept a hash of options but none of them did anything
+ # so it's been removed.
my $taxables;
my $taxables;
- my %opt = ();
if (ref($_[0]) eq 'ARRAY') {
$taxables = shift;
if (ref($_[0]) eq 'ARRAY') {
$taxables = shift;
- %opt = @_;
}else{
$taxables = [ @_ ];
#exemptions would be broken in this case
}else{
$taxables = [ @_ ];
#exemptions would be broken in this case
@@
-1826,6
+1826,12
@@
sub browse_queries {
=item queue_liability_report PARAMS
Launches a tax liability report.
=item queue_liability_report PARAMS
Launches a tax liability report.
+
+PARAMS needs to be a base64-encoded Storable hash containing:
+- beginning: the start date, as a I<user-readable string> (not a timestamp).
+- end: the end date of the report, likewise.
+- agentnum: the agent to limit the report to, if any.
+
=cut
sub queue_liability_report {
=cut
sub queue_liability_report {
@@
-1849,8
+1855,12
@@
sub queue_liability_report {
=item generate_liability_report PARAMS
=item generate_liability_report PARAMS
-Generates a tax liability report. Provide a hash including desired
-agentnum, beginning, and ending
+Generates a tax liability report. PARAMS must include:
+
+- beginning, as a timestamp
+- ending, as a timestamp
+- p: the Freeside root URL, for generating links
+- agentnum (optional)
=cut
=cut
@@
-1912,11
+1922,16
@@
sub generate_liability_report {
my %taxes = ();
my %basetaxes = ();
my $calculated = 0;
my %taxes = ();
my %basetaxes = ();
my $calculated = 0;
+
+ # get all distinct tuples of (tax name, state, county, city, locationtaxid)
+ # for taxes that have been charged
+ # (state, county, city are from tax_rate_location, not from customer data)
my @tax_and_location = qsearch({ table => 'cust_bill_pkg',
select => $select,
hashref => { pkgpart => 0 },
addl_from => $addl_from,
extra_sql => $where,
my @tax_and_location = qsearch({ table => 'cust_bill_pkg',
select => $select,
hashref => { pkgpart => 0 },
addl_from => $addl_from,
extra_sql => $where,
+ debug => 1,
});
$count = scalar(@tax_and_location);
foreach my $t ( @tax_and_location ) {
});
$count = scalar(@tax_and_location);
foreach my $t ( @tax_and_location ) {
@@
-1940,15
+1955,17
@@
sub generate_liability_report {
$taxes{$label}->{'url_param'} =
join(';', map { "$_=". uri_escape($t->$_) } @params);
$taxes{$label}->{'url_param'} =
join(';', map { "$_=". uri_escape($t->$_) } @params);
- my $payby_itemdesc_loc =
- " payby != 'COMP' ".
- "AND ( itemdesc = ? OR ? = '' AND itemdesc IS NULL ) ".
+ my $itemdesc_loc =
+ # " payby != 'COMP' ". # breaks the entire report under 4.x
+ # # and unnecessary since COMP accounts don't
+ # # get taxes calculated in the first place
+ " ( itemdesc = ? OR ? = '' AND itemdesc IS NULL ) ".
"AND ". FS::tax_rate_location->location_sql( map { $_ => $t->$_ }
@taxparams
);
my $taxwhere =
"AND ". FS::tax_rate_location->location_sql( map { $_ => $t->$_ }
@taxparams
);
my $taxwhere =
- "FROM cust_bill_pkg $addl_from $where AND $
payby_
itemdesc_loc";
+ "FROM cust_bill_pkg $addl_from $where AND $itemdesc_loc";
my $sql = "SELECT SUM(amount) $taxwhere AND cust_bill_pkg.pkgnum = 0";
my $sql = "SELECT SUM(amount) $taxwhere AND cust_bill_pkg.pkgnum = 0";
@@
-1959,7
+1976,7
@@
sub generate_liability_report {
my $creditfrom =
"JOIN cust_credit_bill_pkg USING (billpkgnum,billpkgtaxratelocationnum)";
my $creditwhere =
my $creditfrom =
"JOIN cust_credit_bill_pkg USING (billpkgnum,billpkgtaxratelocationnum)";
my $creditwhere =
- "FROM cust_bill_pkg $addl_from $creditfrom $where AND $
payby_
itemdesc_loc";
+ "FROM cust_bill_pkg $addl_from $creditfrom $where AND $itemdesc_loc";
$sql = "SELECT SUM(cust_credit_bill_pkg.amount) ".
" $creditwhere AND cust_bill_pkg.pkgnum = 0";
$sql = "SELECT SUM(cust_credit_bill_pkg.amount) ".
" $creditwhere AND cust_bill_pkg.pkgnum = 0";
@@
-2023,7
+2040,8
@@
sub generate_liability_report {
my $dateagentlink = "begin=$args{beginning};end=$args{ending}";
$dateagentlink .= ';agentnum='. $args{agentnum}
if length($agentname);
my $dateagentlink = "begin=$args{beginning};end=$args{ending}";
$dateagentlink .= ';agentnum='. $args{agentnum}
if length($agentname);
- my $baselink = $args{p}. "search/cust_bill_pkg.cgi?$dateagentlink";
+ my $baselink = $args{p}. "search/cust_bill_pkg.cgi?vendortax=1;" .
+ $dateagentlink;
my $creditlink = $args{p}. "search/cust_credit_bill_pkg.html?$dateagentlink";
print $report <<EOF;
my $creditlink = $args{p}. "search/cust_credit_bill_pkg.html?$dateagentlink";
print $report <<EOF;