X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=httemplate%2Fsearch%2Freport_tax.cgi;h=491cd42c53297c377d268257133caf9edb2d0ea9;hb=6419542b10f8ebb0dada9dcb1a48cf78151ca82a;hp=3519d722a8635af646740e1119669f19f4d307e6;hpb=97418edf65d4cb40b8aa51998c123fd185a27711;p=freeside.git
diff --git a/httemplate/search/report_tax.cgi b/httemplate/search/report_tax.cgi
old mode 100755
new mode 100644
index 3519d722a..491cd42c5
--- a/httemplate/search/report_tax.cgi
+++ b/httemplate/search/report_tax.cgi
@@ -1,583 +1,231 @@
-<% include("/elements/header.html", "$agentname Sales Tax Report - ".
- ( $beginning
- ? time2str('%h %o %Y ', $beginning )
- : ''
- ).
- 'through '.
- ( $ending == 4294967295
- ? 'now'
- : time2str('%h %o %Y', $ending )
- ),
- menubar( 'Main Menu'=>$p, )
- )
-%>
-
-<% include('/elements/table-grid.html') %>
-
+<& /elements/header.html, $report->title &>
+
+Download full results
+as Excel spreadsheet
+ |
+
+
+<& /elements/table-grid.html &>
+
- |
- Sales |
- |
- Rate |
- |
- Tax owed |
-% unless ( $cgi->param('show_taxclasses') ) {
+ |
+ Sales |
+ |
+ Rate |
+ |
+ Estimated tax |
+ Tax invoiced |
+ |
+ Tax credited |
+ |
+ Net tax due |
+
- Tax invoiced |
-% }
+
+ Total |
+ Non-taxable |
+ Non-taxable |
+ Non-taxable |
+ Taxable |
+
+
+ (tax-exempt customer) |
+ (tax-exempt package) |
+ (monthly exemption) |
+
+
+% my $rownum = 0;
+% my $prev_row = { pkgclass => 'DUMMY PKGCLASS' };
+
+
+% foreach my $row (@rows) {
+% # before anything else: if this row's pkgclass is not the same as the
+% # previous row's, then:
+% if ( $row->{pkgclass} ne $prev_row->{pkgclass} ) {
+% if ( $rownum > 0 ) { # start a new section
+% $rownum = 0;
+
+% }
+% if ( $params{breakdown}->{pkgclass} ) { # and caption the new section
- Total |
- |
- Non-taxable (tax-exempt customer) |
- |
- Non-taxable (tax-exempt package) |
- |
- Non-taxable (monthly exemption) |
- |
- Taxable |
+
+ <% $pkgclass_name{$row->{pkgclass}} %>
+ |
-% my $bgcolor1 = '#eeeeee';
-% my $bgcolor2 = '#ffffff';
-% my $bgcolor;
-%
-% foreach my $region ( @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'};
-% }
-% }
-%
-%
-%
+% }
+% } # if $row->{pkgclass} ne ...
+
+% # construct base links that limit to the tax rates described by this row
+% my $rowlink = ';taxnum=' . $row->{taxnums};
+% # and also the package class, if we're limiting package class
+% if ( $params{breakdown}->{pkgclass} ) {
+% $rowlink .= ';classnum=' . ($row->{pkgclass} || 0);
+% }
%
-%
-
-
+% if ( $row->{total} ) {
+
+% }
+
+% # Row label
+ <% $row->{label} |h %> |
+
+% # Total sales
+
+ <% $money_sprintf->( $row->{sales} ) %>
+
+ |
+% # Exemptions: customer
+
+
+ <% $money_sprintf->( $row->{exempt_cust} ) %>
+
+ |
+% # package
+
+
+ <% $money_sprintf->( $row->{exempt_pkg} ) %>
+
+ |
+% # monthly (note this uses $exemptlink; it's a completely separate report)
+
+
+ <% $money_sprintf->( $row->{exempt_monthly} ) %>
+
+ |
+% # taxable sales
+
+ ">
+ <% $money_sprintf->( $row->{taxable} ) %>
+
+ |
+ × |
+ <% $row->{rate} %> |
+% # estimated tax
+ = |
+
+% if ( $row->{estimated} ) {
+ <% $money_sprintf->( $row->{estimated} ) %>
+% }
+ |
+% # invoiced tax
+
+
+ <% $money_sprintf->( $row->{tax} ) %>
+
+ |
+% # credited tax
+ − |
+
+
+ <% $money_sprintf->( $row->{credit} ) %>
+
+ |
+% # net tax due
+ = |
+ <% $money_sprintf->( $row->{tax} - $row->{credit} ) %> |
+
+% $rownum++;
+% $prev_row = $row;
+% } # foreach my $row
+% # at the end of everything
+
+% if ( $report->{outside} > 0 ) {
+
- <% $region->{'label'} %> |
-
- <% $money_char %><% sprintf('%.2f', $region->{'total'} ) %>
- |
- - |
-
- <% $money_char %><% sprintf('%.2f', $region->{'exempt_cust'} ) %>
- |
- - |
-
- <% $money_char %><% sprintf('%.2f', $region->{'exempt_pkg'} ) %>
+ |
+ <% emt('Out of taxable region') %>
|
- - |
-
- <% $money_char %><% sprintf('%.2f', $region->{'exempt_monthly'} ) %>
- |
- = |
-
- <% $money_char %><% sprintf('%.2f', $region->{'taxable'} ) %>
+ |
+
+ <% $money_sprintf->( $report->{outside } ) %>
+
|
- <% $region->{'label'} eq 'Total' ? '' : ' X ' %> |
- <% $region->{'rate'} %> |
- <% $region->{'label'} eq 'Total' ? '' : ' = ' %> |
-
- <% $money_char %><% sprintf('%.2f', $region->{'owed'} ) %>
- |
-% unless ( $cgi->param('show_taxclasses') ) {
-
-
- <% $money_char %><% sprintf('%.2f', $region->{'tax'} ) %>
- |
-% }
-
+ |
-% }
-
-
+
+% }
-% 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'};
-% }
-% #}
-%
-
-
-
- <% $region->{'label'} %> |
-
- <% $money_char %><% sprintf('%.2f', $region->{'tax'} ) %>
- |
-
-% }
-%
-% if ( $bgcolor eq $bgcolor1 ) {
-% $bgcolor = $bgcolor2;
-% } else {
-% $bgcolor = $bgcolor1;
-% }
-%
-
-
- Total |
-
- <% $money_char %><% sprintf('%.2f', $tax ) %>
- |
-
-
-
-% }
-
-
-