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

SF.net SVN: ledger-smb:[3590] addons/1.3



Revision: 3590
          http://ledger-smb.svn.sourceforge.net/ledger-smb/?rev=3590&view=rev
Author:   einhverfr
Date:     2011-07-29 19:06:02 +0000 (Fri, 29 Jul 2011)

Log Message:
-----------
Adding back routines deleted from Payment.sql which are not normally exposed to the 
workflow

Added Paths:
-----------
    addons/1.3/payment_queue/
    addons/1.3/payment_queue/trunk/
    addons/1.3/payment_queue/trunk/sql/
    addons/1.3/payment_queue/trunk/sql/modules/
    addons/1.3/payment_queue/trunk/sql/modules/Payment_queue.sql

Added: addons/1.3/payment_queue/trunk/sql/modules/Payment_queue.sql
===================================================================
--- addons/1.3/payment_queue/trunk/sql/modules/Payment_queue.sql	                        (rev 0)
+++ addons/1.3/payment_queue/trunk/sql/modules/Payment_queue.sql	2011-07-29 19:06:02 UTC (rev 3590)
@@ -0,0 +1,52 @@
+
+CREATE OR REPLACE FUNCTION payment_bulk_queue
+(in_transactions numeric[], in_batch_id int, in_source text, in_total numeric,
+	in_ar_ap_accno text, in_cash_accno text, 
+	in_payment_date date, in_account_class int)
+returns int as
+$$
+BEGIN
+	INSERT INTO payments_queue
+	(transactions, batch_id, source, total, ar_ap_accno, cash_accno,
+		payment_date, account_class)
+	VALUES 
+	(in_transactions, in_batch_id, in_source, in_total, in_ar_ap_accno,
+		in_cash_accno, in_payment_date, in_account_class);
+
+	RETURN array_upper(in_transactions, 1) - 
+		array_lower(in_transactions, 1);
+END;
+$$ LANGUAGE PLPGSQL;
+
+CREATE OR REPLACE FUNCTION job__create(in_batch_class int, in_batch_id int)
+RETURNS int AS
+$$
+BEGIN
+	INSERT INTO pending_job (batch_class, batch_id)
+	VALUES (coalesce(in_batch_class, 3), in_batch_id);
+
+	RETURN currval('pending_job_id_seq');
+END;
+$$ LANGUAGE PLPGSQL;
+
+CREATE TYPE job__status AS (
+	completed int, -- 1 for completed, 0 for no
+	success int, -- 1 for success, 0 for no
+	completed_at timestamp,
+	error_condition text -- error if not successful
+);
+
+CREATE OR REPLACE FUNCTION job__status(in_job_id int) RETURNS job__status AS
+$$
+DECLARE out_row job__status;
+BEGIN
+	SELECT  (completed_at IS NULL)::INT, success::int, completed_at,
+		error_condition
+	INTO out_row 
+	FROM pending_job
+	WHERE id = in_job_id;
+
+	RETURN out_row;
+END;
+$$ language plpgsql;
+


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