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

SF.net SVN: ledger-smb:[5146] branches/1.3



Revision: 5146
          http://ledger-smb.svn.sourceforge.net/ledger-smb/?rev=5146&view=rev
Author:   einhverfr
Date:     2012-10-06 09:16:58 +0000 (Sat, 06 Oct 2012)
Log Message:
-----------
committing Berend Tober's documentation patches.  Deferring patch on permissions in prepare_company.sh and menu label change.

Modified Paths:
--------------
    branches/1.3/CONTRIBUTORS
    branches/1.3/INSTALL
    branches/1.3/LedgerSMB/AA.pm
    branches/1.3/LedgerSMB/Form.pm
    branches/1.3/LedgerSMB/GL.pm
    branches/1.3/LedgerSMB/IR.pm
    branches/1.3/LedgerSMB/IS.pm
    branches/1.3/LedgerSMB/OE.pm
    branches/1.3/UI/journal/journal_entry.html
    branches/1.3/bin/aa.pl
    branches/1.3/bin/gl.pl
    branches/1.3/bin/io.pl
    branches/1.3/doc/manual/LedgerSMB-manual.tex

Modified: branches/1.3/CONTRIBUTORS
===================================================================
--- branches/1.3/CONTRIBUTORS	2012-10-05 23:43:01 UTC (rev 5145)
+++ branches/1.3/CONTRIBUTORS	2012-10-06 09:16:58 UTC (rev 5146)
@@ -122,8 +122,9 @@
 
 Brian Wolf <  brian @ activustech.com > has contributed bug reports.
 
+Berend Tober < btober @ broadstripe.net > has contributed some to the 
+documentation.
 
-
 Original Authors of SQL-Ledger:
 ===================================
 Dieter Simader <dsimader @ sql-ledger.com>

Modified: branches/1.3/INSTALL
===================================================================
--- branches/1.3/INSTALL	2012-10-05 23:43:01 UTC (rev 5145)
+++ branches/1.3/INSTALL	2012-10-06 09:16:58 UTC (rev 5146)
@@ -293,12 +293,12 @@
 The script assumes your PostgreSQL server runs on 'localhost' with
 PostgreSQL's default port (5432).
 
-Upon completion, it'll have created a company database with the name
+Upon completion, it will have created a company database with the name
 'testinc', a user called 'ledgersmb' (password: 'LEDGERSMBINITIALPASSWORD'),
 a single user called 'admin' (password: 'admin') and the roles required to
 manage authorizations.
 
-Additionally, it'll have loaded a minimal list of languages required
+Additionally, it will have loaded a minimal list of languages required
 to succesfully navigate the various screens.
 
 All these can be adjusted using arguments provided to the setup script. See

Modified: branches/1.3/LedgerSMB/AA.pm
===================================================================
--- branches/1.3/LedgerSMB/AA.pm	2012-10-05 23:43:01 UTC (rev 5145)
+++ branches/1.3/LedgerSMB/AA.pm	2012-10-06 09:16:58 UTC (rev 5146)
@@ -60,6 +60,7 @@
 	use strict;
 
     my ( $self, $myconfig, $form ) = @_;
+    $form->all_business_units;
 
     my $exchangerate;
     my $batch_class;
@@ -440,6 +441,12 @@
 
     my $taxformfound=AA->taxform_exist($form,$form->{"$form->{vc}_id"});
 
+    my $b_unit_sth = $dbh->prepare(
+         "INSERT INTO business_unit_ac (entry_id, class_id, bu_id)
+          VALUES (currval('acc_trans_entry_id_seq'), ?, ?)"
+    );
+
+
     foreach $ref ( @{ $form->{acc_trans}{lineitems} } ) {
         # insert detail records in acc_trans
         if ( $ref->{amount} ) {
@@ -461,6 +468,14 @@
            $dbh->prepare($query)->execute(@queryargs)
               || $form->dberror($query);
 
+           if ($ref->{row_num} and !$ref->{fx_transaction}){
+              my $i = $ref->{row_num};
+              for my $cls(@{$form->{bu_class}}){
+                  if ($form->{"b_unit_$cls->{id}_$i"}){
+                     $b_unit_sth->execute($cls->{id}, $form->{"b_unit_$cls->{id}_$i"});
+                  }
+              }
+           }
            if($taxformfound)
            {
             $query="select max(entry_id) from acc_trans;";

Modified: branches/1.3/LedgerSMB/Form.pm
===================================================================
--- branches/1.3/LedgerSMB/Form.pm	2012-10-05 23:43:01 UTC (rev 5145)
+++ branches/1.3/LedgerSMB/Form.pm	2012-10-06 09:16:58 UTC (rev 5146)
@@ -1977,6 +1977,45 @@
     return $i;
 }
 
+=item $form->all_business_units([$transdate, $credit_id]);
+
+Returns a list at bu_class with class information, ordered by order information
+and a list of units in lists at bu_units->$class_id.  $transdate is used to
+filter projects active at specified date.  $credit_id is to filter out 
+units assigned to other customers.
+
+=cut
+
+sub all_business_units {
+
+    my ( $self, $transdate, $credit_id, $module_name) = @_;
+    $self->{bu_class} = [];
+    $self->{b_units} = {};
+
+    my $dbh       = $self->{dbh};
+    my $class_sth = $dbh->prepare(
+                q|SELECT * FROM business_unit__list_classes('1', ?)|
+    );
+    $class_sth->execute($module_name);
+
+    my $bu_sth    = $dbh->prepare(
+                q|SELECT * 
+                    FROM business_unit__list_by_class(?, ?, ?, 'false')|
+    );
+
+    while (my $classref = $class_sth->fetchrow_hashref('NAME_lc')){
+        push @{$self->{bu_class}}, $classref;
+        $bu_sth->execute($classref->{id}, $transdate, $credit_id);
+        $self->{b_units}->{$classref->{id}} = [];
+        while (my $buref = $bu_sth->fetchrow_hashref('NAME_lc')){
+           push @{$self->{b_units}->{$classref->{id}}}, $buref;
+        }
+    }
+    $class_sth->finish;
+    $bu_sth->finish;
+
+}
+
 =item $form->all_vc($myconfig, $vc, $module, $dbh, $transdate, $job);
 
 Populates the list referred to by $form->{all_${vc}} with hashes of either
@@ -2657,12 +2696,18 @@
         $query = qq|
 			SELECT c.accno, c.description, a.source, a.amount,
 				a.memo,a.entry_id, a.transdate, a.cleared, a.project_id,
-				p.projectnumber
+				p.projectnumber,
+                                compound_array(ARRAY[ARRAY[bul.class_id, bul.bu_id]])
+                                AS bu_lines
 			FROM acc_trans a
 			JOIN chart c ON (c.id = a.chart_id)
 			LEFT JOIN project p ON (p.id = a.project_id)
+                   LEFT JOIN business_unit_ac bul ON a.entry_id = bul.entry_id
 			WHERE a.trans_id = ?
 				AND a.fx_transaction = '0'
+                        GROUP BY c.accno, c.description, a.source, a.amount,
+                                 a.memo,a.entry_id, a.transdate, a.cleared,
+                                 a.project_id, p.projectnumber
 			ORDER BY transdate|;
 
         $sth = $dbh->prepare($query);

Modified: branches/1.3/LedgerSMB/GL.pm
===================================================================
--- branches/1.3/LedgerSMB/GL.pm	2012-10-05 23:43:01 UTC (rev 5145)
+++ branches/1.3/LedgerSMB/GL.pm	2012-10-06 09:16:58 UTC (rev 5146)
@@ -97,6 +97,7 @@
 sub post_transaction {
 
     my ( $self, $myconfig, $form, $locale) = @_;
+    $form->all_business_units;
     $form->{reference} = $form->update_defaults( $myconfig, 'glnumber', $dbh )
       unless $form->{reference};
     my $null;
@@ -195,6 +196,10 @@
     my $debit;
     my $credit;
 
+    $b_sth = $dbh->prepare(
+            qq|INSERT INTO business_unit_ac (entry_id, class_id, bu_id) | . 
+            qq|VALUES (currval('acc_trans_entry_id_seq'), ?, ?)|
+    );
     # insert acc_trans transactions
     for $i ( 0 .. $form->{rowcount} ) {
 
@@ -244,6 +249,12 @@
                 ($form->{"cleared_$i"} || 0)
             ) || $form->dberror($query);
 
+            for my $cls(@{$form->{bu_class}}){
+                if ($form->{"b_unit_$cls->{id}_$i"}){
+                    $b_sth->execute($cls->{id}, 
+                                     $form->{"b_unit_$cls->{id}_$i"});
+                }
+            }
             $posted = 1;
         }
     }
@@ -654,8 +665,18 @@
         $sth = $dbh->prepare($query);
         $sth->execute( $form->{id} ) || $form->dberror($query);
 
+        my $bu_sth = $dbh->prepare(
+            qq|SELECT * FROM business_unit_ac 
+                WHERE entry_id = ?  |
+        );
+
         while ( $ref = $sth->fetchrow_hashref(NAME_lc) ) {
+            $bu_sth->execute($ref->{entry_id});
+            while ($buref = $bu_sth->fetchrow_hashref(NAME_lc) ) {
+                 $ref->{"b_unit_$buref->{class_id}"} = $buref->{bu_id};
+            }
 
+
             if ( $ref->{fx_transaction} ) {
                 $form->{transfer} = 1;
             }

Modified: branches/1.3/LedgerSMB/IR.pm
===================================================================
--- branches/1.3/LedgerSMB/IR.pm	2012-10-05 23:43:01 UTC (rev 5145)
+++ branches/1.3/LedgerSMB/IR.pm	2012-10-06 09:16:58 UTC (rev 5146)
@@ -69,6 +69,7 @@
 sub post_invoice {
     my ( $self, $myconfig, $form ) = @_;
 
+    $form->all_business_units;
     if ($form->{id}){
         delete_invoice($self, $myconfig, $form);
     }
@@ -205,6 +206,15 @@
     
     my $taxformfound=IR->taxform_exist($form,$form->{"vendor_id"});#tshvr this always returns true!!
   
+    my $b_unit_sth = $dbh->prepare(
+         "INSERT INTO business_unit_inv (entry_id, class_id, bu_id)
+          VALUES (currval('invoice_id_seq'), ?, ?)"
+    );
+
+    my $b_unit_sth_ac = $dbh->prepare(
+         "INSERT INTO business_unit_ac (entry_id, class_id, bu_id)
+          VALUES (currval('acc_trans_entry_id_seq'), ?, ?)"
+    );
     for my $i ( 1 .. $form->{rowcount} ) {
         $form->{"qty_$i"} = $form->parse_amount( $myconfig, $form->{"qty_$i"} );
 
@@ -337,6 +347,12 @@
                 $invoice_id
             ) || $form->dberror($query);
 
+            for my $cls(@{$form->{bu_class}}){
+                if ($form->{"b_unit_$cls->{id}_$i"}){
+                 $b_unit_sth->execute($cls->{id}, $form->{"b_unit_$cls->{id}_$i"});
+                }
+            }
+
             if($taxformfound)
             {
              my $report=$form->{"taxformcheck_$i"}?"true":"false";
@@ -483,6 +499,11 @@
                             $ref->{transdate}, $ref->{transdate},
                         ) || $form->dberror($query);
 
+                        for my $cls(@{$form->{bu_class}}){
+                            if ($form->{"b_unit_$cls->{id}_$i"}){
+                             $b_unit_sth_ac->execute($cls->{id}, $form->{"b_unit_$cls->{id}_$i"});
+                            }
+                        }
                         # add expense
                         $query = qq|
 				INSERT INTO acc_trans 
@@ -507,6 +528,12 @@
                         ) || $form->dberror($query);
                     }
 
+
+                    for my $cls(@{$form->{bu_class}}){
+                        if ($form->{"b_unit_$cls->{id}_$i"}){
+                         $b_unit_sth_ac->execute($cls->{id}, $form->{"b_unit_$cls->{id}_$i"});
+                        }
+                    }
                     # update allocated for sold item
                     $form->update_balance( $dbh, "invoice", "allocated",
                         qq|id = $ref->{id}|,
@@ -1275,7 +1302,13 @@
         $sth->execute( $form->{language_code}, $form->{id} )
           || $form->dberror($query);
 
+        my $bu_sth = $dbh->prepare(
+            qq|SELECT * FROM business_unit_inv
+                WHERE entry_id = ?  |
+        );
+
         # exchangerate defaults
+        # exchangerate defaults
         &exchangerate_defaults( $dbh, $form );
 
         # price matrix and vendor partnumber
@@ -1300,6 +1333,11 @@
             $dec = length $dec;
             my $decimalplaces = ( $dec > 2 ) ? $dec : 2;
 
+            $bu_sth->execute($ref->{invoice_id});
+            while ( $buref = $bu_sth->fetchrow_hashref(NAME_lc) ) {
+                $ref->{"b_unit_$buref->{class_id}"} = $buref->{bu_id};
+            }
+
             $tth->execute( $ref->{id} );
             $ref->{taxaccounts} = "";
             my $taxrate = 0;

Modified: branches/1.3/LedgerSMB/IS.pm
===================================================================
--- branches/1.3/LedgerSMB/IS.pm	2012-10-05 23:43:01 UTC (rev 5145)
+++ branches/1.3/LedgerSMB/IS.pm	2012-10-06 09:16:58 UTC (rev 5146)
@@ -910,6 +910,7 @@
 sub post_invoice {
 
     my ( $self, $myconfig, $form ) = @_;
+    $form->all_business_units;
     $form->{invnumber} = $form->update_defaults( $myconfig, "sinumber", $dbh )
       unless $form->{invnumber};
 
@@ -1036,6 +1037,10 @@
 
     my $taxformfound=IS->taxform_exist($form,$form->{"customer_id"});
 
+    my $b_unit_sth = $dbh->prepare(
+         "INSERT INTO business_unit_inv (entry_id, class_id, bu_id)
+          VALUES (currval('invoice_id_seq'), ?, ?)"
+    );
 
     foreach $i ( 1 .. $form->{rowcount} ) {
         my $allocated = 0;
@@ -1248,6 +1253,11 @@
                 $invoice_id
             ) || $form->dberror($query);
 
+            for my $cls(@{$form->{bu_class}}){
+                if ($form->{"b_unit_$cls->{id}_$i"}){
+                 $b_unit_sth->execute($cls->{id}, $form->{"b_unit_$cls->{id}_$i"});
+                }
+            }
 	   my $report=($taxformfound and $form->{"taxformcheck_$i"})?"true":"false";
 
 	   IS->update_invoice_tax_form($form,$dbh,$invoice_id,$report);
@@ -1298,6 +1308,29 @@
     $invnetamount = $amount;
 
     $amount = 0;
+
+    $form->{paid} = 0;
+    for $i ( 1 .. $form->{paidaccounts} ) {
+        $form->{"paid_$i"} =
+          $form->parse_amount( $myconfig, $form->{"paid_$i"} )->bstr();
+        $form->{paid} += $form->{"paid_$i"};
+        $form->{datepaid} = $form->{"datepaid_$i"}
+          if ( $form->{"paid_$i"} );
+    }
+
+    # add lineitems + tax
+    $amount        = 0;
+    $grossamount   = 0;
+    $fxgrossamount = 0;
+
+    for ( @{ $form->{acc_trans}{lineitems} } ) {
+        $amount        += $_->{amount};
+        $grossamount   += $_->{grossamount};
+        $fxgrossamount += $_->{fxgrossamount};
+    }
+    $invnetamount = $amount;
+
+    $amount = 0;
     for ( split / /, $form->{taxaccounts} ) {
         $amount += $form->{acc_trans}{ $form->{id} }{$_}{amount} =
           $form->round_amount( $form->{acc_trans}{ $form->{id} }{$_}{amount},
@@ -1307,6 +1340,11 @@
 
     $diff = 0;
 
+    $b_unit_sth = $dbh->prepare(
+         "INSERT INTO business_unit_ac (entry_id, class_id, bu_id)
+          VALUES (currval('acc_trans_entry_id_seq'), ?, ?)"
+    );
+
     if ( $form->{taxincluded} ) {
         $diff = $form->round_amount( $grossamount - $invamount, 2 );
         $invamount += $diff;
@@ -1339,6 +1377,11 @@
           || $form->dberror($query);
         $diff   = 0;
         $fxdiff = 0;
+        for my $cls(@{$form->{bu_class}}){
+            if ($form->{"b_unit_$cls->{id}_$i"}){
+               $b_unit_sth->execute($cls->{id}, $form->{"b_unit_$cls->{id}_$i"});
+            }
+        }
     }
 
     $form->{receivables} = $invamount * -1;
@@ -2161,6 +2204,12 @@
           || $form->dberror($query);
 
         
+        my $bu_sth = $dbh->prepare(
+            qq|SELECT * FROM business_unit_inv
+                WHERE entry_id = ?  |
+        );
+
+        
         # foreign currency
         &exchangerate_defaults( $dbh, $form );
 
@@ -2187,6 +2236,11 @@
             $dec = length $dec;
             my $decimalplaces = ( $dec > 2 ) ? $dec : 2;
 
+            $bu_sth->execute($ref->{invoice_id});
+            while ( $buref = $bu_sth->fetchrow_hashref(NAME_lc) ) {
+                $ref->{"b_unit_$buref->{class_id}"} = $buref->{bu_id};
+            }
+
             $tth->execute( $ref->{id} );
 
             $ref->{taxaccounts} = "";

Modified: branches/1.3/LedgerSMB/OE.pm
===================================================================
--- branches/1.3/LedgerSMB/OE.pm	2012-10-05 23:43:01 UTC (rev 5145)
+++ branches/1.3/LedgerSMB/OE.pm	2012-10-06 09:16:58 UTC (rev 5146)
@@ -309,6 +309,7 @@
 sub save {
     my ( $self, $myconfig, $form ) = @_;
   
+    $form->all_business_units;
     $form->db_prepare_vars(
         "quonumber", "transdate",     "vendor_id",     "entity_id",
         "reqdate",   "taxincluded",   "shippingpoint", "shipvia",
@@ -317,6 +318,10 @@
     );
     # connect to database, turn off autocommit
     my $dbh = $form->{dbh};
+    my $b_unit_sth = $dbh->prepare(
+         "INSERT INTO business_unit_oitem (entry_id, class_id, bu_id)
+          VALUES (currval('orderitems_id_seq'), ?, ?)"
+    );
     my @queryargs;
     my $quotation;
     my $ordnumber;
@@ -572,6 +577,11 @@
             $sth->execute(@queryargs) || $form->dberror($query);
 	    $dbh->commit;
             $form->{"sellprice_$i"} = $fxsellprice;
+            for my $cls(@{$form->{bu_class}}){
+                if ($form->{"b_unit_$cls->{id}_$i"}){
+                 $b_unit_sth->execute($cls->{id}, $form->{"b_unit_$cls->{id}_$i"});
+                }
+            }
         }
         $form->{"discount_$i"} *= 100;
  
@@ -816,6 +826,11 @@
     # connect to database
     my $dbh = $form->{dbh};
 
+    my $bu_sth = $dbh->prepare(
+            qq|SELECT * FROM business_unit_oitem
+                WHERE entry_id = ?  |
+    );
+
     my $query;
     my $sth;
     my $var;
@@ -930,6 +945,11 @@
         while ( $ref = $sth->fetchrow_hashref('NAME_lc') ) {
             $form->db_parse_numeric(sth=>$sth, hashref=>$ref);
 
+            $bu_sth->execute($ref->{invoice_id});
+            while ( $buref = $bu_sth->fetchrow_hashref(NAME_lc) ) {
+                $ref->{"b_unit_$buref->{class_id}"} = $buref->{bu_id};
+            }
+
             ($decimalplaces) = ( $ref->{sellprice} =~ /\.(\d+)/ );
             $decimalplaces = length $decimalplaces;
             $decimalplaces = ( $decimalplaces > 2 ) ? $decimalplaces : 2;

Modified: branches/1.3/UI/journal/journal_entry.html
===================================================================
--- branches/1.3/UI/journal/journal_entry.html	2012-10-05 23:43:01 UTC (rev 5145)
+++ branches/1.3/UI/journal/journal_entry.html	2012-10-06 09:16:58 UTC (rev 5146)
@@ -134,6 +134,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>
@@ -256,6 +261,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: branches/1.3/bin/aa.pl
===================================================================
--- branches/1.3/bin/aa.pl	2012-10-05 23:43:01 UTC (rev 5145)
+++ branches/1.3/bin/aa.pl	2012-10-06 09:16:58 UTC (rev 5146)
@@ -435,6 +435,10 @@
 
     $title = $form->{title};
 
+    $form->all_business_units($form->{transdate}, 
+                              $form->{"$form->{vc}_id"}, 
+                              $form->{ARAP});
+
     if($form->{batch_id})
     {
 		$form->{batch_control_code}=$form->get_batch_control_code($form->{dbh},$form->{batch_id});
@@ -744,7 +748,13 @@
 	  <th>| . $locale->text('Account') . qq|</th>
 	  <th>| . $locale->text('Description') . qq|</th>
 	  <th>| . $locale->text('Tax Form Applied') . qq|</th>
-	  $project
+	  $project|;
+    for my $cls (@{$form->{bu_class}}){
+        if (scalar @{$form->{b_units}->{"$cls->{id}"}}){
+            print qq|<th>| . $locale->text($cls->{label}) . qq|</th>|;
+        }
+    }
+       print qq|
 	</tr>
 |;
 
@@ -792,7 +802,27 @@
 	  <td><select name="$form->{ARAP}_amount_$i">$selectamount</select></td>
 	  $description
           $taxformcheck
-	  $project
+	  $project|;
+
+        for my $cls (@{$form->{bu_class}}){
+            if (scalar @{$form->{b_units}->{"$cls->{id}"}}){
+                print qq|<td><select name="b_unit_$cls->{id}_$i">
+                                    <option></option>|;
+                      for my $bu (@{$form->{b_units}->{"$cls->{id}"}}){
+                         my $selected = '';
+                         if ($form->{"b_unit_$cls->{id}_$i"} eq $bu->{id}){
+                            $selected = "SELECTED='SELECTED'";
+                         }
+                         print qq|  <option value="$bu->{id}" $selected>
+                                        $bu->{control_code}
+                                    </option>|;
+                      }
+                print qq|
+                             </select>
+                        </th>|;
+            }
+        }
+        print qq|
 	</tr>
 |;
 
@@ -1492,6 +1522,9 @@
         $selectname = qq|<input name=$form->{vc} size=35>|;
     }
 
+    # Business Reporting Units
+    $form->all_business_units;
+
     # departments
     if ( @{ $form->{all_department} } ) {
         $form->{selectdepartment} = "<option>\n";

Modified: branches/1.3/bin/gl.pl
===================================================================
--- branches/1.3/bin/gl.pl	2012-10-05 23:43:01 UTC (rev 5145)
+++ branches/1.3/bin/gl.pl	2012-10-06 09:16:58 UTC (rev 5146)
@@ -179,6 +179,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;
@@ -406,7 +407,12 @@
 			      $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"};
@@ -927,6 +933,8 @@
 
     &create_links;
 
+    $form->all_business_units($form->{transdate}, undef, 'GL');
+
     $form->{locked} =
       ( $form->{revtrans} )
       ? '1'
@@ -956,6 +964,10 @@
             $form->{"credit_$i"} = $ref->{amount};
         }
 
+        for my $cls (@{$form->{bu_class}}){
+            $form->{"b_unit_$cls->{id}_$i"} = $ref->{"b_unit_$cls->{id}"};
+        }
+
         $i++;
     }
    if ($form->{id}){

Modified: branches/1.3/bin/io.pl
===================================================================
--- branches/1.3/bin/io.pl	2012-10-05 23:43:01 UTC (rev 5145)
+++ branches/1.3/bin/io.pl	2012-10-06 09:16:58 UTC (rev 5146)
@@ -126,6 +126,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);
 
@@ -174,6 +183,14 @@
 
     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 ;
 
@@ -336,6 +353,26 @@
 
 	}
 
+        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>|;
+                for my $bu (@{$form->{b_units}->{"$cls->{id}"}}){
+                   my $selected = "";
+                   if ($bu->{id} eq $form->{"b_unit_$cls->{id}_$i"}){
+                       $selected = "SELECTED='SELECTED'";
+                   }
+                   $column_data{"b_unit_$cls->{id}"} .= qq|
+                       <option value="$bu->{id}" $selected >
+                               $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>|;

Modified: branches/1.3/doc/manual/LedgerSMB-manual.tex
===================================================================
--- branches/1.3/doc/manual/LedgerSMB-manual.tex	2012-10-05 23:43:01 UTC (rev 5145)
+++ branches/1.3/doc/manual/LedgerSMB-manual.tex	2012-10-06 09:16:58 UTC (rev 5146)
@@ -308,12 +308,12 @@
 The script assumes your PostgreSQL server runs on 'localhost' with
 PostgreSQL's default port (5432).
 
-Upon completion, it'll have created a company database with the name
+Upon completion, it will have created a company database with the name
 'testinc', a user called 'ledgersmb' (password: 'LEDGERSMBINITIALPASSWORD'),
 a single user called 'admin' (password: 'admin') and the roles required to
 manage authorizations.
 
-Additionally, it'll have loaded a minimal list of languages required
+Additionally, it will have loaded a minimal list of languages required
 to succesfully navigate the various screens.
 
 All these can be adjusted using arguments provided to the setup script. See
@@ -325,7 +325,7 @@
 user, by default, only has user management capabilities.  Ideally actual work 
 should be done with accounts which have fewer permissions.
 
-To set up a user, log in with you administrative credentials (created when
+To set up a user, log in with your administrative credentials (created when
 initializing the database) and then go to System/Admin Users/Add User.  From
 here you can create a user and add appropriate permissions.
 
@@ -337,9 +337,10 @@
 
 The roles follow a naming convention which allows several LSMB databases to
 exist on the same PostgreSQL instance.  Each role is named lsmb\_\lbrack
-dbname\rbrack\_\_ followed by the role name.  Note that two underscores separate
-the database and role names.  If these are followed then the interface will
-pick up on defined groups and display them along with other permissions.
+dbname\rbrack\_\_ followed by the role name.  Note that two underscores
+separate the database and role names.  If this naming convention is followed,
+then the interface will find the defined groups in the data base and display
+them along with other permissions.
 
 \subsubsection{List of Roles}
 
@@ -758,7 +759,7 @@
 groups.  There is not currently a way of doing this from the front-end, but as
 long as you follow the conventions, roles you create can be assigned to users
 through the front-end.  One can also create super-groups that the front-end
-cannot see but can assign permissions to broups of users on multiple databases.
+cannot see but can assign permissions to groups of users on multiple databases.
 This section will cover both of these approaches.
 
 \subsubsection{Naming Conventions}

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