r16249 - gnucash/trunk - Overpayment for bills records wrong amount (#447269)
Derek Atkins
warlord at cvs.gnucash.org
Wed Jul 4 15:10:04 EDT 2007
Author: warlord
Date: 2007-07-04 15:10:03 -0400 (Wed, 04 Jul 2007)
New Revision: 16249
Trac: http://svn.gnucash.org/trac/changeset/16249
Modified:
gnucash/trunk/
gnucash/trunk/src/business/business-core/gncInvoice.c
Log:
Overpayment for bills records wrong amount (#447269)
Patch by Mark Jenkins to improve the sign checking and not improperly
reverse the sign of the amount.
Property changes on: gnucash/trunk
___________________________________________________________________
Name: svk:merge
- 3889ce50-311e-0410-a464-f059747ec5d1:/local/gnucash/branches/swig-redo:802
3889ce50-311e-0410-a464-f059747ec5d1:/local/gnucash/trunk:1037
57a11ea4-9604-0410-9ed3-97b8803252fd:/gnucash/branches/gobject-engine-dev-warlord:15827
d2ab10a8-8a95-4986-baff-8d511d9f15b2:/local/gnucash/branches/gobject-engine-dev-warlord:14369
d2ab10a8-8a95-4986-baff-8d511d9f15b2:/local/gnucash/branches/gobject-engine-dev-warlord1:14446
d2ab10a8-8a95-4986-baff-8d511d9f15b2:/local/gnucash/trunk:14601
d2ab10a8-8a95-4986-baff-8d511d9f15b2:/local/gnucash/trunk2:14762
+ 3889ce50-311e-0410-a464-f059747ec5d1:/local/gnucash/branches/swig-redo:802
3889ce50-311e-0410-a464-f059747ec5d1:/local/gnucash/trunk:1037
57a11ea4-9604-0410-9ed3-97b8803252fd:/gnucash/branches/gobject-engine-dev-warlord:15827
d2ab10a8-8a95-4986-baff-8d511d9f15b2:/local/gnucash/branches/gobject-engine-dev-warlord:14369
d2ab10a8-8a95-4986-baff-8d511d9f15b2:/local/gnucash/branches/gobject-engine-dev-warlord1:14446
d2ab10a8-8a95-4986-baff-8d511d9f15b2:/local/gnucash/trunk:14601
d2ab10a8-8a95-4986-baff-8d511d9f15b2:/local/gnucash/trunk2:14896
Modified: gnucash/trunk/src/business/business-core/gncInvoice.c
===================================================================
--- gnucash/trunk/src/business/business-core/gncInvoice.c 2007-07-04 10:42:57 UTC (rev 16248)
+++ gnucash/trunk/src/business/business-core/gncInvoice.c 2007-07-04 19:10:03 UTC (rev 16249)
@@ -1107,12 +1107,16 @@
/* check the lot -- if we still look like a payment lot, then that
* means we need to create a balancing split and create a new payment
* lot for the next invoice
+ *
+ * we're looking for a positive balance for bill/AP, and a negative balance
+ * for invoice/AR.
+ * (because bill payments debit AP accounts and invoice payments
+ * credit AR accounts)
*/
total = gnc_lot_get_balance (lot);
- if (!reverse)
- total = gnc_numeric_neg (total);
-
- if (gnc_numeric_negative_p (total)) {
+
+ if ( (gnc_numeric_negative_p (total) && reverse) ||
+ (gnc_numeric_positive_p (total) && !reverse) ) {
Transaction *t2;
GNCLot *lot2;
Split *split;
@@ -1143,6 +1147,8 @@
xaccSplitSetAction (split, action2);
xaccAccountInsertSplit (acc, split);
xaccTransAppendSplit (t2, split);
+ // the value of total used here is correct for both bill/AP and
+ // invoice/AR. See the comment before this if block
xaccSplitSetBaseValue (split, gnc_numeric_neg (total),
invoice->currency);
gnc_lot_add_split (lot, split);
More information about the gnucash-changes
mailing list