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

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



Revision: 4414
          http://ledger-smb.svn.sourceforge.net/ledger-smb/?rev=4414&view=rev
Author:   einhverfr
Date:     2012-03-08 13:43:02 +0000 (Thu, 08 Mar 2012)
Log Message:
-----------
Business units now display on journal entry properly.  They do not save and are not retrieved yet properly though

Modified Paths:
--------------
    trunk/LedgerSMB/GL.pm
    trunk/UI/journal/journal_entry.html
    trunk/bin/aa.pl
    trunk/bin/gl.pl

Modified: trunk/LedgerSMB/GL.pm
===================================================================
--- trunk/LedgerSMB/GL.pm	2012-03-08 10:56:18 UTC (rev 4413)
+++ trunk/LedgerSMB/GL.pm	2012-03-08 13:43:02 UTC (rev 4414)
@@ -731,18 +731,6 @@
     $sth->finish;
    
     
-    # get departments
-  
-    $form->all_departments( $myconfig, $dbh );
-
-    if ( @{ $form->{all_department} } ) {
-        $form->{departmentset} = 1;
-        for ( @{ $form->{all_department} } ) {
-            $_->{departmentstyle}=$_->{description}."--".$_->{id};
-        }
-    }
-
-
     # get projects
     $form->all_business_units( $form->{transdate} );
 

Modified: trunk/UI/journal/journal_entry.html
===================================================================
--- trunk/UI/journal/journal_entry.html	2012-03-08 10:56:18 UTC (rev 4413)
+++ trunk/UI/journal/journal_entry.html	2012-03-08 13:43:02 UTC (rev 4414)
@@ -133,6 +133,11 @@
 	  <?lsmb IF form.projectset == 1 ?>
 	  <th class="listheading"><?lsmb text('Project') ?></th>
 	  <?lsmb END ?>
+          <?lsmb FOREACH cls IN form.bu_class ?>
+              <?lsmb IF form.b_units.${cls.id} ?>
+          <th><?lsmb text(cls.label) ?></th>
+               <?lsmb END ?>
+          <?lsmb END ?>
 	</tr>
 	<?lsmb FOREACH displayrow IN displayrows ?> 
 	<tr>
@@ -255,6 +260,24 @@
 			<?lsmb END ?>
 
 		   </td>
+                       <?lsmb END ?>
+                   <?lsmb FOREACH cls IN form.bu_class ?>
+                      <?lsmb IF form.b_units.${cls.id} ?>
+                   <td>
+                       
+                       <?lsmb clsid = cls.id;
+                              bucid = "b_unit_$clsid";
+                              burow = "${bucid}_$INDEX";
+                       form.b_units.${clsid}.unshift({});
+                       INCLUDE select element_data = {
+                              text_attr = "control_code"
+                             value_attr = "id"
+                         default_values = [displayrow.${bucid}]
+                                   name = "$burow"
+                                options = form.b_units.${clsid}
+                       } ?>
+                   </td>
+                   <?lsmb END ?>
 		  <?lsmb END ?>
 
         </tr>

Modified: trunk/bin/aa.pl
===================================================================
--- trunk/bin/aa.pl	2012-03-08 10:56:18 UTC (rev 4413)
+++ trunk/bin/aa.pl	2012-03-08 13:43:02 UTC (rev 4414)
@@ -421,7 +421,9 @@
 sub form_header {
 
     $title = $form->{title};
-    $form->all_business_units($transdate, $form->{"$form->{vc}_id"}, $form->{ARAP});
+    $form->all_business_units($form->{transdate}, 
+                              $form->{"$form->{vc}_id"}, 
+                              $form->{ARAP});
 
     if($form->{batch_id})
     {

Modified: trunk/bin/gl.pl
===================================================================
--- trunk/bin/gl.pl	2012-03-08 10:56:18 UTC (rev 4413)
+++ trunk/bin/gl.pl	2012-03-08 13:43:02 UTC (rev 4414)
@@ -177,6 +177,7 @@
 sub display_form
 {
     #Add General Ledger Transaction
+    $form->all_business_units($form->{transdate}, undef, 'GL');
     $form->close_form;
     $form->open_form; 
     $form->{dbh}->commit;
@@ -403,8 +404,11 @@
 
 			      $temphash1->{debit}=$form->{"debit_$i"};
 			      $temphash1->{credit}=$form->{"credit_$i"};
+                              for my $cls(@{$form->{bu_class}}){
+                                  $temphash1->{"b_unit_$cls->{id}"} =
+                                         $form->{"b_unit_$cls->{id}_$i"};
+                              } 
 
-
 			      if ( $i < $form->{rowcount} )
 			      {					      
 						    $temphash1->{accno}=$form->{"accno_$i"};
@@ -438,7 +442,7 @@
 			      }
 
          }
-  
+ 
          push @displayrows,$temphash1;
 
  } 
@@ -457,7 +461,7 @@
 
     $colspan = 5;
 
-    $form->all_departments( \%myconfig );
+    #$form->all_departments( \%myconfig );
 
     # departments
     if ( @{ $form->{all_department} } ) {
@@ -1051,12 +1055,19 @@
 
      if ( $form->{transdate} ne $form->{oldtransdate} ) {
          $form->{oldtransdate} = $form->{transdate};
-     }
+     } 
 
+    $form->all_business_units($form->{transdate}, undef, 'GL');
     GL->get_all_acc_dep_pro( \%myconfig, \%$form );
+
     @a     = ();
     $count = 0;
     @flds  = qw(accno debit credit projectnumber fx_transaction source memo);
+    for my $cls (@{$form->{bu_class}}){
+        if (scalar @{$form->{b_units}->{$cls->{id}}}){
+           push @flds, "b_unit_$cls->{id}";
+        }
+    }
 
     for $i ( 0 .. $form->{rowcount} ) {
         unless ( ( $form->{"debit_$i"} eq "" )
@@ -1087,7 +1098,7 @@
             $count++;
         }
     }
-
+    
     for $i ( 1 .. $count ) {
         $j = $i - 1;
         for (@flds) { $form->{"${_}_$j"} = $a[$j]->{$_} }
@@ -1096,7 +1107,6 @@
     for $i ( $count  .. $form->{rowcount} ) {
         for (@flds) { delete $form->{"${_}_$i"} }
     }
-
     $form->{rowcount} = $count;
  
     

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