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

SF.net SVN: ledger-smb:[4416] trunk/bin/io.pl



Revision: 4416
          http://ledger-smb.svn.sourceforge.net/ledger-smb/?rev=4416&view=rev
Author:   einhverfr
Date:     2012-03-08 15:14:43 +0000 (Thu, 08 Mar 2012)
Log Message:
-----------
business reporting units now show up on invoices, orders, etc. but are not saved.

Modified Paths:
--------------
    trunk/bin/io.pl

Modified: trunk/bin/io.pl
===================================================================
--- trunk/bin/io.pl	2012-03-08 14:17:33 UTC (rev 4415)
+++ trunk/bin/io.pl	2012-03-08 15:14:43 UTC (rev 4416)
@@ -124,7 +124,15 @@
 
 sub display_row {
     my $numrows = shift;
-
+    my $lsmb_module;
+    if ($form->{vc} eq 'customer'){
+       $lsmb_module = 'AR';
+    } elsif ($form->{vc} eq 'vendor'){
+       $lsmb_module = 'AP';
+    }
+    $form->all_business_units($form->{transdate}, 
+                              $form->{"$form->{vc}_id"}, 
+                              $lsmb_module);
     @column_index = qw(runningnumber partnumber description qty);
 
     if ( $form->{type} eq "sales_order" ) {
@@ -171,6 +179,13 @@
     }
 
     push @column_index, @{LedgerSMB::Sysconfig::io_lineitem_columns};
+    for my $cls(@{$form->{bu_class}}){
+        if (scalar @{$form->{b_units}->{"$cls->{id}"}}){
+             push @column_index, "b_unit_$cls->{id}";
+             $column_data{"b_unit_$cls->{id}"} = 
+               qq|<th class=listheading nowrap>| . $cls->{label} . qq|</th>|;
+        }
+    }
 
     push @column_index, "taxformcheck";#increase the number of elements by pushing into column_index.(Ex: NEw added element 
 				       # taxformcheck & check the screen AR->Sales Invoice) do everything before colspan ;
@@ -334,6 +349,24 @@
 
 	}
 
+        for my $cls(@{$form->{bu_class}}){
+            if (scalar @{$form->{b_units}->{"$cls->{id}"}}){
+                $column_data{"b_unit_$cls->{id}"} = 
+                   qq|<td><select name="b_unit_$cls->{id}_$i">
+                           <option></option>|;
+                my $selected = "";
+                for my $bu (@{$form->{b_units}->{"$cls->{id}"}}){
+                   if ($bu->{id} eq $form->{"b_unit_$cls->{id}_$i"}){
+                       $selected = "SELECTED='SELECTED'";
+                   }
+                   $column_data{"b_unit_$cls->{id}"} .= qq|
+                       <option value="$bu->{id}">$bu->{control_code}</option>|;
+                }
+                $column_data{"b_unit_$cls->{id}"} .= qq|
+                     </select></td>|;
+                   
+            }
+        }
 
 $column_data{runningnumber} =
           qq|<td><input name="runningnumber_$i" size=3 value=$i></td>|;

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