[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
SF.net SVN: ledger-smb:[3599] trunk
- Subject: SF.net SVN: ledger-smb:[3599] trunk
- From: ..hidden..
- Date: Sat, 30 Jul 2011 17:06:10 +0000
Revision: 3599
http://ledger-smb.svn.sourceforge.net/ledger-smb/?rev=3599&view=rev
Author: einhverfr
Date: 2011-07-30 17:06:10 +0000 (Sat, 30 Jul 2011)
Log Message:
-----------
Docstrings for tax form and 1099 functionality
Modified Paths:
--------------
trunk/LedgerSMB/DBObject/TaxForm.pm
trunk/scripts/taxform.pl
trunk/t/98-pod-coverage.t
Modified: trunk/LedgerSMB/DBObject/TaxForm.pm
===================================================================
--- trunk/LedgerSMB/DBObject/TaxForm.pm 2011-07-30 16:08:13 UTC (rev 3598)
+++ trunk/LedgerSMB/DBObject/TaxForm.pm 2011-07-30 17:06:10 UTC (rev 3599)
@@ -1,11 +1,53 @@
-#! /usr/bin/perl
+=pod
+=head1 NAME
+
+LedgerSMB:DBObject::TaxForm
+
+=head1 SYNOPSIS
+
+This module includes methods for saving and retrieving tax forms, and running
+reports. The tax forms are for reporting purchases or sales to tax bodies, and
+as of 1.3.0, the only tax forms officially included are those of the 1099-MISC
+and 1099-INT forms of the USA.
+
+Currently there is no abstraction layer to allow replacing the various reports
+on the fly, but this will have to be implemented in the future.
+
+=head1 METHODS
+
+=over
+
+=cut
+
+
package LedgerSMB::DBObject::TaxForm;
use base qw(LedgerSMB::DBObject);
use strict;
+=item save
+Saves the tax form. Inputs are:
+
+=over
+
+=item form_name (required)
+The name of the form, eg, 1099-MISC
+
+=item country_id (required)
+The id of the country
+
+=item id (optional)
+The id of the tax form to overwrite
+
+=back
+
+In the future it is likely that we will add a taxform_sproc_id too as part of
+an abstraction layer.
+
+=cut
+
sub save
{
@@ -15,6 +57,27 @@
$self->{dbh}->commit();
}
+
+=item get($id)
+
+Retrieves information on the tax form specified and merges it with the current
+object. Properties set are:
+
+=over
+
+=item id
+ID of tax form
+
+=item form_name
+Name of tax form (eg, 1099-MISC)
+
+=item country_id
+ID of country attached to tax form
+
+=back
+
+=cut
+
sub get
{
my ($self, $id) = @_;
@@ -25,6 +88,19 @@
return $results[0];
}
+=item get_full_list
+
+No inputs required. Provides a list of hashrefs (and attaches them to the
+form property of the object hashref).
+
+Each hashref has the same properties as are set by get($id) above, but also
+includes country_name which is the full name of the country (eg, 'United
+States').
+
+Default ordering is by country name and then by tax form name.
+
+=cut
+
sub get_full_list
{
my ($self) = @_;
@@ -35,6 +111,16 @@
return @{$self->{forms}};
}
+=item get_forms
+
+No inputs needed
+
+Returns a list of hashrefs representing tax forms. Each hashref contains
+the same properties as from get() above. Default ordering is by country id
+then tax form id.
+
+=cut
+
sub get_forms
{
my ($self) = @_;
@@ -45,6 +131,24 @@
return @{$self->{forms}};
}
+=item get_metadata
+
+Gets metadata for the screen.
+
+Sets the following hashref properties
+
+=over
+
+=item countries
+A list of all countries, for drop down box purposes.
+
+=item default_country
+The default country of the organization, to set the dropdown box.
+
+=back
+
+=cut
+
sub get_metadata
{
my ($self) = @_;
@@ -59,4 +163,15 @@
+=back
+
+=head1 COPYRIGHT
+
+Copyright (C) 2009 LedgerSMB Core Team. This file is licensed under the GNU
+General Public License version 2, or at your option any later version. Please
+see the included License.txt for details.
+
+=cut
+
+
1;
Modified: trunk/scripts/taxform.pl
===================================================================
--- trunk/scripts/taxform.pl 2011-07-30 16:08:13 UTC (rev 3598)
+++ trunk/scripts/taxform.pl 2011-07-30 17:06:10 UTC (rev 3599)
@@ -75,7 +75,7 @@
=item add_taxform
-Display the "add taxform" view.
+Display the "add taxform" screen.
=back
@@ -97,6 +97,33 @@
$template->render($taxform);
}
+=item generate_report
+
+Generates the summary or detail report. Query inputs (required unless
+otherwise specified:
+
+=over
+
+=item begin
+Begin date
+
+=item end
+End date
+
+=item taxform_id
+ID of tax form
+
+=item meta_number (optional)
+Vendor or customer account number. If set, triggers detailed report instead
+of summary for all customers/vendors associated with the tax form.
+
+=back
+
+In the future the actual report routines will be wrapped in a taxform_report
+package.
+
+=cut
+
sub generate_report {
@@ -104,7 +131,7 @@
if (!$request->{format}){
$request->{format} = 'HTML';
}
-
+ # TODO: Eliminate duplicate code!
if ($request->{meta_number}) {
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},
@@ -168,6 +195,12 @@
$template->render($taxform);
}
+=item print
+
+Prints the tax forms, using the 1099 templates.
+
+=cut
+
sub print {
my ($request) = @_;
my $taxform = LedgerSMB::DBObject::TaxForm->new({base => $request});
@@ -177,7 +210,12 @@
generate_report($request);
}
+=item list_all
+Lists all tax forms.
+
+=cut
+
sub list_all {
my ($request) = @_;
@@ -219,7 +257,7 @@
});
}
-=head1 Copyright (C) 2007 The LedgerSMB Core Team
+=head1 Copyright (C) 2010 The LedgerSMB Core Team
Licensed under the GNU General Public License version 2 or later (at your
option). For more information please see the included LICENSE and COPYRIGHT
Modified: trunk/t/98-pod-coverage.t
===================================================================
--- trunk/t/98-pod-coverage.t 2011-07-30 16:08:13 UTC (rev 3598)
+++ trunk/t/98-pod-coverage.t 2011-07-30 17:06:10 UTC (rev 3599)
@@ -13,7 +13,7 @@
if ($@){
plan skip_all => "Test::Pod::Coverage required for testing POD coverage";
} else {
- plan tests => 27;
+ plan tests => 28;
}
pod_coverage_ok("LedgerSMB");
pod_coverage_ok("LedgerSMB::Form");
@@ -44,4 +44,5 @@
{also_private => [qr/^(format_ten_|num2text_)/]}
);
pod_coverage_ok("LedgerSMB::DBObject::Reconciliation");
+pod_coverage_ok("LedgerSMB::DBObject::TaxForm");
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.