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

SF.net SVN: ledger-smb:[4735] trunk



Revision: 4735
          http://ledger-smb.svn.sourceforge.net/ledger-smb/?rev=4735&view=rev
Author:   einhverfr
Date:     2012-05-20 08:55:43 +0000 (Sun, 20 May 2012)
Log Message:
-----------
GL Report now can be run for any business unit or intersection thereof

Modified Paths:
--------------
    trunk/LedgerSMB/DBObject/Business_Unit_Class.pm
    trunk/LedgerSMB/DBObject/Report/GL.pm
    trunk/LedgerSMB/DBObject/Report/co/Balance_y_Mayor.pm
    trunk/LedgerSMB/DBObject/Report/co/Caja_Diaria.pm
    trunk/LedgerSMB/DBObject/Report.pm
    trunk/LedgerSMB/Scripts/journal.pm
    trunk/UI/journal/search.html
    trunk/sql/Pg-database.sql

Modified: trunk/LedgerSMB/DBObject/Business_Unit_Class.pm
===================================================================
--- trunk/LedgerSMB/DBObject/Business_Unit_Class.pm	2012-05-20 07:08:06 UTC (rev 4734)
+++ trunk/LedgerSMB/DBObject/Business_Unit_Class.pm	2012-05-20 08:55:43 UTC (rev 4735)
@@ -131,15 +131,17 @@
     );
 }
 
-=item list
+=item list(bool $active, string $mod_name)
 
 Returns a list of all business unit classes.
 
 =cut
 
 sub list {
-    my ($self) = @_;
-    my @classes = $self->exec_method({funcname => 'business_unit__list_classes'});
+    my ($self, $active, $mod_name) = @_;
+    my @classes = $self->call_procedure(
+            procname => 'business_unit__list_classes',
+                args => [$active, $mod_name]);
     for my $class (@classes){
         $self->prepare_dbhash($class);
         $class = $self->new(%$class);

Modified: trunk/LedgerSMB/DBObject/Report/GL.pm
===================================================================
--- trunk/LedgerSMB/DBObject/Report/GL.pm	2012-05-20 07:08:06 UTC (rev 4734)
+++ trunk/LedgerSMB/DBObject/Report/GL.pm	2012-05-20 08:55:43 UTC (rev 4735)
@@ -384,4 +384,5 @@
 
 =cut
 
+__PACKAGE__->meta->make_immutable;
 return 1;

Modified: trunk/LedgerSMB/DBObject/Report/co/Balance_y_Mayor.pm
===================================================================
--- trunk/LedgerSMB/DBObject/Report/co/Balance_y_Mayor.pm	2012-05-20 07:08:06 UTC (rev 4734)
+++ trunk/LedgerSMB/DBObject/Report/co/Balance_y_Mayor.pm	2012-05-20 08:55:43 UTC (rev 4735)
@@ -191,4 +191,5 @@
 
 =cut
 
+__PACKAGE__->meta->make_immutable;
 return 1;

Modified: trunk/LedgerSMB/DBObject/Report/co/Caja_Diaria.pm
===================================================================
--- trunk/LedgerSMB/DBObject/Report/co/Caja_Diaria.pm	2012-05-20 07:08:06 UTC (rev 4734)
+++ trunk/LedgerSMB/DBObject/Report/co/Caja_Diaria.pm	2012-05-20 08:55:43 UTC (rev 4735)
@@ -209,4 +209,5 @@
 
 =cut
 
+__PACKAGE__->meta->make_immutable;
 return 1;

Modified: trunk/LedgerSMB/DBObject/Report.pm
===================================================================
--- trunk/LedgerSMB/DBObject/Report.pm	2012-05-20 07:08:06 UTC (rev 4734)
+++ trunk/LedgerSMB/DBObject/Report.pm	2012-05-20 08:55:43 UTC (rev 4735)
@@ -173,4 +173,5 @@
 
 =cut
 
+__PACKAGE__->meta->make_immutable;
 return 1;

Modified: trunk/LedgerSMB/Scripts/journal.pm
===================================================================
--- trunk/LedgerSMB/Scripts/journal.pm	2012-05-20 07:08:06 UTC (rev 4734)
+++ trunk/LedgerSMB/Scripts/journal.pm	2012-05-20 08:55:43 UTC (rev 4735)
@@ -19,6 +19,7 @@
 
 use LedgerSMB;
 use LedgerSMB::Template;
+use LedgerSMB::DBObject::Business_Unit;
 use LedgerSMB::DBObject::Report::GL;
 use strict;
 
@@ -65,6 +66,18 @@
 
 sub start_search {
     my ($request) = @_;
+    $request->{class_id} = 0;
+    $request->{control_code} = '';
+    my $buc = LedgerSMB::DBObject::Business_Unit_Class->new(%$request);
+    my $bu = LedgerSMB::DBObject::Business_Unit->new(%$request);
+    @{$request->{bu_classes}} = $buc->list(1, 'gl');
+    for my $bc (@{$request->{bu_classes}}){
+        @{$request->{b_units}->{$bc->{id}}}
+            = $bu->list($bc->{id}, undef, 0, undef);
+        for my $bu (@{$request->{b_units}->{$bc->{id}}}){
+            $bu->{text} = $bu->control_code . ' -- '. $bu->description;
+        }
+    } 
     my $template = LedgerSMB::Template->new(
         user => $request->{_user},
         locale => $request->{_locale},
@@ -84,6 +97,11 @@
 sub search {
     my ($request) = @_;
     delete $request->{category} if ($request->{category} = 'X');
+    $request->{business_units} = [];
+    for my $count (1 .. $request->{bc_count}){
+         push @{$request->{business_units}}, $request->{"business_unit_$count"}
+               if $request->{"business_unit_$count"};
+    }
     LedgerSMB::DBObject::Report::GL->prepare_criteria($request);
     my $report = LedgerSMB::DBObject::Report::GL->new(%$request);
     $report->run_report;

Modified: trunk/UI/journal/search.html
===================================================================
--- trunk/UI/journal/search.html	2012-05-20 07:08:06 UTC (rev 4734)
+++ trunk/UI/journal/search.html	2012-05-20 08:55:43 UTC (rev 4735)
@@ -68,17 +68,24 @@
                               size='60'
                               type='text' } ?></td>
 	</tr>
-        <?lsmb IF all_departments.size -?>
+        <?lsmb FOREACH BUC IN bu_classes ?>
         <tr>
-          <th align="right"><?lsmb text('Department') ?></th>
-          <td colspan="5"><?lsmb PROCESS select element_data = {
-                                 name = 'department'
-                                 options = all_departments
-                                 value_attr = 'id'
-                                 text_attr = 'description'
-                              } ?></td>
+          <th align="right"><?lsmb text(BUC.label) ?></th>
+          <?lsmb b_units.${BUC.id}.unshift({}) ?>
+          <td><?lsmb PROCESS select element_data = {
+                   name = 'business_unit_' _ loop.count
+                options = b_units.${BUC.id}
+              text_attr = 'text'
+             value_attr = 'id'
+                  class = 'business_unit'
+              } ?></td>
         </tr>
-        <?lsmb END -?>
+        <?lsmb END; # FOREACH BUC
+        PROCESS input element_data = {
+             type = 'hidden'
+             name = 'bc_count'
+             value = bu_classes.size
+        } ?>
 	<tr>
 
 	  <th align="right"><?lsmb text('From') ?></th>

Modified: trunk/sql/Pg-database.sql
===================================================================
--- trunk/sql/Pg-database.sql	2012-05-20 07:08:06 UTC (rev 4734)
+++ trunk/sql/Pg-database.sql	2012-05-20 08:55:43 UTC (rev 4735)
@@ -2941,7 +2941,7 @@
 75	reference	Adjusting Till: (Till)  Source: (Source)	177
 75	descripton	Adjusting till due to data entry error	178
 76	module	journal.pl	180
-76	action	begin_search	181
+76	action	start_search	181
 77	menu	1	182
 78	module	ic.pl	183
 78	action	add	184

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