[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

SF.net SVN: ledger-smb:[4178] branches/1.3



Revision: 4178
          http://ledger-smb.svn.sourceforge.net/ledger-smb/?rev=4178&view=rev
Author:   einhverfr
Date:     2011-12-09 10:12:35 +0000 (Fri, 09 Dec 2011)
Log Message:
-----------
Minus some length adjustments printing single 1099-MISC forms works.

Modified Paths:
--------------
    branches/1.3/Changelog
    branches/1.3/UI/taxform/1099-MISC-base.tex
    branches/1.3/dists/rpm/ledgersmb.spec
    branches/1.3/scripts/taxform.pl
    branches/1.3/sql/modules/1099_reports.sql

Modified: branches/1.3/Changelog
===================================================================
--- branches/1.3/Changelog	2011-12-09 09:29:34 UTC (rev 4177)
+++ branches/1.3/Changelog	2011-12-09 10:12:35 UTC (rev 4178)
@@ -7,6 +7,10 @@
 * Translation fixes in tax form reports (Chris T)
 * Added accidently omitted 1099 forms (Chris T)
 * Fixed formatting issue in sales_quotation.tex (Chris T)
+* Better localization handling on logout (Herman V)
+* Better handling of successive logouts (Herman V)
+* Correcting some erroneous errors on db setup (Herman V)
+* Corrected error message in old handler (Herman V)
 
 Changelog for 1.3.8:
 * Fixed duplicate key error saving taxes (Herman V)

Modified: branches/1.3/UI/taxform/1099-MISC-base.tex
===================================================================
--- branches/1.3/UI/taxform/1099-MISC-base.tex	2011-12-09 09:29:34 UTC (rev 4177)
+++ branches/1.3/UI/taxform/1099-MISC-base.tex	2011-12-09 10:12:35 UTC (rev 4178)
@@ -1,3 +1,4 @@
+\setlength{\parindent}{0pt}
 <?lsmb BLOCK taxformpart ?>
 \begin{textblock}{4}[0,1](0.5, 1)
 <?lsmb company_name ?>
@@ -14,7 +15,10 @@
 \end{textblock}
 
 \begin{textblock}{4}[0,1](0.5, 2.5)
-<?lsmb pay_to_name ?>\\
+<?lsmb legal_name ?>\\
+<?lsmb IF street1 ?><?lsmb street1 ?>\\ <?lsmb END ?>
+<?lsmb IF street2 ?><?lsmb street2 ?>\\ <?lsmb END ?>
+<?lsmb IF street3 ?><?lsmb street3 ?>\\ <?lsmb END ?>
 <?lsmb city ?>, <?lsmb state ?> <?lsmb mail_code ?>
 \end{textblock}
 
@@ -22,4 +26,13 @@
 <?lsmb total_sum ?>
 \end{textblock}
 <?lsmb END # Block taxformpart ?>
-
+<?lsmb BLOCK taxform ?>
+<?lsmb PROCESS taxformpart ?>
+\clearpage
+<?lsmb PROCESS taxformpart ?>
+\clearpage
+<?lsmb PROCESS taxformpart ?>
+\clearpage
+<?lsmb PROCESS taxformpart ?>
+\clearpage
+<?lsmb END #BLOCK taxform ?>

Modified: branches/1.3/dists/rpm/ledgersmb.spec
===================================================================
--- branches/1.3/dists/rpm/ledgersmb.spec	2011-12-09 09:29:34 UTC (rev 4177)
+++ branches/1.3/dists/rpm/ledgersmb.spec	2011-12-09 10:12:35 UTC (rev 4178)
@@ -7,7 +7,6 @@
 URL: http://www.ledgersmb.org/
 Group: Applications/Productivity
 Source0: %{name}-%{version}.tar.gz
-Source2: Template-Plugin-Latex-3.02.tar.gz
 BuildRoot: %{_tmppath}/%{name}-%{version}-root
 BuildArch: noarch
 Requires: perl >= 5.8, httpd, postgresql >= 8.1, tetex-latex
@@ -21,6 +20,7 @@
 Requires: perl-IO-String perl-Config-Std >= 0.007
 Requires: perl-Math-BigInt-GMP
 Requires: perl-Log-Log4perl perl-DateTime
+Requires: perl-Config-Std
 BuildRequires: perl
 # avoid bogus autodetection of perl modules:
 AutoReqProv: no
@@ -58,6 +58,9 @@
 Visit http://localhost/ledgersmb/admin.pl with password "yada" and create an
 application database and users.
 
+Also note, this does NOT provide the LaTeX template extensions which are 
+technically optional but frequently used.  To use these you will need to install
+texlive packages from yum and Template::Latex from cpan.
 
 %prep
 %setup -q -n ledgersmb

Modified: branches/1.3/scripts/taxform.pl
===================================================================
--- branches/1.3/scripts/taxform.pl	2011-12-09 09:29:34 UTC (rev 4177)
+++ branches/1.3/scripts/taxform.pl	2011-12-09 10:12:35 UTC (rev 4178)
@@ -23,11 +23,13 @@
 
 use strict;
 use LedgerSMB;
+use LedgerSMB::Company_Config;
 use LedgerSMB::Template;
 use LedgerSMB::DBObject::TaxForm;
 use LedgerSMB::DBObject::Date;
 use LedgerSMB::Template;
 use LedgerSMB::Form;
+use LedgerSMB::DBObject::Vendor;
 
 =pod
 
@@ -131,6 +133,14 @@
     if (!$request->{format}){
        $request->{format} = 'HTML';
     }
+
+    # Business settings for 1099
+    #
+    my $cc = $LedgerSMB::Company_Config::settings;
+    $request->{company_name}      = $cc->{company_name};
+    $request->{company_address}   = $cc->{company_address};
+    $request->{company_telephone} = $cc->{company_phone};
+    $request->{my_tax_code}       = $cc->{businessnumber};
     # TODO:  Eliminate duplicate code!
     if ($request->{meta_number}) {
       my @call_args = ($request->{'tax_form_id'},
@@ -138,18 +148,37 @@
                        $request->{meta_number});
                        
       my @results = $request->call_procedure(procname => 'tax_form_details_report', args => ..hidden..);
+      my $credit_id;
       for my $r (@results){
           $r->{acc_sum} = $request->format_amount({amount => $r->{acc_sum}});
           $r->{invoice_sum} = 
                $request->format_amount({amount => $r->{invoice_sum}});
+          ($request->{total_sum}) ? $request->{total_sum} + $r->{total_sum}
+                                  : $r->{total_sum};
           $r->{total_sum} = $request->format_amount({amount => $r->{total_sum}});
+          $credit_id = $r->{credit_id};
       }
+      $request->{total_sum} = $request->format_amount(
+                                      {amount => $request->{total_sum}}
+      ) || '0';
+      #XXX Please note, the line below is a kludge because we don't support
+      # generic companies at present on instantiation.  This means I have to 
+      # specify that this is either a customer or vendor.  Right now I am 
+      # specifying as a vendor.  This should have no effect on subsequent code
+      # but if this is somethign we end up depending on, we need to fix it.
+      my $company = LedgerSMB::DBObject::Vendor->new(base => $request);
+      $company->{id} = $credit_id;
+      $company->get_billing_info;
+      delete $company->{id}; 
+      $request->merge($company);
       $request->{results} = ..hidden..;
+      $request->debug({file=>'/tmp/taxformdebug'});
       
       my $template = LedgerSMB::Template->new(
           user => $request->{_user}, 
           locale => $request->{_locale},
           path => 'UI',
+          media => 'screen',
           template => 'taxform/details_report',
           format => $request->{format},
       );

Modified: branches/1.3/sql/modules/1099_reports.sql
===================================================================
--- branches/1.3/sql/modules/1099_reports.sql	2011-12-09 09:29:34 UTC (rev 4177)
+++ branches/1.3/sql/modules/1099_reports.sql	2011-12-09 10:12:35 UTC (rev 4178)
@@ -9,9 +9,10 @@
 -- This file provides 1099 reporting (MISC and INT).  It does NOT provide 1099-K
 -- and we'd need an abstraction layer for that. --CT
 
-
-
+BEGIN;
+DROP TYPE IF EXISTS tax_form_report_item CASCADE;
 CREATE TYPE tax_form_report_item AS (
+    credit_id integer,
     legal_name text, 
     entity_id integer, 
     entity_class integer, 
@@ -21,7 +22,9 @@
     invoice_sum numeric, 
     total_sum numeric);
 
+DROP TYPE IF EXISTS tax_form_report_detail_item CASCADE;
 CREATE TYPE tax_form_report_detail_item AS (
+    credit_id integer,
     legal_name text, 
     entity_id integer, 
     entity_class integer, 
@@ -40,7 +43,8 @@
 	out_row tax_form_report_item;
 BEGIN
 	FOR out_row IN 
-              SELECT company.legal_name, company.entity_id, 
+              SELECT entity_credit_account.id,
+                     company.legal_name, company.entity_id, 
                      entity_credit_account.entity_class, entity.control_code, 
                      entity_credit_account.meta_number, 
                      sum(CASE WHEN gl.amount = 0 THEN 0
@@ -107,7 +111,7 @@
 		JOIN company ON (entity.id = company.entity_id)
 		JOIN country_tax_form ON (entity_credit_account.taxform_id = country_tax_form.id)
                WHERE country_tax_form.id = in_tax_form_id
-             GROUP BY legal_name, meta_number, company.entity_id, entity_credit_account.entity_class, entity.control_code 
+             GROUP BY legal_name, meta_number, company.entity_id, entity_credit_account.entity_class, entity.control_code, entity_credit_account.id
     LOOP
 		RETURN NEXT out_row;
 	END LOOP;
@@ -125,7 +129,8 @@
 	out_row tax_form_report_detail_item;
 BEGIN
 	FOR out_row IN 
-              SELECT company.legal_name, company.entity_id, 
+              SELECT entity_credit_account.id,
+                     company.legal_name, company.entity_id, 
                      entity_credit_account.entity_class, entity.control_code, 
                      entity_credit_account.meta_number, 
                      sum(CASE WHEN gl.amount = 0 then 0 
@@ -191,7 +196,7 @@
                      group by ac.trans_id
                      ) pmt ON  (pmt.trans_id = gl.id)
 		WHERE country_tax_form.id = in_tax_form_id AND meta_number = in_meta_number
-		GROUP BY legal_name, meta_number, company.entity_id, entity_credit_account.entity_class, entity.control_code, gl.invnumber, gl.duedate, gl.id
+		GROUP BY legal_name, meta_number, company.entity_id, entity_credit_account.entity_class, entity.control_code, gl.invnumber, gl.duedate, gl.id, entity_credit_account.id
 	LOOP
 		RETURN NEXT out_row;
 	END LOOP;
@@ -203,3 +208,4 @@
 $$ This provides a list of invoices and transactions that a report hits.  This 
 is intended to allow an organization to adjust what is reported on the 1099 
 before printing them.$$;
+COMMIT;

This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.