mirror of
https://github.com/Gnucash/gnucash.git
synced 2025-02-25 18:55:30 -06:00
* src/business/business-core/gncEntry.h: Move the definitions
of PaymentType and DiscountHow higher earlier in the file to prevent problems of circular dependencies. * src/business/business-core/gncInvoice.[ch]: - Add the storage of the to_charge_amount. - Add GetTotalOf() to find the total of Cash and Charge amounts - Use the to_charge_amount when posting an invoice * src/business/business-core/dialog-invoice.c: - add a to_charge_amount for Exp. Vouchers - add a "Total Cash" and "Total Charge" summary * src/business/business-gnome/glade/invoice.glade: - add the to_charge_amount frame and labels. * src/busines/business-core/file/gnc-invoice-xml-v2.c: Add support for the to-charge amount. git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@8153 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
parent
efd32817c2
commit
41e630069e
17
ChangeLog
17
ChangeLog
@ -1,3 +1,20 @@
|
||||
2003-04-01 Derek Atkins <derek@ihtfp.com>
|
||||
|
||||
* src/business/business-core/gncEntry.h: Move the definitions
|
||||
of PaymentType and DiscountHow higher earlier in the file
|
||||
to prevent problems of circular dependencies.
|
||||
* src/business/business-core/gncInvoice.[ch]:
|
||||
- Add the storage of the to_charge_amount.
|
||||
- Add GetTotalOf() to find the total of Cash and Charge amounts
|
||||
- Use the to_charge_amount when posting an invoice
|
||||
* src/business/business-core/dialog-invoice.c:
|
||||
- add a to_charge_amount for Exp. Vouchers
|
||||
- add a "Total Cash" and "Total Charge" summary
|
||||
* src/business/business-gnome/glade/invoice.glade:
|
||||
- add the to_charge_amount frame and labels.
|
||||
* src/busines/business-core/file/gnc-invoice-xml-v2.c: Add support
|
||||
for the to-charge amount.
|
||||
|
||||
2003-04-01 Christian Stimming <stimming@tuhh.de>
|
||||
|
||||
* src/report/report-system/options-utilities.scm: Fix missing i18n
|
||||
|
@ -71,6 +71,7 @@ const gchar *invoice_version_string = "2.0.0";
|
||||
#define invoice_postacc_string "invoice:postacc"
|
||||
#define invoice_currency_string "invoice:currency"
|
||||
#define invoice_billto_string "invoice:billto"
|
||||
#define invoice_tochargeamt_string "invoice:charge-amt"
|
||||
|
||||
static void
|
||||
maybe_add_string (xmlNodePtr ptr, const char *tag, const char *str)
|
||||
@ -96,6 +97,7 @@ invoice_dom_tree_create (GncInvoice *invoice)
|
||||
Account *acc;
|
||||
GncBillTerm *term;
|
||||
GncOwner *billto;
|
||||
gnc_numeric amt;
|
||||
|
||||
ret = xmlNewNode(NULL, gnc_invoice_string);
|
||||
xmlSetProp(ret, "version", invoice_version_string);
|
||||
@ -151,6 +153,10 @@ invoice_dom_tree_create (GncInvoice *invoice)
|
||||
if (billto && billto->owner.undefined != NULL)
|
||||
xmlAddChild (ret, gnc_owner_to_dom_tree (invoice_billto_string, billto));
|
||||
|
||||
amt = gncInvoiceGetToChargeAmount (invoice);
|
||||
if (! gnc_numeric_zero_p (amt))
|
||||
xmlAddChild (ret, gnc_numeric_to_dom_tree (invoice_tochargeamt_string, &amt));
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
@ -382,6 +388,18 @@ invoice_billto_handler (xmlNodePtr node, gpointer invoice_pdata)
|
||||
return ret;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
invoice_tochargeamt_handler (xmlNodePtr node, gpointer invoice_pdata)
|
||||
{
|
||||
struct invoice_pdata *pdata = invoice_pdata;
|
||||
gnc_numeric* num = dom_tree_to_gnc_numeric(node);
|
||||
g_return_val_if_fail(num, FALSE);
|
||||
|
||||
gncInvoiceSetToChargeAmount (pdata->invoice, *num);
|
||||
g_free(num);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static struct dom_tree_handler invoice_handlers_v2[] = {
|
||||
{ invoice_guid_string, invoice_guid_handler, 1, 0 },
|
||||
{ invoice_id_string, invoice_id_handler, 1, 0 },
|
||||
@ -398,6 +416,7 @@ static struct dom_tree_handler invoice_handlers_v2[] = {
|
||||
{ invoice_currency_string, invoice_currency_handler, 0, 0 },
|
||||
{ "invoice:commodity", invoice_currency_handler, 0, 0 },
|
||||
{ invoice_billto_string, invoice_billto_handler, 0, 0 },
|
||||
{ invoice_tochargeamt_string, invoice_tochargeamt_handler, 0, 0},
|
||||
{ NULL, 0, 0, 0 }
|
||||
};
|
||||
|
||||
|
@ -9,6 +9,17 @@
|
||||
|
||||
typedef struct _gncEntry GncEntry;
|
||||
|
||||
typedef enum {
|
||||
GNC_PAYMENT_CASH = 1,
|
||||
GNC_PAYMENT_CARD
|
||||
} GncEntryPaymentType;
|
||||
|
||||
typedef enum {
|
||||
GNC_DISC_PRETAX = 1,
|
||||
GNC_DISC_SAMETIME,
|
||||
GNC_DISC_POSTTAX
|
||||
} GncDiscountHow;
|
||||
|
||||
#include "date.h"
|
||||
#include "gnc-book.h"
|
||||
#include "gncTaxTable.h"
|
||||
@ -17,7 +28,6 @@ typedef struct _gncEntry GncEntry;
|
||||
|
||||
#define GNC_ENTRY_MODULE_NAME "gncEntry"
|
||||
|
||||
|
||||
/* How to apply the discount and taxes. There are three distinct ways to
|
||||
* apply them:
|
||||
*
|
||||
@ -26,16 +36,6 @@ typedef struct _gncEntry GncEntry;
|
||||
* SAMETIME pretax pretax
|
||||
* POSTTAX pretax+tax pretax
|
||||
*/
|
||||
typedef enum {
|
||||
GNC_DISC_PRETAX = 1,
|
||||
GNC_DISC_SAMETIME,
|
||||
GNC_DISC_POSTTAX
|
||||
} GncDiscountHow;
|
||||
|
||||
typedef enum {
|
||||
GNC_PAYMENT_CASH = 1,
|
||||
GNC_PAYMENT_CARD
|
||||
} GncEntryPaymentType;
|
||||
|
||||
const char * gncEntryDiscountHowToString (GncDiscountHow how);
|
||||
gboolean gncEntryDiscountStringToHow (const char *str, GncDiscountHow *how);
|
||||
|
@ -44,6 +44,8 @@ struct _gncInvoice {
|
||||
Timespec date_opened;
|
||||
Timespec date_posted;
|
||||
|
||||
gnc_numeric to_charge_amount;
|
||||
|
||||
gnc_commodity * currency;
|
||||
|
||||
Account * posted_acc;
|
||||
@ -109,6 +111,8 @@ GncInvoice *gncInvoiceCreate (GNCBook *book)
|
||||
invoice->billto.type = GNC_OWNER_CUSTOMER;
|
||||
invoice->active = TRUE;
|
||||
|
||||
invoice->to_charge_amount = gnc_numeric_zero();
|
||||
|
||||
xaccGUIDNew (&invoice->guid, book);
|
||||
addObj (invoice);
|
||||
|
||||
@ -256,6 +260,16 @@ void gncInvoiceSetBillTo (GncInvoice *invoice, GncOwner *billto)
|
||||
gncInvoiceCommitEdit (invoice);
|
||||
}
|
||||
|
||||
void gncInvoiceSetToChargeAmount (GncInvoice *invoice, gnc_numeric amount)
|
||||
{
|
||||
if (!invoice) return;
|
||||
if (gnc_numeric_equal (invoice->to_charge_amount, amount)) return;
|
||||
gncInvoiceBeginEdit (invoice);
|
||||
invoice->to_charge_amount = amount;
|
||||
mark_invoice (invoice);
|
||||
gncInvoiceCommitEdit (invoice);
|
||||
}
|
||||
|
||||
void gncInvoiceSetDirty (GncInvoice *invoice, gboolean dirty)
|
||||
{
|
||||
if (!invoice) return;
|
||||
@ -451,6 +465,38 @@ gnc_numeric gncInvoiceGetTotal (GncInvoice *invoice)
|
||||
return total;
|
||||
}
|
||||
|
||||
gnc_numeric gncInvoiceGetTotalOf (GncInvoice *invoice, GncEntryPaymentType type)
|
||||
{
|
||||
GList *node;
|
||||
gnc_numeric total = gnc_numeric_zero();
|
||||
gboolean reverse;
|
||||
|
||||
if (!invoice) return total;
|
||||
|
||||
reverse = (gncInvoiceGetOwnerType (invoice) == GNC_OWNER_CUSTOMER);
|
||||
|
||||
for (node = gncInvoiceGetEntries(invoice); node; node = node->next) {
|
||||
GncEntry *entry = node->data;
|
||||
gnc_numeric value, tax;
|
||||
|
||||
if (gncEntryGetBillPayment (entry) != type)
|
||||
continue;
|
||||
|
||||
gncEntryGetValue (entry, reverse, &value, NULL, &tax, NULL);
|
||||
|
||||
if (gnc_numeric_check (value) == GNC_ERROR_OK)
|
||||
total = gnc_numeric_add (total, value, GNC_DENOM_AUTO, GNC_DENOM_LCD);
|
||||
else
|
||||
g_warning ("bad value in our entry");
|
||||
|
||||
if (gnc_numeric_check (value) == GNC_ERROR_OK)
|
||||
total = gnc_numeric_add (total, tax, GNC_DENOM_AUTO, GNC_DENOM_LCD);
|
||||
else
|
||||
g_warning ("bad tax-value in our entry");
|
||||
}
|
||||
return total;
|
||||
}
|
||||
|
||||
const char * gncInvoiceGetType (GncInvoice *invoice)
|
||||
{
|
||||
if (!invoice) return NULL;
|
||||
@ -503,6 +549,12 @@ gboolean gncInvoiceGetActive (GncInvoice *invoice)
|
||||
return invoice->active;
|
||||
}
|
||||
|
||||
gnc_numeric gncInvoiceGetToChargeAmount (GncInvoice *invoice)
|
||||
{
|
||||
if (!invoice) return gnc_numeric_zero();
|
||||
return invoice->to_charge_amount;
|
||||
}
|
||||
|
||||
GList * gncInvoiceGetEntries (GncInvoice *invoice)
|
||||
{
|
||||
if (!invoice) return NULL;
|
||||
@ -803,6 +855,27 @@ Transaction * gncInvoicePostToAccount (GncInvoice *invoice, Account *acc,
|
||||
xaccTransAppendSplit (txn, split);
|
||||
}
|
||||
|
||||
/* If there is a ccard account, we may have an additional "to_card" payment.
|
||||
* we should make that now..
|
||||
*/
|
||||
if (ccard_acct && !gnc_numeric_zero_p (invoice->to_charge_amount)) {
|
||||
Split *split = xaccMallocSplit (invoice->book);
|
||||
|
||||
/* Set memo. action? */
|
||||
xaccSplitSetMemo (split, _("Extra to Charge Card"));
|
||||
|
||||
xaccSplitSetBaseValue (split, (reverse ? invoice->to_charge_amount :
|
||||
gnc_numeric_neg(invoice->to_charge_amount)),
|
||||
invoice->currency);
|
||||
xaccAccountBeginEdit (ccard_acct);
|
||||
xaccAccountInsertSplit (ccard_acct, split);
|
||||
xaccAccountCommitEdit (ccard_acct);
|
||||
xaccTransAppendSplit (txn, split);
|
||||
|
||||
total = gnc_numeric_sub (total, invoice->to_charge_amount,
|
||||
GNC_DENOM_AUTO, GNC_DENOM_LCD);
|
||||
}
|
||||
|
||||
/* Now create the Posted split (which is negative -- it's a credit) */
|
||||
{
|
||||
Split *split = xaccMallocSplit (invoice->book);
|
||||
|
@ -34,6 +34,7 @@ void gncInvoiceSetNotes (GncInvoice *invoice, const char *notes);
|
||||
void gncInvoiceSetCurrency (GncInvoice *invoice, gnc_commodity *currency);
|
||||
void gncInvoiceSetActive (GncInvoice *invoice, gboolean active);
|
||||
void gncInvoiceSetBillTo (GncInvoice *invoice, GncOwner *billto);
|
||||
void gncInvoiceSetToChargeAmount (GncInvoice *invoice, gnc_numeric amount);
|
||||
|
||||
void gncInvoiceAddEntry (GncInvoice *invoice, GncEntry *entry);
|
||||
void gncInvoiceRemoveEntry (GncInvoice *invoice, GncEntry *entry);
|
||||
@ -57,6 +58,7 @@ const char * gncInvoiceGetNotes (GncInvoice *invoice);
|
||||
const char * gncInvoiceGetType (GncInvoice *invoice);
|
||||
gnc_commodity * gncInvoiceGetCurrency (GncInvoice *invoice);
|
||||
GncOwner * gncInvoiceGetBillTo (GncInvoice *invoice);
|
||||
gnc_numeric gncInvoiceGetToChargeAmount (GncInvoice *invoice);
|
||||
gboolean gncInvoiceGetActive (GncInvoice *invoice);
|
||||
|
||||
GNCLot * gncInvoiceGetPostedLot (GncInvoice *invoice);
|
||||
@ -65,6 +67,7 @@ Account * gncInvoiceGetPostedAcc (GncInvoice *invoice);
|
||||
|
||||
/* return the "total" amount of the invoice */
|
||||
gnc_numeric gncInvoiceGetTotal (GncInvoice *invoice);
|
||||
gnc_numeric gncInvoiceGetTotalOf (GncInvoice *invoice, GncEntryPaymentType type);
|
||||
|
||||
GList * gncInvoiceGetEntries (GncInvoice *invoice);
|
||||
|
||||
|
@ -19,6 +19,7 @@
|
||||
#include "gnc-engine-util.h"
|
||||
#include "gnc-date-edit.h"
|
||||
#include "gnc-menu-extensions.h"
|
||||
#include "gnc-amount-edit.h"
|
||||
#include "gnucash-sheet.h"
|
||||
#include "window-help.h"
|
||||
#include "window-report.h"
|
||||
@ -95,6 +96,8 @@ struct _invoice_window {
|
||||
/* Summary Bar Widgets */
|
||||
GtkWidget * summarybar_dock;
|
||||
GtkWidget * total_label;
|
||||
GtkWidget * total_cash_label;
|
||||
GtkWidget * total_charge_label;
|
||||
|
||||
/* Menu Widgets */
|
||||
GtkWidget * menu_print;
|
||||
@ -127,6 +130,10 @@ struct _invoice_window {
|
||||
GtkWidget * proj_job_box;
|
||||
GtkWidget * proj_job_choice;
|
||||
|
||||
/* Exp Voucher Widgets */
|
||||
GtkWidget * to_charge_frame;
|
||||
GtkWidget * to_charge_edit;
|
||||
|
||||
gint width;
|
||||
|
||||
GncBillTerm * terms;
|
||||
@ -221,6 +228,11 @@ static void gnc_ui_to_invoice (InvoiceWindow *iw, GncInvoice *invoice)
|
||||
gncInvoiceSetNotes (invoice, gtk_editable_get_chars
|
||||
(GTK_EDITABLE (iw->notes_text), 0, -1));
|
||||
|
||||
if (iw->to_charge_edit)
|
||||
gncInvoiceSetToChargeAmount (invoice,
|
||||
gnc_amount_edit_get_amount
|
||||
(GNC_AMOUNT_EDIT (iw->to_charge_edit)));
|
||||
|
||||
/* Only set these values for NEW/MOD INVOICE types */
|
||||
if (iw->dialog_type != EDIT_INVOICE) {
|
||||
gncInvoiceSetID (invoice, gtk_editable_get_chars
|
||||
@ -885,6 +897,25 @@ gnc_invoice_window_leave_notes_cb (GtkWidget *widget, GdkEventFocus *event,
|
||||
(GTK_EDITABLE (widget), 0, -1));
|
||||
}
|
||||
|
||||
static void
|
||||
gnc_invoice_window_leave_to_charge_cb (GtkWidget *widget, GdkEventFocus *event,
|
||||
gpointer data)
|
||||
{
|
||||
gnc_amount_edit_evaluate (GNC_AMOUNT_EDIT (widget));
|
||||
}
|
||||
|
||||
static void
|
||||
gnc_invoice_window_changed_to_charge_cb (GtkWidget *widget, gpointer data)
|
||||
{
|
||||
InvoiceWindow *iw = data;
|
||||
GncInvoice *invoice = iw_get_invoice(iw);
|
||||
|
||||
if (!invoice) return;
|
||||
|
||||
gncInvoiceSetToChargeAmount (invoice, gnc_amount_edit_get_amount
|
||||
(GNC_AMOUNT_EDIT (widget)));
|
||||
}
|
||||
|
||||
static GtkWidget *
|
||||
add_summary_label (GtkWidget *summarybar, const char *label_str)
|
||||
{
|
||||
@ -911,11 +942,18 @@ gnc_invoice_window_create_summary_bar (InvoiceWindow *iw)
|
||||
GtkWidget *summarybar;
|
||||
|
||||
iw->total_label = NULL;
|
||||
iw->total_cash_label = NULL;
|
||||
iw->total_charge_label = NULL;
|
||||
|
||||
summarybar = gtk_hbox_new (FALSE, 4);
|
||||
|
||||
iw->total_label = add_summary_label (summarybar, _("Total:"));
|
||||
|
||||
if (gncOwnerGetType (&iw->owner) == GNC_OWNER_EMPLOYEE) {
|
||||
iw->total_cash_label = add_summary_label (summarybar, _("Total Cash:"));
|
||||
iw->total_charge_label = add_summary_label (summarybar, _("Total Charge:"));
|
||||
}
|
||||
|
||||
return summarybar;
|
||||
}
|
||||
|
||||
@ -1284,13 +1322,22 @@ gnc_invoice_window_close_handler (gpointer user_data)
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
gnc_invoice_reset_total_label (GtkLabel *label, gnc_numeric amt)
|
||||
{
|
||||
char string[256];
|
||||
|
||||
xaccSPrintAmount (string, amt, gnc_default_print_info (TRUE));
|
||||
gtk_label_set_text (label, string);
|
||||
}
|
||||
|
||||
static void
|
||||
gnc_invoice_redraw_all_cb (GnucashRegister *g_reg, gpointer data)
|
||||
{
|
||||
InvoiceWindow *iw = data;
|
||||
GncInvoice * invoice;
|
||||
gnc_numeric amount;
|
||||
char string[256];
|
||||
gnc_commodity * currency;
|
||||
gnc_numeric amount, to_charge_amt = gnc_numeric_zero();
|
||||
|
||||
if (!iw)
|
||||
return;
|
||||
@ -1303,9 +1350,31 @@ gnc_invoice_redraw_all_cb (GnucashRegister *g_reg, gpointer data)
|
||||
return;
|
||||
|
||||
if (iw->total_label) {
|
||||
amount = gncInvoiceGetTotal(invoice);
|
||||
xaccSPrintAmount (string, amount, gnc_default_print_info (TRUE));
|
||||
gtk_label_set_text (GTK_LABEL (iw->total_label), string);
|
||||
amount = gncInvoiceGetTotal (invoice);
|
||||
gnc_invoice_reset_total_label (GTK_LABEL (iw->total_label), amount);
|
||||
}
|
||||
|
||||
/* Deal with extra items for the expense voucher */
|
||||
|
||||
currency = gncInvoiceGetCurrency (invoice);
|
||||
|
||||
if (iw->to_charge_edit) {
|
||||
gnc_amount_edit_evaluate (GNC_AMOUNT_EDIT (iw->to_charge_edit));
|
||||
to_charge_amt = gnc_amount_edit_get_amount(GNC_AMOUNT_EDIT(iw->to_charge_edit));
|
||||
}
|
||||
|
||||
if (iw->total_cash_label) {
|
||||
amount = gncInvoiceGetTotalOf (invoice, GNC_PAYMENT_CASH);
|
||||
amount = gnc_numeric_sub (amount, to_charge_amt,
|
||||
gnc_commodity_get_fraction (currency), GNC_RND_ROUND);
|
||||
gnc_invoice_reset_total_label (GTK_LABEL (iw->total_cash_label), amount);
|
||||
}
|
||||
|
||||
if (iw->total_charge_label) {
|
||||
amount = gncInvoiceGetTotalOf (invoice, GNC_PAYMENT_CARD);
|
||||
amount = gnc_numeric_add (amount, to_charge_amt,
|
||||
gnc_commodity_get_fraction (currency), GNC_RND_ROUND);
|
||||
gnc_invoice_reset_total_label (GTK_LABEL (iw->total_charge_label), amount);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1483,6 +1552,7 @@ gnc_invoice_update_window (InvoiceWindow *iw)
|
||||
const char *string;
|
||||
Timespec ts, ts_zero = {0,0};
|
||||
Account *acct;
|
||||
gnc_numeric amount;
|
||||
gint pos = 0;
|
||||
|
||||
gtk_entry_set_text (GTK_ENTRY (iw->id_entry), gncInvoiceGetID (invoice));
|
||||
@ -1510,6 +1580,10 @@ gnc_invoice_update_window (InvoiceWindow *iw)
|
||||
iw->terms = gncInvoiceGetTerms (invoice);
|
||||
gnc_ui_billterms_optionmenu (iw->terms_menu, iw->book, TRUE, &iw->terms);
|
||||
|
||||
/* fill in the to_charge amount */
|
||||
amount = gncInvoiceGetToChargeAmount (invoice);
|
||||
gnc_amount_edit_set_amount (GNC_AMOUNT_EDIT (iw->to_charge_edit), amount);
|
||||
|
||||
/*
|
||||
* Next, figure out if we've been posted, and if so set the
|
||||
* appropriate bits of information.. Then work on hiding or
|
||||
@ -1577,7 +1651,6 @@ gnc_invoice_update_window (InvoiceWindow *iw)
|
||||
gtk_widget_set_sensitive (iw->delete_button, !is_posted);
|
||||
gtk_widget_set_sensitive (iw->duplicate_button, !is_posted);
|
||||
gtk_widget_set_sensitive (iw->blank_button, !is_posted);
|
||||
gtk_widget_set_sensitive (iw->print_button, is_posted);
|
||||
gtk_widget_set_sensitive (iw->post_button, !is_posted);
|
||||
gtk_widget_set_sensitive (iw->unpost_button, can_unpost);
|
||||
|
||||
@ -1588,6 +1661,19 @@ gnc_invoice_update_window (InvoiceWindow *iw)
|
||||
gtk_widget_set_sensitive (iw->menu_edit_invoice, !is_posted);
|
||||
gtk_widget_set_sensitive (iw->menu_actions, !is_posted);
|
||||
|
||||
/* Set the to-change widget */
|
||||
gtk_widget_set_sensitive (iw->to_charge_edit, !is_posted);
|
||||
|
||||
/* Hide the to_charge frame for all non-employee invoices,
|
||||
* or set insensitive if the employee does not have a charge card
|
||||
*/
|
||||
if (iw->owner.type == GNC_OWNER_EMPLOYEE) {
|
||||
if (!gncEmployeeGetCCard (gncOwnerGetEmployee(&iw->owner)))
|
||||
gtk_widget_set_sensitive (iw->to_charge_edit, FALSE);
|
||||
} else {
|
||||
gtk_widget_hide_all (iw->to_charge_frame);
|
||||
}
|
||||
|
||||
if (is_posted) {
|
||||
// GtkWidget *hide;
|
||||
|
||||
@ -1596,7 +1682,6 @@ gnc_invoice_update_window (InvoiceWindow *iw)
|
||||
gtk_widget_set_sensitive (iw->id_entry, FALSE);
|
||||
gtk_widget_set_sensitive (iw->terms_menu, FALSE);
|
||||
gtk_widget_set_sensitive (iw->notes_text, FALSE); *//* XXX: should notes remain writable? */
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@ -1688,6 +1773,7 @@ gnc_invoice_new_window (GNCBook *bookp, InvoiceDialogType type,
|
||||
GncOwner *billto;
|
||||
|
||||
g_assert (type != NEW_INVOICE && type != MOD_INVOICE);
|
||||
g_assert (invoice != NULL);
|
||||
|
||||
/*
|
||||
* Find an existing window for this invoice. If found, bring it to
|
||||
@ -1773,6 +1859,33 @@ gnc_invoice_new_window (GNCBook *bookp, InvoiceDialogType type,
|
||||
iw->menu_edit_invoice = glade_xml_get_widget (xml, "menu_edit_invoice");
|
||||
iw->menu_actions = glade_xml_get_widget (xml, "menu_actions");
|
||||
|
||||
/* grab the to_charge widgets */
|
||||
{
|
||||
GtkWidget *edit;
|
||||
gnc_commodity *currency = gncInvoiceGetCurrency (invoice);
|
||||
GNCPrintAmountInfo print_info;
|
||||
|
||||
iw->to_charge_frame = glade_xml_get_widget (xml, "to_charge_frame");
|
||||
edit = gnc_amount_edit_new();
|
||||
print_info = gnc_commodity_print_info (currency, FALSE);
|
||||
gnc_amount_edit_set_evaluate_on_enter (GNC_AMOUNT_EDIT (edit), TRUE);
|
||||
gnc_amount_edit_set_print_info (GNC_AMOUNT_EDIT (edit), print_info);
|
||||
gnc_amount_edit_set_fraction (GNC_AMOUNT_EDIT (edit),
|
||||
gnc_commodity_get_fraction (currency));
|
||||
iw->to_charge_edit = edit;
|
||||
gtk_widget_show (edit);
|
||||
hbox = glade_xml_get_widget (xml, "to_charge_box");
|
||||
gtk_box_pack_start (GTK_BOX (hbox), edit, TRUE, TRUE, 0);
|
||||
|
||||
gtk_signal_connect (GTK_OBJECT(gnc_amount_edit_gtk_entry
|
||||
(GNC_AMOUNT_EDIT(edit))),
|
||||
"focus-out-event",
|
||||
GTK_SIGNAL_FUNC(gnc_invoice_window_leave_to_charge_cb), iw);
|
||||
gtk_signal_connect (GTK_OBJECT (edit), "amount_changed",
|
||||
GTK_SIGNAL_FUNC(gnc_invoice_window_changed_to_charge_cb),
|
||||
iw);
|
||||
}
|
||||
|
||||
/* grab the statusbar */
|
||||
iw->statusbar = glade_xml_get_widget (xml, "status_bar");
|
||||
|
||||
|
@ -2004,6 +2004,59 @@
|
||||
</widget>
|
||||
</widget>
|
||||
|
||||
<widget>
|
||||
<class>GtkFrame</class>
|
||||
<name>to_charge_frame</name>
|
||||
<label>Extra Payments</label>
|
||||
<label_xalign>0</label_xalign>
|
||||
<shadow_type>GTK_SHADOW_ETCHED_IN</shadow_type>
|
||||
<child>
|
||||
<padding>0</padding>
|
||||
<expand>True</expand>
|
||||
<fill>True</fill>
|
||||
</child>
|
||||
|
||||
<widget>
|
||||
<class>GtkHBox</class>
|
||||
<name>hbox9</name>
|
||||
<homogeneous>False</homogeneous>
|
||||
<spacing>0</spacing>
|
||||
|
||||
<widget>
|
||||
<class>GtkLabel</class>
|
||||
<name>label26</name>
|
||||
<label>Additional to Card:</label>
|
||||
<justify>GTK_JUSTIFY_RIGHT</justify>
|
||||
<wrap>False</wrap>
|
||||
<xalign>1</xalign>
|
||||
<yalign>0.5</yalign>
|
||||
<xpad>0</xpad>
|
||||
<ypad>0</ypad>
|
||||
<child>
|
||||
<padding>0</padding>
|
||||
<expand>False</expand>
|
||||
<fill>False</fill>
|
||||
</child>
|
||||
</widget>
|
||||
|
||||
<widget>
|
||||
<class>GtkHBox</class>
|
||||
<name>to_charge_box</name>
|
||||
<homogeneous>False</homogeneous>
|
||||
<spacing>0</spacing>
|
||||
<child>
|
||||
<padding>0</padding>
|
||||
<expand>False</expand>
|
||||
<fill>False</fill>
|
||||
</child>
|
||||
|
||||
<widget>
|
||||
<class>Placeholder</class>
|
||||
</widget>
|
||||
</widget>
|
||||
</widget>
|
||||
</widget>
|
||||
|
||||
<widget>
|
||||
<class>GtkFrame</class>
|
||||
<name>ledger_frame</name>
|
||||
|
Loading…
Reference in New Issue
Block a user