mirror of
https://github.com/Gnucash/gnucash.git
synced 2025-02-25 18:55:30 -06:00
Create a new lot when an invoice is posted
git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@6893 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
parent
cd8551e563
commit
ed360101be
@ -18,6 +18,7 @@
|
|||||||
#include "GNCIdP.h"
|
#include "GNCIdP.h"
|
||||||
#include "QueryObject.h"
|
#include "QueryObject.h"
|
||||||
#include "gnc-event-p.h"
|
#include "gnc-event-p.h"
|
||||||
|
#include "gnc-lot.h"
|
||||||
|
|
||||||
#include "gncBusiness.h"
|
#include "gncBusiness.h"
|
||||||
#include "gncEntry.h"
|
#include "gncEntry.h"
|
||||||
@ -416,6 +417,7 @@ Transaction * gncInvoicePostToAccount (GncInvoice *invoice, Account *acc,
|
|||||||
const char * memo)
|
const char * memo)
|
||||||
{
|
{
|
||||||
Transaction *txn;
|
Transaction *txn;
|
||||||
|
GNCLot *lot;
|
||||||
GList *iter;
|
GList *iter;
|
||||||
GList *splitinfo = NULL;
|
GList *splitinfo = NULL;
|
||||||
gnc_numeric total;
|
gnc_numeric total;
|
||||||
@ -430,6 +432,10 @@ Transaction * gncInvoicePostToAccount (GncInvoice *invoice, Account *acc,
|
|||||||
|
|
||||||
reverse = (gncInvoiceGetOwnerType (invoice) == GNC_OWNER_CUSTOMER);
|
reverse = (gncInvoiceGetOwnerType (invoice) == GNC_OWNER_CUSTOMER);
|
||||||
|
|
||||||
|
/* Create a new lot for this invoice */
|
||||||
|
lot = gnc_lot_new (invoice->book);
|
||||||
|
|
||||||
|
/* Create a new transaction */
|
||||||
txn = xaccMallocTransaction (invoice->book);
|
txn = xaccMallocTransaction (invoice->book);
|
||||||
xaccTransBeginEdit (txn);
|
xaccTransBeginEdit (txn);
|
||||||
|
|
||||||
@ -512,8 +518,11 @@ Transaction * gncInvoicePostToAccount (GncInvoice *invoice, Account *acc,
|
|||||||
/* Now create the Posted split (which is negative -- it's a credit) */
|
/* Now create the Posted split (which is negative -- it's a credit) */
|
||||||
{
|
{
|
||||||
Split *split = xaccMallocSplit (invoice->book);
|
Split *split = xaccMallocSplit (invoice->book);
|
||||||
/* Set action/memo */
|
|
||||||
|
|
||||||
|
/* add this split to the lot */
|
||||||
|
gnc_lot_add_split (lot, split);
|
||||||
|
|
||||||
|
/* Set action/memo */
|
||||||
xaccSplitSetMemo (split, memo);
|
xaccSplitSetMemo (split, memo);
|
||||||
xaccSplitSetAction (split, gncInvoiceGetType (invoice));
|
xaccSplitSetAction (split, gncInvoiceGetType (invoice));
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user