mirror of
https://github.com/Gnucash/gnucash.git
synced 2025-02-25 18:55:30 -06:00
* integrate the Billing Terms into the Core, GUI, and XML Backend
for the rest of the business objects that need billing terms. git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@6994 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
parent
64555fa8c3
commit
00a335aca1
@ -1,5 +1,8 @@
|
|||||||
2002-06-21 Derek Atkins <derek@ihtfp.com>
|
2002-06-21 Derek Atkins <derek@ihtfp.com>
|
||||||
|
|
||||||
|
* integrate the Billing Terms into the Core, GUI, and XML Backend
|
||||||
|
for the rest of the business objects that need billing terms.
|
||||||
|
|
||||||
* .../business-core/gncBillTerm*.[ch]: Add Billing Term objects.
|
* .../business-core/gncBillTerm*.[ch]: Add Billing Term objects.
|
||||||
Currently there are "Days" and "Proximo" billing terms available.
|
Currently there are "Days" and "Proximo" billing terms available.
|
||||||
|
|
||||||
|
@ -41,6 +41,7 @@
|
|||||||
#include "io-gncxml-gen.h"
|
#include "io-gncxml-gen.h"
|
||||||
#include "io-gncxml-v2.h"
|
#include "io-gncxml-v2.h"
|
||||||
|
|
||||||
|
#include "gncBillTermP.h"
|
||||||
#include "gncCustomerP.h"
|
#include "gncCustomerP.h"
|
||||||
#include "gnc-customer-xml-v2.h"
|
#include "gnc-customer-xml-v2.h"
|
||||||
#include "gnc-address-xml-v2.h"
|
#include "gnc-address-xml-v2.h"
|
||||||
@ -81,6 +82,7 @@ customer_dom_tree_create (GncCustomer *cust)
|
|||||||
{
|
{
|
||||||
xmlNodePtr ret;
|
xmlNodePtr ret;
|
||||||
gnc_numeric num;
|
gnc_numeric num;
|
||||||
|
GncBillTerm *term;
|
||||||
|
|
||||||
ret = xmlNewNode(NULL, gnc_customer_string);
|
ret = xmlNewNode(NULL, gnc_customer_string);
|
||||||
xmlSetProp(ret, "version", customer_version_string);
|
xmlSetProp(ret, "version", customer_version_string);
|
||||||
@ -101,7 +103,11 @@ customer_dom_tree_create (GncCustomer *cust)
|
|||||||
gncCustomerGetShipAddr (cust)));
|
gncCustomerGetShipAddr (cust)));
|
||||||
|
|
||||||
maybe_add_string (ret, cust_notes_string, gncCustomerGetNotes (cust));
|
maybe_add_string (ret, cust_notes_string, gncCustomerGetNotes (cust));
|
||||||
maybe_add_string (ret, cust_terms_string, gncCustomerGetTerms (cust));
|
|
||||||
|
term = gncCustomerGetTerms (cust);
|
||||||
|
if (term)
|
||||||
|
xmlAddChild(ret, guid_to_dom_tree(cust_terms_string,
|
||||||
|
gncBillTermGetGUID (term)));
|
||||||
|
|
||||||
xmlAddChild(ret, int_to_dom_tree(cust_taxincluded_string,
|
xmlAddChild(ret, int_to_dom_tree(cust_taxincluded_string,
|
||||||
gncCustomerGetTaxIncluded (cust)));
|
gncCustomerGetTaxIncluded (cust)));
|
||||||
@ -195,8 +201,22 @@ static gboolean
|
|||||||
customer_terms_handler (xmlNodePtr node, gpointer cust_pdata)
|
customer_terms_handler (xmlNodePtr node, gpointer cust_pdata)
|
||||||
{
|
{
|
||||||
struct customer_pdata *pdata = cust_pdata;
|
struct customer_pdata *pdata = cust_pdata;
|
||||||
|
GUID *guid;
|
||||||
|
GncBillTerm *term;
|
||||||
|
|
||||||
return set_string(node, pdata->customer, gncCustomerSetTerms);
|
guid = dom_tree_to_guid(node);
|
||||||
|
g_return_val_if_fail (guid, FALSE);
|
||||||
|
term = gncBillTermLookup (pdata->book, guid);
|
||||||
|
if (!term) {
|
||||||
|
term = gncBillTermCreate (pdata->book);
|
||||||
|
gncBillTermSetGUID (term, guid);
|
||||||
|
} else
|
||||||
|
gncBillTermDecRef (term);
|
||||||
|
|
||||||
|
g_free (guid);
|
||||||
|
gncCustomerSetTerms (pdata->customer, term);
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
|
@ -41,6 +41,7 @@
|
|||||||
#include "io-gncxml-gen.h"
|
#include "io-gncxml-gen.h"
|
||||||
#include "io-gncxml-v2.h"
|
#include "io-gncxml-v2.h"
|
||||||
|
|
||||||
|
#include "gncBillTermP.h"
|
||||||
#include "gncInvoiceP.h"
|
#include "gncInvoiceP.h"
|
||||||
#include "gnc-invoice-xml-v2.h"
|
#include "gnc-invoice-xml-v2.h"
|
||||||
#include "gnc-owner-xml-v2.h"
|
#include "gnc-owner-xml-v2.h"
|
||||||
@ -90,6 +91,7 @@ invoice_dom_tree_create (GncInvoice *invoice)
|
|||||||
Timespec ts;
|
Timespec ts;
|
||||||
Transaction *txn;
|
Transaction *txn;
|
||||||
Account *acc;
|
Account *acc;
|
||||||
|
GncBillTerm *term;
|
||||||
|
|
||||||
ret = xmlNewNode(NULL, gnc_invoice_string);
|
ret = xmlNewNode(NULL, gnc_invoice_string);
|
||||||
xmlSetProp(ret, "version", invoice_version_string);
|
xmlSetProp(ret, "version", invoice_version_string);
|
||||||
@ -109,7 +111,11 @@ invoice_dom_tree_create (GncInvoice *invoice)
|
|||||||
maybe_add_timespec (ret, invoice_posted_string,
|
maybe_add_timespec (ret, invoice_posted_string,
|
||||||
gncInvoiceGetDatePosted (invoice));
|
gncInvoiceGetDatePosted (invoice));
|
||||||
|
|
||||||
maybe_add_string (ret, invoice_terms_string, gncInvoiceGetTerms (invoice));
|
term = gncInvoiceGetTerms (invoice);
|
||||||
|
if (term)
|
||||||
|
xmlAddChild(ret, guid_to_dom_tree(invoice_terms_string,
|
||||||
|
gncBillTermGetGUID (term)));
|
||||||
|
|
||||||
maybe_add_string (ret, invoice_billing_id_string,
|
maybe_add_string (ret, invoice_billing_id_string,
|
||||||
gncInvoiceGetBillingID (invoice));
|
gncInvoiceGetBillingID (invoice));
|
||||||
maybe_add_string (ret, invoice_notes_string, gncInvoiceGetNotes (invoice));
|
maybe_add_string (ret, invoice_notes_string, gncInvoiceGetNotes (invoice));
|
||||||
@ -229,14 +235,6 @@ invoice_posted_handler (xmlNodePtr node, gpointer invoice_pdata)
|
|||||||
return set_timespec (node, pdata->invoice, gncInvoiceSetDatePosted);
|
return set_timespec (node, pdata->invoice, gncInvoiceSetDatePosted);
|
||||||
}
|
}
|
||||||
|
|
||||||
static gboolean
|
|
||||||
invoice_terms_handler (xmlNodePtr node, gpointer invoice_pdata)
|
|
||||||
{
|
|
||||||
struct invoice_pdata *pdata = invoice_pdata;
|
|
||||||
|
|
||||||
return set_string(node, pdata->invoice, gncInvoiceSetTerms);
|
|
||||||
}
|
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
invoice_billing_id_handler (xmlNodePtr node, gpointer invoice_pdata)
|
invoice_billing_id_handler (xmlNodePtr node, gpointer invoice_pdata)
|
||||||
{
|
{
|
||||||
@ -267,6 +265,28 @@ invoice_active_handler (xmlNodePtr node, gpointer invoice_pdata)
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static gboolean
|
||||||
|
invoice_terms_handler (xmlNodePtr node, gpointer invoice_pdata)
|
||||||
|
{
|
||||||
|
struct invoice_pdata *pdata = invoice_pdata;
|
||||||
|
GUID *guid;
|
||||||
|
GncBillTerm *term;
|
||||||
|
|
||||||
|
guid = dom_tree_to_guid(node);
|
||||||
|
g_return_val_if_fail (guid, FALSE);
|
||||||
|
term = gncBillTermLookup (pdata->book, guid);
|
||||||
|
if (!term) {
|
||||||
|
term = gncBillTermCreate (pdata->book);
|
||||||
|
gncBillTermSetGUID (term, guid);
|
||||||
|
} else
|
||||||
|
gncBillTermDecRef (term);
|
||||||
|
|
||||||
|
g_free (guid);
|
||||||
|
gncInvoiceSetTerms (pdata->invoice, term);
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
invoice_posttxn_handler (xmlNodePtr node, gpointer invoice_pdata)
|
invoice_posttxn_handler (xmlNodePtr node, gpointer invoice_pdata)
|
||||||
{
|
{
|
||||||
@ -321,10 +341,10 @@ static struct dom_tree_handler invoice_handlers_v2[] = {
|
|||||||
{ invoice_owner_string, invoice_owner_handler, 1, 0 },
|
{ invoice_owner_string, invoice_owner_handler, 1, 0 },
|
||||||
{ invoice_opened_string, invoice_opened_handler, 1, 0 },
|
{ invoice_opened_string, invoice_opened_handler, 1, 0 },
|
||||||
{ invoice_posted_string, invoice_posted_handler, 0, 0 },
|
{ invoice_posted_string, invoice_posted_handler, 0, 0 },
|
||||||
{ invoice_terms_string, invoice_terms_handler, 0, 0 },
|
|
||||||
{ invoice_billing_id_string, invoice_billing_id_handler, 0, 0 },
|
{ invoice_billing_id_string, invoice_billing_id_handler, 0, 0 },
|
||||||
{ invoice_notes_string, invoice_notes_handler, 0, 0 },
|
{ invoice_notes_string, invoice_notes_handler, 0, 0 },
|
||||||
{ invoice_active_string, invoice_active_handler, 1, 0 },
|
{ invoice_active_string, invoice_active_handler, 1, 0 },
|
||||||
|
{ invoice_terms_string, invoice_terms_handler, 0, 0 },
|
||||||
{ invoice_posttxn_string, invoice_posttxn_handler, 0, 0 },
|
{ invoice_posttxn_string, invoice_posttxn_handler, 0, 0 },
|
||||||
{ invoice_postacc_string, invoice_postacc_handler, 0, 0 },
|
{ invoice_postacc_string, invoice_postacc_handler, 0, 0 },
|
||||||
{ invoice_commodity_string, invoice_commodity_handler, 1, 0 },
|
{ invoice_commodity_string, invoice_commodity_handler, 1, 0 },
|
||||||
|
@ -41,6 +41,7 @@
|
|||||||
#include "io-gncxml-gen.h"
|
#include "io-gncxml-gen.h"
|
||||||
#include "io-gncxml-v2.h"
|
#include "io-gncxml-v2.h"
|
||||||
|
|
||||||
|
#include "gncBillTermP.h"
|
||||||
#include "gncVendorP.h"
|
#include "gncVendorP.h"
|
||||||
#include "gnc-vendor-xml-v2.h"
|
#include "gnc-vendor-xml-v2.h"
|
||||||
#include "gnc-address-xml-v2.h"
|
#include "gnc-address-xml-v2.h"
|
||||||
@ -77,6 +78,7 @@ static xmlNodePtr
|
|||||||
vendor_dom_tree_create (GncVendor *vendor)
|
vendor_dom_tree_create (GncVendor *vendor)
|
||||||
{
|
{
|
||||||
xmlNodePtr ret;
|
xmlNodePtr ret;
|
||||||
|
GncBillTerm *term;
|
||||||
|
|
||||||
ret = xmlNewNode(NULL, gnc_vendor_string);
|
ret = xmlNewNode(NULL, gnc_vendor_string);
|
||||||
xmlSetProp(ret, "version", vendor_version_string);
|
xmlSetProp(ret, "version", vendor_version_string);
|
||||||
@ -94,7 +96,11 @@ vendor_dom_tree_create (GncVendor *vendor)
|
|||||||
gncVendorGetAddr (vendor)));
|
gncVendorGetAddr (vendor)));
|
||||||
|
|
||||||
maybe_add_string (ret, vendor_notes_string, gncVendorGetNotes (vendor));
|
maybe_add_string (ret, vendor_notes_string, gncVendorGetNotes (vendor));
|
||||||
maybe_add_string (ret, vendor_terms_string, gncVendorGetTerms (vendor));
|
|
||||||
|
term = gncVendorGetTerms (vendor);
|
||||||
|
if (term)
|
||||||
|
xmlAddChild(ret, guid_to_dom_tree(vendor_terms_string,
|
||||||
|
gncBillTermGetGUID (term)));
|
||||||
|
|
||||||
xmlAddChild(ret, int_to_dom_tree(vendor_taxincluded_string,
|
xmlAddChild(ret, int_to_dom_tree(vendor_taxincluded_string,
|
||||||
gncVendorGetTaxIncluded (vendor)));
|
gncVendorGetTaxIncluded (vendor)));
|
||||||
@ -182,8 +188,22 @@ static gboolean
|
|||||||
vendor_terms_handler (xmlNodePtr node, gpointer vendor_pdata)
|
vendor_terms_handler (xmlNodePtr node, gpointer vendor_pdata)
|
||||||
{
|
{
|
||||||
struct vendor_pdata *pdata = vendor_pdata;
|
struct vendor_pdata *pdata = vendor_pdata;
|
||||||
|
GUID *guid;
|
||||||
|
GncBillTerm *term;
|
||||||
|
|
||||||
return set_string(node, pdata->vendor, gncVendorSetTerms);
|
guid = dom_tree_to_guid(node);
|
||||||
|
g_return_val_if_fail (guid, FALSE);
|
||||||
|
term = gncBillTermLookup (pdata->book, guid);
|
||||||
|
if (!term) {
|
||||||
|
term = gncBillTermCreate (pdata->book);
|
||||||
|
gncBillTermSetGUID (term, guid);
|
||||||
|
} else
|
||||||
|
gncBillTermDecRef (term);
|
||||||
|
|
||||||
|
g_free (guid);
|
||||||
|
gncVendorSetTerms (pdata->vendor, term);
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
|
@ -29,7 +29,7 @@ struct _gncCustomer {
|
|||||||
char * id;
|
char * id;
|
||||||
char * name;
|
char * name;
|
||||||
char * notes;
|
char * notes;
|
||||||
char * terms;
|
GncBillTerm * terms;
|
||||||
GncAddress * addr;
|
GncAddress * addr;
|
||||||
GncAddress * shipaddr;
|
GncAddress * shipaddr;
|
||||||
gnc_commodity * commodity;
|
gnc_commodity * commodity;
|
||||||
@ -72,7 +72,6 @@ GncCustomer *gncCustomerCreate (GNCBook *book)
|
|||||||
cust->id = CACHE_INSERT ("");
|
cust->id = CACHE_INSERT ("");
|
||||||
cust->name = CACHE_INSERT ("");
|
cust->name = CACHE_INSERT ("");
|
||||||
cust->notes = CACHE_INSERT ("");
|
cust->notes = CACHE_INSERT ("");
|
||||||
cust->terms = CACHE_INSERT ("Net-30");
|
|
||||||
cust->addr = gncAddressCreate (book, &cust->guid);
|
cust->addr = gncAddressCreate (book, &cust->guid);
|
||||||
cust->shipaddr = gncAddressCreate (book, &cust->guid);
|
cust->shipaddr = gncAddressCreate (book, &cust->guid);
|
||||||
cust->discount = gnc_numeric_zero();
|
cust->discount = gnc_numeric_zero();
|
||||||
@ -98,7 +97,6 @@ void gncCustomerDestroy (GncCustomer *cust)
|
|||||||
CACHE_REMOVE (cust->id);
|
CACHE_REMOVE (cust->id);
|
||||||
CACHE_REMOVE (cust->name);
|
CACHE_REMOVE (cust->name);
|
||||||
CACHE_REMOVE (cust->notes);
|
CACHE_REMOVE (cust->notes);
|
||||||
CACHE_REMOVE (cust->terms);
|
|
||||||
gncAddressDestroy (cust->addr);
|
gncAddressDestroy (cust->addr);
|
||||||
gncAddressDestroy (cust->shipaddr);
|
gncAddressDestroy (cust->shipaddr);
|
||||||
g_list_free (cust->jobs);
|
g_list_free (cust->jobs);
|
||||||
@ -153,10 +151,15 @@ void gncCustomerSetGUID (GncCustomer *cust, const GUID *guid)
|
|||||||
addObj (cust);
|
addObj (cust);
|
||||||
}
|
}
|
||||||
|
|
||||||
void gncCustomerSetTerms (GncCustomer *cust, const char *terms)
|
void gncCustomerSetTerms (GncCustomer *cust, GncBillTerm *terms)
|
||||||
{
|
{
|
||||||
if (!cust || !terms) return;
|
if (!cust) return;
|
||||||
SET_STR(cust->terms, terms);
|
if (cust->terms == terms) return;
|
||||||
|
if (cust->terms)
|
||||||
|
gncBillTermDecRef (cust->terms);
|
||||||
|
cust->terms = terms;
|
||||||
|
if (cust->terms)
|
||||||
|
gncBillTermIncRef (cust->terms);
|
||||||
mark_customer (cust);
|
mark_customer (cust);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -286,7 +289,7 @@ const char * gncCustomerGetNotes (GncCustomer *cust)
|
|||||||
return cust->notes;
|
return cust->notes;
|
||||||
}
|
}
|
||||||
|
|
||||||
const char * gncCustomerGetTerms (GncCustomer *cust)
|
GncBillTerm * gncCustomerGetTerms (GncCustomer *cust)
|
||||||
{
|
{
|
||||||
if (!cust) return NULL;
|
if (!cust) return NULL;
|
||||||
return cust->terms;
|
return cust->terms;
|
||||||
|
@ -11,6 +11,7 @@ typedef struct _gncCustomer GncCustomer;
|
|||||||
|
|
||||||
#include "gnc-book.h"
|
#include "gnc-book.h"
|
||||||
#include "gncAddress.h"
|
#include "gncAddress.h"
|
||||||
|
#include "gncBillTerm.h"
|
||||||
#include "gncJob.h"
|
#include "gncJob.h"
|
||||||
|
|
||||||
#include "gnc-numeric.h"
|
#include "gnc-numeric.h"
|
||||||
@ -27,7 +28,7 @@ void gncCustomerDestroy (GncCustomer *customer);
|
|||||||
void gncCustomerSetID (GncCustomer *customer, const char *id);
|
void gncCustomerSetID (GncCustomer *customer, const char *id);
|
||||||
void gncCustomerSetName (GncCustomer *customer, const char *name);
|
void gncCustomerSetName (GncCustomer *customer, const char *name);
|
||||||
void gncCustomerSetNotes (GncCustomer *customer, const char *notes);
|
void gncCustomerSetNotes (GncCustomer *customer, const char *notes);
|
||||||
void gncCustomerSetTerms (GncCustomer *customer, const char *terms);
|
void gncCustomerSetTerms (GncCustomer *customer, GncBillTerm *term);
|
||||||
void gncCustomerSetTaxIncluded (GncCustomer *customer, gboolean taxincl);
|
void gncCustomerSetTaxIncluded (GncCustomer *customer, gboolean taxincl);
|
||||||
void gncCustomerSetActive (GncCustomer *customer, gboolean active);
|
void gncCustomerSetActive (GncCustomer *customer, gboolean active);
|
||||||
void gncCustomerSetDiscount (GncCustomer *customer, gnc_numeric discount);
|
void gncCustomerSetDiscount (GncCustomer *customer, gnc_numeric discount);
|
||||||
@ -48,7 +49,7 @@ const char * gncCustomerGetName (GncCustomer *customer);
|
|||||||
GncAddress * gncCustomerGetAddr (GncCustomer *customer);
|
GncAddress * gncCustomerGetAddr (GncCustomer *customer);
|
||||||
GncAddress * gncCustomerGetShipAddr (GncCustomer *customer);
|
GncAddress * gncCustomerGetShipAddr (GncCustomer *customer);
|
||||||
const char * gncCustomerGetNotes (GncCustomer *customer);
|
const char * gncCustomerGetNotes (GncCustomer *customer);
|
||||||
const char * gncCustomerGetTerms (GncCustomer *customer);
|
GncBillTerm * gncCustomerGetTerms (GncCustomer *customer);
|
||||||
gboolean gncCustomerGetTaxIncluded (GncCustomer *customer);
|
gboolean gncCustomerGetTaxIncluded (GncCustomer *customer);
|
||||||
gboolean gncCustomerGetActive (GncCustomer *customer);
|
gboolean gncCustomerGetActive (GncCustomer *customer);
|
||||||
gnc_numeric gncCustomerGetDiscount (GncCustomer *customer);
|
gnc_numeric gncCustomerGetDiscount (GncCustomer *customer);
|
||||||
|
@ -33,9 +33,9 @@ struct _gncInvoice {
|
|||||||
GUID guid;
|
GUID guid;
|
||||||
char * id;
|
char * id;
|
||||||
char * notes;
|
char * notes;
|
||||||
char * terms;
|
|
||||||
char * billing_id;
|
char * billing_id;
|
||||||
char * printname;
|
char * printname;
|
||||||
|
GncBillTerm * terms;
|
||||||
GList * entries;
|
GList * entries;
|
||||||
GncOwner owner;
|
GncOwner owner;
|
||||||
GncJob * job;
|
GncJob * job;
|
||||||
@ -94,7 +94,6 @@ GncInvoice *gncInvoiceCreate (GNCBook *book)
|
|||||||
|
|
||||||
invoice->id = CACHE_INSERT ("");
|
invoice->id = CACHE_INSERT ("");
|
||||||
invoice->notes = CACHE_INSERT ("");
|
invoice->notes = CACHE_INSERT ("");
|
||||||
invoice->terms = CACHE_INSERT ("");
|
|
||||||
invoice->billing_id = CACHE_INSERT ("");
|
invoice->billing_id = CACHE_INSERT ("");
|
||||||
|
|
||||||
invoice->active = TRUE;
|
invoice->active = TRUE;
|
||||||
@ -115,7 +114,6 @@ void gncInvoiceDestroy (GncInvoice *invoice)
|
|||||||
|
|
||||||
CACHE_REMOVE (invoice->id);
|
CACHE_REMOVE (invoice->id);
|
||||||
CACHE_REMOVE (invoice->notes);
|
CACHE_REMOVE (invoice->notes);
|
||||||
CACHE_REMOVE (invoice->terms);
|
|
||||||
CACHE_REMOVE (invoice->billing_id);
|
CACHE_REMOVE (invoice->billing_id);
|
||||||
g_list_free (invoice->entries);
|
g_list_free (invoice->entries);
|
||||||
remObj (invoice);
|
remObj (invoice);
|
||||||
@ -168,10 +166,15 @@ void gncInvoiceSetDatePosted (GncInvoice *invoice, Timespec date)
|
|||||||
mark_invoice (invoice);
|
mark_invoice (invoice);
|
||||||
}
|
}
|
||||||
|
|
||||||
void gncInvoiceSetTerms (GncInvoice *invoice, const char *terms)
|
void gncInvoiceSetTerms (GncInvoice *invoice, GncBillTerm *terms)
|
||||||
{
|
{
|
||||||
if (!invoice) return;
|
if (!invoice) return;
|
||||||
SET_STR (invoice->terms, terms);
|
if (invoice->terms == terms) return;
|
||||||
|
if (invoice->terms)
|
||||||
|
gncBillTermDecRef (invoice->terms);
|
||||||
|
invoice->terms = terms;
|
||||||
|
if (invoice->terms)
|
||||||
|
gncBillTermIncRef (invoice->terms);
|
||||||
mark_invoice (invoice);
|
mark_invoice (invoice);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -306,7 +309,7 @@ Timespec gncInvoiceGetDateDue (GncInvoice *invoice)
|
|||||||
return xaccTransRetDateDueTS (txn);
|
return xaccTransRetDateDueTS (txn);
|
||||||
}
|
}
|
||||||
|
|
||||||
const char * gncInvoiceGetTerms (GncInvoice *invoice)
|
GncBillTerm * gncInvoiceGetTerms (GncInvoice *invoice)
|
||||||
{
|
{
|
||||||
if (!invoice) return 0;
|
if (!invoice) return 0;
|
||||||
return invoice->terms;
|
return invoice->terms;
|
||||||
@ -418,6 +421,12 @@ Transaction * gncInvoicePostToAccount (GncInvoice *invoice, Account *acc,
|
|||||||
|
|
||||||
if (!invoice || !acc) return NULL;
|
if (!invoice || !acc) return NULL;
|
||||||
|
|
||||||
|
/* Stabilize the Billing Terms of this invoice */
|
||||||
|
if (invoice->terms)
|
||||||
|
gncInvoiceSetTerms (invoice,
|
||||||
|
gncBillTermReturnChild (invoice->terms, TRUE));
|
||||||
|
|
||||||
|
/* Figure out if we need to "reverse" the numbers. */
|
||||||
reverse = (gncInvoiceGetOwnerType (invoice) == GNC_OWNER_CUSTOMER);
|
reverse = (gncInvoiceGetOwnerType (invoice) == GNC_OWNER_CUSTOMER);
|
||||||
|
|
||||||
/* Create a new lot for this invoice */
|
/* Create a new lot for this invoice */
|
||||||
@ -694,12 +703,12 @@ gboolean gncInvoiceRegister (void)
|
|||||||
{ INVOICE_DUE, QUERYCORE_DATE, (QueryAccess)gncInvoiceGetDateDue },
|
{ INVOICE_DUE, QUERYCORE_DATE, (QueryAccess)gncInvoiceGetDateDue },
|
||||||
{ INVOICE_POSTED, QUERYCORE_DATE, (QueryAccess)gncInvoiceGetDatePosted },
|
{ INVOICE_POSTED, QUERYCORE_DATE, (QueryAccess)gncInvoiceGetDatePosted },
|
||||||
{ INVOICE_IS_POSTED, QUERYCORE_BOOLEAN, (QueryAccess)gncInvoiceIsPosted },
|
{ INVOICE_IS_POSTED, QUERYCORE_BOOLEAN, (QueryAccess)gncInvoiceIsPosted },
|
||||||
{ INVOICE_TERMS, QUERYCORE_STRING, (QueryAccess)gncInvoiceGetTerms },
|
|
||||||
{ INVOICE_BILLINGID, QUERYCORE_STRING, (QueryAccess)gncInvoiceGetBillingID },
|
{ INVOICE_BILLINGID, QUERYCORE_STRING, (QueryAccess)gncInvoiceGetBillingID },
|
||||||
{ INVOICE_NOTES, QUERYCORE_STRING, (QueryAccess)gncInvoiceGetNotes },
|
{ INVOICE_NOTES, QUERYCORE_STRING, (QueryAccess)gncInvoiceGetNotes },
|
||||||
{ INVOICE_ACC, GNC_ID_ACCOUNT, (QueryAccess)gncInvoiceGetPostedAcc },
|
{ INVOICE_ACC, GNC_ID_ACCOUNT, (QueryAccess)gncInvoiceGetPostedAcc },
|
||||||
{ INVOICE_POST_TXN, GNC_ID_TRANS, (QueryAccess)gncInvoiceGetPostedTxn },
|
{ INVOICE_POST_TXN, GNC_ID_TRANS, (QueryAccess)gncInvoiceGetPostedTxn },
|
||||||
{ INVOICE_TYPE, QUERYCORE_STRING, (QueryAccess)gncInvoiceGetType },
|
{ INVOICE_TYPE, QUERYCORE_STRING, (QueryAccess)gncInvoiceGetType },
|
||||||
|
{ INVOICE_TERMS, GNC_BILLTERM_MODULE_NAME, (QueryAccess)gncInvoiceGetTerms },
|
||||||
{ QUERY_PARAM_BOOK, GNC_ID_BOOK, (QueryAccess)gncInvoiceGetBook },
|
{ QUERY_PARAM_BOOK, GNC_ID_BOOK, (QueryAccess)gncInvoiceGetBook },
|
||||||
{ QUERY_PARAM_GUID, QUERYCORE_GUID, (QueryAccess)gncInvoiceGetGUID },
|
{ QUERY_PARAM_GUID, QUERYCORE_GUID, (QueryAccess)gncInvoiceGetGUID },
|
||||||
{ NULL },
|
{ NULL },
|
||||||
|
@ -10,6 +10,7 @@
|
|||||||
struct _gncInvoice;
|
struct _gncInvoice;
|
||||||
typedef struct _gncInvoice GncInvoice;
|
typedef struct _gncInvoice GncInvoice;
|
||||||
|
|
||||||
|
#include "gncBillTerm.h"
|
||||||
#include "gncEntry.h"
|
#include "gncEntry.h"
|
||||||
#include "gncOwner.h"
|
#include "gncOwner.h"
|
||||||
|
|
||||||
@ -26,7 +27,7 @@ void gncInvoiceSetID (GncInvoice *invoice, const char *id);
|
|||||||
void gncInvoiceSetOwner (GncInvoice *invoice, GncOwner *owner);
|
void gncInvoiceSetOwner (GncInvoice *invoice, GncOwner *owner);
|
||||||
void gncInvoiceSetDateOpened (GncInvoice *invoice, Timespec date);
|
void gncInvoiceSetDateOpened (GncInvoice *invoice, Timespec date);
|
||||||
void gncInvoiceSetDatePosted (GncInvoice *invoice, Timespec date);
|
void gncInvoiceSetDatePosted (GncInvoice *invoice, Timespec date);
|
||||||
void gncInvoiceSetTerms (GncInvoice *invoice, const char *terms);
|
void gncInvoiceSetTerms (GncInvoice *invoice, GncBillTerm *terms);
|
||||||
void gncInvoiceSetBillingID (GncInvoice *invoice, const char *billing_id);
|
void gncInvoiceSetBillingID (GncInvoice *invoice, const char *billing_id);
|
||||||
void gncInvoiceSetNotes (GncInvoice *invoice, const char *notes);
|
void gncInvoiceSetNotes (GncInvoice *invoice, const char *notes);
|
||||||
void gncInvoiceSetCommonCommodity (GncInvoice *invoice, gnc_commodity *com);
|
void gncInvoiceSetCommonCommodity (GncInvoice *invoice, gnc_commodity *com);
|
||||||
@ -44,7 +45,7 @@ GncOwner * gncInvoiceGetOwner (GncInvoice *invoice);
|
|||||||
Timespec gncInvoiceGetDateOpened (GncInvoice *invoice);
|
Timespec gncInvoiceGetDateOpened (GncInvoice *invoice);
|
||||||
Timespec gncInvoiceGetDatePosted (GncInvoice *invoice);
|
Timespec gncInvoiceGetDatePosted (GncInvoice *invoice);
|
||||||
Timespec gncInvoiceGetDateDue (GncInvoice *invoice);
|
Timespec gncInvoiceGetDateDue (GncInvoice *invoice);
|
||||||
const char * gncInvoiceGetTerms (GncInvoice *invoice);
|
GncBillTerm * gncInvoiceGetTerms (GncInvoice *invoice);
|
||||||
const char * gncInvoiceGetBillingID (GncInvoice *invoice);
|
const char * gncInvoiceGetBillingID (GncInvoice *invoice);
|
||||||
const char * gncInvoiceGetNotes (GncInvoice *invoice);
|
const char * gncInvoiceGetNotes (GncInvoice *invoice);
|
||||||
const char * gncInvoiceGetType (GncInvoice *invoice);
|
const char * gncInvoiceGetType (GncInvoice *invoice);
|
||||||
|
@ -28,7 +28,7 @@ struct _gncVendor {
|
|||||||
char * id;
|
char * id;
|
||||||
char * name;
|
char * name;
|
||||||
char * notes;
|
char * notes;
|
||||||
char * terms;
|
GncBillTerm * terms;
|
||||||
GncAddress * addr;
|
GncAddress * addr;
|
||||||
gnc_commodity * commodity;
|
gnc_commodity * commodity;
|
||||||
gboolean taxincluded;
|
gboolean taxincluded;
|
||||||
@ -68,7 +68,6 @@ GncVendor *gncVendorCreate (GNCBook *book)
|
|||||||
vendor->id = CACHE_INSERT ("");
|
vendor->id = CACHE_INSERT ("");
|
||||||
vendor->name = CACHE_INSERT ("");
|
vendor->name = CACHE_INSERT ("");
|
||||||
vendor->notes = CACHE_INSERT ("");
|
vendor->notes = CACHE_INSERT ("");
|
||||||
vendor->terms = CACHE_INSERT ("");
|
|
||||||
vendor->addr = gncAddressCreate (book, &vendor->guid);
|
vendor->addr = gncAddressCreate (book, &vendor->guid);
|
||||||
vendor->taxincluded = FALSE;
|
vendor->taxincluded = FALSE;
|
||||||
vendor->active = TRUE;
|
vendor->active = TRUE;
|
||||||
@ -90,7 +89,6 @@ void gncVendorDestroy (GncVendor *vendor)
|
|||||||
CACHE_REMOVE (vendor->id);
|
CACHE_REMOVE (vendor->id);
|
||||||
CACHE_REMOVE (vendor->name);
|
CACHE_REMOVE (vendor->name);
|
||||||
CACHE_REMOVE (vendor->notes);
|
CACHE_REMOVE (vendor->notes);
|
||||||
CACHE_REMOVE (vendor->terms);
|
|
||||||
gncAddressDestroy (vendor->addr);
|
gncAddressDestroy (vendor->addr);
|
||||||
g_list_free (vendor->jobs);
|
g_list_free (vendor->jobs);
|
||||||
|
|
||||||
@ -144,10 +142,15 @@ void gncVendorSetGUID (GncVendor *vendor, const GUID *guid)
|
|||||||
addObj (vendor);
|
addObj (vendor);
|
||||||
}
|
}
|
||||||
|
|
||||||
void gncVendorSetTerms (GncVendor *vendor, const char *terms)
|
void gncVendorSetTerms (GncVendor *vendor, GncBillTerm *terms)
|
||||||
{
|
{
|
||||||
if (!vendor || !terms) return;
|
if (!vendor) return;
|
||||||
SET_STR(vendor->terms, terms);
|
if (vendor->terms == terms) return;
|
||||||
|
if (vendor->terms)
|
||||||
|
gncBillTermDecRef (vendor->terms);
|
||||||
|
vendor->terms = terms;
|
||||||
|
if (vendor->terms)
|
||||||
|
gncBillTermDecRef (vendor->terms);
|
||||||
mark_vendor (vendor);
|
mark_vendor (vendor);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -215,7 +218,7 @@ const char * gncVendorGetNotes (GncVendor *vendor)
|
|||||||
return vendor->notes;
|
return vendor->notes;
|
||||||
}
|
}
|
||||||
|
|
||||||
const char * gncVendorGetTerms (GncVendor *vendor)
|
GncBillTerm * gncVendorGetTerms (GncVendor *vendor)
|
||||||
{
|
{
|
||||||
if (!vendor) return 0;
|
if (!vendor) return 0;
|
||||||
return vendor->terms;
|
return vendor->terms;
|
||||||
|
@ -11,6 +11,7 @@ typedef struct _gncVendor GncVendor;
|
|||||||
|
|
||||||
#include "gnc-book.h"
|
#include "gnc-book.h"
|
||||||
#include "gncAddress.h"
|
#include "gncAddress.h"
|
||||||
|
#include "gncBillTerm.h"
|
||||||
#include "gncJob.h"
|
#include "gncJob.h"
|
||||||
|
|
||||||
#define GNC_VENDOR_MODULE_NAME "gncVendor"
|
#define GNC_VENDOR_MODULE_NAME "gncVendor"
|
||||||
@ -25,7 +26,7 @@ void gncVendorDestroy (GncVendor *vendor);
|
|||||||
void gncVendorSetID (GncVendor *vendor, const char *id);
|
void gncVendorSetID (GncVendor *vendor, const char *id);
|
||||||
void gncVendorSetName (GncVendor *vendor, const char *name);
|
void gncVendorSetName (GncVendor *vendor, const char *name);
|
||||||
void gncVendorSetNotes (GncVendor *vendor, const char *notes);
|
void gncVendorSetNotes (GncVendor *vendor, const char *notes);
|
||||||
void gncVendorSetTerms (GncVendor *vendor, const char *terms);
|
void gncVendorSetTerms (GncVendor *vendor, GncBillTerm *terms);
|
||||||
void gncVendorSetTaxIncluded (GncVendor *vendor, gboolean taxincl);
|
void gncVendorSetTaxIncluded (GncVendor *vendor, gboolean taxincl);
|
||||||
void gncVendorSetCommodity (GncVendor *vendor, gnc_commodity *com);
|
void gncVendorSetCommodity (GncVendor *vendor, gnc_commodity *com);
|
||||||
void gncVendorSetActive (GncVendor *vendor, gboolean active);
|
void gncVendorSetActive (GncVendor *vendor, gboolean active);
|
||||||
@ -43,7 +44,7 @@ const char * gncVendorGetID (GncVendor *vendor);
|
|||||||
const char * gncVendorGetName (GncVendor *vendor);
|
const char * gncVendorGetName (GncVendor *vendor);
|
||||||
GncAddress * gncVendorGetAddr (GncVendor *vendor);
|
GncAddress * gncVendorGetAddr (GncVendor *vendor);
|
||||||
const char * gncVendorGetNotes (GncVendor *vendor);
|
const char * gncVendorGetNotes (GncVendor *vendor);
|
||||||
const char * gncVendorGetTerms (GncVendor *vendor);
|
GncBillTerm * gncVendorGetTerms (GncVendor *vendor);
|
||||||
gboolean gncVendorGetTaxIncluded (GncVendor *vendor);
|
gboolean gncVendorGetTaxIncluded (GncVendor *vendor);
|
||||||
gnc_commodity * gncVendorGetCommodity (GncVendor *vendor);
|
gnc_commodity * gncVendorGetCommodity (GncVendor *vendor);
|
||||||
gboolean gncVendorGetActive (GncVendor *vendor);
|
gboolean gncVendorGetActive (GncVendor *vendor);
|
||||||
|
@ -34,6 +34,7 @@
|
|||||||
(lambda (wrapset client-wrapset)
|
(lambda (wrapset client-wrapset)
|
||||||
(list
|
(list
|
||||||
"#include <gncAddress.h>\n"
|
"#include <gncAddress.h>\n"
|
||||||
|
"#include <gncBillTerm.h>\n"
|
||||||
"#include <gncCustomer.h>\n"
|
"#include <gncCustomer.h>\n"
|
||||||
"#include <gncEmployee.h>\n"
|
"#include <gncEmployee.h>\n"
|
||||||
"#include <gncEntry.h>\n"
|
"#include <gncEntry.h>\n"
|
||||||
@ -41,6 +42,7 @@
|
|||||||
"#include <gncJob.h>\n"
|
"#include <gncJob.h>\n"
|
||||||
"#include <gncOrder.h>\n"
|
"#include <gncOrder.h>\n"
|
||||||
"#include <gncOwner.h>\n"
|
"#include <gncOwner.h>\n"
|
||||||
|
"#include <gncTaxTable.h>\n"
|
||||||
"#include <gncVendor.h>\n")))
|
"#include <gncVendor.h>\n")))
|
||||||
|
|
||||||
(gw:wrapset-add-cs-initializers!
|
(gw:wrapset-add-cs-initializers!
|
||||||
@ -54,6 +56,7 @@
|
|||||||
;; XXX: Need to add lists of all of these!
|
;; XXX: Need to add lists of all of these!
|
||||||
|
|
||||||
(gw:wrap-as-wct ws '<gnc:GncAddress*> "GncAddress*" "const GncAddress*")
|
(gw:wrap-as-wct ws '<gnc:GncAddress*> "GncAddress*" "const GncAddress*")
|
||||||
|
(gw:wrap-as-wct ws '<gnc:GncBillTerm*> "GncBillTerm*" "const GncBillTerm*")
|
||||||
(gw:wrap-as-wct ws '<gnc:GncCustomer*> "GncCustomer*" "const GncCustomer*")
|
(gw:wrap-as-wct ws '<gnc:GncCustomer*> "GncCustomer*" "const GncCustomer*")
|
||||||
(gw:wrap-as-wct ws '<gnc:GncEmployee*> "GncEmployee*" "const GncEmployee*")
|
(gw:wrap-as-wct ws '<gnc:GncEmployee*> "GncEmployee*" "const GncEmployee*")
|
||||||
(gw:wrap-as-wct ws '<gnc:GncEntry*> "GncEntry*" "const GncEntry*")
|
(gw:wrap-as-wct ws '<gnc:GncEntry*> "GncEntry*" "const GncEntry*")
|
||||||
@ -61,6 +64,7 @@
|
|||||||
(gw:wrap-as-wct ws '<gnc:GncJob*> "GncJob*" "const GncJob*")
|
(gw:wrap-as-wct ws '<gnc:GncJob*> "GncJob*" "const GncJob*")
|
||||||
(gw:wrap-as-wct ws '<gnc:GncOrder*> "GncOrder*" "const GncOrder*")
|
(gw:wrap-as-wct ws '<gnc:GncOrder*> "GncOrder*" "const GncOrder*")
|
||||||
(gw:wrap-as-wct ws '<gnc:GncOwner*> "GncOwner*" "const GncOwner*")
|
(gw:wrap-as-wct ws '<gnc:GncOwner*> "GncOwner*" "const GncOwner*")
|
||||||
|
(gw:wrap-as-wct ws '<gnc:GncTaxTable*> "GncTaxTable*" "const GncTaxTable*")
|
||||||
(gw:wrap-as-wct ws '<gnc:GncVendor*> "GncVendor*" "const GncVendor*")
|
(gw:wrap-as-wct ws '<gnc:GncVendor*> "GncVendor*" "const GncVendor*")
|
||||||
|
|
||||||
(let ((wt (gw:wrap-enumeration ws '<gnc:GncOwnerType> "GncOwnerType")))
|
(let ((wt (gw:wrap-enumeration ws '<gnc:GncOwnerType> "GncOwnerType")))
|
||||||
@ -183,6 +187,26 @@
|
|||||||
'((<gnc:GncAddress*> address))
|
'((<gnc:GncAddress*> address))
|
||||||
"Return the Address's Email Entry")
|
"Return the Address's Email Entry")
|
||||||
|
|
||||||
|
;;
|
||||||
|
;; gncBillTerm.h
|
||||||
|
;;
|
||||||
|
|
||||||
|
(gw:wrap-function
|
||||||
|
ws
|
||||||
|
'gnc:bill-term-get-name
|
||||||
|
'(<gw:mchars> callee-owned const)
|
||||||
|
"gncBillTermGetName"
|
||||||
|
'((<gnc:GncBillTerm*> term))
|
||||||
|
"Return the Bill-term name")
|
||||||
|
|
||||||
|
(gw:wrap-function
|
||||||
|
ws
|
||||||
|
'gnc:bill-term-get-description
|
||||||
|
'(<gw:mchars> callee-owned const)
|
||||||
|
"gncBillTermGetDescription"
|
||||||
|
'((<gnc:GncBillTerm*> term))
|
||||||
|
"Return the printable Bill-term description")
|
||||||
|
|
||||||
;;
|
;;
|
||||||
;; gncCustomer.h
|
;; gncCustomer.h
|
||||||
;;
|
;;
|
||||||
@ -450,7 +474,7 @@
|
|||||||
'gnc:invoice-set-terms
|
'gnc:invoice-set-terms
|
||||||
'<gw:void>
|
'<gw:void>
|
||||||
"gncInvoiceSetTerms"
|
"gncInvoiceSetTerms"
|
||||||
'((<gnc:GncInvoice*> invoice) ((<gw:mchars> callee-owned const) id))
|
'((<gnc:GncInvoice*> invoice) (<gnc:GncBillTerm*> term))
|
||||||
"Set the Invoice Terms")
|
"Set the Invoice Terms")
|
||||||
|
|
||||||
(gw:wrap-function
|
(gw:wrap-function
|
||||||
@ -514,7 +538,7 @@
|
|||||||
(gw:wrap-function
|
(gw:wrap-function
|
||||||
ws
|
ws
|
||||||
'gnc:invoice-get-terms
|
'gnc:invoice-get-terms
|
||||||
'(<gw:mchars> callee-owned const)
|
'(<gnc:GncBillTerm*>)
|
||||||
"gncInvoiceGetTerms"
|
"gncInvoiceGetTerms"
|
||||||
'((<gnc:GncInvoice*> invoice))
|
'((<gnc:GncInvoice*> invoice))
|
||||||
"Return the invoice's Terms")
|
"Return the invoice's Terms")
|
||||||
|
@ -60,7 +60,7 @@ test_customer (void)
|
|||||||
test_string_fcn (book, "Name", gncCustomerSetName, gncCustomerGetName);
|
test_string_fcn (book, "Name", gncCustomerSetName, gncCustomerGetName);
|
||||||
test_string_fcn (book, "Notes", gncCustomerSetNotes, gncCustomerGetNotes);
|
test_string_fcn (book, "Notes", gncCustomerSetNotes, gncCustomerGetNotes);
|
||||||
|
|
||||||
test_string_fcn (book, "Terms", gncCustomerSetTerms, gncCustomerGetTerms);
|
//test_string_fcn (book, "Terms", gncCustomerSetTerms, gncCustomerGetTerms);
|
||||||
|
|
||||||
test_numeric_fcn (book, "Discount", gncCustomerSetDiscount, gncCustomerGetDiscount);
|
test_numeric_fcn (book, "Discount", gncCustomerSetDiscount, gncCustomerGetDiscount);
|
||||||
test_numeric_fcn (book, "Credit", gncCustomerSetCredit, gncCustomerGetCredit);
|
test_numeric_fcn (book, "Credit", gncCustomerSetCredit, gncCustomerGetCredit);
|
||||||
|
@ -62,7 +62,7 @@ test_vendor (void)
|
|||||||
test_string_fcn (book, "Name", gncVendorSetName, gncVendorGetName);
|
test_string_fcn (book, "Name", gncVendorSetName, gncVendorGetName);
|
||||||
test_string_fcn (book, "Notes", gncVendorSetNotes, gncVendorGetNotes);
|
test_string_fcn (book, "Notes", gncVendorSetNotes, gncVendorGetNotes);
|
||||||
|
|
||||||
test_string_fcn (book, "Terms", gncVendorSetTerms, gncVendorGetTerms);
|
//test_string_fcn (book, "Terms", gncVendorSetTerms, gncVendorGetTerms);
|
||||||
|
|
||||||
test_bool_fcn (book, "TaxIncluded", gncVendorSetTaxIncluded, gncVendorGetTaxIncluded);
|
test_bool_fcn (book, "TaxIncluded", gncVendorSetTaxIncluded, gncVendorGetTaxIncluded);
|
||||||
test_bool_fcn (book, "Active", gncVendorSetActive, gncVendorGetActive);
|
test_bool_fcn (book, "Active", gncVendorSetActive, gncVendorGetActive);
|
||||||
|
@ -214,3 +214,87 @@ gnc_business_account_types (GncOwner *owner)
|
|||||||
return (g_list_prepend (NULL, (gpointer)NO_TYPE));
|
return (g_list_prepend (NULL, (gpointer)NO_TYPE));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
business_option_changed (GtkWidget *widget, gpointer *result)
|
||||||
|
{
|
||||||
|
*result =
|
||||||
|
gtk_object_get_data (GTK_OBJECT (widget), "this_item");
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
add_menu_item (GtkWidget *menu, const char *label, gpointer *result,
|
||||||
|
gpointer this_item)
|
||||||
|
{
|
||||||
|
GtkWidget *item = gtk_menu_item_new_with_label (label);
|
||||||
|
gtk_object_set_data (GTK_OBJECT (item), "this_item", this_item);
|
||||||
|
gtk_signal_connect (GTK_OBJECT (item), "activate",
|
||||||
|
business_option_changed, result);
|
||||||
|
gtk_menu_append (GTK_MENU (menu), item);
|
||||||
|
gtk_widget_show (item);
|
||||||
|
}
|
||||||
|
|
||||||
|
#define DO_ADD_ITEM(s,o) { \
|
||||||
|
add_menu_item (menu, (s), result, (o)); \
|
||||||
|
if (*result == (o)) current = index; \
|
||||||
|
index++; \
|
||||||
|
}
|
||||||
|
|
||||||
|
typedef const char * (*GenericLookup_t)(gpointer);
|
||||||
|
|
||||||
|
static void
|
||||||
|
make_generic_optionmenu (GList *items, GtkWidget *omenu, GNCBook *book,
|
||||||
|
gboolean none_ok, GenericLookup_t func,
|
||||||
|
gpointer *result)
|
||||||
|
{
|
||||||
|
GtkWidget *menu;
|
||||||
|
int current = 0, index = 0;
|
||||||
|
|
||||||
|
menu = gtk_menu_new ();
|
||||||
|
|
||||||
|
if (none_ok || items == NULL)
|
||||||
|
DO_ADD_ITEM (_("None"), NULL);
|
||||||
|
|
||||||
|
for ( ; items; items = items->next)
|
||||||
|
DO_ADD_ITEM (func (items->data), items->data);
|
||||||
|
|
||||||
|
gtk_option_menu_set_menu (GTK_OPTION_MENU (omenu), menu);
|
||||||
|
gtk_option_menu_set_history (GTK_OPTION_MENU (omenu), current);
|
||||||
|
gtk_widget_show (menu);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Create an optionmenu of available billing terms and attach it to
|
||||||
|
* the menu passed in. If none_ok is true, then add "none" as a
|
||||||
|
* choice (with data set to NULL). Any time the menu changes,
|
||||||
|
* 'choice' will be set to the chosen option. If *choice is non-NULL,
|
||||||
|
* then that will be the default option setting when the menu is
|
||||||
|
* created.
|
||||||
|
*/
|
||||||
|
void
|
||||||
|
gnc_ui_billterms_optionmenu (GtkWidget *omenu, GNCBook *book,
|
||||||
|
gboolean none_ok, GncBillTerm **choice)
|
||||||
|
{
|
||||||
|
GList *terms;
|
||||||
|
|
||||||
|
if (!omenu || !choice || !book) return;
|
||||||
|
|
||||||
|
terms = gncBillTermGetTerms (book);
|
||||||
|
make_generic_optionmenu (terms, omenu, book, none_ok,
|
||||||
|
(GenericLookup_t)gncBillTermGetName,
|
||||||
|
(gpointer *)choice);
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
gnc_ui_taxtables_optionmenu (GtkWidget *omenu, GNCBook *book,
|
||||||
|
gboolean none_ok, GncTaxTable **choice)
|
||||||
|
{
|
||||||
|
GList *tables;
|
||||||
|
|
||||||
|
if (!omenu || !choice || !book) return;
|
||||||
|
|
||||||
|
tables = gncTaxTableGetTables (book);
|
||||||
|
make_generic_optionmenu (tables, omenu, book, none_ok,
|
||||||
|
(GenericLookup_t)gncTaxTableGetName,
|
||||||
|
(gpointer *)choice);
|
||||||
|
}
|
||||||
|
@ -10,6 +10,8 @@
|
|||||||
|
|
||||||
#include "gnc-book.h"
|
#include "gnc-book.h"
|
||||||
#include "gncOwner.h"
|
#include "gncOwner.h"
|
||||||
|
#include "gncBillTerm.h"
|
||||||
|
#include "gncTaxTable.h"
|
||||||
|
|
||||||
GtkWidget * gnc_owner_select_create (GtkWidget *label, GtkWidget *hbox,
|
GtkWidget * gnc_owner_select_create (GtkWidget *label, GtkWidget *hbox,
|
||||||
GNCBook *book, GncOwner *owner);
|
GNCBook *book, GncOwner *owner);
|
||||||
@ -28,4 +30,20 @@ GList * gnc_business_account_types (GncOwner *owner);
|
|||||||
void gnc_fill_account_select_combo (GtkWidget *combo, GNCBook *book,
|
void gnc_fill_account_select_combo (GtkWidget *combo, GNCBook *book,
|
||||||
GList *acct_types);
|
GList *acct_types);
|
||||||
|
|
||||||
|
|
||||||
|
/* Create an optionmenu of available billing terms and attach it to
|
||||||
|
* the menu passed in. If none_ok is true, then add "none" as a
|
||||||
|
* choice (with data set to NULL). Any time the menu changes,
|
||||||
|
* 'choice' will be set to the chosen option. If *choice is non-NULL,
|
||||||
|
* then that will be the default option setting when the menu is
|
||||||
|
* created.
|
||||||
|
*/
|
||||||
|
void gnc_ui_billterms_optionmenu (GtkWidget *omenu, GNCBook *book,
|
||||||
|
gboolean none_ok, GncBillTerm **choice);
|
||||||
|
|
||||||
|
/* Same thing except for the tax tables */
|
||||||
|
void
|
||||||
|
gnc_ui_taxtables_optionmenu (GtkWidget *omenu, GNCBook *book,
|
||||||
|
gboolean none_ok, GncTaxTable **choice);
|
||||||
|
|
||||||
#endif /* GNC_BUSINESS_UTILS_H_ */
|
#endif /* GNC_BUSINESS_UTILS_H_ */
|
||||||
|
@ -25,6 +25,7 @@
|
|||||||
#include "gncCustomer.h"
|
#include "gncCustomer.h"
|
||||||
#include "gncCustomerP.h"
|
#include "gncCustomerP.h"
|
||||||
|
|
||||||
|
#include "business-utils.h"
|
||||||
#include "dialog-customer.h"
|
#include "dialog-customer.h"
|
||||||
#include "dialog-job.h"
|
#include "dialog-job.h"
|
||||||
#include "dialog-order.h"
|
#include "dialog-order.h"
|
||||||
@ -69,7 +70,7 @@ struct _customer_window {
|
|||||||
GtkWidget * shipfax_entry;
|
GtkWidget * shipfax_entry;
|
||||||
GtkWidget * shipemail_entry;
|
GtkWidget * shipemail_entry;
|
||||||
|
|
||||||
GtkWidget * terms_entry;
|
GtkWidget * terms_menu;
|
||||||
GtkWidget * discount_amount;
|
GtkWidget * discount_amount;
|
||||||
GtkWidget * credit_amount;
|
GtkWidget * credit_amount;
|
||||||
|
|
||||||
@ -77,6 +78,7 @@ struct _customer_window {
|
|||||||
GtkWidget * taxincluded_check;
|
GtkWidget * taxincluded_check;
|
||||||
GtkWidget * notes_text;
|
GtkWidget * notes_text;
|
||||||
|
|
||||||
|
GncBillTerm * terms;
|
||||||
CustomerDialogType dialog_type;
|
CustomerDialogType dialog_type;
|
||||||
GUID customer_guid;
|
GUID customer_guid;
|
||||||
gint component_id;
|
gint component_id;
|
||||||
@ -150,8 +152,7 @@ static void gnc_ui_to_customer (CustomerWindow *cw, GncCustomer *cust)
|
|||||||
(GTK_EDITABLE (cw->notes_text), 0, -1));
|
(GTK_EDITABLE (cw->notes_text), 0, -1));
|
||||||
|
|
||||||
/* Parse and set the terms, discount, and credit amounts */
|
/* Parse and set the terms, discount, and credit amounts */
|
||||||
gncCustomerSetTerms (cust, gtk_editable_get_chars
|
gncCustomerSetTerms (cust, cw->terms);
|
||||||
(GTK_EDITABLE (cw->terms_entry), 0, -1));
|
|
||||||
gncCustomerSetDiscount (cust, gnc_amount_edit_get_amount
|
gncCustomerSetDiscount (cust, gnc_amount_edit_get_amount
|
||||||
(GNC_AMOUNT_EDIT (cw->discount_amount)));
|
(GNC_AMOUNT_EDIT (cw->discount_amount)));
|
||||||
gncCustomerSetCredit (cust, gnc_amount_edit_get_amount
|
gncCustomerSetCredit (cust, gnc_amount_edit_get_amount
|
||||||
@ -219,10 +220,6 @@ gnc_customer_window_ok_cb (GtkWidget *widget, gpointer data)
|
|||||||
/* Verify terms, discount, and credit are valid (or empty) */
|
/* Verify terms, discount, and credit are valid (or empty) */
|
||||||
min = gnc_numeric_zero ();
|
min = gnc_numeric_zero ();
|
||||||
max = gnc_numeric_create (100, 1);
|
max = gnc_numeric_create (100, 1);
|
||||||
// if (check_edit_amount (cw->dialog, cw->terms_amount, &min, NULL,
|
|
||||||
// _("Terms must be a positive integer or "
|
|
||||||
// "you must leave it blank.")))
|
|
||||||
// return;
|
|
||||||
|
|
||||||
if (check_edit_amount (cw->dialog, cw->discount_amount, &min, &max,
|
if (check_edit_amount (cw->dialog, cw->discount_amount, &min, &max,
|
||||||
_("Discount percentage must be between 0-100 "
|
_("Discount percentage must be between 0-100 "
|
||||||
@ -426,7 +423,7 @@ gnc_customer_new_window (GNCBook *bookp, GncCustomer *cust)
|
|||||||
cw->taxincluded_check = glade_xml_get_widget (xml, "tax_included_check");
|
cw->taxincluded_check = glade_xml_get_widget (xml, "tax_included_check");
|
||||||
cw->notes_text = glade_xml_get_widget (xml, "notes_text");
|
cw->notes_text = glade_xml_get_widget (xml, "notes_text");
|
||||||
|
|
||||||
cw->terms_entry = glade_xml_get_widget (xml, "terms_entry");
|
cw->terms_menu = glade_xml_get_widget (xml, "terms_menu");
|
||||||
|
|
||||||
/* DISCOUNT: Percentage Value */
|
/* DISCOUNT: Percentage Value */
|
||||||
edit = gnc_amount_edit_new();
|
edit = gnc_amount_edit_new();
|
||||||
@ -554,6 +551,8 @@ gnc_customer_new_window (GNCBook *bookp, GncCustomer *cust)
|
|||||||
gnc_customer_window_refresh_handler,
|
gnc_customer_window_refresh_handler,
|
||||||
gnc_customer_window_close_handler,
|
gnc_customer_window_close_handler,
|
||||||
cw);
|
cw);
|
||||||
|
cw->terms = gncCustomerGetTerms (cust);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
cust = gncCustomerCreate (bookp);
|
cust = gncCustomerCreate (bookp);
|
||||||
gncCustomerSetCommodity (cust, commodity);
|
gncCustomerSetCommodity (cust, commodity);
|
||||||
@ -565,12 +564,15 @@ gnc_customer_new_window (GNCBook *bookp, GncCustomer *cust)
|
|||||||
gnc_customer_window_refresh_handler,
|
gnc_customer_window_refresh_handler,
|
||||||
gnc_customer_window_close_handler,
|
gnc_customer_window_close_handler,
|
||||||
cw);
|
cw);
|
||||||
|
|
||||||
|
/* XXX: get the global-default terms */
|
||||||
|
cw->terms = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* I know that cust exists here -- either passed in or just created */
|
/* I know that cust exists here -- either passed in or just created */
|
||||||
|
|
||||||
gtk_entry_set_text (GTK_ENTRY (cw->terms_entry),
|
gnc_ui_billterms_optionmenu (cw->terms_menu, bookp, TRUE, &cw->terms);
|
||||||
gncCustomerGetTerms (cust));
|
|
||||||
|
|
||||||
/* Set the Discount, and Credit amounts */
|
/* Set the Discount, and Credit amounts */
|
||||||
gnc_amount_edit_set_amount (GNC_AMOUNT_EDIT (cw->discount_amount),
|
gnc_amount_edit_set_amount (GNC_AMOUNT_EDIT (cw->discount_amount),
|
||||||
|
@ -82,10 +82,11 @@ struct _invoice_window {
|
|||||||
GtkWidget * job_box;
|
GtkWidget * job_box;
|
||||||
GtkWidget * job_choice;
|
GtkWidget * job_choice;
|
||||||
GtkWidget * billing_id_entry;
|
GtkWidget * billing_id_entry;
|
||||||
GtkWidget * terms_entry;
|
GtkWidget * terms_menu;
|
||||||
|
|
||||||
gint width;
|
gint width;
|
||||||
|
|
||||||
|
GncBillTerm * terms;
|
||||||
GnucashRegister * reg;
|
GnucashRegister * reg;
|
||||||
GncEntryLedger * ledger;
|
GncEntryLedger * ledger;
|
||||||
|
|
||||||
@ -136,8 +137,7 @@ static void gnc_ui_to_invoice (InvoiceWindow *iw, GncInvoice *invoice)
|
|||||||
(GTK_EDITABLE (iw->id_entry), 0, -1));
|
(GTK_EDITABLE (iw->id_entry), 0, -1));
|
||||||
gncInvoiceSetBillingID (invoice, gtk_editable_get_chars
|
gncInvoiceSetBillingID (invoice, gtk_editable_get_chars
|
||||||
(GTK_EDITABLE (iw->billing_id_entry), 0, -1));
|
(GTK_EDITABLE (iw->billing_id_entry), 0, -1));
|
||||||
gncInvoiceSetTerms (invoice, gtk_editable_get_chars
|
gncInvoiceSetTerms (invoice, iw->terms);
|
||||||
(GTK_EDITABLE (iw->terms_entry), 0, -1));
|
|
||||||
|
|
||||||
ts = gnc_date_edit_get_date_ts (GNC_DATE_EDIT (iw->opened_date));
|
ts = gnc_date_edit_get_date_ts (GNC_DATE_EDIT (iw->opened_date));
|
||||||
gncInvoiceSetDateOpened (invoice, ts);
|
gncInvoiceSetDateOpened (invoice, ts);
|
||||||
@ -764,7 +764,7 @@ static int
|
|||||||
gnc_invoice_owner_changed_cb (GtkWidget *widget, gpointer data)
|
gnc_invoice_owner_changed_cb (GtkWidget *widget, gpointer data)
|
||||||
{
|
{
|
||||||
InvoiceWindow *iw = data;
|
InvoiceWindow *iw = data;
|
||||||
char const *msg = "";
|
GncBillTerm *term = NULL;
|
||||||
GncOwner owner;
|
GncOwner owner;
|
||||||
|
|
||||||
if (!iw)
|
if (!iw)
|
||||||
@ -791,17 +791,19 @@ gnc_invoice_owner_changed_cb (GtkWidget *widget, gpointer data)
|
|||||||
|
|
||||||
switch (gncOwnerGetType (&(iw->owner))) {
|
switch (gncOwnerGetType (&(iw->owner))) {
|
||||||
case GNC_OWNER_CUSTOMER:
|
case GNC_OWNER_CUSTOMER:
|
||||||
msg = gncCustomerGetTerms (gncOwnerGetCustomer (&(iw->owner)));
|
term = gncCustomerGetTerms (gncOwnerGetCustomer (&(iw->owner)));
|
||||||
break;
|
break;
|
||||||
case GNC_OWNER_VENDOR:
|
case GNC_OWNER_VENDOR:
|
||||||
msg = gncVendorGetTerms (gncOwnerGetVendor (&(iw->owner)));
|
term = gncVendorGetTerms (gncOwnerGetVendor (&(iw->owner)));
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
g_warning ("Unknown owner type: %d\n", gncOwnerGetType (&(iw->owner)));
|
g_warning ("Unknown owner type: %d\n", gncOwnerGetType (&(iw->owner)));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
gtk_entry_set_text (GTK_ENTRY (iw->terms_entry), msg ? msg : "");
|
/* XXX: I'm not sure -- should we change the terms if this happens? */
|
||||||
|
iw->terms = term;
|
||||||
|
gnc_ui_billterms_optionmenu (iw->terms_menu, iw->book, TRUE, &iw->terms);
|
||||||
|
|
||||||
gnc_invoice_update_job_choice (iw);
|
gnc_invoice_update_job_choice (iw);
|
||||||
|
|
||||||
@ -991,9 +993,6 @@ gnc_invoice_update_window (InvoiceWindow *iw)
|
|||||||
gtk_entry_set_text (GTK_ENTRY (iw->billing_id_entry),
|
gtk_entry_set_text (GTK_ENTRY (iw->billing_id_entry),
|
||||||
gncInvoiceGetBillingID (invoice));
|
gncInvoiceGetBillingID (invoice));
|
||||||
|
|
||||||
gtk_entry_set_text (GTK_ENTRY (iw->terms_entry),
|
|
||||||
gncInvoiceGetTerms (invoice));
|
|
||||||
|
|
||||||
string = gncInvoiceGetNotes (invoice);
|
string = gncInvoiceGetNotes (invoice);
|
||||||
gtk_editable_delete_text (GTK_EDITABLE (iw->notes_text), 0, -1);
|
gtk_editable_delete_text (GTK_EDITABLE (iw->notes_text), 0, -1);
|
||||||
gtk_editable_insert_text (GTK_EDITABLE (iw->notes_text), string,
|
gtk_editable_insert_text (GTK_EDITABLE (iw->notes_text), string,
|
||||||
@ -1010,6 +1009,10 @@ gnc_invoice_update_window (InvoiceWindow *iw)
|
|||||||
gnc_date_edit_set_time_ts (GNC_DATE_EDIT (iw->opened_date), ts);
|
gnc_date_edit_set_time_ts (GNC_DATE_EDIT (iw->opened_date), ts);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* fill in the terms menu */
|
||||||
|
iw->terms = gncInvoiceGetTerms (invoice);
|
||||||
|
gnc_ui_billterms_optionmenu (iw->terms_menu, iw->book, TRUE, &iw->terms);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Next, figure out if we've been posted, and if so set the
|
* Next, figure out if we've been posted, and if so set the
|
||||||
* appropriate bits of information.. Then work on hiding or
|
* appropriate bits of information.. Then work on hiding or
|
||||||
@ -1029,7 +1032,6 @@ gnc_invoice_update_window (InvoiceWindow *iw)
|
|||||||
string = xaccAccountGetFullName (acct, gnc_get_account_separator ());
|
string = xaccAccountGetFullName (acct, gnc_get_account_separator ());
|
||||||
gtk_entry_set_text (GTK_ENTRY (acct_entry), string);
|
gtk_entry_set_text (GTK_ENTRY (acct_entry), string);
|
||||||
|
|
||||||
|
|
||||||
} while (FALSE);
|
} while (FALSE);
|
||||||
|
|
||||||
if (iw->dialog_type == NEW_INVOICE || iw->dialog_type == MOD_INVOICE)
|
if (iw->dialog_type == NEW_INVOICE || iw->dialog_type == MOD_INVOICE)
|
||||||
@ -1075,7 +1077,7 @@ gnc_invoice_update_window (InvoiceWindow *iw)
|
|||||||
/* Setup viewer for read-only access */
|
/* Setup viewer for read-only access */
|
||||||
/*
|
/*
|
||||||
gtk_widget_set_sensitive (iw->id_entry, FALSE);
|
gtk_widget_set_sensitive (iw->id_entry, FALSE);
|
||||||
gtk_widget_set_sensitive (iw->terms_entry, FALSE);
|
gtk_widget_set_sensitive (iw->terms_menu, FALSE);
|
||||||
gtk_widget_set_sensitive (iw->opened_date, FALSE);
|
gtk_widget_set_sensitive (iw->opened_date, FALSE);
|
||||||
gtk_widget_set_sensitive (iw->notes_text, FALSE); *//* XXX: should notes remain writable? */
|
gtk_widget_set_sensitive (iw->notes_text, FALSE); *//* XXX: should notes remain writable? */
|
||||||
|
|
||||||
@ -1141,7 +1143,7 @@ gnc_invoice_new_window (GNCBook *bookp, InvoiceDialogType type,
|
|||||||
/* Grab the widgets */
|
/* Grab the widgets */
|
||||||
iw->id_entry = glade_xml_get_widget (xml, "id_entry");
|
iw->id_entry = glade_xml_get_widget (xml, "id_entry");
|
||||||
iw->billing_id_entry = glade_xml_get_widget (xml, "billing_id_entry");
|
iw->billing_id_entry = glade_xml_get_widget (xml, "billing_id_entry");
|
||||||
iw->terms_entry = glade_xml_get_widget (xml, "terms_entry");
|
iw->terms_menu = glade_xml_get_widget (xml, "terms_menu");
|
||||||
iw->notes_text = glade_xml_get_widget (xml, "notes_text");
|
iw->notes_text = glade_xml_get_widget (xml, "notes_text");
|
||||||
iw->active_check = glade_xml_get_widget (xml, "active_check");
|
iw->active_check = glade_xml_get_widget (xml, "active_check");
|
||||||
iw->owner_box = glade_xml_get_widget (xml, "owner_hbox");
|
iw->owner_box = glade_xml_get_widget (xml, "owner_hbox");
|
||||||
@ -1318,7 +1320,7 @@ gnc_invoice_window_new_invoice (GNCBook *bookp, GncOwner *owner,
|
|||||||
/* Grab the widgets */
|
/* Grab the widgets */
|
||||||
iw->id_entry = glade_xml_get_widget (xml, "id_entry");
|
iw->id_entry = glade_xml_get_widget (xml, "id_entry");
|
||||||
iw->billing_id_entry = glade_xml_get_widget (xml, "billing_id_entry");
|
iw->billing_id_entry = glade_xml_get_widget (xml, "billing_id_entry");
|
||||||
iw->terms_entry = glade_xml_get_widget (xml, "terms_entry");
|
iw->terms_menu = glade_xml_get_widget (xml, "terms_menu");
|
||||||
iw->notes_text = glade_xml_get_widget (xml, "notes_text");
|
iw->notes_text = glade_xml_get_widget (xml, "notes_text");
|
||||||
iw->owner_box = glade_xml_get_widget (xml, "owner_hbox");
|
iw->owner_box = glade_xml_get_widget (xml, "owner_hbox");
|
||||||
iw->owner_label = glade_xml_get_widget (xml, "owner_label");
|
iw->owner_label = glade_xml_get_widget (xml, "owner_label");
|
||||||
|
@ -24,6 +24,7 @@
|
|||||||
#include "gncVendor.h"
|
#include "gncVendor.h"
|
||||||
#include "gncVendorP.h"
|
#include "gncVendorP.h"
|
||||||
|
|
||||||
|
#include "business-utils.h"
|
||||||
#include "dialog-vendor.h"
|
#include "dialog-vendor.h"
|
||||||
#include "dialog-job.h"
|
#include "dialog-job.h"
|
||||||
#include "dialog-order.h"
|
#include "dialog-order.h"
|
||||||
@ -58,12 +59,13 @@ struct _vendor_window {
|
|||||||
GtkWidget * phone_entry;
|
GtkWidget * phone_entry;
|
||||||
GtkWidget * fax_entry;
|
GtkWidget * fax_entry;
|
||||||
GtkWidget * email_entry;
|
GtkWidget * email_entry;
|
||||||
GtkWidget * terms_entry;
|
GtkWidget * terms_menu;
|
||||||
|
|
||||||
GtkWidget * active_check;
|
GtkWidget * active_check;
|
||||||
GtkWidget * taxincluded_check;
|
GtkWidget * taxincluded_check;
|
||||||
GtkWidget * notes_text;
|
GtkWidget * notes_text;
|
||||||
|
|
||||||
|
GncBillTerm * terms;
|
||||||
VendorDialogType dialog_type;
|
VendorDialogType dialog_type;
|
||||||
GUID vendor_guid;
|
GUID vendor_guid;
|
||||||
gint component_id;
|
gint component_id;
|
||||||
@ -117,8 +119,7 @@ static void gnc_ui_to_vendor (VendorWindow *vw, GncVendor *vendor)
|
|||||||
(GTK_TOGGLE_BUTTON (vw->taxincluded_check)));
|
(GTK_TOGGLE_BUTTON (vw->taxincluded_check)));
|
||||||
gncVendorSetNotes (vendor, gtk_editable_get_chars
|
gncVendorSetNotes (vendor, gtk_editable_get_chars
|
||||||
(GTK_EDITABLE (vw->notes_text), 0, -1));
|
(GTK_EDITABLE (vw->notes_text), 0, -1));
|
||||||
gncVendorSetTerms (vendor, gtk_editable_get_chars
|
gncVendorSetTerms (vendor, vw->terms);
|
||||||
(GTK_EDITABLE (vw->terms_entry), 0, -1));
|
|
||||||
|
|
||||||
gncVendorCommitEdit (vendor);
|
gncVendorCommitEdit (vendor);
|
||||||
gnc_resume_gui_refresh ();
|
gnc_resume_gui_refresh ();
|
||||||
@ -156,13 +157,6 @@ gnc_vendor_window_ok_cb (GtkWidget *widget, gpointer data)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// /* Verify terms are valid (or empty) */
|
|
||||||
// min = gnc_numeric_zero ();
|
|
||||||
// if (check_edit_amount (vw->dialog, vw->terms_amount, &min, NULL,
|
|
||||||
// _("Terms must be a positive integer or "
|
|
||||||
// "you must leave it blank.")))
|
|
||||||
// return;
|
|
||||||
|
|
||||||
/* Check for valid id and set one if necessary */
|
/* Check for valid id and set one if necessary */
|
||||||
if (safe_strcmp (gtk_entry_get_text (GTK_ENTRY (vw->id_entry)), "") == 0)
|
if (safe_strcmp (gtk_entry_get_text (GTK_ENTRY (vw->id_entry)), "") == 0)
|
||||||
gtk_entry_set_text (GTK_ENTRY (vw->id_entry),
|
gtk_entry_set_text (GTK_ENTRY (vw->id_entry),
|
||||||
@ -341,7 +335,7 @@ gnc_vendor_new_window (GNCBook *bookp, GncVendor *vendor)
|
|||||||
vw->active_check = glade_xml_get_widget (xml, "active_check");
|
vw->active_check = glade_xml_get_widget (xml, "active_check");
|
||||||
vw->taxincluded_check = glade_xml_get_widget (xml, "tax_included_check");
|
vw->taxincluded_check = glade_xml_get_widget (xml, "tax_included_check");
|
||||||
vw->notes_text = glade_xml_get_widget (xml, "notes_text");
|
vw->notes_text = glade_xml_get_widget (xml, "notes_text");
|
||||||
vw->terms_entry = glade_xml_get_widget (xml, "terms_entry");
|
vw->terms_menu = glade_xml_get_widget (xml, "terms_menu");
|
||||||
|
|
||||||
/* Setup Dialog for Editing */
|
/* Setup Dialog for Editing */
|
||||||
gnome_dialog_set_default (vwd, 0);
|
gnome_dialog_set_default (vwd, 0);
|
||||||
@ -422,6 +416,9 @@ gnc_vendor_new_window (GNCBook *bookp, GncVendor *vendor)
|
|||||||
gnc_vendor_window_refresh_handler,
|
gnc_vendor_window_refresh_handler,
|
||||||
gnc_vendor_window_close_handler,
|
gnc_vendor_window_close_handler,
|
||||||
vw);
|
vw);
|
||||||
|
|
||||||
|
vw->terms = gncVendorGetTerms (vendor);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
vendor = gncVendorCreate (bookp);
|
vendor = gncVendorCreate (bookp);
|
||||||
gncVendorSetCommodity (vendor, gnc_default_currency ());
|
gncVendorSetCommodity (vendor, gnc_default_currency ());
|
||||||
@ -433,12 +430,15 @@ gnc_vendor_new_window (GNCBook *bookp, GncVendor *vendor)
|
|||||||
gnc_vendor_window_refresh_handler,
|
gnc_vendor_window_refresh_handler,
|
||||||
gnc_vendor_window_close_handler,
|
gnc_vendor_window_close_handler,
|
||||||
vw);
|
vw);
|
||||||
|
|
||||||
|
/* XXX: Get the default Billing Terms */
|
||||||
|
vw->terms = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* I know that vendor exists here -- either passed in or just created */
|
/* I know that vendor exists here -- either passed in or just created */
|
||||||
|
|
||||||
/* Set the Terms amounts */
|
gnc_ui_billterms_optionmenu (vw->terms_menu, bookp, TRUE, &vw->terms);
|
||||||
gtk_entry_set_text (GTK_ENTRY (vw->terms_entry), gncVendorGetTerms (vendor));
|
|
||||||
|
|
||||||
gnc_gui_component_watch_entity_type (vw->component_id,
|
gnc_gui_component_watch_entity_type (vw->component_id,
|
||||||
GNC_VENDOR_MODULE_NAME,
|
GNC_VENDOR_MODULE_NAME,
|
||||||
|
@ -716,13 +716,12 @@
|
|||||||
</child>
|
</child>
|
||||||
|
|
||||||
<widget>
|
<widget>
|
||||||
<class>GtkEntry</class>
|
<class>GtkOptionMenu</class>
|
||||||
<name>terms_entry</name>
|
<name>terms_menu</name>
|
||||||
<can_focus>True</can_focus>
|
<can_focus>True</can_focus>
|
||||||
<editable>True</editable>
|
<items>(terms)
|
||||||
<text_visible>True</text_visible>
|
</items>
|
||||||
<text_max_length>0</text_max_length>
|
<initial_choice>0</initial_choice>
|
||||||
<text></text>
|
|
||||||
<child>
|
<child>
|
||||||
<padding>0</padding>
|
<padding>0</padding>
|
||||||
<expand>False</expand>
|
<expand>False</expand>
|
||||||
|
@ -366,13 +366,12 @@
|
|||||||
</widget>
|
</widget>
|
||||||
|
|
||||||
<widget>
|
<widget>
|
||||||
<class>GtkEntry</class>
|
<class>GtkOptionMenu</class>
|
||||||
<name>terms_entry</name>
|
<name>terms_menu</name>
|
||||||
<can_focus>True</can_focus>
|
<can_focus>True</can_focus>
|
||||||
<editable>True</editable>
|
<items>(terms)
|
||||||
<text_visible>True</text_visible>
|
</items>
|
||||||
<text_max_length>0</text_max_length>
|
<initial_choice>0</initial_choice>
|
||||||
<text></text>
|
|
||||||
<child>
|
<child>
|
||||||
<padding>0</padding>
|
<padding>0</padding>
|
||||||
<expand>False</expand>
|
<expand>False</expand>
|
||||||
@ -912,13 +911,13 @@
|
|||||||
</widget>
|
</widget>
|
||||||
|
|
||||||
<widget>
|
<widget>
|
||||||
<class>GtkEntry</class>
|
<class>GtkOptionMenu</class>
|
||||||
<name>terms_entry</name>
|
<name>terms_menu</name>
|
||||||
|
<sensitive>False</sensitive>
|
||||||
<can_focus>True</can_focus>
|
<can_focus>True</can_focus>
|
||||||
<editable>False</editable>
|
<items>(terms)
|
||||||
<text_visible>True</text_visible>
|
</items>
|
||||||
<text_max_length>0</text_max_length>
|
<initial_choice>0</initial_choice>
|
||||||
<text></text>
|
|
||||||
<child>
|
<child>
|
||||||
<padding>0</padding>
|
<padding>0</padding>
|
||||||
<expand>False</expand>
|
<expand>False</expand>
|
||||||
|
@ -683,13 +683,12 @@
|
|||||||
</child>
|
</child>
|
||||||
|
|
||||||
<widget>
|
<widget>
|
||||||
<class>GtkEntry</class>
|
<class>GtkOptionMenu</class>
|
||||||
<name>terms_entry</name>
|
<name>terms_menu</name>
|
||||||
<can_focus>True</can_focus>
|
<can_focus>True</can_focus>
|
||||||
<editable>True</editable>
|
<items>(terms)
|
||||||
<text_visible>True</text_visible>
|
</items>
|
||||||
<text_max_length>0</text_max_length>
|
<initial_choice>0</initial_choice>
|
||||||
<text></text>
|
|
||||||
<child>
|
<child>
|
||||||
<padding>0</padding>
|
<padding>0</padding>
|
||||||
<expand>False</expand>
|
<expand>False</expand>
|
||||||
|
@ -564,7 +564,8 @@
|
|||||||
(make-break! document)))))
|
(make-break! document)))))
|
||||||
|
|
||||||
(if (opt-val "Display" "Invoice Terms")
|
(if (opt-val "Display" "Invoice Terms")
|
||||||
(let ((terms (gnc:invoice-get-terms invoice)))
|
(let* ((term (gnc:invoice-get-terms invoice))
|
||||||
|
(terms (gnc:bill-term-get-description term)))
|
||||||
(if (and terms (> (string-length terms) 0))
|
(if (and terms (> (string-length terms) 0))
|
||||||
(gnc:html-document-add-object!
|
(gnc:html-document-add-object!
|
||||||
document
|
document
|
||||||
|
Loading…
Reference in New Issue
Block a user