[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
SF.net SVN: ledger-smb:[3131] trunk
- Subject: SF.net SVN: ledger-smb:[3131] trunk
- From: ..hidden..
- Date: Mon, 11 Apr 2011 19:53:51 +0000
Revision: 3131
http://ledger-smb.svn.sourceforge.net/ledger-smb/?rev=3131&view=rev
Author: einhverfr
Date: 2011-04-11 19:53:50 +0000 (Mon, 11 Apr 2011)
Log Message:
-----------
1099 printing fixes
also includes project numbers on AR/AP transaction report
Modified Paths:
--------------
trunk/LedgerSMB/AA.pm
trunk/LedgerSMB/DBObject/TaxForm.pm
trunk/LedgerSMB/Form.pm
trunk/UI/taxform/add_taxform.html
trunk/UI/taxform/details_report.html
trunk/UI/taxform/summary_report.html
trunk/bin/aa.pl
trunk/bin/arap.pl
trunk/scripts/taxform.pl
trunk/sql/Pg-database.sql
trunk/sql/modules/TaxForm.sql
Modified: trunk/LedgerSMB/AA.pm
===================================================================
--- trunk/LedgerSMB/AA.pm 2011-03-25 13:10:25 UTC (rev 3130)
+++ trunk/LedgerSMB/AA.pm 2011-04-11 19:53:50 UTC (rev 3131)
@@ -798,14 +798,15 @@
if ( !$form->{summary} and !$form->{outstanding} ) {
$acc_trans_flds = qq|
, c.accno, ac.source,
- pr.projectnumber, ac.memo AS description,
+ p.projectnumber, ac.memo AS description,
ac.amount AS linetotal,
i.description AS linedescription|;
+ $group_by_fields = qq|, c.accno, ac.source, p.projectnumber, ac.memo,
+ ac.amount, i.description |;
$acc_trans_join = qq|
JOIN acc_trans ac ON (a.id = ac.trans_id)
JOIN chart c ON (c.id = ac.chart_id)
- LEFT JOIN project pr ON (pr.id = ac.project_id)
LEFT JOIN invoice i ON (i.id = ac.invoice_id)|;
}
my $query;
@@ -891,9 +892,13 @@
vc.entity_id, a.till, me.name AS manager, a.curr,
ex.$buysell AS exchangerate,
d.description AS department,
- a.ponumber $acc_trans_flds
+ a.ponumber, as_array(p.projectnumber) as ac_projects,
+ as_array(ip.projectnumber) as inv_projects
+ $acc_trans_flds
FROM $table a
JOIN entity_credit_account vc ON (a.entity_credit_account = vc.id)
+ JOIN acc_trans ac ON (a.id = ac.trans_id)
+ JOIN chart c ON (c.id = ac.chart_id)
LEFT JOIN employee e ON (a.person_id = e.entity_id)
LEFT JOIN employee m ON (e.manager_id = m.entity_id)
LEFT JOIN entity ee ON (e.entity_id = ee.id)
@@ -902,7 +907,18 @@
LEFT JOIN exchangerate ex ON (ex.curr = a.curr
AND ex.transdate = a.transdate)
LEFT JOIN department d ON (a.department_id = d.id)
- $acc_trans_join|;
+ LEFT JOIN invoice i ON (i.trans_id = a.id)
+ LEFT JOIN project ip ON (i.project_id = ip.id)
+ LEFT JOIN project p ON ac.project_id = p.id |;
+ $group_by = qq|
+ GROUP BY a.id, a.invnumber, a.ordnumber, a.transdate,
+ a.duedate, a.netamount, a.amount,
+ a.invoice, a.datepaid, a.terms, a.notes,
+ a.shipvia, a.shippingpoint, ee.name ,
+ vce.name, vc.meta_number, ($paid),
+ vc.entity_id, a.till, me.name, a.curr,
+ ex.$buysell, a.ponumber,
+ d.description $group_by_fields|;
}
my %ordinal = (
@@ -1076,6 +1092,7 @@
$query .= "\n ORDER BY $sortorder";
} else {
$query .= "WHERE ($approved OR a.approved) AND $where
+ $group_by
ORDER BY $sortorder";
}
my $sth = $dbh->prepare($query);
Modified: trunk/LedgerSMB/DBObject/TaxForm.pm
===================================================================
--- trunk/LedgerSMB/DBObject/TaxForm.pm 2011-03-25 13:10:25 UTC (rev 3130)
+++ trunk/LedgerSMB/DBObject/TaxForm.pm 2011-04-11 19:53:50 UTC (rev 3131)
@@ -15,7 +15,16 @@
$self->{dbh}->commit();
}
+sub get
+{
+ my ($self, $id) = @_;
+ my @results = $self->exec_method(
+ funcname => 'tax_form__get', args => [$id]
+ );
+ return $results[0];
+}
+
sub get_forms
{
my ($self) = @_;
Modified: trunk/LedgerSMB/Form.pm
===================================================================
--- trunk/LedgerSMB/Form.pm 2011-03-25 13:10:25 UTC (rev 3130)
+++ trunk/LedgerSMB/Form.pm 2011-04-11 19:53:50 UTC (rev 3131)
@@ -1813,10 +1813,12 @@
# Vendor and Customer are now views into entity_credit_account.
my $query = qq/
- SELECT c.*, e.name, e.control_code FROM entity_credit_account c
- JOIN entity e ON (c.entity_id = e.id)
- WHERE (lower(e.name) LIKE ?
- OR c.meta_number ILIKE ?)
+ SELECT c.*, e.name, e.control_code, ctf.default_reportable
+ FROM entity_credit_account c
+ JOIN entity e ON (c.entity_id = e.id)
+ LEFT JOIN country_tax_form ctf ON (c.taxform_id = ctf.id)
+ WHERE (lower(e.name) LIKE ?
+ OR c.meta_number ILIKE ?)
$where
ORDER BY e.name/;
@@ -2395,7 +2397,7 @@
a.amount AS oldinvtotal, a.paid AS oldtotalpaid,
a.person_id, e.name AS employee,
c.language_code, a.ponumber, a.reverse,
- a.approved
+ a.approved, ctf.default_reportable
FROM $arap a
JOIN entity_credit_account c
ON (a.entity_credit_account = c.id)
@@ -2403,6 +2405,8 @@
LEFT JOIN employee er ON (er.entity_id = a.person_id)
LEFT JOIN entity e ON (er.entity_id = e.id)
LEFT JOIN department d ON (d.id = a.department_id)
+ LEFT JOIN country_tax_form ctf
+ ON (ctf.id = c.taxform_id)
WHERE a.id = ? AND c.entity_class =
(select id FROM entity_class
WHERE class ilike ?)|;
Modified: trunk/UI/taxform/add_taxform.html
===================================================================
--- trunk/UI/taxform/add_taxform.html 2011-03-25 13:10:25 UTC (rev 3130)
+++ trunk/UI/taxform/add_taxform.html 2011-04-11 19:53:50 UTC (rev 3131)
@@ -40,6 +40,18 @@
?>
</div>
+<div class="labelledinput">
+
+ <?lsmb PROCESS input element_data = {
+ name = "default_reportable"
+ type = "checkbox"
+ value = "1"
+ label = text("Select by Default:") #"
+ checked = CHECKED
+ }
+ ?>
+</div>
+
<div id="buttons">
<?lsmb INCLUDE button element_data = {
Modified: trunk/UI/taxform/details_report.html
===================================================================
--- trunk/UI/taxform/details_report.html 2011-03-25 13:10:25 UTC (rev 3130)
+++ trunk/UI/taxform/details_report.html 2011-04-11 19:53:50 UTC (rev 3131)
@@ -1,3 +1,7 @@
+<?lsmb INCLUDE 'ui-header.html'
+ include_script = ["UI/ajax/scriptaculous/lib/prototype.js","UI/ajax/scriptaculous/src/scriptaculous.js?load=builder,effects,dragdrop,controls","UI/ajax/helpers.js"]
+?>
+<?lsmb PROCESS 'elements.html' ?>
<!--
* Occurs from filter_screen if vendor meta_number added, or from summary report of total amount is clicked
* vendor.meta_number (click through to edit vendor)
@@ -7,10 +11,6 @@
* sum of invoice reportable entries
* total of sums above
-->
-<?lsmb INCLUDE 'ui-header.html'
- include_script = ["UI/ajax/scriptaculous/lib/prototype.js","UI/ajax/scriptaculous/src/scriptaculous.js?load=builder,effects,dragdrop,controls","UI/ajax/helpers.js"]
-?>
-<?lsmb PROCESS 'elements.html' ?>
<body>
<table width="100%">
@@ -36,6 +36,20 @@
</tr>
<?lsmb END ?>
</table>
-
+<form action="taxform.pl" method="POST">
+<?lsmb INCLUDE "taxform/report_hiddens.html" ?>
+<?lsmb PROCESS input element_data = {
+ name="print_all"
+ type="hidden"
+ value="0"
+} ?>
+<?lsmb PROCESS button = element_data {
+ name="action"
+ text="Print"
+ value="print"
+ class="submit"
+ type="submit"
+} ?>
+</form>
</body>
</html>
Modified: trunk/UI/taxform/summary_report.html
===================================================================
--- trunk/UI/taxform/summary_report.html 2011-03-25 13:10:25 UTC (rev 3130)
+++ trunk/UI/taxform/summary_report.html 2011-04-11 19:53:50 UTC (rev 3131)
@@ -1,3 +1,7 @@
+<?lsmb INCLUDE 'ui-header.html'
+ include_script = ["UI/ajax/scriptaculous/lib/prototype.js","UI/ajax/scriptaculous/src/scriptaculous.js?load=builder,effects,dragdrop,controls","UI/ajax/helpers.js"]
+?>
+<?lsmb PROCESS 'elements.html' ?>
<!--
* Occurs from filter screen if no vendor meta_number added
* vendor company.legal_name
@@ -7,10 +11,6 @@
* sum of invoice reportable entries
* total of sums above (click through to details report)
-->
-<?lsmb INCLUDE 'ui-header.html'
- include_script = ["UI/ajax/scriptaculous/lib/prototype.js","UI/ajax/scriptaculous/src/scriptaculous.js?load=builder,effects,dragdrop,controls","UI/ajax/helpers.js"]
-?>
-<?lsmb PROCESS 'elements.html' ?>
<body>
<table width="100%">
@@ -34,6 +34,20 @@
</tr>
<?lsmb END ?>
</table>
-
+<form action="taxform.pl" method="POST">
+<?lsmb INCLUDE "taxform/report_hiddens.html" ?>
+<?lsmb PROCESS input element_data = {
+ name="print_all"
+ type="hidden"
+ value="1"
+} ?>
+<?lsmb PROCESS button element_data {
+ name="action"
+ text="Print"
+ value="print"
+ class="submit"
+ type="submit"
+} ?>
+</form>
</body>
</html>
Modified: trunk/bin/aa.pl
===================================================================
--- trunk/bin/aa.pl 2011-03-25 13:10:25 UTC (rev 3130)
+++ trunk/bin/aa.pl 2011-04-11 19:53:50 UTC (rev 3131)
@@ -573,7 +573,7 @@
$form->hide_form(
qw(batch_id approved id printed emailed sort closedto locked
oldtransdate audittrail recurring checktax reverse batch_id subtype
- entity_control_code meta_number)
+ entity_control_code meta_number default_reportable)
);
if ( $form->{vc} eq 'customer' ) {
@@ -746,9 +746,9 @@
}
$taxchecked="";
- if($form->{"taxformcheck_$i"})
+ if($form->{"taxformcheck_$i"} or ($form->{default_reportable} and ($i == $form->{rowcount})))
{
- $taxchecked="checked";
+ $taxchecked=qq|CHECKED="CHECKED"|;
}
@@ -1572,9 +1572,11 @@
. $locale->text('Order Number');
push @a, qq|<input name="l_ponumber" class=checkbox type=checkbox value=Y> |
. $locale->text('PO Number');
+ push @a, qq|<input name="l_transdate" class=checkbox type=checkbox value=Y checked> |
+ . $locale->text('Invoice Date');
push @a,
-qq|<input name="l_transdate" class=checkbox type=checkbox value=Y checked> |
- . $locale->text('Invoice Date');
+qq|<input name="l_projectnumber" class=checkbox type=checkbox value=Y checked> |
+ . $locale->text('Project Numbers');
push @a, $l_name;
push @a, $l_employee if $l_employee;
push @a, $l_manager if $l_employee;
@@ -1896,6 +1898,8 @@
{
push @column_index, $item;
}
+ } elsif ($form->{l_projectnumber} eq 'Y'){
+ push @column_index, 'projectnumber';
}
if ( $form->{l_subtotal} eq 'Y' ) {
@@ -2056,7 +2060,13 @@
foreach $ref ( @{ $form->{transactions} } ) {
$i++;
-
+ if ($form->{l_projectnumber} eq 'Y' and ref($ref->{ac_projects}) eq 'ARRAY' and ref($ref->{inv_projects}) eq 'ARRAY'){
+ my @projects;
+ push @projects, @{$ref->{ac_projects}};
+ push @projects, @{$ref->{inv_projects}};
+ $ref->{projectnumber} = join '<br />', @projects;
+ $ref->{projectnumber} =~ s/(<br \/>)+/<br \/>/;
+ } else { $form->error($ref->{ac_projects} . $ref->{inv_projects})}
if ( $form->{l_subtotal} eq 'Y' ) {
if ( $sameitem ne $ref->{ $form->{sort} } ) {
&subtotal;
Modified: trunk/bin/arap.pl
===================================================================
--- trunk/bin/arap.pl 2011-03-25 13:10:25 UTC (rev 3130)
+++ trunk/bin/arap.pl 2011-04-11 19:53:50 UTC (rev 3131)
@@ -117,6 +117,7 @@
# we got one name
$form->{"${name}_id"} = $form->{name_list}[0]->{id};
+ $form->{default_reportable}= $form->{name_list}[0]->{default_reportable};
$form->{$name} = $form->{name_list}[0]->{name};
$form->{"old$name"} = qq|$form->{$name}--$form->{"${name}_id"}|;
Modified: trunk/scripts/taxform.pl
===================================================================
--- trunk/scripts/taxform.pl 2011-03-25 13:10:25 UTC (rev 3130)
+++ trunk/scripts/taxform.pl 2011-04-11 19:53:50 UTC (rev 3131)
@@ -101,6 +101,9 @@
my ($request) = @_;
+ if (!$request->{format}){
+ $request->{format} = 'HTML';
+ }
if ($request->{meta_number}) {
my @call_args = ($request->{'tax_form_id'},
@@ -121,7 +124,7 @@
locale => $request->{_locale},
path => 'UI',
template => 'taxform/details_report',
- format => 'HTML'
+ format => $request->{format},
);
$template->render($request);
}
@@ -142,7 +145,7 @@
locale => $request->{_locale},
path => 'UI',
template => 'taxform/summary_report',
- format => 'HTML'
+ format => $request->{format},
);
$template->render($request);
}
@@ -165,6 +168,15 @@
$template->render($taxform);
}
+sub print {
+ my ($request) = @_;
+ my $taxform = LedgerSMB::DBObject::TaxForm->new({base => $request});
+ my $form_info = $taxform->get($request->{tax_form_id});
+ $request->{taxform_name} = $form_info->{description};
+ $request->{format} = 'PDF';
+ generate_report($request);
+}
+
=head1 Copyright (C) 2007 The LedgerSMB Core Team
Licensed under the GNU General Public License version 2 or later (at your
Modified: trunk/sql/Pg-database.sql
===================================================================
--- trunk/sql/Pg-database.sql 2011-03-25 13:10:25 UTC (rev 3130)
+++ trunk/sql/Pg-database.sql 2011-04-11 19:53:50 UTC (rev 3131)
@@ -360,6 +360,7 @@
create table country_tax_form ( country_id int references country(id) not null,
form_name text not null,
id serial not null unique,
+ default_reportable bool not null default false,
primary key(country_id, form_name)
);
Modified: trunk/sql/modules/TaxForm.sql
===================================================================
--- trunk/sql/modules/TaxForm.sql 2011-03-25 13:10:25 UTC (rev 3130)
+++ trunk/sql/modules/TaxForm.sql 2011-04-11 19:53:50 UTC (rev 3131)
@@ -1,10 +1,16 @@
-CREATE OR REPLACE FUNCTION tax_form__save(in_country_id int, in_form_name text)
+CREATE OR REPLACE FUNCTION tax_form__save(in_country_id int, in_form_name text, in_default_reportable bool)
RETURNS int AS
$$
BEGIN
- insert into country_tax_form(country_id,form_name)
- values (in_country_id, in_form_name);
+ insert into country_tax_form(country_id,form_name, default_reportable)
+ values (in_country_id, in_form_name, in_default_reportable);
RETURN currval('country_tax_form_id_seq');
END;
$$ LANGUAGE PLPGSQL;
+
+CREATE OR REPLACE FUNCTION tax_form__get(in_form_id int)
+returns country_tax_form
+as $$
+SELECT * FROM country_tax_form where id = $1;
+$$ language sql;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.