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

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



Revision: 4900
          http://ledger-smb.svn.sourceforge.net/ledger-smb/?rev=4900&view=rev
Author:   einhverfr
Date:     2012-06-16 09:03:29 +0000 (Sat, 16 Jun 2012)
Log Message:
-----------
DB structures for inventory adjustment reports
Also changed logic so 0-line invoices won't be posted for inventory adjusmemtn reports

Modified Paths:
--------------
    trunk/LedgerSMB/Scripts/import_csv.pm
    trunk/sql/Pg-database.sql

Modified: trunk/LedgerSMB/Scripts/import_csv.pm
===================================================================
--- trunk/LedgerSMB/Scripts/import_csv.pm	2012-06-16 08:43:33 UTC (rev 4899)
+++ trunk/LedgerSMB/Scripts/import_csv.pm	2012-06-16 09:03:29 UTC (rev 4900)
@@ -282,8 +282,8 @@
                 $ap_form->{customer_id} = $ap_eca->{id}; 
 
                 # POST
-                IS->post_invoice(undef, $ar_form);
-                IR->post_invoice(undef, $ap_form);
+                IS->post_invoice(undef, $ar_form) if $ar_form->{rowcount};
+                IR->post_invoice(undef, $ap_form) if $ap_form->{rowcount};
 
                 # Now, update the report record.
                 $dbh->do( # These two params come from posting above, and from

Modified: trunk/sql/Pg-database.sql
===================================================================
--- trunk/sql/Pg-database.sql	2012-06-16 08:43:33 UTC (rev 4899)
+++ trunk/sql/Pg-database.sql	2012-06-16 09:03:29 UTC (rev 4900)
@@ -1724,6 +1724,24 @@
 $$ Not exposed to the UI, but can be set to prevent an invoice from showing up
 for payment or in outstanding reports.$$;
 
+-- INVENTORY ADJUSTMENTS
+
+CREATE TABLE inventory_report (
+   id serial primary key, -- these are not tied to external sources usually
+   transdate date NOT NULL,    
+   source text, -- may be null 
+   ar_trans_id int,  -- would be null if no items were adjusted down
+   ap_trans_id int,  -- would be null if no items were adjusted up
+);
+
+CREATE TABLE inventory_report_line (
+   report_id int REFERENCES inventory_report(id), 
+   parts_id int REFERENCES parts(id),
+   counted numeric,
+   expected numeric,
+   PRIMARY KEY (report_id, parts_id)
+);
+
 --
 CREATE TABLE taxmodule (
   taxmodule_id serial PRIMARY KEY,

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