X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=httemplate%2Fsearch%2Freport_tax.cgi;h=6dc9ffcfb586d318f970a7741953c5c8ad25f9e8;hb=34b6146b716903b4a4f437c95a8e403c44ba0241;hp=7585caa1545ad2c1732e524001d6282305ffab9b;hpb=de602da29b21203c4526a391c50d27cbf2e92fec;p=freeside.git
diff --git a/httemplate/search/report_tax.cgi b/httemplate/search/report_tax.cgi
index 7585caa15..6dc9ffcfb 100755
--- a/httemplate/search/report_tax.cgi
+++ b/httemplate/search/report_tax.cgi
@@ -1,4 +1,4 @@
-<% include("/elements/header.html", "$agentname Sales Tax Report - ".
+<% include("/elements/header.html", "$agentname Tax Report - ".
( $beginning
? time2str('%h %o %Y ', $beginning )
: ''
@@ -10,214 +10,327 @@
)
)
%>
-
+
+Download full results
+as Excel spreadsheet
+ |
+
+
<% include('/elements/table-grid.html') %>
+
+ |
+ Sales |
+ |
+ Rate |
+ |
+ Tax owed |
+% unless ( $cgi->param('show_taxclasses') ) {
+ Tax invoiced |
+ |
+ Tax credited |
+ |
+ Tax collected |
+% }
+
+ Total |
|
- Sales |
+ Non-taxable |
|
- Rate |
+ Non-taxable |
|
- Tax owed |
-% unless ( $cgi->param('show_taxclasses') ) {
-
- Tax invoiced |
-% }
+ Non-taxable |
+ |
+ Taxable |
+
+
+ (tax-exempt customer) |
+ (tax-exempt package) |
+ (monthly exemption) |
+
+% foreach my $class (@pkgclasses ) {
+% next if @{ $class->{regions} } == 0;
+% if ( $class->{classname} ) {
- Total |
- |
- Non-taxable (tax-exempt customer) |
- |
- Non-taxable (tax-exempt package) |
- |
- Non-taxable (monthly exemption) |
- |
- Taxable |
+ <% $class->{classname} %> |
+% }
+
% my $bgcolor1 = '#eeeeee';
-% my $bgcolor2 = '#ffffff';
-% my $bgcolor;
-%
+% my $bgcolor2 = '#ffffff';
+% my $bgcolor;
+
+% my @regions = @{ $class->{regions} };
% foreach my $region ( @regions ) {
%
-% if ( $bgcolor eq $bgcolor1 ) {
-% $bgcolor = $bgcolor2;
-% } else {
-% $bgcolor = $bgcolor1;
-% }
+% my $link = '';
+% if ( $with_pkgclass and length($class->{classnum}) ) {
+% $link = ';classnum='.$class->{classnum};
+% } # else we're not breaking down pkg class, or this is the grand total
%
-% my $link = '';
-% if ( $region->{'label'} ne 'Total' ) {
-% if ( $region->{'label'} eq $out ) {
-% $link = ';out=1';
-% } else {
-% $link = ';'. $region->{'url_param'};
-% }
-% }
+% if ( $region->{'label'} eq $out ) {
+% $link .= ';out=1';
+% } elsif ( $region->{'taxnums'} ) {
+% # might be nicer to specify this as country:state:city
+% $link .= ';'.join(';', map { "taxnum=$_" } @{ $region->{'taxnums'} });
+% }
%
+% if ( $bgcolor eq $bgcolor1 ) {
+% $bgcolor = $bgcolor2;
+% } else {
+% $bgcolor = $bgcolor1;
+% }
%
+% my $hicolor = $bgcolor;
+% unless ( $cgi->param('show_taxclasses') ) {
+% my $diff = abs( sprintf( '%.2f', $region->{'owed'} )
+% - sprintf( '%.2f', $region->{'tax'} )
+% );
+% if ( $diff > 0.02 ) {
+% $hicolor = $hicolor eq '#eeeeee' ? '#eeee99' : '#ffffcc';
+% }
+% }
%
%
-%
-
-
+% my $td = qq(TD CLASS="grid" BGCOLOR="$bgcolor");
+% my $tdh = qq(TD CLASS="grid" BGCOLOR="$hicolor");
+% my $bigmath = '';
+% my $bme = '';
+
+% if ( $region->{'is_total'} ) {
+
+ Total |
+% } else {
- <% $region->{'label'} %> |
-
- <% $money_char %><% sprintf('%.2f', $region->{'total'} ) %>
+ <<%$td%>><% $region->{'label'} %> |
+% }
+ <<%$td%> ALIGN="right">
+ <% &$money_sprintf( $region->{'sales'} ) %>
- - |
-
- <% $money_char %><% sprintf('%.2f', $region->{'exempt_cust'} ) %>
+% if ( $region->{'label'} eq $out ) {
+ <<%$td%> COLSPAN=12> |
+% } else { #not $out
+ <<%$td%>> -
+ <<%$td%> ALIGN="right">
+ <% &$money_sprintf( $region->{'exempt_cust'} ) %>
- - |
-
- <% $money_char %><% sprintf('%.2f', $region->{'exempt_pkg'} ) %>
+ <<%$td%>> - |
+ <<%$td%> ALIGN="right">
+ <% &$money_sprintf( $region->{'exempt_pkg'} ) %>
- - |
-
- <% $money_char %><% sprintf('%.2f', $region->{'exempt_monthly'} ) %>
+ <<%$td%>> - |
+ <<%$td%> ALIGN="right">
+ <% &$money_sprintf( $region->{'exempt_monthly'} ) %>
- = |
-
- <% $money_char %><% sprintf('%.2f', $region->{'taxable'} ) %>
+ <<%$td%>> = |
+ <<%$td%> ALIGN="right">
+ <% &$money_sprintf( $region->{'taxable'} ) %>
- <% $region->{'label'} eq 'Total' ? '' : ' X ' %> |
- <% $region->{'rate'} %> |
- <% $region->{'label'} eq 'Total' ? '' : ' = ' %> |
-
- <% $money_char %><% sprintf('%.2f', $region->{'owed'} ) %>
+ <<%$td%>><% $region->{'label'} eq 'Total' ? '' : "$bigmath X $bme" %> |
+ <<%$td%> ALIGN="right"><% $region->{'rate'} %>
+ <<%$td%>><% $region->{'label'} eq 'Total' ? '' : "$bigmath = $bme" %>
+ <<%$tdh%> ALIGN="right">
+ <% &$money_sprintf( $region->{'owed'} ) %>
-% unless ( $cgi->param('show_taxclasses') ) {
-
-
- <% $money_char %><% sprintf('%.2f', $region->{'tax'} ) %>
+% } # if !$out
+% unless ( $cgi->param('show_taxclasses') ) {
+% my $invlink = $region->{'url_param_inv'}
+% ? ';'. $region->{'url_param_inv'}
+% : $link;
+
+% if ( $region->{'label'} eq $out ) {
+ <<%$td%> ALIGN="right">
+ <% &$money_sprintf_nonzero( $region->{'tax'} ) %>
|
-% }
+ <<%$td%>>
+ <<%$td%> ALIGN="right">
+ <% &$money_sprintf_nonzero( $region->{'credit'} ) %>
+
+ <<%$td%> COLSPAN=2>
+% } else { #not $out
+ <<%$tdh%> ALIGN="right">
+ <% &$money_sprintf( $region->{'tax'} ) %>
+
+ <<%$tdh%>> -
+ <<%$tdh%> ALIGN="right">
+ <% &$money_sprintf( $region->{'credit'} ) %>
+
+ <<%$tdh%>> =
+ <<%$tdh%> ALIGN="right">
+ <% &$money_sprintf( $region->{'tax'} - $region->{'credit'} ) %>
+
+% }
+% } # show_taxclasses
-% }
+% } # foreach $region
+%} # foreach $class
-% if ( $cgi->param('show_taxclasses') ) {
+% if ( $cgi->param('show_taxclasses') ) {
-
- <% include('/elements/table-grid.html') %>
-
- |
- Tax invoiced |
-
-% #some false laziness w/above
-% $bgcolor1 = '#eeeeee';
-% $bgcolor2 = '#ffffff';
-% foreach my $region ( @base_regions ) {
-%
-% if ( $bgcolor eq $bgcolor1 ) {
-% $bgcolor = $bgcolor2;
-% } else {
-% $bgcolor = $bgcolor1;
-% }
-%
-% my $link = '';
-% #if ( $region->{'label'} ne 'Total' ) {
-% if ( $region->{'label'} eq $out ) {
-% $link = ';out=1';
-% } else {
-% $link = ';'. $region->{'url_param'};
-% }
-% #}
-%
-
+
+ <% include('/elements/table-grid.html') %>
+
+ |
+ Tax invoiced |
+ |
+ Tax credited |
+ |
+ Tax collected |
+
+% #some false laziness w/above
+% foreach my $class (@pkgclasses) {
+% if ( $class->{classname} ) {
- <% $region->{'label'} %> |
-
- <% $money_char %><% sprintf('%.2f', $region->{'tax'} ) %>
- |
+ <% $class->{classname} %> |
-% }
+% }
+
+% my $bgcolor1 = '#eeeeee';
+% my $bgcolor2 = '#ffffff';
+% my $bgcolor;
+%
+% foreach my $region ( @{ $class->{base_regions} } ) {
+%
+% my $link = '';
+% if ( $with_pkgclass and length($class->{classnum}) ) {
+% $link = ';classnum='.$class->{classnum};
+% }
+%
+% if ( $region->{'label'} eq $out ) {
+% $link .= ';out=1';
+% } else {
+% $link .= ';'. $region->{'url_param'}
+% if $region->{'url_param'};
+% }
%
% if ( $bgcolor eq $bgcolor1 ) {
% $bgcolor = $bgcolor2;
% } else {
% $bgcolor = $bgcolor1;
% }
-%
-
-
-
- Total |
-
- <% $money_char %><% sprintf('%.2f', $tax ) %>
- |
-
+% my $td = qq(TD CLASS="grid" BGCOLOR="$bgcolor");
+% my $tdh = qq(TD CLASS="grid" BGCOLOR="$bgcolor");
+%
+% #?
+% my $invlink = $region->{'url_param_inv'}
+% ? ';'. $region->{'url_param_inv'}
+% : $link;
+
+
+ <<%$td%>><% $region->{'label'} %>
+% if ( $region->{'label'} eq $out ) {
+ <<%$td%> ALIGN="right">
+ <% &$money_sprintf_nonzero( $region->{'tax'} ) %>
+
+ <<%$td%>>
+ <<%$td%> ALIGN="right">
+ <% &$money_sprintf_nonzero( $region->{'credit'} ) %>
+
+ <<%$td%> COLSPAN=2>
+% } else { #not $out
+ <<%$td%> ALIGN="right">
+ <% &$money_sprintf( $region->{'tax'} ) %>
+
+ <<%$td%>> -
+ <<%$tdh%> ALIGN="right">
+ <% &$money_sprintf( $region->{'credit'} ) %>
+
+ <<%$td%>> =
+ <<%$tdh%> ALIGN="right">
+ <% &$money_sprintf( $region->{'tax'} - $region->{'credit'} ) %>
+
+
+% } # if $out
+% } #foreach $region
+% } #foreach $class
-% }
+% } # if show_taxclasses
+
+<% include('/elements/footer.html') %>
-