patch for split accumulation in invoice/bill posting
Derek Atkins
warlord at MIT.EDU
Tue Sep 21 09:24:26 EDT 2004
Hi,
This makes changes to the data file which I am unwilling to make
because it means you wont be able to read the new files in older
versions of gnucash. I.e., a file saved with "1.8.10" (assuming this
patch went in) would not be readable by 1.8.9.
Question: Is there some reason you need to store this flag? Why can't
it just be an argument during the post process, perhaps using a "file
property (preference)" as the default value?
So, in short, I don't object to this patch in theory, but I don't like
how it's implemented or how the user chooses the post method. Nor do
I like how it breaks the data file format.
Also, you include a few files multiple times in this patch, which would
make it hard to apply. :)
-derek
Daniel Lindenaar <d.j.w.lindenaar at student.tue.nl> writes:
> Hi all,
> Here is a patch implementing a choice for the user wether or not
> multiple entrys in an invoice for the same account should be accumulated
> into a single split. If not, each entry is given a split of it's own and
> the description of the entry is copied to the "memo" of the split.
>
>
> There are two patches. the one for 1.8.9 was created against the source
> debian package, but it fairly simple and should patch the current 1.8
> branch.
> the one for 1.9.0 is adapted to the latest CVS checkout of HEAD.
>
> The 1.9.0 branch compiles without any problems with the patch. I wasn't
> able to test wether it works correctly in this branch, since posting an
> invoice (with or without patch) gives the transactions with zero values.
> However, the splits are created as expected, but with all 0's. Is this a
> known bug?
>
> I am aware of the fact that this includes some GUI changes and that
> these should be made into the gnome2 branch, however, I couldn't compile
> that branch and don't have the time to look at it right now. When I do
> have time I'll look at that.
>
> greetz Daniel
>
> diff -urw -x 'Make*' gnucash-1.8.9/src/business/business-core/file/gnc-invoice-xml-v2.c mygnucashpatch/src/business/business-core/file/gnc-invoice-xml-v2.c
> --- gnucash-1.8.9/src/business/business-core/file/gnc-invoice-xml-v2.c 2003-09-11 19:45:25.000000000 +0200
> +++ mygnucashpatch/src/business/business-core/file/gnc-invoice-xml-v2.c 2004-09-20 15:46:51.000000000 +0200
> @@ -66,6 +66,7 @@
> #define invoice_billing_id_string "invoice:billing_id"
> #define invoice_notes_string "invoice:notes"
> #define invoice_active_string "invoice:active"
> +#define invoice_accumulatesplits_string "invoice:accsplits"
> #define invoice_posttxn_string "invoice:posttxn"
> #define invoice_postlot_string "invoice:postlot"
> #define invoice_postacc_string "invoice:postacc"
> @@ -130,6 +131,9 @@
> xmlAddChild(ret, int_to_dom_tree(invoice_active_string,
> gncInvoiceGetActive (invoice)));
>
> + xmlAddChild(ret, int_to_dom_tree(invoice_accumulatesplits_string,
> + gncInvoiceGetAccumulateSplits (invoice)));
> +
> txn = gncInvoiceGetPostedTxn (invoice);
> if (txn)
> xmlAddChild (ret, guid_to_dom_tree (invoice_posttxn_string,
> @@ -287,6 +291,20 @@
> }
>
> static gboolean
> +invoice_accumulatesplits_handler (xmlNodePtr node, gpointer invoice_pdata)
> +{
> + struct invoice_pdata *pdata = invoice_pdata;
> + gint64 val;
> + gboolean ret;
> +
> + ret = dom_tree_to_integer(node, &val);
> + if (ret)
> + gncInvoiceSetAccumulateSplits(pdata->invoice, (gboolean)val);
> +
> + return ret;
> +}
> +
> +static gboolean
> invoice_terms_handler (xmlNodePtr node, gpointer invoice_pdata)
> {
> struct invoice_pdata *pdata = invoice_pdata;
> @@ -416,6 +434,7 @@
> { invoice_billing_id_string, invoice_billing_id_handler, 0, 0 },
> { invoice_notes_string, invoice_notes_handler, 0, 0 },
> { invoice_active_string, invoice_active_handler, 1, 0 },
> + { invoice_accumulatesplits_string, invoice_accumulatesplits_handler, 0, 0 },
> { invoice_terms_string, invoice_terms_handler, 0, 0 },
> { invoice_posttxn_string, invoice_posttxn_handler, 0, 0 },
> { invoice_postlot_string, invoice_postlot_handler, 0, 0 },
>
>
> diff -urw -x 'Make*' gnucash-1.8.9/src/business/business-core/gncInvoice.c mygnucashpatch/src/business/business-core/gncInvoice.c
> --- gnucash-1.8.9/src/business/business-core/gncInvoice.c 2003-07-31 04:03:33.000000000 +0200
> +++ mygnucashpatch/src/business/business-core/gncInvoice.c 2004-09-20 17:09:04.000000000 +0200
> @@ -53,6 +53,7 @@
> GNCLot * posted_lot;
>
> gboolean active;
> + gboolean accumulatesplits;
>
> int editlevel;
> gboolean do_free;
> @@ -110,6 +111,7 @@
>
> invoice->billto.type = GNC_OWNER_CUSTOMER;
> invoice->active = TRUE;
> + invoice->accumulatesplits = TRUE;
>
> invoice->to_charge_amount = gnc_numeric_zero();
>
> @@ -240,6 +242,16 @@
> gncInvoiceCommitEdit (invoice);
> }
>
> +void gncInvoiceSetAccumulateSplits (GncInvoice *invoice, gboolean accumulate)
> +{
> + if (!invoice) return;
> + if (invoice->accumulatesplits == accumulate) return;
> + gncInvoiceBeginEdit (invoice);
> + invoice->accumulatesplits = accumulate;
> + mark_invoice (invoice);
> + gncInvoiceCommitEdit (invoice);
> +}
> +
> void gncInvoiceSetCurrency (GncInvoice *invoice, gnc_commodity *currency)
> {
> if (!invoice || !currency) return;
> @@ -552,6 +564,12 @@
> return invoice->active;
> }
>
> +gboolean gncInvoiceGetAccumulateSplits (GncInvoice *invoice)
> +{
> + if (!invoice) return FALSE;
> + return invoice->accumulatesplits;
> +}
> +
> gnc_numeric gncInvoiceGetToChargeAmount (GncInvoice *invoice)
> {
> if (!invoice) return gnc_numeric_zero();
> @@ -699,12 +717,15 @@
> GList *splitinfo = NULL;
> gnc_numeric total;
> gboolean reverse;
> + gboolean accumulatesplits;
> const char *name, *type;
> Account *ccard_acct = NULL;
> GncOwner *owner;
>
> if (!invoice || !acc) return NULL;
>
> + accumulatesplits = gncInvoiceGetAccumulateSplits(invoice);
> +
> gncInvoiceBeginEdit (invoice);
>
> /* Stabilize the Billing Terms of this invoice */
> @@ -795,7 +816,26 @@
> gncEntryGetBillAccount (entry));
> if (this_acc) {
> if (gnc_numeric_check (value) == GNC_ERROR_OK) {
> - splitinfo = gncAccountValueAdd (splitinfo, this_acc, value);
> + if (accumulatesplits) {
> + gncAccountValueAdd (splitinfo, this_acc, value);
> + } else {
> + Split *split;
> + //gncAccountValueAppend (splitinfo, this_acc, value));
> +
> + split = xaccMallocSplit (invoice->book);
> + /* set action and memo? */
> +
> + xaccSplitSetMemo (split, gncEntryGetDescription (entry));
> + xaccSplitSetAction (split, type);
> +
> + xaccSplitSetBaseValue (split, (reverse ? gnc_numeric_neg (value)
> + : value),
> + invoice->currency);
> + xaccAccountBeginEdit (this_acc);
> + xaccAccountInsertSplit (this_acc, split);
> + xaccAccountCommitEdit (this_acc);
> + xaccTransAppendSplit (txn, split);
> + }
>
> /* If there is a credit-card account, and this is a CCard
> * payment type, the don't add it to the total, and instead
>
> diff -urw -x 'Make*' gnucash-1.8.9/src/business/business-core/gncInvoice.h mygnucashpatch/src/business/business-core/gncInvoice.h
> --- gnucash-1.8.9/src/business/business-core/gncInvoice.h 2003-05-29 18:22:36.000000000 +0200
> +++ mygnucashpatch/src/business/business-core/gncInvoice.h 2004-09-20 14:17:53.000000000 +0200
> @@ -35,7 +35,7 @@
> void gncInvoiceSetActive (GncInvoice *invoice, gboolean active);
> void gncInvoiceSetBillTo (GncInvoice *invoice, GncOwner *billto);
> void gncInvoiceSetToChargeAmount (GncInvoice *invoice, gnc_numeric amount);
> -
> +void gncInvoiceSetAccumulateSplits (GncInvoice *invoice, gboolean accumulate);
> void gncInvoiceAddEntry (GncInvoice *invoice, GncEntry *entry);
> void gncInvoiceRemoveEntry (GncInvoice *invoice, GncEntry *entry);
>
> @@ -60,6 +60,7 @@
> GncOwner * gncInvoiceGetBillTo (GncInvoice *invoice);
> gnc_numeric gncInvoiceGetToChargeAmount (GncInvoice *invoice);
> gboolean gncInvoiceGetActive (GncInvoice *invoice);
> +gboolean gncInvoiceGetAccumulateSplits (GncInvoice *invoice);
>
> GNCLot * gncInvoiceGetPostedLot (GncInvoice *invoice);
> Transaction * gncInvoiceGetPostedTxn (GncInvoice *invoice);
> @@ -138,6 +139,7 @@
> #define INVOICE_POST_LOT "posted_lot"
> #define INVOICE_TYPE "type"
> #define INVOICE_BILLTO "bill-to"
> +#define INVOICE_ACCUSPLITS "Accumulate_splits?"
>
> #define INVOICE_FROM_LOT "invoice-from-lot"
> #define INVOICE_FROM_TXN "invoice-from-txn"
>
> diff -urw -x 'Make*' gnucash-1.8.9/src/business/business-gnome/dialog-invoice.c mygnucashpatch/src/business/business-gnome/dialog-invoice.c
> --- gnucash-1.8.9/src/business/business-gnome/dialog-invoice.c 2003-06-16 04:26:03.000000000 +0200
> +++ mygnucashpatch/src/business/business-gnome/dialog-invoice.c 2004-09-20 15:56:51.000000000 +0200
> @@ -114,6 +114,7 @@
> GtkWidget * posted_date_hbox;
> GtkWidget * posted_date;
> GtkWidget * active_check;
> + GtkWidget * accumulatesplits_check;
>
> GtkWidget * owner_box;
> GtkWidget * owner_label;
> @@ -191,6 +192,7 @@
> void gnc_invoice_window_summarybar_cb (GtkWidget *widget, gpointer data);
>
> void gnc_invoice_window_active_toggled_cb (GtkWidget *widget, gpointer data);
> +void gnc_invoice_window_accumulatesplits_toggled_cb(GtkWidget *widget, gpointer data);
> void gnc_invoice_window_leave_notes_cb (GtkWidget *widget, GdkEventFocus *event, gpointer data);
>
> #define INV_WIDTH_PREFIX "invoice_reg"
> @@ -227,6 +229,10 @@
> gncInvoiceSetActive (invoice, gtk_toggle_button_get_active
> (GTK_TOGGLE_BUTTON (iw->active_check)));
>
> + if (iw->accumulatesplits_check)
> + gncInvoiceSetAccumulateSplits (invoice, gtk_toggle_button_get_active
> + (GTK_TOGGLE_BUTTON (iw->accumulatesplits_check)));
> +
> gncInvoiceSetNotes (invoice, gtk_editable_get_chars
> (GTK_EDITABLE (iw->notes_text), 0, -1));
>
> @@ -887,6 +893,18 @@
> }
>
> void
> +gnc_invoice_window_accumulatesplits_toggled_cb (GtkWidget *widget, gpointer data)
> +{
> + InvoiceWindow *iw = data;
> + GncInvoice *invoice = iw_get_invoice(iw);
> +
> + if (!invoice) return;
> +
> + gncInvoiceSetAccumulateSplits (invoice,
> + gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (widget)));
> +}
> +
> +void
> gnc_invoice_window_leave_notes_cb (GtkWidget *widget, GdkEventFocus *event,
> gpointer data)
> {
> @@ -1587,6 +1605,10 @@
> gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (iw->active_check),
> gncInvoiceGetActive (invoice));
>
> + if (iw->accumulatesplits_check)
> + gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (iw->accumulatesplits_check),
> + gncInvoiceGetAccumulateSplits (invoice));
> +
> ts = gncInvoiceGetDateOpened (invoice);
> if (timespec_equal (&ts, &ts_zero)) {
> gnc_date_edit_set_time (GNC_DATE_EDIT (iw->opened_date), time(NULL));
> @@ -1852,6 +1874,7 @@
> iw->terms_menu = glade_xml_get_widget (xml, "terms_menu");
> iw->notes_text = glade_xml_get_widget (xml, "notes_text");
> iw->active_check = glade_xml_get_widget (xml, "active_check");
> + iw->accumulatesplits_check = glade_xml_get_widget (xml, "accumulatesplits_check");
> iw->owner_box = glade_xml_get_widget (xml, "owner_hbox");
> iw->owner_label = glade_xml_get_widget (xml, "owner_label");
> iw->job_label = glade_xml_get_widget (xml, "job_label");
> Only in mygnucashpatch/src/business/business-gnome: g-wrapped
> diff -urw -x 'Make*' gnucash-1.8.9/src/business/business-gnome/glade/invoice.glade mygnucashpatch/src/business/business-gnome/glade/invoice.glade
> --- gnucash-1.8.9/src/business/business-gnome/glade/invoice.glade 2003-04-01 23:17:32.000000000 +0200
> +++ mygnucashpatch/src/business/business-gnome/glade/invoice.glade 2004-09-20 16:23:55.000000000 +0200
> @@ -1543,6 +1543,23 @@
>
> <widget>
> <class>GtkLabel</class>
> + <name>label9</name>
> + <label></label>
> + <justify>GTK_JUSTIFY_CENTER</justify>
> + <wrap>False</wrap>
> + <xalign>0.5</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>GtkLabel</class>
> <name>hide3</name>
> <label></label>
> <justify>GTK_JUSTIFY_CENTER</justify>
> @@ -1653,6 +1670,26 @@
> </widget>
>
> <widget>
> + <class>GtkCheckButton</class>
> + <name>accumulatesplits_check</name>
> + <can_focus>True</can_focus>
> + <signal>
> + <name>toggled</name>
> + <handler>gnc_invoice_window_accumulatesplits_toggled_cb</handler>
> + <data>Invoice Entry Window</data>
> + <last_modification_time>Mon, 20 Sep 2004 12:47:48 GMT</last_modification_time>
> + </signal>
> + <label>Accumulate Splits</label>
> + <active>False</active>
> + <draw_indicator>True</draw_indicator>
> + <child>
> + <padding>0</padding>
> + <expand>False</expand>
> + <fill>False</fill>
> + </child>
> + </widget>
> +
> + <widget>
> <class>GtkLabel</class>
> <name>hide4</name>
> <label></label>
>
> ? src/business/business-core/.gncInvoice.h.rej.swp
> Index: src/business/business-core/gncInvoice.c
> ===================================================================
> RCS file: /home/cvs/cvsroot/gnucash/src/business/business-core/gncInvoice.c,v
> retrieving revision 1.92
> diff -u -r1.92 gncInvoice.c
> --- src/business/business-core/gncInvoice.c 19 Aug 2004 19:47:34 -0000 1.92
> +++ src/business/business-core/gncInvoice.c 20 Sep 2004 16:06:49 -0000
> @@ -67,6 +67,7 @@
> char * id;
> char * notes;
> gboolean active;
> + gboolean accumulatesplits;
>
> char * billing_id;
> char * printname;
> @@ -134,6 +135,7 @@
>
> invoice->billto.type = GNC_OWNER_CUSTOMER;
> invoice->active = TRUE;
> + invoice->accumulatesplits = TRUE;
>
> invoice->to_charge_amount = gnc_numeric_zero();
>
> @@ -317,6 +319,16 @@
> gncInvoiceCommitEdit (invoice);
> }
>
> +void gncInvoiceSetAccumulateSplits (GncInvoice *invoice, gboolean accumulate)
> +{
> + if (!invoice) return;
> + if (invoice->accumulatesplits == accumulate) return;
> + gncInvoiceBeginEdit (invoice);
> + invoice->accumulatesplits = accumulate;
> + mark_invoice (invoice);
> + gncInvoiceCommitEdit (invoice);
> +}
> +
> void gncInvoiceSetCurrency (GncInvoice *invoice, gnc_commodity *currency)
> {
> if (!invoice || !currency) return;
> @@ -612,6 +624,12 @@
> return invoice->active;
> }
>
> +gboolean gncInvoiceGetAccumulateSplits (GncInvoice *invoice)
> +{
> + if (!invoice) return FALSE;
> + return invoice->accumulatesplits;
> +}
> +
> gnc_numeric gncInvoiceGetToChargeAmount (GncInvoice *invoice)
> {
> if (!invoice) return gnc_numeric_zero();
> @@ -751,12 +769,15 @@
> gnc_numeric total;
> gboolean reverse;
> const char *name, *type;
> + gboolean accumulatesplits;
> char *lot_title;
> Account *ccard_acct = NULL;
> GncOwner *owner;
>
> if (!invoice || !acc) return NULL;
>
> + accumulatesplits = gncInvoiceGetAccumulateSplits(invoice);
> +
> gncInvoiceBeginEdit (invoice);
>
> /* Stabilize the Billing Terms of this invoice */
> @@ -853,7 +874,26 @@
> gncEntryGetBillAccount (entry));
> if (this_acc) {
> if (gnc_numeric_check (value) == GNC_ERROR_OK) {
> - splitinfo = gncAccountValueAdd (splitinfo, this_acc, value);
> + if (accumulatesplits) {
> + gncAccountValueAdd (splitinfo, this_acc, value);
> + } else {
> + Split *split;
> + //gncAccountValueAppend (splitinfo, this_acc, value));
> +
> + split = xaccMallocSplit (invoice->book);
> + /* set action and memo? */
> +
> + xaccSplitSetMemo (split, gncEntryGetDescription (entry));
> + xaccSplitSetAction (split, type);
> +
> + xaccSplitSetBaseValue (split, (reverse ? gnc_numeric_neg (value)
> + : value),
> + invoice->currency);
> + xaccAccountBeginEdit (this_acc);
> + xaccAccountInsertSplit (this_acc, split);
> + xaccAccountCommitEdit (this_acc);
> + xaccTransAppendSplit (txn, split);
> + }
>
> /* If there is a credit-card account, and this is a CCard
> * payment type, the don't add it to the total, and instead
> Index: src/business/business-core/gncInvoice.h
> ===================================================================
> RCS file: /home/cvs/cvsroot/gnucash/src/business/business-core/gncInvoice.h,v
> retrieving revision 1.41
> diff -u -r1.41 gncInvoice.h
> --- src/business/business-core/gncInvoice.h 7 May 2004 05:11:49 -0000 1.41
> +++ src/business/business-core/gncInvoice.h 20 Sep 2004 16:06:49 -0000
> @@ -65,6 +65,7 @@
> void gncInvoiceSetActive (GncInvoice *invoice, gboolean active);
> void gncInvoiceSetBillTo (GncInvoice *invoice, GncOwner *billto);
> void gncInvoiceSetToChargeAmount (GncInvoice *invoice, gnc_numeric amount);
> +void gncInvoiceSetAccumulateSplits(GncInvoice *invoice, gboolean accumulate);
> /** @} */
>
> void gncInvoiceAddEntry (GncInvoice *invoice, GncEntry *entry);
> @@ -89,6 +90,7 @@
> GncOwner * gncInvoiceGetBillTo (GncInvoice *invoice);
> gnc_numeric gncInvoiceGetToChargeAmount (GncInvoice *invoice);
> gboolean gncInvoiceGetActive (GncInvoice *invoice);
> +gboolean gncInvoiceGetAccumulateSplits (GncInvoice *invoice);
>
> GNCLot * gncInvoiceGetPostedLot (GncInvoice *invoice);
> Transaction * gncInvoiceGetPostedTxn (GncInvoice *invoice);
> @@ -176,6 +178,7 @@
> #define INVOICE_POST_LOT "posted_lot"
> #define INVOICE_TYPE "type"
> #define INVOICE_BILLTO "bill-to"
> +#define INVOICE_ACCUSPLITS "Accumulate_splits?"
>
> #define INVOICE_FROM_LOT "invoice-from-lot"
> #define INVOICE_FROM_TXN "invoice-from-txn"
> Index: src/business/business-core/file/gnc-invoice-xml-v2.c
> ===================================================================
> RCS file: /home/cvs/cvsroot/gnucash/src/business/business-core/file/gnc-invoice-xml-v2.c,v
> retrieving revision 1.19
> diff -u -r1.19 gnc-invoice-xml-v2.c
> --- src/business/business-core/file/gnc-invoice-xml-v2.c 19 Oct 2003 05:13:52 -0000 1.19
> +++ src/business/business-core/file/gnc-invoice-xml-v2.c 20 Sep 2004 16:06:49 -0000
> @@ -67,6 +67,7 @@
> #define invoice_billing_id_string "invoice:billing_id"
> #define invoice_notes_string "invoice:notes"
> #define invoice_active_string "invoice:active"
> +#define invoice_accumulatesplits_string "invoice:accsplits"
> #define invoice_posttxn_string "invoice:posttxn"
> #define invoice_postlot_string "invoice:postlot"
> #define invoice_postacc_string "invoice:postacc"
> @@ -131,6 +132,9 @@
> xmlAddChild(ret, int_to_dom_tree(invoice_active_string,
> gncInvoiceGetActive (invoice)));
>
> + xmlAddChild(ret, int_to_dom_tree(invoice_accumulatesplits_string,
> + gncInvoiceGetAccumulateSplits (invoice)));
> +
> txn = gncInvoiceGetPostedTxn (invoice);
> if (txn)
> xmlAddChild (ret, guid_to_dom_tree (invoice_posttxn_string,
> @@ -286,6 +290,20 @@
> }
>
> static gboolean
> +invoice_accumulatesplits_handler (xmlNodePtr node, gpointer invoice_pdata)
> +{
> + struct invoice_pdata *pdata = invoice_pdata;
> + gint64 val;
> + gboolean ret;
> +
> + ret = dom_tree_to_integer(node, &val);
> + if (ret)
> + gncInvoiceSetAccumulateSplits(pdata->invoice, (gboolean)val);
> +
> + return ret;
> +}
> +
> +static gboolean
> invoice_terms_handler (xmlNodePtr node, gpointer invoice_pdata)
> {
> struct invoice_pdata *pdata = invoice_pdata;
> @@ -415,6 +433,7 @@
> { invoice_billing_id_string, invoice_billing_id_handler, 0, 0 },
> { invoice_notes_string, invoice_notes_handler, 0, 0 },
> { invoice_active_string, invoice_active_handler, 1, 0 },
> + { invoice_accumulatesplits_string, invoice_accumulatesplits_handler, 0, 0 },
> { invoice_terms_string, invoice_terms_handler, 0, 0 },
> { invoice_posttxn_string, invoice_posttxn_handler, 0, 0 },
> { invoice_postlot_string, invoice_postlot_handler, 0, 0 },
> Index: src/business/business-gnome/dialog-invoice.c
> ===================================================================
> RCS file: /home/cvs/cvsroot/gnucash/src/business/business-gnome/dialog-invoice.c,v
> retrieving revision 1.100
> diff -u -r1.100 dialog-invoice.c
> --- src/business/business-gnome/dialog-invoice.c 26 Jun 2004 14:52:12 -0000 1.100
> +++ src/business/business-gnome/dialog-invoice.c 20 Sep 2004 16:06:52 -0000
> @@ -137,6 +137,7 @@
> GtkWidget * posted_date_hbox;
> GtkWidget * posted_date;
> GtkWidget * active_check;
> + GtkWidget * accumulatesplits_check;
>
> GtkWidget * owner_box;
> GtkWidget * owner_label;
> @@ -217,6 +218,7 @@
> void gnc_invoice_window_summarybar_cb (GtkWidget *widget, gpointer data);
>
> void gnc_invoice_window_active_toggled_cb (GtkWidget *widget, gpointer data);
> +void gnc_invoice_window_accumulatesplits_toggled_cb(GtkWidget *widget, gpointer data);
> void gnc_invoice_window_leave_notes_cb (GtkWidget *widget, GdkEventFocus *event, gpointer data);
>
> #define INV_WIDTH_PREFIX "invoice_reg"
> @@ -308,6 +310,10 @@
> gncInvoiceSetActive (invoice, gtk_toggle_button_get_active
> (GTK_TOGGLE_BUTTON (iw->active_check)));
>
> + if (iw->accumulatesplits_check)
> + gncInvoiceSetAccumulateSplits (invoice, gtk_toggle_button_get_active
> + (GTK_TOGGLE_BUTTON (iw->accumulatesplits_check)));
> +
> gncInvoiceSetNotes (invoice, gtk_editable_get_chars
> (GTK_EDITABLE (iw->notes_text), 0, -1));
>
> @@ -964,6 +970,18 @@
> }
>
> void
> +gnc_invoice_window_accumulatesplits_toggled_cb (GtkWidget *widget, gpointer data)
> +{
> + InvoiceWindow *iw = data;
> + GncInvoice *invoice = iw_get_invoice(iw);
> +
> + if (!invoice) return;
> +
> + gncInvoiceSetAccumulateSplits (invoice,
> + gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (widget)));
> +}
> +
> +void
> gnc_invoice_window_leave_notes_cb (GtkWidget *widget, GdkEventFocus *event,
> gpointer data)
> {
> @@ -1664,6 +1682,10 @@
> gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (iw->active_check),
> gncInvoiceGetActive (invoice));
>
> + if (iw->accumulatesplits_check)
> + gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (iw->accumulatesplits_check),
> + gncInvoiceGetAccumulateSplits (invoice));
> +
> ts = gncInvoiceGetDateOpened (invoice);
> if (timespec_equal (&ts, &ts_zero)) {
> gnc_date_edit_set_time (GNC_DATE_EDIT (iw->opened_date), time(NULL));
> @@ -1929,6 +1951,7 @@
> iw->terms_menu = glade_xml_get_widget (xml, "terms_menu");
> iw->notes_text = glade_xml_get_widget (xml, "notes_text");
> iw->active_check = glade_xml_get_widget (xml, "active_check");
> + iw->accumulatesplits_check = glade_xml_get_widget (xml, "accumulatesplits_check");
> iw->owner_box = glade_xml_get_widget (xml, "owner_hbox");
> iw->owner_label = glade_xml_get_widget (xml, "owner_label");
> iw->job_label = glade_xml_get_widget (xml, "job_label");
> Index: src/business/business-gnome/glade/invoice.glade
> ===================================================================
> RCS file: /home/cvs/cvsroot/gnucash/src/business/business-gnome/glade/invoice.glade,v
> retrieving revision 1.19
> diff -u -r1.19 invoice.glade
> --- src/business/business-gnome/glade/invoice.glade 29 May 2003 03:02:11 -0000 1.19
> +++ src/business/business-gnome/glade/invoice.glade 20 Sep 2004 16:06:53 -0000
> @@ -1543,6 +1543,23 @@
>
> <widget>
> <class>GtkLabel</class>
> + <name>label9</name>
> + <label></label>
> + <justify>GTK_JUSTIFY_CENTER</justify>
> + <wrap>False</wrap>
> + <xalign>0.5</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>GtkLabel</class>
> <name>hide3</name>
> <label></label>
> <justify>GTK_JUSTIFY_CENTER</justify>
> @@ -1653,6 +1670,26 @@
> </widget>
>
> <widget>
> + <class>GtkCheckButton</class>
> + <name>accumulatesplits_check</name>
> + <can_focus>True</can_focus>
> + <signal>
> + <name>toggled</name>
> + <handler>gnc_invoice_window_accumulatesplits_toggled_cb</handler>
> + <data>Invoice Entry Window</data>
> + <last_modification_time>Mon, 20 Sep 2004 12:47:48 GMT</last_modification_time>
> + </signal>
> + <label>Accumulate Splits</label>
> + <active>False</active>
> + <draw_indicator>True</draw_indicator>
> + <child>
> + <padding>0</padding>
> + <expand>False</expand>
> + <fill>False</fill>
> + </child>
> + </widget>
> +
> + <widget>
> <class>GtkLabel</class>
> <name>hide4</name>
> <label></label>
>
> _______________________________________________
> gnucash-patches mailing list
> gnucash-patches at gnucash.org
> https://lists.gnucash.org/mailman/listinfo/gnucash-patches
--
Derek Atkins, SB '93 MIT EE, SM '95 MIT Media Laboratory
Member, MIT Student Information Processing Board (SIPB)
URL: http://web.mit.edu/warlord/ PP-ASEL-IA N1NWH
warlord at MIT.EDU PGP key available
More information about the gnucash-patches
mailing list