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

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



Revision: 5539
          http://ledger-smb.svn.sourceforge.net/ledger-smb/?rev=5539&view=rev
Author:   einhverfr
Date:     2013-01-11 08:17:39 +0000 (Fri, 11 Jan 2013)
Log Message:
-----------
Inventory Adjustment Approval Workflow Added

Modified Paths:
--------------
    trunk/LedgerSMB/Scripts/inventory.pm
    trunk/sql/modules/Goods.sql

Modified: trunk/LedgerSMB/Scripts/inventory.pm
===================================================================
--- trunk/LedgerSMB/Scripts/inventory.pm	2013-01-11 07:50:20 UTC (rev 5538)
+++ trunk/LedgerSMB/Scripts/inventory.pm	2013-01-11 08:17:39 UTC (rev 5539)
@@ -18,8 +18,9 @@
 package LedgerSMB::Scripts::inventory;
 
 use LedgerSMB::Template;
-use LedgerSMB::Inventory::Adjust.pm
-use LedgerSMB::Inventory::Adjust_line.pm
+use LedgerSMB::Inventory::Adjust;
+use LedgerSMB::Inventory::Adjust_line;
+use LedgerSMB::Report::Inventory::Adjustments;
 
 #require 'lsmb-request.pl';
 
@@ -29,8 +30,6 @@
 
 This entry point specifies the screen for setting up an inventory adjustment.
 
-=back
-
 =cut
 
 sub begin_adjust {
@@ -45,14 +44,10 @@
     $template->render($request);
 }
 
-=over
-
 =item enter_adjust
 
 This entry point specifies the screen for entering an inventory adjustment.
 
-=back
-
 =cut
 
 sub enter_adjust {
@@ -68,16 +63,12 @@
 }
 
 
-=over
-
 =item adjustment_next
 
 This function is triggered on the next button on the adjustment entry screen.
 It retrieves inventory information, calculates adjustment values, and displays the
 screen.
 
-=back
-
 =cut
 
 sub adjustment_next {
@@ -98,15 +89,11 @@
     enter_adjust($adjustment);
 }
 
-=over
-
 =item adjustment_save
 
 This function saves the inventory adjustment report and then creates the required
 invoices.
 
-=back
-
 =cut
 
 sub adjustment_save {
@@ -115,4 +102,41 @@
     $adjustment->save;
     begin_adjust($request);
 } 
+
+=item adjustment_list
+
+=cut
+
+sub adjustment_list {
+    my ($request) = @_;
+    my $report = LedgerSMB::Report::Inventory::Adjustments->new(%$request);
+    $report->render($request);
+}
+
+=item adjustement_approve
+
+=cut
+
+sub adjustment_approve {
+    my ($request) = @_;
+    my $adjust = LedgerSMB::Inventory::Adjustment->new(%$request);
+    $adjust->approve;
+    $request->{report_name} = 'list_inventory_counts';
+    LedgerSMB::Scripts::report::begin_report($request);
+}
+
+=item adjustment_delete
+
+=back
+
+=cut
+
+sub adjustment_delete {
+    my ($request) = @_;
+    my $adjust = LedgerSMB::Inventory::Adjustment->new(%$request);
+    $adjust->delete;
+    $request->{report_name} = 'list_inventory_counts';
+    LedgerSMB::Scripts::report::begin_report($request);
+}
+
 1;

Modified: trunk/sql/modules/Goods.sql
===================================================================
--- trunk/sql/modules/Goods.sql	2013-01-11 07:50:20 UTC (rev 5538)
+++ trunk/sql/modules/Goods.sql	2013-01-11 08:17:39 UTC (rev 5539)
@@ -346,4 +346,29 @@
 END;
 $$;
 
+CREATE OR REPLACE FUNCTION inventory_adjust__list
+(in_from_date date, in_to_date date, in_approved bool)
+RETURNS SETOF inventory_report language sql as $$
+
+SELECT * FROM inventory_report
+ WHERE ($1 is null or transdate >= $1)
+       AND ($2 IS NULL OR transdate <= $2)
+       AND ($3 IS NULL OR $3 = (ar_trans_id IS NULL AND ap_trans_id IS NULL));
+
+$$;
+
+CREATE OR REPLACE FUNCTION inventory_adjust__get(in_id int)
+RETURNS SETOF inventory_report -- only 0-1....
+LANGUAGE SQL AS
+$$
+SELECT * FROM inventory_report WHERE id = $1;
+$$;
+
+CREATE OR REPLACE FUNCTION inventory_adjust__get_lines(in_id int)
+RETURNS SETOF inventory_report_line LANGUAGE SQL AS
+$$
+SELECT * FROM inventory_report_line l WHERE id = $1
+ ORDER BY parts_id;
+$$;
+
 COMMIT;

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