[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
SF.net SVN: ledger-smb:[4808] trunk/sql/modules/test/COGS-FIFO.sql
- Subject: SF.net SVN: ledger-smb:[4808] trunk/sql/modules/test/COGS-FIFO.sql
- From: ..hidden..
- Date: Thu, 31 May 2012 02:35:50 +0000
Revision: 4808
http://ledger-smb.svn.sourceforge.net/ledger-smb/?rev=4808&view=rev
Author: einhverfr
Date: 2012-05-31 02:35:50 +0000 (Thu, 31 May 2012)
Log Message:
-----------
Additional unit tests for series 1 (COGS, AR entered first)
Modified Paths:
--------------
trunk/sql/modules/test/COGS-FIFO.sql
Modified: trunk/sql/modules/test/COGS-FIFO.sql
===================================================================
--- trunk/sql/modules/test/COGS-FIFO.sql 2012-05-31 02:16:03 UTC (rev 4807)
+++ trunk/sql/modules/test/COGS-FIFO.sql 2012-05-31 02:35:50 UTC (rev 4808)
@@ -68,6 +68,14 @@
from acc_trans
where trans_id = -1201 and chart_id = -1102;
+INSERT INTO test_result(test_name, success)
+SELECT 'post-ap-run allocated 75 (invoice 1, series 1)', allocated = -75
+FROM invoice WHERE id = -1201;
+
+INSERT INTO test_result(test_name, success)
+SELECT 'post-ap-run allocated 75 (invoice 2, series 1)', allocated = 75
+FROM invoice WHERE id = -1202;
+
INSERT INTO ar (id, invoice, invnumber, transdate, entity_credit_account)
VALUES (-1203, true, 'test1003', now() - '9 days'::interval, -2000);
INSERT INTO invoice (id, trans_id, parts_id, qty, allocated, sellprice)
@@ -80,10 +88,21 @@
SELECT cogs__add_for_ar_line(-1203);
+INSERT INTO test_result(test_name, success)
+SELECT 'post-ap-run allocated 75 (invoice 1, series 1)', allocated = -75
+FROM invoice WHERE id = -1201;
+INSERT INTO test_result(test_name, success)
+SELECT 'post-ap-run allocated still 75 (invoice 2, series 1)', allocated = 75
+FROM invoice WHERE id = -1202;
+
+INSERT INTO test_result(test_name, success)
+SELECT 'post-ap-run allocated 0 (invoice 3, series 1)', allocated = 0
+FROM invoice WHERE id = -1203;
+
--duplicate to check against reversals
INSERT INTO test_result (test_name, success)
-SELECT 'post-ap-run COGS is 37.50, (invoice 1, series 1)', sum(amount) = 37.5
+SELECT 'post-ap-run COGS still 37.50, (invoice 1, series 1)', sum(amount) = 37.5
from acc_trans
where trans_id = -1201 and chart_id = -1102;
@@ -100,6 +119,22 @@
SELECT cogs__add_for_ap_line(-1204);
+INSERT INTO test_result(test_name, success)
+SELECT 'post-ap-run allocated 100 (invoice 1, series 1)', allocated = -100
+FROM invoice WHERE id = -1201;
+
+INSERT INTO test_result(test_name, success)
+SELECT 'post-ap-run allocated still 75 (invoice 2, series 1)', allocated = 75
+FROM invoice WHERE id = -1202;
+
+INSERT INTO test_result(test_name, success)
+SELECT 'post-ap-run allocated 50 (invoice 3, series 1)', allocated = -50
+FROM invoice WHERE id = -1203;
+
+INSERT INTO test_result(test_name, success)
+SELECT 'post-ap-run allocated 75 (invoice 4, series 1)', allocated = 75
+FROM invoice WHERE id = -1204;
+
INSERT INTO test_result (test_name, success)
SELECT 'post-ap-run COGS is 62.50, (invoice 1, series 1)', sum(amount) = 62.5
from acc_trans
@@ -119,6 +154,27 @@
SELECT parts_id, qty, allocated, trans_id, id FROM invoice WHERE parts_id < 0;
SELECT cogs__add_for_ap_line(-1205);
+INSERT INTO test_result(test_name, success)
+SELECT 'post-ap-run allocated still 100 (invoice 1, series 1)', allocated = -100
+FROM invoice WHERE id = -1201;
+
+INSERT INTO test_result(test_name, success)
+SELECT 'post-ap-run allocated still 75 (invoice 2, series 1)', allocated = 75
+FROM invoice WHERE id = -1202;
+
+INSERT INTO test_result(test_name, success)
+SELECT 'post-ap-run allocated 100 (invoice 3, series 1)', allocated = -100
+FROM invoice WHERE id = -1203;
+
+INSERT INTO test_result(test_name, success)
+SELECT 'post-ap-run allocated still 75 (invoice 4, series 1)', allocated = 75
+FROM invoice WHERE id = -1204;
+
+
+INSERT INTO test_result(test_name, success)
+SELECT 'post-ap-run allocated 50 (invoice 5, series 1)', allocated = 50
+FROM invoice WHERE id = -1205;
+
INSERT INTO test_result (test_name, success)
SELECT 'post-ap-run COGS is 62.50, (invoice 1, series 1)', sum(amount) = 62.5
from acc_trans
@@ -134,7 +190,14 @@
from acc_trans
where trans_id = -1203 and chart_id = -1102;
+-- Series 2, AP invoices first, cogs only added to AR
+
+
+-- Series 3, Mixed
+
+-- Series 4, AP Reversal
+
SELECT * FROM test_result;
SELECT (select count(*) from test_result where success is true)
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.