[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
SF.net SVN: ledger-smb:[6303] addons/1.3/wxPOS
- Subject: SF.net SVN: ledger-smb:[6303] addons/1.3/wxPOS
- From: ..hidden..
- Date: Thu, 21 Nov 2013 13:13:19 +0000
Revision: 6303
http://sourceforge.net/p/ledger-smb/code/6303
Author: einhverfr
Date: 2013-11-21 13:13:16 +0000 (Thu, 21 Nov 2013)
Log Message:
-----------
AR and AP invoices post. However without a payment, things don't work
Modified Paths:
--------------
addons/1.3/wxPOS/WXPOS/UI/AP/Pay.pm
addons/1.3/wxPOS/WXPOS/UI/AR/Pay.pm
addons/1.3/wxPOS/setup/invoices.sql
Modified: addons/1.3/wxPOS/WXPOS/UI/AP/Pay.pm
===================================================================
--- addons/1.3/wxPOS/WXPOS/UI/AP/Pay.pm 2013-11-21 11:38:29 UTC (rev 6302)
+++ addons/1.3/wxPOS/WXPOS/UI/AP/Pay.pm 2013-11-21 13:13:16 UTC (rev 6303)
@@ -176,7 +176,7 @@
my $line = {};
$line->{partnumber} = $list->GetItem($item, 0)->GetText();
$line->{sellprice} = $list->GetItem($item, 2)->GetText();
- $line->{qty} = $list->GetItem($item, 6)->GetText();
+ $line->{qty} = $list->GetItem($item, 5)->GetText();
push @$lines, $line;
}
Modified: addons/1.3/wxPOS/WXPOS/UI/AR/Pay.pm
===================================================================
--- addons/1.3/wxPOS/WXPOS/UI/AR/Pay.pm 2013-11-21 11:38:29 UTC (rev 6302)
+++ addons/1.3/wxPOS/WXPOS/UI/AR/Pay.pm 2013-11-21 13:13:16 UTC (rev 6303)
@@ -183,7 +183,7 @@
my $line = {};
$line->{partnumber} = $list->GetItem($item, 0)->GetText();
$line->{sellprice} = $list->GetItem($item, 2)->GetText();
- $line->{qty} = $list->GetItem($item, 6)->GetText();
+ $line->{qty} = $list->GetItem($item, 5)->GetText();
push @$lines, $line;
}
Modified: addons/1.3/wxPOS/setup/invoices.sql
===================================================================
--- addons/1.3/wxPOS/setup/invoices.sql 2013-11-21 11:38:29 UTC (rev 6302)
+++ addons/1.3/wxPOS/setup/invoices.sql 2013-11-21 13:13:16 UTC (rev 6303)
@@ -23,7 +23,7 @@
INSERT INTO acc_trans
(trans_id, transdate, chart_id, amount, approved)
- SELECT currval('id')::int, $2, a.id, $4 * -1, true
+ SELECT currval('id')::int, $2, a.id, $4, true
FROM account a WHERE accno = $16;
SELECT currval('id')::int;
@@ -52,7 +52,7 @@
INSERT INTO acc_trans
(trans_id, transdate, chart_id, amount, approved)
- SELECT currval('id')::int, $2, a.id, $4, true
+ SELECT currval('id')::int, $2, a.id, $4 * -1, true
FROM account a WHERE accno = $16;
SELECT currval('id')::int;
@@ -151,14 +151,14 @@
-- inventory
INSERT INTO acc_trans (trans_id, chart_id, transdate, amount, approved,
invoice_id)
- SELECT in_id, p.income_accno_id, a.transdate, i.qty * i.sellprice , true, i.id
+ SELECT in_id, p.income_accno_id, a.transdate, i.qty * i.sellprice * -1, true, i.id
FROM parts p
JOIN invoice i ON i.parts_id = p.id
JOIN ar a ON i.trans_id = a.id AND a.id = in_id;
-- transaction should now be balanced if this was done with invoice__begin_ar
-- add cogs
- PERFORM cogs__add_for_ap(parts_id, qty)
+ PERFORM cogs__add_for_ap(parts_id, qty, sellprice)
FROM invoice WHERE trans_id = in_id;
-- check if transaction is balanced, else raise exception
@@ -178,11 +178,12 @@
CREATE OR REPLACE FUNCTION invoice__finalize_ar(in_id int)
returns bool language plpgsql as
$$
+DECLARE balance numeric;
BEGIN
-- income
INSERT INTO acc_trans (trans_id, chart_id, transdate, amount, approved,
invoice_id)
- SELECT in_id, p.income_accno_id, a.transdate, i.qty * i.sellprice * -1, true, i.id
+ SELECT in_id, p.income_accno_id, a.transdate, i.qty * i.sellprice , true, i.id
FROM parts p
JOIN invoice i ON i.parts_id = p.id
JOIN ar a ON i.trans_id = a.id AND a.id = in_id;
@@ -193,12 +194,12 @@
FROM invoice WHERE trans_id = in_id;
-- check if transaction is balanced, else raise exception
- PERFORM trans_id FROM acc_trans
+ SELECT sum(amount) INTO balance FROM acc_trans
WHERE trans_id = in_id
- GROUP BY trans_id
HAVING sum(amount) <> 0;
IF FOUND THEN
+ RAISE WARNING 'Balance: %', balance;
RAISE EXCEPTION 'Out of balance';
END IF;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
------------------------------------------------------------------------------
Shape the Mobile Experience: Free Subscription
Software experts and developers: Be at the forefront of tech innovation.
Intel(R) Software Adrenaline delivers strategic insight and game-changing
conversations that shape the rapidly evolving mobile landscape. Sign up now.
http://pubads.g.doubleclick.net/gampad/clk?id=63431311&iu=/4140/ostg.clktrk
_______________________________________________
Ledger-smb-commits mailing list
..hidden..
https://lists.sourceforge.net/lists/listinfo/ledger-smb-commits