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

SF.net SVN: ledger-smb:[6650] trunk/LedgerSMB



Revision: 6650
          http://sourceforge.net/p/ledger-smb/code/6650
Author:   einhverfr
Date:     2014-01-26 07:31:09 +0000 (Sun, 26 Jan 2014)
Log Message:
-----------
Inventory adjustment reports now save.

Modified Paths:
--------------
    trunk/LedgerSMB/Inventory/Adjust.pm
    trunk/LedgerSMB/Scripts/inventory.pm

Modified: trunk/LedgerSMB/Inventory/Adjust.pm
===================================================================
--- trunk/LedgerSMB/Inventory/Adjust.pm	2014-01-26 06:11:44 UTC (rev 6649)
+++ trunk/LedgerSMB/Inventory/Adjust.pm	2014-01-26 07:31:09 UTC (rev 6650)
@@ -125,13 +125,14 @@
     my ($self, $hashref) = @_;
     my @lines;
     for my $ln (1 .. $hashref->{rowcount}){
-        next if !$hashref->{"counted_$ln"};
-        next if !$hashref->{"partnumber_$ln"} and !$hashref->{"parts_id_$ln"};
+        next 
+          if $hashref->{"id_$ln"} eq 'new';
         my $line = LedgerSMB::Inventory::Adjust_Line->new(
-          {parts_id => $hashref->{"parts_id_$ln"},
+          parts_id => $hashref->{"id_$ln"},
          partnumber => $hashref->{"partnumber_$ln"},
             counted => $hashref->{"counted_$ln"},
-           expected => $hashref->{"expected_$ln"}});
+           expected => $hashref->{"onhand_$ln"},
+           variance => $hashref->{"onhand_$ln"} - $hashref->{"counted_$ln"});
         push @lines, $line;
     }
     my $rows = $self->rows;

Modified: trunk/LedgerSMB/Scripts/inventory.pm
===================================================================
--- trunk/LedgerSMB/Scripts/inventory.pm	2014-01-26 06:11:44 UTC (rev 6649)
+++ trunk/LedgerSMB/Scripts/inventory.pm	2014-01-26 07:31:09 UTC (rev 6650)
@@ -80,7 +80,7 @@
         if ($request->{"id_$i"} eq "new" or !$request->{"id_$i"}){
             my $item = $adjustment->get_part_at_date(
 		$request->{transdate}, $request->{"partnumber_$i"});
-            $request->{"row_$i"} = $item->{id};
+            $request->{"id_$i"} = $item->{id};
             $request->{"description_$i"} = $item->{description};
             $request->{"onhand_$i"} = $item->{onhand};
         }
@@ -101,7 +101,8 @@
 
 sub adjustment_save {
     my ($request) = @_;
-    my $adjustment = LedgerSMB::Inventory::Adjust->new(base => $request);
+    my $adjustment = LedgerSMB::Inventory::Adjust->new(%$request);
+    $adjustment->lines_from_form($request);
     $adjustment->save;
     begin_adjust($request);
 } 

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


------------------------------------------------------------------------------
CenturyLink Cloud: The Leader in Enterprise Cloud Services.
Learn Why More Businesses Are Choosing CenturyLink Cloud For
Critical Workloads, Development Environments & Everything In Between.
Get a Quote or Start a Free Trial Today.
http://pubads.g.doubleclick.net/gampad/clk?id=119420431&iu=/4140/ostg.clktrk
_______________________________________________
Ledger-smb-commits mailing list
..hidden..
https://lists.sourceforge.net/lists/listinfo/ledger-smb-commits