[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
SF.net SVN: ledger-smb:[2783] trunk
- Subject: SF.net SVN: ledger-smb:[2783] trunk
- From: ..hidden..
- Date: Fri, 06 Nov 2009 20:23:08 +0000
Revision: 2783
http://ledger-smb.svn.sourceforge.net/ledger-smb/?rev=2783&view=rev
Author: einhverfr
Date: 2009-11-06 20:23:08 +0000 (Fri, 06 Nov 2009)
Log Message:
-----------
Minor corrections to 1099 reports.
Modified Paths:
--------------
trunk/LedgerSMB/DBObject/TaxForm.pm
trunk/bin/aa.pl
trunk/bin/gl.pl
trunk/scripts/taxform.pl
trunk/sql/modules/1099_reports.sql
Modified: trunk/LedgerSMB/DBObject/TaxForm.pm
===================================================================
--- trunk/LedgerSMB/DBObject/TaxForm.pm 2009-11-05 23:17:48 UTC (rev 2782)
+++ trunk/LedgerSMB/DBObject/TaxForm.pm 2009-11-06 20:23:08 UTC (rev 2783)
@@ -21,8 +21,7 @@
my ($self) = @_;
@{$self->{forms}} = $self->exec_method(
- funcname => 'list_taxforms',
- args => ['1'] # lx: Inquire as to the use of this argument in this sp; currently doesn't add up in the SQL for the SP.
+ funcname => 'tax_form__list_all',
);
}
Modified: trunk/bin/aa.pl
===================================================================
--- trunk/bin/aa.pl 2009-11-05 23:17:48 UTC (rev 2782)
+++ trunk/bin/aa.pl 2009-11-06 20:23:08 UTC (rev 2783)
@@ -959,6 +959,8 @@
'save_info' =>
{ ndx => 9, key => 'I', value => $locale->text('Save Info') },
+ 'save_temp' =>
+ { ndx => 10, key => 'T', value => $locale->text('Save Template')},
);
if (!$form->{approved} && !$form->{batch_id}){
$button{approve} = {
@@ -1028,6 +1030,42 @@
|;
}
+sub save_temp {
+ use LedgerSMB;
+ use LedgerSMB::DBObject::TransTemplate;
+ my $lsmb = LedgerSMB->new();
+ $lsmb->merge($form);
+ $lsmb->{is_invoice} = 1;
+ my ($department_name, $department_id) = split/--/, $form->{department};
+ if (!$lsmb->{language_code}){
+ delete $lsmb->{language_code};
+ }
+ $lsmb->{credit_id} = $form->{"$form->{vc}_id"};
+ $lsmb->{department_id} = $department_id;
+ if ($form->{arap} eq 'ar'){
+ $lsmb->{entity_class} = 2;
+ } else {
+ $lsmb->{entity_class} = 1;
+ }
+ $lsmb->{transaction_date} = $form->{transdate};
+ for my $iter (0 .. $form->{rowcount}){
+ if ($form->{"accno_$iter"} and
+ ($form->{"amount_$iter"} != 0)){
+ my ($acc_id, $acc_name) = split /--/, $form->{"accno_$iter"};
+ my $amount = $form->{"credit_$iter"} || ( $form->{"debit_$iter"}
+ * -1 );
+ push @{$lsmb->{journal_lines}},
+ {accno => $acc_id,
+ amount => $amount,
+ cleared => false,
+ };
+ }
+ }
+ $template = LedgerSMB::DBObject::TransTemplate->new(base => $lsmb);
+ $template->save;
+ $form->redirect( $locale->text('Template Saved!') );
+}
+
sub edit_and_approve {
use LedgerSMB::DBObject::Draft;
use LedgerSMB;
Modified: trunk/bin/gl.pl
===================================================================
--- trunk/bin/gl.pl 2009-11-05 23:17:48 UTC (rev 2782)
+++ trunk/bin/gl.pl 2009-11-06 20:23:08 UTC (rev 2783)
@@ -241,6 +241,10 @@
'update' =>
{ ndx => 1, key => 'U', value => $locale->text('Update') },
'post' => { ndx => 3, key => 'O', value => $locale->text('Post') },
+ 'save_temp' =>
+ { ndx => 9,
+ key => 'T',
+ value => $locale->text('Save Template') },
'post_as_new' =>
{ ndx => 6, key => 'N', value => $locale->text('Post as new') },
'schedule' =>
@@ -254,6 +258,7 @@
$button{post}->{value} = $locale->text('Save');
}
%a = ();
+ $a{save_temp} = 1;
if ( $form->{id} ) {
for ( 'update', 'post_as_new', 'schedule' ) { $a{$_} = 1 }
@@ -334,7 +339,37 @@
}
+sub save_temp {
+ use LedgerSMB;
+ use LedgerSMB::DBObject::TransTemplate;
+ my $lsmb = LedgerSMB->new();
+ my ($department_name, $department_id) = split/--/, $form->{department};
+ $lsmb->{department_id} = $department_id;
+ $lsmb->{source} = $form->{reference};
+ $lsmb->{description} = $form->{description};
+ $lsmb->{department_id} = $department_id;
+ $lsmb->{transaction_date} = $form->{transdate};
+ $lsmb->{type} = 'gl';
+ $lsmb->{journal_lines} = [];
+ for my $iter (0 .. $form->{rowcount}){
+ if ($form->{"accno_$iter"} and
+ (($form->{"credit_$iter"} != 0) or ($form->{"debit_$iter"} != 0))){
+ my ($acc_id, $acc_name) = split /--/, $form->{"accno_$iter"};
+ my $amount = $form->{"credit_$iter"} || ( $form->{"debit_$iter"}
+ * -1 );
+ push @{$lsmb->{journal_lines}},
+ {accno => $acc_id,
+ amount => $amount,
+ cleared => false,
+ };
+ }
+ }
+ $template = LedgerSMB::DBObject::TransTemplate->new(base => $lsmb);
+ $template->save;
+ $form->redirect( $locale->text('Template Saved!') );
+}
+
sub display_row
{
Modified: trunk/scripts/taxform.pl
===================================================================
--- trunk/scripts/taxform.pl 2009-11-05 23:17:48 UTC (rev 2782)
+++ trunk/scripts/taxform.pl 2009-11-06 20:23:08 UTC (rev 2783)
@@ -105,6 +105,12 @@
{
my @call_args = ($request->{'tax_form_id'}, $request->{begin_month}.' '.$request->{begin_day}.' '.$request->{begin_year}, $request->{end_month}.' '.$request->{end_day}.' '.$request->{end_year}, $request->{meta_number});
my @results = $request->call_procedure(procname => 'tax_form_details_report', args => ..hidden.., );
+ for my $r (@results){
+ $r->{acc_sum} = $request->format_amount({amount => $r->{acc_sum}});
+ $r->{invoice_sum} =
+ $request->format_amount({amount => $r->{invoice_sum}});
+ $r->{total_sum} = $request->format_amount({amount => $r->{total_sum}});
+ }
$request->{results} = ..hidden..;
my $template = LedgerSMB::Template->new(
@@ -118,6 +124,12 @@
} else {
my @call_args = ($request->{'tax_form_id'}, $request->{begin_month}.' '.$request->{begin_day}.' '.$request->{begin_year}, $request->{end_month}.' '.$request->{end_day}.' '.$request->{end_year});
my @results = $request->call_procedure(procname => 'tax_form_summary_report', args => ..hidden.., );
+ for my $r (@results){
+ $r->{acc_sum} = $request->format_amount({amount => $r->{acc_sum}});
+ $r->{invoice_sum} =
+ $request->format_amount({amount => $r->{invoice_sum}});
+ $r->{total_sum} = $request->format_amount({amount => $r->{total_sum}});
+ }
$request->{results} = ..hidden..;
my $template = LedgerSMB::Template->new(
Modified: trunk/sql/modules/1099_reports.sql
===================================================================
--- trunk/sql/modules/1099_reports.sql 2009-11-05 23:17:48 UTC (rev 2782)
+++ trunk/sql/modules/1099_reports.sql 2009-11-06 20:23:08 UTC (rev 2783)
@@ -1,6 +1,12 @@
CREATE TYPE tax_form_report_item AS (legal_name text, entity_id integer, entity_class integer, control_code text, meta_number character varying(32), acc_sum numeric, invoice_sum numeric, total_sum numeric);
CREATE TYPE tax_form_report_detail_item AS (legal_name text, entity_id integer, entity_class integer, control_code text, meta_number character varying(32), acc_sum numeric, invoice_sum numeric, total_sum numeric, invnumber text, duedate text);
+CREATE OR REPLACE FUNCTION tax_form__list_all()
+RETURNS SETOF country_tax_form as
+$$
+select * from country_tax_form order by country_id;
+$$ language sql;
+
CREATE OR REPLACE FUNCTION tax_form_summary_report(in_tax_form_id int, in_begin date, in_end date) RETURNS setof tax_form_report_item AS $$
DECLARE
out_row tax_form_report_item;
@@ -24,7 +30,7 @@
END;
$$ LANGUAGE plpgsql;
-CREATE OR REPLACE FUNCTION tax_form_details_report(in_tax_form_id int, in_begin date, in_end date, in_meta_number integer) RETURNS setof tax_form_report_detail_item AS $$
+CREATE OR REPLACE FUNCTION tax_form_details_report(in_tax_form_id int, in_begin date, in_end date, in_meta_number text) RETURNS setof tax_form_report_detail_item AS $$
DECLARE
out_row tax_form_report_detail_item;
BEGIN
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.