[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
SF.net SVN: ledger-smb:[4592] trunk
- Subject: SF.net SVN: ledger-smb:[4592] trunk
- From: ..hidden..
- Date: Mon, 26 Mar 2012 11:02:59 +0000
Revision: 4592
http://ledger-smb.svn.sourceforge.net/ledger-smb/?rev=4592&view=rev
Author: einhverfr
Date: 2012-03-26 11:02:59 +0000 (Mon, 26 Mar 2012)
Log Message:
-----------
1.4 now has GL reports mostly functional and on new framework
Modified Paths:
--------------
trunk/LedgerSMB/DBObject/Report/GL.pm
trunk/LedgerSMB/DBObject/Report.pm
trunk/LedgerSMB/Scripts/journal.pm
trunk/UI/Reports/display_report.html
trunk/UI/journal/search.html
trunk/UI/lib/dynatable.html
trunk/sql/Pg-database.sql
trunk/sql/modules/Report.sql
Modified: trunk/LedgerSMB/DBObject/Report/GL.pm
===================================================================
--- trunk/LedgerSMB/DBObject/Report/GL.pm 2012-03-26 09:47:25 UTC (rev 4591)
+++ trunk/LedgerSMB/DBObject/Report/GL.pm 2012-03-26 11:02:59 UTC (rev 4592)
@@ -83,9 +83,15 @@
type => 'text',
pwidth => 1, },
+ {col_id => 'transdate',
+ name => $locale->text('Date'),
+ type => 'text',
+ pwidth => '3', },
+
{col_id => 'reference',
name => $locale->text('Reference'),
- type => 'text',
+ type => 'href',
+ href_base => '',
pwidth => '3', },
{col_id => 'description',
@@ -123,11 +129,6 @@
type => 'text',
pwidth => '1', },
- {col_id => 'transdate',
- name => $locale->text('Date'),
- type => 'text',
- pwidth => '3', },
-
{col_id => 'till',
name => $locale->text('Till'),
type => 'text',
@@ -310,7 +311,32 @@
sub run_report{
my ($self) = @_;
my @rows = $self->exec_method({funcname => 'report__gl'});
- # TODO: Convert to links and add href stuff.
+ for my $ref(@rows){
+ if ($ref->{amount} < 0){
+ $ref->{debits} = $ref->{amount} * -1;
+ $ref->{credits} = 0;
+ } else {
+ $ref->{credits} = $ref->{amount};
+ $ref->{debits} = 0;
+ }
+ if ($ref->{type} eq 'gl'){
+ $ref->{reference_href_suffix} = "gl.pl?action=edit&id=$ref->{id}";
+ } elsif ($ref->{type} eq 'ar'){
+ if ($ref->{invoice}){
+ $ref->{reference_href_suffix} = 'is.pl';
+ } else {
+ $ref->{reference_href_suffix} = 'ar.pl';
+ }
+ $ref->{reference_href_suffix} .= "?action=edit&id=$ref->{id}";
+ } elsif ($ref->{type} eq 'ap'){
+ if ($ref->{invoice}){
+ $ref->{reference_href_suffix} = 'ir.pl';
+ } else {
+ $ref->{reference_href_suffix} = 'ap.pl';
+ }
+ $ref->{reference_href_suffix} .= "?action=edit&id=$ref->{id}";
+ }
+ }
$self->rows(..hidden..);
}
Modified: trunk/LedgerSMB/DBObject/Report.pm
===================================================================
--- trunk/LedgerSMB/DBObject/Report.pm 2012-03-26 09:47:25 UTC (rev 4591)
+++ trunk/LedgerSMB/DBObject/Report.pm 2012-03-26 11:02:59 UTC (rev 4592)
@@ -139,9 +139,26 @@
format => uc($request->{format} || 'HTML'),
);
$template->render({report => $self, request => $request,
- columns => $self->columns, rows => $self->rows});
+ columns => $self->show_cols($request), rows => $self->rows});
}
+=item show_cols
+
+Returns a list of columns based on selected ones from the report
+
+=cut
+
+sub show_cols {
+ my ($self, $request) = @_;
+ my @retval;
+ for my $ref (@{$self->columns}){
+ if ($request->{"col_$ref->{col_id}"}){
+ push @retval, $ref;
+ }
+ }
+ return ..hidden..;
+}
+
=back
=head1 COPYRIGHT
Modified: trunk/LedgerSMB/Scripts/journal.pm
===================================================================
--- trunk/LedgerSMB/Scripts/journal.pm 2012-03-26 09:47:25 UTC (rev 4591)
+++ trunk/LedgerSMB/Scripts/journal.pm 2012-03-26 11:02:59 UTC (rev 4592)
@@ -83,9 +83,10 @@
sub search {
my ($request) = @_;
+ delete $request->{category} if ($request->{category} = 'X');
my $report = LedgerSMB::DBObject::Report::GL->new(%$request);
$report->run_report;
- $report->render;
+ $report->render($request);
}
=back
Modified: trunk/UI/Reports/display_report.html
===================================================================
--- trunk/UI/Reports/display_report.html 2012-03-26 09:47:25 UTC (rev 4591)
+++ trunk/UI/Reports/display_report.html 2012-03-26 11:02:59 UTC (rev 4592)
@@ -1,7 +1,7 @@
<?lsmb
PROCESS "ui-header.html"
- stylesheet = request.stylesheet;
+ stylesheet = USER.stylesheet;
PROCESS "elements.html";
@@ -12,7 +12,7 @@
?>
<body>
-<?lsmb PROCESS dynatable ?>
+<?lsmb PROCESS dynatable tbody = {rows => rows } ?>
<a href="<?lsmb LINK ?>">[<?lsmb text('permalink') ?>]</a>
<a href="<?lsmb LINK _ '&format=PDF' ?>">[<?lsmb text('PDF') ?>]</a>
Modified: trunk/UI/journal/search.html
===================================================================
--- trunk/UI/journal/search.html 2012-03-26 09:47:25 UTC (rev 4591)
+++ trunk/UI/journal/search.html 2012-03-26 11:02:59 UTC (rev 4592)
@@ -198,106 +198,109 @@
<table>
<tr>
<td nowrap><?lsmb PROCESS input element_data = {
- name="l_id"
+ name="col_id"
class="checkbox"
type="checkbox"
value="Y"
} ?> <?lsmb text('ID') ?></td>
<td nowrap><?lsmb PROCESS input element_data = {
- name="l_transdate"
+ name="col_transdate"
class="checkbox"
type="checkbox"
value="Y"
checked="checked"
} ?> <?lsmb text('Date') ?></td>
<td nowrap><?lsmb PROCESS input element_data = {
- name="l_reference"
+ name="col_reference"
class="checkbox"
type="checkbox"
value="Y"
checked="checked"
} ?> <?lsmb text('Reference') ?></td>
<td nowrap><?lsmb PROCESS input element_data = {
- name="l_description"
+ name="col_description"
class="checkbox"
type="checkbox"
value="Y"
checked="checked"
} ?> <?lsmb text('Description') ?></td>
- <td nowrap><?lsmb PROCESS input element_data = {
- name="l_notes"
- class="checkbox"
- type="checkbox"
- value="Y"
- } ?> <?lsmb text('Notes') ?></td>
</tr>
<tr>
<td nowrap><?lsmb PROCESS input element_data = {
- name="l_debit"
+ name="col_debits"
class="checkbox"
type="checkbox"
value="Y"
checked="checked"
} ?> <?lsmb text('Debit') ?></td>
<td nowrap><?lsmb PROCESS input element_data = {
- name="l_credit"
+ name="col_credits"
class="checkbox"
type="checkbox"
value="Y"
checked="checked"
} ?> <?lsmb text('Credit') ?></td>
<td nowrap><?lsmb PROCESS input element_data = {
- name="l_source"
+ name="col_source"
class="checkbox"
type="checkbox"
value="Y"
checked="checked"
} ?> <?lsmb text('Source') ?></td>
<td nowrap><?lsmb PROCESS input element_data = {
- name="l_memo"
+ name="col_memo"
class="checkbox"
type="checkbox"
value="Y"
} ?> <?lsmb text('Memo') ?></td>
<td nowrap><?lsmb PROCESS input element_data = {
- name="l_accno"
+ name="col_cleared"
class="checkbox"
type="checkbox"
+ value="Y"
+ } ?> <?lsmb text('Cleared') ?></td>
+ </tr>
+ <tr>
+ <td nowrap><?lsmb PROCESS input element_data = {
+ name="col_till"
+ class="checkbox"
+ type="checkbox"
value="Y"
+ } ?> <?lsmb text('Till') ?></td>
+ <td nowrap><?lsmb PROCESS input element_data = {
+ name="col_accno"
+ class="checkbox"
+ type="checkbox"
+ value="Y"
checked="checked"
} ?> <?lsmb text('Account') ?></td>
- </tr>
- <tr>
+ <td nowrap><?lsmb PROCESS input element_data = {
+ name="col_gifi_accno"
+ class="checkbox"
+ type="checkbox"
+ value="Y"
+ } ?> <?lsmb text('GIFI') ?></td>
+ <td nowrap><?lsmb PROCESS input element_data = {
+ name="col_accname"
+ class="checkbox"
+ type="checkbox"
+ value="Y"
+ } ?> <?lsmb text('Account Name') ?></td>
<td nowrap><?lsmb PROCESS input element_data = {
- name="l_subtotal"
+ name="col_balance"
class="checkbox"
type="checkbox"
- value="Y"
- } ?> <?lsmb text('Subtotal') ?></td>
- <td nowrap><?lsmb PROCESS input element_data = {
- name="l_balance"
- class="checkbox"
- type="checkbox"
value="Y"
} ?> <?lsmb text('Balance') ?></td>
- <td nowrap><?lsmb PROCESS input element_data = {
- name="l_gifi_accno"
- class="checkbox"
- type="checkbox"
- value="Y"
- } ?> <?lsmb text('GIFI') ?></td>
- <?lsmb IF all_departments.length -?>
+ </tr>
+ <tr>
<td nowrap><?lsmb PROCESS input element_data = {
- name="l_department"
+ name="show_subtotal"
class="checkbox"
type="checkbox"
- value="Y"
- } ?> <?lsmb text('Department') ?></td>
- <?lsmb ELSE ?>
- <td nowrap></td>
- <?lsmb END # IF ?>
- <td nowrap></td>
+ value="Y"
+ } ?> <?lsmb text('Subtotal') ?></td>
</tr>
</table>
</tr>
Modified: trunk/UI/lib/dynatable.html
===================================================================
--- trunk/UI/lib/dynatable.html 2012-03-26 09:47:25 UTC (rev 4591)
+++ trunk/UI/lib/dynatable.html 2012-03-26 11:02:59 UTC (rev 4592)
@@ -57,7 +57,7 @@
<?lsmb CHECKED ?> />
<?lsmb- ELSIF COL.type == 'href';
HREF_SFX = COL.col_id _ "_href_suffix";
- IF row.$HREF_SFX;
+ IF ROW.$HREF_SFX;
HREF = COL.href_base _ ROW.$HREF_SFX;
ELSE;
HREF = COL.href_base _ ROW.row_id;
Modified: trunk/sql/Pg-database.sql
===================================================================
--- trunk/sql/Pg-database.sql 2012-03-26 09:47:25 UTC (rev 4591)
+++ trunk/sql/Pg-database.sql 2012-03-26 11:02:59 UTC (rev 4592)
@@ -2938,8 +2938,8 @@
75 pos_adjust 1 176
75 reference Adjusting Till: (Till) Source: (Source) 177
75 descripton Adjusting till due to data entry error 178
-76 module gl.pl 180
-76 action search 181
+76 module journal.pl 180
+76 action begin_search 181
77 menu 1 182
78 module ic.pl 183
78 action add 184
Modified: trunk/sql/modules/Report.sql
===================================================================
--- trunk/sql/modules/Report.sql 2012-03-26 09:47:25 UTC (rev 4591)
+++ trunk/sql/modules/Report.sql 2012-03-26 11:02:59 UTC (rev 4592)
@@ -247,13 +247,14 @@
AND (ac.source ilike '%' || in_source || '%'
OR in_source is null)
AND (ac.memo ilike '%' || in_memo || '%' OR in_memo is null)
- AND (in_description IS NULL OR
+ AND (in_description IS NULL OR
to_tsvector(get_default_lang()::name, g.description)
@@
plainto_tsquery(get_default_lang()::name, in_description))
AND (transdate BETWEEN in_date_from AND in_date_to
OR (transdate >= in_date_from AND in_date_to IS NULL)
- OR (transdate <= in_date_to AND in_date_from IS NULL))
+ OR (transdate <= in_date_to AND in_date_from IS NULL)
+ OR (in_date_to IS NULL AND in_date_from IS NULL))
AND (in_approved is false OR (g.approved AND ac.approved))
AND (in_amount_from IS NULL OR ac.amount >= in_amount_from)
AND (in_amount_to IS NULL OR ac.amount <= in_amount_to)
@@ -262,7 +263,7 @@
ac.source, ac.amount, c.accno, c.gifi_accno,
g.till, ac.cleared, ac.memo, c.description,
ac.chart_id, ac.entry_id, ac.trans_id
- HAVING in_business_units
+ HAVING in_business_units is null or in_business_units
<@ compound_array(string_to_array(bu_tree.path, ',')::int[])
ORDER BY ac.transdate, ac.trans_id, c.accno
LOOP
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.