r18789 - gnucash/trunk/src/business - Re-indentation of source code, next batch: src/business/*

Christian Stimming cstim at code.gnucash.org
Tue Mar 2 16:41:07 EST 2010


Author: cstim
Date: 2010-03-02 16:41:05 -0500 (Tue, 02 Mar 2010)
New Revision: 18789
Trac: http://svn.gnucash.org/trac/changeset/18789

Modified:
   gnucash/trunk/src/business/business-core/gncAddress.c
   gnucash/trunk/src/business/business-core/gncAddress.h
   gnucash/trunk/src/business/business-core/gncBillTerm.c
   gnucash/trunk/src/business/business-core/gncBillTerm.h
   gnucash/trunk/src/business/business-core/gncBillTermP.h
   gnucash/trunk/src/business/business-core/gncBusGuile.c
   gnucash/trunk/src/business/business-core/gncBusPeriod.c
   gnucash/trunk/src/business/business-core/gncBusiness.c
   gnucash/trunk/src/business/business-core/gncBusiness.h
   gnucash/trunk/src/business/business-core/gncCustomer.c
   gnucash/trunk/src/business/business-core/gncCustomer.h
   gnucash/trunk/src/business/business-core/gncCustomerP.h
   gnucash/trunk/src/business/business-core/gncEmployee.c
   gnucash/trunk/src/business/business-core/gncEmployee.h
   gnucash/trunk/src/business/business-core/gncEmployeeP.h
   gnucash/trunk/src/business/business-core/gncEntry.c
   gnucash/trunk/src/business/business-core/gncEntry.h
   gnucash/trunk/src/business/business-core/gncEntryP.h
   gnucash/trunk/src/business/business-core/gncInvoice.c
   gnucash/trunk/src/business/business-core/gncInvoice.h
   gnucash/trunk/src/business/business-core/gncInvoiceP.h
   gnucash/trunk/src/business/business-core/gncJob.c
   gnucash/trunk/src/business/business-core/gncOrder.c
   gnucash/trunk/src/business/business-core/gncOrder.h
   gnucash/trunk/src/business/business-core/gncOrderP.h
   gnucash/trunk/src/business/business-core/gncOwner.c
   gnucash/trunk/src/business/business-core/gncOwner.h
   gnucash/trunk/src/business/business-core/gncOwnerP.h
   gnucash/trunk/src/business/business-core/gncTaxTable.c
   gnucash/trunk/src/business/business-core/gncTaxTable.h
   gnucash/trunk/src/business/business-core/gncVendor.c
   gnucash/trunk/src/business/business-core/gncVendor.h
   gnucash/trunk/src/business/business-core/gncVendorP.h
   gnucash/trunk/src/business/business-core/sql/gnc-address-sql.c
   gnucash/trunk/src/business/business-core/sql/gnc-bill-term-sql.c
   gnucash/trunk/src/business/business-core/sql/gnc-customer-sql.c
   gnucash/trunk/src/business/business-core/sql/gnc-employee-sql.c
   gnucash/trunk/src/business/business-core/sql/gnc-entry-sql.c
   gnucash/trunk/src/business/business-core/sql/gnc-invoice-sql.c
   gnucash/trunk/src/business/business-core/sql/gnc-job-sql.c
   gnucash/trunk/src/business/business-core/sql/gnc-order-sql.c
   gnucash/trunk/src/business/business-core/sql/gnc-owner-sql.c
   gnucash/trunk/src/business/business-core/sql/gnc-tax-table-sql.c
   gnucash/trunk/src/business/business-core/sql/gnc-vendor-sql.c
   gnucash/trunk/src/business/business-core/test/test-address.c
   gnucash/trunk/src/business/business-core/test/test-business.c
   gnucash/trunk/src/business/business-core/test/test-customer.c
   gnucash/trunk/src/business/business-core/test/test-employee.c
   gnucash/trunk/src/business/business-core/test/test-job.c
   gnucash/trunk/src/business/business-core/test/test-load-module.c
   gnucash/trunk/src/business/business-core/test/test-vendor.c
   gnucash/trunk/src/business/business-core/xml/gnc-address-xml-v2.c
   gnucash/trunk/src/business/business-core/xml/gnc-bill-term-xml-v2.c
   gnucash/trunk/src/business/business-core/xml/gnc-customer-xml-v2.c
   gnucash/trunk/src/business/business-core/xml/gnc-employee-xml-v2.c
   gnucash/trunk/src/business/business-core/xml/gnc-entry-xml-v2.c
   gnucash/trunk/src/business/business-core/xml/gnc-invoice-xml-v2.c
   gnucash/trunk/src/business/business-core/xml/gnc-job-xml-v2.c
   gnucash/trunk/src/business/business-core/xml/gnc-order-xml-v2.c
   gnucash/trunk/src/business/business-core/xml/gnc-owner-xml-v2.c
   gnucash/trunk/src/business/business-core/xml/gnc-owner-xml-v2.h
   gnucash/trunk/src/business/business-core/xml/gnc-tax-table-xml-v2.c
   gnucash/trunk/src/business/business-core/xml/gnc-vendor-xml-v2.c
   gnucash/trunk/src/business/business-core/xml/xml-helpers.h
   gnucash/trunk/src/business/business-gnome/business-gnome-utils.c
   gnucash/trunk/src/business/business-gnome/business-gnome-utils.h
   gnucash/trunk/src/business/business-gnome/business-options-gnome.c
   gnucash/trunk/src/business/business-gnome/business-urls.c
   gnucash/trunk/src/business/business-gnome/dialog-billterms.c
   gnucash/trunk/src/business/business-gnome/dialog-choose-owner.c
   gnucash/trunk/src/business/business-gnome/dialog-customer.c
   gnucash/trunk/src/business/business-gnome/dialog-date-close.c
   gnucash/trunk/src/business/business-gnome/dialog-date-close.h
   gnucash/trunk/src/business/business-gnome/dialog-employee.c
   gnucash/trunk/src/business/business-gnome/dialog-invoice.c
   gnucash/trunk/src/business/business-gnome/dialog-invoice.h
   gnucash/trunk/src/business/business-gnome/dialog-job.c
   gnucash/trunk/src/business/business-gnome/dialog-job.h
   gnucash/trunk/src/business/business-gnome/dialog-order.c
   gnucash/trunk/src/business/business-gnome/dialog-order.h
   gnucash/trunk/src/business/business-gnome/dialog-payment.c
   gnucash/trunk/src/business/business-gnome/dialog-payment.h
   gnucash/trunk/src/business/business-gnome/dialog-vendor.c
   gnucash/trunk/src/business/business-gnome/gnc-plugin-business.c
   gnucash/trunk/src/business/business-gnome/gnc-plugin-business.h
   gnucash/trunk/src/business/business-gnome/gnc-plugin-page-invoice.c
   gnucash/trunk/src/business/business-gnome/gnc-plugin-page-invoice.h
   gnucash/trunk/src/business/business-gnome/search-owner.c
   gnucash/trunk/src/business/business-gnome/search-owner.h
   gnucash/trunk/src/business/business-ledger/gncEntryLedger.c
   gnucash/trunk/src/business/business-ledger/gncEntryLedger.h
   gnucash/trunk/src/business/business-ledger/gncEntryLedgerControl.c
   gnucash/trunk/src/business/business-ledger/gncEntryLedgerDisplay.c
   gnucash/trunk/src/business/business-ledger/gncEntryLedgerLayout.c
   gnucash/trunk/src/business/business-ledger/gncEntryLedgerLoad.c
   gnucash/trunk/src/business/business-ledger/gncEntryLedgerModel.c
   gnucash/trunk/src/business/business-ledger/gncEntryLedgerP.h
   gnucash/trunk/src/business/business-utils/business-options.c
   gnucash/trunk/src/business/business-utils/business-options.h
   gnucash/trunk/src/business/dialog-tax-table/dialog-tax-table.c
Log:
Re-indentation of source code, next batch: src/business/*

This also strips trailing whitespaces from lines where they existed.
This re-indentation was done using astyle-1.24 using the following options:

astyle --indent=spaces=4 --brackets=break --pad-oper --pad-header --suffix=none

Modified: gnucash/trunk/src/business/business-core/gncAddress.c
===================================================================
--- gnucash/trunk/src/business/business-core/gncAddress.c	2010-03-02 21:40:28 UTC (rev 18788)
+++ gnucash/trunk/src/business/business-core/gncAddress.c	2010-03-02 21:41:05 UTC (rev 18789)
@@ -33,26 +33,26 @@
 #include "gncAddressP.h"
 #include "gncCustomerP.h"
 
-struct _gncAddress 
+struct _gncAddress
 {
-  QofInstance inst;
+    QofInstance inst;
 
-  QofBook *	book;
-  QofInstance * parent;
-  gboolean	dirty;
-  char *	name;
-  char *	addr1;
-  char *	addr2;
-  char *	addr3;
-  char *	addr4;
-  char *	phone;
-  char *	fax;
-  char *	email;
+    QofBook *	book;
+    QofInstance * parent;
+    gboolean	dirty;
+    char *	name;
+    char *	addr1;
+    char *	addr2;
+    char *	addr3;
+    char *	addr4;
+    char *	phone;
+    char *	fax;
+    char *	email;
 };
 
 struct _gncAddressClass
 {
-  QofInstanceClass parent_class;
+    QofInstanceClass parent_class;
 };
 
 static QofLogModule log_module = GNC_MOD_BUSINESS;
@@ -62,15 +62,16 @@
 G_INLINE_FUNC void mark_address (GncAddress *address);
 void mark_address (GncAddress *address)
 {
-  address->dirty = TRUE;
+    address->dirty = TRUE;
 
-  qof_event_gen (QOF_INSTANCE(address), QOF_EVENT_MODIFY, address->parent);
-  qof_event_gen (address->parent, QOF_EVENT_MODIFY, NULL);
+    qof_event_gen (QOF_INSTANCE(address), QOF_EVENT_MODIFY, address->parent);
+    qof_event_gen (address->parent, QOF_EVENT_MODIFY, NULL);
 }
 
-enum {
+enum
+{
     PROP_0,
-	PROP_NAME
+    PROP_NAME
 };
 
 /* GObject Initialization */
@@ -95,43 +96,45 @@
 
 static void
 gnc_address_get_property (GObject         *object,
-			  guint            prop_id,
-			  GValue          *value,
-			  GParamSpec      *pspec)
+                          guint            prop_id,
+                          GValue          *value,
+                          GParamSpec      *pspec)
 {
     GncAddress *address;
 
     g_return_if_fail(GNC_IS_ADDRESS(object));
 
     address = GNC_ADDRESS(object);
-    switch (prop_id) {
-	case PROP_NAME:
-	    g_value_set_string(value, address->name);
-		break;
-	default:
-	    G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec);
-	    break;
+    switch (prop_id)
+    {
+    case PROP_NAME:
+        g_value_set_string(value, address->name);
+        break;
+    default:
+        G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec);
+        break;
     }
 }
 
 static void
 gnc_address_set_property (GObject         *object,
-			  guint            prop_id,
-			  const GValue          *value,
-			  GParamSpec      *pspec)
+                          guint            prop_id,
+                          const GValue          *value,
+                          GParamSpec      *pspec)
 {
     GncAddress *address;
 
     g_return_if_fail(GNC_IS_ADDRESS(object));
 
     address = GNC_ADDRESS(object);
-    switch (prop_id) {
-	case PROP_NAME:
-	    gncAddressSetName(address, g_value_get_string(value));
-		break;
-	default:
-	    G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec);
-	    break;
+    switch (prop_id)
+    {
+    case PROP_NAME:
+        gncAddressSetName(address, g_value_get_string(value));
+        break;
+    default:
+        G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec);
+        break;
     }
 }
 
@@ -139,124 +142,133 @@
 gnc_address_class_init (GncAddressClass *klass)
 {
     GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
-	
+
     gobject_class->dispose = gnc_address_dispose;
     gobject_class->finalize = gnc_address_finalize;
     gobject_class->set_property = gnc_address_set_property;
     gobject_class->get_property = gnc_address_get_property;
 
     g_object_class_install_property
-	(gobject_class,
-	 PROP_NAME,
-	 g_param_spec_string ("name",
-			      "Address Name",
-			      "The address name is an arbitrary string "
-			      "assigned by the user.  It is intended to "
-			      "a short string to identify the address.",
-			      NULL,
-			      G_PARAM_READWRITE));
+    (gobject_class,
+     PROP_NAME,
+     g_param_spec_string ("name",
+                          "Address Name",
+                          "The address name is an arbitrary string "
+                          "assigned by the user.  It is intended to "
+                          "a short string to identify the address.",
+                          NULL,
+                          G_PARAM_READWRITE));
 }
 
 /* Create/Destroy functions */
 
-GncAddress * 
+GncAddress *
 gncAddressCreate (QofBook *book, QofInstance *prnt)
 {
-  GncAddress *addr;
+    GncAddress *addr;
 
-  if (!book) return NULL;
+    if (!book) return NULL;
 
-  addr = g_object_new (GNC_TYPE_ADDRESS, NULL);
-  qof_instance_init_data(&addr->inst, GNC_ID_ADDRESS, book);
-  addr->book = book;
-  addr->dirty = FALSE;
-  addr->parent = prnt;
+    addr = g_object_new (GNC_TYPE_ADDRESS, NULL);
+    qof_instance_init_data(&addr->inst, GNC_ID_ADDRESS, book);
+    addr->book = book;
+    addr->dirty = FALSE;
+    addr->parent = prnt;
 
-  addr->name = CACHE_INSERT ("");
-  addr->addr1 = CACHE_INSERT ("");
-  addr->addr2 = CACHE_INSERT ("");
-  addr->addr3 = CACHE_INSERT ("");
-  addr->addr4 = CACHE_INSERT ("");
-  addr->phone = CACHE_INSERT ("");
-  addr->fax = CACHE_INSERT ("");
-  addr->email = CACHE_INSERT ("");
+    addr->name = CACHE_INSERT ("");
+    addr->addr1 = CACHE_INSERT ("");
+    addr->addr2 = CACHE_INSERT ("");
+    addr->addr3 = CACHE_INSERT ("");
+    addr->addr4 = CACHE_INSERT ("");
+    addr->phone = CACHE_INSERT ("");
+    addr->fax = CACHE_INSERT ("");
+    addr->email = CACHE_INSERT ("");
 
-  return addr;
+    return addr;
 }
 
-static GncAddress * 
+static GncAddress *
 qofAddressCreate (QofBook *book)
 {
-  /* The address will get set later by another function */
-  return gncAddressCreate(book, NULL);
+    /* The address will get set later by another function */
+    return gncAddressCreate(book, NULL);
 }
 
 static void
 qofAddressSetOwner(GncAddress *addr, QofInstance *ent)
 {
-	if(!addr || !ent) { return; }
-	if(addr->parent == NULL) { addr->parent = ent; }
+    if (!addr || !ent)
+    {
+        return;
+    }
+    if (addr->parent == NULL)
+    {
+        addr->parent = ent;
+    }
 }
 
 static QofInstance*
 qofAddressGetOwner(const GncAddress *addr)
 {
 
-	if(!addr) { return NULL; }
-	return addr->parent;
+    if (!addr)
+    {
+        return NULL;
+    }
+    return addr->parent;
 }
 
-GncAddress * 
+GncAddress *
 gncCloneAddress (const GncAddress *from, QofInstance *new_parent, QofBook *book)
 {
-  GncAddress *addr;
+    GncAddress *addr;
 
-  if (!book) return NULL;
+    if (!book) return NULL;
 
-  addr = g_object_new (GNC_TYPE_ADDRESS, NULL);
-  qof_instance_init_data(&addr->inst, GNC_ID_ADDRESS, book);
-  addr->book = book;
-  addr->dirty = TRUE;
-  addr->parent = new_parent;
+    addr = g_object_new (GNC_TYPE_ADDRESS, NULL);
+    qof_instance_init_data(&addr->inst, GNC_ID_ADDRESS, book);
+    addr->book = book;
+    addr->dirty = TRUE;
+    addr->parent = new_parent;
 
-  addr->name = CACHE_INSERT (from->name);
-  addr->addr1 = CACHE_INSERT (from->addr1);
-  addr->addr2 = CACHE_INSERT (from->addr2);
-  addr->addr3 = CACHE_INSERT (from->addr3);
-  addr->addr4 = CACHE_INSERT (from->addr4);
-  addr->phone = CACHE_INSERT (from->phone);
-  addr->fax = CACHE_INSERT (from->fax);
-  addr->email = CACHE_INSERT (from->email);
+    addr->name = CACHE_INSERT (from->name);
+    addr->addr1 = CACHE_INSERT (from->addr1);
+    addr->addr2 = CACHE_INSERT (from->addr2);
+    addr->addr3 = CACHE_INSERT (from->addr3);
+    addr->addr4 = CACHE_INSERT (from->addr4);
+    addr->phone = CACHE_INSERT (from->phone);
+    addr->fax = CACHE_INSERT (from->fax);
+    addr->email = CACHE_INSERT (from->email);
 
-  return addr;
+    return addr;
 }
 
-void 
+void
 gncAddressDestroy (GncAddress *addr)
 {
-  if (!addr) return;
-  qof_instance_set_destroying(addr, TRUE);
-  gncAddressCommitEdit (addr);
+    if (!addr) return;
+    qof_instance_set_destroying(addr, TRUE);
+    gncAddressCommitEdit (addr);
 }
 
 static void
 gncAddressFree (GncAddress *addr)
 {
-  if (!addr) return;
+    if (!addr) return;
 
-  qof_event_gen (&addr->inst, QOF_EVENT_DESTROY, NULL);
+    qof_event_gen (&addr->inst, QOF_EVENT_DESTROY, NULL);
 
-  CACHE_REMOVE (addr->name);
-  CACHE_REMOVE (addr->addr1);
-  CACHE_REMOVE (addr->addr2);
-  CACHE_REMOVE (addr->addr3);
-  CACHE_REMOVE (addr->addr4);
-  CACHE_REMOVE (addr->phone);
-  CACHE_REMOVE (addr->fax);
-  CACHE_REMOVE (addr->email);
+    CACHE_REMOVE (addr->name);
+    CACHE_REMOVE (addr->addr1);
+    CACHE_REMOVE (addr->addr2);
+    CACHE_REMOVE (addr->addr3);
+    CACHE_REMOVE (addr->addr4);
+    CACHE_REMOVE (addr->phone);
+    CACHE_REMOVE (addr->fax);
+    CACHE_REMOVE (addr->email);
 
-  /* qof_instance_release (&addr->inst); */
-  g_object_unref (addr);
+    /* qof_instance_release (&addr->inst); */
+    g_object_unref (addr);
 }
 
 
@@ -275,209 +287,213 @@
 
 void gncAddressSetName (GncAddress *addr, const char *name)
 {
-  if (!addr) return;
-  if (!name) return;
-  SET_STR(addr, addr->name, name);
-  mark_address (addr);
-  gncAddressCommitEdit (addr);
+    if (!addr) return;
+    if (!name) return;
+    SET_STR(addr, addr->name, name);
+    mark_address (addr);
+    gncAddressCommitEdit (addr);
 }
 
 void gncAddressSetAddr1 (GncAddress *addr, const char *addr1)
 {
-  if (!addr) return;
-  if (!addr1) return;
-  SET_STR(addr, addr->addr1, addr1);
-  mark_address (addr);
-  gncAddressCommitEdit (addr);
+    if (!addr) return;
+    if (!addr1) return;
+    SET_STR(addr, addr->addr1, addr1);
+    mark_address (addr);
+    gncAddressCommitEdit (addr);
 }
 
 void gncAddressSetAddr2 (GncAddress *addr, const char *addr2)
 {
-  if (!addr) return;
-  if (!addr2) return;
-  SET_STR(addr, addr->addr2, addr2);
-  mark_address (addr);
-  gncAddressCommitEdit (addr);
+    if (!addr) return;
+    if (!addr2) return;
+    SET_STR(addr, addr->addr2, addr2);
+    mark_address (addr);
+    gncAddressCommitEdit (addr);
 }
 
 void gncAddressSetAddr3 (GncAddress *addr, const char *addr3)
 {
-  if (!addr) return;
-  if (!addr3) return;
-  SET_STR(addr, addr->addr3, addr3);
-  mark_address (addr);
-  gncAddressCommitEdit (addr);
+    if (!addr) return;
+    if (!addr3) return;
+    SET_STR(addr, addr->addr3, addr3);
+    mark_address (addr);
+    gncAddressCommitEdit (addr);
 }
 
 void gncAddressSetAddr4 (GncAddress *addr, const char *addr4)
 {
-  if (!addr) return;
-  if (!addr4) return;
-  SET_STR(addr, addr->addr4, addr4);
-  mark_address (addr);
-  gncAddressCommitEdit (addr);
+    if (!addr) return;
+    if (!addr4) return;
+    SET_STR(addr, addr->addr4, addr4);
+    mark_address (addr);
+    gncAddressCommitEdit (addr);
 }
 
 void gncAddressSetPhone (GncAddress *addr, const char *phone)
 {
-  if (!addr) return;
-  if (!phone) return;
-  SET_STR(addr, addr->phone, phone);
-  mark_address (addr);
-  gncAddressCommitEdit (addr);
+    if (!addr) return;
+    if (!phone) return;
+    SET_STR(addr, addr->phone, phone);
+    mark_address (addr);
+    gncAddressCommitEdit (addr);
 }
 
 void gncAddressSetFax (GncAddress *addr, const char *fax)
 {
-  if (!addr) return;
-  if (!fax) return;
-  SET_STR(addr, addr->fax, fax);
-  mark_address (addr);
-  gncAddressCommitEdit (addr);
+    if (!addr) return;
+    if (!fax) return;
+    SET_STR(addr, addr->fax, fax);
+    mark_address (addr);
+    gncAddressCommitEdit (addr);
 }
 
 void gncAddressSetEmail (GncAddress *addr, const char *email)
 {
-  if (!addr) return;
-  if (!email) return;
-  SET_STR(addr, addr->email, email);
-  mark_address (addr);
-  gncAddressCommitEdit (addr);
+    if (!addr) return;
+    if (!email) return;
+    SET_STR(addr, addr->email, email);
+    mark_address (addr);
+    gncAddressCommitEdit (addr);
 }
 
 void gncAddressBeginEdit (GncAddress *addr)
 {
-  qof_begin_edit (&addr->inst);
+    qof_begin_edit (&addr->inst);
 }
 
 static void gncAddressOnError (QofInstance *inst, QofBackendError errcode)
 {
-  PERR("Address QofBackend Failure: %d", errcode);
-  gnc_engine_signal_commit_error( errcode );
+    PERR("Address QofBackend Failure: %d", errcode);
+    gnc_engine_signal_commit_error( errcode );
 }
-  
+
 static void gncAddressOnDone (QofInstance *addr) { }
 
 static void address_free (QofInstance *inst)
 {
-  GncAddress *addr = (GncAddress *) inst;
-  gncAddressFree (addr);
+    GncAddress *addr = (GncAddress *) inst;
+    gncAddressFree (addr);
 }
 
 void gncAddressCommitEdit (GncAddress *addr)
 {
-  if (!qof_commit_edit (QOF_INSTANCE(addr))) return;
-  qof_commit_edit_part2 (&addr->inst, gncAddressOnError,
-                         gncAddressOnDone, address_free);
+    if (!qof_commit_edit (QOF_INSTANCE(addr))) return;
+    qof_commit_edit_part2 (&addr->inst, gncAddressOnError,
+                           gncAddressOnDone, address_free);
 }
-             
 
+
 /* Get Functions */
 
 const char * gncAddressGetName (const GncAddress *addr)
 {
-  if (!addr) return NULL;
-  return addr->name;
+    if (!addr) return NULL;
+    return addr->name;
 }
 
 const char * gncAddressGetAddr1 (const GncAddress *addr)
 {
-  if (!addr) return NULL;
-  return addr->addr1;
+    if (!addr) return NULL;
+    return addr->addr1;
 }
 
 const char * gncAddressGetAddr2 (const GncAddress *addr)
 {
-  if (!addr) return NULL;
-  return addr->addr2;
+    if (!addr) return NULL;
+    return addr->addr2;
 }
 
 const char * gncAddressGetAddr3 (const GncAddress *addr)
 {
-  if (!addr) return NULL;
-  return addr->addr3;
+    if (!addr) return NULL;
+    return addr->addr3;
 }
 
 const char * gncAddressGetAddr4 (const GncAddress *addr)
 {
-  if (!addr) return NULL;
-  return addr->addr4;
+    if (!addr) return NULL;
+    return addr->addr4;
 }
 
 const char * gncAddressGetPhone (const GncAddress *addr)
 {
-  if (!addr) return NULL;
-  return addr->phone;
+    if (!addr) return NULL;
+    return addr->phone;
 }
 
 const char * gncAddressGetFax (const GncAddress *addr)
 {
-  if (!addr) return NULL;
-  return addr->fax;
+    if (!addr) return NULL;
+    return addr->fax;
 }
 
 const char * gncAddressGetEmail (const GncAddress *addr)
 {
-  if (!addr) return NULL;
-  return addr->email;
+    if (!addr) return NULL;
+    return addr->email;
 }
 
 gboolean gncAddressIsDirty (const GncAddress *addr)
 {
-  if (!addr) return FALSE;
-  return addr->dirty;
+    if (!addr) return FALSE;
+    return addr->dirty;
 }
 
 void gncAddressClearDirty (GncAddress *addr)
 {
-  if (!addr) return;
-  addr->dirty = FALSE;
+    if (!addr) return;
+    addr->dirty = FALSE;
 }
 
 int gncAddressCompare (const GncAddress *a, const GncAddress *b)
 {
-  if (!a && !b) return 0;
-  if (!a && b) return 1;
-  if (a && !b) return -1;
+    if (!a && !b) return 0;
+    if (!a && b) return 1;
+    if (a && !b) return -1;
 
-  return safe_strcmp (a->name, b->name);
+    return safe_strcmp (a->name, b->name);
 }
 
 static QofObject GncAddressDesc =
 {
-	.interface_version = QOF_OBJECT_VERSION,
-	.e_type            = GNC_ID_ADDRESS,
-	.type_label        = "Address",
-	.create            = (gpointer)qofAddressCreate,
-	.book_begin        = NULL,
-	.book_end          = NULL,
-	.is_dirty          = qof_collection_is_dirty,
-	.mark_clean        = qof_collection_mark_clean,
-	.foreach           = qof_collection_foreach,
-	.printable         = NULL,
-	.version_cmp       = (int (*)(gpointer, gpointer)) qof_instance_version_cmp,
+    .interface_version = QOF_OBJECT_VERSION,
+    .e_type            = GNC_ID_ADDRESS,
+    .type_label        = "Address",
+    .create            = (gpointer)qofAddressCreate,
+    .book_begin        = NULL,
+    .book_end          = NULL,
+    .is_dirty          = qof_collection_is_dirty,
+    .mark_clean        = qof_collection_mark_clean,
+    .foreach           = qof_collection_foreach,
+    .printable         = NULL,
+    .version_cmp       = (int (*)(gpointer, gpointer)) qof_instance_version_cmp,
 };
 
 gboolean gncAddressRegister (void)
 {
-  static QofParam params[] = {
+    static QofParam params[] =
+    {
 
-    { ADDRESS_NAME,  QOF_TYPE_STRING, (QofAccessFunc)gncAddressGetName,  (QofSetterFunc)gncAddressSetName },
-    { ADDRESS_ONE,   QOF_TYPE_STRING, (QofAccessFunc)gncAddressGetAddr1, (QofSetterFunc)gncAddressSetAddr1 },
-    { ADDRESS_TWO,   QOF_TYPE_STRING, (QofAccessFunc)gncAddressGetAddr2, (QofSetterFunc)gncAddressSetAddr2 },
-    { ADDRESS_THREE, QOF_TYPE_STRING, (QofAccessFunc)gncAddressGetAddr3, (QofSetterFunc)gncAddressSetAddr3 },
-    { ADDRESS_FOUR,  QOF_TYPE_STRING, (QofAccessFunc)gncAddressGetAddr4, (QofSetterFunc)gncAddressSetAddr4 },
-    { ADDRESS_PHONE, QOF_TYPE_STRING, (QofAccessFunc)gncAddressGetPhone, (QofSetterFunc)gncAddressSetPhone },
-    { ADDRESS_FAX,   QOF_TYPE_STRING, (QofAccessFunc)gncAddressGetFax,   (QofSetterFunc)gncAddressSetFax },
-    { ADDRESS_EMAIL, QOF_TYPE_STRING, (QofAccessFunc)gncAddressGetEmail, (QofSetterFunc)gncAddressSetEmail },
-    { ADDRESS_OWNER, QOF_TYPE_CHOICE, (QofAccessFunc)qofAddressGetOwner, (QofSetterFunc)qofAddressSetOwner },
-    { QOF_PARAM_BOOK, QOF_ID_BOOK,   (QofAccessFunc)qof_instance_get_book, NULL },
-    { QOF_PARAM_GUID, QOF_TYPE_GUID, (QofAccessFunc)qof_instance_get_guid, NULL },
-    { NULL },
-  };
+        { ADDRESS_NAME,  QOF_TYPE_STRING, (QofAccessFunc)gncAddressGetName,  (QofSetterFunc)gncAddressSetName },
+        { ADDRESS_ONE,   QOF_TYPE_STRING, (QofAccessFunc)gncAddressGetAddr1, (QofSetterFunc)gncAddressSetAddr1 },
+        { ADDRESS_TWO,   QOF_TYPE_STRING, (QofAccessFunc)gncAddressGetAddr2, (QofSetterFunc)gncAddressSetAddr2 },
+        { ADDRESS_THREE, QOF_TYPE_STRING, (QofAccessFunc)gncAddressGetAddr3, (QofSetterFunc)gncAddressSetAddr3 },
+        { ADDRESS_FOUR,  QOF_TYPE_STRING, (QofAccessFunc)gncAddressGetAddr4, (QofSetterFunc)gncAddressSetAddr4 },
+        { ADDRESS_PHONE, QOF_TYPE_STRING, (QofAccessFunc)gncAddressGetPhone, (QofSetterFunc)gncAddressSetPhone },
+        { ADDRESS_FAX,   QOF_TYPE_STRING, (QofAccessFunc)gncAddressGetFax,   (QofSetterFunc)gncAddressSetFax },
+        { ADDRESS_EMAIL, QOF_TYPE_STRING, (QofAccessFunc)gncAddressGetEmail, (QofSetterFunc)gncAddressSetEmail },
+        { ADDRESS_OWNER, QOF_TYPE_CHOICE, (QofAccessFunc)qofAddressGetOwner, (QofSetterFunc)qofAddressSetOwner },
+        { QOF_PARAM_BOOK, QOF_ID_BOOK,   (QofAccessFunc)qof_instance_get_book, NULL },
+        { QOF_PARAM_GUID, QOF_TYPE_GUID, (QofAccessFunc)qof_instance_get_guid, NULL },
+        { NULL },
+    };
 
-  qof_class_register (GNC_ID_ADDRESS, (QofSortFunc)gncAddressCompare, params);
-  if(!qof_choice_add_class(GNC_ID_CUSTOMER, GNC_ID_ADDRESS, ADDRESS_OWNER)) { return FALSE; }
+    qof_class_register (GNC_ID_ADDRESS, (QofSortFunc)gncAddressCompare, params);
+    if (!qof_choice_add_class(GNC_ID_CUSTOMER, GNC_ID_ADDRESS, ADDRESS_OWNER))
+    {
+        return FALSE;
+    }
 
-  return qof_object_register(&GncAddressDesc);
+    return qof_object_register(&GncAddressDesc);
 }

Modified: gnucash/trunk/src/business/business-core/gncAddress.h
===================================================================
--- gnucash/trunk/src/business/business-core/gncAddress.h	2010-03-02 21:40:28 UTC (rev 18788)
+++ gnucash/trunk/src/business/business-core/gncAddress.h	2010-03-02 21:41:05 UTC (rev 18789)
@@ -93,7 +93,7 @@
      (G_TYPE_INSTANCE_GET_CLASS ((o), GNC_TYPE_ADDRESS, GncAddressClass))
 GType gnc_address_get_type(void);
 
-/** @name Create/Destroy functions 
+/** @name Create/Destroy functions
  @{ */
 GncAddress *gncAddressCreate (QofBook *book, QofInstance *parent);
 void gncAddressDestroy (GncAddress *addr);
@@ -102,7 +102,7 @@
 
 /** @} */
 
-/** @name Set functions 
+/** @name Set functions
  @{ */
 
 void gncAddressSetName (GncAddress *addr, const char *name);
@@ -116,7 +116,7 @@
 void gncAddressClearDirty (GncAddress *address);
 /** @} */
 
-/** @name Get Functions 
+/** @name Get Functions
  @{ */
 
 const char * gncAddressGetName (const GncAddress *addr);
@@ -131,10 +131,10 @@
 
 gboolean gncAddressIsDirty (const GncAddress *addr);
 
-/** \brief compare two addresses 
+/** \brief compare two addresses
 
-\return 0 if identical, -1 if a is empty or less than b 
-and +1 if a is more than b or if b is empty. 
+\return 0 if identical, -1 if a is empty or less than b
+and +1 if a is more than b or if b is empty.
 */
 int gncAddressCompare (const GncAddress *a, const GncAddress *b);
 

Modified: gnucash/trunk/src/business/business-core/gncBillTerm.c
===================================================================
--- gnucash/trunk/src/business/business-core/gncBillTerm.c	2010-03-02 21:40:28 UTC (rev 18788)
+++ gnucash/trunk/src/business/business-core/gncBillTerm.c	2010-03-02 21:41:05 UTC (rev 18789)
@@ -33,37 +33,37 @@
 #include "gnc-engine.h"
 #include "gncBillTermP.h"
 
-struct _gncBillTerm 
+struct _gncBillTerm
 {
-  QofInstance     inst;
+    QofInstance     inst;
 
-  /* 'visible' data fields directly manipulated by user */
-  char *          name;
-  char *          desc;
-  GncBillTermType type;
-  gint            due_days;
-  gint            disc_days;
-  gnc_numeric     discount;
-  gint            cutoff;
+    /* 'visible' data fields directly manipulated by user */
+    char *          name;
+    char *          desc;
+    GncBillTermType type;
+    gint            due_days;
+    gint            disc_days;
+    gnc_numeric     discount;
+    gint            cutoff;
 
-  /* Internal management fields */
-  /* See src/doc/business.txt for an explanation of the following */
-  /* Code that handles this is *identical* to that in gncTaxTable */
-  gint64          refcount;
-  GncBillTerm *   parent;      /* if non-null, we are an immutable child */
-  GncBillTerm *   child;       /* if non-null, we have not changed */
-  gboolean        invisible;
-  GList *         children;    /* list of children for disconnection */
+    /* Internal management fields */
+    /* See src/doc/business.txt for an explanation of the following */
+    /* Code that handles this is *identical* to that in gncTaxTable */
+    gint64          refcount;
+    GncBillTerm *   parent;      /* if non-null, we are an immutable child */
+    GncBillTerm *   child;       /* if non-null, we have not changed */
+    gboolean        invisible;
+    GList *         children;    /* list of children for disconnection */
 };
 
 struct _gncBillTermClass
 {
-  QofInstanceClass parent_class;
+    QofInstanceClass parent_class;
 };
 
-struct _book_info 
+struct _book_info
 {
-  GList *         terms;        /* visible terms */
+    GList *         terms;        /* visible terms */
 };
 
 static QofLogModule log_module = GNC_MOD_BUSINESS;
@@ -89,53 +89,54 @@
 static inline void
 mark_term (GncBillTerm *term)
 {
-  qof_instance_set_dirty(&term->inst);
-  qof_event_gen (&term->inst, QOF_EVENT_MODIFY, NULL);
+    qof_instance_set_dirty(&term->inst);
+    qof_event_gen (&term->inst, QOF_EVENT_MODIFY, NULL);
 }
 
 static inline void maybe_resort_list (GncBillTerm *term)
 {
-  struct _book_info *bi;
+    struct _book_info *bi;
 
-  if (term->parent || term->invisible) return;
-  bi = qof_book_get_data (qof_instance_get_book(term), _GNC_MOD_NAME);
-  bi->terms = g_list_sort (bi->terms, (GCompareFunc)gncBillTermCompare);
+    if (term->parent || term->invisible) return;
+    bi = qof_book_get_data (qof_instance_get_book(term), _GNC_MOD_NAME);
+    bi->terms = g_list_sort (bi->terms, (GCompareFunc)gncBillTermCompare);
 }
 
 static inline void addObj (GncBillTerm *term)
 {
-  struct _book_info *bi;
-  bi = qof_book_get_data (qof_instance_get_book(term), _GNC_MOD_NAME);
-  bi->terms = g_list_insert_sorted (bi->terms, term,
-                                       (GCompareFunc)gncBillTermCompare);
+    struct _book_info *bi;
+    bi = qof_book_get_data (qof_instance_get_book(term), _GNC_MOD_NAME);
+    bi->terms = g_list_insert_sorted (bi->terms, term,
+                                      (GCompareFunc)gncBillTermCompare);
 }
 
 static inline void remObj (GncBillTerm *term)
 {
-  struct _book_info *bi;
-  bi = qof_book_get_data (qof_instance_get_book(term), _GNC_MOD_NAME);
-  bi->terms = g_list_remove (bi->terms, term);
+    struct _book_info *bi;
+    bi = qof_book_get_data (qof_instance_get_book(term), _GNC_MOD_NAME);
+    bi->terms = g_list_remove (bi->terms, term);
 }
 
 static inline void
 gncBillTermAddChild (GncBillTerm *table, GncBillTerm *child)
 {
-  g_return_if_fail(qof_instance_get_destroying(table) == FALSE);
-  table->children = g_list_prepend(table->children, child);
+    g_return_if_fail(qof_instance_get_destroying(table) == FALSE);
+    table->children = g_list_prepend(table->children, child);
 }
 
 static inline void
 gncBillTermRemoveChild (GncBillTerm *table, GncBillTerm *child)
 {
-  if (qof_instance_get_destroying(table)) return;
-  table->children = g_list_remove(table->children, child);
+    if (qof_instance_get_destroying(table)) return;
+    table->children = g_list_remove(table->children, child);
 }
 
 /* ============================================================== */
 
-enum {
+enum
+{
     PROP_0,
-	PROP_NAME
+    PROP_NAME
 };
 
 /* GObject Initialization */
@@ -160,43 +161,45 @@
 
 static void
 gnc_billterm_get_property (GObject         *object,
-			  guint            prop_id,
-			  GValue          *value,
-			  GParamSpec      *pspec)
+                           guint            prop_id,
+                           GValue          *value,
+                           GParamSpec      *pspec)
 {
     GncBillTerm *bt;
 
     g_return_if_fail(GNC_IS_BILLTERM(object));
 
     bt = GNC_BILLTERM(object);
-    switch (prop_id) {
-	case PROP_NAME:
-	    g_value_set_string(value, bt->name);
-		break;
-	default:
-	    G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec);
-	    break;
+    switch (prop_id)
+    {
+    case PROP_NAME:
+        g_value_set_string(value, bt->name);
+        break;
+    default:
+        G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec);
+        break;
     }
 }
 
 static void
 gnc_billterm_set_property (GObject         *object,
-			  guint            prop_id,
-			  const GValue          *value,
-			  GParamSpec      *pspec)
+                           guint            prop_id,
+                           const GValue          *value,
+                           GParamSpec      *pspec)
 {
     GncBillTerm *bt;
 
     g_return_if_fail(GNC_IS_BILLTERM(object));
 
     bt = GNC_BILLTERM(object);
-    switch (prop_id) {
-	case PROP_NAME:
-	    gncBillTermSetName(bt, g_value_get_string(value));
-		break;
-	default:
-	    G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec);
-	    break;
+    switch (prop_id)
+    {
+    case PROP_NAME:
+        gncBillTermSetName(bt, g_value_get_string(value));
+        break;
+    default:
+        G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec);
+        break;
     }
 }
 
@@ -204,142 +207,143 @@
 gnc_billterm_class_init (GncBillTermClass *klass)
 {
     GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
-	
+
     gobject_class->dispose = gnc_billterm_dispose;
     gobject_class->finalize = gnc_billterm_finalize;
     gobject_class->set_property = gnc_billterm_set_property;
     gobject_class->get_property = gnc_billterm_get_property;
 
     g_object_class_install_property
-	(gobject_class,
-	 PROP_NAME,
-	 g_param_spec_string ("name",
-			      "BillTerm Name",
-			      "The bill term name is an arbitrary string "
-			      "assigned by the user.  It is intended to "
-			      "a short, 10 to 30 character long string "
-			      "that is displayed by the GUI as the "
-			      "billterm mnemonic.",
-			      NULL,
-			      G_PARAM_READWRITE));
+    (gobject_class,
+     PROP_NAME,
+     g_param_spec_string ("name",
+                          "BillTerm Name",
+                          "The bill term name is an arbitrary string "
+                          "assigned by the user.  It is intended to "
+                          "a short, 10 to 30 character long string "
+                          "that is displayed by the GUI as the "
+                          "billterm mnemonic.",
+                          NULL,
+                          G_PARAM_READWRITE));
 }
 
 /* Create/Destroy Functions */
 GncBillTerm * gncBillTermCreate (QofBook *book)
 {
-  GncBillTerm *term;
-  if (!book) return NULL;
+    GncBillTerm *term;
+    if (!book) return NULL;
 
-  term = g_object_new (GNC_TYPE_BILLTERM, NULL);
-  qof_instance_init_data(&term->inst, _GNC_MOD_NAME, book);
-  term->name = CACHE_INSERT ("");
-  term->desc = CACHE_INSERT ("");
-  term->discount = gnc_numeric_zero ();
-  addObj (term);
-  qof_event_gen (&term->inst,  QOF_EVENT_CREATE, NULL);
-  return term;
+    term = g_object_new (GNC_TYPE_BILLTERM, NULL);
+    qof_instance_init_data(&term->inst, _GNC_MOD_NAME, book);
+    term->name = CACHE_INSERT ("");
+    term->desc = CACHE_INSERT ("");
+    term->discount = gnc_numeric_zero ();
+    addObj (term);
+    qof_event_gen (&term->inst,  QOF_EVENT_CREATE, NULL);
+    return term;
 }
 
 void gncBillTermDestroy (GncBillTerm *term)
 {
-  if (!term) return;
-  DEBUG("destroying bill term %s (%p)",
-	    guid_to_string(qof_instance_get_guid(&term->inst)), term);
-  qof_instance_set_destroying(term, TRUE);
-  qof_instance_set_dirty (&term->inst);
-  gncBillTermCommitEdit (term);
+    if (!term) return;
+    DEBUG("destroying bill term %s (%p)",
+          guid_to_string(qof_instance_get_guid(&term->inst)), term);
+    qof_instance_set_destroying(term, TRUE);
+    qof_instance_set_dirty (&term->inst);
+    gncBillTermCommitEdit (term);
 }
 
 static void gncBillTermFree (GncBillTerm *term)
 {
-  GncBillTerm *child;
-  GList *list;
+    GncBillTerm *child;
+    GList *list;
 
-  if (!term) return;
+    if (!term) return;
 
-  qof_event_gen (&term->inst,  QOF_EVENT_DESTROY, NULL);
-  CACHE_REMOVE (term->name);
-  CACHE_REMOVE (term->desc);
-  remObj (term);
+    qof_event_gen (&term->inst,  QOF_EVENT_DESTROY, NULL);
+    CACHE_REMOVE (term->name);
+    CACHE_REMOVE (term->desc);
+    remObj (term);
 
-  if (!qof_instance_get_destroying(term))
-    PERR("free a billterm without do_free set!");
+    if (!qof_instance_get_destroying(term))
+        PERR("free a billterm without do_free set!");
 
-  /* disconnect from parent */
-  if (term->parent)
-    gncBillTermRemoveChild(term->parent, term);
+    /* disconnect from parent */
+    if (term->parent)
+        gncBillTermRemoveChild(term->parent, term);
 
-  /* disconnect from the children */
-  for (list = term->children; list; list=list->next) {
-    child = list->data;
-    gncBillTermSetParent(child, NULL);
-  }
-  g_list_free(term->children);
+    /* disconnect from the children */
+    for (list = term->children; list; list = list->next)
+    {
+        child = list->data;
+        gncBillTermSetParent(child, NULL);
+    }
+    g_list_free(term->children);
 
-  /* qof_instance_release(&term->inst); */
-  g_object_unref (term);
+    /* qof_instance_release(&term->inst); */
+    g_object_unref (term);
 }
 
 GncBillTerm *
 gncCloneBillTerm (GncBillTerm *from, QofBook *book)
 {
-  GList *node;
-  GncBillTerm *term;
+    GList *node;
+    GncBillTerm *term;
 
-  if (!book || !from) return NULL;
+    if (!book || !from) return NULL;
 
-  term = g_object_new (GNC_TYPE_BILLTERM, NULL);
-  qof_instance_init_data(&term->inst, _GNC_MOD_NAME, book);
-  qof_instance_gemini (&term->inst, &from->inst);
+    term = g_object_new (GNC_TYPE_BILLTERM, NULL);
+    qof_instance_init_data(&term->inst, _GNC_MOD_NAME, book);
+    qof_instance_gemini (&term->inst, &from->inst);
 
-  term->name = CACHE_INSERT (from->name);
-  term->desc = CACHE_INSERT (from->desc);
-  term->type = from->type;
-  term->due_days = from->due_days;
-  term->disc_days = from->disc_days;
-  term->discount = from->discount;
-  term->cutoff = from->cutoff;
-  term->invisible = from->invisible;
+    term->name = CACHE_INSERT (from->name);
+    term->desc = CACHE_INSERT (from->desc);
+    term->type = from->type;
+    term->due_days = from->due_days;
+    term->disc_days = from->disc_days;
+    term->discount = from->discount;
+    term->cutoff = from->cutoff;
+    term->invisible = from->invisible;
 
-  term->refcount = 0;
+    term->refcount = 0;
 
-  /* Make copies of parents and children. Note that this can be
-   * a recursive copy ... treat as doubly-linked list. */
-  if (from->child)
-  {
-    term->child = gncBillTermObtainTwin (from->child, book);
-    term->child->parent = term;
-  }
-  if (from->parent)
-  {
-    term->parent = gncBillTermObtainTwin (from->parent, book);
-    term->parent->child = term;
-  }
-  for (node=g_list_last(from->children); node; node=node->next)
-  {
-    GncBillTerm *btrm = node->data;
-    btrm = gncBillTermObtainTwin (btrm, book);
-    btrm->parent = term;
-    term->children = g_list_prepend(term->children, btrm);
-  }
+    /* Make copies of parents and children. Note that this can be
+     * a recursive copy ... treat as doubly-linked list. */
+    if (from->child)
+    {
+        term->child = gncBillTermObtainTwin (from->child, book);
+        term->child->parent = term;
+    }
+    if (from->parent)
+    {
+        term->parent = gncBillTermObtainTwin (from->parent, book);
+        term->parent->child = term;
+    }
+    for (node = g_list_last(from->children); node; node = node->next)
+    {
+        GncBillTerm *btrm = node->data;
+        btrm = gncBillTermObtainTwin (btrm, book);
+        btrm->parent = term;
+        term->children = g_list_prepend(term->children, btrm);
+    }
 
-  addObj (term);
-  qof_event_gen (&term->inst, QOF_EVENT_CREATE, NULL);
-  return term;
+    addObj (term);
+    qof_event_gen (&term->inst, QOF_EVENT_CREATE, NULL);
+    return term;
 }
 
 GncBillTerm *
 gncBillTermObtainTwin (GncBillTerm *from, QofBook *book)
 {
-  GncBillTerm *term;
-  if (!from) return NULL;
+    GncBillTerm *term;
+    if (!from) return NULL;
 
-  term = (GncBillTerm *) qof_instance_lookup_twin (QOF_INSTANCE(from), book);
-  if (!term)
-  {
-    term = gncCloneBillTerm (from, book);
-  }
-  return term;
+    term = (GncBillTerm *) qof_instance_lookup_twin (QOF_INSTANCE(from), book);
+    if (!term)
+    {
+        term = gncCloneBillTerm (from, book);
+    }
+    return term;
 }
 
 /* ============================================================== */
@@ -347,30 +351,30 @@
 
 void gncBillTermSetName (GncBillTerm *term, const char *name)
 {
-  if (!term || !name) return;
-  SET_STR (term, term->name, name);
-  mark_term (term);
-  maybe_resort_list (term);
-  gncBillTermCommitEdit (term);
+    if (!term || !name) return;
+    SET_STR (term, term->name, name);
+    mark_term (term);
+    maybe_resort_list (term);
+    gncBillTermCommitEdit (term);
 }
 
 void gncBillTermSetDescription (GncBillTerm *term, const char *desc)
 {
-  if (!term || !desc) return;
-  SET_STR (term, term->desc, desc);
-  mark_term (term);
-  maybe_resort_list (term);
-  gncBillTermCommitEdit (term);
+    if (!term || !desc) return;
+    SET_STR (term, term->desc, desc);
+    mark_term (term);
+    maybe_resort_list (term);
+    gncBillTermCommitEdit (term);
 }
 
 void gncBillTermSetType (GncBillTerm *term, GncBillTermType type)
 {
-  if (!term) return;
-  if (term->type == type) return;
-  gncBillTermBeginEdit (term);
-  term->type = type;
-  mark_term (term);
-  gncBillTermCommitEdit (term);
+    if (!term) return;
+    if (term->type == type) return;
+    gncBillTermBeginEdit (term);
+    term->type = type;
+    mark_term (term);
+    gncBillTermCommitEdit (term);
 }
 
 /** \brief Convert bill term types from text. */
@@ -379,50 +383,50 @@
 static
 void qofBillTermSetType (GncBillTerm *term, const char *type_label)
 {
-	GncBillTermType type;
+    GncBillTermType type;
 
-	type = GncBillTermTypefromString(type_label);
-	gncBillTermSetType(term, type);
+    type = GncBillTermTypefromString(type_label);
+    gncBillTermSetType(term, type);
 }
 
 void gncBillTermSetDueDays (GncBillTerm *term, gint days)
 {
-  if (!term) return;
-  if (term->due_days == days) return;
-  gncBillTermBeginEdit (term);
-  term->due_days = days;
-  mark_term (term);
-  gncBillTermCommitEdit (term);
+    if (!term) return;
+    if (term->due_days == days) return;
+    gncBillTermBeginEdit (term);
+    term->due_days = days;
+    mark_term (term);
+    gncBillTermCommitEdit (term);
 }
 
 void gncBillTermSetDiscountDays (GncBillTerm *term, gint days)
 {
-  if (!term) return;
-  if (term->disc_days == days) return;
-  gncBillTermBeginEdit (term);
-  term->disc_days = days;
-  mark_term (term);
-  gncBillTermCommitEdit (term);
+    if (!term) return;
+    if (term->disc_days == days) return;
+    gncBillTermBeginEdit (term);
+    term->disc_days = days;
+    mark_term (term);
+    gncBillTermCommitEdit (term);
 }
 
 void gncBillTermSetDiscount (GncBillTerm *term, gnc_numeric discount)
 {
-  if (!term) return;
-  if (gnc_numeric_eq (term->discount, discount)) return;
-  gncBillTermBeginEdit (term);
-  term->discount = discount;
-  mark_term (term);
-  gncBillTermCommitEdit (term);
+    if (!term) return;
+    if (gnc_numeric_eq (term->discount, discount)) return;
+    gncBillTermBeginEdit (term);
+    term->discount = discount;
+    mark_term (term);
+    gncBillTermCommitEdit (term);
 }
 
 void gncBillTermSetCutoff (GncBillTerm *term, gint cutoff)
 {
-  if (!term) return;
-  if (term->cutoff == cutoff) return;
-  gncBillTermBeginEdit (term);
-  term->cutoff = cutoff;
-  mark_term (term);
-  gncBillTermCommitEdit (term);
+    if (!term) return;
+    if (term->cutoff == cutoff) return;
+    gncBillTermBeginEdit (term);
+    term->cutoff = cutoff;
+    mark_term (term);
+    gncBillTermCommitEdit (term);
 }
 
 /* XXX this doesn't seem right. If the parent/child relationship
@@ -432,133 +436,135 @@
  */
 void gncBillTermSetParent (GncBillTerm *term, GncBillTerm *parent)
 {
-  if (!term) return;
-  gncBillTermBeginEdit (term);
-  if (term->parent)
-    gncBillTermRemoveChild(term->parent, term);
-  term->parent = parent;
-  if (parent)
-    gncBillTermAddChild(parent, term);
-  term->refcount = 0;
-  if( parent != NULL ) {
-    gncBillTermMakeInvisible (term);
-  }
-  gncBillTermCommitEdit (term);
+    if (!term) return;
+    gncBillTermBeginEdit (term);
+    if (term->parent)
+        gncBillTermRemoveChild(term->parent, term);
+    term->parent = parent;
+    if (parent)
+        gncBillTermAddChild(parent, term);
+    term->refcount = 0;
+    if ( parent != NULL )
+    {
+        gncBillTermMakeInvisible (term);
+    }
+    gncBillTermCommitEdit (term);
 }
 
 void gncBillTermSetChild (GncBillTerm *term, GncBillTerm *child)
 {
-  if (!term) return;
-  gncBillTermBeginEdit (term);
-  term->child = child;
-  gncBillTermCommitEdit (term);
+    if (!term) return;
+    gncBillTermBeginEdit (term);
+    term->child = child;
+    gncBillTermCommitEdit (term);
 }
 
 void gncBillTermIncRef (GncBillTerm *term)
 {
-  if (!term) return;
-  if (term->parent || term->invisible) return;        /* children dont need refcounts */
-  gncBillTermBeginEdit (term);
-  term->refcount++;
-  gncBillTermCommitEdit (term);
+    if (!term) return;
+    if (term->parent || term->invisible) return;        /* children dont need refcounts */
+    gncBillTermBeginEdit (term);
+    term->refcount++;
+    gncBillTermCommitEdit (term);
 }
 
 void gncBillTermDecRef (GncBillTerm *term)
 {
-  if (!term) return;
-  if (term->parent || term->invisible) return;        /* children dont need refcounts */
-  gncBillTermBeginEdit (term);
-  term->refcount--;
-  g_return_if_fail (term->refcount >= 0);
-  gncBillTermCommitEdit (term);
+    if (!term) return;
+    if (term->parent || term->invisible) return;        /* children dont need refcounts */
+    gncBillTermBeginEdit (term);
+    term->refcount--;
+    g_return_if_fail (term->refcount >= 0);
+    gncBillTermCommitEdit (term);
 }
 
 void gncBillTermSetRefcount (GncBillTerm *term, gint64 refcount)
 {
-  if (!term) return;
-  term->refcount = refcount;
+    if (!term) return;
+    term->refcount = refcount;
 }
 
 void gncBillTermMakeInvisible (GncBillTerm *term)
 {
-  if (!term) return;
-  gncBillTermBeginEdit (term);
-  term->invisible = TRUE;
-  remObj (term);
-  gncBillTermCommitEdit (term);
+    if (!term) return;
+    gncBillTermBeginEdit (term);
+    term->invisible = TRUE;
+    remObj (term);
+    gncBillTermCommitEdit (term);
 }
 
 void gncBillTermChanged (GncBillTerm *term)
 {
-  if (!term) return;
-  term->child = NULL;
+    if (!term) return;
+    term->child = NULL;
 }
 
 void gncBillTermBeginEdit (GncBillTerm *term)
 {
-  qof_begin_edit(&term->inst);
+    qof_begin_edit(&term->inst);
 }
 
 static void gncBillTermOnError (QofInstance *inst, QofBackendError errcode)
 {
-  PERR("BillTerm QofBackend Failure: %d", errcode);
-  gnc_engine_signal_commit_error( errcode );
+    PERR("BillTerm QofBackend Failure: %d", errcode);
+    gnc_engine_signal_commit_error( errcode );
 }
 
 static void bill_free (QofInstance *inst)
 {
-  GncBillTerm *term = (GncBillTerm *) inst;
-  gncBillTermFree(term);
+    GncBillTerm *term = (GncBillTerm *) inst;
+    gncBillTermFree(term);
 }
 
 static void on_done (QofInstance *inst) {}
 
 void gncBillTermCommitEdit (GncBillTerm *term)
 {
-  if (!qof_commit_edit (QOF_INSTANCE(term))) return;
-  qof_commit_edit_part2 (&term->inst, gncBillTermOnError,
-                         on_done, bill_free);
+    if (!qof_commit_edit (QOF_INSTANCE(term))) return;
+    qof_commit_edit_part2 (&term->inst, gncBillTermOnError,
+                           on_done, bill_free);
 }
 
 /* Get Functions */
 
 GncBillTerm *gncBillTermLookupByName (QofBook *book, const char *name)
 {
-  GList *list = gncBillTermGetTerms (book);
+    GList *list = gncBillTermGetTerms (book);
 
-  for ( ; list; list = list->next) {
-    GncBillTerm *term = list->data;
-    if (!safe_strcmp (term->name, name))
-      return list->data;
-  }
-  return NULL;
+    for ( ; list; list = list->next)
+    {
+        GncBillTerm *term = list->data;
+        if (!safe_strcmp (term->name, name))
+            return list->data;
+    }
+    return NULL;
 }
 
 GList * gncBillTermGetTerms (QofBook *book)
 {
-  struct _book_info *bi;
-  if (!book) return NULL;
+    struct _book_info *bi;
+    if (!book) return NULL;
 
-  bi = qof_book_get_data (book, _GNC_MOD_NAME);
-  return bi->terms;
+    bi = qof_book_get_data (book, _GNC_MOD_NAME);
+    return bi->terms;
 }
 
 const char *gncBillTermGetName (const GncBillTerm *term)
 {
-  if (!term) return NULL;
-  return term->name;
+    if (!term) return NULL;
+    return term->name;
 }
 
 const char *gncBillTermGetDescription (const GncBillTerm *term)
 {
-  if (!term) return NULL;
-  return term->desc;
+    if (!term) return NULL;
+    return term->desc;
 }
 
 GncBillTermType gncBillTermGetType (const GncBillTerm *term)
 {
-  if (!term) return 0;
-  return term->type;
+    if (!term) return 0;
+    return term->type;
 }
 
 /** \brief Convert bill term types to text. */
@@ -567,108 +573,112 @@
 static
 const char* qofBillTermGetType (const GncBillTerm *term)
 {
-	if (!term) { return NULL; }
-	return GncBillTermTypeasString(term->type);
+    if (!term)
+    {
+        return NULL;
+    }
+    return GncBillTermTypeasString(term->type);
 }
 
 gint gncBillTermGetDueDays (const GncBillTerm *term)
 {
-  if (!term) return 0;
-  return term->due_days;
+    if (!term) return 0;
+    return term->due_days;
 }
 
 gint gncBillTermGetDiscountDays (const GncBillTerm *term)
 {
-  if (!term) return 0;
-  return term->disc_days;
+    if (!term) return 0;
+    return term->disc_days;
 }
 
 gnc_numeric gncBillTermGetDiscount (const GncBillTerm *term)
 {
-  if (!term) return gnc_numeric_zero ();
-  return term->discount;
+    if (!term) return gnc_numeric_zero ();
+    return term->discount;
 }
 
 gint gncBillTermGetCutoff (const GncBillTerm *term)
 {
-  if (!term) return 0;
-  return term->cutoff;
+    if (!term) return 0;
+    return term->cutoff;
 }
 
 static GncBillTerm *gncBillTermCopy (const GncBillTerm *term)
 {
-  GncBillTerm *t;
+    GncBillTerm *t;
 
-  if (!term) return NULL;
-  t = gncBillTermCreate (qof_instance_get_book(term));
+    if (!term) return NULL;
+    t = gncBillTermCreate (qof_instance_get_book(term));
 
-  gncBillTermBeginEdit(t);
+    gncBillTermBeginEdit(t);
 
-  gncBillTermSetName (t, term->name);
-  gncBillTermSetDescription (t, term->desc);
+    gncBillTermSetName (t, term->name);
+    gncBillTermSetDescription (t, term->desc);
 
-  t->type = term->type;
-  t->due_days = term->due_days;
-  t->disc_days = term->disc_days;
-  t->discount = term->discount;
-  t->cutoff = term->cutoff;
+    t->type = term->type;
+    t->due_days = term->due_days;
+    t->disc_days = term->disc_days;
+    t->discount = term->discount;
+    t->cutoff = term->cutoff;
 
-  gncBillTermCommitEdit(t);
+    gncBillTermCommitEdit(t);
 
-  return t;
+    return t;
 }
 
 GncBillTerm *gncBillTermReturnChild (GncBillTerm *term, gboolean make_new)
 {
-  GncBillTerm *child = NULL;
+    GncBillTerm *child = NULL;
 
-  if (!term) return NULL;
-  if (term->child) return term->child;
-  if (term->parent || term->invisible) return term;
-  if (make_new) {
-    child = gncBillTermCopy (term);
-    gncBillTermSetChild (term, child);
-    gncBillTermSetParent (child, term);
-  }
-  return child;
+    if (!term) return NULL;
+    if (term->child) return term->child;
+    if (term->parent || term->invisible) return term;
+    if (make_new)
+    {
+        child = gncBillTermCopy (term);
+        gncBillTermSetChild (term, child);
+        gncBillTermSetParent (child, term);
+    }
+    return child;
 }
 
 GncBillTerm *gncBillTermGetParent (const GncBillTerm *term)
 {
-  if (!term) return NULL;
-  return term->parent;
+    if (!term) return NULL;
+    return term->parent;
 }
 
 gint64 gncBillTermGetRefcount (const GncBillTerm *term)
 {
-  if (!term) return 0;
-  return term->refcount;
+    if (!term) return 0;
+    return term->refcount;
 }
 
 gboolean gncBillTermGetInvisible (const GncBillTerm *term)
 {
-  if (!term) return FALSE;
-  return term->invisible;
+    if (!term) return FALSE;
+    return term->invisible;
 }
 
 int gncBillTermCompare (const GncBillTerm *a, const GncBillTerm *b)
 {
-  int ret;
+    int ret;
 
-  if (!a && !b) return 0;
-  if (!a) return -1;
-  if (!b) return 1;
+    if (!a && !b) return 0;
+    if (!a) return -1;
+    if (!b) return 1;
 
-  ret = safe_strcmp (a->name, b->name);
-  if (ret) return ret;
+    ret = safe_strcmp (a->name, b->name);
+    if (ret) return ret;
 
-  return safe_strcmp (a->desc, b->desc);
+    return safe_strcmp (a->desc, b->desc);
 }
 
 gboolean gncBillTermIsDirty (const GncBillTerm *term)
 {
-  if (!term) return FALSE;
-  return qof_instance_get_dirty_flag(term);
+    if (!term) return FALSE;
+    return qof_instance_get_dirty_flag(term);
 }
 
 /********************************************************/
@@ -684,31 +694,35 @@
 compute_monthyear (const GncBillTerm *term, Timespec post_date,
                    int *month, int *year)
 {
-  int iday, imonth, iyear;
-  int cutoff = term->cutoff;
+    int iday, imonth, iyear;
+    int cutoff = term->cutoff;
 
-  g_return_if_fail (term->type == GNC_TERM_TYPE_PROXIMO);
+    g_return_if_fail (term->type == GNC_TERM_TYPE_PROXIMO);
 
-  gnc_timespec2dmy (post_date, &iday, &imonth, &iyear);
+    gnc_timespec2dmy (post_date, &iday, &imonth, &iyear);
 
-  if (cutoff <= 0)
-    cutoff += gnc_timespec_last_mday (post_date);
+    if (cutoff <= 0)
+        cutoff += gnc_timespec_last_mday (post_date);
 
-  if (iday <= cutoff) {
-    /* We apply this to next month */
-    imonth++;
-  } else {
-    /* We apply to the following month */
-    imonth += 2;
-  }
+    if (iday <= cutoff)
+    {
+        /* We apply this to next month */
+        imonth++;
+    }
+    else
+    {
+        /* We apply to the following month */
+        imonth += 2;
+    }
 
-  if (imonth > 12) {
-    iyear++;
-    imonth -= 12;
-  }
+    if (imonth > 12)
+    {
+        iyear++;
+        imonth -= 12;
+    }
 
-  if (month) *month = imonth;
-  if (year) *year = iyear;
+    if (month) *month = imonth;
+    if (year) *year = iyear;
 }
 
 /* XXX explain this, the logic is totally opaque to me. */
@@ -716,98 +730,100 @@
 static Timespec
 compute_time (const GncBillTerm *term, Timespec post_date, int days)
 {
-  Timespec res = post_date;
-  int day, month, year;
+    Timespec res = post_date;
+    int day, month, year;
 
-  switch (term->type) {
-  case GNC_TERM_TYPE_DAYS:
-    res.tv_sec += (SECS_PER_DAY * days);
-    break;
-  case GNC_TERM_TYPE_PROXIMO:
-    compute_monthyear (term, post_date, &month, &year);
-    day = gnc_date_my_last_mday (month, year);
-    if (days < day)
-      day = days;
-    res = gnc_dmy2timespec (day, month, year);
-    break;
-  }
-  return res;
+    switch (term->type)
+    {
+    case GNC_TERM_TYPE_DAYS:
+        res.tv_sec += (SECS_PER_DAY * days);
+        break;
+    case GNC_TERM_TYPE_PROXIMO:
+        compute_monthyear (term, post_date, &month, &year);
+        day = gnc_date_my_last_mday (month, year);
+        if (days < day)
+            day = days;
+        res = gnc_dmy2timespec (day, month, year);
+        break;
+    }
+    return res;
 }
 
 Timespec
 gncBillTermComputeDueDate (const GncBillTerm *term, Timespec post_date)
 {
-  Timespec res = post_date;
-  if (!term) return res;
+    Timespec res = post_date;
+    if (!term) return res;
 
-  return compute_time (term, post_date, term->due_days);
+    return compute_time (term, post_date, term->due_days);
 }
 
 Timespec
 gncBillTermComputeDiscountDate (const GncBillTerm *term, Timespec post_date)
 {
-  Timespec res = post_date;
-  if (!term) return res;
+    Timespec res = post_date;
+    if (!term) return res;
 
-  return compute_time (term, post_date, term->disc_days);
+    return compute_time (term, post_date, term->disc_days);
 }
 
 /* Package-Private functions */
 
 static void _gncBillTermCreate (QofBook *book)
 {
-  struct _book_info *bi;
+    struct _book_info *bi;
 
-  if (!book) return;
+    if (!book) return;
 
-  bi = g_new0 (struct _book_info, 1);
-  qof_book_set_data (book, _GNC_MOD_NAME, bi);
+    bi = g_new0 (struct _book_info, 1);
+    qof_book_set_data (book, _GNC_MOD_NAME, bi);
 }
 
 static void _gncBillTermDestroy (QofBook *book)
 {
-  struct _book_info *bi;
+    struct _book_info *bi;
 
-  if (!book) return;
+    if (!book) return;
 
-  bi = qof_book_get_data (book, _GNC_MOD_NAME);
+    bi = qof_book_get_data (book, _GNC_MOD_NAME);
 
-  g_list_free (bi->terms);
-  g_free (bi);
+    g_list_free (bi->terms);
+    g_free (bi);
 }
 
-static QofObject gncBillTermDesc = 
+static QofObject gncBillTermDesc =
 {
-  .interface_version = QOF_OBJECT_VERSION,
-  .e_type            = _GNC_MOD_NAME,
-  .type_label        = "Billing Term",
-  .create            = (gpointer)gncBillTermCreate,
-  .book_begin        = _gncBillTermCreate,
-  .book_end          = _gncBillTermDestroy,
-  .is_dirty          = qof_collection_is_dirty,
-  .mark_clean        = qof_collection_mark_clean,
-  .foreach           = qof_collection_foreach,
-  .printable         = NULL,
-  .version_cmp       = (int (*)(gpointer, gpointer)) qof_instance_version_cmp,
+    .interface_version = QOF_OBJECT_VERSION,
+    .e_type            = _GNC_MOD_NAME,
+    .type_label        = "Billing Term",
+    .create            = (gpointer)gncBillTermCreate,
+    .book_begin        = _gncBillTermCreate,
+    .book_end          = _gncBillTermDestroy,
+    .is_dirty          = qof_collection_is_dirty,
+    .mark_clean        = qof_collection_mark_clean,
+    .foreach           = qof_collection_foreach,
+    .printable         = NULL,
+    .version_cmp       = (int (*)(gpointer, gpointer)) qof_instance_version_cmp,
 };
 
 gboolean gncBillTermRegister (void)
 {
-  static QofParam params[] = {
-	{ GNC_BILLTERM_NAME, 		QOF_TYPE_STRING,  (QofAccessFunc)gncBillTermGetName,			(QofSetterFunc)gncBillTermSetName },
-	{ GNC_BILLTERM_DESC, 		QOF_TYPE_STRING,  (QofAccessFunc)gncBillTermGetDescription,		(QofSetterFunc)gncBillTermSetDescription },
-	{ GNC_BILLTERM_TYPE, QOF_TYPE_STRING, (QofAccessFunc)qofBillTermGetType, (QofSetterFunc)qofBillTermSetType },
-	{ GNC_BILLTERM_DUEDAYS, 	QOF_TYPE_INT32,   (QofAccessFunc)gncBillTermGetDueDays, 		(QofSetterFunc)gncBillTermSetDueDays },
-	{ GNC_BILLTERM_DISCDAYS, 	QOF_TYPE_INT32,   (QofAccessFunc)gncBillTermGetDiscountDays,	(QofSetterFunc)gncBillTermSetDiscountDays },
-	{ GNC_BILLTERM_DISCOUNT, 	QOF_TYPE_NUMERIC, (QofAccessFunc)gncBillTermGetDiscount,		(QofSetterFunc)gncBillTermSetDiscount },
-	{ GNC_BILLTERM_CUTOFF, 		QOF_TYPE_INT32,   (QofAccessFunc)gncBillTermGetCutoff, 			(QofSetterFunc)gncBillTermSetCutoff },
-	{ GNC_BILLTERM_REFCOUNT, 	QOF_TYPE_INT64,   (QofAccessFunc)gncBillTermGetRefcount, 		NULL },
-	{ QOF_PARAM_BOOK, 			QOF_ID_BOOK, 	  (QofAccessFunc)qof_instance_get_book, 		NULL },
-    { QOF_PARAM_GUID, 			QOF_TYPE_GUID, 	  (QofAccessFunc)qof_instance_get_guid, 		NULL },
-    { NULL },
-  };
+    static QofParam params[] =
+    {
+        { GNC_BILLTERM_NAME, 		QOF_TYPE_STRING,  (QofAccessFunc)gncBillTermGetName,			(QofSetterFunc)gncBillTermSetName },
+        { GNC_BILLTERM_DESC, 		QOF_TYPE_STRING,  (QofAccessFunc)gncBillTermGetDescription,		(QofSetterFunc)gncBillTermSetDescription },
+        { GNC_BILLTERM_TYPE, QOF_TYPE_STRING, (QofAccessFunc)qofBillTermGetType, (QofSetterFunc)qofBillTermSetType },
+        { GNC_BILLTERM_DUEDAYS, 	QOF_TYPE_INT32,   (QofAccessFunc)gncBillTermGetDueDays, 		(QofSetterFunc)gncBillTermSetDueDays },
+        { GNC_BILLTERM_DISCDAYS, 	QOF_TYPE_INT32,   (QofAccessFunc)gncBillTermGetDiscountDays,	(QofSetterFunc)gncBillTermSetDiscountDays },
+        { GNC_BILLTERM_DISCOUNT, 	QOF_TYPE_NUMERIC, (QofAccessFunc)gncBillTermGetDiscount,		(QofSetterFunc)gncBillTermSetDiscount },
+        { GNC_BILLTERM_CUTOFF, 		QOF_TYPE_INT32,   (QofAccessFunc)gncBillTermGetCutoff, 			(QofSetterFunc)gncBillTermSetCutoff },
+        { GNC_BILLTERM_REFCOUNT, 	QOF_TYPE_INT64,   (QofAccessFunc)gncBillTermGetRefcount, 		NULL },
+        { QOF_PARAM_BOOK, 			QOF_ID_BOOK, 	  (QofAccessFunc)qof_instance_get_book, 		NULL },
+        { QOF_PARAM_GUID, 			QOF_TYPE_GUID, 	  (QofAccessFunc)qof_instance_get_guid, 		NULL },
+        { NULL },
+    };
 
-  qof_class_register (_GNC_MOD_NAME, (QofSortFunc)gncBillTermCompare, params);
+    qof_class_register (_GNC_MOD_NAME, (QofSortFunc)gncBillTermCompare, params);
 
-  return qof_object_register (&gncBillTermDesc);
+    return qof_object_register (&gncBillTermDesc);
 }

Modified: gnucash/trunk/src/business/business-core/gncBillTerm.h
===================================================================
--- gnucash/trunk/src/business/business-core/gncBillTerm.h	2010-03-02 21:40:28 UTC (rev 18788)
+++ gnucash/trunk/src/business/business-core/gncBillTerm.h	2010-03-02 21:41:05 UTC (rev 18789)
@@ -79,13 +79,14 @@
 
 DEFINE_ENUM(GncBillTermType, ENUM_TERMS_TYPE)
 #else
-typedef enum {
-  GNC_TERM_TYPE_DAYS = 1,
-  GNC_TERM_TYPE_PROXIMO,
+typedef enum
+{
+    GNC_TERM_TYPE_DAYS = 1,
+    GNC_TERM_TYPE_PROXIMO,
 } GncBillTermType;
 #endif
 
-/** @name Create/Destroy Functions 
+/** @name Create/Destroy Functions
  @{ */
 GncBillTerm * gncBillTermCreate (QofBook *book);
 void gncBillTermDestroy (GncBillTerm *term);
@@ -97,7 +98,7 @@
 void gncBillTermCommitEdit (GncBillTerm *term);
 /** @} */
 
-/** @name Set Functions 
+/** @name Set Functions
 @{
 */
 void gncBillTermSetName (GncBillTerm *term, const char *name);
@@ -110,10 +111,10 @@
 
 /** @} */
 
-/** @name Get Functions 
+/** @name Get Functions
  @{ */
 /** Return a pointer to the instance gncBillTerm that is identified
- *  by the guid, and is residing in the book. Returns NULL if the 
+ *  by the guid, and is residing in the book. Returns NULL if the
  *  instance can't be found.
  *  Equivalent function prototype is
  *  GncBillTerm * gncBillTermLookup (QofBook *book, const GUID *guid);

Modified: gnucash/trunk/src/business/business-core/gncBillTermP.h
===================================================================
--- gnucash/trunk/src/business/business-core/gncBillTermP.h	2010-03-02 21:40:28 UTC (rev 18788)
+++ gnucash/trunk/src/business/business-core/gncBillTermP.h	2010-03-02 21:41:05 UTC (rev 18789)
@@ -42,9 +42,9 @@
 
 /** The gncCloneBillTerm() routine makes a copy of the indicated
  *  bill term, placing it in the indicated book.  It copies
- *  the name, description, type, due-days, discount, etc. 
+ *  the name, description, type, due-days, discount, etc.
  *  It also copies (as needed) both parents and children, so that
- *  the parent-child relationship is correctly mirrored in the 
+ *  the parent-child relationship is correctly mirrored in the
  *  clone.
  * XXX the refcount is mis-handled. This needs fixin....
  *  It then adds a pair of 'gemini' kvp pointers so that each copy
@@ -59,7 +59,7 @@
  *  gncCloneBillTerm()) and placed into the book.
  *
  * We called this routine 'Obtain' instead of "Get" to distinguish
- * it from the other Get routines, which work in fundamentally  
+ * it from the other Get routines, which work in fundamentally
  * different ways.
  */
 GncBillTerm * gncBillTermObtainTwin (GncBillTerm *from, QofBook *book);

Modified: gnucash/trunk/src/business/business-core/gncBusGuile.c
===================================================================
--- gnucash/trunk/src/business/business-core/gncBusGuile.c	2010-03-02 21:40:28 UTC (rev 18788)
+++ gnucash/trunk/src/business/business-core/gncBusGuile.c	2010-03-02 21:41:05 UTC (rev 18789)
@@ -32,61 +32,61 @@
 static swig_type_info *
 get_acct_type ()
 {
-  static swig_type_info * account_type = NULL;
+    static swig_type_info * account_type = NULL;
 
-  if (!account_type)
-      account_type = SWIG_TypeQuery("_p_Account");
+    if (!account_type)
+        account_type = SWIG_TypeQuery("_p_Account");
 
-  return account_type;
+    return account_type;
 }
 
 int gnc_account_value_pointer_p (SCM arg)
 {
-  swig_type_info * account_type = get_acct_type();
+    swig_type_info * account_type = get_acct_type();
 
-  return (scm_is_pair (arg) &&
-	  SWIG_IsPointerOfType(SCM_CAR (arg), account_type) &&
-	  gnc_numeric_p (SCM_CDR (arg)));
+    return (scm_is_pair (arg) &&
+            SWIG_IsPointerOfType(SCM_CAR (arg), account_type) &&
+            gnc_numeric_p (SCM_CDR (arg)));
 }
 
 GncAccountValue * gnc_scm_to_account_value_ptr (SCM valuearg)
 {
-  GncAccountValue *res;
-  Account *acc = NULL;
-  gnc_numeric value;
-  swig_type_info * account_type = get_acct_type();
-  SCM val;
+    GncAccountValue *res;
+    Account *acc = NULL;
+    gnc_numeric value;
+    swig_type_info * account_type = get_acct_type();
+    SCM val;
 
-  /* Get the account */
-  val = SCM_CAR (valuearg);
-  if (!SWIG_IsPointerOfType (val, account_type))
-    return NULL;
+    /* Get the account */
+    val = SCM_CAR (valuearg);
+    if (!SWIG_IsPointerOfType (val, account_type))
+        return NULL;
 
-  acc = SWIG_MustGetPtr(val, account_type, 1, 0);
+    acc = SWIG_MustGetPtr(val, account_type, 1, 0);
 
-  /* Get the value */
-  val = SCM_CDR (valuearg);
-  value = gnc_scm_to_numeric (val);
+    /* Get the value */
+    val = SCM_CDR (valuearg);
+    value = gnc_scm_to_numeric (val);
 
-  /* Build and return the object */
-  res = g_new0 (GncAccountValue, 1);
-  res->account = acc;
-  res->value = value;
-  return res;
+    /* Build and return the object */
+    res = g_new0 (GncAccountValue, 1);
+    res->account = acc;
+    res->value = value;
+    return res;
 }
 
 SCM gnc_account_value_ptr_to_scm (GncAccountValue *av)
 {
-  swig_type_info * account_type = get_acct_type();
-  gnc_commodity * com;
-  gnc_numeric val;
+    swig_type_info * account_type = get_acct_type();
+    gnc_commodity * com;
+    gnc_numeric val;
 
-  if (!av) return SCM_BOOL_F;
+    if (!av) return SCM_BOOL_F;
 
-  com = xaccAccountGetCommodity (av->account);
-  val = gnc_numeric_convert (av->value, gnc_commodity_get_fraction (com),
-			     GNC_RND_ROUND);
+    com = xaccAccountGetCommodity (av->account);
+    val = gnc_numeric_convert (av->value, gnc_commodity_get_fraction (com),
+                               GNC_RND_ROUND);
 
-  return scm_cons (SWIG_NewPointerObj(av->account, account_type, 0),
-		   gnc_numeric_to_scm (val));
+    return scm_cons (SWIG_NewPointerObj(av->account, account_type, 0),
+                     gnc_numeric_to_scm (val));
 }

Modified: gnucash/trunk/src/business/business-core/gncBusPeriod.c
===================================================================
--- gnucash/trunk/src/business/business-core/gncBusPeriod.c	2010-03-02 21:40:28 UTC (rev 18788)
+++ gnucash/trunk/src/business/business-core/gncBusPeriod.c	2010-03-02 21:41:05 UTC (rev 18789)
@@ -1,29 +1,29 @@
 
 /*
 XXX TODO:
--- contemplate a per-collection (per type) edit/commmit-edit, 
+-- contemplate a per-collection (per type) edit/commmit-edit,
    clone, dirty, etc. functions some more ...
 
--- turn clone into a generic object callback, so that 
+-- turn clone into a generic object callback, so that
    the ObtainTwin could be qof_instance_obtain_twin,
    a generic function. (right now its copied everywhere)
 
 -- contemplate copy-on-write, and the true need for cloning,
    and how to avoid excess cloning for the SQL backend.
 
--- billterm and taxtables are incompletely cloned, not sure 
+-- billterm and taxtables are incompletely cloned, not sure
    what to do with refcount, ask warlord, need to explore.
 
 -- The following business objects have an id/name/desc/active
    this could be abstracted into an common object.
    vendor (customer)
    bill term (but bill terms doesn't have id or active)
-   job 
+   job
 
 -- gncVendor should be a base class to gncCustomer (they're
    identical, but customer adds more stuff).
 
-   Employee could be base class for vendor, its got some of the 
+   Employee could be base class for vendor, its got some of the
    things (name, addr, active, currency)
 
 -- TaxTable and BillTerm have common parent/child code.
@@ -33,7 +33,7 @@
 -- finish clone of invoice, entry,
 
 
--- jobs in the vendor job list that are no longer active should 
+-- jobs in the vendor job list that are no longer active should
    be kept back in old book, removed from new book??
    ditto jobs in the customer list ??
 
@@ -51,22 +51,22 @@
 void
 gncCustomerCopyAll (QofBook *dest_book, QofBook *src_book)
 {
-  
+
 }
 
-static void 
+static void
 bill_term_copy_helper (gpointer object, gpointer user_data)
 {
-  QofBook *dest_book = user_data;
-  gncBillTerm *src_term = object;
-  gncCloneBillTerm (src_term, dest_book);
+    QofBook *dest_book = user_data;
+    gncBillTerm *src_term = object;
+    gncCloneBillTerm (src_term, dest_book);
 }
 
 void
 gncBillTermCopyAll (QofBook *dest_book, QofBook *src_book)
 {
-   qof_object_foreach (GNC_BILLTERM_MODULE_NAME, 
-                   src_book, bill_term_copy_helper, dest_book);
+    qof_object_foreach (GNC_BILLTERM_MODULE_NAME,
+                        src_book, bill_term_copy_helper, dest_book);
 }
 
 
@@ -74,8 +74,8 @@
 partition (QofBook *dest_book, QofBook *src_book)
 {
 
-  /* Copy all bill terms first, since the CustomerCopy expects
-   * these to be in place already. */
-/* XXX not strictly needed, the customer can pull their own .. ? */
-  gncBillTermCopyAll (dest_book, src_book);
+    /* Copy all bill terms first, since the CustomerCopy expects
+     * these to be in place already. */
+    /* XXX not strictly needed, the customer can pull their own .. ? */
+    gncBillTermCopyAll (dest_book, src_book);
 }

Modified: gnucash/trunk/src/business/business-core/gncBusiness.c
===================================================================
--- gnucash/trunk/src/business/business-core/gncBusiness.c	2010-03-02 21:40:28 UTC (rev 18788)
+++ gnucash/trunk/src/business/business-core/gncBusiness.c	2010-03-02 21:41:05 UTC (rev 18789)
@@ -1,5 +1,5 @@
 /*
- * gncBusiness.c -- Business helper functions 
+ * gncBusiness.c -- Business helper functions
  * Copyright (C) 2002 Derek Atkins
  * Author: Derek Atkins <warlord at MIT.EDU>
  *
@@ -28,7 +28,7 @@
 #include "gncBusiness.h"
 #include "gncBusinessP.h"
 
-/* This file is currently unused; 
- * its contents have been moved to qofid.[ch] 
+/* This file is currently unused;
+ * its contents have been moved to qofid.[ch]
  */
 // void gncBusinessInitialize (int argc, char **argv) {}

Modified: gnucash/trunk/src/business/business-core/gncBusiness.h
===================================================================
--- gnucash/trunk/src/business/business-core/gncBusiness.h	2010-03-02 21:40:28 UTC (rev 18788)
+++ gnucash/trunk/src/business/business-core/gncBusiness.h	2010-03-02 21:41:05 UTC (rev 18789)
@@ -20,7 +20,7 @@
 /** @addtogroup Engine
     @{ */
 /** @addtogroup Business
-    The Business Engine provides a set of structures for 
+    The Business Engine provides a set of structures for
     that provide small-business accounting features.
     @{ */
 

Modified: gnucash/trunk/src/business/business-core/gncCustomer.c
===================================================================
--- gnucash/trunk/src/business/business-core/gncCustomer.c	2010-03-02 21:40:28 UTC (rev 18788)
+++ gnucash/trunk/src/business/business-core/gncCustomer.c	2010-03-02 21:41:05 UTC (rev 18789)
@@ -47,34 +47,34 @@
 
 static gint gs_address_event_handler_id = 0;
 static void listen_for_address_events(QofInstance *entity, QofEventId event_type,
-			    gpointer user_data, gpointer event_data);
+                                      gpointer user_data, gpointer event_data);
 
 struct _gncCustomer
 {
-  QofInstance     inst;
+    QofInstance     inst;
 
-  /* The following fields are identical to 'vendor' */
-  char *          id;
-  char *          name;
-  char *          notes;
-  GncBillTerm *   terms;
-  GncAddress *    addr;
-  gnc_commodity * currency;
-  GncTaxTable*    taxtable;
-  gboolean        taxtable_override;
-  GncTaxIncluded  taxincluded;
-  gboolean        active;
-  GList *         jobs;
+    /* The following fields are identical to 'vendor' */
+    char *          id;
+    char *          name;
+    char *          notes;
+    GncBillTerm *   terms;
+    GncAddress *    addr;
+    gnc_commodity * currency;
+    GncTaxTable*    taxtable;
+    gboolean        taxtable_override;
+    GncTaxIncluded  taxincluded;
+    gboolean        active;
+    GList *         jobs;
 
-  /* The following fields are unique to 'customer' */
-  gnc_numeric     credit;
-  gnc_numeric     discount;
-  GncAddress *    shipaddr;
+    /* The following fields are unique to 'customer' */
+    gnc_numeric     credit;
+    gnc_numeric     discount;
+    GncAddress *    shipaddr;
 };
 
 struct _gncCustomerClass
 {
-  QofInstanceClass parent_class;
+    QofInstanceClass parent_class;
 };
 
 static QofLogModule log_module = GNC_MOD_BUSINESS;
@@ -87,15 +87,16 @@
 G_INLINE_FUNC void mark_customer (GncCustomer *customer);
 void mark_customer (GncCustomer *customer)
 {
-  qof_instance_set_dirty(&customer->inst);
-  qof_event_gen (&customer->inst, QOF_EVENT_MODIFY, NULL);
+    qof_instance_set_dirty(&customer->inst);
+    qof_event_gen (&customer->inst, QOF_EVENT_MODIFY, NULL);
 }
 
 /* ============================================================== */
 
-enum {
+enum
+{
     PROP_0,
-	PROP_NAME
+    PROP_NAME
 };
 
 /* GObject Initialization */
@@ -120,43 +121,45 @@
 
 static void
 gnc_customer_get_property (GObject         *object,
-			  guint            prop_id,
-			  GValue          *value,
-			  GParamSpec      *pspec)
+                           guint            prop_id,
+                           GValue          *value,
+                           GParamSpec      *pspec)
 {
     GncCustomer *cust;
 
     g_return_if_fail(GNC_IS_CUSTOMER(object));
 
     cust = GNC_CUSTOMER(object);
-    switch (prop_id) {
-	case PROP_NAME:
-	    g_value_set_string(value, cust->name);
-		break;
-	default:
-	    G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec);
-	    break;
+    switch (prop_id)
+    {
+    case PROP_NAME:
+        g_value_set_string(value, cust->name);
+        break;
+    default:
+        G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec);
+        break;
     }
 }
 
 static void
 gnc_customer_set_property (GObject         *object,
-			  guint            prop_id,
-			  const GValue          *value,
-			  GParamSpec      *pspec)
+                           guint            prop_id,
+                           const GValue          *value,
+                           GParamSpec      *pspec)
 {
     GncCustomer *cust;
 
     g_return_if_fail(GNC_IS_CUSTOMER(object));
 
     cust = GNC_CUSTOMER(object);
-    switch (prop_id) {
-	case PROP_NAME:
-	    gncCustomerSetName(cust, g_value_get_string(value));
-		break;
-	default:
-	    G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec);
-	    break;
+    switch (prop_id)
+    {
+    case PROP_NAME:
+        gncCustomerSetName(cust, g_value_get_string(value));
+        break;
+    default:
+        G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec);
+        break;
     }
 }
 
@@ -164,144 +167,146 @@
 gnc_customer_class_init (GncCustomerClass *klass)
 {
     GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
-	
+
     gobject_class->dispose = gnc_customer_dispose;
     gobject_class->finalize = gnc_customer_finalize;
     gobject_class->set_property = gnc_customer_set_property;
     gobject_class->get_property = gnc_customer_get_property;
 
     g_object_class_install_property
-	(gobject_class,
-	 PROP_NAME,
-	 g_param_spec_string ("name",
-			      "Customer Name",
-			      "The customer is an arbitrary string "
-			      "assigned by the user which provides the "
-				  "customer name.",
-			      NULL,
-			      G_PARAM_READWRITE));
+    (gobject_class,
+     PROP_NAME,
+     g_param_spec_string ("name",
+                          "Customer Name",
+                          "The customer is an arbitrary string "
+                          "assigned by the user which provides the "
+                          "customer name.",
+                          NULL,
+                          G_PARAM_READWRITE));
 }
 
 /* Create/Destroy Functions */
 GncCustomer *gncCustomerCreate (QofBook *book)
 {
-  GncCustomer *cust;
+    GncCustomer *cust;
 
-  if (!book) return NULL;
+    if (!book) return NULL;
 
-  cust = g_object_new (GNC_TYPE_CUSTOMER, NULL);
-  qof_instance_init_data (&cust->inst, _GNC_MOD_NAME, book);
+    cust = g_object_new (GNC_TYPE_CUSTOMER, NULL);
+    qof_instance_init_data (&cust->inst, _GNC_MOD_NAME, book);
 
-  cust->id = CACHE_INSERT ("");
-  cust->name = CACHE_INSERT ("");
-  cust->notes = CACHE_INSERT ("");
-  cust->addr = gncAddressCreate (book, &cust->inst);
-  cust->taxincluded = GNC_TAXINCLUDED_USEGLOBAL;
-  cust->active = TRUE;
-  cust->jobs = NULL;
+    cust->id = CACHE_INSERT ("");
+    cust->name = CACHE_INSERT ("");
+    cust->notes = CACHE_INSERT ("");
+    cust->addr = gncAddressCreate (book, &cust->inst);
+    cust->taxincluded = GNC_TAXINCLUDED_USEGLOBAL;
+    cust->active = TRUE;
+    cust->jobs = NULL;
 
-  cust->discount = gnc_numeric_zero();
-  cust->credit = gnc_numeric_zero();
-  cust->shipaddr = gncAddressCreate (book, &cust->inst);
+    cust->discount = gnc_numeric_zero();
+    cust->credit = gnc_numeric_zero();
+    cust->shipaddr = gncAddressCreate (book, &cust->inst);
 
-  if (gs_address_event_handler_id == 0) {
-    gs_address_event_handler_id = qof_event_register_handler(listen_for_address_events, NULL);
-  }
+    if (gs_address_event_handler_id == 0)
+    {
+        gs_address_event_handler_id = qof_event_register_handler(listen_for_address_events, NULL);
+    }
 
-  qof_event_gen (&cust->inst, QOF_EVENT_CREATE, NULL);
+    qof_event_gen (&cust->inst, QOF_EVENT_CREATE, NULL);
 
-  return cust;
+    return cust;
 }
 
 /** Create a copy of a customer, placing the copy into a new book. */
 GncCustomer *
 gncCloneCustomer (GncCustomer *from, QofBook *book)
 {
-  GList *node;
-  GncCustomer *cust;
+    GList *node;
+    GncCustomer *cust;
 
-  cust = g_object_new (GNC_TYPE_CUSTOMER, NULL);
+    cust = g_object_new (GNC_TYPE_CUSTOMER, NULL);
 
-  qof_instance_init_data (&cust->inst, _GNC_MOD_NAME, book);
-  qof_instance_gemini (&cust->inst, &from->inst);
+    qof_instance_init_data (&cust->inst, _GNC_MOD_NAME, book);
+    qof_instance_gemini (&cust->inst, &from->inst);
 
-  cust->id = CACHE_INSERT (from->id);
-  cust->name = CACHE_INSERT (from->name);
-  cust->notes = CACHE_INSERT (from->notes);
-  cust->discount = from->discount;
-  cust->credit = from->credit;
-  cust->taxincluded = from->taxincluded;
-  cust->active = from->active;
-  cust->taxtable_override = from->taxtable_override;
+    cust->id = CACHE_INSERT (from->id);
+    cust->name = CACHE_INSERT (from->name);
+    cust->notes = CACHE_INSERT (from->notes);
+    cust->discount = from->discount;
+    cust->credit = from->credit;
+    cust->taxincluded = from->taxincluded;
+    cust->active = from->active;
+    cust->taxtable_override = from->taxtable_override;
 
-  cust->addr = gncCloneAddress (from->addr, &cust->inst, book);
-  cust->shipaddr = gncCloneAddress (from->shipaddr, &cust->inst, book);
+    cust->addr = gncCloneAddress (from->addr, &cust->inst, book);
+    cust->shipaddr = gncCloneAddress (from->shipaddr, &cust->inst, book);
 
-  /* Find the matching currency in the new book, assumes
-   * currency has already been copied into new book. */
-  cust->currency = gnc_commodity_obtain_twin (from->currency, book);
+    /* Find the matching currency in the new book, assumes
+     * currency has already been copied into new book. */
+    cust->currency = gnc_commodity_obtain_twin (from->currency, book);
 
-  /* Find the matching bill term, tax table in the new book */
-  cust->terms = gncBillTermObtainTwin(from->terms, book);
-  cust->taxtable = gncTaxTableObtainTwin (from->taxtable, book);
+    /* Find the matching bill term, tax table in the new book */
+    cust->terms = gncBillTermObtainTwin(from->terms, book);
+    cust->taxtable = gncTaxTableObtainTwin (from->taxtable, book);
 
-  for (node=g_list_last(cust->jobs); node; node=node->next)
-  {
-    GncJob *job = node->data;
-    job = gncJobObtainTwin (job, book);
-    cust->jobs = g_list_prepend(cust->jobs, job);
-  }
+    for (node = g_list_last(cust->jobs); node; node = node->next)
+    {
+        GncJob *job = node->data;
+        job = gncJobObtainTwin (job, book);
+        cust->jobs = g_list_prepend(cust->jobs, job);
+    }
 
-  qof_event_gen (&cust->inst, QOF_EVENT_CREATE, NULL);
+    qof_event_gen (&cust->inst, QOF_EVENT_CREATE, NULL);
 
-  return cust;
+    return cust;
 }
 
 void gncCustomerDestroy (GncCustomer *cust)
 {
-  if (!cust) return;
-  qof_instance_set_destroying(cust, TRUE);
-  qof_instance_set_dirty (&cust->inst);
-  gncCustomerCommitEdit (cust);
+    if (!cust) return;
+    qof_instance_set_destroying(cust, TRUE);
+    qof_instance_set_dirty (&cust->inst);
+    gncCustomerCommitEdit (cust);
 }
 
 static void gncCustomerFree (GncCustomer *cust)
 {
-  if (!cust) return;
+    if (!cust) return;
 
-  qof_event_gen (&cust->inst, QOF_EVENT_DESTROY, NULL);
+    qof_event_gen (&cust->inst, QOF_EVENT_DESTROY, NULL);
 
-  CACHE_REMOVE (cust->id);
-  CACHE_REMOVE (cust->name);
-  CACHE_REMOVE (cust->notes);
-  gncAddressBeginEdit (cust->addr);
-  gncAddressDestroy (cust->addr);
-  gncAddressBeginEdit (cust->shipaddr);
-  gncAddressDestroy (cust->shipaddr);
-  g_list_free (cust->jobs);
+    CACHE_REMOVE (cust->id);
+    CACHE_REMOVE (cust->name);
+    CACHE_REMOVE (cust->notes);
+    gncAddressBeginEdit (cust->addr);
+    gncAddressDestroy (cust->addr);
+    gncAddressBeginEdit (cust->shipaddr);
+    gncAddressDestroy (cust->shipaddr);
+    g_list_free (cust->jobs);
 
-  if (cust->terms)
-    gncBillTermDecRef (cust->terms);
-  if (cust->taxtable) {
-    gncTaxTableDecRef (cust->taxtable);
-  }
+    if (cust->terms)
+        gncBillTermDecRef (cust->terms);
+    if (cust->taxtable)
+    {
+        gncTaxTableDecRef (cust->taxtable);
+    }
 
-  /* qof_instance_release (&cust->inst); */
-  g_object_unref (cust);
+    /* qof_instance_release (&cust->inst); */
+    g_object_unref (cust);
 }
 
 GncCustomer *
 gncCustomerObtainTwin (GncCustomer *from, QofBook *book)
 {
-  GncCustomer *cust;
-  if (!from) return NULL;
+    GncCustomer *cust;
+    if (!from) return NULL;
 
-  cust = (GncCustomer *) qof_instance_lookup_twin (QOF_INSTANCE(from), book);
-  if (!cust)
-  {
-    cust = gncCloneCustomer (from, book);
-  }
-  return cust;
+    cust = (GncCustomer *) qof_instance_lookup_twin (QOF_INSTANCE(from), book);
+    if (!cust)
+    {
+        cust = gncCloneCustomer (from, book);
+    }
+    return cust;
 }
 
 /* ============================================================== */
@@ -319,180 +324,183 @@
 
 void gncCustomerSetID (GncCustomer *cust, const char *id)
 {
-  if (!cust) return;
-  if (!id) return;
-  SET_STR(cust, cust->id, id);
-  mark_customer (cust);
-  gncCustomerCommitEdit (cust);
+    if (!cust) return;
+    if (!id) return;
+    SET_STR(cust, cust->id, id);
+    mark_customer (cust);
+    gncCustomerCommitEdit (cust);
 }
 
 void gncCustomerSetName (GncCustomer *cust, const char *name)
 {
-  if (!cust) return;
-  if (!name) return;
-  SET_STR(cust, cust->name, name);
-  mark_customer (cust);
-  gncCustomerCommitEdit (cust);
+    if (!cust) return;
+    if (!name) return;
+    SET_STR(cust, cust->name, name);
+    mark_customer (cust);
+    gncCustomerCommitEdit (cust);
 }
 
 void gncCustomerSetNotes (GncCustomer *cust, const char *notes)
 {
-  if (!cust) return;
-  if (!notes) return;
-  SET_STR(cust, cust->notes, notes);
-  mark_customer (cust);
-  gncCustomerCommitEdit (cust);
+    if (!cust) return;
+    if (!notes) return;
+    SET_STR(cust, cust->notes, notes);
+    mark_customer (cust);
+    gncCustomerCommitEdit (cust);
 }
 
 void gncCustomerSetTerms (GncCustomer *cust, GncBillTerm *terms)
 {
-  if (!cust) return;
-  if (cust->terms == terms) return;
+    if (!cust) return;
+    if (cust->terms == terms) return;
 
-  gncCustomerBeginEdit (cust);
-  if (cust->terms)
-    gncBillTermDecRef (cust->terms);
-  cust->terms = terms;
-  if (cust->terms)
-    gncBillTermIncRef (cust->terms);
-  mark_customer (cust);
-  gncCustomerCommitEdit (cust);
+    gncCustomerBeginEdit (cust);
+    if (cust->terms)
+        gncBillTermDecRef (cust->terms);
+    cust->terms = terms;
+    if (cust->terms)
+        gncBillTermIncRef (cust->terms);
+    mark_customer (cust);
+    gncCustomerCommitEdit (cust);
 }
 
 void gncCustomerSetTaxIncluded (GncCustomer *cust, GncTaxIncluded taxincl)
 {
-  if (!cust) return;
-  if (taxincl == cust->taxincluded) return;
-  gncCustomerBeginEdit (cust);
-  cust->taxincluded = taxincl;
-  mark_customer (cust);
-  gncCustomerCommitEdit (cust);
+    if (!cust) return;
+    if (taxincl == cust->taxincluded) return;
+    gncCustomerBeginEdit (cust);
+    cust->taxincluded = taxincl;
+    mark_customer (cust);
+    gncCustomerCommitEdit (cust);
 }
 
 void gncCustomerSetActive (GncCustomer *cust, gboolean active)
 {
-  if (!cust) return;
-  if (active == cust->active) return;
-  gncCustomerBeginEdit (cust);
-  cust->active = active;
-  mark_customer (cust);
-  gncCustomerCommitEdit (cust);
+    if (!cust) return;
+    if (active == cust->active) return;
+    gncCustomerBeginEdit (cust);
+    cust->active = active;
+    mark_customer (cust);
+    gncCustomerCommitEdit (cust);
 }
 
 void gncCustomerSetDiscount (GncCustomer *cust, gnc_numeric discount)
 {
-  if (!cust) return;
-  if (gnc_numeric_equal (discount, cust->discount)) return;
-  gncCustomerBeginEdit (cust);
-  cust->discount = discount;
-  mark_customer (cust);
-  gncCustomerCommitEdit (cust);
+    if (!cust) return;
+    if (gnc_numeric_equal (discount, cust->discount)) return;
+    gncCustomerBeginEdit (cust);
+    cust->discount = discount;
+    mark_customer (cust);
+    gncCustomerCommitEdit (cust);
 }
 
 void gncCustomerSetCredit (GncCustomer *cust, gnc_numeric credit)
 {
-  if (!cust) return;
-  if (gnc_numeric_equal (credit, cust->credit)) return;
-  gncCustomerBeginEdit (cust);
-  cust->credit = credit;
-  mark_customer (cust);
-  gncCustomerCommitEdit (cust);
+    if (!cust) return;
+    if (gnc_numeric_equal (credit, cust->credit)) return;
+    gncCustomerBeginEdit (cust);
+    cust->credit = credit;
+    mark_customer (cust);
+    gncCustomerCommitEdit (cust);
 }
 
 void gncCustomerSetCurrency (GncCustomer *cust, gnc_commodity *currency)
 {
-  if (!cust || !currency) return;
-  if (cust->currency && gnc_commodity_equal (cust->currency, currency)) return;
-  gncCustomerBeginEdit (cust);
-  cust->currency = currency;
-  mark_customer (cust);
-  gncCustomerCommitEdit (cust);
+    if (!cust || !currency) return;
+    if (cust->currency && gnc_commodity_equal (cust->currency, currency)) return;
+    gncCustomerBeginEdit (cust);
+    cust->currency = currency;
+    mark_customer (cust);
+    gncCustomerCommitEdit (cust);
 }
 
 void gncCustomerSetTaxTableOverride (GncCustomer *customer, gboolean override)
 {
-  if (!customer) return;
-  if (customer->taxtable_override == override) return;
-  gncCustomerBeginEdit (customer);
-  customer->taxtable_override = override;
-  mark_customer (customer);
-  gncCustomerCommitEdit (customer);
+    if (!customer) return;
+    if (customer->taxtable_override == override) return;
+    gncCustomerBeginEdit (customer);
+    customer->taxtable_override = override;
+    mark_customer (customer);
+    gncCustomerCommitEdit (customer);
 }
 
 void gncCustomerSetTaxTable (GncCustomer *customer, GncTaxTable *table)
 {
-  if (!customer) return;
-  if (customer->taxtable == table) return;
+    if (!customer) return;
+    if (customer->taxtable == table) return;
 
-  gncCustomerBeginEdit (customer);
-  if (customer->taxtable)
-    gncTaxTableDecRef (customer->taxtable);
-  if (table)
-    gncTaxTableIncRef (table);
-  customer->taxtable = table;
-  mark_customer (customer);
-  gncCustomerCommitEdit (customer);
+    gncCustomerBeginEdit (customer);
+    if (customer->taxtable)
+        gncTaxTableDecRef (customer->taxtable);
+    if (table)
+        gncTaxTableIncRef (table);
+    customer->taxtable = table;
+    mark_customer (customer);
+    gncCustomerCommitEdit (customer);
 }
 
 /* Note that JobList changes do not affect the "dirtiness" of the customer */
 void gncCustomerAddJob (GncCustomer *cust, GncJob *job)
 {
-  if (!cust) return;
-  if (!job) return;
+    if (!cust) return;
+    if (!job) return;
 
-  if (g_list_index(cust->jobs, job) == -1)
-    cust->jobs = g_list_insert_sorted (cust->jobs, job,
-                                       (GCompareFunc)gncJobCompare);
+    if (g_list_index(cust->jobs, job) == -1)
+        cust->jobs = g_list_insert_sorted (cust->jobs, job,
+                                           (GCompareFunc)gncJobCompare);
 
-  qof_event_gen (&cust->inst, QOF_EVENT_MODIFY, NULL);
+    qof_event_gen (&cust->inst, QOF_EVENT_MODIFY, NULL);
 }
 
 void gncCustomerRemoveJob (GncCustomer *cust, GncJob *job)
 {
-  GList *node;
+    GList *node;
 
-  if (!cust) return;
-  if (!job) return;
+    if (!cust) return;
+    if (!job) return;
 
-  node = g_list_find (cust->jobs, job);
-  if (!node) {
-    /*    PERR ("split not in account"); */
-  } else {
-    cust->jobs = g_list_remove_link (cust->jobs, node);
-    g_list_free_1 (node);
-  }
-  qof_event_gen (&cust->inst, QOF_EVENT_MODIFY, NULL);
+    node = g_list_find (cust->jobs, job);
+    if (!node)
+    {
+        /*    PERR ("split not in account"); */
+    }
+    else
+    {
+        cust->jobs = g_list_remove_link (cust->jobs, node);
+        g_list_free_1 (node);
+    }
+    qof_event_gen (&cust->inst, QOF_EVENT_MODIFY, NULL);
 }
 
 void gncCustomerBeginEdit (GncCustomer *cust)
 {
-  qof_begin_edit (&cust->inst);
+    qof_begin_edit (&cust->inst);
 }
 
 static void gncCustomerOnError (QofInstance *inst, QofBackendError errcode)
 {
-  PERR("Customer QofBackend Failure: %d", errcode);
-  gnc_engine_signal_commit_error( errcode );
+    PERR("Customer QofBackend Failure: %d", errcode);
+    gnc_engine_signal_commit_error( errcode );
 }
 
 static void gncCustomerOnDone (QofInstance *inst)
 {
-  GncCustomer *cust = (GncCustomer *) inst;
-  gncAddressClearDirty (cust->addr);
-  gncAddressClearDirty (cust->shipaddr);
+    GncCustomer *cust = (GncCustomer *) inst;
+    gncAddressClearDirty (cust->addr);
+    gncAddressClearDirty (cust->shipaddr);
 }
 
 static void cust_free (QofInstance *inst)
 {
-  GncCustomer *cust = (GncCustomer *) inst;
-  gncCustomerFree (cust);
+    GncCustomer *cust = (GncCustomer *) inst;
+    gncCustomerFree (cust);
 }
 
 void gncCustomerCommitEdit (GncCustomer *cust)
 {
-  if (!qof_commit_edit (QOF_INSTANCE(cust))) return;
-  qof_commit_edit_part2 (&cust->inst, gncCustomerOnError,
-                         gncCustomerOnDone, cust_free);
+    if (!qof_commit_edit (QOF_INSTANCE(cust))) return;
+    qof_commit_edit_part2 (&cust->inst, gncCustomerOnError,
+                           gncCustomerOnDone, cust_free);
 }
 
 /* ============================================================== */
@@ -500,150 +508,168 @@
 
 const char * gncCustomerGetID (const GncCustomer *cust)
 {
-  if (!cust) return NULL;
-  return cust->id;
+    if (!cust) return NULL;
+    return cust->id;
 }
 
 const char * gncCustomerGetName (const GncCustomer *cust)
 {
-  if (!cust) return NULL;
-  return cust->name;
+    if (!cust) return NULL;
+    return cust->name;
 }
 
 GncAddress * gncCustomerGetAddr (const GncCustomer *cust)
 {
-  if (!cust) return NULL;
-  return cust->addr;
+    if (!cust) return NULL;
+    return cust->addr;
 }
 
 static void
 qofCustomerSetAddr (GncCustomer *cust, QofInstance *addr_ent)
 {
-	GncAddress *addr;
+    GncAddress *addr;
 
-	if(!cust || !addr_ent) { return; }
-	addr = (GncAddress*)addr_ent;
-	if(addr == cust->addr) { return; }
-	if(cust->addr != NULL) {
-		gncAddressBeginEdit(cust->addr);
-		gncAddressDestroy(cust->addr);
-	}
-	gncCustomerBeginEdit(cust);
-	cust->addr = addr;
-	gncCustomerCommitEdit(cust);
+    if (!cust || !addr_ent)
+    {
+        return;
+    }
+    addr = (GncAddress*)addr_ent;
+    if (addr == cust->addr)
+    {
+        return;
+    }
+    if (cust->addr != NULL)
+    {
+        gncAddressBeginEdit(cust->addr);
+        gncAddressDestroy(cust->addr);
+    }
+    gncCustomerBeginEdit(cust);
+    cust->addr = addr;
+    gncCustomerCommitEdit(cust);
 }
 
 static void
 qofCustomerSetShipAddr (GncCustomer *cust, QofInstance *ship_addr_ent)
 {
-	GncAddress *ship_addr;
+    GncAddress *ship_addr;
 
-	if(!cust || !ship_addr_ent) { return; }
-	ship_addr = (GncAddress*)ship_addr_ent;
-	if(ship_addr == cust->shipaddr) { return; }
-	if(cust->shipaddr != NULL) {
-		gncAddressBeginEdit(cust->shipaddr);
-		gncAddressDestroy(cust->shipaddr);
-	}
-	gncCustomerBeginEdit(cust);
-	cust->shipaddr = ship_addr;
-	gncCustomerCommitEdit(cust);
+    if (!cust || !ship_addr_ent)
+    {
+        return;
+    }
+    ship_addr = (GncAddress*)ship_addr_ent;
+    if (ship_addr == cust->shipaddr)
+    {
+        return;
+    }
+    if (cust->shipaddr != NULL)
+    {
+        gncAddressBeginEdit(cust->shipaddr);
+        gncAddressDestroy(cust->shipaddr);
+    }
+    gncCustomerBeginEdit(cust);
+    cust->shipaddr = ship_addr;
+    gncCustomerCommitEdit(cust);
 }
 
 GncAddress * gncCustomerGetShipAddr (const GncCustomer *cust)
 {
-  if (!cust) return NULL;
-  return cust->shipaddr;
+    if (!cust) return NULL;
+    return cust->shipaddr;
 }
 
 const char * gncCustomerGetNotes (const GncCustomer *cust)
 {
-  if (!cust) return NULL;
-  return cust->notes;
+    if (!cust) return NULL;
+    return cust->notes;
 }
 
 GncBillTerm * gncCustomerGetTerms (const GncCustomer *cust)
 {
-  if (!cust) return NULL;
-  return cust->terms;
+    if (!cust) return NULL;
+    return cust->terms;
 }
 
 GncTaxIncluded gncCustomerGetTaxIncluded (const GncCustomer *cust)
 {
-  if (!cust) return GNC_TAXINCLUDED_USEGLOBAL;
-  return cust->taxincluded;
+    if (!cust) return GNC_TAXINCLUDED_USEGLOBAL;
+    return cust->taxincluded;
 }
 
 gnc_commodity * gncCustomerGetCurrency (const GncCustomer *cust)
 {
-  if (!cust) return NULL;
-  return cust->currency;
+    if (!cust) return NULL;
+    return cust->currency;
 }
 
 gboolean gncCustomerGetActive (const GncCustomer *cust)
 {
-  if (!cust) return FALSE;
-  return cust->active;
+    if (!cust) return FALSE;
+    return cust->active;
 }
 
 gnc_numeric gncCustomerGetDiscount (const GncCustomer *cust)
 {
-  if (!cust) return gnc_numeric_zero();
-  return cust->discount;
+    if (!cust) return gnc_numeric_zero();
+    return cust->discount;
 }
 
 gnc_numeric gncCustomerGetCredit (const GncCustomer *cust)
 {
-  if (!cust) return gnc_numeric_zero();
-  return cust->credit;
+    if (!cust) return gnc_numeric_zero();
+    return cust->credit;
 }
 
 gboolean gncCustomerGetTaxTableOverride (const GncCustomer *customer)
 {
-  if (!customer) return FALSE;
-  return customer->taxtable_override;
+    if (!customer) return FALSE;
+    return customer->taxtable_override;
 }
 
 GncTaxTable* gncCustomerGetTaxTable (const GncCustomer *customer)
 {
-  if (!customer) return NULL;
-  return customer->taxtable;
+    if (!customer) return NULL;
+    return customer->taxtable;
 }
 
 GList * gncCustomerGetJoblist (const GncCustomer *cust, gboolean show_all)
 {
-  if (!cust) return NULL;
+    if (!cust) return NULL;
 
-  if (show_all) {
-    return (g_list_copy (cust->jobs));
-  } else {
-    GList *list = NULL, *iterator;
-    for (iterator = cust->jobs; iterator; iterator=iterator->next) {
-      GncJob *j = iterator->data;
-      if (gncJobGetActive (j))
-        list = g_list_append (list, j);
+    if (show_all)
+    {
+        return (g_list_copy (cust->jobs));
     }
-    return list;
-  }
+    else
+    {
+        GList *list = NULL, *iterator;
+        for (iterator = cust->jobs; iterator; iterator = iterator->next)
+        {
+            GncJob *j = iterator->data;
+            if (gncJobGetActive (j))
+                list = g_list_append (list, j);
+        }
+        return list;
+    }
 }
 
 gboolean gncCustomerIsDirty (GncCustomer *cust)
 {
-  if (!cust) return FALSE;
-  return (qof_instance_is_dirty(&cust->inst) ||
-          gncAddressIsDirty (cust->addr) ||
-          gncAddressIsDirty (cust->shipaddr));
+    if (!cust) return FALSE;
+    return (qof_instance_is_dirty(&cust->inst) ||
+            gncAddressIsDirty (cust->addr) ||
+            gncAddressIsDirty (cust->shipaddr));
 }
 
 /* Other functions */
 
 int gncCustomerCompare (const GncCustomer *a, const GncCustomer *b)
 {
-  if (!a && !b) return 0;
-  if (!a && b) return 1;
-  if (a && !b) return -1;
+    if (!a && !b) return 0;
+    if (!a && b) return 1;
+    if (a && !b) return -1;
 
-  return(strcmp(a->name, b->name));
+    return(strcmp(a->name, b->name));
 }
 
 /**
@@ -657,80 +683,99 @@
  */
 static void
 listen_for_address_events(QofInstance *entity, QofEventId event_type,
-			    gpointer user_data, gpointer event_data)
+                          gpointer user_data, gpointer event_data)
 {
-  GncCustomer* cust;
+    GncCustomer* cust;
 
-  if ((event_type & QOF_EVENT_MODIFY) == 0) {
-  	return;
-  }
-  if (!GNC_IS_ADDRESS(entity)) {
-    return;
-  }
-  if (!GNC_IS_CUSTOMER(event_data)) {
-    return;
-  }
-  cust = GNC_CUSTOMER(event_data);
-  gncCustomerBeginEdit(cust);
-  mark_customer(cust);
-  gncCustomerCommitEdit(cust);
+    if ((event_type & QOF_EVENT_MODIFY) == 0)
+    {
+        return;
+    }
+    if (!GNC_IS_ADDRESS(entity))
+    {
+        return;
+    }
+    if (!GNC_IS_CUSTOMER(event_data))
+    {
+        return;
+    }
+    cust = GNC_CUSTOMER(event_data);
+    gncCustomerBeginEdit(cust);
+    mark_customer(cust);
+    gncCustomerCommitEdit(cust);
 }
 /* ============================================================== */
 /* Package-Private functions */
 static const char * _gncCustomerPrintable (gpointer item)
 {
 //  GncCustomer *c = item;
-  if (!item) return "failed";
-  return gncCustomerGetName((GncCustomer*)item);
+    if (!item) return "failed";
+    return gncCustomerGetName((GncCustomer*)item);
 }
 
 static QofObject gncCustomerDesc =
 {
-  .interface_version = QOF_OBJECT_VERSION,
-  .e_type            = _GNC_MOD_NAME,
-  .type_label        = "Customer",
-  .create            = (gpointer)gncCustomerCreate,
-  .book_begin        = NULL,
-  .book_end          = NULL,
-  .is_dirty          = qof_collection_is_dirty,
-  .mark_clean        = qof_collection_mark_clean,
-  .foreach           = qof_collection_foreach,
-  .printable         = (const char* (*)(gpointer))gncCustomerGetName,
-  .version_cmp       = (int (*)(gpointer, gpointer)) qof_instance_version_cmp,
+    .interface_version = QOF_OBJECT_VERSION,
+    .e_type            = _GNC_MOD_NAME,
+    .type_label        = "Customer",
+    .create            = (gpointer)gncCustomerCreate,
+    .book_begin        = NULL,
+    .book_end          = NULL,
+    .is_dirty          = qof_collection_is_dirty,
+    .mark_clean        = qof_collection_mark_clean,
+    .foreach           = qof_collection_foreach,
+    .printable         = (const char * (*)(gpointer))gncCustomerGetName,
+    .version_cmp       = (int (*)(gpointer, gpointer)) qof_instance_version_cmp,
 };
 
 gboolean gncCustomerRegister (void)
 {
-  static QofParam params[] = {
-    { CUSTOMER_ID, QOF_TYPE_STRING, (QofAccessFunc)gncCustomerGetID, (QofSetterFunc)gncCustomerSetID },
-    { CUSTOMER_NAME, QOF_TYPE_STRING, (QofAccessFunc)gncCustomerGetName, (QofSetterFunc)gncCustomerSetName },
-	{ CUSTOMER_NOTES, QOF_TYPE_STRING, (QofAccessFunc)gncCustomerGetNotes, (QofSetterFunc)gncCustomerSetNotes },
-	{ CUSTOMER_DISCOUNT, QOF_TYPE_NUMERIC, (QofAccessFunc)gncCustomerGetDiscount,
-		(QofSetterFunc)gncCustomerSetDiscount },
-	{ CUSTOMER_CREDIT, QOF_TYPE_NUMERIC, (QofAccessFunc)gncCustomerGetCredit,
-		(QofSetterFunc)gncCustomerSetCredit },
-    { CUSTOMER_ADDR, GNC_ID_ADDRESS, (QofAccessFunc)gncCustomerGetAddr, (QofSetterFunc)qofCustomerSetAddr },
-    { CUSTOMER_SHIPADDR, GNC_ID_ADDRESS, (QofAccessFunc)gncCustomerGetShipAddr, (QofSetterFunc)qofCustomerSetShipAddr },
-	{ CUSTOMER_TT_OVER, QOF_TYPE_BOOLEAN, (QofAccessFunc)gncCustomerGetTaxTableOverride, 
-		(QofSetterFunc)gncCustomerSetTaxTableOverride },
-	{ CUSTOMER_TERMS, GNC_ID_BILLTERM, (QofAccessFunc)gncCustomerGetTerms, (QofSetterFunc)gncCustomerSetTerms },
-	{ CUSTOMER_SLOTS, QOF_TYPE_KVP, (QofAccessFunc)qof_instance_get_slots, NULL },
-    { QOF_PARAM_ACTIVE, QOF_TYPE_BOOLEAN, (QofAccessFunc)gncCustomerGetActive, (QofSetterFunc)gncCustomerSetActive },
-    { QOF_PARAM_BOOK, QOF_ID_BOOK, (QofAccessFunc)qof_instance_get_book, NULL },
-    { QOF_PARAM_GUID, QOF_TYPE_GUID, (QofAccessFunc)qof_instance_get_guid, NULL },
-    { NULL },
-  };
+    static QofParam params[] =
+    {
+        { CUSTOMER_ID, QOF_TYPE_STRING, (QofAccessFunc)gncCustomerGetID, (QofSetterFunc)gncCustomerSetID },
+        { CUSTOMER_NAME, QOF_TYPE_STRING, (QofAccessFunc)gncCustomerGetName, (QofSetterFunc)gncCustomerSetName },
+        { CUSTOMER_NOTES, QOF_TYPE_STRING, (QofAccessFunc)gncCustomerGetNotes, (QofSetterFunc)gncCustomerSetNotes },
+        {
+            CUSTOMER_DISCOUNT, QOF_TYPE_NUMERIC, (QofAccessFunc)gncCustomerGetDiscount,
+            (QofSetterFunc)gncCustomerSetDiscount
+        },
+        {
+            CUSTOMER_CREDIT, QOF_TYPE_NUMERIC, (QofAccessFunc)gncCustomerGetCredit,
+            (QofSetterFunc)gncCustomerSetCredit
+        },
+        { CUSTOMER_ADDR, GNC_ID_ADDRESS, (QofAccessFunc)gncCustomerGetAddr, (QofSetterFunc)qofCustomerSetAddr },
+        { CUSTOMER_SHIPADDR, GNC_ID_ADDRESS, (QofAccessFunc)gncCustomerGetShipAddr, (QofSetterFunc)qofCustomerSetShipAddr },
+        {
+            CUSTOMER_TT_OVER, QOF_TYPE_BOOLEAN, (QofAccessFunc)gncCustomerGetTaxTableOverride,
+            (QofSetterFunc)gncCustomerSetTaxTableOverride
+        },
+        { CUSTOMER_TERMS, GNC_ID_BILLTERM, (QofAccessFunc)gncCustomerGetTerms, (QofSetterFunc)gncCustomerSetTerms },
+        { CUSTOMER_SLOTS, QOF_TYPE_KVP, (QofAccessFunc)qof_instance_get_slots, NULL },
+        { QOF_PARAM_ACTIVE, QOF_TYPE_BOOLEAN, (QofAccessFunc)gncCustomerGetActive, (QofSetterFunc)gncCustomerSetActive },
+        { QOF_PARAM_BOOK, QOF_ID_BOOK, (QofAccessFunc)qof_instance_get_book, NULL },
+        { QOF_PARAM_GUID, QOF_TYPE_GUID, (QofAccessFunc)qof_instance_get_guid, NULL },
+        { NULL },
+    };
 
-  if(!qof_choice_add_class(GNC_ID_INVOICE, GNC_ID_CUSTOMER, INVOICE_OWNER)) { return FALSE; }
-  if(!qof_choice_add_class(GNC_ID_JOB, GNC_ID_CUSTOMER, JOB_OWNER)) { return FALSE; }
-  qof_class_register (_GNC_MOD_NAME, (QofSortFunc)gncCustomerCompare,params);
-  if(!qof_choice_create(GNC_ID_CUSTOMER)) { return FALSE;}
-  /* temp */
-  _gncCustomerPrintable(NULL);
-  return qof_object_register (&gncCustomerDesc);
+    if (!qof_choice_add_class(GNC_ID_INVOICE, GNC_ID_CUSTOMER, INVOICE_OWNER))
+    {
+        return FALSE;
+    }
+    if (!qof_choice_add_class(GNC_ID_JOB, GNC_ID_CUSTOMER, JOB_OWNER))
+    {
+        return FALSE;
+    }
+    qof_class_register (_GNC_MOD_NAME, (QofSortFunc)gncCustomerCompare, params);
+    if (!qof_choice_create(GNC_ID_CUSTOMER))
+    {
+        return FALSE;
+    }
+    /* temp */
+    _gncCustomerPrintable(NULL);
+    return qof_object_register (&gncCustomerDesc);
 }
 
 gint64 gncCustomerNextID (QofBook *book)
 {
-  return qof_book_get_counter (book, _GNC_MOD_NAME);
+    return qof_book_get_counter (book, _GNC_MOD_NAME);
 }

Modified: gnucash/trunk/src/business/business-core/gncCustomer.h
===================================================================
--- gnucash/trunk/src/business/business-core/gncCustomer.h	2010-03-02 21:40:28 UTC (rev 18788)
+++ gnucash/trunk/src/business/business-core/gncCustomer.h	2010-03-02 21:41:05 UTC (rev 18789)
@@ -24,7 +24,7 @@
 /** @addtogroup Customer
     @{ */
 /** @file gncCustomer.h
-    @brief Core Customer Interface 
+    @brief Core Customer Interface
     @author Copyright (C) 2001,2002 Derek Atkins <warlord at MIT.EDU>
 */
 
@@ -78,7 +78,7 @@
      (G_TYPE_INSTANCE_GET_CLASS ((o), GNC_TYPE_CUSTOMER, GncCustomerClass))
 GType gnc_customer_get_type(void);
 
-/** @name Create/Destroy Functions 
+/** @name Create/Destroy Functions
  @{ */
 GncCustomer *gncCustomerCreate (QofBook *book);
 void gncCustomerDestroy (GncCustomer *customer);
@@ -86,7 +86,7 @@
 void gncCustomerCommitEdit (GncCustomer *customer);
 /** @} */
 
-/** @name Set Functions 
+/** @name Set Functions
  @{ */
 
 void gncCustomerSetID (GncCustomer *customer, const char *id);
@@ -107,10 +107,10 @@
 
 /** @} */
 
-/** @name Get Functions 
+/** @name Get Functions
  @{ */
 /** Return a pointer to the instance gncCustomer that is identified
- *  by the guid, and is residing in the book. Returns NULL if the 
+ *  by the guid, and is residing in the book. Returns NULL if the
  *  instance can't be found.
  *  Equivalent function prototype is
  *  GncCustomer * gncCustomerLookup (QofBook *book, const GUID *guid);

Modified: gnucash/trunk/src/business/business-core/gncCustomerP.h
===================================================================
--- gnucash/trunk/src/business/business-core/gncCustomerP.h	2010-03-02 21:40:28 UTC (rev 18788)
+++ gnucash/trunk/src/business/business-core/gncCustomerP.h	2010-03-02 21:41:05 UTC (rev 18789)
@@ -37,7 +37,7 @@
 /** The gncCloneCustomer() routine makes a copy of the indicated
  *  customer, placing it in the indicated book.  It copies
  *  the addresses, credits, currency, billing terms and jobs.
- *  It then adds a pair of 'gemini' kvp pointers so that each copy 
+ *  It then adds a pair of 'gemini' kvp pointers so that each copy
  *  can be found from the other.
  */
 GncCustomer * gncCloneCustomer (GncCustomer *from,  QofBook *book);

Modified: gnucash/trunk/src/business/business-core/gncEmployee.c
===================================================================
--- gnucash/trunk/src/business/business-core/gncEmployee.c	2010-03-02 21:40:28 UTC (rev 18788)
+++ gnucash/trunk/src/business/business-core/gncEmployee.c	2010-03-02 21:41:05 UTC (rev 18789)
@@ -39,28 +39,28 @@
 
 static gint gs_address_event_handler_id = 0;
 static void listen_for_address_events(QofInstance *entity, QofEventId event_type,
-			    gpointer user_data, gpointer event_data);
+                                      gpointer user_data, gpointer event_data);
 
-struct _gncEmployee 
+struct _gncEmployee
 {
-  QofInstance     inst;
-  char *          id;
-  char *          username;
-  GncAddress *    addr;
-  gnc_commodity * currency;
-  gboolean        active;
- 
-  char *          language;
-  char *          acl;
-  gnc_numeric     workday;
-  gnc_numeric     rate;
+    QofInstance     inst;
+    char *          id;
+    char *          username;
+    GncAddress *    addr;
+    gnc_commodity * currency;
+    gboolean        active;
 
-  Account *        ccard_acc;
+    char *          language;
+    char *          acl;
+    gnc_numeric     workday;
+    gnc_numeric     rate;
+
+    Account *        ccard_acc;
 };
 
 struct _gncEmployeeClass
 {
-  QofInstanceClass parent_class;
+    QofInstanceClass parent_class;
 };
 
 static QofLogModule log_module = GNC_MOD_BUSINESS;
@@ -70,15 +70,16 @@
 G_INLINE_FUNC void mark_employee (GncEmployee *employee);
 void mark_employee (GncEmployee *employee)
 {
-  qof_instance_set_dirty(&employee->inst);
-  qof_event_gen (&employee->inst, QOF_EVENT_MODIFY, NULL);
+    qof_instance_set_dirty(&employee->inst);
+    qof_event_gen (&employee->inst, QOF_EVENT_MODIFY, NULL);
 }
 
 /* ============================================================== */
 
-enum {
+enum
+{
     PROP_0,
-	PROP_USERNAME
+    PROP_USERNAME
 };
 
 /* GObject Initialization */
@@ -103,43 +104,45 @@
 
 static void
 gnc_employee_get_property (GObject         *object,
-			  guint            prop_id,
-			  GValue          *value,
-			  GParamSpec      *pspec)
+                           guint            prop_id,
+                           GValue          *value,
+                           GParamSpec      *pspec)
 {
     GncEmployee *emp;
 
     g_return_if_fail(GNC_IS_EMPLOYEE(object));
 
     emp = GNC_EMPLOYEE(object);
-    switch (prop_id) {
-	case PROP_USERNAME:
-	    g_value_set_string(value, emp->username);
-		break;
-	default:
-	    G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec);
-	    break;
+    switch (prop_id)
+    {
+    case PROP_USERNAME:
+        g_value_set_string(value, emp->username);
+        break;
+    default:
+        G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec);
+        break;
     }
 }
 
 static void
 gnc_employee_set_property (GObject         *object,
-			  guint            prop_id,
-			  const GValue          *value,
-			  GParamSpec      *pspec)
+                           guint            prop_id,
+                           const GValue          *value,
+                           GParamSpec      *pspec)
 {
     GncEmployee *emp;
 
     g_return_if_fail(GNC_IS_EMPLOYEE(object));
 
     emp = GNC_EMPLOYEE(object);
-    switch (prop_id) {
-	case PROP_USERNAME:
-	    gncEmployeeSetUsername(emp, g_value_get_string(value));
-		break;
-	default:
-	    G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec);
-	    break;
+    switch (prop_id)
+    {
+    case PROP_USERNAME:
+        gncEmployeeSetUsername(emp, g_value_get_string(value));
+        break;
+    default:
+        G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec);
+        break;
     }
 }
 
@@ -147,116 +150,117 @@
 gnc_employee_class_init (GncEmployeeClass *klass)
 {
     GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
-	
+
     gobject_class->dispose = gnc_employee_dispose;
     gobject_class->finalize = gnc_employee_finalize;
     gobject_class->set_property = gnc_employee_set_property;
     gobject_class->get_property = gnc_employee_get_property;
 
     g_object_class_install_property
-	(gobject_class,
-	 PROP_USERNAME,
-	 g_param_spec_string ("name",
-			      "Employee Name",
-			      "The employee name is an arbitrary string "
-			      "assigned by the user which provides the employee "
-				  "name.",
-			      NULL,
-			      G_PARAM_READWRITE));
+    (gobject_class,
+     PROP_USERNAME,
+     g_param_spec_string ("name",
+                          "Employee Name",
+                          "The employee name is an arbitrary string "
+                          "assigned by the user which provides the employee "
+                          "name.",
+                          NULL,
+                          G_PARAM_READWRITE));
 }
 
 /* Create/Destroy Functions */
 GncEmployee *gncEmployeeCreate (QofBook *book)
 {
-  GncEmployee *employee;
+    GncEmployee *employee;
 
-  if (!book) return NULL;
+    if (!book) return NULL;
 
-  employee = g_object_new (GNC_TYPE_EMPLOYEE, NULL);
-  qof_instance_init_data (&employee->inst, _GNC_MOD_NAME, book);
-  
-  employee->id = CACHE_INSERT ("");
-  employee->username = CACHE_INSERT ("");
-  employee->language = CACHE_INSERT ("");
-  employee->acl = CACHE_INSERT ("");
-  employee->addr = gncAddressCreate (book, &employee->inst);
-  employee->workday = gnc_numeric_zero();
-  employee->rate = gnc_numeric_zero();
-  employee->active = TRUE;
-  
-  if (gs_address_event_handler_id == 0) {
-    gs_address_event_handler_id = qof_event_register_handler(listen_for_address_events, NULL);
-  }
+    employee = g_object_new (GNC_TYPE_EMPLOYEE, NULL);
+    qof_instance_init_data (&employee->inst, _GNC_MOD_NAME, book);
 
-  qof_event_gen (&employee->inst, QOF_EVENT_CREATE, NULL);
+    employee->id = CACHE_INSERT ("");
+    employee->username = CACHE_INSERT ("");
+    employee->language = CACHE_INSERT ("");
+    employee->acl = CACHE_INSERT ("");
+    employee->addr = gncAddressCreate (book, &employee->inst);
+    employee->workday = gnc_numeric_zero();
+    employee->rate = gnc_numeric_zero();
+    employee->active = TRUE;
 
-  return employee;
+    if (gs_address_event_handler_id == 0)
+    {
+        gs_address_event_handler_id = qof_event_register_handler(listen_for_address_events, NULL);
+    }
+
+    qof_event_gen (&employee->inst, QOF_EVENT_CREATE, NULL);
+
+    return employee;
 }
 
 void gncEmployeeDestroy (GncEmployee *employee)
 {
-  if (!employee) return;
-  qof_instance_set_destroying(employee, TRUE);
-  gncEmployeeCommitEdit(employee);
+    if (!employee) return;
+    qof_instance_set_destroying(employee, TRUE);
+    gncEmployeeCommitEdit(employee);
 }
 
 static void gncEmployeeFree (GncEmployee *employee)
 {
-  if (!employee) return;
+    if (!employee) return;
 
-  qof_event_gen (&employee->inst, QOF_EVENT_DESTROY, NULL);
+    qof_event_gen (&employee->inst, QOF_EVENT_DESTROY, NULL);
 
-  CACHE_REMOVE (employee->id);
-  CACHE_REMOVE (employee->username);
-  CACHE_REMOVE (employee->language);
-  CACHE_REMOVE (employee->acl);
-  gncAddressBeginEdit (employee->addr);
-  gncAddressDestroy (employee->addr);
+    CACHE_REMOVE (employee->id);
+    CACHE_REMOVE (employee->username);
+    CACHE_REMOVE (employee->language);
+    CACHE_REMOVE (employee->acl);
+    gncAddressBeginEdit (employee->addr);
+    gncAddressDestroy (employee->addr);
 
-  /* qof_instance_release (&employee->inst); */
-  g_object_unref (employee);
+    /* qof_instance_release (&employee->inst); */
+    g_object_unref (employee);
 }
 
 GncEmployee *
 gncCloneEmployee (GncEmployee *from, QofBook *book)
 {
-  GncEmployee *employee;
-  if (!book || !from) return NULL;
+    GncEmployee *employee;
+    if (!book || !from) return NULL;
 
-  employee = g_object_new (GNC_TYPE_EMPLOYEE, NULL);
-  qof_instance_init_data(&employee->inst, _GNC_MOD_NAME, book);
-  qof_instance_gemini (&employee->inst, &from->inst);
+    employee = g_object_new (GNC_TYPE_EMPLOYEE, NULL);
+    qof_instance_init_data(&employee->inst, _GNC_MOD_NAME, book);
+    qof_instance_gemini (&employee->inst, &from->inst);
 
-  employee->id = CACHE_INSERT (from->id);
-  employee->username = CACHE_INSERT (from->username);
-  employee->language = CACHE_INSERT (from->language);
-  employee->acl = CACHE_INSERT (from->acl);
-  employee->addr = gncCloneAddress (from->addr, &employee->inst, book);
-  employee->workday = from->workday;
-  employee->rate = from->rate;
-  employee->active = from->active;
-  employee->currency = gnc_commodity_obtain_twin(from->currency, book);
-  employee->ccard_acc = 
-     GNC_ACCOUNT(qof_instance_lookup_twin(QOF_INSTANCE(from->ccard_acc), book));
-  
-  qof_event_gen (&employee->inst, QOF_EVENT_CREATE, NULL);
+    employee->id = CACHE_INSERT (from->id);
+    employee->username = CACHE_INSERT (from->username);
+    employee->language = CACHE_INSERT (from->language);
+    employee->acl = CACHE_INSERT (from->acl);
+    employee->addr = gncCloneAddress (from->addr, &employee->inst, book);
+    employee->workday = from->workday;
+    employee->rate = from->rate;
+    employee->active = from->active;
+    employee->currency = gnc_commodity_obtain_twin(from->currency, book);
+    employee->ccard_acc =
+        GNC_ACCOUNT(qof_instance_lookup_twin(QOF_INSTANCE(from->ccard_acc), book));
 
-  return employee;
+    qof_event_gen (&employee->inst, QOF_EVENT_CREATE, NULL);
+
+    return employee;
 }
 
 GncEmployee *
 gncEmployeeObtainTwin (GncEmployee *from, QofBook *book)
 {
-  GncEmployee *employee;
-  if (!book) return NULL;
+    GncEmployee *employee;
+    if (!book) return NULL;
 
-  employee = (GncEmployee *) qof_instance_lookup_twin (QOF_INSTANCE(from), book);
-  if (!employee)
-  {
-    employee = gncCloneEmployee (from, book);
-  }
+    employee = (GncEmployee *) qof_instance_lookup_twin (QOF_INSTANCE(from), book);
+    if (!employee)
+    {
+        employee = gncCloneEmployee (from, book);
+    }
 
-  return employee;
+    return employee;
 }
 
 /* ============================================================== */
@@ -274,207 +278,214 @@
 
 void gncEmployeeSetID (GncEmployee *employee, const char *id)
 {
-  if (!employee) return;
-  if (!id) return;
-  SET_STR(employee, employee->id, id);
-  mark_employee (employee);
-  gncEmployeeCommitEdit (employee);
+    if (!employee) return;
+    if (!id) return;
+    SET_STR(employee, employee->id, id);
+    mark_employee (employee);
+    gncEmployeeCommitEdit (employee);
 }
 
 void gncEmployeeSetUsername (GncEmployee *employee, const char *username)
 {
-  if (!employee) return;
-  if (!username) return;
-  SET_STR(employee, employee->username, username);
-  mark_employee (employee);
-  gncEmployeeCommitEdit (employee);
+    if (!employee) return;
+    if (!username) return;
+    SET_STR(employee, employee->username, username);
+    mark_employee (employee);
+    gncEmployeeCommitEdit (employee);
 }
 
 void gncEmployeeSetLanguage (GncEmployee *employee, const char *language)
 {
-  if (!employee) return;
-  if (!language) return;
-  SET_STR(employee, employee->language, language);
-  mark_employee (employee);
-  gncEmployeeCommitEdit (employee);
+    if (!employee) return;
+    if (!language) return;
+    SET_STR(employee, employee->language, language);
+    mark_employee (employee);
+    gncEmployeeCommitEdit (employee);
 }
 
 void gncEmployeeSetAcl (GncEmployee *employee, const char *acl)
 {
-  if (!employee) return;
-  if (!acl) return;
-  SET_STR(employee, employee->acl, acl);
-  mark_employee (employee);
-  gncEmployeeCommitEdit (employee);
+    if (!employee) return;
+    if (!acl) return;
+    SET_STR(employee, employee->acl, acl);
+    mark_employee (employee);
+    gncEmployeeCommitEdit (employee);
 }
 
 void gncEmployeeSetWorkday (GncEmployee *employee, gnc_numeric workday)
 {
-  if (!employee) return;
-  if (gnc_numeric_equal (workday, employee->workday)) return;
-  gncEmployeeBeginEdit (employee);
-  employee->workday = workday;
-  mark_employee (employee);
-  gncEmployeeCommitEdit (employee);
+    if (!employee) return;
+    if (gnc_numeric_equal (workday, employee->workday)) return;
+    gncEmployeeBeginEdit (employee);
+    employee->workday = workday;
+    mark_employee (employee);
+    gncEmployeeCommitEdit (employee);
 }
 
 void gncEmployeeSetRate (GncEmployee *employee, gnc_numeric rate)
 {
-  if (!employee) return;
-  if (gnc_numeric_equal (rate, employee->rate)) return;
-  gncEmployeeBeginEdit (employee);
-  employee->rate = rate;
-  mark_employee (employee);
-  gncEmployeeCommitEdit (employee);
+    if (!employee) return;
+    if (gnc_numeric_equal (rate, employee->rate)) return;
+    gncEmployeeBeginEdit (employee);
+    employee->rate = rate;
+    mark_employee (employee);
+    gncEmployeeCommitEdit (employee);
 }
 
 void gncEmployeeSetCurrency (GncEmployee *employee, gnc_commodity *currency)
 {
-  if (!employee || !currency) return;
-  if (employee->currency && 
-      gnc_commodity_equal (employee->currency, currency))
-    return;
-  gncEmployeeBeginEdit (employee);
-  employee->currency = currency;
-  mark_employee (employee);
-  gncEmployeeCommitEdit (employee);
+    if (!employee || !currency) return;
+    if (employee->currency &&
+            gnc_commodity_equal (employee->currency, currency))
+        return;
+    gncEmployeeBeginEdit (employee);
+    employee->currency = currency;
+    mark_employee (employee);
+    gncEmployeeCommitEdit (employee);
 }
 
 void gncEmployeeSetActive (GncEmployee *employee, gboolean active)
 {
-  if (!employee) return;
-  if (active == employee->active) return;
-  gncEmployeeBeginEdit (employee);
-  employee->active = active;
-  mark_employee (employee);
-  gncEmployeeCommitEdit (employee);
+    if (!employee) return;
+    if (active == employee->active) return;
+    gncEmployeeBeginEdit (employee);
+    employee->active = active;
+    mark_employee (employee);
+    gncEmployeeCommitEdit (employee);
 }
 
 void gncEmployeeSetCCard (GncEmployee *employee, Account* ccard_acc)
 {
-  if (!employee) return;
-  if (ccard_acc == employee->ccard_acc) return;
-  gncEmployeeBeginEdit (employee);
-  employee->ccard_acc = ccard_acc;
-  mark_employee (employee);
-  gncEmployeeCommitEdit (employee);
+    if (!employee) return;
+    if (ccard_acc == employee->ccard_acc) return;
+    gncEmployeeBeginEdit (employee);
+    employee->ccard_acc = ccard_acc;
+    mark_employee (employee);
+    gncEmployeeCommitEdit (employee);
 }
 
 void
 qofEmployeeSetAddr (GncEmployee *employee, QofInstance *addr_ent)
 {
-	GncAddress *addr;
+    GncAddress *addr;
 
-	if(!employee || !addr_ent) { return; }
-	addr = (GncAddress*)addr_ent;
-	if(addr == employee->addr) { return; }
-	if(employee->addr != NULL) {
-		gncAddressBeginEdit(employee->addr);
-		gncAddressDestroy(employee->addr);
-	}
-	gncEmployeeBeginEdit(employee);
-	employee->addr = addr;
-	gncEmployeeCommitEdit(employee);
+    if (!employee || !addr_ent)
+    {
+        return;
+    }
+    addr = (GncAddress*)addr_ent;
+    if (addr == employee->addr)
+    {
+        return;
+    }
+    if (employee->addr != NULL)
+    {
+        gncAddressBeginEdit(employee->addr);
+        gncAddressDestroy(employee->addr);
+    }
+    gncEmployeeBeginEdit(employee);
+    employee->addr = addr;
+    gncEmployeeCommitEdit(employee);
 }
 
 /* ============================================================== */
 /* Get Functions */
 const char * gncEmployeeGetID (const GncEmployee *employee)
 {
-  if (!employee) return NULL;
-  return employee->id;
+    if (!employee) return NULL;
+    return employee->id;
 }
 
 const char * gncEmployeeGetUsername (const GncEmployee *employee)
 {
-  if (!employee) return NULL;
-  return employee->username;
+    if (!employee) return NULL;
+    return employee->username;
 }
 
 GncAddress * gncEmployeeGetAddr (const GncEmployee *employee)
 {
-  if (!employee) return NULL;
-  return employee->addr;
+    if (!employee) return NULL;
+    return employee->addr;
 }
 
 const char * gncEmployeeGetLanguage (const GncEmployee *employee)
 {
-  if (!employee) return NULL;
-  return employee->language;
+    if (!employee) return NULL;
+    return employee->language;
 }
 
 const char * gncEmployeeGetAcl (const GncEmployee *employee)
 {
-  if (!employee) return NULL;
-  return employee->acl;
+    if (!employee) return NULL;
+    return employee->acl;
 }
 
 gnc_numeric gncEmployeeGetWorkday (const GncEmployee *employee)
 {
-  if (!employee) return gnc_numeric_zero();
-  return employee->workday;
+    if (!employee) return gnc_numeric_zero();
+    return employee->workday;
 }
 
 gnc_numeric gncEmployeeGetRate (const GncEmployee *employee)
 {
-  if (!employee) return gnc_numeric_zero();
-  return employee->rate;
+    if (!employee) return gnc_numeric_zero();
+    return employee->rate;
 }
 
 gnc_commodity * gncEmployeeGetCurrency (const GncEmployee *employee)
 {
-  if (!employee) return NULL;
-  return employee->currency;
+    if (!employee) return NULL;
+    return employee->currency;
 }
 
 gboolean gncEmployeeGetActive (const GncEmployee *employee)
 {
-  if (!employee) return FALSE;
-  return employee->active;
+    if (!employee) return FALSE;
+    return employee->active;
 }
 
 Account * gncEmployeeGetCCard (const GncEmployee *employee)
 {
-  if (!employee) return NULL;
-  return employee->ccard_acc;
+    if (!employee) return NULL;
+    return employee->ccard_acc;
 }
 
 gboolean gncEmployeeIsDirty (const GncEmployee *employee)
 {
-  if (!employee) return FALSE;
-  return (qof_instance_get_dirty_flag(employee)
-          || gncAddressIsDirty (employee->addr));
+    if (!employee) return FALSE;
+    return (qof_instance_get_dirty_flag(employee)
+            || gncAddressIsDirty (employee->addr));
 }
 
 void gncEmployeeBeginEdit (GncEmployee *employee)
 {
-  qof_begin_edit(&employee->inst);
+    qof_begin_edit(&employee->inst);
 }
 
 static void gncEmployeeOnError (QofInstance *employee, QofBackendError errcode)
 {
-  PERR("Employee QofBackend Failure: %d", errcode);
-  gnc_engine_signal_commit_error( errcode );
+    PERR("Employee QofBackend Failure: %d", errcode);
+    gnc_engine_signal_commit_error( errcode );
 }
 
 static void gncEmployeeOnDone (QofInstance *inst)
 {
-  GncEmployee *employee = (GncEmployee *) inst;
-  gncAddressClearDirty (employee->addr);
+    GncEmployee *employee = (GncEmployee *) inst;
+    gncAddressClearDirty (employee->addr);
 }
 
 static void emp_free (QofInstance *inst)
 {
-  GncEmployee *employee = (GncEmployee *) inst;
-  gncEmployeeFree (employee);
+    GncEmployee *employee = (GncEmployee *) inst;
+    gncEmployeeFree (employee);
 }
 
 
 void gncEmployeeCommitEdit (GncEmployee *employee)
 {
-  if (!qof_commit_edit (QOF_INSTANCE(employee))) return;
-  qof_commit_edit_part2 (&employee->inst, gncEmployeeOnError,
-                         gncEmployeeOnDone, emp_free);
+    if (!qof_commit_edit (QOF_INSTANCE(employee))) return;
+    qof_commit_edit_part2 (&employee->inst, gncEmployeeOnError,
+                           gncEmployeeOnDone, emp_free);
 }
 
 /* ============================================================== */
@@ -482,20 +493,20 @@
 
 int gncEmployeeCompare (const GncEmployee *a, const GncEmployee *b)
 {
-  if (!a && !b) return 0;
-  if (!a && b) return 1;
-  if (a && !b) return -1;
+    if (!a && !b) return 0;
+    if (!a && b) return 1;
+    if (a && !b) return -1;
 
-  return(strcmp(a->username, b->username));
+    return(strcmp(a->username, b->username));
 }
 
 /* Package-Private functions */
 
 static const char * _gncEmployeePrintable (gpointer item)
 {
-  GncEmployee *v = item;
-  if (!item) return NULL;
-  return gncAddressGetName(v->addr);
+    GncEmployee *v = item;
+    if (!item) return NULL;
+    return gncAddressGetName(v->addr);
 }
 
 /**
@@ -509,66 +520,76 @@
  */
 static void
 listen_for_address_events(QofInstance *entity, QofEventId event_type,
-			    gpointer user_data, gpointer event_data)
+                          gpointer user_data, gpointer event_data)
 {
-  GncEmployee* empl;
+    GncEmployee* empl;
 
-  if ((event_type & QOF_EVENT_MODIFY) == 0) {
-  	return;
-  }
-  if (!GNC_IS_ADDRESS(entity)) {
-    return;
-  }
-  if (!GNC_IS_EMPLOYEE(event_data)) {
-    return;
-  }
-  empl = GNC_EMPLOYEE(event_data);
-  gncEmployeeBeginEdit(empl);
-  mark_employee(empl);
-  gncEmployeeCommitEdit(empl);
+    if ((event_type & QOF_EVENT_MODIFY) == 0)
+    {
+        return;
+    }
+    if (!GNC_IS_ADDRESS(entity))
+    {
+        return;
+    }
+    if (!GNC_IS_EMPLOYEE(event_data))
+    {
+        return;
+    }
+    empl = GNC_EMPLOYEE(event_data);
+    gncEmployeeBeginEdit(empl);
+    mark_employee(empl);
+    gncEmployeeCommitEdit(empl);
 }
 
-static QofObject gncEmployeeDesc = 
+static QofObject gncEmployeeDesc =
 {
-  .interface_version = QOF_OBJECT_VERSION,
-  .e_type            = _GNC_MOD_NAME,
-  .type_label        = "Employee",
-  .create            = (gpointer)gncEmployeeCreate,
-  .book_begin        = NULL,
-  .book_end          = NULL,
-  .is_dirty          = qof_collection_is_dirty,
-  .mark_clean        = qof_collection_mark_clean,
-  .foreach           = qof_collection_foreach,
-  .printable         = _gncEmployeePrintable,
-  .version_cmp       = (int (*)(gpointer, gpointer)) qof_instance_version_cmp,
+    .interface_version = QOF_OBJECT_VERSION,
+    .e_type            = _GNC_MOD_NAME,
+    .type_label        = "Employee",
+    .create            = (gpointer)gncEmployeeCreate,
+    .book_begin        = NULL,
+    .book_end          = NULL,
+    .is_dirty          = qof_collection_is_dirty,
+    .mark_clean        = qof_collection_mark_clean,
+    .foreach           = qof_collection_foreach,
+    .printable         = _gncEmployeePrintable,
+    .version_cmp       = (int (*)(gpointer, gpointer)) qof_instance_version_cmp,
 };
 
 gboolean gncEmployeeRegister (void)
 {
-  static QofParam params[] = {
-    { EMPLOYEE_ID, QOF_TYPE_STRING, (QofAccessFunc)gncEmployeeGetID, (QofSetterFunc)gncEmployeeSetID },
-    { EMPLOYEE_USERNAME, QOF_TYPE_STRING, (QofAccessFunc)gncEmployeeGetUsername, 
-		(QofSetterFunc)gncEmployeeSetUsername },
-	{ EMPLOYEE_LANGUAGE, QOF_TYPE_STRING, (QofAccessFunc)gncEmployeeGetLanguage, 
-		(QofSetterFunc)gncEmployeeSetLanguage },
-	{ EMPLOYEE_ACL, QOF_TYPE_STRING, (QofAccessFunc)gncEmployeeGetAcl, (QofSetterFunc)gncEmployeeSetAcl },
-	{ EMPLOYEE_WORKDAY, QOF_TYPE_NUMERIC, (QofAccessFunc)gncEmployeeGetWorkday,
-		(QofSetterFunc)gncEmployeeSetWorkday },
-	{ EMPLOYEE_RATE, QOF_TYPE_NUMERIC, (QofAccessFunc)gncEmployeeGetRate, (QofSetterFunc)gncEmployeeSetRate },
-    { EMPLOYEE_ADDR, GNC_ID_ADDRESS, (QofAccessFunc)gncEmployeeGetAddr, (QofSetterFunc)qofEmployeeSetAddr },
-    { EMPLOYEE_CC,  GNC_ID_ACCOUNT, (QofAccessFunc)gncEmployeeGetCCard, (QofSetterFunc)gncEmployeeSetCCard },
-    { QOF_PARAM_ACTIVE, QOF_TYPE_BOOLEAN, (QofAccessFunc)gncEmployeeGetActive, (QofSetterFunc)gncEmployeeSetActive },
-    { QOF_PARAM_BOOK, QOF_ID_BOOK, (QofAccessFunc)qof_instance_get_book, NULL },
-    { QOF_PARAM_GUID, QOF_TYPE_GUID, (QofAccessFunc)qof_instance_get_guid, NULL },
-    { NULL },
-  };
+    static QofParam params[] =
+    {
+        { EMPLOYEE_ID, QOF_TYPE_STRING, (QofAccessFunc)gncEmployeeGetID, (QofSetterFunc)gncEmployeeSetID },
+        {
+            EMPLOYEE_USERNAME, QOF_TYPE_STRING, (QofAccessFunc)gncEmployeeGetUsername,
+            (QofSetterFunc)gncEmployeeSetUsername
+        },
+        {
+            EMPLOYEE_LANGUAGE, QOF_TYPE_STRING, (QofAccessFunc)gncEmployeeGetLanguage,
+            (QofSetterFunc)gncEmployeeSetLanguage
+        },
+        { EMPLOYEE_ACL, QOF_TYPE_STRING, (QofAccessFunc)gncEmployeeGetAcl, (QofSetterFunc)gncEmployeeSetAcl },
+        {
+            EMPLOYEE_WORKDAY, QOF_TYPE_NUMERIC, (QofAccessFunc)gncEmployeeGetWorkday,
+            (QofSetterFunc)gncEmployeeSetWorkday
+        },
+        { EMPLOYEE_RATE, QOF_TYPE_NUMERIC, (QofAccessFunc)gncEmployeeGetRate, (QofSetterFunc)gncEmployeeSetRate },
+        { EMPLOYEE_ADDR, GNC_ID_ADDRESS, (QofAccessFunc)gncEmployeeGetAddr, (QofSetterFunc)qofEmployeeSetAddr },
+        { EMPLOYEE_CC,  GNC_ID_ACCOUNT, (QofAccessFunc)gncEmployeeGetCCard, (QofSetterFunc)gncEmployeeSetCCard },
+        { QOF_PARAM_ACTIVE, QOF_TYPE_BOOLEAN, (QofAccessFunc)gncEmployeeGetActive, (QofSetterFunc)gncEmployeeSetActive },
+        { QOF_PARAM_BOOK, QOF_ID_BOOK, (QofAccessFunc)qof_instance_get_book, NULL },
+        { QOF_PARAM_GUID, QOF_TYPE_GUID, (QofAccessFunc)qof_instance_get_guid, NULL },
+        { NULL },
+    };
 
-  qof_class_register (_GNC_MOD_NAME, (QofSortFunc)gncEmployeeCompare,params);
+    qof_class_register (_GNC_MOD_NAME, (QofSortFunc)gncEmployeeCompare, params);
 
-  return qof_object_register (&gncEmployeeDesc);
+    return qof_object_register (&gncEmployeeDesc);
 }
 
 gint64 gncEmployeeNextID (QofBook *book)
 {
-  return qof_book_get_counter (book, _GNC_MOD_NAME);
+    return qof_book_get_counter (book, _GNC_MOD_NAME);
 }

Modified: gnucash/trunk/src/business/business-core/gncEmployee.h
===================================================================
--- gnucash/trunk/src/business/business-core/gncEmployee.h	2010-03-02 21:40:28 UTC (rev 18788)
+++ gnucash/trunk/src/business/business-core/gncEmployee.h	2010-03-02 21:41:05 UTC (rev 18789)
@@ -53,7 +53,7 @@
      (G_TYPE_INSTANCE_GET_CLASS ((o), GNC_TYPE_EMPLOYEE, GncEmployeeClass))
 GType gnc_employee_get_type(void);
 
-/** @name Create/Destroy Functions 
+/** @name Create/Destroy Functions
  @{ */
 GncEmployee *gncEmployeeCreate (QofBook *book);
 void gncEmployeeDestroy (GncEmployee *employee);
@@ -62,7 +62,7 @@
 int gncEmployeeCompare (const GncEmployee *a, const GncEmployee *b);
 /** @} */
 
-/** @name Set Functions 
+/** @name Set Functions
  @{ */
 void gncEmployeeSetID (GncEmployee *employee, const char *id);
 void gncEmployeeSetUsername (GncEmployee *employee, const char *username);
@@ -77,7 +77,7 @@
 
 /** @} */
 
-/** @name Get Functions 
+/** @name Get Functions
  @{ */
 QofBook * gncEmployeeGetBook (GncEmployee *employee);
 const char * gncEmployeeGetID (const GncEmployee *employee);

Modified: gnucash/trunk/src/business/business-core/gncEmployeeP.h
===================================================================
--- gnucash/trunk/src/business/business-core/gncEmployeeP.h	2010-03-02 21:40:28 UTC (rev 18788)
+++ gnucash/trunk/src/business/business-core/gncEmployeeP.h	2010-03-02 21:41:05 UTC (rev 18789)
@@ -38,7 +38,7 @@
  *  employee, placing it in the indicated book.  It copies
  *  the username, address, currency, ccard account, etc.
  *  It also copies (as needed) both parents and children, so that
- *  the parent-child relationship is correctly mirrored in the 
+ *  the parent-child relationship is correctly mirrored in the
  *  clone.
  *  It then adds a pair of 'gemini' kvp pointers so that each copy
  *  can be found from the other.
@@ -52,7 +52,7 @@
  *  gncCloneEmployee()) and placed into the book.
  *
  * We called this routine 'Obtain' instead of "Get" to distinguish
- * it from the other Get routines, which work in fundamentally  
+ * it from the other Get routines, which work in fundamentally
  * different ways.
  */
 GncEmployee * gncEmployeeObtainTwin (GncEmployee *from, QofBook *book);

Modified: gnucash/trunk/src/business/business-core/gncEntry.c
===================================================================
--- gnucash/trunk/src/business/business-core/gncEntry.c	2010-03-02 21:40:28 UTC (rev 18788)
+++ gnucash/trunk/src/business/business-core/gncEntry.c	2010-03-02 21:41:05 UTC (rev 18789)
@@ -36,69 +36,69 @@
 #include "gncInvoice.h"
 #include "gncOrder.h"
 
-struct _gncEntry 
+struct _gncEntry
 {
-  QofInstance inst;
+    QofInstance inst;
 
-  Timespec	date;
-  Timespec	date_entered;
-  char *	desc;
-  char *	action;
-  char *	notes;
-  gnc_numeric 	quantity;
+    Timespec	date;
+    Timespec	date_entered;
+    char *	desc;
+    char *	action;
+    char *	notes;
+    gnc_numeric 	quantity;
 
-  /* customer invoice data */
-  Account *	i_account;
-  gnc_numeric 	i_price;
-  gboolean	i_taxable;
-  gboolean	i_taxincluded;
-  GncTaxTable *	i_tax_table;
-  gnc_numeric 	i_discount;
-  GncAmountType	i_disc_type;
-  GncDiscountHow i_disc_how;
+    /* customer invoice data */
+    Account *	i_account;
+    gnc_numeric 	i_price;
+    gboolean	i_taxable;
+    gboolean	i_taxincluded;
+    GncTaxTable *	i_tax_table;
+    gnc_numeric 	i_discount;
+    GncAmountType	i_disc_type;
+    GncDiscountHow i_disc_how;
 
-  /* vendor bill data */
-  Account *	b_account;
-  gnc_numeric 	b_price;
-  gboolean	b_taxable;
-  gboolean	b_taxincluded;
-  GncTaxTable *	b_tax_table;
-  gboolean	billable;
-  GncOwner	billto;
+    /* vendor bill data */
+    Account *	b_account;
+    gnc_numeric 	b_price;
+    gboolean	b_taxable;
+    gboolean	b_taxincluded;
+    GncTaxTable *	b_tax_table;
+    gboolean	billable;
+    GncOwner	billto;
 
-  /* employee bill data */
-  GncEntryPaymentType b_payment;
+    /* employee bill data */
+    GncEntryPaymentType b_payment;
 
-  /* my parent(s) */
-  GncOrder *	order;
-  GncInvoice *	invoice;
-  GncInvoice *	bill;
+    /* my parent(s) */
+    GncOrder *	order;
+    GncInvoice *	invoice;
+    GncInvoice *	bill;
 
-  /* CACHED VALUES */
-  gboolean	values_dirty;
+    /* CACHED VALUES */
+    gboolean	values_dirty;
 
-  /* customer invoice */
-  gnc_numeric	i_value;
-  gnc_numeric	i_value_rounded;
-  GList *	i_tax_values;
-  gnc_numeric	i_tax_value;
-  gnc_numeric	i_tax_value_rounded;
-  gnc_numeric	i_disc_value;
-  gnc_numeric	i_disc_value_rounded;
-  Timespec	i_taxtable_modtime;
+    /* customer invoice */
+    gnc_numeric	i_value;
+    gnc_numeric	i_value_rounded;
+    GList *	i_tax_values;
+    gnc_numeric	i_tax_value;
+    gnc_numeric	i_tax_value_rounded;
+    gnc_numeric	i_disc_value;
+    gnc_numeric	i_disc_value_rounded;
+    Timespec	i_taxtable_modtime;
 
-  /* vendor bill */
-  gnc_numeric	b_value;
-  gnc_numeric	b_value_rounded;
-  GList *	b_tax_values;
-  gnc_numeric	b_tax_value;
-  gnc_numeric	b_tax_value_rounded;
-  Timespec	b_taxtable_modtime;
+    /* vendor bill */
+    gnc_numeric	b_value;
+    gnc_numeric	b_value_rounded;
+    GList *	b_tax_values;
+    gnc_numeric	b_tax_value;
+    gnc_numeric	b_tax_value_rounded;
+    Timespec	b_taxtable_modtime;
 };
 
 struct _gncEntryClass
 {
-  QofInstanceClass parent_class;
+    QofInstanceClass parent_class;
 };
 
 static QofLogModule log_module = GNC_MOD_BUSINESS;
@@ -110,51 +110,51 @@
 const char *
 gncEntryDiscountHowToString (GncDiscountHow how)
 {
-  switch(how)
-  {
-    GNC_RETURN_ENUM_AS_STRING(GNC_DISC_PRETAX, "PRETAX");
-    GNC_RETURN_ENUM_AS_STRING(GNC_DISC_SAMETIME, "SAMETIME");
-    GNC_RETURN_ENUM_AS_STRING(GNC_DISC_POSTTAX, "POSTTAX");
+    switch (how)
+    {
+        GNC_RETURN_ENUM_AS_STRING(GNC_DISC_PRETAX, "PRETAX");
+        GNC_RETURN_ENUM_AS_STRING(GNC_DISC_SAMETIME, "SAMETIME");
+        GNC_RETURN_ENUM_AS_STRING(GNC_DISC_POSTTAX, "POSTTAX");
     default:
-      g_warning ("asked to translate unknown discount-how %d.\n", how);
-      break;
-  }
-  return(NULL);
+        g_warning ("asked to translate unknown discount-how %d.\n", how);
+        break;
+    }
+    return(NULL);
 }
 
 const char * gncEntryPaymentTypeToString (GncEntryPaymentType type)
 {
-  switch(type)
-  {
-    GNC_RETURN_ENUM_AS_STRING(GNC_PAYMENT_CASH, "CASH");
-    GNC_RETURN_ENUM_AS_STRING(GNC_PAYMENT_CARD, "CARD");
+    switch (type)
+    {
+        GNC_RETURN_ENUM_AS_STRING(GNC_PAYMENT_CASH, "CASH");
+        GNC_RETURN_ENUM_AS_STRING(GNC_PAYMENT_CARD, "CARD");
     default:
-      g_warning ("asked to translate unknown payment type %d.\n", type);
-      break;
-  }
-  return(NULL);
+        g_warning ("asked to translate unknown payment type %d.\n", type);
+        break;
+    }
+    return(NULL);
 }
 #undef GNC_RETURN_ENUM_AS_STRING
 #define GNC_RETURN_ON_MATCH(s,x,r) \
   if(safe_strcmp((s), (str)) == 0) { *(r) = x; return(TRUE); }
 gboolean gncEntryDiscountStringToHow (const char *str, GncDiscountHow *how)
 {
-  GNC_RETURN_ON_MATCH ("PRETAX", GNC_DISC_PRETAX, how);
-  GNC_RETURN_ON_MATCH ("SAMETIME", GNC_DISC_SAMETIME, how);
-  GNC_RETURN_ON_MATCH ("POSTTAX", GNC_DISC_POSTTAX, how);
-  g_warning ("asked to translate unknown discount-how string %s.\n",
-       str ? str : "(null)");
+    GNC_RETURN_ON_MATCH ("PRETAX", GNC_DISC_PRETAX, how);
+    GNC_RETURN_ON_MATCH ("SAMETIME", GNC_DISC_SAMETIME, how);
+    GNC_RETURN_ON_MATCH ("POSTTAX", GNC_DISC_POSTTAX, how);
+    g_warning ("asked to translate unknown discount-how string %s.\n",
+               str ? str : "(null)");
 
-  return(FALSE);
+    return(FALSE);
 }
 gboolean gncEntryPaymentStringToType (const char *str, GncEntryPaymentType *type)
 {
-  GNC_RETURN_ON_MATCH ("CASH", GNC_PAYMENT_CASH, type);
-  GNC_RETURN_ON_MATCH ("CARD", GNC_PAYMENT_CARD, type);
-  g_warning ("asked to translate unknown discount-how string %s.\n",
-       str ? str : "(null)");
+    GNC_RETURN_ON_MATCH ("CASH", GNC_PAYMENT_CASH, type);
+    GNC_RETURN_ON_MATCH ("CARD", GNC_PAYMENT_CARD, type);
+    g_warning ("asked to translate unknown discount-how string %s.\n",
+               str ? str : "(null)");
 
-  return(FALSE);
+    return(FALSE);
 }
 #undef GNC_RETURN_ON_MATCH
 
@@ -173,15 +173,16 @@
 G_INLINE_FUNC void mark_entry (GncEntry *entry);
 void mark_entry (GncEntry *entry)
 {
-  qof_instance_set_dirty(&entry->inst);
-  qof_event_gen (&entry->inst, QOF_EVENT_MODIFY, NULL);
+    qof_instance_set_dirty(&entry->inst);
+    qof_event_gen (&entry->inst, QOF_EVENT_MODIFY, NULL);
 }
 
 /* ================================================================ */
 
-enum {
+enum
+{
     PROP_0,
-	PROP_DESCRIPTION
+    PROP_DESCRIPTION
 };
 
 /* GObject Initialization */
@@ -206,43 +207,45 @@
 
 static void
 gnc_entry_get_property (GObject         *object,
-			  guint            prop_id,
-			  GValue          *value,
-			  GParamSpec      *pspec)
+                        guint            prop_id,
+                        GValue          *value,
+                        GParamSpec      *pspec)
 {
     GncEntry *entry;
 
     g_return_if_fail(GNC_IS_ENTRY(object));
 
     entry = GNC_ENTRY(object);
-    switch (prop_id) {
-	case PROP_DESCRIPTION:
-	    g_value_set_string(value, entry->desc);
-		break;
-	default:
-	    G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec);
-	    break;
+    switch (prop_id)
+    {
+    case PROP_DESCRIPTION:
+        g_value_set_string(value, entry->desc);
+        break;
+    default:
+        G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec);
+        break;
     }
 }
 
 static void
 gnc_entry_set_property (GObject         *object,
-			  guint            prop_id,
-			  const GValue          *value,
-			  GParamSpec      *pspec)
+                        guint            prop_id,
+                        const GValue          *value,
+                        GParamSpec      *pspec)
 {
     GncEntry *entry;
 
     g_return_if_fail(GNC_IS_ENTRY(object));
 
     entry = GNC_ENTRY(object);
-    switch (prop_id) {
-	case PROP_DESCRIPTION:
-	    gncEntrySetDescription(entry, g_value_get_string(value));
-		break;
-	default:
-	    G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec);
-	    break;
+    switch (prop_id)
+    {
+    case PROP_DESCRIPTION:
+        gncEntrySetDescription(entry, g_value_get_string(value));
+        break;
+    default:
+        G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec);
+        break;
     }
 }
 
@@ -250,107 +253,107 @@
 gnc_entry_class_init (GncEntryClass *klass)
 {
     GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
-	
+
     gobject_class->dispose = gnc_entry_dispose;
     gobject_class->finalize = gnc_entry_finalize;
     gobject_class->set_property = gnc_entry_set_property;
     gobject_class->get_property = gnc_entry_get_property;
 
     g_object_class_install_property
-	(gobject_class,
-	 PROP_DESCRIPTION,
-	 g_param_spec_string ("description",
-			      "Entry Description",
-			      "The description is an arbitrary string "
-			      "assigned by the user.  It provides identification "
-			      "for this entry.",
-			      NULL,
-			      G_PARAM_READWRITE));
+    (gobject_class,
+     PROP_DESCRIPTION,
+     g_param_spec_string ("description",
+                          "Entry Description",
+                          "The description is an arbitrary string "
+                          "assigned by the user.  It provides identification "
+                          "for this entry.",
+                          NULL,
+                          G_PARAM_READWRITE));
 }
 
 /* Create/Destroy Functions */
 GncEntry *gncEntryCreate (QofBook *book)
 {
-  GncEntry *entry;
-  gnc_numeric zero = gnc_numeric_zero ();
+    GncEntry *entry;
+    gnc_numeric zero = gnc_numeric_zero ();
 
-  if (!book) return NULL;
+    if (!book) return NULL;
 
-  entry = g_object_new (GNC_TYPE_ENTRY, NULL);
-  qof_instance_init_data (&entry->inst, _GNC_MOD_NAME, book);
+    entry = g_object_new (GNC_TYPE_ENTRY, NULL);
+    qof_instance_init_data (&entry->inst, _GNC_MOD_NAME, book);
 
-  entry->desc = CACHE_INSERT ("");
-  entry->action = CACHE_INSERT ("");
-  entry->notes = CACHE_INSERT ("");
-  entry->quantity = zero;
+    entry->desc = CACHE_INSERT ("");
+    entry->action = CACHE_INSERT ("");
+    entry->notes = CACHE_INSERT ("");
+    entry->quantity = zero;
 
-  entry->i_price = zero;
-  entry->i_taxable = TRUE;
-  entry->i_discount = zero;
-  entry->i_disc_type = GNC_AMT_TYPE_PERCENT;
-  entry->i_disc_how = GNC_DISC_PRETAX;
+    entry->i_price = zero;
+    entry->i_taxable = TRUE;
+    entry->i_discount = zero;
+    entry->i_disc_type = GNC_AMT_TYPE_PERCENT;
+    entry->i_disc_how = GNC_DISC_PRETAX;
 
-  entry->b_price = zero;
-  entry->b_taxable = TRUE;
-  entry->billto.type = GNC_OWNER_CUSTOMER;
-  entry->b_payment = GNC_PAYMENT_CASH;
+    entry->b_price = zero;
+    entry->b_taxable = TRUE;
+    entry->billto.type = GNC_OWNER_CUSTOMER;
+    entry->b_payment = GNC_PAYMENT_CASH;
 
-  entry->values_dirty = TRUE;
+    entry->values_dirty = TRUE;
 
-  qof_event_gen (&entry->inst, QOF_EVENT_CREATE, NULL);
+    qof_event_gen (&entry->inst, QOF_EVENT_CREATE, NULL);
 
-  return entry;
+    return entry;
 }
 
 void gncEntryDestroy (GncEntry *entry)
 {
-  if (!entry) return;
-  qof_instance_set_destroying(entry, TRUE);
-  gncEntryCommitEdit(entry);
+    if (!entry) return;
+    qof_instance_set_destroying(entry, TRUE);
+    gncEntryCommitEdit(entry);
 }
 
 static void gncEntryFree (GncEntry *entry)
 {
-  if (!entry) return;
+    if (!entry) return;
 
-  qof_event_gen (&entry->inst, QOF_EVENT_DESTROY, NULL);
+    qof_event_gen (&entry->inst, QOF_EVENT_DESTROY, NULL);
 
-  CACHE_REMOVE (entry->desc);
-  CACHE_REMOVE (entry->action);
-  CACHE_REMOVE (entry->notes);
-  if (entry->i_tax_values)
-    gncAccountValueDestroy (entry->i_tax_values);
-  if (entry->b_tax_values)
-    gncAccountValueDestroy (entry->b_tax_values);
-  if (entry->i_tax_table)
-    gncTaxTableDecRef (entry->i_tax_table);
-  if (entry->b_tax_table)
-    gncTaxTableDecRef (entry->b_tax_table);
+    CACHE_REMOVE (entry->desc);
+    CACHE_REMOVE (entry->action);
+    CACHE_REMOVE (entry->notes);
+    if (entry->i_tax_values)
+        gncAccountValueDestroy (entry->i_tax_values);
+    if (entry->b_tax_values)
+        gncAccountValueDestroy (entry->b_tax_values);
+    if (entry->i_tax_table)
+        gncTaxTableDecRef (entry->i_tax_table);
+    if (entry->b_tax_table)
+        gncTaxTableDecRef (entry->b_tax_table);
 
-  /* qof_instance_release (&entry->inst); */
-  g_object_unref (entry);
+    /* qof_instance_release (&entry->inst); */
+    g_object_unref (entry);
 }
 
 GncEntry *
 gncCloneEntry (GncEntry *from, QofBook *book)
 {
-  /* XXX unfinished */
-  return NULL;
+    /* XXX unfinished */
+    return NULL;
 }
 
 GncEntry *
 gncEntryObtainTwin (GncEntry *from, QofBook *book)
 {
-  GncEntry *entry;
-  if (!book) return NULL;
+    GncEntry *entry;
+    if (!book) return NULL;
 
-  entry = (GncEntry *) qof_instance_lookup_twin (QOF_INSTANCE(from), book);
-  if (!entry)
-  {
-    entry = gncCloneEntry (from, book);
-  }
+    entry = (GncEntry *) qof_instance_lookup_twin (QOF_INSTANCE(from), book);
+    if (!entry)
+    {
+        entry = gncCloneEntry (from, book);
+    }
 
-  return entry;
+    return entry;
 }
 
 
@@ -359,372 +362,373 @@
 
 void gncEntrySetDate (GncEntry *entry, Timespec date)
 {
-  gboolean first_date = FALSE;
-  Timespec zero_time = { 0, 0 };
+    gboolean first_date = FALSE;
+    Timespec zero_time = { 0, 0 };
 
-  if (!entry) return;
-  if (timespec_equal (&entry->date, &date)) return;
-  if (timespec_equal (&entry->date, &zero_time))
-    first_date = TRUE;
-  gncEntryBeginEdit (entry);
-  entry->date = date;
-  mark_entry (entry);
-  gncEntryCommitEdit (entry);
+    if (!entry) return;
+    if (timespec_equal (&entry->date, &date)) return;
+    if (timespec_equal (&entry->date, &zero_time))
+        first_date = TRUE;
+    gncEntryBeginEdit (entry);
+    entry->date = date;
+    mark_entry (entry);
+    gncEntryCommitEdit (entry);
 
-  /* Don't re-sort the first time we set the date on this entry */
-  if (!first_date) {
-    if (entry->invoice)
-      gncInvoiceSortEntries(entry->invoice);
-    if (entry->bill)
-      gncInvoiceSortEntries(entry->bill);
-  }
+    /* Don't re-sort the first time we set the date on this entry */
+    if (!first_date)
+    {
+        if (entry->invoice)
+            gncInvoiceSortEntries(entry->invoice);
+        if (entry->bill)
+            gncInvoiceSortEntries(entry->bill);
+    }
 }
 
 void gncEntrySetDateEntered (GncEntry *entry, Timespec date)
 {
-  if (!entry) return;
-  if (timespec_equal (&entry->date_entered, &date)) return;
-  gncEntryBeginEdit (entry);
-  entry->date_entered = date;
-  mark_entry (entry);
-  gncEntryCommitEdit (entry);
+    if (!entry) return;
+    if (timespec_equal (&entry->date_entered, &date)) return;
+    gncEntryBeginEdit (entry);
+    entry->date_entered = date;
+    mark_entry (entry);
+    gncEntryCommitEdit (entry);
 }
 
 void gncEntrySetDescription (GncEntry *entry, const char *desc)
 {
-  if (!entry || !desc) return;
-  SET_STR (entry, entry->desc, desc);
-  mark_entry (entry);
-  gncEntryCommitEdit (entry);
+    if (!entry || !desc) return;
+    SET_STR (entry, entry->desc, desc);
+    mark_entry (entry);
+    gncEntryCommitEdit (entry);
 }
 
 void gncEntrySetAction (GncEntry *entry, const char *action)
 {
-  if (!entry || !action) return;
-  SET_STR (entry,entry->action, action);
-  mark_entry (entry);
-  gncEntryCommitEdit (entry);
+    if (!entry || !action) return;
+    SET_STR (entry, entry->action, action);
+    mark_entry (entry);
+    gncEntryCommitEdit (entry);
 }
 
 void gncEntrySetNotes (GncEntry *entry, const char *notes)
 {
-  if (!entry || !notes) return;
-  SET_STR (entry, entry->notes, notes);
-  mark_entry (entry);
-  gncEntryCommitEdit (entry);
+    if (!entry || !notes) return;
+    SET_STR (entry, entry->notes, notes);
+    mark_entry (entry);
+    gncEntryCommitEdit (entry);
 }
 
 void gncEntrySetQuantity (GncEntry *entry, gnc_numeric quantity)
 {
-  if (!entry) return;
-  if (gnc_numeric_eq (entry->quantity, quantity)) return;
-  gncEntryBeginEdit (entry);
-  entry->quantity = quantity;
-  entry->values_dirty = TRUE;
-  mark_entry (entry);
-  gncEntryCommitEdit (entry);
+    if (!entry) return;
+    if (gnc_numeric_eq (entry->quantity, quantity)) return;
+    gncEntryBeginEdit (entry);
+    entry->quantity = quantity;
+    entry->values_dirty = TRUE;
+    mark_entry (entry);
+    gncEntryCommitEdit (entry);
 }
 
 /* Customer Invoices */
 
 void gncEntrySetInvAccount (GncEntry *entry, Account *acc)
 {
-  if (!entry) return;
-  if (entry->i_account == acc) return;
-  gncEntryBeginEdit (entry);
-  entry->i_account = acc;
-  mark_entry (entry);
-  gncEntryCommitEdit (entry);
+    if (!entry) return;
+    if (entry->i_account == acc) return;
+    gncEntryBeginEdit (entry);
+    entry->i_account = acc;
+    mark_entry (entry);
+    gncEntryCommitEdit (entry);
 }
 
 void gncEntrySetInvPrice (GncEntry *entry, gnc_numeric price)
 {
-  if (!entry) return;
-  if (gnc_numeric_eq (entry->i_price, price)) return;
-  gncEntryBeginEdit (entry);
-  entry->i_price = price;
-  entry->values_dirty = TRUE;
-  mark_entry (entry);
-  gncEntryCommitEdit (entry);
+    if (!entry) return;
+    if (gnc_numeric_eq (entry->i_price, price)) return;
+    gncEntryBeginEdit (entry);
+    entry->i_price = price;
+    entry->values_dirty = TRUE;
+    mark_entry (entry);
+    gncEntryCommitEdit (entry);
 }
 
 void gncEntrySetInvTaxable (GncEntry *entry, gboolean taxable)
 {
-  if (!entry) return;
-  if (entry->i_taxable == taxable) return;
-  gncEntryBeginEdit (entry);
-  entry->i_taxable = taxable;
-  entry->values_dirty = TRUE;
-  mark_entry (entry);
-  gncEntryCommitEdit (entry);
+    if (!entry) return;
+    if (entry->i_taxable == taxable) return;
+    gncEntryBeginEdit (entry);
+    entry->i_taxable = taxable;
+    entry->values_dirty = TRUE;
+    mark_entry (entry);
+    gncEntryCommitEdit (entry);
 }
 
 void gncEntrySetInvTaxIncluded (GncEntry *entry, gboolean taxincluded)
 {
-  if (!entry) return;
-  if (entry->i_taxincluded == taxincluded) return;
-  gncEntryBeginEdit (entry);
-  entry->i_taxincluded = taxincluded;
-  entry->values_dirty = TRUE;
-  mark_entry (entry);
-  gncEntryCommitEdit (entry);
+    if (!entry) return;
+    if (entry->i_taxincluded == taxincluded) return;
+    gncEntryBeginEdit (entry);
+    entry->i_taxincluded = taxincluded;
+    entry->values_dirty = TRUE;
+    mark_entry (entry);
+    gncEntryCommitEdit (entry);
 }
 
 void gncEntrySetInvTaxTable (GncEntry *entry, GncTaxTable *table)
 {
-  if (!entry) return;
-  if (entry->i_tax_table == table) return;
-  gncEntryBeginEdit (entry);
-  if (entry->i_tax_table)
-    gncTaxTableDecRef (entry->i_tax_table);
-  if (table)
-    gncTaxTableIncRef (table);
-  entry->i_tax_table = table;
-  entry->values_dirty = TRUE;
-  mark_entry (entry);
-  gncEntryCommitEdit (entry);
+    if (!entry) return;
+    if (entry->i_tax_table == table) return;
+    gncEntryBeginEdit (entry);
+    if (entry->i_tax_table)
+        gncTaxTableDecRef (entry->i_tax_table);
+    if (table)
+        gncTaxTableIncRef (table);
+    entry->i_tax_table = table;
+    entry->values_dirty = TRUE;
+    mark_entry (entry);
+    gncEntryCommitEdit (entry);
 }
 
 void gncEntrySetInvDiscount (GncEntry *entry, gnc_numeric discount)
 {
-  if (!entry) return;
-  if (gnc_numeric_eq (entry->i_discount, discount)) return;
-  gncEntryBeginEdit (entry);
-  entry->i_discount = discount;
-  entry->values_dirty = TRUE;
-  mark_entry (entry);
-  gncEntryCommitEdit (entry);
+    if (!entry) return;
+    if (gnc_numeric_eq (entry->i_discount, discount)) return;
+    gncEntryBeginEdit (entry);
+    entry->i_discount = discount;
+    entry->values_dirty = TRUE;
+    mark_entry (entry);
+    gncEntryCommitEdit (entry);
 }
 
 void gncEntrySetInvDiscountType (GncEntry *entry, GncAmountType type)
 {
-  if (!entry) return;
-  if (entry->i_disc_type == type) return;
+    if (!entry) return;
+    if (entry->i_disc_type == type) return;
 
-  gncEntryBeginEdit (entry);
-  entry->i_disc_type = type;
-  entry->values_dirty = TRUE;
-  mark_entry (entry);
-  gncEntryCommitEdit (entry);
+    gncEntryBeginEdit (entry);
+    entry->i_disc_type = type;
+    entry->values_dirty = TRUE;
+    mark_entry (entry);
+    gncEntryCommitEdit (entry);
 }
 
 void gncEntrySetInvDiscountHow (GncEntry *entry, GncDiscountHow how)
 {
-  if (!entry) return;
-  if (entry->i_disc_how == how) return;
+    if (!entry) return;
+    if (entry->i_disc_how == how) return;
 
-  gncEntryBeginEdit (entry);
-  entry->i_disc_how = how;
-  entry->values_dirty = TRUE;
-  mark_entry (entry);
-  gncEntryCommitEdit (entry);
+    gncEntryBeginEdit (entry);
+    entry->i_disc_how = how;
+    entry->values_dirty = TRUE;
+    mark_entry (entry);
+    gncEntryCommitEdit (entry);
 }
 
 void qofEntrySetInvDiscType (GncEntry *entry, const char *type_string)
 {
-	GncAmountType type;
+    GncAmountType type;
 
-	if (!entry) return;
-	gncAmountStringToType(type_string, &type);
-	if (entry->i_disc_type == type) return;
-	gncEntryBeginEdit (entry);
-	entry->i_disc_type = type;
-	entry->values_dirty = TRUE;
-	mark_entry (entry);
-	gncEntryCommitEdit (entry);
+    if (!entry) return;
+    gncAmountStringToType(type_string, &type);
+    if (entry->i_disc_type == type) return;
+    gncEntryBeginEdit (entry);
+    entry->i_disc_type = type;
+    entry->values_dirty = TRUE;
+    mark_entry (entry);
+    gncEntryCommitEdit (entry);
 
 }
 
 void qofEntrySetInvDiscHow  (GncEntry *entry, const char *type)
 {
-	GncDiscountHow how;
+    GncDiscountHow how;
 
-	if (!entry) return;
-	gncEntryBeginEdit (entry);
-	gncEntryDiscountStringToHow(type, &how);
-	if (entry->i_disc_how == how) return;
-	entry->i_disc_how = how;
-	entry->values_dirty = TRUE;
-	mark_entry (entry);
-	gncEntryCommitEdit (entry);
+    if (!entry) return;
+    gncEntryBeginEdit (entry);
+    gncEntryDiscountStringToHow(type, &how);
+    if (entry->i_disc_how == how) return;
+    entry->i_disc_how = how;
+    entry->values_dirty = TRUE;
+    mark_entry (entry);
+    gncEntryCommitEdit (entry);
 }
 
 /* Vendor Bills */
 
 void gncEntrySetBillAccount (GncEntry *entry, Account *acc)
 {
-  if (!entry) return;
-  if (entry->b_account == acc) return;
-  gncEntryBeginEdit (entry);
-  entry->b_account = acc;
-  mark_entry (entry);
-  gncEntryCommitEdit (entry);
+    if (!entry) return;
+    if (entry->b_account == acc) return;
+    gncEntryBeginEdit (entry);
+    entry->b_account = acc;
+    mark_entry (entry);
+    gncEntryCommitEdit (entry);
 }
 
 void gncEntrySetBillPrice (GncEntry *entry, gnc_numeric price)
 {
-  if (!entry) return;
-  if (gnc_numeric_eq (entry->b_price, price)) return;
-  gncEntryBeginEdit (entry);
-  entry->b_price = price;
-  entry->values_dirty = TRUE;
-  mark_entry (entry);
-  gncEntryCommitEdit (entry);
+    if (!entry) return;
+    if (gnc_numeric_eq (entry->b_price, price)) return;
+    gncEntryBeginEdit (entry);
+    entry->b_price = price;
+    entry->values_dirty = TRUE;
+    mark_entry (entry);
+    gncEntryCommitEdit (entry);
 }
 
 void gncEntrySetBillTaxable (GncEntry *entry, gboolean taxable)
 {
-  if (!entry) return;
-  if (entry->b_taxable == taxable) return;
-  gncEntryBeginEdit (entry);
-  entry->b_taxable = taxable;
-  entry->values_dirty = TRUE;
-  mark_entry (entry);
-  gncEntryCommitEdit (entry);
+    if (!entry) return;
+    if (entry->b_taxable == taxable) return;
+    gncEntryBeginEdit (entry);
+    entry->b_taxable = taxable;
+    entry->values_dirty = TRUE;
+    mark_entry (entry);
+    gncEntryCommitEdit (entry);
 }
 
 void gncEntrySetBillTaxIncluded (GncEntry *entry, gboolean taxincluded)
 {
-  if (!entry) return;
-  if (entry->b_taxincluded == taxincluded) return;
-  gncEntryBeginEdit (entry);
-  entry->b_taxincluded = taxincluded;
-  entry->values_dirty = TRUE;
-  mark_entry (entry);
-  gncEntryCommitEdit (entry);
+    if (!entry) return;
+    if (entry->b_taxincluded == taxincluded) return;
+    gncEntryBeginEdit (entry);
+    entry->b_taxincluded = taxincluded;
+    entry->values_dirty = TRUE;
+    mark_entry (entry);
+    gncEntryCommitEdit (entry);
 }
 
 void gncEntrySetBillTaxTable (GncEntry *entry, GncTaxTable *table)
 {
-  if (!entry) return;
-  if (entry->b_tax_table == table) return;
-  gncEntryBeginEdit (entry);
-  if (entry->b_tax_table)
-    gncTaxTableDecRef (entry->b_tax_table);
-  if (table)
-    gncTaxTableIncRef (table);
-  entry->b_tax_table = table;
-  entry->values_dirty = TRUE;
-  mark_entry (entry);
-  gncEntryCommitEdit (entry);
+    if (!entry) return;
+    if (entry->b_tax_table == table) return;
+    gncEntryBeginEdit (entry);
+    if (entry->b_tax_table)
+        gncTaxTableDecRef (entry->b_tax_table);
+    if (table)
+        gncTaxTableIncRef (table);
+    entry->b_tax_table = table;
+    entry->values_dirty = TRUE;
+    mark_entry (entry);
+    gncEntryCommitEdit (entry);
 }
 
 void gncEntrySetBillable (GncEntry *entry, gboolean billable)
 {
-  if (!entry) return;
-  if (entry->billable == billable) return;
+    if (!entry) return;
+    if (entry->billable == billable) return;
 
-  gncEntryBeginEdit (entry);
-  entry->billable = billable;
-  mark_entry (entry);
-  gncEntryCommitEdit (entry);
+    gncEntryBeginEdit (entry);
+    entry->billable = billable;
+    mark_entry (entry);
+    gncEntryCommitEdit (entry);
 }
 
 void gncEntrySetBillTo (GncEntry *entry, GncOwner *billto)
 {
-  if (!entry || !billto) return;
-  if (gncOwnerEqual (&entry->billto, billto)) return;
+    if (!entry || !billto) return;
+    if (gncOwnerEqual (&entry->billto, billto)) return;
 
-  gncEntryBeginEdit (entry);
-  gncOwnerCopy (billto, &entry->billto);
-  mark_entry (entry);
-  gncEntryCommitEdit (entry);
+    gncEntryBeginEdit (entry);
+    gncOwnerCopy (billto, &entry->billto);
+    mark_entry (entry);
+    gncEntryCommitEdit (entry);
 }
 
 void gncEntrySetBillPayment (GncEntry *entry, GncEntryPaymentType type)
 {
-  if (!entry) return;
-  if (entry->b_payment == type) return;
-  gncEntryBeginEdit (entry);
-  entry->b_payment = type;
-  mark_entry (entry);
-  gncEntryCommitEdit (entry);
+    if (!entry) return;
+    if (entry->b_payment == type) return;
+    gncEntryBeginEdit (entry);
+    entry->b_payment = type;
+    mark_entry (entry);
+    gncEntryCommitEdit (entry);
 }
 
 /* Called from gncOrder when we're added to the Order */
 void gncEntrySetOrder (GncEntry *entry, GncOrder *order)
 {
-  if (!entry) return;
-  if (entry->order == order) return;
-  gncEntryBeginEdit (entry);
-  entry->order = order;
-  mark_entry (entry);
-  gncEntryCommitEdit (entry);
+    if (!entry) return;
+    if (entry->order == order) return;
+    gncEntryBeginEdit (entry);
+    entry->order = order;
+    mark_entry (entry);
+    gncEntryCommitEdit (entry);
 
-  /* Generate an event modifying the Order's end-owner */
-#if 0  
-  qof_event_gen (gncOwnerGetEndGUID (gncOrderGetOwner (order)),
-		 QOF_EVENT_MODIFY, NULL);
+    /* Generate an event modifying the Order's end-owner */
+#if 0
+    qof_event_gen (gncOwnerGetEndGUID (gncOrderGetOwner (order)),
+                   QOF_EVENT_MODIFY, NULL);
 #endif
 }
 
 /* called from gncInvoice when we're added to the Invoice */
 void gncEntrySetInvoice (GncEntry *entry, GncInvoice *invoice)
 {
-  if (!entry) return;
-  if (entry->invoice == invoice) return;
-  gncEntryBeginEdit (entry);
-  entry->invoice = invoice;
-  mark_entry (entry);
-  gncEntryCommitEdit (entry);
+    if (!entry) return;
+    if (entry->invoice == invoice) return;
+    gncEntryBeginEdit (entry);
+    entry->invoice = invoice;
+    mark_entry (entry);
+    gncEntryCommitEdit (entry);
 }
 
 /* called from gncInvoice when we're added to the Invoice/Bill */
 void gncEntrySetBill (GncEntry *entry, GncInvoice *bill)
 {
-  if (!entry) return;
-  if (entry->bill == bill) return;
-  gncEntryBeginEdit (entry);
-  entry->bill = bill;
-  mark_entry (entry);
-  gncEntryCommitEdit (entry);
+    if (!entry) return;
+    if (entry->bill == bill) return;
+    gncEntryBeginEdit (entry);
+    entry->bill = bill;
+    mark_entry (entry);
+    gncEntryCommitEdit (entry);
 }
 
 void gncEntryCopy (const GncEntry *src, GncEntry *dest)
 {
-  if (!src || !dest) return;
+    if (!src || !dest) return;
 
-  gncEntryBeginEdit (dest);
-  dest->date 			= src->date;
-  dest->date_entered		= src->date_entered; /* ??? */
-  gncEntrySetDescription (dest, src->desc);
-  gncEntrySetAction (dest, src->action);
-  gncEntrySetNotes (dest, src->notes);
-  dest->quantity		= src->quantity;
+    gncEntryBeginEdit (dest);
+    dest->date 			= src->date;
+    dest->date_entered		= src->date_entered; /* ??? */
+    gncEntrySetDescription (dest, src->desc);
+    gncEntrySetAction (dest, src->action);
+    gncEntrySetNotes (dest, src->notes);
+    dest->quantity		= src->quantity;
 
-  dest->i_account		= src->i_account;
-  dest->i_price			= src->i_price;
-  dest->i_taxable		= src->i_taxable;
-  dest->i_taxincluded		= src->i_taxincluded;
-  dest->i_discount		= src->i_discount;
-  dest->i_disc_type		= src->i_disc_type;
-  dest->i_disc_how		= src->i_disc_how;
+    dest->i_account		= src->i_account;
+    dest->i_price			= src->i_price;
+    dest->i_taxable		= src->i_taxable;
+    dest->i_taxincluded		= src->i_taxincluded;
+    dest->i_discount		= src->i_discount;
+    dest->i_disc_type		= src->i_disc_type;
+    dest->i_disc_how		= src->i_disc_how;
 
-  /* vendor bill data */
-  dest->b_account		= src->b_account;
-  dest->b_price			= src->b_price;
-  dest->b_taxable		= src->b_taxable;
-  dest->b_taxincluded		= src->b_taxincluded;
-  dest->billable		= src->billable;
-  dest->billto			= src->billto;
+    /* vendor bill data */
+    dest->b_account		= src->b_account;
+    dest->b_price			= src->b_price;
+    dest->b_taxable		= src->b_taxable;
+    dest->b_taxincluded		= src->b_taxincluded;
+    dest->billable		= src->billable;
+    dest->billto			= src->billto;
 
-  if (src->i_tax_table)
-    gncEntrySetInvTaxTable (dest, src->i_tax_table);
+    if (src->i_tax_table)
+        gncEntrySetInvTaxTable (dest, src->i_tax_table);
 
-  if (src->b_tax_table)
-    gncEntrySetBillTaxTable (dest, src->b_tax_table);
+    if (src->b_tax_table)
+        gncEntrySetBillTaxTable (dest, src->b_tax_table);
 
-  if (src->order)
-    gncOrderAddEntry (src->order, dest);
+    if (src->order)
+        gncOrderAddEntry (src->order, dest);
 
-  if (src->invoice)
-    gncInvoiceAddEntry (src->invoice, dest);
+    if (src->invoice)
+        gncInvoiceAddEntry (src->invoice, dest);
 
-  if (src->bill)
-    gncBillAddEntry (src->bill, dest);
+    if (src->bill)
+        gncBillAddEntry (src->bill, dest);
 
-  dest->values_dirty = TRUE;
-  gncEntryCommitEdit (dest);
+    dest->values_dirty = TRUE;
+    gncEntryCommitEdit (dest);
 }
 
 /* ================================================================ */
@@ -732,176 +736,180 @@
 
 Timespec gncEntryGetDate (const GncEntry *entry)
 {
-  Timespec ts; ts.tv_sec = 0; ts.tv_nsec = 0;
-  if (!entry) return ts;
-  return entry->date;
+    Timespec ts;
+    ts.tv_sec = 0;
+    ts.tv_nsec = 0;
+    if (!entry) return ts;
+    return entry->date;
 }
 
 Timespec gncEntryGetDateEntered (const GncEntry *entry)
 {
-  Timespec ts; ts.tv_sec = 0; ts.tv_nsec = 0;
-  if (!entry) return ts;
-  return entry->date_entered;
+    Timespec ts;
+    ts.tv_sec = 0;
+    ts.tv_nsec = 0;
+    if (!entry) return ts;
+    return entry->date_entered;
 }
 
 const char * gncEntryGetDescription (const GncEntry *entry)
 {
-  if (!entry) return NULL;
-  return entry->desc;
+    if (!entry) return NULL;
+    return entry->desc;
 }
 
 const char * gncEntryGetAction (const GncEntry *entry)
 {
-  if (!entry) return NULL;
-  return entry->action;
+    if (!entry) return NULL;
+    return entry->action;
 }
 
 const char * gncEntryGetNotes (const GncEntry *entry)
 {
-  if (!entry) return NULL;
-  return entry->notes;
+    if (!entry) return NULL;
+    return entry->notes;
 }
 
 gnc_numeric gncEntryGetQuantity (const GncEntry *entry)
 {
-  if (!entry) return gnc_numeric_zero();
-  return entry->quantity;
+    if (!entry) return gnc_numeric_zero();
+    return entry->quantity;
 }
 
 /* Customer Invoice */
 
 Account * gncEntryGetInvAccount (const GncEntry *entry)
 {
-  if (!entry) return NULL;
-  return entry->i_account;
+    if (!entry) return NULL;
+    return entry->i_account;
 }
 
 gnc_numeric gncEntryGetInvPrice (const GncEntry *entry)
 {
-  if (!entry) return gnc_numeric_zero();
-  return entry->i_price;
+    if (!entry) return gnc_numeric_zero();
+    return entry->i_price;
 }
 
 gnc_numeric gncEntryGetInvDiscount (const GncEntry *entry)
 {
-  if (!entry) return gnc_numeric_zero();
-  return entry->i_discount;
+    if (!entry) return gnc_numeric_zero();
+    return entry->i_discount;
 }
 
 GncAmountType gncEntryGetInvDiscountType (const GncEntry *entry)
 {
-  if (!entry) return 0;
-  return entry->i_disc_type;
+    if (!entry) return 0;
+    return entry->i_disc_type;
 }
 
 GncDiscountHow gncEntryGetInvDiscountHow (const GncEntry *entry)
 {
-  if (!entry) return 0;
-  return entry->i_disc_how;
+    if (!entry) return 0;
+    return entry->i_disc_how;
 }
 
 char* qofEntryGetInvDiscType (const GncEntry *entry)
 {
-	char *type_string;
+    char *type_string;
 
-	if (!entry) return 0;
-	type_string = g_strdup(gncAmountTypeToString(entry->i_disc_type));
-	return type_string;
+    if (!entry) return 0;
+    type_string = g_strdup(gncAmountTypeToString(entry->i_disc_type));
+    return type_string;
 }
 
 char* qofEntryGetInvDiscHow (const GncEntry *entry)
 {
-	char *type_string;
+    char *type_string;
 
-	if (!entry) return 0;
-	type_string = g_strdup(gncEntryDiscountHowToString(entry->i_disc_how));
-	return type_string;
+    if (!entry) return 0;
+    type_string = g_strdup(gncEntryDiscountHowToString(entry->i_disc_how));
+    return type_string;
 }
 
 gboolean gncEntryGetInvTaxable (const GncEntry *entry)
 {
-  if (!entry) return FALSE;
-  return entry->i_taxable;
+    if (!entry) return FALSE;
+    return entry->i_taxable;
 }
 
 gboolean gncEntryGetInvTaxIncluded (const GncEntry *entry)
 {
-  if (!entry) return FALSE;
-  return entry->i_taxincluded;
+    if (!entry) return FALSE;
+    return entry->i_taxincluded;
 }
 
 GncTaxTable * gncEntryGetInvTaxTable (const GncEntry *entry)
 {
-  if (!entry) return NULL;
-  return entry->i_tax_table;
+    if (!entry) return NULL;
+    return entry->i_tax_table;
 }
 
 /* vendor bills */
 
 Account * gncEntryGetBillAccount (const GncEntry *entry)
 {
-  if (!entry) return NULL;
-  return entry->b_account;
+    if (!entry) return NULL;
+    return entry->b_account;
 }
 
 gnc_numeric gncEntryGetBillPrice (const GncEntry *entry)
 {
-  if (!entry) return gnc_numeric_zero();
-  return entry->b_price;
+    if (!entry) return gnc_numeric_zero();
+    return entry->b_price;
 }
 
 gboolean gncEntryGetBillTaxable (const GncEntry *entry)
 {
-  if (!entry) return FALSE;
-  return entry->b_taxable;
+    if (!entry) return FALSE;
+    return entry->b_taxable;
 }
 
 gboolean gncEntryGetBillTaxIncluded (const GncEntry *entry)
 {
-  if (!entry) return FALSE;
-  return entry->b_taxincluded;
+    if (!entry) return FALSE;
+    return entry->b_taxincluded;
 }
 
 GncTaxTable * gncEntryGetBillTaxTable (const GncEntry *entry)
 {
-  if (!entry) return NULL;
-  return entry->b_tax_table;
+    if (!entry) return NULL;
+    return entry->b_tax_table;
 }
 
 gboolean gncEntryGetBillable (const GncEntry *entry)
 {
-  if (!entry) return FALSE;
-  return entry->billable;
+    if (!entry) return FALSE;
+    return entry->billable;
 }
 
 GncOwner * gncEntryGetBillTo (GncEntry *entry)
 {
-  if (!entry) return NULL;
-  return &entry->billto;
+    if (!entry) return NULL;
+    return &entry->billto;
 }
 
 GncEntryPaymentType gncEntryGetBillPayment (const GncEntry* entry)
 {
-  if (!entry) return 0;
-  return entry->b_payment;
+    if (!entry) return 0;
+    return entry->b_payment;
 }
 
 GncInvoice * gncEntryGetInvoice (const GncEntry *entry)
 {
-  if (!entry) return NULL;
-  return entry->invoice;
+    if (!entry) return NULL;
+    return entry->invoice;
 }
 
 GncInvoice * gncEntryGetBill (const GncEntry *entry)
 {
-  if (!entry) return NULL;
-  return entry->bill;
+    if (!entry) return NULL;
+    return entry->bill;
 }
 
 GncOrder * gncEntryGetOrder (const GncEntry *entry)
 {
-  if (!entry) return NULL;
-  return entry->order;
+    if (!entry) return NULL;
+    return entry->order;
 }
 
 /* ================================================================ */
@@ -939,428 +947,462 @@
  * to let a consumer know how much they saved.
  */
 void gncEntryComputeValue (gnc_numeric qty, gnc_numeric price,
-			   const GncTaxTable *tax_table, gboolean tax_included,
-			   gnc_numeric discount, GncAmountType discount_type,
-			   GncDiscountHow discount_how, int SCU,
-			   gnc_numeric *value, gnc_numeric *discount_value,
-			   GList **tax_value)
+                           const GncTaxTable *tax_table, gboolean tax_included,
+                           gnc_numeric discount, GncAmountType discount_type,
+                           GncDiscountHow discount_how, int SCU,
+                           gnc_numeric *value, gnc_numeric *discount_value,
+                           GList **tax_value)
 {
-  gnc_numeric	aggregate;
-  gnc_numeric	pretax;
-  gnc_numeric	result;
-  gnc_numeric	tax;
-  gnc_numeric	percent = gnc_numeric_create (100, 1);
-  gnc_numeric	tpercent = gnc_numeric_zero ();
-  gnc_numeric	tvalue = gnc_numeric_zero ();
+    gnc_numeric	aggregate;
+    gnc_numeric	pretax;
+    gnc_numeric	result;
+    gnc_numeric	tax;
+    gnc_numeric	percent = gnc_numeric_create (100, 1);
+    gnc_numeric	tpercent = gnc_numeric_zero ();
+    gnc_numeric	tvalue = gnc_numeric_zero ();
 
-  GList * 	entries = gncTaxTableGetEntries (tax_table);
-  GList * 	node;
+    GList * 	entries = gncTaxTableGetEntries (tax_table);
+    GList * 	node;
 
-  /* Step 1: compute the aggregate price */
+    /* Step 1: compute the aggregate price */
 
-  aggregate = gnc_numeric_mul (qty, price, GNC_DENOM_AUTO, GNC_DENOM_LCD);
+    aggregate = gnc_numeric_mul (qty, price, GNC_DENOM_AUTO, GNC_DENOM_LCD);
 
-  /* Step 2: compute the pre-tax aggregate */
+    /* Step 2: compute the pre-tax aggregate */
 
-  /* First, compute the aggregate tpercent and tvalue numbers */
-  for (node = entries; node; node = node->next) {
-    GncTaxTableEntry *entry = node->data;
-    gnc_numeric amount = gncTaxTableEntryGetAmount (entry);
+    /* First, compute the aggregate tpercent and tvalue numbers */
+    for (node = entries; node; node = node->next)
+    {
+        GncTaxTableEntry *entry = node->data;
+        gnc_numeric amount = gncTaxTableEntryGetAmount (entry);
 
-    switch (gncTaxTableEntryGetType (entry)) {
-    case GNC_AMT_TYPE_VALUE:
-      tvalue = gnc_numeric_add (tvalue, amount, GNC_DENOM_AUTO,
-				GNC_DENOM_LCD);
-      break;
-    case GNC_AMT_TYPE_PERCENT:
-      tpercent = gnc_numeric_add (tpercent, amount, GNC_DENOM_AUTO,
-				  GNC_DENOM_LCD);
-      break;
-    default:
-      g_warning ("Unknown tax type: %d", gncTaxTableEntryGetType (entry));
+        switch (gncTaxTableEntryGetType (entry))
+        {
+        case GNC_AMT_TYPE_VALUE:
+            tvalue = gnc_numeric_add (tvalue, amount, GNC_DENOM_AUTO,
+                                      GNC_DENOM_LCD);
+            break;
+        case GNC_AMT_TYPE_PERCENT:
+            tpercent = gnc_numeric_add (tpercent, amount, GNC_DENOM_AUTO,
+                                        GNC_DENOM_LCD);
+            break;
+        default:
+            g_warning ("Unknown tax type: %d", gncTaxTableEntryGetType (entry));
+        }
     }
-  }
-  /* now we need to convert from 5% -> .05 */
-  tpercent = gnc_numeric_div (tpercent, percent, GNC_DENOM_AUTO,
-			      GNC_DENOM_LCD);
+    /* now we need to convert from 5% -> .05 */
+    tpercent = gnc_numeric_div (tpercent, percent, GNC_DENOM_AUTO,
+                                GNC_DENOM_LCD);
 
-  /* Next, actually compute the pre-tax aggregate value based on the
-   * taxincluded flag.
-   */
-  if (tax_table && tax_included) {
-    /* Back-compute the pre-tax aggregate value.
-     * We know that aggregate = pretax + pretax*tpercent + tvalue, so
-     * pretax = (aggregate-tvalue)/(1+tpercent)
+    /* Next, actually compute the pre-tax aggregate value based on the
+     * taxincluded flag.
      */
-    pretax = gnc_numeric_sub (aggregate, tvalue, GNC_DENOM_AUTO,
-			      GNC_DENOM_LCD);
-    pretax = gnc_numeric_div (pretax,
-			      gnc_numeric_add (tpercent,
-					       gnc_numeric_create (1, 1),
-					       GNC_DENOM_AUTO, GNC_DENOM_LCD),
-			      GNC_DENOM_AUTO, GNC_DENOM_LCD);
-  } else {
-    pretax = aggregate;
-  }
+    if (tax_table && tax_included)
+    {
+        /* Back-compute the pre-tax aggregate value.
+         * We know that aggregate = pretax + pretax*tpercent + tvalue, so
+         * pretax = (aggregate-tvalue)/(1+tpercent)
+         */
+        pretax = gnc_numeric_sub (aggregate, tvalue, GNC_DENOM_AUTO,
+                                  GNC_DENOM_LCD);
+        pretax = gnc_numeric_div (pretax,
+                                  gnc_numeric_add (tpercent,
+                                          gnc_numeric_create (1, 1),
+                                          GNC_DENOM_AUTO, GNC_DENOM_LCD),
+                                  GNC_DENOM_AUTO, GNC_DENOM_LCD);
+    }
+    else
+    {
+        pretax = aggregate;
+    }
 
-  /* Step 3:  apply discount and taxes in the appropriate order */
+    /* Step 3:  apply discount and taxes in the appropriate order */
 
-  /*
-   * There are two ways to apply discounts and taxes.  In one way, you
-   * always compute the discount off the pretax number, and compute
-   * the taxes off of either the pretax value or "pretax-discount"
-   * value.  In the other way, you always compute the tax on "pretax",
-   * and compute the discount on either "pretax" or "pretax+taxes".
-   *
-   * I don't know which is the "correct" way.
-   */
+    /*
+     * There are two ways to apply discounts and taxes.  In one way, you
+     * always compute the discount off the pretax number, and compute
+     * the taxes off of either the pretax value or "pretax-discount"
+     * value.  In the other way, you always compute the tax on "pretax",
+     * and compute the discount on either "pretax" or "pretax+taxes".
+     *
+     * I don't know which is the "correct" way.
+     */
 
-  /*
-   * Type:	discount	tax
-   * PRETAX	pretax		pretax-discount
-   * SAMETIME	pretax		pretax
-   * POSTTAX	pretax+tax	pretax
-   */
+    /*
+     * Type:	discount	tax
+     * PRETAX	pretax		pretax-discount
+     * SAMETIME	pretax		pretax
+     * POSTTAX	pretax+tax	pretax
+     */
 
-  switch (discount_how) {
-  case GNC_DISC_PRETAX:
-  case GNC_DISC_SAMETIME:
-    /* compute the discount from pretax */
+    switch (discount_how)
+    {
+    case GNC_DISC_PRETAX:
+    case GNC_DISC_SAMETIME:
+        /* compute the discount from pretax */
 
-    if (discount_type == GNC_AMT_TYPE_PERCENT) {
-      discount = gnc_numeric_div (discount, percent, GNC_DENOM_AUTO, 
-				  GNC_DENOM_LCD);
-      discount = gnc_numeric_mul (pretax, discount, GNC_DENOM_AUTO,
-				  GNC_DENOM_LCD);
-    }
+        if (discount_type == GNC_AMT_TYPE_PERCENT)
+        {
+            discount = gnc_numeric_div (discount, percent, GNC_DENOM_AUTO,
+                                        GNC_DENOM_LCD);
+            discount = gnc_numeric_mul (pretax, discount, GNC_DENOM_AUTO,
+                                        GNC_DENOM_LCD);
+        }
 
-    result = gnc_numeric_sub (pretax, discount, GNC_DENOM_AUTO, GNC_DENOM_LCD);
+        result = gnc_numeric_sub (pretax, discount, GNC_DENOM_AUTO, GNC_DENOM_LCD);
 
-    /* Figure out when to apply the tax, pretax or pretax-discount */
-    if (discount_how == GNC_DISC_PRETAX)
-      pretax = result;
-    break;
+        /* Figure out when to apply the tax, pretax or pretax-discount */
+        if (discount_how == GNC_DISC_PRETAX)
+            pretax = result;
+        break;
 
-  case GNC_DISC_POSTTAX:
-    /* compute discount on pretax+taxes */
+    case GNC_DISC_POSTTAX:
+        /* compute discount on pretax+taxes */
 
-    if (discount_type == GNC_AMT_TYPE_PERCENT) {
-      gnc_numeric after_tax;
+        if (discount_type == GNC_AMT_TYPE_PERCENT)
+        {
+            gnc_numeric after_tax;
 
-      tax = gnc_numeric_mul (pretax, tpercent, GNC_DENOM_AUTO, GNC_DENOM_LCD);
-      after_tax = gnc_numeric_add (pretax, tax, GNC_DENOM_AUTO, GNC_DENOM_LCD);
-      after_tax = gnc_numeric_add (after_tax, tvalue, GNC_DENOM_AUTO,
-				   GNC_DENOM_LCD);
-      discount = gnc_numeric_div (discount, percent, GNC_DENOM_AUTO,
-				  GNC_DENOM_LCD);
-      discount = gnc_numeric_mul (after_tax, discount, GNC_DENOM_AUTO,
-				  GNC_DENOM_LCD);
-    }
+            tax = gnc_numeric_mul (pretax, tpercent, GNC_DENOM_AUTO, GNC_DENOM_LCD);
+            after_tax = gnc_numeric_add (pretax, tax, GNC_DENOM_AUTO, GNC_DENOM_LCD);
+            after_tax = gnc_numeric_add (after_tax, tvalue, GNC_DENOM_AUTO,
+                                         GNC_DENOM_LCD);
+            discount = gnc_numeric_div (discount, percent, GNC_DENOM_AUTO,
+                                        GNC_DENOM_LCD);
+            discount = gnc_numeric_mul (after_tax, discount, GNC_DENOM_AUTO,
+                                        GNC_DENOM_LCD);
+        }
 
-    result = gnc_numeric_sub (pretax, discount, GNC_DENOM_AUTO, GNC_DENOM_LCD);
-    break;
+        result = gnc_numeric_sub (pretax, discount, GNC_DENOM_AUTO, GNC_DENOM_LCD);
+        break;
 
-  default:
-    g_warning ("unknown DiscountHow value: %d", discount_how);
-  }
+    default:
+        g_warning ("unknown DiscountHow value: %d", discount_how);
+    }
 
-  /* Step 4:  return the requested results. */
+    /* Step 4:  return the requested results. */
 
-  /* result == amount merchant gets
-   * discount == amount of discount
-   * need to compute taxes (based on 'pretax') if the caller wants it.
-   */
+    /* result == amount merchant gets
+     * discount == amount of discount
+     * need to compute taxes (based on 'pretax') if the caller wants it.
+     */
 
-  if (discount_value != NULL) {
-    if (SCU) discount = gnc_numeric_convert(discount, SCU, GNC_RND_ROUND);
-    *discount_value = discount;
-  }
+    if (discount_value != NULL)
+    {
+        if (SCU) discount = gnc_numeric_convert(discount, SCU, GNC_RND_ROUND);
+        *discount_value = discount;
+    }
 
-  if (value != NULL) {
-    if (SCU) result = gnc_numeric_convert(result, SCU, GNC_RND_ROUND);
-    *value = result;
-  }
+    if (value != NULL)
+    {
+        if (SCU) result = gnc_numeric_convert(result, SCU, GNC_RND_ROUND);
+        *value = result;
+    }
 
-  /* Now... Compute the list of tax values (if the caller wants it) */
+    /* Now... Compute the list of tax values (if the caller wants it) */
 
-  if (tax_value != NULL) {
-    GList *	taxes = NULL;
+    if (tax_value != NULL)
+    {
+        GList *	taxes = NULL;
 
-    for (node = entries; node; node = node->next) {
-      GncTaxTableEntry *entry = node->data;
-      Account *acc = gncTaxTableEntryGetAccount (entry);
-      gnc_numeric amount = gncTaxTableEntryGetAmount (entry);
+        for (node = entries; node; node = node->next)
+        {
+            GncTaxTableEntry *entry = node->data;
+            Account *acc = gncTaxTableEntryGetAccount (entry);
+            gnc_numeric amount = gncTaxTableEntryGetAmount (entry);
 
-      g_return_if_fail (acc);
+            g_return_if_fail (acc);
 
-      switch (gncTaxTableEntryGetType (entry)) {
-      case GNC_AMT_TYPE_VALUE:
-	if (SCU) amount = gnc_numeric_convert(amount, SCU, GNC_RND_ROUND);
-	taxes = gncAccountValueAdd (taxes, acc, amount);
-	break;
-      case GNC_AMT_TYPE_PERCENT:
-	amount = gnc_numeric_div (amount, percent, GNC_DENOM_AUTO,
-				  GNC_DENOM_LCD);
-	tax = gnc_numeric_mul (pretax, amount, GNC_DENOM_AUTO, GNC_DENOM_LCD);
-	if (SCU) tax = gnc_numeric_convert(tax, SCU, GNC_RND_ROUND);
-	taxes = gncAccountValueAdd (taxes, acc, tax);
-	break;
-      default:
-       break;
-      }
+            switch (gncTaxTableEntryGetType (entry))
+            {
+            case GNC_AMT_TYPE_VALUE:
+                if (SCU) amount = gnc_numeric_convert(amount, SCU, GNC_RND_ROUND);
+                taxes = gncAccountValueAdd (taxes, acc, amount);
+                break;
+            case GNC_AMT_TYPE_PERCENT:
+                amount = gnc_numeric_div (amount, percent, GNC_DENOM_AUTO,
+                                          GNC_DENOM_LCD);
+                tax = gnc_numeric_mul (pretax, amount, GNC_DENOM_AUTO, GNC_DENOM_LCD);
+                if (SCU) tax = gnc_numeric_convert(tax, SCU, GNC_RND_ROUND);
+                taxes = gncAccountValueAdd (taxes, acc, tax);
+                break;
+            default:
+                break;
+            }
+        }
+        *tax_value = taxes;
     }
-    *tax_value = taxes;
-  }
 
-  return;
+    return;
 }
 
 static int
 get_entry_commodity_denom (const GncEntry *entry)
 {
-  gnc_commodity *c;
-  if (!entry)
-    return 0;
-  if (entry->invoice) {
-    c = gncInvoiceGetCurrency (entry->invoice);
-    if (c)
-      return (gnc_commodity_get_fraction (c));
-  }
-  if (entry->bill) {
-    c = gncInvoiceGetCurrency (entry->bill);
-    if (c)
-      return (gnc_commodity_get_fraction (c));
-  }
-  return 100000;
+    gnc_commodity *c;
+    if (!entry)
+        return 0;
+    if (entry->invoice)
+    {
+        c = gncInvoiceGetCurrency (entry->invoice);
+        if (c)
+            return (gnc_commodity_get_fraction (c));
+    }
+    if (entry->bill)
+    {
+        c = gncInvoiceGetCurrency (entry->bill);
+        if (c)
+            return (gnc_commodity_get_fraction (c));
+    }
+    return 100000;
 }
 
 static void
 gncEntryRecomputeValues (GncEntry *entry)
 {
-  int denom;
+    int denom;
 
-  /* See if either tax table changed since we last computed values */
-  if (entry->i_tax_table) {
-    Timespec modtime = gncTaxTableLastModified (entry->i_tax_table);
-    if (timespec_cmp (&entry->i_taxtable_modtime, &modtime)) {
-      entry->values_dirty = TRUE;
-      entry->i_taxtable_modtime = modtime;
+    /* See if either tax table changed since we last computed values */
+    if (entry->i_tax_table)
+    {
+        Timespec modtime = gncTaxTableLastModified (entry->i_tax_table);
+        if (timespec_cmp (&entry->i_taxtable_modtime, &modtime))
+        {
+            entry->values_dirty = TRUE;
+            entry->i_taxtable_modtime = modtime;
+        }
     }
-  }
-  if (entry->b_tax_table) {
-    Timespec modtime = gncTaxTableLastModified (entry->b_tax_table);
-    if (timespec_cmp (&entry->b_taxtable_modtime, &modtime)) {
-      entry->values_dirty = TRUE;
-      entry->b_taxtable_modtime = modtime;
+    if (entry->b_tax_table)
+    {
+        Timespec modtime = gncTaxTableLastModified (entry->b_tax_table);
+        if (timespec_cmp (&entry->b_taxtable_modtime, &modtime))
+        {
+            entry->values_dirty = TRUE;
+            entry->b_taxtable_modtime = modtime;
+        }
     }
-  }
 
-  if (!entry->values_dirty)
-    return;
+    if (!entry->values_dirty)
+        return;
 
-  /* Clear the last-computed tax values */
-  if (entry->i_tax_values) {
-    gncAccountValueDestroy (entry->i_tax_values);
-    entry->i_tax_values = NULL;
-  }
-  if (entry->b_tax_values) {
-    gncAccountValueDestroy (entry->b_tax_values);
-    entry->b_tax_values = NULL;
-  }
+    /* Clear the last-computed tax values */
+    if (entry->i_tax_values)
+    {
+        gncAccountValueDestroy (entry->i_tax_values);
+        entry->i_tax_values = NULL;
+    }
+    if (entry->b_tax_values)
+    {
+        gncAccountValueDestroy (entry->b_tax_values);
+        entry->b_tax_values = NULL;
+    }
 
-  /* Determine the commodity denominator */
-  denom = get_entry_commodity_denom (entry);
+    /* Determine the commodity denominator */
+    denom = get_entry_commodity_denom (entry);
 
-  /* Compute the invoice values */
-  gncEntryComputeValue (entry->quantity, entry->i_price,
-			(entry->i_taxable ? entry->i_tax_table : NULL),
-			entry->i_taxincluded,
-			entry->i_discount, entry->i_disc_type,
-			entry->i_disc_how,
-			denom,
-			&(entry->i_value), &(entry->i_disc_value),
-			&(entry->i_tax_values));
+    /* Compute the invoice values */
+    gncEntryComputeValue (entry->quantity, entry->i_price,
+                          (entry->i_taxable ? entry->i_tax_table : NULL),
+                          entry->i_taxincluded,
+                          entry->i_discount, entry->i_disc_type,
+                          entry->i_disc_how,
+                          denom,
+                          &(entry->i_value), &(entry->i_disc_value),
+                          &(entry->i_tax_values));
 
-  /* Compute the bill values */
-  gncEntryComputeValue (entry->quantity, entry->b_price,
-			(entry->b_taxable ? entry->b_tax_table : NULL),
-			entry->b_taxincluded,
-			gnc_numeric_zero(), GNC_AMT_TYPE_VALUE, GNC_DISC_PRETAX,
-			denom,
-			&(entry->b_value), NULL, &(entry->b_tax_values));
+    /* Compute the bill values */
+    gncEntryComputeValue (entry->quantity, entry->b_price,
+                          (entry->b_taxable ? entry->b_tax_table : NULL),
+                          entry->b_taxincluded,
+                          gnc_numeric_zero(), GNC_AMT_TYPE_VALUE, GNC_DISC_PRETAX,
+                          denom,
+                          &(entry->b_value), NULL, &(entry->b_tax_values));
 
-  entry->i_value_rounded = gnc_numeric_convert (entry->i_value, denom,
-						GNC_RND_ROUND);
-  entry->i_disc_value_rounded = gnc_numeric_convert (entry->i_disc_value, denom,
-						     GNC_RND_ROUND);
-  entry->i_tax_value = gncAccountValueTotal (entry->i_tax_values);
-  entry->i_tax_value_rounded = gnc_numeric_convert (entry->i_tax_value, denom,
-						    GNC_RND_ROUND);
+    entry->i_value_rounded = gnc_numeric_convert (entry->i_value, denom,
+                             GNC_RND_ROUND);
+    entry->i_disc_value_rounded = gnc_numeric_convert (entry->i_disc_value, denom,
+                                  GNC_RND_ROUND);
+    entry->i_tax_value = gncAccountValueTotal (entry->i_tax_values);
+    entry->i_tax_value_rounded = gnc_numeric_convert (entry->i_tax_value, denom,
+                                 GNC_RND_ROUND);
 
-  entry->b_value_rounded = gnc_numeric_convert (entry->b_value, denom,
-						GNC_RND_ROUND);
-  entry->b_tax_value = gncAccountValueTotal (entry->b_tax_values);
-  entry->b_tax_value_rounded = gnc_numeric_convert (entry->b_tax_value, denom,
-						    GNC_RND_ROUND);
-  entry->values_dirty = FALSE;
+    entry->b_value_rounded = gnc_numeric_convert (entry->b_value, denom,
+                             GNC_RND_ROUND);
+    entry->b_tax_value = gncAccountValueTotal (entry->b_tax_values);
+    entry->b_tax_value_rounded = gnc_numeric_convert (entry->b_tax_value, denom,
+                                 GNC_RND_ROUND);
+    entry->values_dirty = FALSE;
 }
 
 void gncEntryGetValue (GncEntry *entry, gboolean is_inv, gnc_numeric *value,
-		       gnc_numeric *discount_value, gnc_numeric *tax_value,
-		       GList **tax_values)
+                       gnc_numeric *discount_value, gnc_numeric *tax_value,
+                       GList **tax_values)
 {
-  if (!entry) return;
-  gncEntryRecomputeValues (entry);
-  if (value)
-    *value = (is_inv ? entry->i_value : entry->b_value);
-  if (discount_value)
-    *discount_value = (is_inv ? entry->i_disc_value : gnc_numeric_zero());
-  if (tax_value)
-    *tax_value = (is_inv ? entry->i_tax_value : entry->b_tax_value);
-  if (tax_values)
-    *tax_values = (is_inv ? entry->i_tax_values : entry->b_tax_values);
+    if (!entry) return;
+    gncEntryRecomputeValues (entry);
+    if (value)
+        *value = (is_inv ? entry->i_value : entry->b_value);
+    if (discount_value)
+        *discount_value = (is_inv ? entry->i_disc_value : gnc_numeric_zero());
+    if (tax_value)
+        *tax_value = (is_inv ? entry->i_tax_value : entry->b_tax_value);
+    if (tax_values)
+        *tax_values = (is_inv ? entry->i_tax_values : entry->b_tax_values);
 }
 
 gnc_numeric gncEntryReturnValue (GncEntry *entry, gboolean is_inv)
 {
-  if (!entry) return gnc_numeric_zero();
-  gncEntryRecomputeValues (entry);
-  return (is_inv ? entry->i_value_rounded : entry->b_value_rounded);
+    if (!entry) return gnc_numeric_zero();
+    gncEntryRecomputeValues (entry);
+    return (is_inv ? entry->i_value_rounded : entry->b_value_rounded);
 }
 
 gnc_numeric gncEntryReturnTaxValue (GncEntry *entry, gboolean is_inv)
 {
-  if (!entry) return gnc_numeric_zero();
-  gncEntryRecomputeValues (entry);
-  return (is_inv ? entry->i_tax_value_rounded : entry->b_tax_value_rounded);
+    if (!entry) return gnc_numeric_zero();
+    gncEntryRecomputeValues (entry);
+    return (is_inv ? entry->i_tax_value_rounded : entry->b_tax_value_rounded);
 }
 
 AccountValueList * gncEntryReturnTaxValues (GncEntry *entry, gboolean is_inv)
 {
-  if (!entry) return NULL;
-  gncEntryRecomputeValues (entry);
-  return (is_inv ? entry->i_tax_values : entry->b_tax_values);
+    if (!entry) return NULL;
+    gncEntryRecomputeValues (entry);
+    return (is_inv ? entry->i_tax_values : entry->b_tax_values);
 }
 
 gnc_numeric gncEntryReturnDiscountValue (GncEntry *entry, gboolean is_inv)
 {
-  if (!entry) return gnc_numeric_zero();
-  gncEntryRecomputeValues (entry);
-  return (is_inv ? entry->i_disc_value_rounded : gnc_numeric_zero());
+    if (!entry) return gnc_numeric_zero();
+    gncEntryRecomputeValues (entry);
+    return (is_inv ? entry->i_disc_value_rounded : gnc_numeric_zero());
 }
 
 /* XXXX this exsitnace of this routine is just wrong */
 gboolean gncEntryIsOpen (const GncEntry *entry)
 {
-  if (!entry) return FALSE;
-  return (qof_instance_get_editlevel(entry) > 0);
+    if (!entry) return FALSE;
+    return (qof_instance_get_editlevel(entry) > 0);
 }
 
 /* ================================================================ */
 
 void gncEntryBeginEdit (GncEntry *entry)
 {
-  qof_begin_edit(&entry->inst);
+    qof_begin_edit(&entry->inst);
 }
 
 static void gncEntryOnError (QofInstance *entry, QofBackendError errcode)
 {
-  PERR("Entry QofBackend Failure: %d", errcode);
-  gnc_engine_signal_commit_error( errcode );
+    PERR("Entry QofBackend Failure: %d", errcode);
+    gnc_engine_signal_commit_error( errcode );
 }
 
 static void gncEntryOnDone (QofInstance *inst) {}
 
 static void entry_free (QofInstance *inst)
 {
-  GncEntry *entry = (GncEntry *)inst;
-  gncEntryFree (entry);
+    GncEntry *entry = (GncEntry *)inst;
+    gncEntryFree (entry);
 }
 
 void gncEntryCommitEdit (GncEntry *entry)
 {
-  if (!qof_commit_edit (QOF_INSTANCE(entry))) return;
-  qof_commit_edit_part2 (&entry->inst, gncEntryOnError,
-			 gncEntryOnDone, entry_free);
+    if (!qof_commit_edit (QOF_INSTANCE(entry))) return;
+    qof_commit_edit_part2 (&entry->inst, gncEntryOnError,
+                           gncEntryOnDone, entry_free);
 }
 
 int gncEntryCompare (const GncEntry *a, const GncEntry *b)
 {
-  int compare;
+    int compare;
 
-  if (a == b) return 0;
-  if (!a && b) return -1;
-  if (a && !b) return 1;
+    if (a == b) return 0;
+    if (!a && b) return -1;
+    if (a && !b) return 1;
 
-  compare = timespec_cmp (&(a->date), &(b->date));
-  if (compare) return compare;
+    compare = timespec_cmp (&(a->date), &(b->date));
+    if (compare) return compare;
 
-  compare = timespec_cmp (&(a->date_entered), &(b->date_entered));
-  if (compare) return compare;
+    compare = timespec_cmp (&(a->date_entered), &(b->date_entered));
+    if (compare) return compare;
 
-  compare = safe_strcmp (a->desc, b->desc);
-  if (compare) return compare;
+    compare = safe_strcmp (a->desc, b->desc);
+    if (compare) return compare;
 
-  compare = safe_strcmp (a->action, b->action);
-  if (compare) return compare;
+    compare = safe_strcmp (a->action, b->action);
+    if (compare) return compare;
 
-  return qof_instance_guid_compare(a, b);
+    return qof_instance_guid_compare(a, b);
 }
 
 /* ============================================================= */
 /* Object declaration */
 
-static QofObject gncEntryDesc = 
+static QofObject gncEntryDesc =
 {
-  .interface_version = QOF_OBJECT_VERSION,
-  .e_type            = _GNC_MOD_NAME,
-  .type_label        = "Order/Invoice/Bill Entry",
-  .create            = (gpointer)gncEntryCreate,
-  .book_begin        = NULL,
-  .book_end          = NULL,
-  .is_dirty          = qof_collection_is_dirty,
-  .mark_clean        = qof_collection_mark_clean,
-  .foreach           = qof_collection_foreach,
-  .printable         = NULL,
-  .version_cmp       = (int (*)(gpointer, gpointer)) qof_instance_version_cmp,
+    .interface_version = QOF_OBJECT_VERSION,
+    .e_type            = _GNC_MOD_NAME,
+    .type_label        = "Order/Invoice/Bill Entry",
+    .create            = (gpointer)gncEntryCreate,
+    .book_begin        = NULL,
+    .book_end          = NULL,
+    .is_dirty          = qof_collection_is_dirty,
+    .mark_clean        = qof_collection_mark_clean,
+    .foreach           = qof_collection_foreach,
+    .printable         = NULL,
+    .version_cmp       = (int (*)(gpointer, gpointer)) qof_instance_version_cmp,
 };
 
 gboolean gncEntryRegister (void)
 {
-  static QofParam params[] = {
-    { ENTRY_DATE, QOF_TYPE_DATE, (QofAccessFunc)gncEntryGetDate, (QofSetterFunc)gncEntrySetDate },
-    { ENTRY_DATE_ENTERED, QOF_TYPE_DATE, (QofAccessFunc)gncEntryGetDateEntered, (QofSetterFunc)gncEntrySetDateEntered },
-    { ENTRY_DESC, QOF_TYPE_STRING, (QofAccessFunc)gncEntryGetDescription, (QofSetterFunc)gncEntrySetDescription },
-    { ENTRY_ACTION, QOF_TYPE_STRING, (QofAccessFunc)gncEntryGetAction, (QofSetterFunc)gncEntrySetAction },
-    { ENTRY_NOTES, QOF_TYPE_STRING, (QofAccessFunc)gncEntryGetNotes, (QofSetterFunc)gncEntrySetNotes },
-    { ENTRY_QTY, QOF_TYPE_NUMERIC, (QofAccessFunc)gncEntryGetQuantity, (QofSetterFunc)gncEntrySetQuantity },
-    { ENTRY_IPRICE, QOF_TYPE_NUMERIC, (QofAccessFunc)gncEntryGetInvPrice, (QofSetterFunc)gncEntrySetInvPrice },
-    { ENTRY_BPRICE, QOF_TYPE_NUMERIC, (QofAccessFunc)gncEntryGetBillPrice, (QofSetterFunc)gncEntrySetBillPrice },
-    { ENTRY_INVOICE, GNC_ID_INVOICE, (QofAccessFunc)gncEntryGetInvoice, NULL },
-    { ENTRY_IACCT, GNC_ID_ACCOUNT,  (QofAccessFunc)gncEntryGetInvAccount,  (QofSetterFunc)gncEntrySetInvAccount  },
-    { ENTRY_BACCT, GNC_ID_ACCOUNT,  (QofAccessFunc)gncEntryGetBillAccount, (QofSetterFunc)gncEntrySetBillAccount },
-    { ENTRY_BILL, GNC_ID_INVOICE, (QofAccessFunc)gncEntryGetBill, NULL },
-    { ENTRY_INV_DISC_TYPE, QOF_TYPE_STRING, (QofAccessFunc)qofEntryGetInvDiscType,
-       (QofSetterFunc)qofEntrySetInvDiscType },
-    { ENTRY_INV_DISC_HOW, QOF_TYPE_STRING, (QofAccessFunc)qofEntryGetInvDiscHow,
-       (QofSetterFunc)qofEntrySetInvDiscHow },
-    { ENTRY_INV_TAXABLE, QOF_TYPE_BOOLEAN, (QofAccessFunc)gncEntryGetInvTaxable,
-       (QofSetterFunc)gncEntrySetInvTaxable },
-    { ENTRY_INV_TAX_INC, QOF_TYPE_BOOLEAN, (QofAccessFunc)gncEntryGetInvTaxIncluded,
-       (QofSetterFunc)gncEntrySetInvTaxIncluded },
-    { ENTRY_BILL_TAXABLE, QOF_TYPE_BOOLEAN, (QofAccessFunc)gncEntryGetInvTaxable,
-       (QofSetterFunc)gncEntrySetInvTaxable },
-    { ENTRY_BILL_TAX_INC, QOF_TYPE_BOOLEAN, (QofAccessFunc)gncEntryGetBillTaxIncluded,
-       (QofSetterFunc)gncEntrySetBillTaxIncluded },
-    { ENTRY_BILLABLE, QOF_TYPE_BOOLEAN, (QofAccessFunc)gncEntryGetBillable, (QofSetterFunc)gncEntrySetBillable },
-    { ENTRY_BILLTO, GNC_ID_OWNER, (QofAccessFunc)gncEntryGetBillTo, (QofSetterFunc)gncEntrySetBillTo },
-    { ENTRY_ORDER, GNC_ID_ORDER, (QofAccessFunc)gncEntryGetOrder, NULL },
-    { QOF_PARAM_BOOK, QOF_ID_BOOK, (QofAccessFunc)qof_instance_get_book, NULL },
-    { QOF_PARAM_GUID, QOF_TYPE_GUID, (QofAccessFunc)qof_instance_get_guid, NULL },
-    { NULL },
-  };
+    static QofParam params[] =
+    {
+        { ENTRY_DATE, QOF_TYPE_DATE, (QofAccessFunc)gncEntryGetDate, (QofSetterFunc)gncEntrySetDate },
+        { ENTRY_DATE_ENTERED, QOF_TYPE_DATE, (QofAccessFunc)gncEntryGetDateEntered, (QofSetterFunc)gncEntrySetDateEntered },
+        { ENTRY_DESC, QOF_TYPE_STRING, (QofAccessFunc)gncEntryGetDescription, (QofSetterFunc)gncEntrySetDescription },
+        { ENTRY_ACTION, QOF_TYPE_STRING, (QofAccessFunc)gncEntryGetAction, (QofSetterFunc)gncEntrySetAction },
+        { ENTRY_NOTES, QOF_TYPE_STRING, (QofAccessFunc)gncEntryGetNotes, (QofSetterFunc)gncEntrySetNotes },
+        { ENTRY_QTY, QOF_TYPE_NUMERIC, (QofAccessFunc)gncEntryGetQuantity, (QofSetterFunc)gncEntrySetQuantity },
+        { ENTRY_IPRICE, QOF_TYPE_NUMERIC, (QofAccessFunc)gncEntryGetInvPrice, (QofSetterFunc)gncEntrySetInvPrice },
+        { ENTRY_BPRICE, QOF_TYPE_NUMERIC, (QofAccessFunc)gncEntryGetBillPrice, (QofSetterFunc)gncEntrySetBillPrice },
+        { ENTRY_INVOICE, GNC_ID_INVOICE, (QofAccessFunc)gncEntryGetInvoice, NULL },
+        { ENTRY_IACCT, GNC_ID_ACCOUNT,  (QofAccessFunc)gncEntryGetInvAccount,  (QofSetterFunc)gncEntrySetInvAccount  },
+        { ENTRY_BACCT, GNC_ID_ACCOUNT,  (QofAccessFunc)gncEntryGetBillAccount, (QofSetterFunc)gncEntrySetBillAccount },
+        { ENTRY_BILL, GNC_ID_INVOICE, (QofAccessFunc)gncEntryGetBill, NULL },
+        {
+            ENTRY_INV_DISC_TYPE, QOF_TYPE_STRING, (QofAccessFunc)qofEntryGetInvDiscType,
+            (QofSetterFunc)qofEntrySetInvDiscType
+        },
+        {
+            ENTRY_INV_DISC_HOW, QOF_TYPE_STRING, (QofAccessFunc)qofEntryGetInvDiscHow,
+            (QofSetterFunc)qofEntrySetInvDiscHow
+        },
+        {
+            ENTRY_INV_TAXABLE, QOF_TYPE_BOOLEAN, (QofAccessFunc)gncEntryGetInvTaxable,
+            (QofSetterFunc)gncEntrySetInvTaxable
+        },
+        {
+            ENTRY_INV_TAX_INC, QOF_TYPE_BOOLEAN, (QofAccessFunc)gncEntryGetInvTaxIncluded,
+            (QofSetterFunc)gncEntrySetInvTaxIncluded
+        },
+        {
+            ENTRY_BILL_TAXABLE, QOF_TYPE_BOOLEAN, (QofAccessFunc)gncEntryGetInvTaxable,
+            (QofSetterFunc)gncEntrySetInvTaxable
+        },
+        {
+            ENTRY_BILL_TAX_INC, QOF_TYPE_BOOLEAN, (QofAccessFunc)gncEntryGetBillTaxIncluded,
+            (QofSetterFunc)gncEntrySetBillTaxIncluded
+        },
+        { ENTRY_BILLABLE, QOF_TYPE_BOOLEAN, (QofAccessFunc)gncEntryGetBillable, (QofSetterFunc)gncEntrySetBillable },
+        { ENTRY_BILLTO, GNC_ID_OWNER, (QofAccessFunc)gncEntryGetBillTo, (QofSetterFunc)gncEntrySetBillTo },
+        { ENTRY_ORDER, GNC_ID_ORDER, (QofAccessFunc)gncEntryGetOrder, NULL },
+        { QOF_PARAM_BOOK, QOF_ID_BOOK, (QofAccessFunc)qof_instance_get_book, NULL },
+        { QOF_PARAM_GUID, QOF_TYPE_GUID, (QofAccessFunc)qof_instance_get_guid, NULL },
+        { NULL },
+    };
 
-  qof_class_register (_GNC_MOD_NAME, (QofSortFunc)gncEntryCompare, params);
+    qof_class_register (_GNC_MOD_NAME, (QofSortFunc)gncEntryCompare, params);
 
-  return qof_object_register (&gncEntryDesc);
+    return qof_object_register (&gncEntryDesc);
 }

Modified: gnucash/trunk/src/business/business-core/gncEntry.h
===================================================================
--- gnucash/trunk/src/business/business-core/gncEntry.h	2010-03-02 21:40:28 UTC (rev 18788)
+++ gnucash/trunk/src/business/business-core/gncEntry.h	2010-03-02 21:41:05 UTC (rev 18789)
@@ -34,15 +34,17 @@
 typedef struct _gncEntry GncEntry;
 typedef struct _gncEntryClass GncEntryClass;
 
-typedef enum {
-  GNC_PAYMENT_CASH = 1,
-  GNC_PAYMENT_CARD
+typedef enum
+{
+    GNC_PAYMENT_CASH = 1,
+    GNC_PAYMENT_CARD
 } GncEntryPaymentType;
 
-typedef enum {
-  GNC_DISC_PRETAX = 1,
-  GNC_DISC_SAMETIME,
-  GNC_DISC_POSTTAX
+typedef enum
+{
+    GNC_DISC_PRETAX = 1,
+    GNC_DISC_SAMETIME,
+    GNC_DISC_POSTTAX
 } GncDiscountHow;
 
 #ifdef GNUCASH_MAJOR_VERSION
@@ -84,7 +86,7 @@
 const char * gncEntryPaymentTypeToString (GncEntryPaymentType type);
 gboolean gncEntryPaymentStringToType (const char *str, GncEntryPaymentType *type);
 
-/** @name Create/Destroy Functions 
+/** @name Create/Destroy Functions
  @{ */
 GncEntry *gncEntryCreate (QofBook *book);
 void gncEntryDestroy (GncEntry *entry);
@@ -92,7 +94,7 @@
 
 /* SET FUNCTIONS */
 
-/** @name Generic (shared) data 
+/** @name Generic (shared) data
  @{ */
 void gncEntrySetDate (GncEntry *entry, Timespec date);
 void gncEntrySetDateEntered (GncEntry *entry, Timespec date);
@@ -102,7 +104,7 @@
 void gncEntrySetQuantity (GncEntry *entry, gnc_numeric quantity);
 /** @} */
 
-/** @name Customer Invoices 
+/** @name Customer Invoices
  @{ */
 void gncEntrySetInvAccount (GncEntry *entry, Account *acc);
 void gncEntrySetInvPrice (GncEntry *entry, gnc_numeric price);
@@ -116,7 +118,7 @@
 void qofEntrySetInvDiscHow  (GncEntry *entry, const char *type);
 /** @} */
 
-/** @name Vendor Bills (and Employee Expenses) 
+/** @name Vendor Bills (and Employee Expenses)
  @{ */
 void gncEntrySetBillAccount (GncEntry *entry, Account *acc);
 void gncEntrySetBillPrice (GncEntry *entry, gnc_numeric price);
@@ -127,13 +129,13 @@
 void gncEntrySetBillTo (GncEntry *entry, GncOwner *billto);
 /** @} */
 
-/** @name employee-stuff 
+/** @name employee-stuff
  @{ */
 void gncEntrySetBillPayment (GncEntry *entry, GncEntryPaymentType type);
 /** @} */
 
 /* GET FUNCTIONS */
-/** @name Generic (shared) data 
+/** @name Generic (shared) data
  @{ */
 Timespec gncEntryGetDate (const GncEntry *entry);
 Timespec gncEntryGetDateEntered (const GncEntry *entry);
@@ -143,7 +145,7 @@
 gnc_numeric gncEntryGetQuantity (const GncEntry *entry);
 /** @} */
 
-/** @name Customer Invoices 
+/** @name Customer Invoices
  @{ */
 Account * gncEntryGetInvAccount (const GncEntry *entry);
 gnc_numeric gncEntryGetInvPrice (const GncEntry *entry);
@@ -157,7 +159,7 @@
 GncTaxTable * gncEntryGetInvTaxTable (const GncEntry *entry);
 /** @} */
 
-/** @name Vendor Bills (and Employee Expenses) 
+/** @name Vendor Bills (and Employee Expenses)
  @{ */
 Account * gncEntryGetBillAccount (const GncEntry *entry);
 gnc_numeric gncEntryGetBillPrice (const GncEntry *entry);
@@ -172,7 +174,7 @@
 
 void gncEntryCopy (const GncEntry *src, GncEntry *dest);
 
-/** @name Getting Values 
+/** @name Getting Values
 
  * The first three return the rounded values -- the last returns the
  * list of unrounded account-values.  The list belongs to the entry
@@ -197,16 +199,16 @@
  * values from these two functions are NOT rounded.
  */
 void gncEntryGetValue (GncEntry *entry, gboolean is_inv, gnc_numeric *value,
-		       gnc_numeric *discount, gnc_numeric *tax_value,
-		       GList **tax_values);
+                       gnc_numeric *discount, gnc_numeric *tax_value,
+                       GList **tax_values);
 
 void gncEntryComputeValue (gnc_numeric qty, gnc_numeric price,
-			   const GncTaxTable *tax_table, gboolean tax_included,
-			   gnc_numeric discount, GncAmountType discount_type,
-			   GncDiscountHow discount_how, int SCU,
-			   /* return values */
-			   gnc_numeric *value, gnc_numeric *discount_value,
-			   GList **tax_values);
+                           const GncTaxTable *tax_table, gboolean tax_included,
+                           gnc_numeric discount, GncAmountType discount_type,
+                           GncDiscountHow discount_how, int SCU,
+                           /* return values */
+                           gnc_numeric *value, gnc_numeric *discount_value,
+                           GList **tax_values);
 
 /** @} */
 
@@ -215,7 +217,7 @@
 GncInvoice * gncEntryGetBill (const GncEntry *entry);
 
 /** Return a pointer to the instance gncEntry that is identified
- *  by the guid, and is residing in the book. Returns NULL if the 
+ *  by the guid, and is residing in the book. Returns NULL if the
  *  instance can't be found.
  *  Equivalent function prototype is
  *  GncEntry * gncEntryLookup (QofBook *book, const GUID *guid);

Modified: gnucash/trunk/src/business/business-core/gncEntryP.h
===================================================================
--- gnucash/trunk/src/business/business-core/gncEntryP.h	2010-03-02 21:40:28 UTC (rev 18788)
+++ gnucash/trunk/src/business/business-core/gncEntryP.h	2010-03-02 21:41:05 UTC (rev 18789)
@@ -54,7 +54,7 @@
  *  gncCloneEntry()) and placed into the book.
  *
  * We called this routine 'Obtain' instead of "Get" to distinguish
- * it from the other Get routines, which work in fundamentally  
+ * it from the other Get routines, which work in fundamentally
  * different ways.
  */
 GncEntry * gncEntryObtainTwin (GncEntry *from, QofBook *book);

Modified: gnucash/trunk/src/business/business-core/gncInvoice.c
===================================================================
--- gnucash/trunk/src/business/business-core/gncInvoice.c	2010-03-02 21:40:28 UTC (rev 18788)
+++ gnucash/trunk/src/business/business-core/gncInvoice.c	2010-03-02 21:41:05 UTC (rev 18789)
@@ -42,37 +42,37 @@
 #include "gncInvoiceP.h"
 #include "gncOwnerP.h"
 
-struct _gncInvoice 
+struct _gncInvoice
 {
-  QofInstance inst;
-  
-  char        *id;
-  char        *notes;
-  gboolean    active;
+    QofInstance inst;
 
-  char        *billing_id;
-  char        *printname;
-  GncBillTerm *terms;
-  GList       *entries;
-  GList       *prices;
-  GncOwner    owner;
-  GncOwner    billto;
-  GncJob      *job;
-  Timespec    date_opened;
-  Timespec    date_posted;
+    char        *id;
+    char        *notes;
+    gboolean    active;
 
-  gnc_numeric	to_charge_amount;
+    char        *billing_id;
+    char        *printname;
+    GncBillTerm *terms;
+    GList       *entries;
+    GList       *prices;
+    GncOwner    owner;
+    GncOwner    billto;
+    GncJob      *job;
+    Timespec    date_opened;
+    Timespec    date_posted;
 
-  gnc_commodity * currency;
+    gnc_numeric	to_charge_amount;
 
-  Account     *posted_acc;
-  Transaction *posted_txn;
-  GNCLot      *posted_lot;
+    gnc_commodity * currency;
+
+    Account     *posted_acc;
+    Transaction *posted_txn;
+    GNCLot      *posted_lot;
 };
 
 struct _gncInvoiceClass
 {
-  QofInstanceClass parent_class;
+    QofInstanceClass parent_class;
 };
 
 static QofLogModule log_module = GNC_MOD_BUSINESS;
@@ -96,8 +96,8 @@
 static void
 mark_invoice (GncInvoice *invoice)
 {
-  qof_instance_set_dirty(&invoice->inst);
-  qof_event_gen (&invoice->inst, QOF_EVENT_MODIFY, NULL);
+    qof_instance_set_dirty(&invoice->inst);
+    qof_event_gen (&invoice->inst, QOF_EVENT_MODIFY, NULL);
 }
 
 QofBook * gncInvoiceGetBook(GncInvoice *x)
@@ -107,9 +107,10 @@
 
 /* ================================================================== */
 
-enum {
+enum
+{
     PROP_0,
-	PROP_NOTES
+    PROP_NOTES
 };
 
 /* GObject Initialization */
@@ -134,43 +135,45 @@
 
 static void
 gnc_invoice_get_property (GObject         *object,
-			  guint            prop_id,
-			  GValue          *value,
-			  GParamSpec      *pspec)
+                          guint            prop_id,
+                          GValue          *value,
+                          GParamSpec      *pspec)
 {
     GncInvoice *inv;
 
     g_return_if_fail(GNC_IS_INVOICE(object));
 
     inv = GNC_INVOICE(object);
-    switch (prop_id) {
-	case PROP_NOTES:
-	    g_value_set_string(value, inv->notes);
-		break;
-	default:
-	    G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec);
-	    break;
+    switch (prop_id)
+    {
+    case PROP_NOTES:
+        g_value_set_string(value, inv->notes);
+        break;
+    default:
+        G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec);
+        break;
     }
 }
 
 static void
 gnc_invoice_set_property (GObject         *object,
-			  guint            prop_id,
-			  const GValue          *value,
-			  GParamSpec      *pspec)
+                          guint            prop_id,
+                          const GValue          *value,
+                          GParamSpec      *pspec)
 {
     GncInvoice *inv;
 
     g_return_if_fail(GNC_IS_INVOICE(object));
 
     inv = GNC_INVOICE(object);
-    switch (prop_id) {
-	case PROP_NOTES:
-	    gncInvoiceSetNotes(inv, g_value_get_string(value));
-		break;
-	default:
-	    G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec);
-	    break;
+    switch (prop_id)
+    {
+    case PROP_NOTES:
+        gncInvoiceSetNotes(inv, g_value_get_string(value));
+        break;
+    default:
+        G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec);
+        break;
     }
 }
 
@@ -178,149 +181,149 @@
 gnc_invoice_class_init (GncInvoiceClass *klass)
 {
     GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
-	
+
     gobject_class->dispose = gnc_invoice_dispose;
     gobject_class->finalize = gnc_invoice_finalize;
     gobject_class->set_property = gnc_invoice_set_property;
     gobject_class->get_property = gnc_invoice_get_property;
 
     g_object_class_install_property
-	(gobject_class,
-	 PROP_NOTES,
-	 g_param_spec_string ("notes",
-			      "Invoice Notes",
-			      "The invoice notes is an arbitrary string "
-			      "assigned by the user to provide notes regarding "
-			      "this invoice.",
-			      NULL,
-			      G_PARAM_READWRITE));
+    (gobject_class,
+     PROP_NOTES,
+     g_param_spec_string ("notes",
+                          "Invoice Notes",
+                          "The invoice notes is an arbitrary string "
+                          "assigned by the user to provide notes regarding "
+                          "this invoice.",
+                          NULL,
+                          G_PARAM_READWRITE));
 }
 
 /* Create/Destroy Functions */
 GncInvoice *gncInvoiceCreate (QofBook *book)
 {
-  GncInvoice *invoice;
+    GncInvoice *invoice;
 
-  if (!book) return NULL;
+    if (!book) return NULL;
 
-  invoice = g_object_new (GNC_TYPE_INVOICE, NULL);
-  qof_instance_init_data (&invoice->inst, _GNC_MOD_NAME, book);
+    invoice = g_object_new (GNC_TYPE_INVOICE, NULL);
+    qof_instance_init_data (&invoice->inst, _GNC_MOD_NAME, book);
 
-  invoice->id = CACHE_INSERT ("");
-  invoice->notes = CACHE_INSERT ("");
-  invoice->billing_id = CACHE_INSERT ("");
+    invoice->id = CACHE_INSERT ("");
+    invoice->notes = CACHE_INSERT ("");
+    invoice->billing_id = CACHE_INSERT ("");
 
-  invoice->billto.type = GNC_OWNER_CUSTOMER;
-  invoice->active = TRUE;
+    invoice->billto.type = GNC_OWNER_CUSTOMER;
+    invoice->active = TRUE;
 
-  invoice->to_charge_amount = gnc_numeric_zero();
+    invoice->to_charge_amount = gnc_numeric_zero();
 
-  qof_event_gen (&invoice->inst, QOF_EVENT_CREATE, NULL);
+    qof_event_gen (&invoice->inst, QOF_EVENT_CREATE, NULL);
 
-  return invoice;
+    return invoice;
 }
 
 void gncInvoiceDestroy (GncInvoice *invoice)
 {
-  if (!invoice) return;
-  qof_instance_set_destroying(invoice, TRUE);
-  gncInvoiceCommitEdit (invoice);
+    if (!invoice) return;
+    qof_instance_set_destroying(invoice, TRUE);
+    gncInvoiceCommitEdit (invoice);
 }
 
 static void gncInvoiceFree (GncInvoice *invoice)
 {
-  if (!invoice) return;
+    if (!invoice) return;
 
-  qof_event_gen (&invoice->inst, QOF_EVENT_DESTROY, NULL);
+    qof_event_gen (&invoice->inst, QOF_EVENT_DESTROY, NULL);
 
-  CACHE_REMOVE (invoice->id);
-  CACHE_REMOVE (invoice->notes);
-  CACHE_REMOVE (invoice->billing_id);
-  g_list_free (invoice->entries);
-  g_list_free (invoice->prices);
+    CACHE_REMOVE (invoice->id);
+    CACHE_REMOVE (invoice->notes);
+    CACHE_REMOVE (invoice->billing_id);
+    g_list_free (invoice->entries);
+    g_list_free (invoice->prices);
 
-  if (invoice->printname) g_free (invoice->printname);
+    if (invoice->printname) g_free (invoice->printname);
 
-  if (invoice->terms)
-    gncBillTermDecRef (invoice->terms);
+    if (invoice->terms)
+        gncBillTermDecRef (invoice->terms);
 
-  /* qof_instance_release (&invoice->inst); */
-  g_object_unref (invoice);
+    /* qof_instance_release (&invoice->inst); */
+    g_object_unref (invoice);
 }
 
 GncInvoice *
 gncCloneInvoice (GncInvoice *from, QofBook *book)
 {
-  GList *node;
-  GncInvoice *invoice;
+    GList *node;
+    GncInvoice *invoice;
 
-  if (!book) return NULL;
+    if (!book) return NULL;
 
-  invoice = g_object_new (GNC_TYPE_INVOICE, NULL);
-  qof_instance_init_data (&invoice->inst, _GNC_MOD_NAME, book);
+    invoice = g_object_new (GNC_TYPE_INVOICE, NULL);
+    qof_instance_init_data (&invoice->inst, _GNC_MOD_NAME, book);
 
-  invoice->id = CACHE_INSERT (from->id);
-  invoice->notes = CACHE_INSERT (from->notes);
-  invoice->billing_id = CACHE_INSERT (from->billing_id);
-  invoice->active = from->active;
+    invoice->id = CACHE_INSERT (from->id);
+    invoice->notes = CACHE_INSERT (from->notes);
+    invoice->billing_id = CACHE_INSERT (from->billing_id);
+    invoice->active = from->active;
 
-  invoice->billto = gncCloneOwner (&from->billto, book);
-  invoice->owner = gncCloneOwner (&from->owner, book);
-  invoice->job = (GncJob*)gncJobObtainTwin (from->job, book);
-  invoice->terms = gncBillTermObtainTwin (from->terms, book);
-  gncBillTermIncRef (invoice->terms);
+    invoice->billto = gncCloneOwner (&from->billto, book);
+    invoice->owner = gncCloneOwner (&from->owner, book);
+    invoice->job = (GncJob*)gncJobObtainTwin (from->job, book);
+    invoice->terms = gncBillTermObtainTwin (from->terms, book);
+    gncBillTermIncRef (invoice->terms);
 
 
-  invoice->to_charge_amount = from->to_charge_amount;
-  invoice->printname = NULL; /* that's right, NULL. See below. */
-  invoice->date_opened = from->date_opened;
-  invoice->date_posted = from->date_posted;
+    invoice->to_charge_amount = from->to_charge_amount;
+    invoice->printname = NULL; /* that's right, NULL. See below. */
+    invoice->date_opened = from->date_opened;
+    invoice->date_posted = from->date_posted;
 
-  invoice->currency = gnc_commodity_obtain_twin (from->currency, book);
+    invoice->currency = gnc_commodity_obtain_twin (from->currency, book);
 
-  invoice->entries = NULL;
-  for (node = g_list_last(from->entries); node; node=node->next)
-  {
-    GncEntry *entry = node->data;
-    entry = gncEntryObtainTwin (entry, book);
-    invoice->entries = g_list_prepend (invoice->entries, entry);
-  }
+    invoice->entries = NULL;
+    for (node = g_list_last(from->entries); node; node = node->next)
+    {
+        GncEntry *entry = node->data;
+        entry = gncEntryObtainTwin (entry, book);
+        invoice->entries = g_list_prepend (invoice->entries, entry);
+    }
 
-  invoice->prices = NULL;
-  for (node = g_list_last(from->prices); node; node=node->next)
-  {
-    GNCPrice *price = node->data;
-    price = gnc_price_clone(price, book);
-    invoice->prices = g_list_prepend (invoice->prices, price);
-  }
+    invoice->prices = NULL;
+    for (node = g_list_last(from->prices); node; node = node->next)
+    {
+        GNCPrice *price = node->data;
+        price = gnc_price_clone(price, book);
+        invoice->prices = g_list_prepend (invoice->prices, price);
+    }
 
-  /* XXX should probably be obtain-twin not lookup-twin */
-  invoice->posted_acc = 
-     GNC_ACCOUNT(qof_instance_lookup_twin(QOF_INSTANCE(from->posted_acc), book));
+    /* XXX should probably be obtain-twin not lookup-twin */
+    invoice->posted_acc =
+        GNC_ACCOUNT(qof_instance_lookup_twin(QOF_INSTANCE(from->posted_acc), book));
 #if 0
-XXX not done */
-  Transaction * posted_txn;
-  GNCLot *	posted_lot;
+    XXX not done * /
+    Transaction * posted_txn;
+    GNCLot *	posted_lot;
 #endif
 
-  qof_event_gen (&invoice->inst, QOF_EVENT_CREATE, NULL);
+    qof_event_gen (&invoice->inst, QOF_EVENT_CREATE, NULL);
 
-  return invoice;
+    return invoice;
 }
 
 GncInvoice *
 gncInvoiceObtainTwin (GncInvoice *from, QofBook *book)
 {
-  GncInvoice *invoice;
-  if (!book) return NULL;
+    GncInvoice *invoice;
+    if (!book) return NULL;
 
-  invoice = (GncInvoice *) qof_instance_lookup_twin (QOF_INSTANCE(from), book);
-  if (!invoice)
-  {
-    invoice = gncCloneInvoice (from, book);
-  }
+    invoice = (GncInvoice *) qof_instance_lookup_twin (QOF_INSTANCE(from), book);
+    if (!invoice)
+    {
+        invoice = gncCloneInvoice (from, book);
+    }
 
-  return invoice;
+    return invoice;
 }
 
 /* ================================================================== */
@@ -328,257 +331,263 @@
 
 void gncInvoiceSetID (GncInvoice *invoice, const char *id)
 {
-  if (!invoice || !id) return;
-  SET_STR (invoice, invoice->id, id);
-  mark_invoice (invoice);
-  gncInvoiceCommitEdit (invoice);
+    if (!invoice || !id) return;
+    SET_STR (invoice, invoice->id, id);
+    mark_invoice (invoice);
+    gncInvoiceCommitEdit (invoice);
 }
 
 void gncInvoiceSetOwner (GncInvoice *invoice, GncOwner *owner)
 {
-  if (!invoice || !owner) return;
-  if (gncOwnerEqual (&invoice->owner, owner)) return;
-  gncInvoiceBeginEdit (invoice);
-  gncOwnerCopy (owner, &invoice->owner);
-  mark_invoice (invoice);
-  gncInvoiceCommitEdit (invoice);
+    if (!invoice || !owner) return;
+    if (gncOwnerEqual (&invoice->owner, owner)) return;
+    gncInvoiceBeginEdit (invoice);
+    gncOwnerCopy (owner, &invoice->owner);
+    mark_invoice (invoice);
+    gncInvoiceCommitEdit (invoice);
 }
 
 static void
 qofInvoiceSetOwner (GncInvoice *invoice, QofInstance *ent)
 {
-	if(!invoice || !ent) { return; }
-	gncInvoiceBeginEdit (invoice);
-	qofOwnerSetEntity(&invoice->owner, ent);
-	mark_invoice (invoice);
-	gncInvoiceCommitEdit (invoice);
+    if (!invoice || !ent)
+    {
+        return;
+    }
+    gncInvoiceBeginEdit (invoice);
+    qofOwnerSetEntity(&invoice->owner, ent);
+    mark_invoice (invoice);
+    gncInvoiceCommitEdit (invoice);
 }
 
 static void
 qofInvoiceSetBillTo (GncInvoice *invoice, QofInstance *ent)
 {
-	if(!invoice || !ent) { return; }
-	gncInvoiceBeginEdit (invoice);
-	qofOwnerSetEntity(&invoice->billto, ent);
-	mark_invoice (invoice);
-	gncInvoiceCommitEdit (invoice);
+    if (!invoice || !ent)
+    {
+        return;
+    }
+    gncInvoiceBeginEdit (invoice);
+    qofOwnerSetEntity(&invoice->billto, ent);
+    mark_invoice (invoice);
+    gncInvoiceCommitEdit (invoice);
 }
 
 void gncInvoiceSetDateOpened (GncInvoice *invoice, Timespec date)
 {
-  if (!invoice) return;
-  if (timespec_equal (&invoice->date_opened, &date)) return;
-  gncInvoiceBeginEdit (invoice);
-  invoice->date_opened = date;
-  mark_invoice (invoice);
-  gncInvoiceCommitEdit (invoice);
+    if (!invoice) return;
+    if (timespec_equal (&invoice->date_opened, &date)) return;
+    gncInvoiceBeginEdit (invoice);
+    invoice->date_opened = date;
+    mark_invoice (invoice);
+    gncInvoiceCommitEdit (invoice);
 }
 
 void gncInvoiceSetDatePosted (GncInvoice *invoice, Timespec date)
 {
-  if (!invoice) return;
-  if (timespec_equal (&invoice->date_posted, &date)) return;
-  gncInvoiceBeginEdit (invoice);
-  invoice->date_posted = date;
-  mark_invoice (invoice);
-  gncInvoiceCommitEdit (invoice);
+    if (!invoice) return;
+    if (timespec_equal (&invoice->date_posted, &date)) return;
+    gncInvoiceBeginEdit (invoice);
+    invoice->date_posted = date;
+    mark_invoice (invoice);
+    gncInvoiceCommitEdit (invoice);
 }
 
 void gncInvoiceSetTerms (GncInvoice *invoice, GncBillTerm *terms)
 {
-  if (!invoice) return;
-  if (invoice->terms == terms) return;
-  gncInvoiceBeginEdit (invoice);
-  if (invoice->terms)
-    gncBillTermDecRef (invoice->terms);
-  invoice->terms = terms;
-  if (invoice->terms)
-    gncBillTermIncRef (invoice->terms);
-  mark_invoice (invoice);
-  gncInvoiceCommitEdit (invoice);
+    if (!invoice) return;
+    if (invoice->terms == terms) return;
+    gncInvoiceBeginEdit (invoice);
+    if (invoice->terms)
+        gncBillTermDecRef (invoice->terms);
+    invoice->terms = terms;
+    if (invoice->terms)
+        gncBillTermIncRef (invoice->terms);
+    mark_invoice (invoice);
+    gncInvoiceCommitEdit (invoice);
 }
 
 void gncInvoiceSetBillingID (GncInvoice *invoice, const char *billing_id)
 {
-  if (!invoice) return;
-  SET_STR (invoice, invoice->billing_id, billing_id);
-  mark_invoice (invoice);
-  gncInvoiceCommitEdit (invoice);
+    if (!invoice) return;
+    SET_STR (invoice, invoice->billing_id, billing_id);
+    mark_invoice (invoice);
+    gncInvoiceCommitEdit (invoice);
 }
 
 void gncInvoiceSetNotes (GncInvoice *invoice, const char *notes)
 {
-  if (!invoice || !notes) return;
-  SET_STR (invoice, invoice->notes, notes);
-  mark_invoice (invoice);
-  gncInvoiceCommitEdit (invoice);
+    if (!invoice || !notes) return;
+    SET_STR (invoice, invoice->notes, notes);
+    mark_invoice (invoice);
+    gncInvoiceCommitEdit (invoice);
 }
 
 void gncInvoiceSetActive (GncInvoice *invoice, gboolean active)
 {
-  if (!invoice) return;
-  if (invoice->active == active) return;
-  gncInvoiceBeginEdit (invoice);
-  invoice->active = active;
-  mark_invoice (invoice);
-  gncInvoiceCommitEdit (invoice);
+    if (!invoice) return;
+    if (invoice->active == active) return;
+    gncInvoiceBeginEdit (invoice);
+    invoice->active = active;
+    mark_invoice (invoice);
+    gncInvoiceCommitEdit (invoice);
 }
 
 void gncInvoiceSetCurrency (GncInvoice *invoice, gnc_commodity *currency)
 {
-  if (!invoice || !currency) return;
-  if (invoice->currency &&
-      gnc_commodity_equal (invoice->currency, currency))
-    return;
-  gncInvoiceBeginEdit (invoice);
-  invoice->currency = currency;
-  mark_invoice (invoice);
-  gncInvoiceCommitEdit (invoice);
+    if (!invoice || !currency) return;
+    if (invoice->currency &&
+            gnc_commodity_equal (invoice->currency, currency))
+        return;
+    gncInvoiceBeginEdit (invoice);
+    invoice->currency = currency;
+    mark_invoice (invoice);
+    gncInvoiceCommitEdit (invoice);
 }
 
 void gncInvoiceSetBillTo (GncInvoice *invoice, GncOwner *billto)
 {
-  if (!invoice || !billto) return;
-  if (gncOwnerEqual (&invoice->billto, billto)) return;
+    if (!invoice || !billto) return;
+    if (gncOwnerEqual (&invoice->billto, billto)) return;
 
-  gncInvoiceBeginEdit (invoice);
-  gncOwnerCopy (billto, &invoice->billto);
-  mark_invoice (invoice);
-  gncInvoiceCommitEdit (invoice);
+    gncInvoiceBeginEdit (invoice);
+    gncOwnerCopy (billto, &invoice->billto);
+    mark_invoice (invoice);
+    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);
+    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 gncInvoiceSetPostedTxn (GncInvoice *invoice, Transaction *txn)
 {
-  if (!invoice) return;
-  g_return_if_fail (invoice->posted_txn == NULL);
+    if (!invoice) return;
+    g_return_if_fail (invoice->posted_txn == NULL);
 
-  gncInvoiceBeginEdit (invoice);
-  invoice->posted_txn = txn;
-  mark_invoice (invoice);
-  gncInvoiceCommitEdit (invoice);
+    gncInvoiceBeginEdit (invoice);
+    invoice->posted_txn = txn;
+    mark_invoice (invoice);
+    gncInvoiceCommitEdit (invoice);
 }
 
 void gncInvoiceSetPostedLot (GncInvoice *invoice, GNCLot *lot)
 {
-  if (!invoice) return;
-  g_return_if_fail (invoice->posted_lot == NULL);
+    if (!invoice) return;
+    g_return_if_fail (invoice->posted_lot == NULL);
 
-  gncInvoiceBeginEdit (invoice);
-  invoice->posted_lot = lot;
-  mark_invoice (invoice);
-  gncInvoiceCommitEdit (invoice);
+    gncInvoiceBeginEdit (invoice);
+    invoice->posted_lot = lot;
+    mark_invoice (invoice);
+    gncInvoiceCommitEdit (invoice);
 }
 
 void gncInvoiceSetPostedAcc (GncInvoice *invoice, Account *acc)
 {
-  if (!invoice) return;
-  g_return_if_fail (invoice->posted_acc == NULL);
+    if (!invoice) return;
+    g_return_if_fail (invoice->posted_acc == NULL);
 
-  gncInvoiceBeginEdit (invoice);
-  invoice->posted_acc = acc;
-  mark_invoice (invoice);
-  gncInvoiceCommitEdit (invoice);
+    gncInvoiceBeginEdit (invoice);
+    invoice->posted_acc = acc;
+    mark_invoice (invoice);
+    gncInvoiceCommitEdit (invoice);
 }
 
 void gncInvoiceAddEntry (GncInvoice *invoice, GncEntry *entry)
 {
-  GncInvoice *old;
+    GncInvoice *old;
 
-  if (!invoice || !entry) return;
+    if (!invoice || !entry) return;
 
-  old = gncEntryGetInvoice (entry);
-  if (old == invoice) return;	/* I already own this one */
-  if (old) gncInvoiceRemoveEntry (old, entry);
+    old = gncEntryGetInvoice (entry);
+    if (old == invoice) return;	/* I already own this one */
+    if (old) gncInvoiceRemoveEntry (old, entry);
 
-  gncEntrySetInvoice (entry, invoice);
-  invoice->entries = g_list_insert_sorted (invoice->entries, entry,
-					   (GCompareFunc)gncEntryCompare);
-  mark_invoice (invoice);
+    gncEntrySetInvoice (entry, invoice);
+    invoice->entries = g_list_insert_sorted (invoice->entries, entry,
+                       (GCompareFunc)gncEntryCompare);
+    mark_invoice (invoice);
 }
 
 void gncInvoiceRemoveEntry (GncInvoice *invoice, GncEntry *entry)
 {
-  if (!invoice || !entry) return;
+    if (!invoice || !entry) return;
 
-  gncEntrySetInvoice (entry, NULL);
-  invoice->entries = g_list_remove (invoice->entries, entry);
-  mark_invoice (invoice);
+    gncEntrySetInvoice (entry, NULL);
+    invoice->entries = g_list_remove (invoice->entries, entry);
+    mark_invoice (invoice);
 }
 
 void gncInvoiceAddPrice (GncInvoice *invoice, GNCPrice *price)
 {
-  if (!invoice || !price) return;
+    if (!invoice || !price) return;
 
-  invoice->prices = g_list_prepend(invoice->prices, price);
-  mark_invoice (invoice);
+    invoice->prices = g_list_prepend(invoice->prices, price);
+    mark_invoice (invoice);
 }
 
 void gncInvoiceRemovePrice (GncInvoice *invoice, GNCPrice *price)
 {
-  if (!invoice || !price) return;
+    if (!invoice || !price) return;
 
-  invoice->prices = g_list_remove (invoice->prices, price);
-  mark_invoice (invoice);
+    invoice->prices = g_list_remove (invoice->prices, price);
+    mark_invoice (invoice);
 }
 
 void gncBillAddEntry (GncInvoice *bill, GncEntry *entry)
 {
-  GncInvoice *old;
+    GncInvoice *old;
 
-  if (!bill || !entry) return;
+    if (!bill || !entry) return;
 
-  old = gncEntryGetBill (entry);
-  if (old == bill) return;	/* I already own this one */
-  if (old) gncBillRemoveEntry (old, entry);
+    old = gncEntryGetBill (entry);
+    if (old == bill) return;	/* I already own this one */
+    if (old) gncBillRemoveEntry (old, entry);
 
-  gncEntrySetBill (entry, bill);
-  bill->entries = g_list_insert_sorted (bill->entries, entry,
-					   (GCompareFunc)gncEntryCompare);
-  mark_invoice (bill);
+    gncEntrySetBill (entry, bill);
+    bill->entries = g_list_insert_sorted (bill->entries, entry,
+                                          (GCompareFunc)gncEntryCompare);
+    mark_invoice (bill);
 }
 
 void gncBillRemoveEntry (GncInvoice *bill, GncEntry *entry)
 {
-  if (!bill || !entry) return;
+    if (!bill || !entry) return;
 
-  gncEntrySetBill (entry, NULL);
-  bill->entries = g_list_remove (bill->entries, entry);
-  mark_invoice (bill);
+    gncEntrySetBill (entry, NULL);
+    bill->entries = g_list_remove (bill->entries, entry);
+    mark_invoice (bill);
 }
 
 void gncBillAddPrice (GncInvoice *bill, GNCPrice *price)
 {
-  if (!bill || !price) return;
+    if (!bill || !price) return;
 
-  bill->prices = g_list_prepend(bill->prices, price);
-  mark_invoice (bill);
+    bill->prices = g_list_prepend(bill->prices, price);
+    mark_invoice (bill);
 }
 
 void gncBillRemovePrice (GncInvoice *bill, GNCPrice *price)
 {
-  if (!bill || !price) return;
+    if (!bill || !price) return;
 
-  bill->prices = g_list_remove (bill->prices, price);
-  mark_invoice (bill);
+    bill->prices = g_list_remove (bill->prices, price);
+    mark_invoice (bill);
 }
 
 
 void gncInvoiceSortEntries (GncInvoice *invoice)
 {
-  if (!invoice) return;
-  invoice->entries = g_list_sort(invoice->entries,
-				 (GCompareFunc)gncEntryCompare);
-  mark_invoice(invoice);
+    if (!invoice) return;
+    invoice->entries = g_list_sort(invoice->entries,
+                                   (GCompareFunc)gncEntryCompare);
+    mark_invoice(invoice);
 }
 
 /* ================================================================== */
@@ -586,881 +595,934 @@
 
 const char * gncInvoiceGetID (const GncInvoice *invoice)
 {
-  if (!invoice) return NULL;
-  return invoice->id;
+    if (!invoice) return NULL;
+    return invoice->id;
 }
 
 GncOwner * gncInvoiceGetOwner (GncInvoice *invoice)
 {
-  if (!invoice) return NULL;
-  return &invoice->owner;
+    if (!invoice) return NULL;
+    return &invoice->owner;
 }
 
 static QofInstance*
 qofInvoiceGetOwner (GncInvoice *invoice)
 {
-	GncOwner *owner;
+    GncOwner *owner;
 
-	if(!invoice) { return NULL; }
-	owner = &invoice->owner;
-	return QOF_INSTANCE(owner);
+    if (!invoice)
+    {
+        return NULL;
+    }
+    owner = &invoice->owner;
+    return QOF_INSTANCE(owner);
 }
 
 static QofInstance*
 qofInvoiceGetBillTo (GncInvoice *invoice)
 {
-	GncOwner *billto;
+    GncOwner *billto;
 
-	if(!invoice) { return NULL; }
-	billto = &invoice->billto;
-	return QOF_INSTANCE(billto);
+    if (!invoice)
+    {
+        return NULL;
+    }
+    billto = &invoice->billto;
+    return QOF_INSTANCE(billto);
 }
 
 Timespec gncInvoiceGetDateOpened (const GncInvoice *invoice)
 {
-  Timespec ts; ts.tv_sec = 0; ts.tv_nsec = 0;
-  if (!invoice) return ts;
-  return invoice->date_opened;
+    Timespec ts;
+    ts.tv_sec = 0;
+    ts.tv_nsec = 0;
+    if (!invoice) return ts;
+    return invoice->date_opened;
 }
 
 Timespec gncInvoiceGetDatePosted (const GncInvoice *invoice)
 {
-  Timespec ts; ts.tv_sec = 0; ts.tv_nsec = 0;
-  if (!invoice) return ts;
-  return invoice->date_posted;
+    Timespec ts;
+    ts.tv_sec = 0;
+    ts.tv_nsec = 0;
+    if (!invoice) return ts;
+    return invoice->date_posted;
 }
 
 Timespec gncInvoiceGetDateDue (const GncInvoice *invoice)
 {
-  Transaction *txn;
-  Timespec ts; ts.tv_sec = 0; ts.tv_nsec = 0;
-  if (!invoice) return ts;
-  txn = gncInvoiceGetPostedTxn (invoice);
-  if (!txn) return ts;
-  return xaccTransRetDateDueTS (txn);
+    Transaction *txn;
+    Timespec ts;
+    ts.tv_sec = 0;
+    ts.tv_nsec = 0;
+    if (!invoice) return ts;
+    txn = gncInvoiceGetPostedTxn (invoice);
+    if (!txn) return ts;
+    return xaccTransRetDateDueTS (txn);
 }
 
 GncBillTerm * gncInvoiceGetTerms (const GncInvoice *invoice)
 {
-  if (!invoice) return NULL;
-  return invoice->terms;
+    if (!invoice) return NULL;
+    return invoice->terms;
 }
 
 const char * gncInvoiceGetBillingID (const GncInvoice *invoice)
 {
-  if (!invoice) return NULL;
-  return invoice->billing_id;
+    if (!invoice) return NULL;
+    return invoice->billing_id;
 }
 
 const char * gncInvoiceGetNotes (const GncInvoice *invoice)
 {
-  if (!invoice) return NULL;
-  return invoice->notes;
+    if (!invoice) return NULL;
+    return invoice->notes;
 }
 
 GncOwnerType gncInvoiceGetOwnerType (GncInvoice *invoice)
 {
-  GncOwner *owner;
-  g_return_val_if_fail (invoice, GNC_OWNER_NONE);
+    GncOwner *owner;
+    g_return_val_if_fail (invoice, GNC_OWNER_NONE);
 
-  owner = gncOwnerGetEndOwner (gncInvoiceGetOwner (invoice));
-  return (gncOwnerGetType (owner));
+    owner = gncOwnerGetEndOwner (gncInvoiceGetOwner (invoice));
+    return (gncOwnerGetType (owner));
 }
 
 static gnc_numeric
 gncInvoiceGetTotalInternal (GncInvoice *invoice, gboolean use_value,
-			    gboolean use_tax,
-			    gboolean use_payment_type, GncEntryPaymentType type)
+                            gboolean use_tax,
+                            gboolean use_payment_type, GncEntryPaymentType type)
 {
-  GList *node;
-  gnc_numeric total = gnc_numeric_zero();
-  gboolean reverse;
+    GList *node;
+    gnc_numeric total = gnc_numeric_zero();
+    gboolean reverse;
 
-  g_return_val_if_fail (invoice, total);
+    g_return_val_if_fail (invoice, total);
 
-  reverse = (gncInvoiceGetOwnerType (invoice) == GNC_OWNER_CUSTOMER);
+    reverse = (gncInvoiceGetOwnerType (invoice) == GNC_OWNER_CUSTOMER);
 
-  for (node = gncInvoiceGetEntries(invoice); node; node = node->next) {
-    GncEntry *entry = node->data;
-    gnc_numeric value, tax;
+    for (node = gncInvoiceGetEntries(invoice); node; node = node->next)
+    {
+        GncEntry *entry = node->data;
+        gnc_numeric value, tax;
 
-    if (use_payment_type && gncEntryGetBillPayment (entry) != type)
-      continue;
+        if (use_payment_type && gncEntryGetBillPayment (entry) != type)
+            continue;
 
-    gncEntryGetValue (entry, reverse, &value, NULL, &tax, NULL);
-    
-    if (gnc_numeric_check (value) == GNC_ERROR_OK) {
-      if (use_value)
-	total = gnc_numeric_add (total, value, GNC_DENOM_AUTO, GNC_DENOM_LCD);
-    } else
-      g_warning ("bad value in our entry");
+        gncEntryGetValue (entry, reverse, &value, NULL, &tax, NULL);
 
-    if (gnc_numeric_check (tax) == GNC_ERROR_OK) {
-      if (use_tax)
-	total = gnc_numeric_add (total, tax, GNC_DENOM_AUTO, GNC_DENOM_LCD);
-    } else
-      g_warning ("bad tax-value in our entry");
-  }
-  return total;
+        if (gnc_numeric_check (value) == GNC_ERROR_OK)
+        {
+            if (use_value)
+                total = gnc_numeric_add (total, value, GNC_DENOM_AUTO, GNC_DENOM_LCD);
+        }
+        else
+            g_warning ("bad value in our entry");
+
+        if (gnc_numeric_check (tax) == GNC_ERROR_OK)
+        {
+            if (use_tax)
+                total = gnc_numeric_add (total, tax, GNC_DENOM_AUTO, GNC_DENOM_LCD);
+        }
+        else
+            g_warning ("bad tax-value in our entry");
+    }
+    return total;
 }
 
 gnc_numeric gncInvoiceGetTotal (GncInvoice *invoice)
 {
-  if (!invoice) return gnc_numeric_zero();
-  return gncInvoiceGetTotalInternal(invoice, TRUE, TRUE, FALSE, 0);
+    if (!invoice) return gnc_numeric_zero();
+    return gncInvoiceGetTotalInternal(invoice, TRUE, TRUE, FALSE, 0);
 }
 
 gnc_numeric gncInvoiceGetTotalSubtotal (GncInvoice *invoice)
 {
-  if (!invoice) return gnc_numeric_zero();
-  return gncInvoiceGetTotalInternal(invoice, TRUE, FALSE, FALSE, 0);
+    if (!invoice) return gnc_numeric_zero();
+    return gncInvoiceGetTotalInternal(invoice, TRUE, FALSE, FALSE, 0);
 }
 
 gnc_numeric gncInvoiceGetTotalTax (GncInvoice *invoice)
 {
-  if (!invoice) return gnc_numeric_zero();
-  return gncInvoiceGetTotalInternal(invoice, FALSE, TRUE, FALSE, 0);
+    if (!invoice) return gnc_numeric_zero();
+    return gncInvoiceGetTotalInternal(invoice, FALSE, TRUE, FALSE, 0);
 }
 
 gnc_numeric gncInvoiceGetTotalOf (GncInvoice *invoice, GncEntryPaymentType type)
 {
-  if (!invoice) return gnc_numeric_zero();
-  return gncInvoiceGetTotalInternal(invoice, TRUE, TRUE, TRUE, type);
+    if (!invoice) return gnc_numeric_zero();
+    return gncInvoiceGetTotalInternal(invoice, TRUE, TRUE, TRUE, type);
 }
 
 const char * gncInvoiceGetType (GncInvoice *invoice)
 {
-  if (!invoice) return NULL;
+    if (!invoice) return NULL;
 
-  switch (gncInvoiceGetOwnerType (invoice)) {
-  case GNC_OWNER_CUSTOMER:
-    return _("Invoice");
-  case GNC_OWNER_VENDOR:
-    return _("Bill");
-  case GNC_OWNER_EMPLOYEE:
-    return _("Expense");
-  default:
-    return NULL;
-  }
+    switch (gncInvoiceGetOwnerType (invoice))
+    {
+    case GNC_OWNER_CUSTOMER:
+        return _("Invoice");
+    case GNC_OWNER_VENDOR:
+        return _("Bill");
+    case GNC_OWNER_EMPLOYEE:
+        return _("Expense");
+    default:
+        return NULL;
+    }
 }
 
 gnc_commodity * gncInvoiceGetCurrency (const GncInvoice *invoice)
 {
-  if (!invoice) return NULL;
-  return invoice->currency;
+    if (!invoice) return NULL;
+    return invoice->currency;
 }
 
 GncOwner * gncInvoiceGetBillTo (GncInvoice *invoice)
 {
-  if (!invoice) return NULL;
-  return &invoice->billto;
+    if (!invoice) return NULL;
+    return &invoice->billto;
 }
 
 GNCLot * gncInvoiceGetPostedLot (const GncInvoice *invoice)
 {
-  if (!invoice) return NULL;
-  return invoice->posted_lot;
+    if (!invoice) return NULL;
+    return invoice->posted_lot;
 }
 
 Transaction * gncInvoiceGetPostedTxn (const GncInvoice *invoice)
 {
-  if (!invoice) return NULL;
-  return invoice->posted_txn;
+    if (!invoice) return NULL;
+    return invoice->posted_txn;
 }
 
 Account * gncInvoiceGetPostedAcc (const GncInvoice *invoice)
 {
-  if (!invoice) return NULL;
-  return invoice->posted_acc;
+    if (!invoice) return NULL;
+    return invoice->posted_acc;
 }
 
 gboolean gncInvoiceGetActive (const GncInvoice *invoice)
 {
-  if (!invoice) return FALSE;
-  return invoice->active;
+    if (!invoice) return FALSE;
+    return invoice->active;
 }
 
 
 gnc_numeric gncInvoiceGetToChargeAmount (const GncInvoice *invoice)
 {
-  if (!invoice) return gnc_numeric_zero();
-  return invoice->to_charge_amount;
+    if (!invoice) return gnc_numeric_zero();
+    return invoice->to_charge_amount;
 }
 
 EntryList * gncInvoiceGetEntries (GncInvoice *invoice)
 {
-  if (!invoice) return NULL;
-  return invoice->entries;
+    if (!invoice) return NULL;
+    return invoice->entries;
 }
 
 GList * gncInvoiceGetPrices(GncInvoice *invoice)
 {
-  if (!invoice) return NULL;
-  return invoice->prices;
+    if (!invoice) return NULL;
+    return invoice->prices;
 }
 
 GNCPrice * gncInvoiceGetPrice(GncInvoice *invoice, gnc_commodity *commodity)
 {
-  GList *node=g_list_first(invoice->prices);
+    GList *node = g_list_first(invoice->prices);
 
-  while (node != NULL)
-  {
-    GNCPrice *curr = (GNCPrice*)node->data;
+    while (node != NULL)
+    {
+        GNCPrice *curr = (GNCPrice*)node->data;
 
-    if (gnc_commodity_equal(commodity, gnc_price_get_commodity(curr)))
-        return curr;
+        if (gnc_commodity_equal(commodity, gnc_price_get_commodity(curr)))
+            return curr;
 
-    node = g_list_next(node);
-  }
+        node = g_list_next(node);
+    }
 
-  return NULL;
+    return NULL;
 }
 
 static QofCollection*
 qofInvoiceGetEntries (GncInvoice *invoice)
 {
-	QofCollection *entry_coll;
-	GList         *list;
-	QofInstance     *entry;
+    QofCollection *entry_coll;
+    GList         *list;
+    QofInstance     *entry;
 
-	entry_coll = qof_collection_new(GNC_ID_ENTRY);
-	for(list = gncInvoiceGetEntries(invoice); list != NULL; list = list->next)
-	{
-		entry = QOF_INSTANCE(list->data);
-		qof_collection_add_entity(entry_coll, entry);
-	}
-	return entry_coll;
+    entry_coll = qof_collection_new(GNC_ID_ENTRY);
+    for (list = gncInvoiceGetEntries(invoice); list != NULL; list = list->next)
+    {
+        entry = QOF_INSTANCE(list->data);
+        qof_collection_add_entity(entry_coll, entry);
+    }
+    return entry_coll;
 }
 
 static void
 qofInvoiceEntryCB (QofInstance *ent, gpointer user_data)
 {
-	GncInvoice *invoice;
+    GncInvoice *invoice;
 
-	invoice = (GncInvoice*)user_data;
-	if(!invoice || !ent) { return; }
-	switch (gncInvoiceGetOwnerType (invoice)) {
-		case GNC_OWNER_VENDOR: {
-		gncBillAddEntry (invoice, (GncEntry*) ent);
-		break;
-		}
-		default : {
-			gncInvoiceAddEntry(invoice, (GncEntry*)ent);
-			break;
-		}
-	}
+    invoice = (GncInvoice*)user_data;
+    if (!invoice || !ent)
+    {
+        return;
+    }
+    switch (gncInvoiceGetOwnerType (invoice))
+    {
+    case GNC_OWNER_VENDOR:
+    {
+        gncBillAddEntry (invoice, (GncEntry*) ent);
+        break;
+    }
+    default :
+    {
+        gncInvoiceAddEntry(invoice, (GncEntry*)ent);
+        break;
+    }
+    }
 }
 
-static void 
+static void
 qofInvoiceSetEntries(GncInvoice *invoice, QofCollection *entry_coll)
 {
-	if(!entry_coll) { return; }
-	if(0 == safe_strcmp(qof_collection_get_type(entry_coll), GNC_ID_ENTRY))
-	{
-		qof_collection_foreach(entry_coll, qofInvoiceEntryCB, invoice);
-	}
+    if (!entry_coll)
+    {
+        return;
+    }
+    if (0 == safe_strcmp(qof_collection_get_type(entry_coll), GNC_ID_ENTRY))
+    {
+        qof_collection_foreach(entry_coll, qofInvoiceEntryCB, invoice);
+    }
 }
 
 static GncJob*
 qofInvoiceGetJob (const GncInvoice *invoice)
 {
-	if(!invoice) { return NULL; }
-	return invoice->job;
+    if (!invoice)
+    {
+        return NULL;
+    }
+    return invoice->job;
 }
 
-static void 
+static void
 qofInvoiceSetJob (GncInvoice *invoice, GncJob *job)
 {
-	if(!invoice) { return; }
-	invoice->job = job;
+    if (!invoice)
+    {
+        return;
+    }
+    invoice->job = job;
 }
 
 static void
 gncInvoiceDetachFromLot (GNCLot *lot)
 {
-  KvpFrame *kvp;
+    KvpFrame *kvp;
 
-  if (!lot) return;
+    if (!lot) return;
 
-  kvp = gnc_lot_get_slots (lot);
-  kvp_frame_set_slot_path (kvp, NULL, GNC_INVOICE_ID, GNC_INVOICE_GUID, NULL);
+    kvp = gnc_lot_get_slots (lot);
+    kvp_frame_set_slot_path (kvp, NULL, GNC_INVOICE_ID, GNC_INVOICE_GUID, NULL);
 }
 
 static void
 gncInvoiceAttachToLot (GncInvoice *invoice, GNCLot *lot)
 {
-  KvpFrame *kvp;
-  KvpValue *value;
-  
-  if (!invoice || !lot)
-    return;
+    KvpFrame *kvp;
+    KvpValue *value;
 
-  if (invoice->posted_lot) return;	/* Cannot reset invoice's lot */
+    if (!invoice || !lot)
+        return;
 
-  kvp = gnc_lot_get_slots (lot);
-  value = kvp_value_new_guid (qof_instance_get_guid (QOF_INSTANCE(invoice)));
-  kvp_frame_set_slot_path (kvp, value, GNC_INVOICE_ID, GNC_INVOICE_GUID, NULL);
-  kvp_value_delete (value);
-  gncInvoiceSetPostedLot (invoice, lot);
+    if (invoice->posted_lot) return;	/* Cannot reset invoice's lot */
+
+    kvp = gnc_lot_get_slots (lot);
+    value = kvp_value_new_guid (qof_instance_get_guid (QOF_INSTANCE(invoice)));
+    kvp_frame_set_slot_path (kvp, value, GNC_INVOICE_ID, GNC_INVOICE_GUID, NULL);
+    kvp_value_delete (value);
+    gncInvoiceSetPostedLot (invoice, lot);
 }
 
 GncInvoice * gncInvoiceGetInvoiceFromLot (GNCLot *lot)
 {
-  KvpFrame *kvp;
-  KvpValue *value;
-  GUID *guid;
-  QofBook *book;
+    KvpFrame *kvp;
+    KvpValue *value;
+    GUID *guid;
+    QofBook *book;
 
-  if (!lot) return NULL;
+    if (!lot) return NULL;
 
-  book = gnc_lot_get_book (lot);
-  kvp = gnc_lot_get_slots (lot);
-  value = kvp_frame_get_slot_path (kvp, GNC_INVOICE_ID, GNC_INVOICE_GUID, NULL);
-  if (!value) return NULL;
+    book = gnc_lot_get_book (lot);
+    kvp = gnc_lot_get_slots (lot);
+    value = kvp_frame_get_slot_path (kvp, GNC_INVOICE_ID, GNC_INVOICE_GUID, NULL);
+    if (!value) return NULL;
 
-  guid = kvp_value_get_guid (value);
-  return gncInvoiceLookup(book, guid);
+    guid = kvp_value_get_guid (value);
+    return gncInvoiceLookup(book, guid);
 }
 
 static void
 gncInvoiceAttachToTxn (GncInvoice *invoice, Transaction *txn)
 {
-  KvpFrame *kvp;
-  KvpValue *value;
-  
-  if (!invoice || !txn)
-    return;
+    KvpFrame *kvp;
+    KvpValue *value;
 
-  if (invoice->posted_txn) return;	/* Cannot reset invoice's txn */
+    if (!invoice || !txn)
+        return;
 
-  xaccTransBeginEdit (txn);
-  kvp = xaccTransGetSlots (txn);
-  value = kvp_value_new_guid (qof_instance_get_guid(QOF_INSTANCE(invoice)));
-  kvp_frame_set_slot_path (kvp, value, GNC_INVOICE_ID, GNC_INVOICE_GUID, NULL);
-  kvp_value_delete (value);
-  xaccTransSetTxnType (txn, TXN_TYPE_INVOICE);
-  xaccTransCommitEdit (txn);
-  gncInvoiceSetPostedTxn (invoice, txn);
+    if (invoice->posted_txn) return;	/* Cannot reset invoice's txn */
+
+    xaccTransBeginEdit (txn);
+    kvp = xaccTransGetSlots (txn);
+    value = kvp_value_new_guid (qof_instance_get_guid(QOF_INSTANCE(invoice)));
+    kvp_frame_set_slot_path (kvp, value, GNC_INVOICE_ID, GNC_INVOICE_GUID, NULL);
+    kvp_value_delete (value);
+    xaccTransSetTxnType (txn, TXN_TYPE_INVOICE);
+    xaccTransCommitEdit (txn);
+    gncInvoiceSetPostedTxn (invoice, txn);
 }
 
-GncInvoice * 
+GncInvoice *
 gncInvoiceGetInvoiceFromTxn (const Transaction *txn)
 {
-  KvpFrame *kvp;
-  KvpValue *value;
-  GUID *guid;
-  QofBook *book;
+    KvpFrame *kvp;
+    KvpValue *value;
+    GUID *guid;
+    QofBook *book;
 
-  if (!txn) return NULL;
+    if (!txn) return NULL;
 
-  book = xaccTransGetBook (txn);
-  kvp = xaccTransGetSlots (txn);
-  value = kvp_frame_get_slot_path (kvp, GNC_INVOICE_ID, GNC_INVOICE_GUID, NULL);
-  if (!value) return NULL;
+    book = xaccTransGetBook (txn);
+    kvp = xaccTransGetSlots (txn);
+    value = kvp_frame_get_slot_path (kvp, GNC_INVOICE_ID, GNC_INVOICE_GUID, NULL);
+    if (!value) return NULL;
 
-  guid = kvp_value_get_guid (value);
-  return gncInvoiceLookup(book,guid);
+    guid = kvp_value_get_guid (value);
+    return gncInvoiceLookup(book, guid);
 }
 
-struct lotmatch {
-  GncOwner *owner;
-  gboolean reverse;
+struct lotmatch
+{
+    GncOwner *owner;
+    gboolean reverse;
 };
 
 static gboolean
 gnc_lot_match_owner_payment (GNCLot *lot, gpointer user_data)
 {
-  struct lotmatch *lm = user_data;
-  GncOwner owner_def, *owner;
-  gnc_numeric balance = gnc_lot_get_balance (lot);
+    struct lotmatch *lm = user_data;
+    GncOwner owner_def, *owner;
+    gnc_numeric balance = gnc_lot_get_balance (lot);
 
-  /* Is this a payment lot */
-  if (gnc_numeric_positive_p (lm->reverse ? balance :
-			      gnc_numeric_neg (balance)))
-    return FALSE;
+    /* Is this a payment lot */
+    if (gnc_numeric_positive_p (lm->reverse ? balance :
+                                gnc_numeric_neg (balance)))
+        return FALSE;
 
-  /* Is there an invoice attached? */
-  if (gncInvoiceGetInvoiceFromLot (lot))
-    return FALSE;
+    /* Is there an invoice attached? */
+    if (gncInvoiceGetInvoiceFromLot (lot))
+        return FALSE;
 
-  /* Is it ours? */
-  if (!gncOwnerGetOwnerFromLot (lot, &owner_def))
-    return FALSE;
-  owner = gncOwnerGetEndOwner (&owner_def);
+    /* Is it ours? */
+    if (!gncOwnerGetOwnerFromLot (lot, &owner_def))
+        return FALSE;
+    owner = gncOwnerGetEndOwner (&owner_def);
 
-  return gncOwnerEqual (owner, lm->owner);
+    return gncOwnerEqual (owner, lm->owner);
 }
 
 Transaction * gncInvoicePostToAccount (GncInvoice *invoice, Account *acc,
-				       Timespec *post_date, Timespec *due_date,
-				       const char * memo, gboolean accumulatesplits)
+                                       Timespec *post_date, Timespec *due_date,
+                                       const char * memo, gboolean accumulatesplits)
 {
-  Transaction *txn;
-  QofBook *book;
-  GNCLot *lot = NULL;
-  GList *iter;
-  GList *splitinfo = NULL;
-  gnc_numeric total;
-  gboolean reverse;
-  const char *name, *type;
-  char *lot_title;
-  Account *ccard_acct = NULL;
-  GncOwner *owner;
+    Transaction *txn;
+    QofBook *book;
+    GNCLot *lot = NULL;
+    GList *iter;
+    GList *splitinfo = NULL;
+    gnc_numeric total;
+    gboolean reverse;
+    const char *name, *type;
+    char *lot_title;
+    Account *ccard_acct = NULL;
+    GncOwner *owner;
 
-  if (!invoice || !acc) return NULL;
+    if (!invoice || !acc) return NULL;
 
-  gncInvoiceBeginEdit (invoice);
-  book = qof_instance_get_book(invoice);
+    gncInvoiceBeginEdit (invoice);
+    book = qof_instance_get_book(invoice);
 
-  /* Stabilize the Billing Terms of this invoice */
-  if (invoice->terms)
-    gncInvoiceSetTerms (invoice,
-			gncBillTermReturnChild (invoice->terms, TRUE));
+    /* 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);
+    /* Figure out if we need to "reverse" the numbers. */
+    reverse = (gncInvoiceGetOwnerType (invoice) == GNC_OWNER_CUSTOMER);
 
-  /* Figure out if we need to separate out "credit-card" items */
-  owner = gncOwnerGetEndOwner (gncInvoiceGetOwner (invoice));
-  if (gncInvoiceGetOwnerType (invoice) == GNC_OWNER_EMPLOYEE)
-    ccard_acct = gncEmployeeGetCCard (gncOwnerGetEmployee (owner));
+    /* Figure out if we need to separate out "credit-card" items */
+    owner = gncOwnerGetEndOwner (gncInvoiceGetOwner (invoice));
+    if (gncInvoiceGetOwnerType (invoice) == GNC_OWNER_EMPLOYEE)
+        ccard_acct = gncEmployeeGetCCard (gncOwnerGetEmployee (owner));
 
-  /* Find an existing payment-lot for this owner */
-  {
-    LotList *lot_list;
-    struct lotmatch lm;
+    /* Find an existing payment-lot for this owner */
+    {
+        LotList *lot_list;
+        struct lotmatch lm;
 
-    lm.reverse = reverse;
-    lm.owner = owner;
+        lm.reverse = reverse;
+        lm.owner = owner;
 
-    lot_list = xaccAccountFindOpenLots (acc, gnc_lot_match_owner_payment,
-					&lm, NULL);
-    if (lot_list)
-      lot = lot_list->data;
+        lot_list = xaccAccountFindOpenLots (acc, gnc_lot_match_owner_payment,
+                                            &lm, NULL);
+        if (lot_list)
+            lot = lot_list->data;
 
-    g_list_free (lot_list);
-  }
+        g_list_free (lot_list);
+    }
 
-  /* Create a new lot for this invoice, if we need to do so */
-  if (!lot)
-    lot = gnc_lot_new (book);
-  gnc_lot_begin_edit (lot);
+    /* Create a new lot for this invoice, if we need to do so */
+    if (!lot)
+        lot = gnc_lot_new (book);
+    gnc_lot_begin_edit (lot);
 
-  type = gncInvoiceGetType (invoice);
+    type = gncInvoiceGetType (invoice);
 
-  /* Set the lot title */
-  lot_title = g_strdup_printf ("%s %s", type, gncInvoiceGetID (invoice));
-  gnc_lot_set_title (lot, lot_title);
-  g_free (lot_title);
+    /* Set the lot title */
+    lot_title = g_strdup_printf ("%s %s", type, gncInvoiceGetID (invoice));
+    gnc_lot_set_title (lot, lot_title);
+    g_free (lot_title);
 
-  /* Create a new transaction */
-  txn = xaccMallocTransaction (book);
-  xaccTransBeginEdit (txn);
+    /* Create a new transaction */
+    txn = xaccMallocTransaction (book);
+    xaccTransBeginEdit (txn);
 
-  name = gncOwnerGetName (gncOwnerGetEndOwner (gncInvoiceGetOwner (invoice)));
+    name = gncOwnerGetName (gncOwnerGetEndOwner (gncInvoiceGetOwner (invoice)));
 
-  /* Set Transaction Description (Owner Name) , Num (invoice ID), Currency */
-  xaccTransSetDescription (txn, name ? name : "");
-  xaccTransSetNum (txn, gncInvoiceGetID (invoice));
-  xaccTransSetCurrency (txn, invoice->currency);
+    /* Set Transaction Description (Owner Name) , Num (invoice ID), Currency */
+    xaccTransSetDescription (txn, name ? name : "");
+    xaccTransSetNum (txn, gncInvoiceGetID (invoice));
+    xaccTransSetCurrency (txn, invoice->currency);
 
-  /* Entered and Posted at date */
-  xaccTransSetDateEnteredSecs (txn, time(NULL));
-  if (post_date) {
-    xaccTransSetDatePostedTS (txn, post_date);
-    gncInvoiceSetDatePosted (invoice, *post_date);
-  }
+    /* Entered and Posted at date */
+    xaccTransSetDateEnteredSecs (txn, time(NULL));
+    if (post_date)
+    {
+        xaccTransSetDatePostedTS (txn, post_date);
+        gncInvoiceSetDatePosted (invoice, *post_date);
+    }
 
-  if (due_date)
-    xaccTransSetDateDueTS (txn, due_date);
+    if (due_date)
+        xaccTransSetDateDueTS (txn, due_date);
 
-  /* Iterate through the entries; sum up everything for each account.
-   * then create the appropriate splits in this txn.
-   */
-  total = gnc_numeric_zero();
-  for (iter = gncInvoiceGetEntries(invoice); iter; iter = iter->next) {
-    gnc_numeric value, tax;
-    GList *taxes;
-    GncEntry * entry = iter->data;
-    Account *this_acc;
+    /* Iterate through the entries; sum up everything for each account.
+     * then create the appropriate splits in this txn.
+     */
+    total = gnc_numeric_zero();
+    for (iter = gncInvoiceGetEntries(invoice); iter; iter = iter->next)
+    {
+        gnc_numeric value, tax;
+        GList *taxes;
+        GncEntry * entry = iter->data;
+        Account *this_acc;
 
-    /* Stabilize the TaxTable in this entry */
-    gncEntryBeginEdit (entry);
-    if (reverse)
-      gncEntrySetInvTaxTable
-	(entry, gncTaxTableReturnChild (gncEntryGetInvTaxTable (entry), TRUE));
-    else {
-      gncEntrySetBillTaxTable
-	(entry, gncTaxTableReturnChild (gncEntryGetBillTaxTable (entry), TRUE));
+        /* Stabilize the TaxTable in this entry */
+        gncEntryBeginEdit (entry);
+        if (reverse)
+            gncEntrySetInvTaxTable
+            (entry, gncTaxTableReturnChild (gncEntryGetInvTaxTable (entry), TRUE));
+        else
+        {
+            gncEntrySetBillTaxTable
+            (entry, gncTaxTableReturnChild (gncEntryGetBillTaxTable (entry), TRUE));
 
-      /* If this is a bill, and the entry is billable, copy the price */
-      if (gncEntryGetBillable (entry))
-	gncEntrySetInvPrice (entry, gncEntryGetBillPrice (entry));
-    }
-    gncEntryCommitEdit (entry);
+            /* If this is a bill, and the entry is billable, copy the price */
+            if (gncEntryGetBillable (entry))
+                gncEntrySetInvPrice (entry, gncEntryGetBillPrice (entry));
+        }
+        gncEntryCommitEdit (entry);
 
-    /* Obtain the Entry's Value and TaxValues */
-    gncEntryGetValue (entry, reverse, &value, NULL, &tax, &taxes);
+        /* Obtain the Entry's Value and TaxValues */
+        gncEntryGetValue (entry, reverse, &value, NULL, &tax, &taxes);
 
-    /* add the value for the account split */
-    this_acc = (reverse ? gncEntryGetInvAccount (entry) :
-		gncEntryGetBillAccount (entry));
-    if (this_acc) {
-      if (gnc_numeric_check (value) == GNC_ERROR_OK) {
-	if (accumulatesplits) {
-	    splitinfo = gncAccountValueAdd (splitinfo, this_acc, value);
-	} else {
-	  Split *split;
+        /* add the value for the account split */
+        this_acc = (reverse ? gncEntryGetInvAccount (entry) :
+                    gncEntryGetBillAccount (entry));
+        if (this_acc)
+        {
+            if (gnc_numeric_check (value) == GNC_ERROR_OK)
+            {
+                if (accumulatesplits)
+                {
+                    splitinfo = gncAccountValueAdd (splitinfo, this_acc, value);
+                }
+                else
+                {
+                    Split *split;
 
-	  split = xaccMallocSplit (book);
-	  /* set action and memo? */
+                    split = xaccMallocSplit (book);
+                    /* set action and memo? */
 
-	  xaccSplitSetMemo (split, gncEntryGetDescription (entry));
-	  xaccSplitSetAction (split, type);
+                    xaccSplitSetMemo (split, gncEntryGetDescription (entry));
+                    xaccSplitSetAction (split, type);
 
-	  /* Need to insert this split into the account AND txn before
-	   * we set the Base Value.  Otherwise SetBaseValue complains
-	   * that we don't have an account and fails to set the value.
-	   */
-	  xaccAccountBeginEdit (this_acc);
-	  xaccAccountInsertSplit (this_acc, split);
-	  xaccAccountCommitEdit (this_acc);
-	  xaccTransAppendSplit (txn, split);
+                    /* Need to insert this split into the account AND txn before
+                     * we set the Base Value.  Otherwise SetBaseValue complains
+                     * that we don't have an account and fails to set the value.
+                     */
+                    xaccAccountBeginEdit (this_acc);
+                    xaccAccountInsertSplit (this_acc, split);
+                    xaccAccountCommitEdit (this_acc);
+                    xaccTransAppendSplit (txn, split);
 
-	  if (gnc_commodity_equal(xaccAccountGetCommodity(this_acc), invoice->currency))
-	  {
-	      xaccSplitSetBaseValue (split, (reverse ? gnc_numeric_neg (value)
-					 : value),
-				 invoice->currency);
-	  }
-          else
-          {
-              /*need to do conversion */
-              GNCPrice *price = gncInvoiceGetPrice(invoice, xaccAccountGetCommodity(this_acc));
+                    if (gnc_commodity_equal(xaccAccountGetCommodity(this_acc), invoice->currency))
+                    {
+                        xaccSplitSetBaseValue (split, (reverse ? gnc_numeric_neg (value)
+                                                       : value),
+                                               invoice->currency);
+                    }
+                    else
+                    {
+                        /*need to do conversion */
+                        GNCPrice *price = gncInvoiceGetPrice(invoice, xaccAccountGetCommodity(this_acc));
 
-              if (price == NULL)
-              {
-                  /*This is an error, which shouldn't even be able to happen.
-                    We can't really do anything sensible about it, and this is
-		    a user-interface free zone so we can't try asking the user 
-                    again either, have to return NULL*/
-		  return NULL;
-              }
-              else
-              {
-                  gnc_numeric converted_amount;
-                  xaccSplitSetValue(split, (reverse ? gnc_numeric_neg(value): value));
-                  converted_amount = gnc_numeric_div(value, gnc_price_get_value(price), GNC_DENOM_AUTO, GNC_HOW_RND_ROUND);
-                  printf("converting from %f to %f\n", gnc_numeric_to_double(value), gnc_numeric_to_double(converted_amount));
-                  xaccSplitSetAmount(split, reverse ? gnc_numeric_neg(converted_amount): converted_amount);
-              }
-          }
-	}
+                        if (price == NULL)
+                        {
+                            /*This is an error, which shouldn't even be able to happen.
+                              We can't really do anything sensible about it, and this is
+                            		    a user-interface free zone so we can't try asking the user
+                              again either, have to return NULL*/
+                            return NULL;
+                        }
+                        else
+                        {
+                            gnc_numeric converted_amount;
+                            xaccSplitSetValue(split, (reverse ? gnc_numeric_neg(value) : value));
+                            converted_amount = gnc_numeric_div(value, gnc_price_get_value(price), GNC_DENOM_AUTO, GNC_HOW_RND_ROUND);
+                            printf("converting from %f to %f\n", gnc_numeric_to_double(value), gnc_numeric_to_double(converted_amount));
+                            xaccSplitSetAmount(split, reverse ? gnc_numeric_neg(converted_amount) : converted_amount);
+                        }
+                    }
+                }
 
-	/* If there is a credit-card account, and this is a CCard
-	 * payment type, the don't add it to the total, and instead
-	 * create a split to the CC Acct with a memo of the entry
-	 * description instead of the provided memo.  Note that the
-	 * value reversal is the same as the post account.
-	 *
-	 * Note: we don't have to worry about the tax values --
-	 * expense vouchers don't have them.
-	 */
-	if (ccard_acct && gncEntryGetBillPayment (entry) == GNC_PAYMENT_CARD) {
-	  Split *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
+                 * create a split to the CC Acct with a memo of the entry
+                 * description instead of the provided memo.  Note that the
+                 * value reversal is the same as the post account.
+                 *
+                 * Note: we don't have to worry about the tax values --
+                 * expense vouchers don't have them.
+                 */
+                if (ccard_acct && gncEntryGetBillPayment (entry) == GNC_PAYMENT_CARD)
+                {
+                    Split *split;
 
-	  split = xaccMallocSplit (book);
-	  /* set action? */
-	  xaccSplitSetMemo (split, gncEntryGetDescription (entry));
-	  xaccSplitSetAction (split, type);
-	  xaccAccountBeginEdit (ccard_acct);
-	  xaccAccountInsertSplit (ccard_acct, split);
-	  xaccAccountCommitEdit (ccard_acct);
-	  xaccTransAppendSplit (txn, split);
-	  xaccSplitSetBaseValue (split, (reverse ? value : gnc_numeric_neg (value)),
-				 invoice->currency);
-	  
-	} else
-	  total = gnc_numeric_add (total, value, GNC_DENOM_AUTO, GNC_DENOM_LCD);
+                    split = xaccMallocSplit (book);
+                    /* set action? */
+                    xaccSplitSetMemo (split, gncEntryGetDescription (entry));
+                    xaccSplitSetAction (split, type);
+                    xaccAccountBeginEdit (ccard_acct);
+                    xaccAccountInsertSplit (ccard_acct, split);
+                    xaccAccountCommitEdit (ccard_acct);
+                    xaccTransAppendSplit (txn, split);
+                    xaccSplitSetBaseValue (split, (reverse ? value : gnc_numeric_neg (value)),
+                                           invoice->currency);
 
-      } else
-	g_warning ("bad value in our entry");
-    }
+                }
+                else
+                    total = gnc_numeric_add (total, value, GNC_DENOM_AUTO, GNC_DENOM_LCD);
 
-    /* now merge in the TaxValues */
-    splitinfo = gncAccountValueAddList (splitinfo, taxes);
+            }
+            else
+                g_warning ("bad value in our entry");
+        }
 
-    /* ... and add the tax total */
-    if (gnc_numeric_check (tax) == GNC_ERROR_OK) 
-      total = gnc_numeric_add (total, tax, GNC_DENOM_AUTO, GNC_DENOM_LCD);
-    else
-      g_warning ("bad tax in our entry");
+        /* now merge in the TaxValues */
+        splitinfo = gncAccountValueAddList (splitinfo, taxes);
 
-  } /* for */
+        /* ... and add the tax total */
+        if (gnc_numeric_check (tax) == GNC_ERROR_OK)
+            total = gnc_numeric_add (total, tax, GNC_DENOM_AUTO, GNC_DENOM_LCD);
+        else
+            g_warning ("bad tax in our entry");
 
-  /* Iterate through the splitinfo list and generate the splits */
-  for (iter = splitinfo; iter; iter = iter->next) {
-    Split *split;
-    GncAccountValue *acc_val = iter->data;
+    } /* for */
 
-    split = xaccMallocSplit (book);
-    /* set action and memo? */
+    /* Iterate through the splitinfo list and generate the splits */
+    for (iter = splitinfo; iter; iter = iter->next)
+    {
+        Split *split;
+        GncAccountValue *acc_val = iter->data;
 
-    xaccSplitSetMemo (split, memo);
-    xaccSplitSetAction (split, type);
+        split = xaccMallocSplit (book);
+        /* set action and memo? */
 
-    xaccAccountBeginEdit (acc_val->account);
-    xaccAccountInsertSplit (acc_val->account, split);
-    xaccAccountCommitEdit (acc_val->account);
-    xaccTransAppendSplit (txn, split);
+        xaccSplitSetMemo (split, memo);
+        xaccSplitSetAction (split, type);
 
-    if (gnc_commodity_equal(xaccAccountGetCommodity(acc_val->account), invoice->currency))
-    {
-        xaccSplitSetBaseValue (split, (reverse ? gnc_numeric_neg (acc_val->value)
-                                       : acc_val->value),
-                               invoice->currency);
-    }
-    else
-    {
-        /*need to do conversion */
-        GNCPrice *price = gncInvoiceGetPrice(invoice, xaccAccountGetCommodity(acc_val->account));
+        xaccAccountBeginEdit (acc_val->account);
+        xaccAccountInsertSplit (acc_val->account, split);
+        xaccAccountCommitEdit (acc_val->account);
+        xaccTransAppendSplit (txn, split);
 
-        if (price == NULL)
+        if (gnc_commodity_equal(xaccAccountGetCommodity(acc_val->account), invoice->currency))
         {
-            /*This is an error, which shouldn't even be able to happen.
-              We can't really do anything sensible about it, and this is
-              a user-interface free zone so we can't try asking the user 
-              again either, have to return NULL*/
-            return NULL;
+            xaccSplitSetBaseValue (split, (reverse ? gnc_numeric_neg (acc_val->value)
+                                           : acc_val->value),
+                                   invoice->currency);
         }
         else
         {
-            gnc_numeric converted_amount;
-            xaccSplitSetValue(split, (reverse ? gnc_numeric_neg(acc_val->value): acc_val->value));
-            converted_amount = gnc_numeric_div(acc_val->value, gnc_price_get_value(price), GNC_DENOM_AUTO, GNC_HOW_RND_ROUND);
-            printf("converting from %f to %f\n", gnc_numeric_to_double(acc_val->value), gnc_numeric_to_double(converted_amount));
+            /*need to do conversion */
+            GNCPrice *price = gncInvoiceGetPrice(invoice, xaccAccountGetCommodity(acc_val->account));
 
-            xaccSplitSetAmount(split, reverse ? gnc_numeric_neg(converted_amount): converted_amount);
+            if (price == NULL)
+            {
+                /*This is an error, which shouldn't even be able to happen.
+                  We can't really do anything sensible about it, and this is
+                  a user-interface free zone so we can't try asking the user
+                  again either, have to return NULL*/
+                return NULL;
+            }
+            else
+            {
+                gnc_numeric converted_amount;
+                xaccSplitSetValue(split, (reverse ? gnc_numeric_neg(acc_val->value) : acc_val->value));
+                converted_amount = gnc_numeric_div(acc_val->value, gnc_price_get_value(price), GNC_DENOM_AUTO, GNC_HOW_RND_ROUND);
+                printf("converting from %f to %f\n", gnc_numeric_to_double(acc_val->value), gnc_numeric_to_double(converted_amount));
+
+                xaccSplitSetAmount(split, reverse ? gnc_numeric_neg(converted_amount) : converted_amount);
+            }
         }
     }
-  }
 
-  /* 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 (book);
+    /* 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 (book);
 
-    /* Set memo.  action? */
-    xaccSplitSetMemo (split, _("Extra to Charge Card"));
-    xaccSplitSetAction (split, type);
-    
-    xaccAccountBeginEdit (ccard_acct);
-    xaccAccountInsertSplit (ccard_acct, split);
-    xaccAccountCommitEdit (ccard_acct);
-    xaccTransAppendSplit (txn, split);
-    xaccSplitSetBaseValue (split, (reverse ? invoice->to_charge_amount :
-				   gnc_numeric_neg(invoice->to_charge_amount)),
-			   invoice->currency);
+        /* Set memo.  action? */
+        xaccSplitSetMemo (split, _("Extra to Charge Card"));
+        xaccSplitSetAction (split, type);
 
-    total = gnc_numeric_sub (total, invoice->to_charge_amount,
-			     GNC_DENOM_AUTO, GNC_DENOM_LCD);
-  }
+        xaccAccountBeginEdit (ccard_acct);
+        xaccAccountInsertSplit (ccard_acct, split);
+        xaccAccountCommitEdit (ccard_acct);
+        xaccTransAppendSplit (txn, split);
+        xaccSplitSetBaseValue (split, (reverse ? invoice->to_charge_amount :
+                                       gnc_numeric_neg(invoice->to_charge_amount)),
+                               invoice->currency);
 
-  /* Now create the Posted split (which is negative -- it's a credit) */
-  {
-    Split *split = xaccMallocSplit (book);
+        total = gnc_numeric_sub (total, invoice->to_charge_amount,
+                                 GNC_DENOM_AUTO, GNC_DENOM_LCD);
+    }
 
-    /* Set action/memo */
-    xaccSplitSetMemo (split, memo);
-    xaccSplitSetAction (split, type);
-			   
-    xaccAccountBeginEdit (acc);
-    xaccAccountInsertSplit (acc, split);
-    xaccAccountCommitEdit (acc);
-    xaccTransAppendSplit (txn, split);
-    xaccSplitSetBaseValue (split, (reverse ? total : gnc_numeric_neg (total)),
-			   invoice->currency);
+    /* Now create the Posted split (which is negative -- it's a credit) */
+    {
+        Split *split = xaccMallocSplit (book);
 
-    /* add this split to the lot */
-    gnc_lot_add_split (lot, split);
-  }
+        /* Set action/memo */
+        xaccSplitSetMemo (split, memo);
+        xaccSplitSetAction (split, type);
 
-  /* Now attach this invoice to the txn, lot, and account */
-  gncInvoiceAttachToLot (invoice, lot);
-  gncInvoiceAttachToTxn (invoice, txn);
-  gncInvoiceSetPostedAcc (invoice, acc);
+        xaccAccountBeginEdit (acc);
+        xaccAccountInsertSplit (acc, split);
+        xaccAccountCommitEdit (acc);
+        xaccTransAppendSplit (txn, split);
+        xaccSplitSetBaseValue (split, (reverse ? total : gnc_numeric_neg (total)),
+                               invoice->currency);
 
-  xaccTransSetReadOnly (txn, _("Generated from an invoice.  Try unposting the invoice."));
-  xaccTransCommitEdit (txn);
+        /* add this split to the lot */
+        gnc_lot_add_split (lot, split);
+    }
 
-  gncAccountValueDestroy (splitinfo);
+    /* Now attach this invoice to the txn, lot, and account */
+    gncInvoiceAttachToLot (invoice, lot);
+    gncInvoiceAttachToTxn (invoice, txn);
+    gncInvoiceSetPostedAcc (invoice, acc);
 
-  /* check the lot -- if we still look like a payment lot, then that
-   * means we need to create a balancing split and create a new payment
-   * lot for the next invoice
-   *
-   * we're looking for a positive balance for bill/AP, and a negative balance
-   * for invoice/AR.
-   * (because bill payments debit AP accounts and invoice payments
-   * credit AR accounts)
-   */
-  total = gnc_lot_get_balance (lot);
-  
-  if ( (gnc_numeric_negative_p (total) && reverse) || 
-       (gnc_numeric_positive_p (total) && !reverse) ) {
-    Transaction *t2;
-    GNCLot *lot2;
-    Split *split;
-    /* Translators: This is the memo of an auto-created split */
-    char *memo2 = _("Automatic Payment Forward");
-    char *action2 = _("Auto Split");
+    xaccTransSetReadOnly (txn, _("Generated from an invoice.  Try unposting the invoice."));
+    xaccTransCommitEdit (txn);
 
-    t2 = xaccMallocTransaction (book);
-    lot2 = gnc_lot_new (book);
-	gnc_lot_begin_edit (lot2);
-    gncOwnerAttachToLot (gncOwnerGetEndOwner (gncInvoiceGetOwner (invoice)),
-			 lot2);
-    
-    xaccTransBeginEdit (t2);
-    xaccAccountBeginEdit (acc);
+    gncAccountValueDestroy (splitinfo);
 
-    /* Set Transaction Description (Owner Name), Currency */
-    xaccTransSetDescription (t2, name ? name : "");
-    xaccTransSetCurrency (t2, invoice->currency);
+    /* check the lot -- if we still look like a payment lot, then that
+     * means we need to create a balancing split and create a new payment
+     * lot for the next invoice
+     *
+     * we're looking for a positive balance for bill/AP, and a negative balance
+     * for invoice/AR.
+     * (because bill payments debit AP accounts and invoice payments
+     * credit AR accounts)
+     */
+    total = gnc_lot_get_balance (lot);
 
-    /* Entered and Posted at date */
-    xaccTransSetDateEnteredSecs (t2, time(NULL));
-    if (post_date)
-      xaccTransSetDatePostedTS (t2, post_date);
+    if ( (gnc_numeric_negative_p (total) && reverse) ||
+            (gnc_numeric_positive_p (total) && !reverse) )
+    {
+        Transaction *t2;
+        GNCLot *lot2;
+        Split *split;
+        /* Translators: This is the memo of an auto-created split */
+        char *memo2 = _("Automatic Payment Forward");
+        char *action2 = _("Auto Split");
 
-    /* Balance out this lot */
-    split = xaccMallocSplit (book);
-    xaccSplitSetMemo (split, memo2);
-    xaccSplitSetAction (split, action2);
-    xaccAccountInsertSplit (acc, split);
-    xaccTransAppendSplit (t2, split);
-    // the value of total used here is correct for both bill/AP and
-    // invoice/AR. See the comment before this if block
-    xaccSplitSetBaseValue (split, gnc_numeric_neg (total),
-			   invoice->currency);
-    gnc_lot_add_split (lot, split);
+        t2 = xaccMallocTransaction (book);
+        lot2 = gnc_lot_new (book);
+        gnc_lot_begin_edit (lot2);
+        gncOwnerAttachToLot (gncOwnerGetEndOwner (gncInvoiceGetOwner (invoice)),
+                             lot2);
 
-    /* And apply the pre-payment to a new lot */
-    split = xaccMallocSplit (book);
-    xaccSplitSetMemo (split, memo2);
-    xaccSplitSetAction (split, action2);
-    xaccAccountInsertSplit (acc, split);
-    xaccTransAppendSplit (t2, split);
-    xaccSplitSetBaseValue (split, total, invoice->currency);
-    gnc_lot_add_split (lot2, split);
+        xaccTransBeginEdit (t2);
+        xaccAccountBeginEdit (acc);
 
-	gnc_lot_commit_edit (lot2);
-    xaccTransCommitEdit (t2);
-    xaccAccountCommitEdit (acc);
-  }
+        /* Set Transaction Description (Owner Name), Currency */
+        xaccTransSetDescription (t2, name ? name : "");
+        xaccTransSetCurrency (t2, invoice->currency);
 
-  gnc_lot_commit_edit (lot);
-  gncInvoiceCommitEdit (invoice);
+        /* Entered and Posted at date */
+        xaccTransSetDateEnteredSecs (t2, time(NULL));
+        if (post_date)
+            xaccTransSetDatePostedTS (t2, post_date);
 
-  return txn;
+        /* Balance out this lot */
+        split = xaccMallocSplit (book);
+        xaccSplitSetMemo (split, memo2);
+        xaccSplitSetAction (split, action2);
+        xaccAccountInsertSplit (acc, split);
+        xaccTransAppendSplit (t2, split);
+        // the value of total used here is correct for both bill/AP and
+        // invoice/AR. See the comment before this if block
+        xaccSplitSetBaseValue (split, gnc_numeric_neg (total),
+                               invoice->currency);
+        gnc_lot_add_split (lot, split);
+
+        /* And apply the pre-payment to a new lot */
+        split = xaccMallocSplit (book);
+        xaccSplitSetMemo (split, memo2);
+        xaccSplitSetAction (split, action2);
+        xaccAccountInsertSplit (acc, split);
+        xaccTransAppendSplit (t2, split);
+        xaccSplitSetBaseValue (split, total, invoice->currency);
+        gnc_lot_add_split (lot2, split);
+
+        gnc_lot_commit_edit (lot2);
+        xaccTransCommitEdit (t2);
+        xaccAccountCommitEdit (acc);
+    }
+
+    gnc_lot_commit_edit (lot);
+    gncInvoiceCommitEdit (invoice);
+
+    return txn;
 }
 
 gboolean
 gncInvoiceUnpost (GncInvoice *invoice, gboolean reset_tax_tables)
 {
-  Transaction *txn;
-  GNCLot *lot;
+    Transaction *txn;
+    GNCLot *lot;
 
-  if (!invoice) return FALSE;
-  if (!gncInvoiceIsPosted (invoice)) return FALSE;
+    if (!invoice) return FALSE;
+    if (!gncInvoiceIsPosted (invoice)) return FALSE;
 
-  txn = gncInvoiceGetPostedTxn (invoice);
-  g_return_val_if_fail (txn, FALSE);
+    txn = gncInvoiceGetPostedTxn (invoice);
+    g_return_val_if_fail (txn, FALSE);
 
-  lot = gncInvoiceGetPostedLot (invoice);
-  g_return_val_if_fail (lot, FALSE);
+    lot = gncInvoiceGetPostedLot (invoice);
+    g_return_val_if_fail (lot, FALSE);
 
-  /* Destroy the Posted Transaction */
-  xaccTransClearReadOnly (txn);
-  xaccTransBeginEdit (txn);
-  xaccTransDestroy (txn);
-  xaccTransCommitEdit (txn);
+    /* Destroy the Posted Transaction */
+    xaccTransClearReadOnly (txn);
+    xaccTransBeginEdit (txn);
+    xaccTransDestroy (txn);
+    xaccTransCommitEdit (txn);
 
-  /* Disconnect the lot from the invoice; re-attach to the invoice owner */
-  gncInvoiceDetachFromLot (lot);
-  gncOwnerAttachToLot (&invoice->owner, lot);
+    /* Disconnect the lot from the invoice; re-attach to the invoice owner */
+    gncInvoiceDetachFromLot (lot);
+    gncOwnerAttachToLot (&invoice->owner, lot);
 
-  /* If the lot has no splits, then destroy it */
-  if (!gnc_lot_count_splits (lot))
-    gnc_lot_destroy (lot);
+    /* If the lot has no splits, then destroy it */
+    if (!gnc_lot_count_splits (lot))
+        gnc_lot_destroy (lot);
 
-  /* Clear out the invoice posted information */
-  gncInvoiceBeginEdit (invoice);
+    /* Clear out the invoice posted information */
+    gncInvoiceBeginEdit (invoice);
 
-  invoice->posted_acc = NULL;
-  invoice->posted_txn = NULL;
-  invoice->posted_lot = NULL;
-  invoice->date_posted.tv_sec = invoice->date_posted.tv_nsec = 0;
+    invoice->posted_acc = NULL;
+    invoice->posted_txn = NULL;
+    invoice->posted_lot = NULL;
+    invoice->date_posted.tv_sec = invoice->date_posted.tv_nsec = 0;
 
-  /* if we've been asked to reset the tax tables, then do so */
-  if (reset_tax_tables) {
-    gboolean reverse = (gncInvoiceGetOwnerType(invoice) == GNC_OWNER_CUSTOMER);
-    GList *iter;
+    /* if we've been asked to reset the tax tables, then do so */
+    if (reset_tax_tables)
+    {
+        gboolean reverse = (gncInvoiceGetOwnerType(invoice) == GNC_OWNER_CUSTOMER);
+        GList *iter;
 
-    for (iter = gncInvoiceGetEntries(invoice); iter; iter = iter->next) {
-      GncEntry *entry = iter->data;
+        for (iter = gncInvoiceGetEntries(invoice); iter; iter = iter->next)
+        {
+            GncEntry *entry = iter->data;
 
-      gncEntryBeginEdit(entry);
-      if (reverse)
-	gncEntrySetInvTaxTable(entry,
-			       gncTaxTableGetParent(gncEntryGetInvTaxTable(entry)));
-      else
-	gncEntrySetBillTaxTable(entry,
-			       gncTaxTableGetParent(gncEntryGetBillTaxTable(entry)));
-      gncEntryCommitEdit(entry);
+            gncEntryBeginEdit(entry);
+            if (reverse)
+                gncEntrySetInvTaxTable(entry,
+                                       gncTaxTableGetParent(gncEntryGetInvTaxTable(entry)));
+            else
+                gncEntrySetBillTaxTable(entry,
+                                        gncTaxTableGetParent(gncEntryGetBillTaxTable(entry)));
+            gncEntryCommitEdit(entry);
+        }
     }
-  }
 
-  mark_invoice (invoice);
-  gncInvoiceCommitEdit (invoice);
+    mark_invoice (invoice);
+    gncInvoiceCommitEdit (invoice);
 
-  return TRUE;
+    return TRUE;
 }
 
 static gboolean
 gnc_lot_match_invoice_owner (GNCLot *lot, gpointer user_data)
 {
-  GncOwner owner_def, *owner, *this_owner = user_data;
-  GncInvoice *invoice;
+    GncOwner owner_def, *owner, *this_owner = user_data;
+    GncInvoice *invoice;
 
-  /* If this lot is not for this owner, then ignore it */
-  invoice = gncInvoiceGetInvoiceFromLot (lot);
-  if (invoice) {
-    owner = gncInvoiceGetOwner (invoice);
-    owner = gncOwnerGetEndOwner (owner);
-  } else {
-    if (!gncOwnerGetOwnerFromLot (lot, &owner_def))
-      return FALSE;
-    owner = gncOwnerGetEndOwner (&owner_def);
-  }
+    /* If this lot is not for this owner, then ignore it */
+    invoice = gncInvoiceGetInvoiceFromLot (lot);
+    if (invoice)
+    {
+        owner = gncInvoiceGetOwner (invoice);
+        owner = gncOwnerGetEndOwner (owner);
+    }
+    else
+    {
+        if (!gncOwnerGetOwnerFromLot (lot, &owner_def))
+            return FALSE;
+        owner = gncOwnerGetEndOwner (&owner_def);
+    }
 
-  return gncOwnerEqual (owner, this_owner);
+    return gncOwnerEqual (owner, this_owner);
 }
 
 static gint
 gnc_lot_sort_func (GNCLot *a, GNCLot *b)
 {
-  GncInvoice *ia, *ib;
-  Timespec da, db;
+    GncInvoice *ia, *ib;
+    Timespec da, db;
 
-  ia = gncInvoiceGetInvoiceFromLot (a);
-  ib = gncInvoiceGetInvoiceFromLot (b);
+    ia = gncInvoiceGetInvoiceFromLot (a);
+    ib = gncInvoiceGetInvoiceFromLot (b);
 
-  da = gncInvoiceGetDateDue (ia);
-  db = gncInvoiceGetDateDue (ib);
+    da = gncInvoiceGetDateDue (ia);
+    db = gncInvoiceGetDateDue (ib);
 
-  return timespec_cmp (&da, &db);
+    return timespec_cmp (&da, &db);
 }
 
 /*
@@ -1472,263 +1534,276 @@
  */
 Transaction *
 gncOwnerApplyPayment (GncOwner *owner, GncInvoice* invoice,
-		      Account *posted_acc, Account *xfer_acc,
-		      gnc_numeric amount, gnc_numeric exch, Timespec date,
-		      const char *memo, const char *num)
+                      Account *posted_acc, Account *xfer_acc,
+                      gnc_numeric amount, gnc_numeric exch, Timespec date,
+                      const char *memo, const char *num)
 {
-  QofBook *book;
-  Account *inv_posted_acc;
-  Transaction *txn;
-  Split *split;
-  GList *lot_list, *fifo = NULL;
-  GNCLot *lot, *inv_posted_lot = NULL, *prepay_lot = NULL;
-  GncInvoice *this_invoice;
-  const char *name;
-  gnc_commodity *commodity;
-  gnc_numeric split_amt;
-  gboolean reverse, inv_passed = TRUE;
-  gnc_numeric payment_value=amount;
+    QofBook *book;
+    Account *inv_posted_acc;
+    Transaction *txn;
+    Split *split;
+    GList *lot_list, *fifo = NULL;
+    GNCLot *lot, *inv_posted_lot = NULL, *prepay_lot = NULL;
+    GncInvoice *this_invoice;
+    const char *name;
+    gnc_commodity *commodity;
+    gnc_numeric split_amt;
+    gboolean reverse, inv_passed = TRUE;
+    gnc_numeric payment_value = amount;
 
-  /* Verify our arguments */
-  if (!owner || !posted_acc || !xfer_acc) return NULL;
-  g_return_val_if_fail (owner->owner.undefined != NULL, NULL);
+    /* Verify our arguments */
+    if (!owner || !posted_acc || !xfer_acc) return NULL;
+    g_return_val_if_fail (owner->owner.undefined != NULL, NULL);
 
-  /* Compute the ancillary data */
-  book = gnc_account_get_book (posted_acc);
-  name = gncOwnerGetName (gncOwnerGetEndOwner (owner));
-  commodity = gncOwnerGetCurrency (owner);
-  reverse = (gncOwnerGetType (owner) == GNC_OWNER_CUSTOMER);
+    /* Compute the ancillary data */
+    book = gnc_account_get_book (posted_acc);
+    name = gncOwnerGetName (gncOwnerGetEndOwner (owner));
+    commodity = gncOwnerGetCurrency (owner);
+    reverse = (gncOwnerGetType (owner) == GNC_OWNER_CUSTOMER);
 
-  txn = xaccMallocTransaction (book);
-  xaccTransBeginEdit (txn);
+    txn = xaccMallocTransaction (book);
+    xaccTransBeginEdit (txn);
 
-  /* Set up the transaction */
-  xaccTransSetDescription (txn, name ? name : "");
-  xaccTransSetNum (txn, num);
-  xaccTransSetCurrency (txn, commodity);
-  xaccTransSetDateEnteredSecs (txn, time(NULL));
-  xaccTransSetDatePostedTS (txn, &date);
-  xaccTransSetTxnType (txn, TXN_TYPE_PAYMENT);
+    /* Set up the transaction */
+    xaccTransSetDescription (txn, name ? name : "");
+    xaccTransSetNum (txn, num);
+    xaccTransSetCurrency (txn, commodity);
+    xaccTransSetDateEnteredSecs (txn, time(NULL));
+    xaccTransSetDatePostedTS (txn, &date);
+    xaccTransSetTxnType (txn, TXN_TYPE_PAYMENT);
 
 
-  /* The split for the transfer account */
-  split = xaccMallocSplit (book);
-  xaccSplitSetMemo (split, memo);
-  xaccSplitSetAction (split, _("Payment"));
-  xaccAccountBeginEdit (xfer_acc);
-  xaccAccountInsertSplit (xfer_acc, split);
-  xaccAccountCommitEdit (xfer_acc);
-  xaccTransAppendSplit (txn, split);
+    /* The split for the transfer account */
+    split = xaccMallocSplit (book);
+    xaccSplitSetMemo (split, memo);
+    xaccSplitSetAction (split, _("Payment"));
+    xaccAccountBeginEdit (xfer_acc);
+    xaccAccountInsertSplit (xfer_acc, split);
+    xaccAccountCommitEdit (xfer_acc);
+    xaccTransAppendSplit (txn, split);
 
-  if (gnc_commodity_equal(xaccAccountGetCommodity(xfer_acc), commodity))
-  {
-      xaccSplitSetBaseValue (split, reverse ? amount :
-	    		     gnc_numeric_neg (amount), commodity);
-  }
-  else
-  {
-      /* Need to value the payment in terms of the owner commodity */
-      xaccSplitSetAmount(split, reverse ? amount : gnc_numeric_neg (amount));
-      payment_value = gnc_numeric_mul(amount, exch, GNC_DENOM_AUTO, GNC_HOW_RND_ROUND);
-      xaccSplitSetValue(split, reverse ? payment_value : gnc_numeric_neg(payment_value));
-  }
+    if (gnc_commodity_equal(xaccAccountGetCommodity(xfer_acc), commodity))
+    {
+        xaccSplitSetBaseValue (split, reverse ? amount :
+                               gnc_numeric_neg (amount), commodity);
+    }
+    else
+    {
+        /* Need to value the payment in terms of the owner commodity */
+        xaccSplitSetAmount(split, reverse ? amount : gnc_numeric_neg (amount));
+        payment_value = gnc_numeric_mul(amount, exch, GNC_DENOM_AUTO, GNC_HOW_RND_ROUND);
+        xaccSplitSetValue(split, reverse ? payment_value : gnc_numeric_neg(payment_value));
+    }
 
 
-  /* Now, find all "open" lots in the posting account for this
-   * company and apply the payment on a FIFO basis.  Create
-   * a new split for each open lot until the payment is gone.
-   */
+    /* Now, find all "open" lots in the posting account for this
+     * company and apply the payment on a FIFO basis.  Create
+     * a new split for each open lot until the payment is gone.
+     */
 
-  fifo = xaccAccountFindOpenLots (posted_acc, gnc_lot_match_invoice_owner,
-				  owner,
-				  (GCompareFunc)gnc_lot_sort_func);
+    fifo = xaccAccountFindOpenLots (posted_acc, gnc_lot_match_invoice_owner,
+                                    owner,
+                                    (GCompareFunc)gnc_lot_sort_func);
 
-  /* Check if an invoice was passed in, and if so, does it match the
-   * account, and is it an open lot?  If so, put it at the beginning
-   * of the lot list fifo so we post to this invoice's lot first.
-   */
-  if (invoice) {
-    inv_posted_acc = gncInvoiceGetPostedAcc(invoice);
-    inv_posted_lot = gncInvoiceGetPostedLot(invoice);
-    if (inv_posted_acc && inv_posted_lot &&
-	guid_equal(xaccAccountGetGUID(inv_posted_acc),
-		   xaccAccountGetGUID(posted_acc)) &&
-	!gnc_lot_is_closed(inv_posted_lot)) {
-      /* Put this invoice at the beginning of the FIFO */
-      fifo = g_list_prepend (fifo, inv_posted_lot);
-      inv_passed = FALSE;
+    /* Check if an invoice was passed in, and if so, does it match the
+     * account, and is it an open lot?  If so, put it at the beginning
+     * of the lot list fifo so we post to this invoice's lot first.
+     */
+    if (invoice)
+    {
+        inv_posted_acc = gncInvoiceGetPostedAcc(invoice);
+        inv_posted_lot = gncInvoiceGetPostedLot(invoice);
+        if (inv_posted_acc && inv_posted_lot &&
+                guid_equal(xaccAccountGetGUID(inv_posted_acc),
+                           xaccAccountGetGUID(posted_acc)) &&
+                !gnc_lot_is_closed(inv_posted_lot))
+        {
+            /* Put this invoice at the beginning of the FIFO */
+            fifo = g_list_prepend (fifo, inv_posted_lot);
+            inv_passed = FALSE;
+        }
     }
-  }
 
-  xaccAccountBeginEdit (posted_acc);
+    xaccAccountBeginEdit (posted_acc);
 
-  /* Now iterate over the fifo until the payment is fully applied
-   * (or all the lots are paid)
-   */
-  for (lot_list = fifo; lot_list; lot_list = lot_list->next) {
-    gnc_numeric balance;
+    /* Now iterate over the fifo until the payment is fully applied
+     * (or all the lots are paid)
+     */
+    for (lot_list = fifo; lot_list; lot_list = lot_list->next)
+    {
+        gnc_numeric balance;
 
-    lot = lot_list->data;
+        lot = lot_list->data;
 
-    /* Skip this lot if it matches the invoice that was passed in and
-     * we've seen it already.  This way we post to it the first time
-     * (from the beginning of the lot-list) but not when we reach it
-     * the second time.
-     */
-    if (inv_posted_lot &&
-	guid_equal(qof_instance_get_guid(QOF_INSTANCE(lot)),
-		   qof_instance_get_guid(QOF_INSTANCE(inv_posted_lot)))) {
-      if (inv_passed)
-	continue;
-      else
-	inv_passed = TRUE;
-    }
+        /* Skip this lot if it matches the invoice that was passed in and
+         * we've seen it already.  This way we post to it the first time
+         * (from the beginning of the lot-list) but not when we reach it
+         * the second time.
+         */
+        if (inv_posted_lot &&
+                guid_equal(qof_instance_get_guid(QOF_INSTANCE(lot)),
+                           qof_instance_get_guid(QOF_INSTANCE(inv_posted_lot))))
+        {
+            if (inv_passed)
+                continue;
+            else
+                inv_passed = TRUE;
+        }
 
-    balance = gnc_lot_get_balance (lot);
+        balance = gnc_lot_get_balance (lot);
 
-    if (!reverse)
-      balance = gnc_numeric_neg (balance);
+        if (!reverse)
+            balance = gnc_numeric_neg (balance);
 
-    /* If the balance is "negative" then skip this lot.
-     * (just save the pre-payment lot for later)
-     */
-    if (gnc_numeric_negative_p (balance)) {
-      if (prepay_lot) {
-	g_warning ("Multiple pre-payment lots are found.  Skipping.");
-      } else {
-	prepay_lot = lot;
-      }
-      continue;
-    }
+        /* If the balance is "negative" then skip this lot.
+         * (just save the pre-payment lot for later)
+         */
+        if (gnc_numeric_negative_p (balance))
+        {
+            if (prepay_lot)
+            {
+                g_warning ("Multiple pre-payment lots are found.  Skipping.");
+            }
+            else
+            {
+                prepay_lot = lot;
+            }
+            continue;
+        }
 
-    /*
-     * If the payment_value <= the balance; we're done -- apply the payment_value.
-     * Otherwise, apply the balance, subtract that from the payment_value,
-     * and move on to the next one.
-     */
-    if (gnc_numeric_compare (payment_value, balance) <= 0) {
-      /* payment_value <= balance */
-      split_amt = payment_value;
-    } else {
-      /* payment_value > balance */
-      split_amt = balance;
-    }
+        /*
+         * If the payment_value <= the balance; we're done -- apply the payment_value.
+         * Otherwise, apply the balance, subtract that from the payment_value,
+         * and move on to the next one.
+         */
+        if (gnc_numeric_compare (payment_value, balance) <= 0)
+        {
+            /* payment_value <= balance */
+            split_amt = payment_value;
+        }
+        else
+        {
+            /* payment_value > balance */
+            split_amt = balance;
+        }
 
-    /* reduce the payment_value by split_amt */
-    payment_value = gnc_numeric_sub (payment_value, split_amt, GNC_DENOM_AUTO, GNC_DENOM_LCD);
+        /* reduce the payment_value by split_amt */
+        payment_value = gnc_numeric_sub (payment_value, split_amt, GNC_DENOM_AUTO, GNC_DENOM_LCD);
 
-    /* Create the split for this lot in the post account */
-    split = xaccMallocSplit (book);
-    xaccSplitSetMemo (split, memo);
-    xaccSplitSetAction (split, _("Payment"));
-    xaccAccountInsertSplit (posted_acc, split);
-    xaccTransAppendSplit (txn, split);
-    xaccSplitSetBaseValue (split, reverse ? gnc_numeric_neg (split_amt) :
-			   split_amt, commodity);
-    gnc_lot_add_split (lot, split);
+        /* Create the split for this lot in the post account */
+        split = xaccMallocSplit (book);
+        xaccSplitSetMemo (split, memo);
+        xaccSplitSetAction (split, _("Payment"));
+        xaccAccountInsertSplit (posted_acc, split);
+        xaccTransAppendSplit (txn, split);
+        xaccSplitSetBaseValue (split, reverse ? gnc_numeric_neg (split_amt) :
+                               split_amt, commodity);
+        gnc_lot_add_split (lot, split);
 
-    /* Now send an event for the invoice so it gets updated as paid */
-    this_invoice = gncInvoiceGetInvoiceFromLot(lot);
-    if (this_invoice)
-      qof_event_gen (&this_invoice->inst, QOF_EVENT_MODIFY, NULL);
+        /* Now send an event for the invoice so it gets updated as paid */
+        this_invoice = gncInvoiceGetInvoiceFromLot(lot);
+        if (this_invoice)
+            qof_event_gen (&this_invoice->inst, QOF_EVENT_MODIFY, NULL);
 
-    if (gnc_numeric_zero_p (payment_value))
-      break;
-  }
+        if (gnc_numeric_zero_p (payment_value))
+            break;
+    }
 
-  g_list_free (fifo);
+    g_list_free (fifo);
 
-  /* If there is still money left here, then create a pre-payment lot */
-  if (gnc_numeric_positive_p (payment_value)) {
-    if (prepay_lot == NULL) {
-      prepay_lot = gnc_lot_new (book);
-      gncOwnerAttachToLot (owner, prepay_lot);
+    /* If there is still money left here, then create a pre-payment lot */
+    if (gnc_numeric_positive_p (payment_value))
+    {
+        if (prepay_lot == NULL)
+        {
+            prepay_lot = gnc_lot_new (book);
+            gncOwnerAttachToLot (owner, prepay_lot);
+        }
+
+        split = xaccMallocSplit (book);
+        xaccSplitSetMemo (split, memo);
+        xaccSplitSetAction (split, _("Pre-Payment"));
+        xaccAccountInsertSplit (posted_acc, split);
+        xaccTransAppendSplit (txn, split);
+        xaccSplitSetBaseValue (split, reverse ? gnc_numeric_neg (payment_value) :
+                               payment_value, commodity);
+        gnc_lot_add_split (prepay_lot, split);
     }
 
-    split = xaccMallocSplit (book);
-    xaccSplitSetMemo (split, memo);
-    xaccSplitSetAction (split, _("Pre-Payment"));
-    xaccAccountInsertSplit (posted_acc, split);
-    xaccTransAppendSplit (txn, split);
-    xaccSplitSetBaseValue (split, reverse ? gnc_numeric_neg (payment_value) :
-			   payment_value, commodity);
-    gnc_lot_add_split (prepay_lot, split);
-  }
+    xaccAccountCommitEdit (posted_acc);
 
-  xaccAccountCommitEdit (posted_acc);
+    /* Commit this new transaction */
+    xaccTransCommitEdit (txn);
 
-  /* Commit this new transaction */
-  xaccTransCommitEdit (txn);
-
-  return txn;    
+    return txn;
 }
 
 static gboolean gncInvoiceDateExists (const Timespec *date)
 {
-  g_return_val_if_fail (date, FALSE);
-  if (date->tv_sec || date->tv_nsec) return TRUE;
-  return FALSE;
+    g_return_val_if_fail (date, FALSE);
+    if (date->tv_sec || date->tv_nsec) return TRUE;
+    return FALSE;
 }
 
 gboolean gncInvoiceIsPosted (const GncInvoice *invoice)
 {
-  if (!invoice) return FALSE;
-  return gncInvoiceDateExists (&(invoice->date_posted));
+    if (!invoice) return FALSE;
+    return gncInvoiceDateExists (&(invoice->date_posted));
 }
 
 gboolean gncInvoiceIsPaid (const GncInvoice *invoice)
 {
-  if (!invoice) return FALSE;
-  if (!invoice->posted_lot) return FALSE;
-  return gnc_lot_is_closed(invoice->posted_lot);
+    if (!invoice) return FALSE;
+    if (!invoice->posted_lot) return FALSE;
+    return gnc_lot_is_closed(invoice->posted_lot);
 }
 
 /* ================================================================== */
 
 void gncInvoiceBeginEdit (GncInvoice *invoice)
 {
-  qof_begin_edit(&invoice->inst);
+    qof_begin_edit(&invoice->inst);
 }
 
 static void gncInvoiceOnError (QofInstance *inst, QofBackendError errcode)
 {
-  PERR("Invoice QofBackend Failure: %d", errcode);
-  gnc_engine_signal_commit_error( errcode );
+    PERR("Invoice QofBackend Failure: %d", errcode);
+    gnc_engine_signal_commit_error( errcode );
 }
 
 static void gncInvoiceOnDone (QofInstance *invoice) { }
 
 static void invoice_free (QofInstance *inst)
 {
-  GncInvoice *invoice = (GncInvoice *) inst;
-  gncInvoiceFree (invoice);
+    GncInvoice *invoice = (GncInvoice *) inst;
+    gncInvoiceFree (invoice);
 }
 
 void gncInvoiceCommitEdit (GncInvoice *invoice)
 {
-  if (!qof_commit_edit (QOF_INSTANCE(invoice))) return;
-  qof_commit_edit_part2 (&invoice->inst, gncInvoiceOnError,
-			 gncInvoiceOnDone, invoice_free);
+    if (!qof_commit_edit (QOF_INSTANCE(invoice))) return;
+    qof_commit_edit_part2 (&invoice->inst, gncInvoiceOnError,
+                           gncInvoiceOnDone, invoice_free);
 }
 
 int gncInvoiceCompare (const GncInvoice *a, const GncInvoice *b)
 {
-  int compare;
+    int compare;
 
-  if (a == b) return 0;
-  if (!a && b) return -1;
-  if (a && !b) return 1;
+    if (a == b) return 0;
+    if (!a && b) return -1;
+    if (a && !b) return 1;
 
-  compare = safe_strcmp (a->id, b->id);
-  if (compare) return compare;
+    compare = safe_strcmp (a->id, b->id);
+    if (compare) return compare;
 
-  compare = timespec_cmp (&(a->date_opened), &(b->date_opened));
-  if (compare) return compare;
+    compare = timespec_cmp (&(a->date_opened), &(b->date_opened));
+    if (compare) return compare;
 
-  compare = timespec_cmp (&(a->date_posted), &(b->date_posted));
-  if (compare) return compare;
+    compare = timespec_cmp (&(a->date_posted), &(b->date_posted));
+    if (compare) return compare;
 
-  return qof_instance_guid_compare(a, b);
+    return qof_instance_guid_compare(a, b);
 }
 
 /* ============================================================= */
@@ -1736,119 +1811,132 @@
 
 static const char * _gncInvoicePrintable (gpointer obj)
 {
-  GncInvoice *invoice = obj;
+    GncInvoice *invoice = obj;
 
-  g_return_val_if_fail (invoice, NULL);
+    g_return_val_if_fail (invoice, NULL);
 
-  if (qof_instance_get_dirty_flag(invoice) || invoice->printname == NULL) {
-    if (invoice->printname) g_free (invoice->printname);
+    if (qof_instance_get_dirty_flag(invoice) || invoice->printname == NULL)
+    {
+        if (invoice->printname) g_free (invoice->printname);
 
-    invoice->printname =
-      g_strdup_printf ("%s%s", invoice->id,
-		       gncInvoiceIsPosted (invoice) ? _(" (posted)") : "");
-  }
+        invoice->printname =
+            g_strdup_printf ("%s%s", invoice->id,
+                             gncInvoiceIsPosted (invoice) ? _(" (posted)") : "");
+    }
 
-  return invoice->printname;
+    return invoice->printname;
 }
 
-static QofObject gncInvoiceDesc = 
+static QofObject gncInvoiceDesc =
 {
-  .interface_version = QOF_OBJECT_VERSION,
-  .e_type            = _GNC_MOD_NAME,
-  .type_label        = "Invoice",
-  .create            = (gpointer)gncInvoiceCreate,
-  .book_begin        = NULL,
-  .book_end          = NULL,
-  .is_dirty          = qof_collection_is_dirty,
-  .mark_clean        = qof_collection_mark_clean,
-  .foreach           = qof_collection_foreach,
-  .printable         = _gncInvoicePrintable,
-  .version_cmp       = (int (*)(gpointer, gpointer)) qof_instance_version_cmp,
+    .interface_version = QOF_OBJECT_VERSION,
+    .e_type            = _GNC_MOD_NAME,
+    .type_label        = "Invoice",
+    .create            = (gpointer)gncInvoiceCreate,
+    .book_begin        = NULL,
+    .book_end          = NULL,
+    .is_dirty          = qof_collection_is_dirty,
+    .mark_clean        = qof_collection_mark_clean,
+    .foreach           = qof_collection_foreach,
+    .printable         = _gncInvoicePrintable,
+    .version_cmp       = (int (*)(gpointer, gpointer)) qof_instance_version_cmp,
 };
 
 static void
 reg_lot (void)
 {
-  static QofParam params[] = {
-    { INVOICE_FROM_LOT, _GNC_MOD_NAME,
-      (QofAccessFunc)gncInvoiceGetInvoiceFromLot, NULL },
-    { NULL },
-  };
+    static QofParam params[] =
+    {
+        {
+            INVOICE_FROM_LOT, _GNC_MOD_NAME,
+            (QofAccessFunc)gncInvoiceGetInvoiceFromLot, NULL
+        },
+        { NULL },
+    };
 
-  qof_class_register (GNC_ID_LOT, NULL, params);
+    qof_class_register (GNC_ID_LOT, NULL, params);
 }
 
 static void
 reg_txn (void)
 {
-  static QofParam params[] = {
-    { INVOICE_FROM_TXN, _GNC_MOD_NAME,
-      (QofAccessFunc)gncInvoiceGetInvoiceFromTxn, NULL },
-    { NULL },
-  };
+    static QofParam params[] =
+    {
+        {
+            INVOICE_FROM_TXN, _GNC_MOD_NAME,
+            (QofAccessFunc)gncInvoiceGetInvoiceFromTxn, NULL
+        },
+        { NULL },
+    };
 
-  qof_class_register (GNC_ID_TRANS, NULL, params);
+    qof_class_register (GNC_ID_TRANS, NULL, params);
 }
 
 gboolean gncInvoiceRegister (void)
 {
-  static QofParam params[] = {
-    { INVOICE_ID,      QOF_TYPE_STRING, (QofAccessFunc)gncInvoiceGetID,     (QofSetterFunc)gncInvoiceSetID },
-    { INVOICE_OWNER,   GNC_ID_OWNER, (QofAccessFunc)gncInvoiceGetOwner, NULL },
-    { INVOICE_OPENED,  QOF_TYPE_DATE,   (QofAccessFunc)gncInvoiceGetDateOpened, (QofSetterFunc)gncInvoiceSetDateOpened },
-    { INVOICE_DUE,     QOF_TYPE_DATE,   (QofAccessFunc)gncInvoiceGetDateDue, NULL },
-    { INVOICE_POSTED,  QOF_TYPE_DATE,   (QofAccessFunc)gncInvoiceGetDatePosted, (QofSetterFunc)gncInvoiceSetDatePosted },
-    { INVOICE_IS_POSTED, QOF_TYPE_BOOLEAN, (QofAccessFunc)gncInvoiceIsPosted, NULL },
-    { INVOICE_IS_PAID, QOF_TYPE_BOOLEAN, (QofAccessFunc)gncInvoiceIsPaid,    NULL },
-    { INVOICE_BILLINGID, QOF_TYPE_STRING, (QofAccessFunc)gncInvoiceGetBillingID, (QofSetterFunc)gncInvoiceSetBillingID },
-    { INVOICE_NOTES,   QOF_TYPE_STRING, (QofAccessFunc)gncInvoiceGetNotes,   (QofSetterFunc)gncInvoiceSetNotes },
-    { INVOICE_ACC,     GNC_ID_ACCOUNT,  (QofAccessFunc)gncInvoiceGetPostedAcc, (QofSetterFunc)gncInvoiceSetPostedAcc },
-    { INVOICE_POST_TXN, GNC_ID_TRANS,   (QofAccessFunc)gncInvoiceGetPostedTxn, (QofSetterFunc)gncInvoiceSetPostedTxn },
-    { INVOICE_POST_LOT, GNC_ID_LOT,     (QofAccessFunc)gncInvoiceGetPostedLot, NULL/*(QofSetterFunc)gncInvoiceSetPostedLot*/ },
-    { INVOICE_TYPE,    QOF_TYPE_STRING, (QofAccessFunc)gncInvoiceGetType,    NULL },
-    { INVOICE_TERMS,   GNC_ID_BILLTERM, (QofAccessFunc)gncInvoiceGetTerms,   (QofSetterFunc)gncInvoiceSetTerms },
-    { INVOICE_BILLTO,  GNC_ID_OWNER, (QofAccessFunc)gncInvoiceGetBillTo, NULL  },
-    { INVOICE_ENTRIES, QOF_TYPE_COLLECT, (QofAccessFunc)qofInvoiceGetEntries, (QofSetterFunc)qofInvoiceSetEntries },
-    { INVOICE_JOB,     GNC_ID_JOB,      (QofAccessFunc)qofInvoiceGetJob,     (QofSetterFunc)qofInvoiceSetJob }, 
-    { QOF_PARAM_ACTIVE, QOF_TYPE_BOOLEAN, (QofAccessFunc)gncInvoiceGetActive, (QofSetterFunc)gncInvoiceSetActive },
-    { QOF_PARAM_BOOK, QOF_ID_BOOK, (QofAccessFunc)qof_instance_get_book, NULL },
-    { QOF_PARAM_GUID, QOF_TYPE_GUID, (QofAccessFunc)qof_instance_get_guid, NULL },
-    { NULL },
-  };
+    static QofParam params[] =
+    {
+        { INVOICE_ID,      QOF_TYPE_STRING, (QofAccessFunc)gncInvoiceGetID,     (QofSetterFunc)gncInvoiceSetID },
+        { INVOICE_OWNER,   GNC_ID_OWNER, (QofAccessFunc)gncInvoiceGetOwner, NULL },
+        { INVOICE_OPENED,  QOF_TYPE_DATE,   (QofAccessFunc)gncInvoiceGetDateOpened, (QofSetterFunc)gncInvoiceSetDateOpened },
+        { INVOICE_DUE,     QOF_TYPE_DATE,   (QofAccessFunc)gncInvoiceGetDateDue, NULL },
+        { INVOICE_POSTED,  QOF_TYPE_DATE,   (QofAccessFunc)gncInvoiceGetDatePosted, (QofSetterFunc)gncInvoiceSetDatePosted },
+        { INVOICE_IS_POSTED, QOF_TYPE_BOOLEAN, (QofAccessFunc)gncInvoiceIsPosted, NULL },
+        { INVOICE_IS_PAID, QOF_TYPE_BOOLEAN, (QofAccessFunc)gncInvoiceIsPaid,    NULL },
+        { INVOICE_BILLINGID, QOF_TYPE_STRING, (QofAccessFunc)gncInvoiceGetBillingID, (QofSetterFunc)gncInvoiceSetBillingID },
+        { INVOICE_NOTES,   QOF_TYPE_STRING, (QofAccessFunc)gncInvoiceGetNotes,   (QofSetterFunc)gncInvoiceSetNotes },
+        { INVOICE_ACC,     GNC_ID_ACCOUNT,  (QofAccessFunc)gncInvoiceGetPostedAcc, (QofSetterFunc)gncInvoiceSetPostedAcc },
+        { INVOICE_POST_TXN, GNC_ID_TRANS,   (QofAccessFunc)gncInvoiceGetPostedTxn, (QofSetterFunc)gncInvoiceSetPostedTxn },
+        { INVOICE_POST_LOT, GNC_ID_LOT,     (QofAccessFunc)gncInvoiceGetPostedLot, NULL/*(QofSetterFunc)gncInvoiceSetPostedLot*/ },
+        { INVOICE_TYPE,    QOF_TYPE_STRING, (QofAccessFunc)gncInvoiceGetType,    NULL },
+        { INVOICE_TERMS,   GNC_ID_BILLTERM, (QofAccessFunc)gncInvoiceGetTerms,   (QofSetterFunc)gncInvoiceSetTerms },
+        { INVOICE_BILLTO,  GNC_ID_OWNER, (QofAccessFunc)gncInvoiceGetBillTo, NULL  },
+        { INVOICE_ENTRIES, QOF_TYPE_COLLECT, (QofAccessFunc)qofInvoiceGetEntries, (QofSetterFunc)qofInvoiceSetEntries },
+        { INVOICE_JOB,     GNC_ID_JOB,      (QofAccessFunc)qofInvoiceGetJob,     (QofSetterFunc)qofInvoiceSetJob },
+        { QOF_PARAM_ACTIVE, QOF_TYPE_BOOLEAN, (QofAccessFunc)gncInvoiceGetActive, (QofSetterFunc)gncInvoiceSetActive },
+        { QOF_PARAM_BOOK, QOF_ID_BOOK, (QofAccessFunc)qof_instance_get_book, NULL },
+        { QOF_PARAM_GUID, QOF_TYPE_GUID, (QofAccessFunc)qof_instance_get_guid, NULL },
+        { NULL },
+    };
 
-  qof_class_register (_GNC_MOD_NAME, (QofSortFunc)gncInvoiceCompare, params);
-  reg_lot ();
-  reg_txn ();
+    qof_class_register (_GNC_MOD_NAME, (QofSortFunc)gncInvoiceCompare, params);
+    reg_lot ();
+    reg_txn ();
 
-  /* Make the compiler happy... */
-  if (0) {
-    qofInvoiceSetEntries(NULL, NULL);
-    qofInvoiceGetEntries(NULL);
-    qofInvoiceSetOwner(NULL, NULL);
-    qofInvoiceGetOwner(NULL);
-    qofInvoiceSetBillTo(NULL, NULL);
-    qofInvoiceGetBillTo(NULL);
-  }
-  if(!qof_choice_create(GNC_ID_INVOICE)) { return FALSE;}
-  return qof_object_register (&gncInvoiceDesc);
+    /* Make the compiler happy... */
+    if (0)
+    {
+        qofInvoiceSetEntries(NULL, NULL);
+        qofInvoiceGetEntries(NULL);
+        qofInvoiceSetOwner(NULL, NULL);
+        qofInvoiceGetOwner(NULL);
+        qofInvoiceSetBillTo(NULL, NULL);
+        qofInvoiceGetBillTo(NULL);
+    }
+    if (!qof_choice_create(GNC_ID_INVOICE))
+    {
+        return FALSE;
+    }
+    return qof_object_register (&gncInvoiceDesc);
 }
 
 gint64 gncInvoiceNextID (QofBook *book, GncOwner *owner)
 {
-  gint64 nextID;
-  switch(gncOwnerGetType(gncOwnerGetEndOwner(owner))) {
+    gint64 nextID;
+    switch (gncOwnerGetType(gncOwnerGetEndOwner(owner)))
+    {
     case GNC_OWNER_CUSTOMER:
         nextID = qof_book_get_counter (book, "gncInvoice");
         break;
     case GNC_OWNER_VENDOR:
-      nextID = qof_book_get_counter (book, "gncBill");
-      break;
+        nextID = qof_book_get_counter (book, "gncBill");
+        break;
     case GNC_OWNER_EMPLOYEE:
-      nextID = qof_book_get_counter (book, "gncExpVoucher");
-      break;
+        nextID = qof_book_get_counter (book, "gncExpVoucher");
+        break;
     default:
-      nextID = qof_book_get_counter (book, _GNC_MOD_NAME);
-      break;
-  }
-  return nextID;
+        nextID = qof_book_get_counter (book, _GNC_MOD_NAME);
+        break;
+    }
+    return nextID;
 }

Modified: gnucash/trunk/src/business/business-core/gncInvoice.h
===================================================================
--- gnucash/trunk/src/business/business-core/gncInvoice.h	2010-03-02 21:40:28 UTC (rev 18788)
+++ gnucash/trunk/src/business/business-core/gncInvoice.h	2010-03-02 21:41:05 UTC (rev 18789)
@@ -23,12 +23,12 @@
     @{ */
 /** @addtogroup Invoice
 
-An invoice holds a list of entries, a pointer to the customer, 
-and the job, the dates entered and posted, as well as the account, 
+An invoice holds a list of entries, a pointer to the customer,
+and the job, the dates entered and posted, as well as the account,
 transaction and lot for the posted invoice.
     @{ */
 /** @file gncInvoice.h
-    @brief  Business Invoice Interface 
+    @brief  Business Invoice Interface
     @author Copyright (C) 2001,2006 Derek Atkins <warlord at MIT.EDU>
     @author Copyright (c) 2005 Neil Williams <linux at codehelp.co.uk>
 */
@@ -64,13 +64,13 @@
      (G_TYPE_INSTANCE_GET_CLASS ((o), GNC_TYPE_INVOICE, GncInvoiceClass))
 GType gnc_invoice_get_type(void);
 
-/** @name Create/Destroy Functions 
+/** @name Create/Destroy Functions
  @{ */
 GncInvoice *gncInvoiceCreate (QofBook *book);
 void gncInvoiceDestroy (GncInvoice *invoice);
 /** @} */
 
-/** @name Set Functions 
+/** @name Set Functions
  @{ */
 void gncInvoiceSetID (GncInvoice *invoice, const char *id);
 void gncInvoiceSetOwner (GncInvoice *invoice, GncOwner *owner);
@@ -101,7 +101,7 @@
 */
 void gncInvoiceSortEntries (GncInvoice *invoice);
 
-/** @name Get Functions 
+/** @name Get Functions
  @{ */
 const char * gncInvoiceGetID (const GncInvoice *invoice);
 GncOwner * gncInvoiceGetOwner (GncInvoice *invoice);
@@ -112,7 +112,7 @@
 const char * gncInvoiceGetBillingID (const GncInvoice *invoice);
 const char * gncInvoiceGetNotes (const GncInvoice *invoice);
 GncOwnerType gncInvoiceGetOwnerType (GncInvoice *invoice);
-const char * gncInvoiceGetType (GncInvoice *invoice); 
+const char * gncInvoiceGetType (GncInvoice *invoice);
 gnc_commodity * gncInvoiceGetCurrency (const GncInvoice *invoice);
 GncOwner * gncInvoiceGetBillTo (GncInvoice *invoice);
 gnc_numeric gncInvoiceGetToChargeAmount (const GncInvoice *invoice);
@@ -141,8 +141,8 @@
  */
 Transaction *
 gncInvoicePostToAccount (GncInvoice *invoice, Account *acc,
-			 Timespec *posted_date, Timespec *due_date,
-			 const char *memo, gboolean accumulatesplits);
+                         Timespec *posted_date, Timespec *due_date,
+                         const char *memo, gboolean accumulatesplits);
 
 /**
  * UNpost this invoice.  This will destroy the posted transaction and
@@ -168,9 +168,9 @@
  */
 Transaction *
 gncOwnerApplyPayment (GncOwner *owner, GncInvoice *invoice,
-		      Account *posted_acc, Account *xfer_acc,
-		      gnc_numeric amount, gnc_numeric exch, Timespec date,
-		      const char *memo, const char *num);
+                      Account *posted_acc, Account *xfer_acc,
+                      gnc_numeric amount, gnc_numeric exch, Timespec date,
+                      const char *memo, const char *num);
 
 
 /** Given a transaction, find and return the Invoice */
@@ -180,7 +180,7 @@
 GncInvoice * gncInvoiceGetInvoiceFromLot (GNCLot *lot);
 
 /** Return a pointer to the instance gncInvoice that is identified
- *  by the guid, and is residing in the book. Returns NULL if the 
+ *  by the guid, and is residing in the book. Returns NULL if the
  *  instance can't be found.
  *  Equivalent function prototype is
  *  GncInvoice * gncInvoiceLookup (QofBook *book, const GUID *guid);

Modified: gnucash/trunk/src/business/business-core/gncInvoiceP.h
===================================================================
--- gnucash/trunk/src/business/business-core/gncInvoiceP.h	2010-03-02 21:40:28 UTC (rev 18788)
+++ gnucash/trunk/src/business/business-core/gncInvoiceP.h	2010-03-02 21:41:05 UTC (rev 18789)
@@ -44,9 +44,9 @@
 
 /** The gncCloneInvoice() routine makes a copy of the indicated
  *  invoice, placing it in the indicated book.  It copies
- *  the name, description, type, due-days, discount, etc. 
+ *  the name, description, type, due-days, discount, etc.
  *  It also copies (as needed) both parents and children, so that
- *  the parent-child relationship is correctly mirrored in the 
+ *  the parent-child relationship is correctly mirrored in the
  *  clone.
  *  It then adds a pair of 'gemini' kvp pointers so that each copy
  *  can be found from the other.
@@ -60,7 +60,7 @@
  *  gncCloneInvoice()) and placed into the book.
  *
  * We called this routine 'Obtain' instead of "Get" to distinguish
- * it from the other Get routines, which work in fundamentally  
+ * it from the other Get routines, which work in fundamentally
  * different ways.
  */
 GncInvoice * gncInvoiceObtainTwin (GncInvoice *from, QofBook *book);

Modified: gnucash/trunk/src/business/business-core/gncJob.c
===================================================================
--- gnucash/trunk/src/business/business-core/gncJob.c	2010-03-02 21:40:28 UTC (rev 18788)
+++ gnucash/trunk/src/business/business-core/gncJob.c	2010-03-02 21:41:05 UTC (rev 18789)
@@ -36,19 +36,19 @@
 #include "gncJobP.h"
 #include "gncOwnerP.h"
 
-struct _gncJob 
+struct _gncJob
 {
-  QofInstance inst; 
-  char *        id;
-  char *        name;
-  char *        desc;
-  GncOwner      owner;
-  gboolean      active;
+    QofInstance inst;
+    char *        id;
+    char *        name;
+    char *        desc;
+    GncOwner      owner;
+    gboolean      active;
 };
 
 struct _gncJobClass
 {
-  QofInstanceClass parent_class;
+    QofInstanceClass parent_class;
 };
 
 static QofLogModule log_module = GNC_MOD_BUSINESS;
@@ -61,15 +61,16 @@
 G_INLINE_FUNC void mark_job (GncJob *job);
 void mark_job (GncJob *job)
 {
-  qof_instance_set_dirty(&job->inst);
-  qof_event_gen (&job->inst, QOF_EVENT_MODIFY, NULL);
+    qof_instance_set_dirty(&job->inst);
+    qof_event_gen (&job->inst, QOF_EVENT_MODIFY, NULL);
 }
 
 /* ================================================================== */
 
-enum {
+enum
+{
     PROP_0,
-	PROP_NAME
+    PROP_NAME
 };
 
 /* GObject Initialization */
@@ -94,43 +95,45 @@
 
 static void
 gnc_job_get_property (GObject         *object,
-			  guint            prop_id,
-			  GValue          *value,
-			  GParamSpec      *pspec)
+                      guint            prop_id,
+                      GValue          *value,
+                      GParamSpec      *pspec)
 {
-    GncJob *job; 
+    GncJob *job;
 
     g_return_if_fail(GNC_IS_JOB(object));
 
     job = GNC_JOB(object);
-    switch (prop_id) {
-	case PROP_NAME:
-	    g_value_set_string(value, job->name);
-		break;
-	default:
-	    G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec);
-	    break;
+    switch (prop_id)
+    {
+    case PROP_NAME:
+        g_value_set_string(value, job->name);
+        break;
+    default:
+        G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec);
+        break;
     }
 }
 
 static void
 gnc_job_set_property (GObject         *object,
-			  guint            prop_id,
-			  const GValue          *value,
-			  GParamSpec      *pspec)
+                      guint            prop_id,
+                      const GValue          *value,
+                      GParamSpec      *pspec)
 {
     GncJob *job;
 
     g_return_if_fail(GNC_IS_JOB(object));
 
     job = GNC_JOB(object);
-    switch (prop_id) {
-	case PROP_NAME:
-	    gncJobSetName(job, g_value_get_string(value));
-		break;
-	default:
-	    G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec);
-	    break;
+    switch (prop_id)
+    {
+    case PROP_NAME:
+        gncJobSetName(job, g_value_get_string(value));
+        break;
+    default:
+        G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec);
+        break;
     }
 }
 
@@ -138,113 +141,114 @@
 gnc_job_class_init (GncJobClass *klass)
 {
     GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
-	
+
     gobject_class->dispose = gnc_job_dispose;
     gobject_class->finalize = gnc_job_finalize;
     gobject_class->set_property = gnc_job_set_property;
     gobject_class->get_property = gnc_job_get_property;
 
     g_object_class_install_property
-	(gobject_class,
-	 PROP_NAME,
-	 g_param_spec_string ("name",
-			      "Job Name",
-			      "The job name is an arbitrary string "
-			      "assigned by the user.  It is intended to "
-			      "a short character string that is displayed "
-				  "by the GUI as the job mnemonic.",
-			      NULL,
-			      G_PARAM_READWRITE));
+    (gobject_class,
+     PROP_NAME,
+     g_param_spec_string ("name",
+                          "Job Name",
+                          "The job name is an arbitrary string "
+                          "assigned by the user.  It is intended to "
+                          "a short character string that is displayed "
+                          "by the GUI as the job mnemonic.",
+                          NULL,
+                          G_PARAM_READWRITE));
 }
 
 /* Create/Destroy Functions */
 GncJob *gncJobCreate (QofBook *book)
 {
-  GncJob *job;
+    GncJob *job;
 
-  if (!book) return NULL;
+    if (!book) return NULL;
 
-  job = g_object_new (GNC_TYPE_JOB, NULL);
-  qof_instance_init_data (&job->inst, _GNC_MOD_NAME, book);
+    job = g_object_new (GNC_TYPE_JOB, NULL);
+    qof_instance_init_data (&job->inst, _GNC_MOD_NAME, book);
 
-  job->id = CACHE_INSERT ("");
-  job->name = CACHE_INSERT ("");
-  job->desc = CACHE_INSERT ("");
-  job->active = TRUE;
+    job->id = CACHE_INSERT ("");
+    job->name = CACHE_INSERT ("");
+    job->desc = CACHE_INSERT ("");
+    job->active = TRUE;
 
-  /* GncOwner not initialized */
-  qof_event_gen (&job->inst, QOF_EVENT_CREATE, NULL);
+    /* GncOwner not initialized */
+    qof_event_gen (&job->inst, QOF_EVENT_CREATE, NULL);
 
-  return job;
+    return job;
 }
 
 GncJob *
 gncCloneJob (GncJob *from, QofBook *book)
 {
-  GncJob *job;
-                                                                                
-  if (!book) return NULL;
-                                                                                
-  job = g_object_new (GNC_TYPE_JOB, NULL);
-  qof_instance_init_data (&job->inst, _GNC_MOD_NAME, book);
-  qof_instance_gemini (&job->inst, &from->inst);
-                                                                                
-  job->id = CACHE_INSERT (from->id);
-  job->name = CACHE_INSERT (from->name);
-  job->desc = CACHE_INSERT (from->desc);
-  job->active = from->active;
+    GncJob *job;
 
-  job->owner = gncCloneOwner(&from->owner, book);
+    if (!book) return NULL;
 
-  qof_event_gen (&job->inst, QOF_EVENT_CREATE, NULL);
-                                                                                
-  return job;
+    job = g_object_new (GNC_TYPE_JOB, NULL);
+    qof_instance_init_data (&job->inst, _GNC_MOD_NAME, book);
+    qof_instance_gemini (&job->inst, &from->inst);
+
+    job->id = CACHE_INSERT (from->id);
+    job->name = CACHE_INSERT (from->name);
+    job->desc = CACHE_INSERT (from->desc);
+    job->active = from->active;
+
+    job->owner = gncCloneOwner(&from->owner, book);
+
+    qof_event_gen (&job->inst, QOF_EVENT_CREATE, NULL);
+
+    return job;
 }
 
 void gncJobDestroy (GncJob *job)
 {
-  if (!job) return;
-  qof_instance_set_destroying(job, TRUE);
-  gncJobCommitEdit (job);
+    if (!job) return;
+    qof_instance_set_destroying(job, TRUE);
+    gncJobCommitEdit (job);
 }
 
 static void gncJobFree (GncJob *job)
 {
-  if (!job) return;
+    if (!job) return;
 
-  qof_event_gen (&job->inst, QOF_EVENT_DESTROY, NULL);
+    qof_event_gen (&job->inst, QOF_EVENT_DESTROY, NULL);
 
-  CACHE_REMOVE (job->id);
-  CACHE_REMOVE (job->name);
-  CACHE_REMOVE (job->desc);
+    CACHE_REMOVE (job->id);
+    CACHE_REMOVE (job->name);
+    CACHE_REMOVE (job->desc);
 
-  switch (gncOwnerGetType (&(job->owner))) {
-  case GNC_OWNER_CUSTOMER:
-    gncCustomerRemoveJob (gncOwnerGetCustomer(&job->owner), job);
-    break;
-  case GNC_OWNER_VENDOR:
-    gncVendorRemoveJob (gncOwnerGetVendor(&job->owner), job);
-    break;
-  default:
-    break;
-  }
+    switch (gncOwnerGetType (&(job->owner)))
+    {
+    case GNC_OWNER_CUSTOMER:
+        gncCustomerRemoveJob (gncOwnerGetCustomer(&job->owner), job);
+        break;
+    case GNC_OWNER_VENDOR:
+        gncVendorRemoveJob (gncOwnerGetVendor(&job->owner), job);
+        break;
+    default:
+        break;
+    }
 
-  /* qof_instance_release (&job->inst); */
-  g_object_unref (job);
+    /* qof_instance_release (&job->inst); */
+    g_object_unref (job);
 }
 
 GncJob *
 gncJobObtainTwin (GncJob *from, QofBook *book)
 {
-  GncJob *job;
-  if (!from) return NULL;
-                                                                                
-  job = (GncJob *) qof_instance_lookup_twin (QOF_INSTANCE(from), book);
-  if (!job)
-  {
-    job = gncCloneJob (from, book);
-  }
-  return job;
+    GncJob *job;
+    if (!from) return NULL;
+
+    job = (GncJob *) qof_instance_lookup_twin (QOF_INSTANCE(from), book);
+    if (!job)
+    {
+        job = gncCloneJob (from, book);
+    }
+    return job;
 }
 
 /* ================================================================== */
@@ -262,120 +266,126 @@
 
 void gncJobSetID (GncJob *job, const char *id)
 {
-  if (!job) return;
-  if (!id) return;
-  SET_STR(job, job->id, id);
-  mark_job (job);
-  gncJobCommitEdit (job);
+    if (!job) return;
+    if (!id) return;
+    SET_STR(job, job->id, id);
+    mark_job (job);
+    gncJobCommitEdit (job);
 }
 
 void gncJobSetName (GncJob *job, const char *name)
 {
-  if (!job) return;
-  if (!name) return;
-  SET_STR(job, job->name, name);
-  mark_job (job);
-  gncJobCommitEdit (job);
+    if (!job) return;
+    if (!name) return;
+    SET_STR(job, job->name, name);
+    mark_job (job);
+    gncJobCommitEdit (job);
 }
 
 void gncJobSetReference (GncJob *job, const char *desc)
 {
-  if (!job) return;
-  if (!desc) return;
-  SET_STR(job, job->desc, desc);
-  mark_job (job);
-  gncJobCommitEdit (job);
+    if (!job) return;
+    if (!desc) return;
+    SET_STR(job, job->desc, desc);
+    mark_job (job);
+    gncJobCommitEdit (job);
 }
 
 void gncJobSetOwner (GncJob *job, GncOwner *owner)
 {
-  if (!job) return;
-  if (!owner) return;
-  if (gncOwnerEqual (owner, &(job->owner))) return;
+    if (!job) return;
+    if (!owner) return;
+    if (gncOwnerEqual (owner, &(job->owner))) return;
 
-  switch (gncOwnerGetType (owner)) {
-  case GNC_OWNER_CUSTOMER:
-  case GNC_OWNER_VENDOR:
-    break;
-  default:
-    PERR("Unsupported Owner type: %d", gncOwnerGetType(owner));
-    return;
-  }
+    switch (gncOwnerGetType (owner))
+    {
+    case GNC_OWNER_CUSTOMER:
+    case GNC_OWNER_VENDOR:
+        break;
+    default:
+        PERR("Unsupported Owner type: %d", gncOwnerGetType(owner));
+        return;
+    }
 
-  gncJobBeginEdit (job);
+    gncJobBeginEdit (job);
 
-  switch (gncOwnerGetType (&(job->owner))) {
-  case GNC_OWNER_CUSTOMER:
-    gncCustomerRemoveJob (gncOwnerGetCustomer(&job->owner), job);
-    break;
-  case GNC_OWNER_VENDOR:
-    gncVendorRemoveJob (gncOwnerGetVendor(&job->owner), job);
-    break;
-  default:
-    break;
-  }
+    switch (gncOwnerGetType (&(job->owner)))
+    {
+    case GNC_OWNER_CUSTOMER:
+        gncCustomerRemoveJob (gncOwnerGetCustomer(&job->owner), job);
+        break;
+    case GNC_OWNER_VENDOR:
+        gncVendorRemoveJob (gncOwnerGetVendor(&job->owner), job);
+        break;
+    default:
+        break;
+    }
 
-  gncOwnerCopy (owner, &(job->owner));
+    gncOwnerCopy (owner, &(job->owner));
 
-  switch (gncOwnerGetType (&(job->owner))) {
-  case GNC_OWNER_CUSTOMER:
-    gncCustomerAddJob (gncOwnerGetCustomer(&job->owner), job);
-    break;
-  case GNC_OWNER_VENDOR:
-    gncVendorAddJob (gncOwnerGetVendor(&job->owner), job);
-    break;
-  default:
-    break;
-  }
+    switch (gncOwnerGetType (&(job->owner)))
+    {
+    case GNC_OWNER_CUSTOMER:
+        gncCustomerAddJob (gncOwnerGetCustomer(&job->owner), job);
+        break;
+    case GNC_OWNER_VENDOR:
+        gncVendorAddJob (gncOwnerGetVendor(&job->owner), job);
+        break;
+    default:
+        break;
+    }
 
-  mark_job (job);
-  gncJobCommitEdit (job);
+    mark_job (job);
+    gncJobCommitEdit (job);
 }
 
 void gncJobSetActive (GncJob *job, gboolean active)
 {
-  if (!job) return;
-  if (active == job->active) return;
-  gncJobBeginEdit (job);
-  job->active = active;
-  mark_job (job);
-  gncJobCommitEdit (job);
+    if (!job) return;
+    if (active == job->active) return;
+    gncJobBeginEdit (job);
+    job->active = active;
+    mark_job (job);
+    gncJobCommitEdit (job);
 }
 
 static void
 qofJobSetOwner (GncJob *job, QofInstance *ent)
 {
-	if(!job || !ent) { return; }
-	qof_begin_edit(&job->inst);
-	qofOwnerSetEntity(&job->owner, ent);
-	mark_job (job);
-	qof_commit_edit(&job->inst);
+    if (!job || !ent)
+    {
+        return;
+    }
+    qof_begin_edit(&job->inst);
+    qofOwnerSetEntity(&job->owner, ent);
+    mark_job (job);
+    qof_commit_edit(&job->inst);
 }
 
 void gncJobBeginEdit (GncJob *job)
 {
-  qof_begin_edit(&job->inst);
+    qof_begin_edit(&job->inst);
 }
 
 static void gncJobOnError (QofInstance *inst, QofBackendError errcode)
 {
-  PERR("Job QofBackend Failure: %d", errcode);
-  gnc_engine_signal_commit_error( errcode );
+    PERR("Job QofBackend Failure: %d", errcode);
+    gnc_engine_signal_commit_error( errcode );
 }
 
 static void job_free (QofInstance *inst)
 {
-  GncJob *job = (GncJob *)inst;
-  gncJobFree (job);
+    GncJob *job = (GncJob *)inst;
+    gncJobFree (job);
 }
 
 static void gncJobOnDone (QofInstance *qof) { }
 
 void gncJobCommitEdit (GncJob *job)
 {
-  if (!qof_commit_edit (QOF_INSTANCE(job))) return;
-  qof_commit_edit_part2 (&job->inst, gncJobOnError,
-                         gncJobOnDone, job_free);
+    if (!qof_commit_edit (QOF_INSTANCE(job))) return;
+    qof_commit_edit_part2 (&job->inst, gncJobOnError,
+                           gncJobOnDone, job_free);
 }
 
 /* ================================================================== */
@@ -383,49 +393,53 @@
 
 const char * gncJobGetID (const GncJob *job)
 {
-  if (!job) return NULL;
-  return job->id;
+    if (!job) return NULL;
+    return job->id;
 }
 
 const char * gncJobGetName (const GncJob *job)
 {
-  if (!job) return NULL;
-  return job->name;
+    if (!job) return NULL;
+    return job->name;
 }
 
 const char * gncJobGetReference (const GncJob *job)
 {
-  if (!job) return NULL;
-  return job->desc;
+    if (!job) return NULL;
+    return job->desc;
 }
 
 GncOwner * gncJobGetOwner (GncJob *job)
 {
-  if (!job) return NULL;
-  return &(job->owner);
+    if (!job) return NULL;
+    return &(job->owner);
 }
 
 gboolean gncJobGetActive (const GncJob *job)
 {
-  if (!job) return FALSE;
-  return job->active;
+    if (!job) return FALSE;
+    return job->active;
 }
 
 static QofInstance*
 qofJobGetOwner (GncJob *job)
 {
-	if(!job) { return NULL; }
-	return QOF_INSTANCE(qofOwnerGetOwner(&job->owner));
+    if (!job)
+    {
+        return NULL;
+    }
+    return QOF_INSTANCE(qofOwnerGetOwner(&job->owner));
 }
 
 /* Other functions */
 
-int gncJobCompare (const GncJob * a, const GncJob *b) {
-  if (!a && !b) return 0;
-  if (!a && b) return 1;
-  if (a && !b) return -1;
+int gncJobCompare (const GncJob * a, const GncJob *b)
+{
+    if (!a && !b) return 0;
+    if (!a && b) return 1;
+    if (a && !b) return -1;
 
-  return (safe_strcmp(a->id, b->id));
+    return (safe_strcmp(a->id, b->id));
 }
 
 /* ================================================================== */
@@ -433,57 +447,64 @@
 
 static const char * _gncJobPrintable (gpointer item)
 {
-  GncJob *c;
-  if (!item) return NULL;
-  c = item;
-  return c->name;
+    GncJob *c;
+    if (!item) return NULL;
+    c = item;
+    return c->name;
 }
 
-static QofObject gncJobDesc = 
+static QofObject gncJobDesc =
 {
-  .interface_version = QOF_OBJECT_VERSION,
-  .e_type            = _GNC_MOD_NAME,
-  .type_label        = "Job",
-  .create            = (gpointer)gncJobCreate,
-  .book_begin        = NULL,
-  .book_end          = NULL,
-  .is_dirty          = qof_collection_is_dirty,
-  .mark_clean        = qof_collection_mark_clean,
-  .foreach           = qof_collection_foreach,
-  .printable         = _gncJobPrintable,
-  .version_cmp       = (int (*)(gpointer, gpointer)) qof_instance_version_cmp,
+    .interface_version = QOF_OBJECT_VERSION,
+    .e_type            = _GNC_MOD_NAME,
+    .type_label        = "Job",
+    .create            = (gpointer)gncJobCreate,
+    .book_begin        = NULL,
+    .book_end          = NULL,
+    .is_dirty          = qof_collection_is_dirty,
+    .mark_clean        = qof_collection_mark_clean,
+    .foreach           = qof_collection_foreach,
+    .printable         = _gncJobPrintable,
+    .version_cmp       = (int (*)(gpointer, gpointer)) qof_instance_version_cmp,
 };
 
 gboolean gncJobRegister (void)
 {
-  static QofParam params[] = {
-    { JOB_ID, QOF_TYPE_STRING, (QofAccessFunc)gncJobGetID, (QofSetterFunc)gncJobSetID },
-    { JOB_NAME, QOF_TYPE_STRING, (QofAccessFunc)gncJobGetName, (QofSetterFunc)gncJobSetName },
-    { JOB_ACTIVE, QOF_TYPE_BOOLEAN, (QofAccessFunc)gncJobGetActive, (QofSetterFunc)gncJobSetActive },
-    { JOB_REFERENCE, QOF_TYPE_STRING, (QofAccessFunc)gncJobGetReference, (QofSetterFunc)gncJobSetReference },
+    static QofParam params[] =
+    {
+        { JOB_ID, QOF_TYPE_STRING, (QofAccessFunc)gncJobGetID, (QofSetterFunc)gncJobSetID },
+        { JOB_NAME, QOF_TYPE_STRING, (QofAccessFunc)gncJobGetName, (QofSetterFunc)gncJobSetName },
+        { JOB_ACTIVE, QOF_TYPE_BOOLEAN, (QofAccessFunc)gncJobGetActive, (QofSetterFunc)gncJobSetActive },
+        { JOB_REFERENCE, QOF_TYPE_STRING, (QofAccessFunc)gncJobGetReference, (QofSetterFunc)gncJobSetReference },
 #ifdef GNUCASH_MAJOR_VERSION
-    { JOB_OWNER, GNC_ID_OWNER, (QofAccessFunc)gncJobGetOwner, NULL },
+        { JOB_OWNER, GNC_ID_OWNER, (QofAccessFunc)gncJobGetOwner, NULL },
 #else
-    { JOB_OWNER, QOF_TYPE_CHOICE, (QofAccessFunc)qofJobGetOwner, (QofSetterFunc)qofJobSetOwner },
+        { JOB_OWNER, QOF_TYPE_CHOICE, (QofAccessFunc)qofJobGetOwner, (QofSetterFunc)qofJobSetOwner },
 #endif
-    { QOF_PARAM_ACTIVE, QOF_TYPE_BOOLEAN, (QofAccessFunc)gncJobGetActive, NULL },
-    { QOF_PARAM_BOOK, QOF_ID_BOOK, (QofAccessFunc)qof_instance_get_book, NULL },
-    { QOF_PARAM_GUID, QOF_TYPE_GUID, (QofAccessFunc)qof_instance_get_guid, NULL },
-    { NULL },
-  };
+        { QOF_PARAM_ACTIVE, QOF_TYPE_BOOLEAN, (QofAccessFunc)gncJobGetActive, NULL },
+        { QOF_PARAM_BOOK, QOF_ID_BOOK, (QofAccessFunc)qof_instance_get_book, NULL },
+        { QOF_PARAM_GUID, QOF_TYPE_GUID, (QofAccessFunc)qof_instance_get_guid, NULL },
+        { NULL },
+    };
 
-  if(!qof_choice_create(GNC_ID_JOB)) { return FALSE; }
-  if(!qof_choice_add_class(GNC_ID_INVOICE, GNC_ID_JOB, INVOICE_OWNER)) { return FALSE; }
+    if (!qof_choice_create(GNC_ID_JOB))
+    {
+        return FALSE;
+    }
+    if (!qof_choice_add_class(GNC_ID_INVOICE, GNC_ID_JOB, INVOICE_OWNER))
+    {
+        return FALSE;
+    }
 
-  qof_class_register (_GNC_MOD_NAME, (QofSortFunc)gncJobCompare, params);
+    qof_class_register (_GNC_MOD_NAME, (QofSortFunc)gncJobCompare, params);
 #ifdef GNUCASH_MAJOR_VERSION
-  qofJobGetOwner(NULL);
-  qofJobSetOwner(NULL, NULL);
+    qofJobGetOwner(NULL);
+    qofJobSetOwner(NULL, NULL);
 #endif
-  return qof_object_register (&gncJobDesc);
+    return qof_object_register (&gncJobDesc);
 }
 
 gint64 gncJobNextID (QofBook *book)
 {
-  return qof_book_get_counter (book, _GNC_MOD_NAME);
+    return qof_book_get_counter (book, _GNC_MOD_NAME);
 }

Modified: gnucash/trunk/src/business/business-core/gncOrder.c
===================================================================
--- gnucash/trunk/src/business/business-core/gncOrder.c	2010-03-02 21:40:28 UTC (rev 18788)
+++ gnucash/trunk/src/business/business-core/gncOrder.c	2010-03-02 21:41:05 UTC (rev 18789)
@@ -37,25 +37,25 @@
 #include "gncOwner.h"
 #include "gncOwnerP.h"
 
-struct _gncOrder 
+struct _gncOrder
 {
-  QofInstance inst;
+    QofInstance inst;
 
-  char *	id;
-  char *	notes;
-  gboolean 	active;
+    char *	id;
+    char *	notes;
+    gboolean 	active;
 
-  char *	reference;
-  char *	printname;
-  GncOwner	owner;
-  GList *	entries;
-  Timespec 	opened;
-  Timespec 	closed;
+    char *	reference;
+    char *	printname;
+    GncOwner	owner;
+    GList *	entries;
+    Timespec 	opened;
+    Timespec 	closed;
 };
 
 struct _gncOrderClass
 {
-  QofInstanceClass parent_class;
+    QofInstanceClass parent_class;
 };
 
 static QofLogModule log_module = GNC_MOD_BUSINESS;
@@ -75,15 +75,16 @@
 G_INLINE_FUNC void mark_order (GncOrder *order);
 void mark_order (GncOrder *order)
 {
-  qof_instance_set_dirty(&order->inst);
-  qof_event_gen (&order->inst, QOF_EVENT_MODIFY, NULL);
+    qof_instance_set_dirty(&order->inst);
+    qof_event_gen (&order->inst, QOF_EVENT_MODIFY, NULL);
 }
 
 /* =============================================================== */
 
-enum {
+enum
+{
     PROP_0,
-	PROP_NOTES
+    PROP_NOTES
 };
 
 /* GObject Initialization */
@@ -108,43 +109,45 @@
 
 static void
 gnc_order_get_property (GObject         *object,
-			  guint            prop_id,
-			  GValue          *value,
-			  GParamSpec      *pspec)
+                        guint            prop_id,
+                        GValue          *value,
+                        GParamSpec      *pspec)
 {
     GncOrder *order;
 
     g_return_if_fail(GNC_IS_ORDER(object));
 
     order = GNC_ORDER(object);
-    switch (prop_id) {
-	case PROP_NOTES:
-	    g_value_set_string(value, order->notes);
-		break;
-	default:
-	    G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec);
-	    break;
+    switch (prop_id)
+    {
+    case PROP_NOTES:
+        g_value_set_string(value, order->notes);
+        break;
+    default:
+        G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec);
+        break;
     }
 }
 
 static void
 gnc_order_set_property (GObject         *object,
-			  guint            prop_id,
-			  const GValue          *value,
-			  GParamSpec      *pspec)
+                        guint            prop_id,
+                        const GValue          *value,
+                        GParamSpec      *pspec)
 {
     GncOrder *order;
 
     g_return_if_fail(GNC_IS_ORDER(object));
 
     order = GNC_ORDER(object);
-    switch (prop_id) {
-	case PROP_NOTES:
-	    gncOrderSetNotes(order, g_value_get_string(value));
-		break;
-	default:
-	    G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec);
-	    break;
+    switch (prop_id)
+    {
+    case PROP_NOTES:
+        gncOrderSetNotes(order, g_value_get_string(value));
+        break;
+    default:
+        G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec);
+        break;
     }
 }
 
@@ -152,118 +155,118 @@
 gnc_order_class_init (GncOrderClass *klass)
 {
     GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
-	
+
     gobject_class->dispose = gnc_order_dispose;
     gobject_class->finalize = gnc_order_finalize;
     gobject_class->set_property = gnc_order_set_property;
     gobject_class->get_property = gnc_order_get_property;
 
     g_object_class_install_property
-	(gobject_class,
-	 PROP_NOTES,
-	 g_param_spec_string ("name",
-			      "Order Notes",
-			      "The order notes is an arbitrary string "
-			      "assigned by the user to provide notes about "
-			      "this order.",
-			      NULL,
-			      G_PARAM_READWRITE));
+    (gobject_class,
+     PROP_NOTES,
+     g_param_spec_string ("name",
+                          "Order Notes",
+                          "The order notes is an arbitrary string "
+                          "assigned by the user to provide notes about "
+                          "this order.",
+                          NULL,
+                          G_PARAM_READWRITE));
 }
 
 /* Create/Destroy Functions */
 GncOrder *gncOrderCreate (QofBook *book)
 {
-  GncOrder *order;
+    GncOrder *order;
 
-  if (!book) return NULL;
+    if (!book) return NULL;
 
-  order = g_object_new (GNC_TYPE_ORDER, NULL);
-  qof_instance_init_data (&order->inst, _GNC_MOD_NAME, book);
+    order = g_object_new (GNC_TYPE_ORDER, NULL);
+    qof_instance_init_data (&order->inst, _GNC_MOD_NAME, book);
 
-  order->id = CACHE_INSERT ("");
-  order->notes = CACHE_INSERT ("");
-  order->reference = CACHE_INSERT ("");
+    order->id = CACHE_INSERT ("");
+    order->notes = CACHE_INSERT ("");
+    order->reference = CACHE_INSERT ("");
 
-  order->active = TRUE;
+    order->active = TRUE;
 
-  qof_event_gen (&order->inst, QOF_EVENT_CREATE, NULL);
+    qof_event_gen (&order->inst, QOF_EVENT_CREATE, NULL);
 
-  return order;
+    return order;
 }
 
 void gncOrderDestroy (GncOrder *order)
 {
-  if (!order) return;
-  qof_instance_set_destroying(order, TRUE);
-  gncOrderCommitEdit (order);
+    if (!order) return;
+    qof_instance_set_destroying(order, TRUE);
+    gncOrderCommitEdit (order);
 }
 
 static void gncOrderFree (GncOrder *order)
 {
-  if (!order) return;
+    if (!order) return;
 
-  qof_event_gen (&order->inst, QOF_EVENT_DESTROY, NULL);
+    qof_event_gen (&order->inst, QOF_EVENT_DESTROY, NULL);
 
-  g_list_free (order->entries);
-  CACHE_REMOVE (order->id);
-  CACHE_REMOVE (order->notes);
-  CACHE_REMOVE (order->reference);
+    g_list_free (order->entries);
+    CACHE_REMOVE (order->id);
+    CACHE_REMOVE (order->notes);
+    CACHE_REMOVE (order->reference);
 
-  if (order->printname) g_free (order->printname);
+    if (order->printname) g_free (order->printname);
 
-  /* qof_instance_release (&order->inst); */
-  g_object_unref (order);
+    /* qof_instance_release (&order->inst); */
+    g_object_unref (order);
 }
 
 GncOrder *
 gncCloneOrder (GncOrder *from, QofBook *book)
 {
-  GList *node;
-  GncOrder *order;
+    GList *node;
+    GncOrder *order;
 
-  if (!book) return NULL;
+    if (!book) return NULL;
 
-  order = g_object_new (GNC_TYPE_ORDER, NULL);
-  qof_instance_init_data (&order->inst, _GNC_MOD_NAME, book);
-  qof_instance_gemini (&order->inst, &from->inst);
+    order = g_object_new (GNC_TYPE_ORDER, NULL);
+    qof_instance_init_data (&order->inst, _GNC_MOD_NAME, book);
+    qof_instance_gemini (&order->inst, &from->inst);
 
-  order->id = CACHE_INSERT (from->id);
-  order->notes = CACHE_INSERT (from->notes);
-  order->reference = CACHE_INSERT (from->reference);
+    order->id = CACHE_INSERT (from->id);
+    order->notes = CACHE_INSERT (from->notes);
+    order->reference = CACHE_INSERT (from->reference);
 
-  order->active = from->active;
-  order->printname = NULL; /* yes, null, that's right */
-  order->opened = from->opened;
-  order->closed = from->closed;
+    order->active = from->active;
+    order->printname = NULL; /* yes, null, that's right */
+    order->opened = from->opened;
+    order->closed = from->closed;
 
-  order->owner = gncCloneOwner (&from->owner, book);
+    order->owner = gncCloneOwner (&from->owner, book);
 
-  order->entries = NULL;
-  for (node = g_list_last(from->entries); node; node=node->prev)
-  {
-    GncEntry *entry = node->data;
-    entry = gncEntryObtainTwin (entry, book);
-    order->entries = g_list_prepend (order->entries, entry);
-  }
+    order->entries = NULL;
+    for (node = g_list_last(from->entries); node; node = node->prev)
+    {
+        GncEntry *entry = node->data;
+        entry = gncEntryObtainTwin (entry, book);
+        order->entries = g_list_prepend (order->entries, entry);
+    }
 
-  qof_event_gen (&order->inst, QOF_EVENT_CREATE, NULL);
+    qof_event_gen (&order->inst, QOF_EVENT_CREATE, NULL);
 
-  return order;
+    return order;
 }
 
 GncOrder *
 gncOrderObtainTwin (GncOrder *from, QofBook *book)
 {
-  GncOrder *order;
-  if (!book) return NULL;
+    GncOrder *order;
+    if (!book) return NULL;
 
-  order = (GncOrder *) qof_instance_lookup_twin (QOF_INSTANCE(from), book);
-  if (!order)
-  {
-    order = gncCloneOrder (from, book);
-  }
+    order = (GncOrder *) qof_instance_lookup_twin (QOF_INSTANCE(from), book);
+    if (!order)
+    {
+        order = gncCloneOrder (from, book);
+    }
 
-  return order;
+    return order;
 }
 
 /* =============================================================== */
@@ -271,264 +274,270 @@
 
 void gncOrderSetID (GncOrder *order, const char *id)
 {
-  if (!order || !id) return;
-  SET_STR (order, order->id, id);
-  mark_order (order);
-  gncOrderCommitEdit (order);
+    if (!order || !id) return;
+    SET_STR (order, order->id, id);
+    mark_order (order);
+    gncOrderCommitEdit (order);
 }
 
 void gncOrderSetOwner (GncOrder *order, GncOwner *owner)
 {
-  if (!order || !owner) return;
-  if (gncOwnerEqual (&order->owner, owner)) return;
+    if (!order || !owner) return;
+    if (gncOwnerEqual (&order->owner, owner)) return;
 
-  gncOrderBeginEdit (order);
-  gncOwnerCopy (owner, &order->owner);
-  mark_order (order);
-  gncOrderCommitEdit (order);
+    gncOrderBeginEdit (order);
+    gncOwnerCopy (owner, &order->owner);
+    mark_order (order);
+    gncOrderCommitEdit (order);
 }
 
 void gncOrderSetDateOpened (GncOrder *order, Timespec date)
 {
-  if (!order) return;
-  if (timespec_equal (&order->opened, &date)) return;
-  gncOrderBeginEdit (order);
-  order->opened = date;
-  mark_order (order);
-  gncOrderCommitEdit (order);
+    if (!order) return;
+    if (timespec_equal (&order->opened, &date)) return;
+    gncOrderBeginEdit (order);
+    order->opened = date;
+    mark_order (order);
+    gncOrderCommitEdit (order);
 }
 
 void gncOrderSetDateClosed (GncOrder *order, Timespec date)
 {
-  if (!order) return;
-  if (timespec_equal (&order->closed, &date)) return;
-  gncOrderBeginEdit (order);
-  order->closed = date;
-  mark_order (order);
-  gncOrderCommitEdit (order);
+    if (!order) return;
+    if (timespec_equal (&order->closed, &date)) return;
+    gncOrderBeginEdit (order);
+    order->closed = date;
+    mark_order (order);
+    gncOrderCommitEdit (order);
 }
 
 void gncOrderSetNotes (GncOrder *order, const char *notes)
 {
-  if (!order || !notes) return;
-  SET_STR (order, order->notes, notes);
-  mark_order (order);
-  gncOrderCommitEdit (order);
+    if (!order || !notes) return;
+    SET_STR (order, order->notes, notes);
+    mark_order (order);
+    gncOrderCommitEdit (order);
 }
 
 void gncOrderSetReference (GncOrder *order, const char *reference)
 {
-  if (!order || !reference) return;
-  SET_STR (order, order->reference, reference);
-  mark_order (order);
-  gncOrderCommitEdit (order);
+    if (!order || !reference) return;
+    SET_STR (order, order->reference, reference);
+    mark_order (order);
+    gncOrderCommitEdit (order);
 }
 
 void gncOrderSetActive (GncOrder *order, gboolean active)
 {
-  if (!order) return;
-  if (order->active == active) return;
-  gncOrderBeginEdit (order);
-  order->active = active;
-  mark_order (order);
-  gncOrderCommitEdit (order);
+    if (!order) return;
+    if (order->active == active) return;
+    gncOrderBeginEdit (order);
+    order->active = active;
+    mark_order (order);
+    gncOrderCommitEdit (order);
 }
 
 /* =============================================================== */
 /* Add an Entry to the Order */
 void gncOrderAddEntry (GncOrder *order, GncEntry *entry)
 {
-  GncOrder *old;
+    GncOrder *old;
 
-  if (!order || !entry) return;
+    if (!order || !entry) return;
 
-  old = gncEntryGetOrder (entry);
-  if (old == order) return;			/* I already own it */
-  if (old) gncOrderRemoveEntry (old, entry);
+    old = gncEntryGetOrder (entry);
+    if (old == order) return;			/* I already own it */
+    if (old) gncOrderRemoveEntry (old, entry);
 
-  order->entries = g_list_insert_sorted (order->entries, entry,
-					 (GCompareFunc)gncEntryCompare);
+    order->entries = g_list_insert_sorted (order->entries, entry,
+                                           (GCompareFunc)gncEntryCompare);
 
-  /* This will send out an event -- make sure we're attached */
-  gncEntrySetOrder (entry, order);
-  mark_order (order);
+    /* This will send out an event -- make sure we're attached */
+    gncEntrySetOrder (entry, order);
+    mark_order (order);
 }
 
 void gncOrderRemoveEntry (GncOrder *order, GncEntry *entry)
 {
-  if (!order || !entry) return;
+    if (!order || !entry) return;
 
-  gncEntrySetOrder (entry, NULL);
-  order->entries = g_list_remove (order->entries, entry);
-  mark_order (order);
+    gncEntrySetOrder (entry, NULL);
+    order->entries = g_list_remove (order->entries, entry);
+    mark_order (order);
 }
 
 /* Get Functions */
 
 const char * gncOrderGetID (const GncOrder *order)
 {
-  if (!order) return NULL;
-  return order->id;
+    if (!order) return NULL;
+    return order->id;
 }
 
 GncOwner * gncOrderGetOwner (GncOrder *order)
 {
-  if (!order) return NULL;
-  return &order->owner;
+    if (!order) return NULL;
+    return &order->owner;
 }
 
 Timespec gncOrderGetDateOpened (const GncOrder *order)
 {
-  Timespec ts; ts.tv_sec = 0; ts.tv_nsec = 0;
-  if (!order) return ts;
-  return order->opened;
+    Timespec ts;
+    ts.tv_sec = 0;
+    ts.tv_nsec = 0;
+    if (!order) return ts;
+    return order->opened;
 }
 
 Timespec gncOrderGetDateClosed (const GncOrder *order)
 {
-  Timespec ts; ts.tv_sec = 0; ts.tv_nsec = 0;
-  if (!order) return ts;
-  return order->closed;
+    Timespec ts;
+    ts.tv_sec = 0;
+    ts.tv_nsec = 0;
+    if (!order) return ts;
+    return order->closed;
 }
 
 const char * gncOrderGetNotes (const GncOrder *order)
 {
-  if (!order) return NULL;
-  return order->notes;
+    if (!order) return NULL;
+    return order->notes;
 }
 
 const char * gncOrderGetReference (const GncOrder *order)
 {
-  if (!order) return NULL;
-  return order->reference;
+    if (!order) return NULL;
+    return order->reference;
 }
 
 gboolean gncOrderGetActive (const GncOrder *order)
 {
-  if (!order) return FALSE;
-  return order->active;
+    if (!order) return FALSE;
+    return order->active;
 }
 
 /* Get the list Entries */
 GList * gncOrderGetEntries (GncOrder *order)
 {
-  if (!order) return NULL;
-  return order->entries;
+    if (!order) return NULL;
+    return order->entries;
 }
 
 gboolean gncOrderIsClosed (const GncOrder *order)
 {
-  if (!order) return FALSE;
-  if (order->closed.tv_sec || order->closed.tv_nsec) return TRUE;
-  return FALSE;
+    if (!order) return FALSE;
+    if (order->closed.tv_sec || order->closed.tv_nsec) return TRUE;
+    return FALSE;
 }
 
 /* =============================================================== */
 
 void gncOrderBeginEdit (GncOrder *order)
 {
-  qof_begin_edit(&order->inst);
+    qof_begin_edit(&order->inst);
 }
 
 static void gncOrderOnError (QofInstance *order, QofBackendError errcode)
 {
-  PERR("Order QofBackend Failure: %d", errcode);
-  gnc_engine_signal_commit_error( errcode );
+    PERR("Order QofBackend Failure: %d", errcode);
+    gnc_engine_signal_commit_error( errcode );
 }
 
 static void gncOrderOnDone (QofInstance *order) {}
 
 static void order_free (QofInstance *inst)
 {
-  GncOrder *order = (GncOrder *) inst;
-  gncOrderFree (order);
+    GncOrder *order = (GncOrder *) inst;
+    gncOrderFree (order);
 }
 
 void gncOrderCommitEdit (GncOrder *order)
 {
-  if (!qof_commit_edit (QOF_INSTANCE(order))) return;
-  qof_commit_edit_part2 (&order->inst, gncOrderOnError,
-			 gncOrderOnDone, order_free);
+    if (!qof_commit_edit (QOF_INSTANCE(order))) return;
+    qof_commit_edit_part2 (&order->inst, gncOrderOnError,
+                           gncOrderOnDone, order_free);
 }
 
 int gncOrderCompare (const GncOrder *a, const GncOrder *b)
 {
-  int compare;
+    int compare;
 
-  if (a == b) return 0;
-  if (!a && b) return -1;
-  if (a && !b) return 1;
+    if (a == b) return 0;
+    if (!a && b) return -1;
+    if (a && !b) return 1;
 
-  compare = safe_strcmp (a->id, b->id);
-  if (compare) return compare;
+    compare = safe_strcmp (a->id, b->id);
+    if (compare) return compare;
 
-  compare = timespec_cmp (&(a->opened), &(b->opened));
-  if (compare) return compare;
+    compare = timespec_cmp (&(a->opened), &(b->opened));
+    if (compare) return compare;
 
-  compare = timespec_cmp (&(a->closed), &(b->closed));
-  if (compare) return compare;
+    compare = timespec_cmp (&(a->closed), &(b->closed));
+    if (compare) return compare;
 
-  return qof_instance_guid_compare(a, b);
+    return qof_instance_guid_compare(a, b);
 }
 
 /* =========================================================== */
 /* Package-Private functions */
 
-static const char * 
+static const char *
 _gncOrderPrintable (gpointer obj)
 {
-  GncOrder *order = obj;
+    GncOrder *order = obj;
 
-  g_return_val_if_fail (order, NULL);
+    g_return_val_if_fail (order, NULL);
 
-  if (qof_instance_get_dirty_flag(order) || order->printname == NULL) {
-    if (order->printname) g_free (order->printname);
+    if (qof_instance_get_dirty_flag(order) || order->printname == NULL)
+    {
+        if (order->printname) g_free (order->printname);
 
-    order->printname =
-      g_strdup_printf ("%s%s", order->id,
-		       gncOrderIsClosed (order) ? _(" (closed)") : "");
-  }
+        order->printname =
+            g_strdup_printf ("%s%s", order->id,
+                             gncOrderIsClosed (order) ? _(" (closed)") : "");
+    }
 
-  return order->printname;
+    return order->printname;
 }
 
 static QofObject gncOrderDesc =
 {
-  .interface_version = QOF_OBJECT_VERSION,
-  .e_type            = _GNC_MOD_NAME,
-  .type_label        = "Order",
-  .create            = (gpointer)gncOrderCreate,
-  .book_begin        = NULL,
-  .book_end          = NULL,
-  .is_dirty          = qof_collection_is_dirty,
-  .mark_clean        = qof_collection_mark_clean,
-  .foreach           = qof_collection_foreach,
-  .printable         = _gncOrderPrintable,
-  .version_cmp       = (int (*)(gpointer, gpointer)) qof_instance_version_cmp,
+    .interface_version = QOF_OBJECT_VERSION,
+    .e_type            = _GNC_MOD_NAME,
+    .type_label        = "Order",
+    .create            = (gpointer)gncOrderCreate,
+    .book_begin        = NULL,
+    .book_end          = NULL,
+    .is_dirty          = qof_collection_is_dirty,
+    .mark_clean        = qof_collection_mark_clean,
+    .foreach           = qof_collection_foreach,
+    .printable         = _gncOrderPrintable,
+    .version_cmp       = (int (*)(gpointer, gpointer)) qof_instance_version_cmp,
 };
 
 gboolean gncOrderRegister (void)
 {
-  static QofParam params[] = {
-    { ORDER_ID, QOF_TYPE_STRING, (QofAccessFunc)gncOrderGetID, (QofSetterFunc)gncOrderSetID },
-    { ORDER_REFERENCE, QOF_TYPE_STRING, (QofAccessFunc)gncOrderGetReference, (QofSetterFunc)gncOrderSetReference },
-    { ORDER_OWNER, GNC_ID_OWNER, (QofAccessFunc)gncOrderGetOwner, (QofSetterFunc)gncOrderSetOwner },
-    { ORDER_OPENED, QOF_TYPE_DATE, (QofAccessFunc)gncOrderGetDateOpened, (QofSetterFunc)gncOrderSetDateOpened },
-    { ORDER_IS_CLOSED, QOF_TYPE_BOOLEAN, (QofAccessFunc)gncOrderIsClosed, NULL },
-    { ORDER_CLOSED, QOF_TYPE_DATE, (QofAccessFunc)gncOrderGetDateClosed, (QofSetterFunc)gncOrderSetDateClosed },
-    { ORDER_NOTES, QOF_TYPE_STRING, (QofAccessFunc)gncOrderGetNotes, (QofSetterFunc)gncOrderSetNotes },
-    { QOF_PARAM_ACTIVE, QOF_TYPE_BOOLEAN, (QofAccessFunc)gncOrderGetActive, (QofSetterFunc)gncOrderSetActive },
-    { QOF_PARAM_BOOK, QOF_ID_BOOK, (QofAccessFunc)qof_instance_get_book, NULL },
-    { QOF_PARAM_GUID, QOF_TYPE_GUID, (QofAccessFunc)qof_instance_get_guid, NULL },
-    { NULL },
-  };
+    static QofParam params[] =
+    {
+        { ORDER_ID, QOF_TYPE_STRING, (QofAccessFunc)gncOrderGetID, (QofSetterFunc)gncOrderSetID },
+        { ORDER_REFERENCE, QOF_TYPE_STRING, (QofAccessFunc)gncOrderGetReference, (QofSetterFunc)gncOrderSetReference },
+        { ORDER_OWNER, GNC_ID_OWNER, (QofAccessFunc)gncOrderGetOwner, (QofSetterFunc)gncOrderSetOwner },
+        { ORDER_OPENED, QOF_TYPE_DATE, (QofAccessFunc)gncOrderGetDateOpened, (QofSetterFunc)gncOrderSetDateOpened },
+        { ORDER_IS_CLOSED, QOF_TYPE_BOOLEAN, (QofAccessFunc)gncOrderIsClosed, NULL },
+        { ORDER_CLOSED, QOF_TYPE_DATE, (QofAccessFunc)gncOrderGetDateClosed, (QofSetterFunc)gncOrderSetDateClosed },
+        { ORDER_NOTES, QOF_TYPE_STRING, (QofAccessFunc)gncOrderGetNotes, (QofSetterFunc)gncOrderSetNotes },
+        { QOF_PARAM_ACTIVE, QOF_TYPE_BOOLEAN, (QofAccessFunc)gncOrderGetActive, (QofSetterFunc)gncOrderSetActive },
+        { QOF_PARAM_BOOK, QOF_ID_BOOK, (QofAccessFunc)qof_instance_get_book, NULL },
+        { QOF_PARAM_GUID, QOF_TYPE_GUID, (QofAccessFunc)qof_instance_get_guid, NULL },
+        { NULL },
+    };
 
-  qof_class_register (_GNC_MOD_NAME, (QofSortFunc)gncOrderCompare, params);
+    qof_class_register (_GNC_MOD_NAME, (QofSortFunc)gncOrderCompare, params);
 
-  return qof_object_register (&gncOrderDesc);
+    return qof_object_register (&gncOrderDesc);
 }
 
 gint64 gncOrderNextID (QofBook *book)
 {
-  return qof_book_get_counter (book, _GNC_MOD_NAME);
+    return qof_book_get_counter (book, _GNC_MOD_NAME);
 }

Modified: gnucash/trunk/src/business/business-core/gncOrder.h
===================================================================
--- gnucash/trunk/src/business/business-core/gncOrder.h	2010-03-02 21:40:28 UTC (rev 18788)
+++ gnucash/trunk/src/business/business-core/gncOrder.h	2010-03-02 21:41:05 UTC (rev 18789)
@@ -96,7 +96,7 @@
 gboolean gncOrderIsClosed (const GncOrder *order);
 
 /** Return a pointer to the instance gncOrder that is identified
- *  by the guid, and is residing in the book. Returns NULL if the 
+ *  by the guid, and is residing in the book. Returns NULL if the
  *  instance can't be found.
  *  Equivalent function prototype is
  *  GncOrder * gncOrderLookup (QofBook *book, const GUID *guid);

Modified: gnucash/trunk/src/business/business-core/gncOrderP.h
===================================================================
--- gnucash/trunk/src/business/business-core/gncOrderP.h	2010-03-02 21:40:28 UTC (rev 18788)
+++ gnucash/trunk/src/business/business-core/gncOrderP.h	2010-03-02 21:41:05 UTC (rev 18789)
@@ -49,7 +49,7 @@
  *  gncCloneOrder()) and placed into the book.
  *
  * We called this routine 'Obtain' instead of "Get" to distinguish
- * it from the other Get routines, which work in fundamentally  
+ * it from the other Get routines, which work in fundamentally
  * different ways.
  */
 GncOrder * gncOrderObtainTwin (GncOrder *from, QofBook *book);

Modified: gnucash/trunk/src/business/business-core/gncOwner.c
===================================================================
--- gnucash/trunk/src/business/business-core/gncOwner.c	2010-03-02 21:40:28 UTC (rev 18788)
+++ gnucash/trunk/src/business/business-core/gncOwner.c	2010-03-02 21:41:05 UTC (rev 18789)
@@ -48,436 +48,461 @@
 
 GncOwner * gncOwnerCreate (void)
 {
-  GncOwner *o;
+    GncOwner *o;
 
-  o = g_new0 (GncOwner, 1);
-  o->type = GNC_OWNER_NONE;
-  return o;
+    o = g_new0 (GncOwner, 1);
+    o->type = GNC_OWNER_NONE;
+    return o;
 }
 
 void gncOwnerDestroy (GncOwner *owner)
 {
-  if (!owner) return;
-  g_free (owner);
+    if (!owner) return;
+    g_free (owner);
 }
 
 void gncOwnerInitUndefined (GncOwner *owner, gpointer obj)
 {
-  if (!owner) return;
-  owner->type = GNC_OWNER_UNDEFINED;
-  owner->owner.undefined = obj;
+    if (!owner) return;
+    owner->type = GNC_OWNER_UNDEFINED;
+    owner->owner.undefined = obj;
 }
 
 void gncOwnerInitCustomer (GncOwner *owner, GncCustomer *customer)
 {
-  if (!owner) return;
-  owner->type = GNC_OWNER_CUSTOMER;
-  owner->owner.customer = customer;
+    if (!owner) return;
+    owner->type = GNC_OWNER_CUSTOMER;
+    owner->owner.customer = customer;
 }
 
 void gncOwnerInitJob (GncOwner *owner, GncJob *job)
 {
-  if (!owner) return;
-  owner->type = GNC_OWNER_JOB;
-  owner->owner.job = job;
+    if (!owner) return;
+    owner->type = GNC_OWNER_JOB;
+    owner->owner.job = job;
 }
 
 void gncOwnerInitVendor (GncOwner *owner, GncVendor *vendor)
 {
-  if (!owner) return;
-  owner->type = GNC_OWNER_VENDOR;
-  owner->owner.vendor = vendor;
+    if (!owner) return;
+    owner->type = GNC_OWNER_VENDOR;
+    owner->owner.vendor = vendor;
 }
 
 void gncOwnerInitEmployee (GncOwner *owner, GncEmployee *employee)
 {
-  if (!owner) return;
-  owner->type = GNC_OWNER_EMPLOYEE;
-  owner->owner.employee = employee;
+    if (!owner) return;
+    owner->type = GNC_OWNER_EMPLOYEE;
+    owner->owner.employee = employee;
 }
 
 GncOwnerType gncOwnerGetType (const GncOwner *owner)
 {
-  if (!owner) return GNC_OWNER_NONE;
-  return owner->type;
+    if (!owner) return GNC_OWNER_NONE;
+    return owner->type;
 }
 
 QofIdType
 qofOwnerGetType(const GncOwner *owner)
 {
-	QofIdType type;
+    QofIdType type;
 
-	type = NULL;
-	switch(owner->type)
-	{
-		case GNC_OWNER_NONE : {
-			type = NULL;
-			break;
-		}
-		case GNC_OWNER_UNDEFINED : {
-			type = NULL;
-			break;
-		}
-		case GNC_OWNER_CUSTOMER : {
-			type = GNC_ID_CUSTOMER;
-			break;
-		}
-		case GNC_OWNER_JOB : {
-			type = GNC_ID_JOB;
-			break;
-		}
-		case GNC_OWNER_VENDOR : {
-			type = GNC_ID_VENDOR;
-			break;
-		}
-		case GNC_OWNER_EMPLOYEE : {
-			type = GNC_ID_EMPLOYEE;
-			break;
-		}
-	}
-	return type;
+    type = NULL;
+    switch (owner->type)
+    {
+    case GNC_OWNER_NONE :
+    {
+        type = NULL;
+        break;
+    }
+    case GNC_OWNER_UNDEFINED :
+    {
+        type = NULL;
+        break;
+    }
+    case GNC_OWNER_CUSTOMER :
+    {
+        type = GNC_ID_CUSTOMER;
+        break;
+    }
+    case GNC_OWNER_JOB :
+    {
+        type = GNC_ID_JOB;
+        break;
+    }
+    case GNC_OWNER_VENDOR :
+    {
+        type = GNC_ID_VENDOR;
+        break;
+    }
+    case GNC_OWNER_EMPLOYEE :
+    {
+        type = GNC_ID_EMPLOYEE;
+        break;
+    }
+    }
+    return type;
 }
 
 QofInstance*
 qofOwnerGetOwner (const GncOwner *owner)
 {
-	QofInstance *ent;
+    QofInstance *ent;
 
-	if(!owner) { return NULL; }
-	ent = NULL;
-	switch(owner->type)
-	{
-		case GNC_OWNER_NONE : {
-			break;
-		}
-		case GNC_OWNER_UNDEFINED : {
-			break;
-		}
-		case GNC_OWNER_CUSTOMER : {
-			ent = QOF_INSTANCE(owner->owner.customer);
-			break;
-		}
-		case GNC_OWNER_JOB : {
-			ent = QOF_INSTANCE(owner->owner.job);
-			break;
-		}
-		case GNC_OWNER_VENDOR : {
-			ent = QOF_INSTANCE(owner->owner.vendor);
-			break;
-		}
-		case GNC_OWNER_EMPLOYEE : {
-			ent = QOF_INSTANCE(owner->owner.employee);
-			break;
-		}
-	}
-	return ent;
+    if (!owner)
+    {
+        return NULL;
+    }
+    ent = NULL;
+    switch (owner->type)
+    {
+    case GNC_OWNER_NONE :
+    {
+        break;
+    }
+    case GNC_OWNER_UNDEFINED :
+    {
+        break;
+    }
+    case GNC_OWNER_CUSTOMER :
+    {
+        ent = QOF_INSTANCE(owner->owner.customer);
+        break;
+    }
+    case GNC_OWNER_JOB :
+    {
+        ent = QOF_INSTANCE(owner->owner.job);
+        break;
+    }
+    case GNC_OWNER_VENDOR :
+    {
+        ent = QOF_INSTANCE(owner->owner.vendor);
+        break;
+    }
+    case GNC_OWNER_EMPLOYEE :
+    {
+        ent = QOF_INSTANCE(owner->owner.employee);
+        break;
+    }
+    }
+    return ent;
 }
 
 void
 qofOwnerSetEntity (GncOwner *owner, QofInstance *ent)
 {
-	if(!owner || !ent) { return; }
-	if(0 == safe_strcmp(ent->e_type, GNC_ID_CUSTOMER))
-	{
-		owner->type = GNC_OWNER_CUSTOMER;
-		gncOwnerInitCustomer(owner, (GncCustomer*)ent);
-	}
-	if(0 == safe_strcmp(ent->e_type, GNC_ID_JOB))
-	{
-		owner->type = GNC_OWNER_JOB;
-		gncOwnerInitJob(owner, (GncJob*)ent);
-	}
-	if(0 == safe_strcmp(ent->e_type, GNC_ID_VENDOR))
-	{
-		owner->type = GNC_OWNER_VENDOR;
-		gncOwnerInitVendor(owner, (GncVendor*)ent);
-	}
-	if(0 == safe_strcmp(ent->e_type, GNC_ID_EMPLOYEE))
-	{
-		owner->type = GNC_OWNER_EMPLOYEE;
-		gncOwnerInitEmployee(owner, (GncEmployee*)ent);
-	}
+    if (!owner || !ent)
+    {
+        return;
+    }
+    if (0 == safe_strcmp(ent->e_type, GNC_ID_CUSTOMER))
+    {
+        owner->type = GNC_OWNER_CUSTOMER;
+        gncOwnerInitCustomer(owner, (GncCustomer*)ent);
+    }
+    if (0 == safe_strcmp(ent->e_type, GNC_ID_JOB))
+    {
+        owner->type = GNC_OWNER_JOB;
+        gncOwnerInitJob(owner, (GncJob*)ent);
+    }
+    if (0 == safe_strcmp(ent->e_type, GNC_ID_VENDOR))
+    {
+        owner->type = GNC_OWNER_VENDOR;
+        gncOwnerInitVendor(owner, (GncVendor*)ent);
+    }
+    if (0 == safe_strcmp(ent->e_type, GNC_ID_EMPLOYEE))
+    {
+        owner->type = GNC_OWNER_EMPLOYEE;
+        gncOwnerInitEmployee(owner, (GncEmployee*)ent);
+    }
 }
 
 gpointer gncOwnerGetUndefined (const GncOwner *owner)
 {
-  if (!owner) return NULL;
-  if (owner->type != GNC_OWNER_UNDEFINED) return NULL;
-  return owner->owner.undefined;
+    if (!owner) return NULL;
+    if (owner->type != GNC_OWNER_UNDEFINED) return NULL;
+    return owner->owner.undefined;
 }
 
 GncCustomer * gncOwnerGetCustomer (const GncOwner *owner)
 {
-  if (!owner) return NULL;
-  if (owner->type != GNC_OWNER_CUSTOMER) return NULL;
-  return owner->owner.customer;
+    if (!owner) return NULL;
+    if (owner->type != GNC_OWNER_CUSTOMER) return NULL;
+    return owner->owner.customer;
 }
 
 GncJob * gncOwnerGetJob (const GncOwner *owner)
 {
-  if (!owner) return NULL;
-  if (owner->type != GNC_OWNER_JOB) return NULL;
-  return owner->owner.job;
+    if (!owner) return NULL;
+    if (owner->type != GNC_OWNER_JOB) return NULL;
+    return owner->owner.job;
 }
 
 GncVendor * gncOwnerGetVendor (const GncOwner *owner)
 {
-  if (!owner) return NULL;
-  if (owner->type != GNC_OWNER_VENDOR) return NULL;
-  return owner->owner.vendor;
+    if (!owner) return NULL;
+    if (owner->type != GNC_OWNER_VENDOR) return NULL;
+    return owner->owner.vendor;
 }
 
 GncEmployee * gncOwnerGetEmployee (const GncOwner *owner)
 {
-  if (!owner) return NULL;
-  if (owner->type != GNC_OWNER_EMPLOYEE) return NULL;
-  return owner->owner.employee;
+    if (!owner) return NULL;
+    if (owner->type != GNC_OWNER_EMPLOYEE) return NULL;
+    return owner->owner.employee;
 }
 
 gnc_commodity * gncOwnerGetCurrency (const GncOwner *owner)
 {
-  if (!owner) return NULL;
-  switch (owner->type) {
-  case GNC_OWNER_NONE:
-  case GNC_OWNER_UNDEFINED:
-  default:
-    return NULL;
-  case GNC_OWNER_CUSTOMER:
-    return gncCustomerGetCurrency (owner->owner.customer);
-  case GNC_OWNER_VENDOR:
-    return gncVendorGetCurrency (owner->owner.vendor);
-  case GNC_OWNER_EMPLOYEE:
-    return gncEmployeeGetCurrency (owner->owner.employee);
-  case GNC_OWNER_JOB:
-    return gncOwnerGetCurrency (gncJobGetOwner (owner->owner.job));
-  }
+    if (!owner) return NULL;
+    switch (owner->type)
+    {
+    case GNC_OWNER_NONE:
+    case GNC_OWNER_UNDEFINED:
+    default:
+        return NULL;
+    case GNC_OWNER_CUSTOMER:
+        return gncCustomerGetCurrency (owner->owner.customer);
+    case GNC_OWNER_VENDOR:
+        return gncVendorGetCurrency (owner->owner.vendor);
+    case GNC_OWNER_EMPLOYEE:
+        return gncEmployeeGetCurrency (owner->owner.employee);
+    case GNC_OWNER_JOB:
+        return gncOwnerGetCurrency (gncJobGetOwner (owner->owner.job));
+    }
 }
 
 void gncOwnerCopy (const GncOwner *src, GncOwner *dest)
 {
-  if (!src || !dest) return;
-  if (src == dest) return;
-  memcpy (dest, src, sizeof (*dest));
+    if (!src || !dest) return;
+    if (src == dest) return;
+    memcpy (dest, src, sizeof (*dest));
 }
 
 GncOwner
 gncCloneOwner (const GncOwner *from, QofBook *book)
 {
-  GncOwner owner = { GNC_OWNER_NONE };
-  if (!from) return owner;
-  owner.type = from->type;
-  switch (from->type)
-  {
+    GncOwner owner = { GNC_OWNER_NONE };
+    if (!from) return owner;
+    owner.type = from->type;
+    switch (from->type)
+    {
     case GNC_OWNER_NONE:
-      return owner;
+        return owner;
     case GNC_OWNER_UNDEFINED:
-      owner.owner.undefined = from->owner.undefined;  /* XXX probably wrong ! */
-      return owner;
+        owner.owner.undefined = from->owner.undefined;  /* XXX probably wrong ! */
+        return owner;
     case GNC_OWNER_CUSTOMER:
-      owner.owner.customer = gncCustomerObtainTwin (from->owner.customer, book);
-      return owner;
+        owner.owner.customer = gncCustomerObtainTwin (from->owner.customer, book);
+        return owner;
     case GNC_OWNER_JOB:
-      owner.owner.job = gncJobObtainTwin (from->owner.job, book);
-      return owner;
+        owner.owner.job = gncJobObtainTwin (from->owner.job, book);
+        return owner;
     case GNC_OWNER_VENDOR:
-      owner.owner.vendor = gncVendorObtainTwin (from->owner.vendor, book);
-      return owner;
+        owner.owner.vendor = gncVendorObtainTwin (from->owner.vendor, book);
+        return owner;
     case GNC_OWNER_EMPLOYEE:
-      owner.owner.employee = gncEmployeeObtainTwin (from->owner.employee, book);
-      return owner;
+        owner.owner.employee = gncEmployeeObtainTwin (from->owner.employee, book);
+        return owner;
     default:
-      return owner;
-  }
+        return owner;
+    }
 }
 
 gboolean gncOwnerEqual (const GncOwner *a, const GncOwner *b)
 {
-  if (!a || !b) return FALSE;
-  if (gncOwnerGetType (a) != gncOwnerGetType (b)) return FALSE;
-  return (a->owner.undefined == b->owner.undefined);
+    if (!a || !b) return FALSE;
+    if (gncOwnerGetType (a) != gncOwnerGetType (b)) return FALSE;
+    return (a->owner.undefined == b->owner.undefined);
 }
 
 const char * gncOwnerGetName (const GncOwner *owner)
 {
-  if (!owner) return NULL;
-  switch (owner->type) {
-  case GNC_OWNER_NONE:
-  case GNC_OWNER_UNDEFINED:
-  default:
-    return NULL;
-  case GNC_OWNER_CUSTOMER:
-    return gncCustomerGetName (owner->owner.customer);
-  case GNC_OWNER_JOB:
-    return gncJobGetName (owner->owner.job);
-  case GNC_OWNER_VENDOR:
-    return gncVendorGetName (owner->owner.vendor);
-  case GNC_OWNER_EMPLOYEE:
-    return gncAddressGetName(gncEmployeeGetAddr (owner->owner.employee));
-  }
+    if (!owner) return NULL;
+    switch (owner->type)
+    {
+    case GNC_OWNER_NONE:
+    case GNC_OWNER_UNDEFINED:
+    default:
+        return NULL;
+    case GNC_OWNER_CUSTOMER:
+        return gncCustomerGetName (owner->owner.customer);
+    case GNC_OWNER_JOB:
+        return gncJobGetName (owner->owner.job);
+    case GNC_OWNER_VENDOR:
+        return gncVendorGetName (owner->owner.vendor);
+    case GNC_OWNER_EMPLOYEE:
+        return gncAddressGetName(gncEmployeeGetAddr (owner->owner.employee));
+    }
 }
 
 const GUID * gncOwnerGetGUID (const GncOwner *owner)
 {
-  if (!owner) return NULL;
+    if (!owner) return NULL;
 
-  switch (owner->type) {
-  case GNC_OWNER_NONE:
-  case GNC_OWNER_UNDEFINED:
-  default:
-    return NULL;
-  case GNC_OWNER_CUSTOMER:
-    return qof_instance_get_guid (QOF_INSTANCE(owner->owner.customer));
-  case GNC_OWNER_JOB:
-    return qof_instance_get_guid (QOF_INSTANCE(owner->owner.job));
-  case GNC_OWNER_VENDOR:
-    return qof_instance_get_guid (QOF_INSTANCE(owner->owner.vendor));
-  case GNC_OWNER_EMPLOYEE:
-    return qof_instance_get_guid (QOF_INSTANCE(owner->owner.employee));
-  }
+    switch (owner->type)
+    {
+    case GNC_OWNER_NONE:
+    case GNC_OWNER_UNDEFINED:
+    default:
+        return NULL;
+    case GNC_OWNER_CUSTOMER:
+        return qof_instance_get_guid (QOF_INSTANCE(owner->owner.customer));
+    case GNC_OWNER_JOB:
+        return qof_instance_get_guid (QOF_INSTANCE(owner->owner.job));
+    case GNC_OWNER_VENDOR:
+        return qof_instance_get_guid (QOF_INSTANCE(owner->owner.vendor));
+    case GNC_OWNER_EMPLOYEE:
+        return qof_instance_get_guid (QOF_INSTANCE(owner->owner.employee));
+    }
 }
 
 GUID gncOwnerRetGUID (GncOwner *owner)
 {
-  const GUID *guid = gncOwnerGetGUID (owner);
-  if (guid)
-    return *guid;
-  return *guid_null ();
+    const GUID *guid = gncOwnerGetGUID (owner);
+    if (guid)
+        return *guid;
+    return *guid_null ();
 }
 
 GncOwner * gncOwnerGetEndOwner (GncOwner *owner)
 {
-  if (!owner) return NULL;
-  switch (owner->type) {
-  case GNC_OWNER_NONE:
-  case GNC_OWNER_UNDEFINED:
-  default:
-    return NULL;
-  case GNC_OWNER_CUSTOMER:
-  case GNC_OWNER_VENDOR:
-  case GNC_OWNER_EMPLOYEE:
-    return owner;
-  case GNC_OWNER_JOB:
-    return gncJobGetOwner (owner->owner.job);
-  }
+    if (!owner) return NULL;
+    switch (owner->type)
+    {
+    case GNC_OWNER_NONE:
+    case GNC_OWNER_UNDEFINED:
+    default:
+        return NULL;
+    case GNC_OWNER_CUSTOMER:
+    case GNC_OWNER_VENDOR:
+    case GNC_OWNER_EMPLOYEE:
+        return owner;
+    case GNC_OWNER_JOB:
+        return gncJobGetOwner (owner->owner.job);
+    }
 }
 
 int gncOwnerCompare (const GncOwner *a, const GncOwner *b)
 {
-  if (!a && !b) return 0;
-  if (!a && b) return 1;
-  if (a && !b) return -1;
+    if (!a && !b) return 0;
+    if (!a && b) return 1;
+    if (a && !b) return -1;
 
-  if (a->type != b->type)
-    return (a->type - b->type);
+    if (a->type != b->type)
+        return (a->type - b->type);
 
-  switch (a->type) {
-  case GNC_OWNER_NONE:
-  case GNC_OWNER_UNDEFINED:
-  default:
-    return 0;
-  case GNC_OWNER_CUSTOMER:
-    return gncCustomerCompare (a->owner.customer, b->owner.customer);
-  case GNC_OWNER_VENDOR:
-    return gncVendorCompare (a->owner.vendor, b->owner.vendor);
-  case GNC_OWNER_EMPLOYEE:
-    return gncEmployeeCompare (a->owner.employee, b->owner.employee);
-  case GNC_OWNER_JOB:
-    return gncJobCompare (a->owner.job, b->owner.job);
-  }
+    switch (a->type)
+    {
+    case GNC_OWNER_NONE:
+    case GNC_OWNER_UNDEFINED:
+    default:
+        return 0;
+    case GNC_OWNER_CUSTOMER:
+        return gncCustomerCompare (a->owner.customer, b->owner.customer);
+    case GNC_OWNER_VENDOR:
+        return gncVendorCompare (a->owner.vendor, b->owner.vendor);
+    case GNC_OWNER_EMPLOYEE:
+        return gncEmployeeCompare (a->owner.employee, b->owner.employee);
+    case GNC_OWNER_JOB:
+        return gncJobCompare (a->owner.job, b->owner.job);
+    }
 }
 
 const GUID * gncOwnerGetEndGUID (GncOwner *owner)
 {
-  if (!owner) return NULL;
-  owner = gncOwnerGetEndOwner (owner);
-  return gncOwnerGetGUID (owner);
+    if (!owner) return NULL;
+    owner = gncOwnerGetEndOwner (owner);
+    return gncOwnerGetGUID (owner);
 }
 
 void gncOwnerAttachToLot (const GncOwner *owner, GNCLot *lot)
 {
-  KvpFrame *kvp;
-  KvpValue *value;
-  
-  if (!owner || !lot)
-    return;
+    KvpFrame *kvp;
+    KvpValue *value;
 
-  kvp = gnc_lot_get_slots (lot);
+    if (!owner || !lot)
+        return;
 
-  value = kvp_value_new_gint64 (gncOwnerGetType (owner));
-  kvp_frame_set_slot_path (kvp, value, GNC_OWNER_ID, GNC_OWNER_TYPE, NULL);
-  kvp_value_delete (value);
+    kvp = gnc_lot_get_slots (lot);
 
-  value = kvp_value_new_guid (gncOwnerGetGUID (owner));
-  kvp_frame_set_slot_path (kvp, value, GNC_OWNER_ID, GNC_OWNER_GUID, NULL);
-  kvp_value_delete (value);
+    value = kvp_value_new_gint64 (gncOwnerGetType (owner));
+    kvp_frame_set_slot_path (kvp, value, GNC_OWNER_ID, GNC_OWNER_TYPE, NULL);
+    kvp_value_delete (value);
 
+    value = kvp_value_new_guid (gncOwnerGetGUID (owner));
+    kvp_frame_set_slot_path (kvp, value, GNC_OWNER_ID, GNC_OWNER_GUID, NULL);
+    kvp_value_delete (value);
+
 }
 
 gboolean gncOwnerGetOwnerFromLot (GNCLot *lot, GncOwner *owner)
 {
-  KvpFrame *kvp;
-  KvpValue *value;
-  GUID *guid;
-  QofBook *book;
-  GncOwnerType type;
+    KvpFrame *kvp;
+    KvpValue *value;
+    GUID *guid;
+    QofBook *book;
+    GncOwnerType type;
 
-  if (!lot || !owner) return FALSE;
+    if (!lot || !owner) return FALSE;
 
-  book = gnc_lot_get_book (lot);
-  kvp = gnc_lot_get_slots (lot);
+    book = gnc_lot_get_book (lot);
+    kvp = gnc_lot_get_slots (lot);
 
-  value = kvp_frame_get_slot_path (kvp, GNC_OWNER_ID, GNC_OWNER_TYPE, NULL);
-  if (!value) return FALSE;
+    value = kvp_frame_get_slot_path (kvp, GNC_OWNER_ID, GNC_OWNER_TYPE, NULL);
+    if (!value) return FALSE;
 
-  type = kvp_value_get_gint64 (value);
+    type = kvp_value_get_gint64 (value);
 
-  value = kvp_frame_get_slot_path (kvp, GNC_OWNER_ID, GNC_OWNER_GUID, NULL);
-  if (!value) return FALSE;
+    value = kvp_frame_get_slot_path (kvp, GNC_OWNER_ID, GNC_OWNER_GUID, NULL);
+    if (!value) return FALSE;
 
-  guid = kvp_value_get_guid (value);
-  if (!guid)
-    return FALSE;
+    guid = kvp_value_get_guid (value);
+    if (!guid)
+        return FALSE;
 
-  switch (type) {
-  case GNC_OWNER_CUSTOMER:
-    gncOwnerInitCustomer (owner, gncCustomerLookup (book, guid));
-    break;
-  case GNC_OWNER_VENDOR:
-    gncOwnerInitVendor (owner, gncVendorLookup (book, guid));
-    break;
-  case GNC_OWNER_EMPLOYEE:
-    gncOwnerInitEmployee (owner, gncEmployeeLookup (book, guid));
-    break;
-  case GNC_OWNER_JOB:
-    gncOwnerInitJob (owner, gncJobLookup (book, guid));
-    break;
-  default:
-    return FALSE;
-  }
-  
-  return (owner->owner.undefined != NULL);
+    switch (type)
+    {
+    case GNC_OWNER_CUSTOMER:
+        gncOwnerInitCustomer (owner, gncCustomerLookup (book, guid));
+        break;
+    case GNC_OWNER_VENDOR:
+        gncOwnerInitVendor (owner, gncVendorLookup (book, guid));
+        break;
+    case GNC_OWNER_EMPLOYEE:
+        gncOwnerInitEmployee (owner, gncEmployeeLookup (book, guid));
+        break;
+    case GNC_OWNER_JOB:
+        gncOwnerInitJob (owner, gncJobLookup (book, guid));
+        break;
+    default:
+        return FALSE;
+    }
+
+    return (owner->owner.undefined != NULL);
 }
 
 gboolean gncOwnerIsValid (const GncOwner *owner)
 {
-  if (!owner) return FALSE;
-  return (owner->owner.undefined != NULL);
+    if (!owner) return FALSE;
+    return (owner->owner.undefined != NULL);
 }
 
 KvpFrame* gncOwnerGetSlots(GncOwner* owner)
 {
-  if (!owner) return NULL;
+    if (!owner) return NULL;
 
-  switch (gncOwnerGetType(owner)) {
-  case GNC_OWNER_CUSTOMER:
-  case GNC_OWNER_VENDOR:
-  case GNC_OWNER_EMPLOYEE:
-    return qof_instance_get_slots(QOF_INSTANCE(owner->owner.undefined));
-  case GNC_OWNER_JOB:
-    return gncOwnerGetSlots(gncJobGetOwner(gncOwnerGetJob(owner)));
-  default:
-    return NULL;
-  }
+    switch (gncOwnerGetType(owner))
+    {
+    case GNC_OWNER_CUSTOMER:
+    case GNC_OWNER_VENDOR:
+    case GNC_OWNER_EMPLOYEE:
+        return qof_instance_get_slots(QOF_INSTANCE(owner->owner.undefined));
+    case GNC_OWNER_JOB:
+        return gncOwnerGetSlots(gncJobGetOwner(gncOwnerGetJob(owner)));
+    default:
+        return NULL;
+    }
 }
 
 /* XXX: Yea, this is broken, but it should work fine for Queries.
@@ -486,67 +511,76 @@
 static GncOwner *
 owner_from_lot (GNCLot *lot)
 {
-  static GncOwner owner;
+    static GncOwner owner;
 
-  if (!lot) return NULL;
-  if (gncOwnerGetOwnerFromLot (lot, &owner))
-    return &owner;
+    if (!lot) return NULL;
+    if (gncOwnerGetOwnerFromLot (lot, &owner))
+        return &owner;
 
-  return NULL;
+    return NULL;
 }
 
 static void
 reg_lot (void)
 {
-  static QofParam params[] = {
-    { OWNER_FROM_LOT, _GNC_MOD_NAME, (QofAccessFunc)owner_from_lot, NULL },
-    { NULL },
-  };
+    static QofParam params[] =
+    {
+        { OWNER_FROM_LOT, _GNC_MOD_NAME, (QofAccessFunc)owner_from_lot, NULL },
+        { NULL },
+    };
 
-  qof_class_register (GNC_ID_LOT, NULL, params);
+    qof_class_register (GNC_ID_LOT, NULL, params);
 }
 
 gboolean gncOwnerGetOwnerFromTypeGuid (QofBook *book, GncOwner *owner, QofIdType type, GUID *guid)
 {
-  if (!book || !owner || !type || !guid) return FALSE;
+    if (!book || !owner || !type || !guid) return FALSE;
 
-  if (0 == safe_strcmp(type, GNC_ID_CUSTOMER)) {
-    GncCustomer *customer = gncCustomerLookup(book,guid);
-    gncOwnerInitCustomer(owner, customer);
-    return (NULL != customer);
-  } else if (0 == safe_strcmp(type, GNC_ID_JOB)) {
-    GncJob *job = gncJobLookup(book,guid);
-    gncOwnerInitJob(owner, job);
-    return (NULL != job);
-  } else if (0 == safe_strcmp(type, GNC_ID_VENDOR)) {
-    GncVendor *vendor = gncVendorLookup(book,guid);
-    gncOwnerInitVendor(owner, vendor);
-    return (NULL != vendor);
-  } else if (0 == safe_strcmp(type, GNC_ID_EMPLOYEE)) {
-    GncEmployee *employee = gncEmployeeLookup(book,guid);
-    gncOwnerInitEmployee(owner, employee);
-    return (NULL != employee);
-  }
-  return 0;
+    if (0 == safe_strcmp(type, GNC_ID_CUSTOMER))
+    {
+        GncCustomer *customer = gncCustomerLookup(book, guid);
+        gncOwnerInitCustomer(owner, customer);
+        return (NULL != customer);
+    }
+    else if (0 == safe_strcmp(type, GNC_ID_JOB))
+    {
+        GncJob *job = gncJobLookup(book, guid);
+        gncOwnerInitJob(owner, job);
+        return (NULL != job);
+    }
+    else if (0 == safe_strcmp(type, GNC_ID_VENDOR))
+    {
+        GncVendor *vendor = gncVendorLookup(book, guid);
+        gncOwnerInitVendor(owner, vendor);
+        return (NULL != vendor);
+    }
+    else if (0 == safe_strcmp(type, GNC_ID_EMPLOYEE))
+    {
+        GncEmployee *employee = gncEmployeeLookup(book, guid);
+        gncOwnerInitEmployee(owner, employee);
+        return (NULL != employee);
+    }
+    return 0;
 }
 
 gboolean gncOwnerRegister (void)
 {
-  static QofParam params[] = {
-    { OWNER_TYPE, QOF_TYPE_INT64,      (QofAccessFunc)gncOwnerGetType,          NULL },
-    { OWNER_CUSTOMER, GNC_ID_CUSTOMER, (QofAccessFunc)gncOwnerGetCustomer,      NULL },
-    { OWNER_JOB, GNC_ID_JOB,           (QofAccessFunc)gncOwnerGetJob,           NULL },
-    { OWNER_VENDOR, GNC_ID_VENDOR,     (QofAccessFunc)gncOwnerGetVendor,        NULL },
-    { OWNER_EMPLOYEE, GNC_ID_EMPLOYEE, (QofAccessFunc)gncOwnerGetEmployee,      NULL },
-    { OWNER_PARENT, GNC_ID_OWNER,      (QofAccessFunc)gncOwnerGetEndOwner,      NULL },
-    { OWNER_PARENTG, QOF_TYPE_GUID,    (QofAccessFunc)gncOwnerGetEndGUID,       NULL },
-    { OWNER_NAME, QOF_TYPE_STRING,     (QofAccessFunc)gncOwnerGetName, NULL },
-    { QOF_PARAM_GUID, QOF_TYPE_GUID,   (QofAccessFunc)gncOwnerGetGUID, NULL },
-    { NULL },
-  };
+    static QofParam params[] =
+    {
+        { OWNER_TYPE, QOF_TYPE_INT64,      (QofAccessFunc)gncOwnerGetType,          NULL },
+        { OWNER_CUSTOMER, GNC_ID_CUSTOMER, (QofAccessFunc)gncOwnerGetCustomer,      NULL },
+        { OWNER_JOB, GNC_ID_JOB,           (QofAccessFunc)gncOwnerGetJob,           NULL },
+        { OWNER_VENDOR, GNC_ID_VENDOR,     (QofAccessFunc)gncOwnerGetVendor,        NULL },
+        { OWNER_EMPLOYEE, GNC_ID_EMPLOYEE, (QofAccessFunc)gncOwnerGetEmployee,      NULL },
+        { OWNER_PARENT, GNC_ID_OWNER,      (QofAccessFunc)gncOwnerGetEndOwner,      NULL },
+        { OWNER_PARENTG, QOF_TYPE_GUID,    (QofAccessFunc)gncOwnerGetEndGUID,       NULL },
+        { OWNER_NAME, QOF_TYPE_STRING,     (QofAccessFunc)gncOwnerGetName, NULL },
+        { QOF_PARAM_GUID, QOF_TYPE_GUID,   (QofAccessFunc)gncOwnerGetGUID, NULL },
+        { NULL },
+    };
 
-  qof_class_register (GNC_ID_OWNER, (QofSortFunc)gncOwnerCompare, params);
-  reg_lot ();
+    qof_class_register (GNC_ID_OWNER, (QofSortFunc)gncOwnerCompare, params);
+    reg_lot ();
 
-  return TRUE;
+    return TRUE;
 }

Modified: gnucash/trunk/src/business/business-core/gncOwner.h
===================================================================
--- gnucash/trunk/src/business/business-core/gncOwner.h	2010-03-02 21:40:28 UTC (rev 18788)
+++ gnucash/trunk/src/business/business-core/gncOwner.h	2010-03-02 21:41:05 UTC (rev 18789)
@@ -42,16 +42,17 @@
 #include "gncJob.h"
 #include "gncVendor.h"
 #include "gncEmployee.h"
-#include "gnc-lot.h" 
+#include "gnc-lot.h"
 
-typedef enum { 
-	GNC_OWNER_NONE , 
-	GNC_OWNER_UNDEFINED , 
-	GNC_OWNER_CUSTOMER , 
-	GNC_OWNER_JOB , 
-	GNC_OWNER_VENDOR , 
-	GNC_OWNER_EMPLOYEE , 
-}GncOwnerType;
+typedef enum
+{
+    GNC_OWNER_NONE ,
+    GNC_OWNER_UNDEFINED ,
+    GNC_OWNER_CUSTOMER ,
+    GNC_OWNER_JOB ,
+    GNC_OWNER_VENDOR ,
+    GNC_OWNER_EMPLOYEE ,
+} GncOwnerType;
 
 /** \name QOF handling
 
@@ -75,16 +76,18 @@
 #ifndef SWIG
 
 /** \struct GncOwner */
-struct _gncOwner {
-  GncOwnerType     type;      /**< Customer, Job, Vendor, Employee or Undefined. */
-  union {
-    gpointer       undefined;
-    GncCustomer *  customer;
-    GncJob *       job;
-    GncVendor *    vendor;
-    GncEmployee *  employee;
-  } owner;                   /**< holds the pointer to the owner object. */
-  gpointer         qof_temp; /**< Set type independently of the owner. */
+struct _gncOwner
+{
+    GncOwnerType     type;      /**< Customer, Job, Vendor, Employee or Undefined. */
+    union
+    {
+        gpointer       undefined;
+        GncCustomer *  customer;
+        GncJob *       job;
+        GncVendor *    vendor;
+        GncEmployee *  employee;
+    } owner;                   /**< holds the pointer to the owner object. */
+    gpointer         qof_temp; /**< Set type independently of the owner. */
 };
 
 #endif /* SWIG */

Modified: gnucash/trunk/src/business/business-core/gncOwnerP.h
===================================================================
--- gnucash/trunk/src/business/business-core/gncOwnerP.h	2010-03-02 21:40:28 UTC (rev 18788)
+++ gnucash/trunk/src/business/business-core/gncOwnerP.h	2010-03-02 21:41:05 UTC (rev 18789)
@@ -1,5 +1,5 @@
 /********************************************************************\
- * gncOwnerP.h -- Business Interface:  Object OWNERs private file   * 
+ * gncOwnerP.h -- Business Interface:  Object OWNERs private file   *
  *                                                                  *
  * This program is free software; you can redistribute it and/or    *
  * modify it under the terms of the GNU General Public License as   *

Modified: gnucash/trunk/src/business/business-core/gncTaxTable.c
===================================================================
--- gnucash/trunk/src/business/business-core/gncTaxTable.c	2010-03-02 21:40:28 UTC (rev 18788)
+++ gnucash/trunk/src/business/business-core/gncTaxTable.c	2010-03-02 21:41:05 UTC (rev 18789)
@@ -32,38 +32,38 @@
 
 #include "gncTaxTableP.h"
 
-struct _gncTaxTable 
+struct _gncTaxTable
 {
-  QofInstance     inst;
-  char *          name;
-  GncTaxTableEntryList*  entries;
-  Timespec        modtime;      /* internal date of last modtime */
+    QofInstance     inst;
+    char *          name;
+    GncTaxTableEntryList*  entries;
+    Timespec        modtime;      /* internal date of last modtime */
 
-  /* See src/doc/business.txt for an explanation of the following */
-  /* Code that handles this is *identical* to that in gncBillTerm */
-  gint64          refcount;
-  GncTaxTable *   parent;       /* if non-null, we are an immutable child */
-  GncTaxTable *   child;        /* if non-null, we have not changed */
-  gboolean        invisible;
-  GList *         children;     /* list of children for disconnection */
+    /* See src/doc/business.txt for an explanation of the following */
+    /* Code that handles this is *identical* to that in gncBillTerm */
+    gint64          refcount;
+    GncTaxTable *   parent;       /* if non-null, we are an immutable child */
+    GncTaxTable *   child;        /* if non-null, we have not changed */
+    gboolean        invisible;
+    GList *         children;     /* list of children for disconnection */
 };
 
 struct _gncTaxTableClass
 {
-  QofInstanceClass parent_class;
+    QofInstanceClass parent_class;
 };
 
-struct _gncTaxTableEntry 
+struct _gncTaxTableEntry
 {
-  GncTaxTable *   table;
-  Account *       account;
-  GncAmountType   type;
-  gnc_numeric     amount;
+    GncTaxTable *   table;
+    Account *       account;
+    GncAmountType   type;
+    gnc_numeric     amount;
 };
 
-struct _book_info 
+struct _book_info
 {
-  GList *         tables;          /* visible tables */
+    GList *         tables;          /* visible tables */
 };
 
 static GncTaxTableEntry * CloneTaxEntry (const GncTaxTableEntry*, QofBook *);
@@ -78,30 +78,30 @@
 const char *
 gncAmountTypeToString (GncAmountType type)
 {
-  switch(type) 
-  {
-    GNC_RETURN_ENUM_AS_STRING(GNC_AMT_TYPE_VALUE, "VALUE");
-    GNC_RETURN_ENUM_AS_STRING(GNC_AMT_TYPE_PERCENT, "PERCENT");
+    switch (type)
+    {
+        GNC_RETURN_ENUM_AS_STRING(GNC_AMT_TYPE_VALUE, "VALUE");
+        GNC_RETURN_ENUM_AS_STRING(GNC_AMT_TYPE_PERCENT, "PERCENT");
     default:
-      g_warning ("asked to translate unknown amount type %d.\n", type);
-      break;
-  }
-  return(NULL);
+        g_warning ("asked to translate unknown amount type %d.\n", type);
+        break;
+    }
+    return(NULL);
 }
 
 const char *
 gncTaxIncludedTypeToString (GncTaxIncluded type)
 {
-  switch(type) 
-  {
-    GNC_RETURN_ENUM_AS_STRING(GNC_TAXINCLUDED_YES, "YES");
-    GNC_RETURN_ENUM_AS_STRING(GNC_TAXINCLUDED_NO, "NO");
-    GNC_RETURN_ENUM_AS_STRING(GNC_TAXINCLUDED_USEGLOBAL, "USEGLOBAL");
+    switch (type)
+    {
+        GNC_RETURN_ENUM_AS_STRING(GNC_TAXINCLUDED_YES, "YES");
+        GNC_RETURN_ENUM_AS_STRING(GNC_TAXINCLUDED_NO, "NO");
+        GNC_RETURN_ENUM_AS_STRING(GNC_TAXINCLUDED_USEGLOBAL, "USEGLOBAL");
     default:
-      g_warning ("asked to translate unknown taxincluded type %d.\n", type);
-      break;
-  }
-  return(NULL);
+        g_warning ("asked to translate unknown taxincluded type %d.\n", type);
+        break;
+    }
+    return(NULL);
 }
 #undef GNC_RETURN_ENUM_AS_STRING
 #define GNC_RETURN_ON_MATCH(s,x) \
@@ -109,24 +109,24 @@
 gboolean
 gncAmountStringToType (const char *str, GncAmountType *type)
 {
-  GNC_RETURN_ON_MATCH ("VALUE", GNC_AMT_TYPE_VALUE);
-  GNC_RETURN_ON_MATCH ("PERCENT", GNC_AMT_TYPE_PERCENT);
-  g_warning ("asked to translate unknown amount type string %s.\n",
-       str ? str : "(null)");
+    GNC_RETURN_ON_MATCH ("VALUE", GNC_AMT_TYPE_VALUE);
+    GNC_RETURN_ON_MATCH ("PERCENT", GNC_AMT_TYPE_PERCENT);
+    g_warning ("asked to translate unknown amount type string %s.\n",
+               str ? str : "(null)");
 
-  return(FALSE);
+    return(FALSE);
 }
 
 gboolean
 gncTaxIncludedStringToType (const char *str, GncTaxIncluded *type)
 {
-  GNC_RETURN_ON_MATCH ("YES", GNC_TAXINCLUDED_YES);
-  GNC_RETURN_ON_MATCH ("NO", GNC_TAXINCLUDED_NO);
-  GNC_RETURN_ON_MATCH ("USEGLOBAL", GNC_TAXINCLUDED_USEGLOBAL);
-  g_warning ("asked to translate unknown taxincluded type string %s.\n",
-       str ? str : "(null)");
+    GNC_RETURN_ON_MATCH ("YES", GNC_TAXINCLUDED_YES);
+    GNC_RETURN_ON_MATCH ("NO", GNC_TAXINCLUDED_NO);
+    GNC_RETURN_ON_MATCH ("USEGLOBAL", GNC_TAXINCLUDED_USEGLOBAL);
+    g_warning ("asked to translate unknown taxincluded type string %s.\n",
+               str ? str : "(null)");
 
-  return(FALSE);
+    return(FALSE);
 }
 #undef GNC_RETURN_ON_MATCH
 
@@ -148,67 +148,68 @@
 static inline void
 mark_table (GncTaxTable *table)
 {
-  qof_instance_set_dirty(&table->inst);
-  qof_event_gen (&table->inst, QOF_EVENT_MODIFY, NULL);
+    qof_instance_set_dirty(&table->inst);
+    qof_event_gen (&table->inst, QOF_EVENT_MODIFY, NULL);
 }
 
-static inline void 
+static inline void
 maybe_resort_list (GncTaxTable *table)
 {
-  struct _book_info *bi;
+    struct _book_info *bi;
 
-  if (table->parent || table->invisible) return;
-  bi = qof_book_get_data (qof_instance_get_book(table), _GNC_MOD_NAME);
-  bi->tables = g_list_sort (bi->tables, (GCompareFunc)gncTaxTableCompare);
+    if (table->parent || table->invisible) return;
+    bi = qof_book_get_data (qof_instance_get_book(table), _GNC_MOD_NAME);
+    bi->tables = g_list_sort (bi->tables, (GCompareFunc)gncTaxTableCompare);
 }
 
 static inline void
 mod_table (GncTaxTable *table)
 {
-  timespecFromTime_t (&table->modtime, time(NULL));
+    timespecFromTime_t (&table->modtime, time(NULL));
 }
 
 static inline void addObj (GncTaxTable *table)
 {
-  struct _book_info *bi;
-  bi = qof_book_get_data (qof_instance_get_book(table), _GNC_MOD_NAME);
-  bi->tables = g_list_insert_sorted (bi->tables, table,
+    struct _book_info *bi;
+    bi = qof_book_get_data (qof_instance_get_book(table), _GNC_MOD_NAME);
+    bi->tables = g_list_insert_sorted (bi->tables, table,
                                        (GCompareFunc)gncTaxTableCompare);
 }
 
 static inline void remObj (GncTaxTable *table)
 {
-  struct _book_info *bi;
-  bi = qof_book_get_data (qof_instance_get_book(table), _GNC_MOD_NAME);
-  bi->tables = g_list_remove (bi->tables, table);
+    struct _book_info *bi;
+    bi = qof_book_get_data (qof_instance_get_book(table), _GNC_MOD_NAME);
+    bi->tables = g_list_remove (bi->tables, table);
 }
 
 static inline void
 gncTaxTableAddChild (GncTaxTable *table, GncTaxTable *child)
 {
-  g_return_if_fail(table);
-  g_return_if_fail(child);
-  g_return_if_fail(qof_instance_get_destroying(table) == FALSE);
+    g_return_if_fail(table);
+    g_return_if_fail(child);
+    g_return_if_fail(qof_instance_get_destroying(table) == FALSE);
 
-  table->children = g_list_prepend(table->children, child);
+    table->children = g_list_prepend(table->children, child);
 }
 
 static inline void
 gncTaxTableRemoveChild (GncTaxTable *table, const GncTaxTable *child)
 {
-  g_return_if_fail(table);
-  g_return_if_fail(child);
+    g_return_if_fail(table);
+    g_return_if_fail(child);
 
-  if (qof_instance_get_destroying(table)) return;
+    if (qof_instance_get_destroying(table)) return;
 
-  table->children = g_list_remove(table->children, child);
+    table->children = g_list_remove(table->children, child);
 }
 
 /* =============================================================== */
 
-enum {
+enum
+{
     PROP_0,
-	PROP_NAME
+    PROP_NAME
 };
 
 /* GObject Initialization */
@@ -233,43 +234,45 @@
 
 static void
 gnc_taxtable_get_property (GObject         *object,
-			  guint            prop_id,
-			  GValue          *value,
-			  GParamSpec      *pspec)
+                           guint            prop_id,
+                           GValue          *value,
+                           GParamSpec      *pspec)
 {
     GncTaxTable *tt;
 
     g_return_if_fail(GNC_IS_TAXTABLE(object));
 
     tt = GNC_TAXTABLE(object);
-    switch (prop_id) {
-	case PROP_NAME:
-	    g_value_set_string(value, tt->name);
-		break;
-	default:
-	    G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec);
-	    break;
+    switch (prop_id)
+    {
+    case PROP_NAME:
+        g_value_set_string(value, tt->name);
+        break;
+    default:
+        G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec);
+        break;
     }
 }
 
 static void
 gnc_taxtable_set_property (GObject         *object,
-			  guint            prop_id,
-			  const GValue          *value,
-			  GParamSpec      *pspec)
+                           guint            prop_id,
+                           const GValue          *value,
+                           GParamSpec      *pspec)
 {
     GncTaxTable *tt;
 
     g_return_if_fail(GNC_IS_TAXTABLE(object));
 
     tt = GNC_TAXTABLE(object);
-    switch (prop_id) {
-	case PROP_NAME:
-	    gncTaxTableSetName(tt, g_value_get_string(value));
-		break;
-	default:
-	    G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec);
-	    break;
+    switch (prop_id)
+    {
+    case PROP_NAME:
+        gncTaxTableSetName(tt, g_value_get_string(value));
+        break;
+    default:
+        G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec);
+        break;
     }
 }
 
@@ -277,185 +280,186 @@
 gnc_taxtable_class_init (GncTaxTableClass *klass)
 {
     GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
-	
+
     gobject_class->dispose = gnc_taxtable_dispose;
     gobject_class->finalize = gnc_taxtable_finalize;
     gobject_class->set_property = gnc_taxtable_set_property;
     gobject_class->get_property = gnc_taxtable_get_property;
 
     g_object_class_install_property
-	(gobject_class,
-	 PROP_NAME,
-	 g_param_spec_string ("name",
-			      "TaxTable Name",
-			      "The accountName is an arbitrary string "
-			      "assigned by the user.  It is intended to "
-			      "a short, 10 to 30 character long string "
-			      "that is displayed by the GUI as the "
-			      "tax table mnemonic.",
-			      NULL,
-			      G_PARAM_READWRITE));
+    (gobject_class,
+     PROP_NAME,
+     g_param_spec_string ("name",
+                          "TaxTable Name",
+                          "The accountName is an arbitrary string "
+                          "assigned by the user.  It is intended to "
+                          "a short, 10 to 30 character long string "
+                          "that is displayed by the GUI as the "
+                          "tax table mnemonic.",
+                          NULL,
+                          G_PARAM_READWRITE));
 }
 
 /* Create/Destroy Functions */
-GncTaxTable * 
+GncTaxTable *
 gncTaxTableCreate (QofBook *book)
 {
-  GncTaxTable *table;
-  if (!book) return NULL;
+    GncTaxTable *table;
+    if (!book) return NULL;
 
-  table = g_object_new (GNC_TYPE_TAXTABLE, NULL);
-  qof_instance_init_data (&table->inst, _GNC_MOD_NAME, book);
-  table->name = CACHE_INSERT ("");
-  addObj (table);
-  qof_event_gen (&table->inst, QOF_EVENT_CREATE, NULL);
-  return table;
+    table = g_object_new (GNC_TYPE_TAXTABLE, NULL);
+    qof_instance_init_data (&table->inst, _GNC_MOD_NAME, book);
+    table->name = CACHE_INSERT ("");
+    addObj (table);
+    qof_event_gen (&table->inst, QOF_EVENT_CREATE, NULL);
+    return table;
 }
 
 
-GncTaxTable * 
+GncTaxTable *
 gncCloneTaxTable (GncTaxTable *from, QofBook *book)
 {
-  GList *node;
-  GncTaxTable *table;
-  if (!book) return NULL;
+    GList *node;
+    GncTaxTable *table;
+    if (!book) return NULL;
 
-  table = g_object_new (GNC_TYPE_TAXTABLE, NULL);
-  qof_instance_init_data (&table->inst, _GNC_MOD_NAME, book);
-  qof_instance_gemini (&table->inst, &from->inst);
-  
-  table->name = CACHE_INSERT (from->name);
-  table->modtime = from->modtime;
-  table->invisible = from->invisible;
+    table = g_object_new (GNC_TYPE_TAXTABLE, NULL);
+    qof_instance_init_data (&table->inst, _GNC_MOD_NAME, book);
+    qof_instance_gemini (&table->inst, &from->inst);
 
-  table->refcount = 0;
+    table->name = CACHE_INSERT (from->name);
+    table->modtime = from->modtime;
+    table->invisible = from->invisible;
 
-  /* Make copies of parents and children. Note that this can be
-   * a recursive copy ... treat as doubly-linked list. */
-  if (from->child)
-  {
-    table->child = gncTaxTableObtainTwin (from->child, book);
-    table->child->parent = table;
-  }
-  if (from->parent)
-  {
-    table->parent = gncTaxTableObtainTwin (from->parent, book);
-    table->parent->child = table;
-  }
-  for (node=g_list_last(from->children); node; node=node->next)
-  {
-    GncTaxTable *tbl = node->data;
-    tbl = gncTaxTableObtainTwin (tbl, book);
-    tbl->parent = table;
-    table->children = g_list_prepend(table->children, tbl);
-  }
+    table->refcount = 0;
 
-  /* Copy tax entries, preserving the order in the list */
-  table->entries = NULL;
-  for (node=g_list_last(from->entries); node; node=node->prev)
-  {
-    GncTaxTableEntry *ent = node->data;
-    ent = CloneTaxEntry (ent, book);
-    table->entries = g_list_prepend (table->entries, ent);
-  }
+    /* Make copies of parents and children. Note that this can be
+     * a recursive copy ... treat as doubly-linked list. */
+    if (from->child)
+    {
+        table->child = gncTaxTableObtainTwin (from->child, book);
+        table->child->parent = table;
+    }
+    if (from->parent)
+    {
+        table->parent = gncTaxTableObtainTwin (from->parent, book);
+        table->parent->child = table;
+    }
+    for (node = g_list_last(from->children); node; node = node->next)
+    {
+        GncTaxTable *tbl = node->data;
+        tbl = gncTaxTableObtainTwin (tbl, book);
+        tbl->parent = table;
+        table->children = g_list_prepend(table->children, tbl);
+    }
 
-  addObj (table);
-  qof_event_gen (&table->inst, QOF_EVENT_CREATE, NULL);
-  return table;
+    /* Copy tax entries, preserving the order in the list */
+    table->entries = NULL;
+    for (node = g_list_last(from->entries); node; node = node->prev)
+    {
+        GncTaxTableEntry *ent = node->data;
+        ent = CloneTaxEntry (ent, book);
+        table->entries = g_list_prepend (table->entries, ent);
+    }
+
+    addObj (table);
+    qof_event_gen (&table->inst, QOF_EVENT_CREATE, NULL);
+    return table;
 }
 
 GncTaxTable *
 gncTaxTableObtainTwin (const GncTaxTable *from, QofBook *book)
 {
-  GncTaxTable *table;
-  if (!from) return NULL;
+    GncTaxTable *table;
+    if (!from) return NULL;
 
-  table = (GncTaxTable *) qof_instance_lookup_twin (QOF_INSTANCE(from), book);
-  if (!table)
-  {
-    table = gncCloneTaxTable (table, book);
-  }
-  return table;
+    table = (GncTaxTable *) qof_instance_lookup_twin (QOF_INSTANCE(from), book);
+    if (!table)
+    {
+        table = gncCloneTaxTable (table, book);
+    }
+    return table;
 }
 
 
-void 
+void
 gncTaxTableDestroy (GncTaxTable *table)
 {
-  if (!table) return;
-  qof_instance_set_destroying(table, TRUE);
-  qof_instance_set_dirty (&table->inst);
-  gncTaxTableCommitEdit (table);
+    if (!table) return;
+    qof_instance_set_destroying(table, TRUE);
+    qof_instance_set_dirty (&table->inst);
+    gncTaxTableCommitEdit (table);
 }
 
-static void 
+static void
 gncTaxTableFree (GncTaxTable *table)
 {
-  GList *list;
-  GncTaxTable *child;
+    GList *list;
+    GncTaxTable *child;
 
-  if (!table) return;
+    if (!table) return;
 
-  qof_event_gen (&table->inst, QOF_EVENT_DESTROY, NULL);
-  CACHE_REMOVE (table->name);
-  remObj (table);
+    qof_event_gen (&table->inst, QOF_EVENT_DESTROY, NULL);
+    CACHE_REMOVE (table->name);
+    remObj (table);
 
-  /* destroy the list of entries */
-  for (list = table->entries; list; list=list->next)
-    gncTaxTableEntryDestroy (list->data);
-  g_list_free (table->entries);
+    /* destroy the list of entries */
+    for (list = table->entries; list; list = list->next)
+        gncTaxTableEntryDestroy (list->data);
+    g_list_free (table->entries);
 
-  if (!qof_instance_get_destroying(table))
-    PERR("free a taxtable without do_free set!");
+    if (!qof_instance_get_destroying(table))
+        PERR("free a taxtable without do_free set!");
 
-  /* disconnect from parent */
-  if (table->parent)
-    gncTaxTableRemoveChild(table->parent, table);
+    /* disconnect from parent */
+    if (table->parent)
+        gncTaxTableRemoveChild(table->parent, table);
 
-  /* disconnect from the children */
-  for (list = table->children; list; list=list->next) {
-    child = list->data;
-    gncTaxTableSetParent(child, NULL);
-  }
-  g_list_free(table->children);
+    /* disconnect from the children */
+    for (list = table->children; list; list = list->next)
+    {
+        child = list->data;
+        gncTaxTableSetParent(child, NULL);
+    }
+    g_list_free(table->children);
 
-  /* qof_instance_release (&table->inst); */
-  g_object_unref (table);
+    /* qof_instance_release (&table->inst); */
+    g_object_unref (table);
 }
 
 /* =============================================================== */
 
 GncTaxTableEntry * gncTaxTableEntryCreate (void)
 {
-  GncTaxTableEntry *entry;
-  entry = g_new0 (GncTaxTableEntry, 1);
-  entry->amount = gnc_numeric_zero ();
-  return entry;
+    GncTaxTableEntry *entry;
+    entry = g_new0 (GncTaxTableEntry, 1);
+    entry->amount = gnc_numeric_zero ();
+    return entry;
 }
 
 void gncTaxTableEntryDestroy (GncTaxTableEntry *entry)
 {
-  if (!entry) return;
-  g_free (entry);
+    if (!entry) return;
+    g_free (entry);
 }
 
-/** Makes a clone. The account is from the appriate book. 
+/** Makes a clone. The account is from the appriate book.
  *  Note that the table is left blank (for performance reasons
  *  we set it above, when cloning the table).
  */
-static GncTaxTableEntry * 
+static GncTaxTableEntry *
 CloneTaxEntry (const GncTaxTableEntry*from, QofBook *book)
 {
-  QofInstance *acc;
-  GncTaxTableEntry *entry;
-  entry = g_new0 (GncTaxTableEntry, 1);
+    QofInstance *acc;
+    GncTaxTableEntry *entry;
+    entry = g_new0 (GncTaxTableEntry, 1);
 
-  entry->type = from->type;
-  entry->amount = from->amount;
+    entry->type = from->type;
+    entry->amount = from->amount;
 
-  acc = qof_instance_lookup_twin (QOF_INSTANCE(from->account), book);
-  entry->account = (Account *) acc;
-  return entry;
+    acc = qof_instance_lookup_twin (QOF_INSTANCE(from->account), book);
+    entry->account = (Account *) acc;
+    return entry;
 }
 
 /* =============================================================== */
@@ -463,166 +467,169 @@
 
 void gncTaxTableSetName (GncTaxTable *table, const char *name)
 {
-  if (!table || !name) return;
-  SET_STR (table, table->name, name);
-  mark_table (table);
-  maybe_resort_list (table);
-  gncTaxTableCommitEdit (table);
+    if (!table || !name) return;
+    SET_STR (table, table->name, name);
+    mark_table (table);
+    maybe_resort_list (table);
+    gncTaxTableCommitEdit (table);
 }
 
 void gncTaxTableSetParent (GncTaxTable *table, GncTaxTable *parent)
 {
-  if (!table) return;
-  gncTaxTableBeginEdit (table);
-  if (table->parent)
-    gncTaxTableRemoveChild(table->parent, table);
-  table->parent = parent;
-  if (parent)
-    gncTaxTableAddChild(parent, table);
-  table->refcount = 0;
-  gncTaxTableMakeInvisible (table);
-  gncTaxTableCommitEdit (table);
+    if (!table) return;
+    gncTaxTableBeginEdit (table);
+    if (table->parent)
+        gncTaxTableRemoveChild(table->parent, table);
+    table->parent = parent;
+    if (parent)
+        gncTaxTableAddChild(parent, table);
+    table->refcount = 0;
+    gncTaxTableMakeInvisible (table);
+    gncTaxTableCommitEdit (table);
 }
 
 void gncTaxTableSetChild (GncTaxTable *table, GncTaxTable *child)
 {
-  if (!table) return;
-  gncTaxTableBeginEdit (table);
-  table->child = child;
-  gncTaxTableCommitEdit (table);
+    if (!table) return;
+    gncTaxTableBeginEdit (table);
+    table->child = child;
+    gncTaxTableCommitEdit (table);
 }
 
 void gncTaxTableIncRef (GncTaxTable *table)
 {
-  if (!table) return;
-  if (table->parent || table->invisible) return;        /* children dont need refcounts */
-  gncTaxTableBeginEdit (table);
-  table->refcount++;
-  gncTaxTableCommitEdit (table);
+    if (!table) return;
+    if (table->parent || table->invisible) return;        /* children dont need refcounts */
+    gncTaxTableBeginEdit (table);
+    table->refcount++;
+    gncTaxTableCommitEdit (table);
 }
 
 void gncTaxTableDecRef (GncTaxTable *table)
 {
-  if (!table) return;
-  if (table->parent || table->invisible) return;        /* children dont need refcounts */
-  gncTaxTableBeginEdit (table);
-  table->refcount--;
-  g_return_if_fail (table->refcount >= 0);
-  gncTaxTableCommitEdit (table);
+    if (!table) return;
+    if (table->parent || table->invisible) return;        /* children dont need refcounts */
+    gncTaxTableBeginEdit (table);
+    table->refcount--;
+    g_return_if_fail (table->refcount >= 0);
+    gncTaxTableCommitEdit (table);
 }
 
 void gncTaxTableSetRefcount (GncTaxTable *table, gint64 refcount)
 {
-  if (!table) return;
-  table->refcount = refcount;
+    if (!table) return;
+    table->refcount = refcount;
 }
 
 void gncTaxTableMakeInvisible (GncTaxTable *table)
 {
-  struct _book_info *bi;
-  if (!table) return;
-  gncTaxTableBeginEdit (table);
-  table->invisible = TRUE;
-  bi = qof_book_get_data (qof_instance_get_book(table), _GNC_MOD_NAME);
-  bi->tables = g_list_remove (bi->tables, table);
-  gncTaxTableCommitEdit (table);
+    struct _book_info *bi;
+    if (!table) return;
+    gncTaxTableBeginEdit (table);
+    table->invisible = TRUE;
+    bi = qof_book_get_data (qof_instance_get_book(table), _GNC_MOD_NAME);
+    bi->tables = g_list_remove (bi->tables, table);
+    gncTaxTableCommitEdit (table);
 }
 
 void gncTaxTableEntrySetAccount (GncTaxTableEntry *entry, Account *account)
 {
-  if (!entry || !account) return;
-  if (entry->account == account) return;
-  entry->account = account;
-  if (entry->table) {
-    mark_table (entry->table);
-    mod_table (entry->table);
-  }
+    if (!entry || !account) return;
+    if (entry->account == account) return;
+    entry->account = account;
+    if (entry->table)
+    {
+        mark_table (entry->table);
+        mod_table (entry->table);
+    }
 }
 
 void gncTaxTableEntrySetType (GncTaxTableEntry *entry, GncAmountType type)
 {
-  if (!entry) return;
-  if (entry->type == type) return;
-  entry->type = type;
-  if (entry->table) {
-    mark_table (entry->table);
-    mod_table (entry->table);
-  }
+    if (!entry) return;
+    if (entry->type == type) return;
+    entry->type = type;
+    if (entry->table)
+    {
+        mark_table (entry->table);
+        mod_table (entry->table);
+    }
 }
 
 void gncTaxTableEntrySetAmount (GncTaxTableEntry *entry, gnc_numeric amount)
 {
-  if (!entry) return;
-  if (gnc_numeric_eq (entry->amount, amount)) return;
-  entry->amount = amount;
-  if (entry->table) {
-    mark_table (entry->table);
-    mod_table (entry->table);
-  }
+    if (!entry) return;
+    if (gnc_numeric_eq (entry->amount, amount)) return;
+    entry->amount = amount;
+    if (entry->table)
+    {
+        mark_table (entry->table);
+        mod_table (entry->table);
+    }
 }
 
 void gncTaxTableAddEntry (GncTaxTable *table, GncTaxTableEntry *entry)
 {
-  if (!table || !entry) return;
-  if (entry->table == table) return; /* already mine */
+    if (!table || !entry) return;
+    if (entry->table == table) return; /* already mine */
 
-  gncTaxTableBeginEdit (table);
-  if (entry->table)
-    gncTaxTableRemoveEntry (entry->table, entry);
+    gncTaxTableBeginEdit (table);
+    if (entry->table)
+        gncTaxTableRemoveEntry (entry->table, entry);
 
-  entry->table = table;
-  table->entries = g_list_insert_sorted (table->entries, entry,
-                                         (GCompareFunc)gncTaxTableEntryCompare);
-  mark_table (table);
-  mod_table (table);
-  gncTaxTableCommitEdit (table);
+    entry->table = table;
+    table->entries = g_list_insert_sorted (table->entries, entry,
+                                           (GCompareFunc)gncTaxTableEntryCompare);
+    mark_table (table);
+    mod_table (table);
+    gncTaxTableCommitEdit (table);
 }
 
 void gncTaxTableRemoveEntry (GncTaxTable *table, GncTaxTableEntry *entry)
 {
-  if (!table || !entry) return;
-  gncTaxTableBeginEdit (table);
-  entry->table = NULL;
-  table->entries = g_list_remove (table->entries, entry);
-  mark_table (table);
-  mod_table (table);
-  gncTaxTableCommitEdit (table);
+    if (!table || !entry) return;
+    gncTaxTableBeginEdit (table);
+    entry->table = NULL;
+    table->entries = g_list_remove (table->entries, entry);
+    mark_table (table);
+    mod_table (table);
+    gncTaxTableCommitEdit (table);
 }
 
 void gncTaxTableChanged (GncTaxTable *table)
 {
-  if (!table) return;
-  gncTaxTableBeginEdit (table);
-  table->child = NULL;
-  gncTaxTableCommitEdit (table);
+    if (!table) return;
+    gncTaxTableBeginEdit (table);
+    table->child = NULL;
+    gncTaxTableCommitEdit (table);
 }
 
 /* =============================================================== */
 
 void gncTaxTableBeginEdit (GncTaxTable *table)
 {
-  qof_begin_edit(&table->inst);
+    qof_begin_edit(&table->inst);
 }
 
 static void gncTaxTableOnError (QofInstance *inst, QofBackendError errcode)
 {
-  PERR("TaxTable QofBackend Failure: %d", errcode);
-  gnc_engine_signal_commit_error( errcode );
+    PERR("TaxTable QofBackend Failure: %d", errcode);
+    gnc_engine_signal_commit_error( errcode );
 }
 
 static void gncTaxTableOnDone (QofInstance *inst) {}
 
 static void table_free (QofInstance *inst)
 {
-  GncTaxTable *table = (GncTaxTable *) inst;
-  gncTaxTableFree (table);
+    GncTaxTable *table = (GncTaxTable *) inst;
+    gncTaxTableFree (table);
 }
 
 void gncTaxTableCommitEdit (GncTaxTable *table)
 {
-  if (!qof_commit_edit (QOF_INSTANCE(table))) return;
-  qof_commit_edit_part2 (&table->inst, gncTaxTableOnError,
-                         gncTaxTableOnDone, table_free);
+    if (!qof_commit_edit (QOF_INSTANCE(table))) return;
+    qof_commit_edit_part2 (&table->inst, gncTaxTableOnError,
+                           gncTaxTableOnDone, table_free);
 }
 
 
@@ -631,158 +638,161 @@
 
 GncTaxTable *gncTaxTableLookupByName (QofBook *book, const char *name)
 {
-  GList *list = gncTaxTableGetTables (book);
+    GList *list = gncTaxTableGetTables (book);
 
-  for ( ; list; list = list->next) {
-    GncTaxTable *table = list->data;
-    if (!safe_strcmp (table->name, name))
-      return list->data;
-  }
-  return NULL;
+    for ( ; list; list = list->next)
+    {
+        GncTaxTable *table = list->data;
+        if (!safe_strcmp (table->name, name))
+            return list->data;
+    }
+    return NULL;
 }
 
 GList * gncTaxTableGetTables (QofBook *book)
 {
-  struct _book_info *bi;
-  if (!book) return NULL;
+    struct _book_info *bi;
+    if (!book) return NULL;
 
-  bi = qof_book_get_data (book, _GNC_MOD_NAME);
-  return bi->tables;
+    bi = qof_book_get_data (book, _GNC_MOD_NAME);
+    return bi->tables;
 }
 
 const char *gncTaxTableGetName (const GncTaxTable *table)
 {
-  if (!table) return NULL;
-  return table->name;
+    if (!table) return NULL;
+    return table->name;
 }
 
 static GncTaxTableEntry *gncTaxTableEntryCopy (const GncTaxTableEntry *entry)
 {
-  GncTaxTableEntry *e;
-  if (!entry) return NULL;
+    GncTaxTableEntry *e;
+    if (!entry) return NULL;
 
-  e = gncTaxTableEntryCreate ();
-  gncTaxTableEntrySetAccount (e, entry->account);
-  gncTaxTableEntrySetType (e, entry->type);
-  gncTaxTableEntrySetAmount (e, entry->amount);
+    e = gncTaxTableEntryCreate ();
+    gncTaxTableEntrySetAccount (e, entry->account);
+    gncTaxTableEntrySetType (e, entry->type);
+    gncTaxTableEntrySetAmount (e, entry->amount);
 
-  return e;
+    return e;
 }
 
 static GncTaxTable *gncTaxTableCopy (const GncTaxTable *table)
 {
-  GncTaxTable *t;
-  GList *list;
+    GncTaxTable *t;
+    GList *list;
 
-  if (!table) return NULL;
-  t = gncTaxTableCreate (qof_instance_get_book(table));
-  gncTaxTableSetName (t, table->name);
-  for (list = table->entries; list; list=list->next) {
-    GncTaxTableEntry *entry, *e;
-    entry = list->data;
-    e = gncTaxTableEntryCopy (entry);
-    gncTaxTableAddEntry (t, e);
-  }
-  return t;
+    if (!table) return NULL;
+    t = gncTaxTableCreate (qof_instance_get_book(table));
+    gncTaxTableSetName (t, table->name);
+    for (list = table->entries; list; list = list->next)
+    {
+        GncTaxTableEntry *entry, *e;
+        entry = list->data;
+        e = gncTaxTableEntryCopy (entry);
+        gncTaxTableAddEntry (t, e);
+    }
+    return t;
 }
 
 GncTaxTable *gncTaxTableReturnChild (GncTaxTable *table, gboolean make_new)
 {
-  GncTaxTable *child = NULL;
+    GncTaxTable *child = NULL;
 
-  if (!table) return NULL;
-  if (table->child) return table->child;
-  if (table->parent || table->invisible) return table;
-  if (make_new) {
-    child = gncTaxTableCopy (table);
-    gncTaxTableSetChild (table, child);
-    gncTaxTableSetParent (child, table);
-  }
-  return child;
+    if (!table) return NULL;
+    if (table->child) return table->child;
+    if (table->parent || table->invisible) return table;
+    if (make_new)
+    {
+        child = gncTaxTableCopy (table);
+        gncTaxTableSetChild (table, child);
+        gncTaxTableSetParent (child, table);
+    }
+    return child;
 }
 
 GncTaxTable *gncTaxTableGetParent (const GncTaxTable *table)
 {
-  if (!table) return NULL;
-  return table->parent;
+    if (!table) return NULL;
+    return table->parent;
 }
 
 GncTaxTableEntryList* gncTaxTableGetEntries (const GncTaxTable *table)
 {
-  if (!table) return NULL;
-  return table->entries;
+    if (!table) return NULL;
+    return table->entries;
 }
 
 gint64 gncTaxTableGetRefcount (const GncTaxTable *table)
 {
-  if (!table) return 0;
-  return table->refcount;
+    if (!table) return 0;
+    return table->refcount;
 }
 
 Timespec gncTaxTableLastModified (const GncTaxTable *table)
 {
-  Timespec ts = { 0 , 0 };
-  if (!table) return ts;
-  return table->modtime;
+    Timespec ts = { 0 , 0 };
+    if (!table) return ts;
+    return table->modtime;
 }
 
 gboolean gncTaxTableGetInvisible (const GncTaxTable *table)
 {
-  if (!table) return FALSE;
-  return table->invisible;
+    if (!table) return FALSE;
+    return table->invisible;
 }
 
 Account * gncTaxTableEntryGetAccount (const GncTaxTableEntry *entry)
 {
-  if (!entry) return NULL;
-  return entry->account;
+    if (!entry) return NULL;
+    return entry->account;
 }
 
 GncAmountType gncTaxTableEntryGetType (const GncTaxTableEntry *entry)
 {
-  if (!entry) return 0;
-  return entry->type;
+    if (!entry) return 0;
+    return entry->type;
 }
 
 gnc_numeric gncTaxTableEntryGetAmount (const GncTaxTableEntry *entry)
 {
-  if (!entry) return gnc_numeric_zero();
-  return entry->amount;
+    if (!entry) return gnc_numeric_zero();
+    return entry->amount;
 }
 
 GncTaxTable* gncTaxTableEntryGetTable( const GncTaxTableEntry* entry )
 {
-  if (!entry) return NULL;
-  return entry->table;
+    if (!entry) return NULL;
+    return entry->table;
 }
 
 int gncTaxTableEntryCompare (const GncTaxTableEntry *a, const GncTaxTableEntry *b)
 {
-  char *name_a, *name_b;
-  int retval;
+    char *name_a, *name_b;
+    int retval;
 
-  if (!a && !b) return 0;
-  if (!a) return -1;
-  if (!b) return 1;
-    
-  name_a = gnc_account_get_full_name (a->account);
-  name_b = gnc_account_get_full_name (b->account);
-  retval = safe_strcmp(name_a, name_b);
-  g_free(name_a);
-  g_free(name_b);
+    if (!a && !b) return 0;
+    if (!a) return -1;
+    if (!b) return 1;
 
-  if (retval)
-    return retval;
+    name_a = gnc_account_get_full_name (a->account);
+    name_b = gnc_account_get_full_name (b->account);
+    retval = safe_strcmp(name_a, name_b);
+    g_free(name_a);
+    g_free(name_b);
 
-  return gnc_numeric_compare (a->amount, b->amount);
+    if (retval)
+        return retval;
+
+    return gnc_numeric_compare (a->amount, b->amount);
 }
 
 int gncTaxTableCompare (const GncTaxTable *a, const GncTaxTable *b)
 {
-  if (!a && !b) return 0;
-  if (!a) return -1;
-  if (!b) return 1;
-  return safe_strcmp (a->name, b->name);
+    if (!a && !b) return 0;
+    if (!a) return -1;
+    if (!b) return 1;
+    return safe_strcmp (a->name, b->name);
 }
 
 
@@ -792,116 +802,121 @@
  */
 GList *gncAccountValueAdd (GList *list, Account *acc, gnc_numeric value)
 {
-  GList *li;
-  GncAccountValue *res = NULL;
+    GList *li;
+    GncAccountValue *res = NULL;
 
-  g_return_val_if_fail (acc, list);
-  g_return_val_if_fail (gnc_numeric_check (value) == GNC_ERROR_OK, list);
+    g_return_val_if_fail (acc, list);
+    g_return_val_if_fail (gnc_numeric_check (value) == GNC_ERROR_OK, list);
 
-  /* Try to find the account in the list */
-  for (li = list; li; li = li->next) {
-    res = li->data;
-    if (res->account == acc) {
-      res->value = gnc_numeric_add (res->value, value, GNC_DENOM_AUTO,
-                                    GNC_DENOM_LCD);
-      return list;
+    /* Try to find the account in the list */
+    for (li = list; li; li = li->next)
+    {
+        res = li->data;
+        if (res->account == acc)
+        {
+            res->value = gnc_numeric_add (res->value, value, GNC_DENOM_AUTO,
+                                          GNC_DENOM_LCD);
+            return list;
+        }
     }
-  }
-  /* Nope, didn't find it. */
+    /* Nope, didn't find it. */
 
-  res = g_new0 (GncAccountValue, 1);
-  res->account = acc;
-  res->value = value;
-  return g_list_prepend (list, res);
+    res = g_new0 (GncAccountValue, 1);
+    res->account = acc;
+    res->value = value;
+    return g_list_prepend (list, res);
 }
 
 /* Merge l2 into l1.  l2 is not touched. */
 GList *gncAccountValueAddList (GList *l1, GList *l2)
 {
-  GList *li;
+    GList *li;
 
-  for (li = l2; li; li = li->next ) {
-    GncAccountValue *val = li->data;
-    l1 = gncAccountValueAdd (l1, val->account, val->value);
-  }
+    for (li = l2; li; li = li->next )
+    {
+        GncAccountValue *val = li->data;
+        l1 = gncAccountValueAdd (l1, val->account, val->value);
+    }
 
-  return l1;
+    return l1;
 }
 
 /* return the total for this list */
 gnc_numeric gncAccountValueTotal (GList *list)
 {
-  gnc_numeric total = gnc_numeric_zero ();
+    gnc_numeric total = gnc_numeric_zero ();
 
-  for ( ; list ; list = list->next) {
-    GncAccountValue *val = list->data;
-    total = gnc_numeric_add (total, val->value, GNC_DENOM_AUTO, GNC_DENOM_LCD);
-  }
-  return total;
+    for ( ; list ; list = list->next)
+    {
+        GncAccountValue *val = list->data;
+        total = gnc_numeric_add (total, val->value, GNC_DENOM_AUTO, GNC_DENOM_LCD);
+    }
+    return total;
 }
 
 /* Destroy a list of accountvalues */
 void gncAccountValueDestroy (GList *list)
 {
-  GList *node;
-  for ( node = list; node ; node = node->next)
-    g_free (node->data);
+    GList *node;
+    for ( node = list; node ; node = node->next)
+        g_free (node->data);
 
-  g_list_free (list);
+    g_list_free (list);
 }
 
 /* Package-Private functions */
 
 static void _gncTaxTableCreate (QofBook *book)
 {
-  struct _book_info *bi;
+    struct _book_info *bi;
 
-  if (!book) return;
+    if (!book) return;
 
-  bi = g_new0 (struct _book_info, 1);
-  qof_book_set_data (book, _GNC_MOD_NAME, bi);
+    bi = g_new0 (struct _book_info, 1);
+    qof_book_set_data (book, _GNC_MOD_NAME, bi);
 }
 
 static void _gncTaxTableDestroy (QofBook *book)
 {
-  struct _book_info *bi;
+    struct _book_info *bi;
 
-  if (!book) return;
+    if (!book) return;
 
-  bi = qof_book_get_data (book, _GNC_MOD_NAME);
+    bi = qof_book_get_data (book, _GNC_MOD_NAME);
 
-  g_list_free (bi->tables);
-  g_free (bi);
+    g_list_free (bi->tables);
+    g_free (bi);
 }
 
-static QofObject gncTaxTableDesc = 
+static QofObject gncTaxTableDesc =
 {
-  .interface_version = QOF_OBJECT_VERSION,
-  .e_type            = _GNC_MOD_NAME,
-  .type_label        = "Tax Table",
-  .create            = (gpointer)gncTaxTableCreate,
-  .book_begin        = _gncTaxTableCreate,
-  .book_end          = _gncTaxTableDestroy,
-  .is_dirty          = qof_collection_is_dirty,
-  .mark_clean        = qof_collection_mark_clean,
-  .foreach           = qof_collection_foreach,
-  .printable         = NULL,
-  .version_cmp       = (int (*)(gpointer, gpointer)) qof_instance_version_cmp,
+    .interface_version = QOF_OBJECT_VERSION,
+    .e_type            = _GNC_MOD_NAME,
+    .type_label        = "Tax Table",
+    .create            = (gpointer)gncTaxTableCreate,
+    .book_begin        = _gncTaxTableCreate,
+    .book_end          = _gncTaxTableDestroy,
+    .is_dirty          = qof_collection_is_dirty,
+    .mark_clean        = qof_collection_mark_clean,
+    .foreach           = qof_collection_foreach,
+    .printable         = NULL,
+    .version_cmp       = (int (*)(gpointer, gpointer)) qof_instance_version_cmp,
 };
 
 gboolean gncTaxTableRegister (void)
 {
-  static QofParam params[] = {
-	{ GNC_TT_NAME, 		QOF_TYPE_STRING, 	(QofAccessFunc)gncTaxTableGetName, 		(QofSetterFunc)gncTaxTableSetName },
-	{ GNC_TT_REFCOUNT, 	QOF_TYPE_INT64, 	(QofAccessFunc)gncTaxTableGetRefcount, 	(QofSetterFunc)gncTaxTableSetRefcount },
-    { QOF_PARAM_BOOK, 	QOF_ID_BOOK, 		(QofAccessFunc)qof_instance_get_book, 	NULL },
-    { QOF_PARAM_GUID, 	QOF_TYPE_GUID, 		(QofAccessFunc)qof_instance_get_guid, 	NULL },
-    { NULL },
-  };
+    static QofParam params[] =
+    {
+        { GNC_TT_NAME, 		QOF_TYPE_STRING, 	(QofAccessFunc)gncTaxTableGetName, 		(QofSetterFunc)gncTaxTableSetName },
+        { GNC_TT_REFCOUNT, 	QOF_TYPE_INT64, 	(QofAccessFunc)gncTaxTableGetRefcount, 	(QofSetterFunc)gncTaxTableSetRefcount },
+        { QOF_PARAM_BOOK, 	QOF_ID_BOOK, 		(QofAccessFunc)qof_instance_get_book, 	NULL },
+        { QOF_PARAM_GUID, 	QOF_TYPE_GUID, 		(QofAccessFunc)qof_instance_get_guid, 	NULL },
+        { NULL },
+    };
 
-  qof_class_register (_GNC_MOD_NAME, (QofSortFunc)gncTaxTableCompare, params);
+    qof_class_register (_GNC_MOD_NAME, (QofSortFunc)gncTaxTableCompare, params);
 
-  return qof_object_register (&gncTaxTableDesc);
+    return qof_object_register (&gncTaxTableDesc);
 }
 
 /* need a QOF tax table entry object */

Modified: gnucash/trunk/src/business/business-core/gncTaxTable.h
===================================================================
--- gnucash/trunk/src/business/business-core/gncTaxTable.h	2010-03-02 21:40:28 UTC (rev 18788)
+++ gnucash/trunk/src/business/business-core/gncTaxTable.h	2010-03-02 21:41:05 UTC (rev 18789)
@@ -35,18 +35,18 @@
 
 modtime is the internal date of the last modtime\n
 See src/doc/business.txt for an explanation of the following\n
-Code that handles refcount, parent, child, invisible and children 
+Code that handles refcount, parent, child, invisible and children
 is *identical* to that in ::GncBillTerm
 
 @param	QofInstance     inst;
 @param 	char *          name;
 @param 	GncTaxTableEntryList*  entries;
- at param 	Timespec        modtime;	
+ at param 	Timespec        modtime;
 @param 	gint64          refcount;
- at param 	GncTaxTable *   parent; if non-null, we are an immutable child 
- at param 	GncTaxTable *   child;  if non-null, we have not changed 
+ at param 	GncTaxTable *   parent; if non-null, we are an immutable child
+ at param 	GncTaxTable *   child;  if non-null, we have not changed
 @param 	gboolean        invisible;
- at param 	GList *         children; list of children for disconnection 
+ at param 	GList *         children; list of children for disconnection
 */
 typedef struct _gncTaxTable GncTaxTable;
 typedef struct _gncTaxTableClass GncTaxTableClass;
@@ -90,16 +90,18 @@
  * How to interpret the amount.
  * You can interpret it as a VALUE or a PERCENT.
  */
-typedef enum {
-  GNC_AMT_TYPE_VALUE = 1, 	/**< tax is a number */
-  GNC_AMT_TYPE_PERCENT		/**< tax is a percentage */
+typedef enum
+{
+    GNC_AMT_TYPE_VALUE = 1, 	/**< tax is a number */
+    GNC_AMT_TYPE_PERCENT		/**< tax is a percentage */
 } GncAmountType;
 
 /** How to interpret the TaxIncluded */
-typedef enum {
-  GNC_TAXINCLUDED_YES = 1,  /**< tax is included */
-  GNC_TAXINCLUDED_NO,		/**< tax is not included */
-  GNC_TAXINCLUDED_USEGLOBAL, /**< use the global setting */
+typedef enum
+{
+    GNC_TAXINCLUDED_YES = 1,  /**< tax is included */
+    GNC_TAXINCLUDED_NO,		/**< tax is not included */
+    GNC_TAXINCLUDED_USEGLOBAL, /**< use the global setting */
 } GncTaxIncluded;
 
 const char * gncAmountTypeToString (GncAmountType type);
@@ -108,14 +110,14 @@
 const char * gncTaxIncludedTypeToString (GncTaxIncluded type);
 gboolean gncTaxIncludedStringToType (const char *str, GncTaxIncluded *type);
 
-/** @name Create/Destroy Functions 
+/** @name Create/Destroy Functions
  @{ */
 GncTaxTable * gncTaxTableCreate (QofBook *book);
 void gncTaxTableDestroy (GncTaxTable *table);
 GncTaxTableEntry * gncTaxTableEntryCreate (void);
 void gncTaxTableEntryDestroy (GncTaxTableEntry *entry);
 /** @} */
-/** \name Set Functions 
+/** \name Set Functions
 @{
 */
 void gncTaxTableSetName (GncTaxTable *table, const char *name);
@@ -133,11 +135,11 @@
 void gncTaxTableBeginEdit (GncTaxTable *table);
 void gncTaxTableCommitEdit (GncTaxTable *table);
 
-/** @name Get Functions 
+/** @name Get Functions
  @{ */
 
 /** Return a pointer to the instance gncTaxTable that is identified
- *  by the guid, and is residing in the book. Returns NULL if the 
+ *  by the guid, and is residing in the book. Returns NULL if the
  *  instance can't be found.
  *  Equivalent function prototype is
  *  GncTaxTable * gncTaxTableLookup (QofBook *book, const GUID *guid);
@@ -168,9 +170,10 @@
 
 /************************************************/
 
-struct _gncAccountValue {
-  Account *	account;
-  gnc_numeric	value;
+struct _gncAccountValue
+{
+    Account *	account;
+    gnc_numeric	value;
 };
 
 /**

Modified: gnucash/trunk/src/business/business-core/gncVendor.c
===================================================================
--- gnucash/trunk/src/business/business-core/gncVendor.c	2010-03-02 21:40:28 UTC (rev 18788)
+++ gnucash/trunk/src/business/business-core/gncVendor.c	2010-03-02 21:41:05 UTC (rev 18789)
@@ -42,28 +42,28 @@
 
 static gint gs_address_event_handler_id = 0;
 static void listen_for_address_events(QofInstance *entity, QofEventId event_type,
-			    gpointer user_data, gpointer event_data);
+                                      gpointer user_data, gpointer event_data);
 
-struct _gncVendor 
+struct _gncVendor
 {
-  QofInstance     inst;
+    QofInstance     inst;
 
-  char *          id;
-  char *          name;
-  char *          notes;
-  GncBillTerm *   terms;
-  GncAddress *    addr;
-  gnc_commodity * currency;
-  GncTaxTable*    taxtable;
-  gboolean        taxtable_override;
-  GncTaxIncluded  taxincluded;
-  gboolean        active;
-  GList *         jobs;
+    char *          id;
+    char *          name;
+    char *          notes;
+    GncBillTerm *   terms;
+    GncAddress *    addr;
+    gnc_commodity * currency;
+    GncTaxTable*    taxtable;
+    gboolean        taxtable_override;
+    GncTaxIncluded  taxincluded;
+    gboolean        active;
+    GList *         jobs;
 };
 
 struct _gncVendorClass
 {
-  QofInstanceClass parent_class;
+    QofInstanceClass parent_class;
 };
 
 static QofLogModule log_module = GNC_MOD_BUSINESS;
@@ -76,15 +76,16 @@
 G_INLINE_FUNC void mark_vendor (GncVendor *vendor);
 void mark_vendor (GncVendor *vendor)
 {
-  qof_instance_set_dirty(&vendor->inst);
-  qof_event_gen (&vendor->inst, QOF_EVENT_MODIFY, NULL);
+    qof_instance_set_dirty(&vendor->inst);
+    qof_event_gen (&vendor->inst, QOF_EVENT_MODIFY, NULL);
 }
 
 /* ============================================================== */
 
-enum {
+enum
+{
     PROP_0,
-	PROP_NAME
+    PROP_NAME
 };
 
 /* GObject Initialization */
@@ -109,43 +110,45 @@
 
 static void
 gnc_vendor_get_property (GObject         *object,
-			  guint            prop_id,
-			  GValue          *value,
-			  GParamSpec      *pspec)
+                         guint            prop_id,
+                         GValue          *value,
+                         GParamSpec      *pspec)
 {
     GncVendor *vendor;
 
     g_return_if_fail(GNC_IS_VENDOR(object));
 
     vendor = GNC_VENDOR(object);
-    switch (prop_id) {
-	case PROP_NAME:
-	    g_value_set_string(value, vendor->name);
-		break;
-	default:
-	    G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec);
-	    break;
+    switch (prop_id)
+    {
+    case PROP_NAME:
+        g_value_set_string(value, vendor->name);
+        break;
+    default:
+        G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec);
+        break;
     }
 }
 
 static void
 gnc_vendor_set_property (GObject         *object,
-			  guint            prop_id,
-			  const GValue          *value,
-			  GParamSpec      *pspec)
+                         guint            prop_id,
+                         const GValue          *value,
+                         GParamSpec      *pspec)
 {
     GncVendor *vendor;
 
     g_return_if_fail(GNC_IS_VENDOR(object));
 
     vendor = GNC_VENDOR(object);
-    switch (prop_id) {
-	case PROP_NAME:
-	    gncVendorSetName(vendor, g_value_get_string(value));
-		break;
-	default:
-	    G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec);
-	    break;
+    switch (prop_id)
+    {
+    case PROP_NAME:
+        gncVendorSetName(vendor, g_value_get_string(value));
+        break;
+    default:
+        G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec);
+        break;
     }
 }
 
@@ -153,134 +156,135 @@
 gnc_vendor_class_init (GncVendorClass *klass)
 {
     GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
-	
+
     gobject_class->dispose = gnc_vendor_dispose;
     gobject_class->finalize = gnc_vendor_finalize;
     gobject_class->set_property = gnc_vendor_set_property;
     gobject_class->get_property = gnc_vendor_get_property;
 
     g_object_class_install_property
-	(gobject_class,
-	 PROP_NAME,
-	 g_param_spec_string ("name",
-			      "Vendor Name",
-			      "The vendor name is an arbitrary string "
-			      "assigned by the user to provide the vendor name.",
-			      NULL,
-			      G_PARAM_READWRITE));
+    (gobject_class,
+     PROP_NAME,
+     g_param_spec_string ("name",
+                          "Vendor Name",
+                          "The vendor name is an arbitrary string "
+                          "assigned by the user to provide the vendor name.",
+                          NULL,
+                          G_PARAM_READWRITE));
 }
 
 /* Create/Destroy Functions */
 GncVendor *gncVendorCreate (QofBook *book)
 {
-  GncVendor *vendor;
+    GncVendor *vendor;
 
-  if (!book) return NULL;
+    if (!book) return NULL;
 
-  vendor = g_object_new (GNC_TYPE_VENDOR, NULL);
-  qof_instance_init_data (&vendor->inst, _GNC_MOD_NAME, book);
-  
-  vendor->id = CACHE_INSERT ("");
-  vendor->name = CACHE_INSERT ("");
-  vendor->notes = CACHE_INSERT ("");
-  vendor->addr = gncAddressCreate (book, &vendor->inst);
-  vendor->taxincluded = GNC_TAXINCLUDED_USEGLOBAL;
-  vendor->active = TRUE;
-  vendor->jobs = NULL;
+    vendor = g_object_new (GNC_TYPE_VENDOR, NULL);
+    qof_instance_init_data (&vendor->inst, _GNC_MOD_NAME, book);
 
-  if (gs_address_event_handler_id == 0) {
-    gs_address_event_handler_id = qof_event_register_handler(listen_for_address_events, NULL);
-  }
+    vendor->id = CACHE_INSERT ("");
+    vendor->name = CACHE_INSERT ("");
+    vendor->notes = CACHE_INSERT ("");
+    vendor->addr = gncAddressCreate (book, &vendor->inst);
+    vendor->taxincluded = GNC_TAXINCLUDED_USEGLOBAL;
+    vendor->active = TRUE;
+    vendor->jobs = NULL;
 
-  qof_event_gen (&vendor->inst, QOF_EVENT_CREATE, NULL);
+    if (gs_address_event_handler_id == 0)
+    {
+        gs_address_event_handler_id = qof_event_register_handler(listen_for_address_events, NULL);
+    }
 
-  return vendor;
+    qof_event_gen (&vendor->inst, QOF_EVENT_CREATE, NULL);
+
+    return vendor;
 }
 
 void gncVendorDestroy (GncVendor *vendor)
 {
-  if (!vendor) return;
-  qof_instance_set_destroying(vendor, TRUE);
-  gncVendorCommitEdit (vendor);
+    if (!vendor) return;
+    qof_instance_set_destroying(vendor, TRUE);
+    gncVendorCommitEdit (vendor);
 }
 
 static void gncVendorFree (GncVendor *vendor)
 {
-  if (!vendor) return;
+    if (!vendor) return;
 
-  qof_event_gen (&vendor->inst, QOF_EVENT_DESTROY, NULL);
+    qof_event_gen (&vendor->inst, QOF_EVENT_DESTROY, NULL);
 
-  CACHE_REMOVE (vendor->id);
-  CACHE_REMOVE (vendor->name);
-  CACHE_REMOVE (vendor->notes);
-  gncAddressBeginEdit (vendor->addr);
-  gncAddressDestroy (vendor->addr);
-  g_list_free (vendor->jobs);
+    CACHE_REMOVE (vendor->id);
+    CACHE_REMOVE (vendor->name);
+    CACHE_REMOVE (vendor->notes);
+    gncAddressBeginEdit (vendor->addr);
+    gncAddressDestroy (vendor->addr);
+    g_list_free (vendor->jobs);
 
-  if (vendor->terms)
-    gncBillTermDecRef (vendor->terms);
-  if (vendor->taxtable)
-    gncTaxTableDecRef (vendor->taxtable);
+    if (vendor->terms)
+        gncBillTermDecRef (vendor->terms);
+    if (vendor->taxtable)
+        gncTaxTableDecRef (vendor->taxtable);
 
-  /* qof_instance_release (&vendor->inst); */
-  g_object_unref (vendor);
+    /* qof_instance_release (&vendor->inst); */
+    g_object_unref (vendor);
 }
 
 /** Create a copy of a vendor, placing the copy into a new book. */
 GncVendor *
 gncCloneVendor (GncVendor *from, QofBook *book)
 {
-  GList *node;
-  GncVendor *vendor;
+    GList *node;
+    GncVendor *vendor;
 
-  if (!book) return NULL;
+    if (!book) return NULL;
 
-  vendor = g_object_new (GNC_TYPE_VENDOR, NULL);
-  qof_instance_init_data (&vendor->inst, _GNC_MOD_NAME, book);
-  qof_instance_gemini (&vendor->inst, &from->inst);
-  
-  vendor->id = CACHE_INSERT (from->id);
-  vendor->name = CACHE_INSERT (from->name);
-  vendor->notes = CACHE_INSERT (from->notes);
-  vendor->addr = gncCloneAddress (from->addr, &vendor->inst, book);
-  vendor->taxincluded = from->taxincluded;
-  vendor->taxtable_override = from->taxtable_override;
-  vendor->active = from->active;
+    vendor = g_object_new (GNC_TYPE_VENDOR, NULL);
+    qof_instance_init_data (&vendor->inst, _GNC_MOD_NAME, book);
+    qof_instance_gemini (&vendor->inst, &from->inst);
 
-  vendor->terms = gncBillTermObtainTwin (from->terms, book);
-  gncBillTermIncRef (vendor->terms);
+    vendor->id = CACHE_INSERT (from->id);
+    vendor->name = CACHE_INSERT (from->name);
+    vendor->notes = CACHE_INSERT (from->notes);
+    vendor->addr = gncCloneAddress (from->addr, &vendor->inst, book);
+    vendor->taxincluded = from->taxincluded;
+    vendor->taxtable_override = from->taxtable_override;
+    vendor->active = from->active;
 
-  vendor->currency = gnc_commodity_obtain_twin (from->currency, book);
+    vendor->terms = gncBillTermObtainTwin (from->terms, book);
+    gncBillTermIncRef (vendor->terms);
 
-  vendor->taxtable = gncTaxTableObtainTwin (from->taxtable, book);
-  gncTaxTableIncRef (vendor->taxtable);
+    vendor->currency = gnc_commodity_obtain_twin (from->currency, book);
 
-  vendor->jobs = NULL;
-  for (node=g_list_last(from->jobs); node; node=node->prev)
-  {
-    GncJob *job = node->data;
-    job = gncJobObtainTwin (job, book);
-    vendor->jobs = g_list_prepend(vendor->jobs, job);
-  }
+    vendor->taxtable = gncTaxTableObtainTwin (from->taxtable, book);
+    gncTaxTableIncRef (vendor->taxtable);
 
-  qof_event_gen (&vendor->inst, QOF_EVENT_CREATE, NULL);
+    vendor->jobs = NULL;
+    for (node = g_list_last(from->jobs); node; node = node->prev)
+    {
+        GncJob *job = node->data;
+        job = gncJobObtainTwin (job, book);
+        vendor->jobs = g_list_prepend(vendor->jobs, job);
+    }
 
-  return vendor;
+    qof_event_gen (&vendor->inst, QOF_EVENT_CREATE, NULL);
+
+    return vendor;
 }
 
 GncVendor *
 gncVendorObtainTwin (GncVendor *from, QofBook *book)
 {
-  GncVendor *vendor;
-  if (!book) return NULL;
+    GncVendor *vendor;
+    if (!book) return NULL;
 
-  vendor = (GncVendor *) qof_instance_lookup_twin (QOF_INSTANCE(from), book);
-  if (!vendor)
-  {
-    vendor = gncCloneVendor (from, book);
-  }
+    vendor = (GncVendor *) qof_instance_lookup_twin (QOF_INSTANCE(from), book);
+    if (!vendor)
+    {
+        vendor = gncCloneVendor (from, book);
+    }
 
-  return vendor;
+    return vendor;
 }
 
 /* ============================================================== */
@@ -298,128 +302,138 @@
 
 void gncVendorSetID (GncVendor *vendor, const char *id)
 {
-  if (!vendor) return;
-  if (!id) return;
-  SET_STR(vendor, vendor->id, id);
-  mark_vendor (vendor);
-  gncVendorCommitEdit (vendor);
+    if (!vendor) return;
+    if (!id) return;
+    SET_STR(vendor, vendor->id, id);
+    mark_vendor (vendor);
+    gncVendorCommitEdit (vendor);
 }
 
 void gncVendorSetName (GncVendor *vendor, const char *name)
 {
-  if (!vendor) return;
-  if (!name) return;
-  SET_STR(vendor, vendor->name, name);
-  mark_vendor (vendor);
-  gncVendorCommitEdit (vendor);
+    if (!vendor) return;
+    if (!name) return;
+    SET_STR(vendor, vendor->name, name);
+    mark_vendor (vendor);
+    gncVendorCommitEdit (vendor);
 }
 
 void gncVendorSetNotes (GncVendor *vendor, const char *notes)
 {
-  if (!vendor) return;
-  if (!notes) return;
-  SET_STR(vendor,vendor->notes, notes);
-  mark_vendor (vendor);
-  gncVendorCommitEdit (vendor);
+    if (!vendor) return;
+    if (!notes) return;
+    SET_STR(vendor, vendor->notes, notes);
+    mark_vendor (vendor);
+    gncVendorCommitEdit (vendor);
 }
 
 void gncVendorSetTerms (GncVendor *vendor, GncBillTerm *terms)
 {
-  if (!vendor) return;
-  if (vendor->terms == terms) return;
+    if (!vendor) return;
+    if (vendor->terms == terms) return;
 
-  gncVendorBeginEdit (vendor);
-  if (vendor->terms)
-    gncBillTermDecRef (vendor->terms);
-  vendor->terms = terms;
-  if (vendor->terms)
-    gncBillTermIncRef (vendor->terms);
-  mark_vendor (vendor);
-  gncVendorCommitEdit (vendor);
+    gncVendorBeginEdit (vendor);
+    if (vendor->terms)
+        gncBillTermDecRef (vendor->terms);
+    vendor->terms = terms;
+    if (vendor->terms)
+        gncBillTermIncRef (vendor->terms);
+    mark_vendor (vendor);
+    gncVendorCommitEdit (vendor);
 }
 
 void gncVendorSetTaxIncluded (GncVendor *vendor, GncTaxIncluded taxincl)
 {
-  if (!vendor) return;
-  if (taxincl == vendor->taxincluded) return;
-  gncVendorBeginEdit (vendor);
-  vendor->taxincluded = taxincl;
-  mark_vendor (vendor);
-  gncVendorCommitEdit (vendor);
+    if (!vendor) return;
+    if (taxincl == vendor->taxincluded) return;
+    gncVendorBeginEdit (vendor);
+    vendor->taxincluded = taxincl;
+    mark_vendor (vendor);
+    gncVendorCommitEdit (vendor);
 }
 
 void gncVendorSetCurrency (GncVendor *vendor, gnc_commodity *currency)
 {
-  if (!vendor || !currency) return;
-  if (vendor->currency &&
-      gnc_commodity_equal (vendor->currency, currency))
-    return;
-  gncVendorBeginEdit (vendor);
-  vendor->currency = currency;
-  mark_vendor (vendor);
-  gncVendorCommitEdit (vendor);
+    if (!vendor || !currency) return;
+    if (vendor->currency &&
+            gnc_commodity_equal (vendor->currency, currency))
+        return;
+    gncVendorBeginEdit (vendor);
+    vendor->currency = currency;
+    mark_vendor (vendor);
+    gncVendorCommitEdit (vendor);
 }
 
 void gncVendorSetActive (GncVendor *vendor, gboolean active)
 {
-  if (!vendor) return;
-  if (active == vendor->active) return;
-  gncVendorBeginEdit (vendor);
-  vendor->active = active;
-  mark_vendor (vendor);
-  gncVendorCommitEdit (vendor);
+    if (!vendor) return;
+    if (active == vendor->active) return;
+    gncVendorBeginEdit (vendor);
+    vendor->active = active;
+    mark_vendor (vendor);
+    gncVendorCommitEdit (vendor);
 }
 
 void gncVendorSetTaxTableOverride (GncVendor *vendor, gboolean override)
 {
-  if (!vendor) return;
-  if (vendor->taxtable_override == override) return;
-  gncVendorBeginEdit (vendor);
-  vendor->taxtable_override = override;
-  mark_vendor (vendor);
-  gncVendorCommitEdit (vendor);
+    if (!vendor) return;
+    if (vendor->taxtable_override == override) return;
+    gncVendorBeginEdit (vendor);
+    vendor->taxtable_override = override;
+    mark_vendor (vendor);
+    gncVendorCommitEdit (vendor);
 }
 
 void gncVendorSetTaxTable (GncVendor *vendor, GncTaxTable *table)
 {
-  if (!vendor) return;
-  if (vendor->taxtable == table) return;
-  gncVendorBeginEdit (vendor);
-  if (vendor->taxtable)
-    gncTaxTableDecRef (vendor->taxtable);
-  if (table)
-    gncTaxTableIncRef (table);
-  vendor->taxtable = table;
-  mark_vendor (vendor);
-  gncVendorCommitEdit (vendor);
+    if (!vendor) return;
+    if (vendor->taxtable == table) return;
+    gncVendorBeginEdit (vendor);
+    if (vendor->taxtable)
+        gncTaxTableDecRef (vendor->taxtable);
+    if (table)
+        gncTaxTableIncRef (table);
+    vendor->taxtable = table;
+    mark_vendor (vendor);
+    gncVendorCommitEdit (vendor);
 }
 
 static void
 qofVendorSetAddr (GncVendor *vendor, QofInstance *addr_ent)
 {
-	GncAddress *addr;
+    GncAddress *addr;
 
-	if(!vendor || !addr_ent) { return; }
-	addr = (GncAddress*)addr_ent;
-	if(addr == vendor->addr) { return; }
-	if(vendor->addr != NULL) {
-		gncAddressBeginEdit(vendor->addr);
-		gncAddressDestroy(vendor->addr);
-	}
-	gncVendorBeginEdit(vendor);
-	vendor->addr = addr;
-	gncVendorCommitEdit(vendor);
+    if (!vendor || !addr_ent)
+    {
+        return;
+    }
+    addr = (GncAddress*)addr_ent;
+    if (addr == vendor->addr)
+    {
+        return;
+    }
+    if (vendor->addr != NULL)
+    {
+        gncAddressBeginEdit(vendor->addr);
+        gncAddressDestroy(vendor->addr);
+    }
+    gncVendorBeginEdit(vendor);
+    vendor->addr = addr;
+    gncVendorCommitEdit(vendor);
 }
 
 static void
 qofVendorSetTaxIncluded(GncVendor *vendor, const char* type_string)
 {
-	GncTaxIncluded inc;
+    GncTaxIncluded inc;
 
-	if(!gncTaxIncludedStringToType(type_string, &inc)) { return; }
-	gncVendorBeginEdit(vendor);
-	vendor->taxincluded = inc;
-	gncVendorCommitEdit(vendor);
+    if (!gncTaxIncludedStringToType(type_string, &inc))
+    {
+        return;
+    }
+    gncVendorBeginEdit(vendor);
+    vendor->taxincluded = inc;
+    gncVendorCommitEdit(vendor);
 }
 
 /* ============================================================== */
@@ -427,129 +441,132 @@
 
 const char * gncVendorGetID (const GncVendor *vendor)
 {
-  if (!vendor) return NULL;
-  return vendor->id;
+    if (!vendor) return NULL;
+    return vendor->id;
 }
 
 const char * gncVendorGetName (const GncVendor *vendor)
 {
-  if (!vendor) return NULL;
-  return vendor->name;
+    if (!vendor) return NULL;
+    return vendor->name;
 }
 
 GncAddress * gncVendorGetAddr (const GncVendor *vendor)
 {
-  if (!vendor) return NULL;
-  return vendor->addr;
+    if (!vendor) return NULL;
+    return vendor->addr;
 }
 
 const char * gncVendorGetNotes (const GncVendor *vendor)
 {
-  if (!vendor) return NULL;
-  return vendor->notes;
+    if (!vendor) return NULL;
+    return vendor->notes;
 }
 
 GncBillTerm * gncVendorGetTerms (const GncVendor *vendor)
 {
-  if (!vendor) return 0;
-  return vendor->terms;
+    if (!vendor) return 0;
+    return vendor->terms;
 }
 
 GncTaxIncluded gncVendorGetTaxIncluded (const GncVendor *vendor)
 {
-  if (!vendor) return GNC_TAXINCLUDED_USEGLOBAL;
-  return vendor->taxincluded;
+    if (!vendor) return GNC_TAXINCLUDED_USEGLOBAL;
+    return vendor->taxincluded;
 }
 
 gnc_commodity * gncVendorGetCurrency (const GncVendor *vendor)
 {
-  if (!vendor) return NULL;
-  return vendor->currency;
+    if (!vendor) return NULL;
+    return vendor->currency;
 }
 
 gboolean gncVendorGetActive (const GncVendor *vendor)
 {
-  if (!vendor) return FALSE;
-  return vendor->active;
+    if (!vendor) return FALSE;
+    return vendor->active;
 }
 
 gboolean gncVendorGetTaxTableOverride (const GncVendor *vendor)
 {
-  if (!vendor) return FALSE;
-  return vendor->taxtable_override;
+    if (!vendor) return FALSE;
+    return vendor->taxtable_override;
 }
 
 GncTaxTable* gncVendorGetTaxTable (const GncVendor *vendor)
 {
-  if (!vendor) return NULL;
-  return vendor->taxtable;
+    if (!vendor) return NULL;
+    return vendor->taxtable;
 }
 
 static const char*
 qofVendorGetTaxIncluded(const GncVendor *vendor)
 {
-	return gncTaxIncludedTypeToString(vendor->taxincluded);
+    return gncTaxIncludedTypeToString(vendor->taxincluded);
 }
 
 /* Note that JobList changes do not affect the "dirtiness" of the vendor */
 void gncVendorAddJob (GncVendor *vendor, GncJob *job)
 {
-  if (!vendor) return;
-  if (!job) return;
+    if (!vendor) return;
+    if (!job) return;
 
-  if (g_list_index(vendor->jobs, job) == -1)
-    vendor->jobs = g_list_insert_sorted (vendor->jobs, job,
-                                         (GCompareFunc)gncJobCompare);
+    if (g_list_index(vendor->jobs, job) == -1)
+        vendor->jobs = g_list_insert_sorted (vendor->jobs, job,
+                                             (GCompareFunc)gncJobCompare);
 
-  qof_event_gen (&vendor->inst, QOF_EVENT_MODIFY, NULL);
+    qof_event_gen (&vendor->inst, QOF_EVENT_MODIFY, NULL);
 }
 
 void gncVendorRemoveJob (GncVendor *vendor, GncJob *job)
 {
-  GList *node;
+    GList *node;
 
-  if (!vendor) return;
-  if (!job) return;
+    if (!vendor) return;
+    if (!job) return;
 
-  node = g_list_find (vendor->jobs, job);
-  if (!node) {
-    /*    PERR ("split not in account"); */
-  } else {
-    vendor->jobs = g_list_remove_link (vendor->jobs, node);
-    g_list_free_1 (node);
-  }
+    node = g_list_find (vendor->jobs, job);
+    if (!node)
+    {
+        /*    PERR ("split not in account"); */
+    }
+    else
+    {
+        vendor->jobs = g_list_remove_link (vendor->jobs, node);
+        g_list_free_1 (node);
+    }
 
-  qof_event_gen (&vendor->inst, QOF_EVENT_MODIFY, NULL);
+    qof_event_gen (&vendor->inst, QOF_EVENT_MODIFY, NULL);
 }
 
 void gncVendorBeginEdit (GncVendor *vendor)
 {
-  qof_begin_edit(&vendor->inst);
+    qof_begin_edit(&vendor->inst);
 }
 
 static void gncVendorOnError (QofInstance *vendor, QofBackendError errcode)
 {
-  PERR("Vendor QofBackend Failure: %d", errcode);
-  gnc_engine_signal_commit_error( errcode );
+    PERR("Vendor QofBackend Failure: %d", errcode);
+    gnc_engine_signal_commit_error( errcode );
 }
 
 static void gncVendorOnDone (QofInstance *inst)
 {
-  GncVendor *vendor = (GncVendor *) inst;
-  gncAddressClearDirty (vendor->addr);
+    GncVendor *vendor = (GncVendor *) inst;
+    gncAddressClearDirty (vendor->addr);
 }
 
 static void vendor_free (QofInstance *inst)
 {
-  GncVendor *vendor = (GncVendor *) inst;
-  gncVendorFree (vendor);
+    GncVendor *vendor = (GncVendor *) inst;
+    gncVendorFree (vendor);
 }
 
 void gncVendorCommitEdit (GncVendor *vendor)
 {
-  if (!qof_commit_edit (QOF_INSTANCE(vendor))) return;
-  qof_commit_edit_part2 (&vendor->inst, gncVendorOnError,
-                         gncVendorOnDone, vendor_free);
+    if (!qof_commit_edit (QOF_INSTANCE(vendor))) return;
+    qof_commit_edit_part2 (&vendor->inst, gncVendorOnError,
+                           gncVendorOnDone, vendor_free);
 }
 
 /* ============================================================== */
@@ -557,35 +574,39 @@
 
 int gncVendorCompare (const GncVendor *a, const GncVendor *b)
 {
-  if (!a && !b) return 0;
-  if (!a && b) return 1;
-  if (a && !b) return -1;
+    if (!a && !b) return 0;
+    if (!a && b) return 1;
+    if (a && !b) return -1;
 
-  return(strcmp(a->name, b->name));
+    return(strcmp(a->name, b->name));
 }
 
 GList * gncVendorGetJoblist (const GncVendor *vendor, gboolean show_all)
 {
-  if (!vendor) return NULL;
+    if (!vendor) return NULL;
 
-  if (show_all) {
-    return (g_list_copy (vendor->jobs));
-  } else {
-    GList *list = NULL, *iterator;
-    for (iterator = vendor->jobs; iterator; iterator=iterator->next) {
-      GncJob *j = iterator->data;
-      if (gncJobGetActive (j))
-        list = g_list_append (list, j);
+    if (show_all)
+    {
+        return (g_list_copy (vendor->jobs));
     }
-    return list;
-  }
+    else
+    {
+        GList *list = NULL, *iterator;
+        for (iterator = vendor->jobs; iterator; iterator = iterator->next)
+        {
+            GncJob *j = iterator->data;
+            if (gncJobGetActive (j))
+                list = g_list_append (list, j);
+        }
+        return list;
+    }
 }
 
 gboolean gncVendorIsDirty (const GncVendor *vendor)
 {
-  if (!vendor) return FALSE;
-  return (qof_instance_get_dirty_flag(vendor)
-          || gncAddressIsDirty (vendor->addr));
+    if (!vendor) return FALSE;
+    return (qof_instance_get_dirty_flag(vendor)
+            || gncAddressIsDirty (vendor->addr));
 }
 
 /**
@@ -599,78 +620,94 @@
  */
 static void
 listen_for_address_events(QofInstance *entity, QofEventId event_type,
-			    gpointer user_data, gpointer event_data)
+                          gpointer user_data, gpointer event_data)
 {
-  GncVendor* v;
+    GncVendor* v;
 
-  if ((event_type & QOF_EVENT_MODIFY) == 0) {
-  	return;
-  }
-  if (!GNC_IS_ADDRESS(entity)) {
-    return;
-  }
-  if (!GNC_IS_VENDOR(event_data)) {
-    return;
-  }
-  v = GNC_VENDOR(event_data);
-  gncVendorBeginEdit(v);
-  mark_vendor(v);
-  gncVendorCommitEdit(v);
+    if ((event_type & QOF_EVENT_MODIFY) == 0)
+    {
+        return;
+    }
+    if (!GNC_IS_ADDRESS(entity))
+    {
+        return;
+    }
+    if (!GNC_IS_VENDOR(event_data))
+    {
+        return;
+    }
+    v = GNC_VENDOR(event_data);
+    gncVendorBeginEdit(v);
+    mark_vendor(v);
+    gncVendorCommitEdit(v);
 }
 /* ============================================================== */
 /* Package-Private functions */
 
 static const char * _gncVendorPrintable (gpointer item)
 {
-  GncVendor *v = item;
-  if (!item) return NULL;
-  return v->name;
+    GncVendor *v = item;
+    if (!item) return NULL;
+    return v->name;
 }
 
-static QofObject gncVendorDesc = 
+static QofObject gncVendorDesc =
 {
-  .interface_version = QOF_OBJECT_VERSION,
-  .e_type            = _GNC_MOD_NAME,
-  .type_label        = "Vendor",
-  .create            = (gpointer)gncVendorCreate,
-  .book_begin        = NULL,
-  .book_end          = NULL,
-  .is_dirty          = qof_collection_is_dirty,
-  .mark_clean        = qof_collection_mark_clean,
-  .foreach           = qof_collection_foreach,
-  .printable         = _gncVendorPrintable,
-  .version_cmp       = (int (*)(gpointer, gpointer)) qof_instance_version_cmp,
+    .interface_version = QOF_OBJECT_VERSION,
+    .e_type            = _GNC_MOD_NAME,
+    .type_label        = "Vendor",
+    .create            = (gpointer)gncVendorCreate,
+    .book_begin        = NULL,
+    .book_end          = NULL,
+    .is_dirty          = qof_collection_is_dirty,
+    .mark_clean        = qof_collection_mark_clean,
+    .foreach           = qof_collection_foreach,
+    .printable         = _gncVendorPrintable,
+    .version_cmp       = (int (*)(gpointer, gpointer)) qof_instance_version_cmp,
 };
 
 gboolean gncVendorRegister (void)
 {
-  static QofParam params[] = {
-    { VENDOR_ID, QOF_TYPE_STRING, (QofAccessFunc)gncVendorGetID, (QofSetterFunc)gncVendorSetID },
-    { VENDOR_NAME, QOF_TYPE_STRING, (QofAccessFunc)gncVendorGetName, (QofSetterFunc)gncVendorSetName },
-    { VENDOR_ADDR,    GNC_ID_ADDRESS, (QofAccessFunc)gncVendorGetAddr, (QofSetterFunc)qofVendorSetAddr },
-    { VENDOR_NOTES,   QOF_TYPE_STRING, (QofAccessFunc)gncVendorGetNotes, (QofSetterFunc)gncVendorSetNotes },
-    { VENDOR_TERMS,   GNC_ID_BILLTERM, (QofAccessFunc)gncVendorGetTerms, (QofSetterFunc)gncVendorSetTerms },
-    { VENDOR_TAX_OVERRIDE, QOF_TYPE_BOOLEAN, (QofAccessFunc)gncVendorGetTaxTableOverride,
-		(QofSetterFunc)gncVendorSetTaxTableOverride },
-    { VENDOR_TAX_TABLE, GNC_ID_TAXTABLE, (QofAccessFunc)gncVendorGetTaxTable,
-		(QofSetterFunc)gncVendorSetTaxTable },
-    { VENDOR_TAX_INC, QOF_TYPE_STRING, (QofAccessFunc)qofVendorGetTaxIncluded, 
-		(QofSetterFunc)qofVendorSetTaxIncluded},
-    { QOF_PARAM_BOOK, QOF_ID_BOOK, (QofAccessFunc)qof_instance_get_book, NULL },
-    { QOF_PARAM_GUID, QOF_TYPE_GUID, (QofAccessFunc)qof_instance_get_guid, NULL },
-    { QOF_PARAM_ACTIVE, QOF_TYPE_BOOLEAN, (QofAccessFunc)gncVendorGetActive, NULL },
-    { NULL },
-  };
+    static QofParam params[] =
+    {
+        { VENDOR_ID, QOF_TYPE_STRING, (QofAccessFunc)gncVendorGetID, (QofSetterFunc)gncVendorSetID },
+        { VENDOR_NAME, QOF_TYPE_STRING, (QofAccessFunc)gncVendorGetName, (QofSetterFunc)gncVendorSetName },
+        { VENDOR_ADDR,    GNC_ID_ADDRESS, (QofAccessFunc)gncVendorGetAddr, (QofSetterFunc)qofVendorSetAddr },
+        { VENDOR_NOTES,   QOF_TYPE_STRING, (QofAccessFunc)gncVendorGetNotes, (QofSetterFunc)gncVendorSetNotes },
+        { VENDOR_TERMS,   GNC_ID_BILLTERM, (QofAccessFunc)gncVendorGetTerms, (QofSetterFunc)gncVendorSetTerms },
+        {
+            VENDOR_TAX_OVERRIDE, QOF_TYPE_BOOLEAN, (QofAccessFunc)gncVendorGetTaxTableOverride,
+            (QofSetterFunc)gncVendorSetTaxTableOverride
+        },
+        {
+            VENDOR_TAX_TABLE, GNC_ID_TAXTABLE, (QofAccessFunc)gncVendorGetTaxTable,
+            (QofSetterFunc)gncVendorSetTaxTable
+        },
+        {
+            VENDOR_TAX_INC, QOF_TYPE_STRING, (QofAccessFunc)qofVendorGetTaxIncluded,
+            (QofSetterFunc)qofVendorSetTaxIncluded
+        },
+        { QOF_PARAM_BOOK, QOF_ID_BOOK, (QofAccessFunc)qof_instance_get_book, NULL },
+        { QOF_PARAM_GUID, QOF_TYPE_GUID, (QofAccessFunc)qof_instance_get_guid, NULL },
+        { QOF_PARAM_ACTIVE, QOF_TYPE_BOOLEAN, (QofAccessFunc)gncVendorGetActive, NULL },
+        { NULL },
+    };
 
-  if(!qof_choice_add_class(GNC_ID_INVOICE, GNC_ID_VENDOR, INVOICE_OWNER)) { return FALSE; }
-  if(!qof_choice_add_class(GNC_ID_JOB, GNC_ID_VENDOR, JOB_OWNER)) { return FALSE; }
+    if (!qof_choice_add_class(GNC_ID_INVOICE, GNC_ID_VENDOR, INVOICE_OWNER))
+    {
+        return FALSE;
+    }
+    if (!qof_choice_add_class(GNC_ID_JOB, GNC_ID_VENDOR, JOB_OWNER))
+    {
+        return FALSE;
+    }
 
-  qof_class_register (_GNC_MOD_NAME, (QofSortFunc)gncVendorCompare, params);
+    qof_class_register (_GNC_MOD_NAME, (QofSortFunc)gncVendorCompare, params);
 
-  return qof_object_register (&gncVendorDesc);
+    return qof_object_register (&gncVendorDesc);
 }
 
 gint64 gncVendorNextID (QofBook *book)
 {
-  return qof_book_get_counter (book, _GNC_MOD_NAME);
+    return qof_book_get_counter (book, _GNC_MOD_NAME);
 }

Modified: gnucash/trunk/src/business/business-core/gncVendor.h
===================================================================
--- gnucash/trunk/src/business/business-core/gncVendor.h	2010-03-02 21:40:28 UTC (rev 18788)
+++ gnucash/trunk/src/business/business-core/gncVendor.h	2010-03-02 21:41:05 UTC (rev 18789)
@@ -24,7 +24,7 @@
 /** @addtogroup Vendor
     @{ */
 /** @file gncVendor.h
-    @brief  Vendor Interface 
+    @brief  Vendor Interface
     @author Copyright (C) 2001,2002 Derek Atkins <warlord at MIT.EDU>
 */
 
@@ -100,14 +100,14 @@
 
 /** @} */
 /** XXX should be renamed to RetJobList to be consistent with
- * other usage, since caller must free the copied list 
+ * other usage, since caller must free the copied list
  */
 GList * gncVendorGetJoblist (const GncVendor *vendor, gboolean show_all);
 gboolean gncVendorIsDirty (const GncVendor *vendor);
 int gncVendorCompare (const GncVendor *a, const GncVendor *b);
 
 /** Return a pointer to the instance gncVendor that is identified
- *  by the guid, and is residing in the book. Returns NULL if the 
+ *  by the guid, and is residing in the book. Returns NULL if the
  *  instance can't be found.
  *  Equivalent function prototype is
  *  GncVendor * gncVendorLookup (QofBook *book, const GUID *guid);

Modified: gnucash/trunk/src/business/business-core/gncVendorP.h
===================================================================
--- gnucash/trunk/src/business/business-core/gncVendorP.h	2010-03-02 21:40:28 UTC (rev 18788)
+++ gnucash/trunk/src/business/business-core/gncVendorP.h	2010-03-02 21:41:05 UTC (rev 18789)
@@ -48,7 +48,7 @@
  *  gncCloneVendor()) and placed into the book.
  *
  * We called this routine 'Obtain' instead of "Get" to distinguish
- * it from the other Get routines, which work in fundamentally  
+ * it from the other Get routines, which work in fundamentally
  * different ways.
  */
 GncVendor * gncVendorObtainTwin (GncVendor *from, QofBook *book);

Modified: gnucash/trunk/src/business/business-core/sql/gnc-address-sql.c
===================================================================
--- gnucash/trunk/src/business/business-core/sql/gnc-address-sql.c	2010-03-02 21:40:28 UTC (rev 18788)
+++ gnucash/trunk/src/business/business-core/sql/gnc-address-sql.c	2010-03-02 21:41:05 UTC (rev 18789)
@@ -49,15 +49,15 @@
 
 static GncSqlColumnTableEntry col_table[] =
 {
-	{ "name",  CT_STRING, ADDRESS_MAX_NAME_LEN,         COL_NNUL, "name" },
-	{ "addr1", CT_STRING, ADDRESS_MAX_ADDRESS_LINE_LEN, COL_NNUL, NULL, ADDRESS_ONE },
-	{ "addr2", CT_STRING, ADDRESS_MAX_ADDRESS_LINE_LEN, COL_NNUL, NULL, ADDRESS_TWO },
-	{ "addr3", CT_STRING, ADDRESS_MAX_ADDRESS_LINE_LEN, COL_NNUL, NULL, ADDRESS_THREE },
-	{ "addr4", CT_STRING, ADDRESS_MAX_ADDRESS_LINE_LEN, COL_NNUL, NULL, ADDRESS_FOUR },
-	{ "phone", CT_STRING, ADDRESS_MAX_PHONE_LEN,        COL_NNUL, NULL, ADDRESS_PHONE },
-	{ "fax",   CT_STRING, ADDRESS_MAX_FAX_LEN,          COL_NNUL, NULL, ADDRESS_FAX },
-	{ "email", CT_STRING, ADDRESS_MAX_EMAIL_LEN,        COL_NNUL, NULL, ADDRESS_EMAIL },
-	{ NULL }
+    { "name",  CT_STRING, ADDRESS_MAX_NAME_LEN,         COL_NNUL, "name" },
+    { "addr1", CT_STRING, ADDRESS_MAX_ADDRESS_LINE_LEN, COL_NNUL, NULL, ADDRESS_ONE },
+    { "addr2", CT_STRING, ADDRESS_MAX_ADDRESS_LINE_LEN, COL_NNUL, NULL, ADDRESS_TWO },
+    { "addr3", CT_STRING, ADDRESS_MAX_ADDRESS_LINE_LEN, COL_NNUL, NULL, ADDRESS_THREE },
+    { "addr4", CT_STRING, ADDRESS_MAX_ADDRESS_LINE_LEN, COL_NNUL, NULL, ADDRESS_FOUR },
+    { "phone", CT_STRING, ADDRESS_MAX_PHONE_LEN,        COL_NNUL, NULL, ADDRESS_PHONE },
+    { "fax",   CT_STRING, ADDRESS_MAX_FAX_LEN,          COL_NNUL, NULL, ADDRESS_FAX },
+    { "email", CT_STRING, ADDRESS_MAX_EMAIL_LEN,        COL_NNUL, NULL, ADDRESS_EMAIL },
+    { NULL }
 };
 
 typedef void (*AddressSetterFunc)( gpointer, GncAddress* );
@@ -65,93 +65,104 @@
 
 static void
 load_address( const GncSqlBackend* be, GncSqlRow* row,
-            QofSetterFunc setter, gpointer pObject,
-            const GncSqlColumnTableEntry* table_row )
+              QofSetterFunc setter, gpointer pObject,
+              const GncSqlColumnTableEntry* table_row )
 {
     const GValue* val;
     gchar* buf;
     GncAddress* addr;
-	AddressSetterFunc a_setter = (AddressSetterFunc)setter;
-	const GncSqlColumnTableEntry* subtable;
-	const gchar* s;
+    AddressSetterFunc a_setter = (AddressSetterFunc)setter;
+    const GncSqlColumnTableEntry* subtable;
+    const gchar* s;
 
-	g_return_if_fail( be != NULL );
-	g_return_if_fail( row != NULL );
-	g_return_if_fail( pObject != NULL );
-	g_return_if_fail( table_row != NULL );
+    g_return_if_fail( be != NULL );
+    g_return_if_fail( row != NULL );
+    g_return_if_fail( pObject != NULL );
+    g_return_if_fail( table_row != NULL );
 
     addr = gncAddressCreate( be->primary_book, NULL );
-	for( subtable = col_table; subtable->col_name != NULL; subtable++ ) {
-    	buf = g_strdup_printf( "%s_%s", table_row->col_name, subtable->col_name );
-    	val = gnc_sql_row_get_value_at_col_name( row, buf );
-    	g_free( buf );
-    	if( val == NULL ) {
-        	s = NULL;
-    	} else {
-        	s = g_value_get_string( val );
-    	}
-    	if( subtable->gobj_param_name != NULL ) {
-			g_object_set( addr, subtable->gobj_param_name, s, NULL );
-    	} else {
-	        if( subtable->qof_param_name != NULL ) {
-            	setter = qof_class_get_parameter_setter( GNC_ID_ADDRESS, subtable->qof_param_name );
-        	} else {
-            	setter = subtable->setter;
-        	}
-			(*setter)( addr, (const gpointer)s );
-    	}
+    for ( subtable = col_table; subtable->col_name != NULL; subtable++ )
+    {
+        buf = g_strdup_printf( "%s_%s", table_row->col_name, subtable->col_name );
+        val = gnc_sql_row_get_value_at_col_name( row, buf );
+        g_free( buf );
+        if ( val == NULL )
+        {
+            s = NULL;
+        }
+        else
+        {
+            s = g_value_get_string( val );
+        }
+        if ( subtable->gobj_param_name != NULL )
+        {
+            g_object_set( addr, subtable->gobj_param_name, s, NULL );
+        }
+        else
+        {
+            if ( subtable->qof_param_name != NULL )
+            {
+                setter = qof_class_get_parameter_setter( GNC_ID_ADDRESS, subtable->qof_param_name );
+            }
+            else
+            {
+                setter = subtable->setter;
+            }
+            (*setter)( addr, (const gpointer)s );
+        }
     }
     (*a_setter)( pObject, addr );
 }
 
 static void
 add_address_col_info_to_list( const GncSqlBackend* be, const GncSqlColumnTableEntry* table_row,
-								GList** pList )
+                              GList** pList )
 {
-	GncSqlColumnInfo* info;
+    GncSqlColumnInfo* info;
     gchar* buf;
-	const GncSqlColumnTableEntry* subtable_row;
-	const gchar* type;
+    const GncSqlColumnTableEntry* subtable_row;
+    const gchar* type;
 
-	g_return_if_fail( be != NULL );
-	g_return_if_fail( table_row != NULL );
-	g_return_if_fail( pList != NULL );
+    g_return_if_fail( be != NULL );
+    g_return_if_fail( table_row != NULL );
+    g_return_if_fail( pList != NULL );
 
-	for( subtable_row = col_table; subtable_row->col_name != NULL; subtable_row++ ) {
-    	buf = g_strdup_printf( "%s_%s", table_row->col_name, subtable_row->col_name );
-		info = g_new0( GncSqlColumnInfo, 1 );
-		info->name = buf;
-		info->type = BCT_STRING;
-		info->size = subtable_row->size;
-		info->is_primary_key = (table_row->flags & COL_PKEY) ? TRUE : FALSE;
-		info->null_allowed = (table_row->flags & COL_NNUL) ? FALSE : TRUE;
-		info->is_unicode = TRUE;
-		*pList = g_list_append( *pList, info );
-	}
+    for ( subtable_row = col_table; subtable_row->col_name != NULL; subtable_row++ )
+    {
+        buf = g_strdup_printf( "%s_%s", table_row->col_name, subtable_row->col_name );
+        info = g_new0( GncSqlColumnInfo, 1 );
+        info->name = buf;
+        info->type = BCT_STRING;
+        info->size = subtable_row->size;
+        info->is_primary_key = (table_row->flags & COL_PKEY) ? TRUE : FALSE;
+        info->null_allowed = (table_row->flags & COL_NNUL) ? FALSE : TRUE;
+        info->is_unicode = TRUE;
+        *pList = g_list_append( *pList, info );
+    }
 }
 
 static void
 add_address_colname_to_list( const GncSqlColumnTableEntry* table_row, GList** pList )
 {
-	gnc_sql_add_subtable_colnames_to_list( table_row, col_table, pList );
+    gnc_sql_add_subtable_colnames_to_list( table_row, col_table, pList );
 }
 
 static void
 get_gvalue_address( const GncSqlBackend* be, QofIdTypeConst obj_name, const gpointer pObject,
-                	const GncSqlColumnTableEntry* table_row, GValue* value )
+                    const GncSqlColumnTableEntry* table_row, GValue* value )
 {
     AddressGetterFunc getter;
     GncAddress* addr;
 
-	g_return_if_fail( be != NULL );
-	g_return_if_fail( obj_name != NULL );
-	g_return_if_fail( pObject != NULL );
-	g_return_if_fail( table_row != NULL );
-	g_return_if_fail( value != NULL );
+    g_return_if_fail( be != NULL );
+    g_return_if_fail( obj_name != NULL );
+    g_return_if_fail( pObject != NULL );
+    g_return_if_fail( table_row != NULL );
+    g_return_if_fail( value != NULL );
 
     memset( value, 0, sizeof( GValue ) );
 
-	getter = (AddressGetterFunc)gnc_sql_get_getter( obj_name, table_row );
+    getter = (AddressGetterFunc)gnc_sql_get_getter( obj_name, table_row );
     addr = (*getter)( pObject );
     g_value_init( value, gnc_address_get_type() );
     g_value_set_object( value, addr );
@@ -159,54 +170,63 @@
 
 static void
 add_gvalue_address_to_slist( const GncSqlBackend* be, QofIdTypeConst obj_name,
-          			const gpointer pObject, const GncSqlColumnTableEntry* table_row, GSList** pList )
+                             const gpointer pObject, const GncSqlColumnTableEntry* table_row, GSList** pList )
 {
     GValue value;
     GValue* subfield_value;
     GncAddress* addr;
     gchar* s;
     QofAccessFunc getter;
-	const GncSqlColumnTableEntry* subtable_row;
+    const GncSqlColumnTableEntry* subtable_row;
 
-	g_return_if_fail( be != NULL );
-	g_return_if_fail( obj_name != NULL );
-	g_return_if_fail( pObject != NULL );
-	g_return_if_fail( table_row != NULL );
+    g_return_if_fail( be != NULL );
+    g_return_if_fail( obj_name != NULL );
+    g_return_if_fail( pObject != NULL );
+    g_return_if_fail( table_row != NULL );
 
     memset( &value, 0, sizeof( GValue ) );
     get_gvalue_address( be, obj_name, pObject, table_row, &value );
 
-    if( G_VALUE_TYPE(&value) != 0 ) {
+    if ( G_VALUE_TYPE(&value) != 0 )
+    {
         addr = g_value_get_object( &value );
-		for( subtable_row = col_table; subtable_row->col_name != NULL; subtable_row++ ) {
-			subfield_value = g_new0( GValue, 1 );
-			if( subtable_row->gobj_param_name != NULL ) {
-				g_object_get( addr, subtable_row->gobj_param_name, &s, NULL );
-			} else {
-    			getter = gnc_sql_get_getter( GNC_ID_ADDRESS, subtable_row );
-    			s = (gchar*)(*getter)( addr, NULL );
-			}
-        	g_value_init( subfield_value, G_TYPE_STRING );
-    		if( s ) {
-        		g_value_set_string( subfield_value, s );
-			} else {
-				g_value_set_string( subfield_value, "NULL" );
-			}
-			(*pList) = g_slist_append( (*pList), subfield_value );
-		}
+        for ( subtable_row = col_table; subtable_row->col_name != NULL; subtable_row++ )
+        {
+            subfield_value = g_new0( GValue, 1 );
+            if ( subtable_row->gobj_param_name != NULL )
+            {
+                g_object_get( addr, subtable_row->gobj_param_name, &s, NULL );
+            }
+            else
+            {
+                getter = gnc_sql_get_getter( GNC_ID_ADDRESS, subtable_row );
+                s = (gchar*)(*getter)( addr, NULL );
+            }
+            g_value_init( subfield_value, G_TYPE_STRING );
+            if ( s )
+            {
+                g_value_set_string( subfield_value, s );
+            }
+            else
+            {
+                g_value_set_string( subfield_value, "NULL" );
+            }
+            (*pList) = g_slist_append( (*pList), subfield_value );
+        }
     }
 }
 
 static GncSqlColumnTypeHandler address_handler
-	= { load_address,
-		add_address_col_info_to_list,
-		add_address_colname_to_list,
-		add_gvalue_address_to_slist };
+= { load_address,
+    add_address_col_info_to_list,
+    add_address_colname_to_list,
+    add_gvalue_address_to_slist
+  };
 
 /* ================================================================= */
 void
 gnc_address_sql_initialize( void )
 {
-	gnc_sql_register_col_type_handler( CT_ADDRESS, &address_handler );
+    gnc_sql_register_col_type_handler( CT_ADDRESS, &address_handler );
 }
 /* ========================== END OF FILE ===================== */

Modified: gnucash/trunk/src/business/business-core/sql/gnc-bill-term-sql.c
===================================================================
--- gnucash/trunk/src/business/business-core/sql/gnc-bill-term-sql.c	2010-03-02 21:40:28 UTC (rev 18788)
+++ gnucash/trunk/src/business/business-core/sql/gnc-bill-term-sql.c	2010-03-02 21:41:05 UTC (rev 18789)
@@ -57,55 +57,65 @@
 
 static GncSqlColumnTableEntry col_table[] =
 {
-	{ "guid",         CT_GUID,        0,                   COL_NNUL|COL_PKEY, "guid" },
-	{ "name",         CT_STRING,      MAX_NAME_LEN,        COL_NNUL,          "name" },
-	{ "description",  CT_STRING,      MAX_DESCRIPTION_LEN, COL_NNUL,          NULL, GNC_BILLTERM_DESC },
-	{ "refcount",     CT_INT,         0,                   COL_NNUL,          NULL, NULL,
-			(QofAccessFunc)gncBillTermGetRefcount,  (QofSetterFunc)gncBillTermSetRefcount },
-	{ "invisible",    CT_BOOLEAN,     0,                   COL_NNUL,          NULL, NULL,
-			(QofAccessFunc)gncBillTermGetInvisible, (QofSetterFunc)set_invisible },
-	{ "parent",       CT_BILLTERMREF, 0,                   0,                 NULL, NULL,
-			(QofAccessFunc)gncBillTermGetParent,    (QofSetterFunc)gncBillTermSetParent },
-	{ "child",        CT_BILLTERMREF, 0,                   0,                 NULL, NULL,
-			(QofAccessFunc)gncBillTermReturnChild,  (QofSetterFunc)gncBillTermSetChild },
-	{ "type",         CT_STRING,      MAX_TYPE_LEN,        COL_NNUL,          NULL, GNC_BILLTERM_TYPE },
-	{ "duedays",      CT_INT,         0,                   0,                 0,    GNC_BILLTERM_DUEDAYS },
-	{ "discountdays", CT_INT,         0,                   0,                 0,    GNC_BILLTERM_DISCDAYS },
-	{ "discount",     CT_NUMERIC,     0,                   0,                 0,    GNC_BILLTERM_DISCOUNT },
-	{ "cutoff",       CT_INT,         0,                   0,                 0,    GNC_BILLTERM_CUTOFF },
-	{ NULL }
+    { "guid",         CT_GUID,        0,                   COL_NNUL | COL_PKEY, "guid" },
+    { "name",         CT_STRING,      MAX_NAME_LEN,        COL_NNUL,          "name" },
+    { "description",  CT_STRING,      MAX_DESCRIPTION_LEN, COL_NNUL,          NULL, GNC_BILLTERM_DESC },
+    {
+        "refcount",     CT_INT,         0,                   COL_NNUL,          NULL, NULL,
+        (QofAccessFunc)gncBillTermGetRefcount,  (QofSetterFunc)gncBillTermSetRefcount
+    },
+    {
+        "invisible",    CT_BOOLEAN,     0,                   COL_NNUL,          NULL, NULL,
+        (QofAccessFunc)gncBillTermGetInvisible, (QofSetterFunc)set_invisible
+    },
+    {
+        "parent",       CT_BILLTERMREF, 0,                   0,                 NULL, NULL,
+        (QofAccessFunc)gncBillTermGetParent,    (QofSetterFunc)gncBillTermSetParent
+    },
+    {
+        "child",        CT_BILLTERMREF, 0,                   0,                 NULL, NULL,
+        (QofAccessFunc)gncBillTermReturnChild,  (QofSetterFunc)gncBillTermSetChild
+    },
+    { "type",         CT_STRING,      MAX_TYPE_LEN,        COL_NNUL,          NULL, GNC_BILLTERM_TYPE },
+    { "duedays",      CT_INT,         0,                   0,                 0,    GNC_BILLTERM_DUEDAYS },
+    { "discountdays", CT_INT,         0,                   0,                 0,    GNC_BILLTERM_DISCDAYS },
+    { "discount",     CT_NUMERIC,     0,                   0,                 0,    GNC_BILLTERM_DISCOUNT },
+    { "cutoff",       CT_INT,         0,                   0,                 0,    GNC_BILLTERM_CUTOFF },
+    { NULL }
 };
 
 static void
 set_invisible( gpointer data, gboolean value )
 {
-	GncBillTerm* term = GNC_BILLTERM(data);
+    GncBillTerm* term = GNC_BILLTERM(data);
 
-	g_return_if_fail( term != NULL );
+    g_return_if_fail( term != NULL );
 
-	if( value ) {
-		gncBillTermMakeInvisible( term );
-	}
+    if ( value )
+    {
+        gncBillTermMakeInvisible( term );
+    }
 }
 
 static GncBillTerm*
 load_single_billterm( GncSqlBackend* be, GncSqlRow* row )
 {
     const GUID* guid;
-	GncBillTerm* pBillTerm;
+    GncBillTerm* pBillTerm;
 
-	g_return_val_if_fail( be != NULL, NULL );
-	g_return_val_if_fail( row != NULL, NULL );
+    g_return_val_if_fail( be != NULL, NULL );
+    g_return_val_if_fail( row != NULL, NULL );
 
     guid = gnc_sql_load_guid( be, row );
     pBillTerm = gncBillTermLookup( be->primary_book, guid );
-    if( pBillTerm == NULL ) {
+    if ( pBillTerm == NULL )
+    {
         pBillTerm = gncBillTermCreate( be->primary_book );
     }
     gnc_sql_load_object( be, row, GNC_ID_BILLTERM, pBillTerm, col_table );
     qof_instance_mark_clean( QOF_INSTANCE(pBillTerm) );
 
-	return pBillTerm;
+    return pBillTerm;
 }
 
 static void
@@ -115,87 +125,96 @@
     GncSqlResult* result;
     QofBook* pBook;
 
-	g_return_if_fail( be != NULL );
+    g_return_if_fail( be != NULL );
 
     pBook = be->primary_book;
 
     stmt = gnc_sql_create_select_statement( be, TABLE_NAME );
     result = gnc_sql_execute_select_statement( be, stmt );
-	gnc_sql_statement_dispose( stmt );
-    if( result != NULL ) {
-		GncSqlRow* row;
-		GList* list = NULL;
+    gnc_sql_statement_dispose( stmt );
+    if ( result != NULL )
+    {
+        GncSqlRow* row;
+        GList* list = NULL;
 
-		row = gnc_sql_result_get_first_row( result );
-        while( row != NULL ) {
+        row = gnc_sql_result_get_first_row( result );
+        while ( row != NULL )
+        {
             GncBillTerm* pBillTerm = load_single_billterm( be, row );
-			if( pBillTerm != NULL ) {
-				list = g_list_append( list, pBillTerm );
-			}
-			row = gnc_sql_result_get_next_row( result );
-		}
-		gnc_sql_result_dispose( result );
+            if ( pBillTerm != NULL )
+            {
+                list = g_list_append( list, pBillTerm );
+            }
+            row = gnc_sql_result_get_next_row( result );
+        }
+        gnc_sql_result_dispose( result );
 
-		if( list != NULL ) {
-			gnc_sql_slots_load_for_list( be, list );
-		}
+        if ( list != NULL )
+        {
+            gnc_sql_slots_load_for_list( be, list );
+        }
     }
 }
 
 /* ================================================================= */
-typedef struct {
-	GncSqlBackend* be;
-	gboolean is_ok;
+typedef struct
+{
+    GncSqlBackend* be;
+    gboolean is_ok;
 } write_billterms_t;
 
 static void
 do_save_billterm( QofInstance* inst, gpointer p2 )
 {
-	write_billterms_t* data = (write_billterms_t*)p2;
+    write_billterms_t* data = (write_billterms_t*)p2;
 
-	if( data->is_ok ) {
-		data->is_ok = gnc_sql_save_billterm( data->be, inst );
-	}
+    if ( data->is_ok )
+    {
+        data->is_ok = gnc_sql_save_billterm( data->be, inst );
+    }
 }
 
 static gboolean
 write_billterms( GncSqlBackend* be )
 {
-	write_billterms_t data;
+    write_billterms_t data;
 
-	g_return_val_if_fail( be != NULL, FALSE );
+    g_return_val_if_fail( be != NULL, FALSE );
 
-	data.be = be;
-	data.is_ok = TRUE;
+    data.be = be;
+    data.is_ok = TRUE;
     qof_object_foreach( GNC_ID_BILLTERM, be->primary_book, do_save_billterm, &data );
-	return data.is_ok;
+    return data.is_ok;
 }
 
 /* ================================================================= */
 static void
 create_billterm_tables( GncSqlBackend* be )
 {
-	gint version;
+    gint version;
 
-	g_return_if_fail( be != NULL );
+    g_return_if_fail( be != NULL );
 
-	version = gnc_sql_get_table_version( be, TABLE_NAME );
-    if( version == 0 ) {
+    version = gnc_sql_get_table_version( be, TABLE_NAME );
+    if ( version == 0 )
+    {
         gnc_sql_create_table( be, TABLE_NAME, TABLE_VERSION, col_table );
-    } else if( version == 1 ) {
-		/* Upgrade 64 bit int handling */
-		gnc_sql_upgrade_table( be, TABLE_NAME, col_table );
-		gnc_sql_set_table_version( be, TABLE_NAME, TABLE_VERSION );
-	}
+    }
+    else if ( version == 1 )
+    {
+        /* Upgrade 64 bit int handling */
+        gnc_sql_upgrade_table( be, TABLE_NAME, col_table );
+        gnc_sql_set_table_version( be, TABLE_NAME, TABLE_VERSION );
+    }
 }
 
 /* ================================================================= */
 gboolean
 gnc_sql_save_billterm( GncSqlBackend* be, QofInstance* inst )
 {
-	g_return_val_if_fail( inst != NULL, FALSE );
-	g_return_val_if_fail( GNC_IS_BILLTERM(inst), FALSE );
-	g_return_val_if_fail( be != NULL, FALSE );
+    g_return_val_if_fail( inst != NULL, FALSE );
+    g_return_val_if_fail( GNC_IS_BILLTERM(inst), FALSE );
+    g_return_val_if_fail( be != NULL, FALSE );
 
     return gnc_sql_commit_standard_item( be, inst, TABLE_NAME, GNC_ID_BILLTERM, col_table );
 }
@@ -203,39 +222,47 @@
 /* ================================================================= */
 static void
 load_billterm_guid( const GncSqlBackend* be, GncSqlRow* row,
-            QofSetterFunc setter, gpointer pObject,
-            const GncSqlColumnTableEntry* table_row )
+                    QofSetterFunc setter, gpointer pObject,
+                    const GncSqlColumnTableEntry* table_row )
 {
     const GValue* val;
     GUID guid;
-	GncBillTerm* term = NULL;
+    GncBillTerm* term = NULL;
 
-	g_return_if_fail( be != NULL );
-	g_return_if_fail( row != NULL );
-	g_return_if_fail( pObject != NULL );
-	g_return_if_fail( table_row != NULL );
+    g_return_if_fail( be != NULL );
+    g_return_if_fail( row != NULL );
+    g_return_if_fail( pObject != NULL );
+    g_return_if_fail( table_row != NULL );
 
     val = gnc_sql_row_get_value_at_col_name( row, table_row->col_name );
-    if( val != NULL && G_VALUE_HOLDS_STRING( val ) && g_value_get_string( val ) != NULL ) {
+    if ( val != NULL && G_VALUE_HOLDS_STRING( val ) && g_value_get_string( val ) != NULL )
+    {
         string_to_guid( g_value_get_string( val ), &guid );
-		term = gncBillTermLookup( be->primary_book, &guid );
-		if( term != NULL ) {
-        	if( table_row->gobj_param_name != NULL ) {
-		    	g_object_set( pObject, table_row->gobj_param_name, term, NULL );
-        	} else {
-		    	(*setter)( pObject, (const gpointer)term );
-        	}
-		} else {
-	    	PWARN( "Billterm ref '%s' not found", g_value_get_string( val ) );
-		}
-	}
+        term = gncBillTermLookup( be->primary_book, &guid );
+        if ( term != NULL )
+        {
+            if ( table_row->gobj_param_name != NULL )
+            {
+                g_object_set( pObject, table_row->gobj_param_name, term, NULL );
+            }
+            else
+            {
+                (*setter)( pObject, (const gpointer)term );
+            }
+        }
+        else
+        {
+            PWARN( "Billterm ref '%s' not found", g_value_get_string( val ) );
+        }
+    }
 }
 
 static GncSqlColumnTypeHandler billterm_guid_handler
-	= { load_billterm_guid,
-		gnc_sql_add_objectref_guid_col_info_to_list,
-		gnc_sql_add_colname_to_list,
-		gnc_sql_add_gvalue_objectref_guid_to_slist };
+= { load_billterm_guid,
+    gnc_sql_add_objectref_guid_col_info_to_list,
+    gnc_sql_add_colname_to_list,
+    gnc_sql_add_gvalue_objectref_guid_to_slist
+  };
 /* ================================================================= */
 void
 gnc_billterm_sql_initialize( void )
@@ -247,12 +274,12 @@
         gnc_sql_save_billterm,				/* commit */
         load_all_billterms,					/* initial_load */
         create_billterm_tables,				/* create_tables */
-		NULL, NULL, NULL,
-		write_billterms						/* write */
+        NULL, NULL, NULL,
+        write_billterms						/* write */
     };
 
     qof_object_register_backend( GNC_ID_BILLTERM, GNC_SQL_BACKEND, &be_data );
 
-	gnc_sql_register_col_type_handler( CT_BILLTERMREF, &billterm_guid_handler );
+    gnc_sql_register_col_type_handler( CT_BILLTERMREF, &billterm_guid_handler );
 }
 /* ========================== END OF FILE ===================== */

Modified: gnucash/trunk/src/business/business-core/sql/gnc-customer-sql.c
===================================================================
--- gnucash/trunk/src/business/business-core/sql/gnc-customer-sql.c	2010-03-02 21:40:28 UTC (rev 18788)
+++ gnucash/trunk/src/business/business-core/sql/gnc-customer-sql.c	2010-03-02 21:41:05 UTC (rev 18789)
@@ -58,44 +58,51 @@
 
 static GncSqlColumnTableEntry col_table[] =
 {
-	{ "guid",         CT_GUID,          0,             COL_NNUL|COL_PKEY, "guid" },
-	{ "name",         CT_STRING,        MAX_NAME_LEN,  COL_NNUL,          "name" },
-	{ "id",           CT_STRING,        MAX_ID_LEN,    COL_NNUL,          NULL, CUSTOMER_ID },
-	{ "notes",        CT_STRING,        MAX_NOTES_LEN, COL_NNUL,          NULL, CUSTOMER_NOTES },
-	{ "active",       CT_BOOLEAN,       0,             COL_NNUL,          NULL, QOF_PARAM_ACTIVE },
-	{ "discount",     CT_NUMERIC,       0,             COL_NNUL,          NULL, CUSTOMER_DISCOUNT },
-	{ "credit",       CT_NUMERIC,       0,             COL_NNUL,          NULL, CUSTOMER_CREDIT },
-	{ "currency",     CT_COMMODITYREF,  0,             COL_NNUL,          NULL, NULL,
-			(QofAccessFunc)gncCustomerGetCurrency, (QofSetterFunc)gncCustomerSetCurrency },
-	{ "tax_override", CT_BOOLEAN,       0,             COL_NNUL,          NULL, CUSTOMER_TT_OVER },
-	{ "addr",         CT_ADDRESS,       0,             0,                 NULL, CUSTOMER_ADDR },
-	{ "shipaddr",     CT_ADDRESS,       0,             0,                 NULL, CUSTOMER_SHIPADDR },
-	{ "terms",        CT_BILLTERMREF,   0,             0,                 NULL, CUSTOMER_TERMS },
-	{ "tax_included", CT_INT,           0,             0,                 NULL, NULL,
-			(QofAccessFunc)gncCustomerGetTaxIncluded, (QofSetterFunc)gncCustomerSetTaxIncluded },
-	{ "taxtable",     CT_TAXTABLEREF,   0,             0,                 NULL, NULL,
-			(QofAccessFunc)gncCustomerGetTaxTable, (QofSetterFunc)gncCustomerSetTaxTable },
-	{ NULL }
+    { "guid",         CT_GUID,          0,             COL_NNUL | COL_PKEY, "guid" },
+    { "name",         CT_STRING,        MAX_NAME_LEN,  COL_NNUL,          "name" },
+    { "id",           CT_STRING,        MAX_ID_LEN,    COL_NNUL,          NULL, CUSTOMER_ID },
+    { "notes",        CT_STRING,        MAX_NOTES_LEN, COL_NNUL,          NULL, CUSTOMER_NOTES },
+    { "active",       CT_BOOLEAN,       0,             COL_NNUL,          NULL, QOF_PARAM_ACTIVE },
+    { "discount",     CT_NUMERIC,       0,             COL_NNUL,          NULL, CUSTOMER_DISCOUNT },
+    { "credit",       CT_NUMERIC,       0,             COL_NNUL,          NULL, CUSTOMER_CREDIT },
+    {
+        "currency",     CT_COMMODITYREF,  0,             COL_NNUL,          NULL, NULL,
+        (QofAccessFunc)gncCustomerGetCurrency, (QofSetterFunc)gncCustomerSetCurrency
+    },
+    { "tax_override", CT_BOOLEAN,       0,             COL_NNUL,          NULL, CUSTOMER_TT_OVER },
+    { "addr",         CT_ADDRESS,       0,             0,                 NULL, CUSTOMER_ADDR },
+    { "shipaddr",     CT_ADDRESS,       0,             0,                 NULL, CUSTOMER_SHIPADDR },
+    { "terms",        CT_BILLTERMREF,   0,             0,                 NULL, CUSTOMER_TERMS },
+    {
+        "tax_included", CT_INT,           0,             0,                 NULL, NULL,
+        (QofAccessFunc)gncCustomerGetTaxIncluded, (QofSetterFunc)gncCustomerSetTaxIncluded
+    },
+    {
+        "taxtable",     CT_TAXTABLEREF,   0,             0,                 NULL, NULL,
+        (QofAccessFunc)gncCustomerGetTaxTable, (QofSetterFunc)gncCustomerSetTaxTable
+    },
+    { NULL }
 };
 
 static GncCustomer*
 load_single_customer( GncSqlBackend* be, GncSqlRow* row )
 {
     const GUID* guid;
-	GncCustomer* pCustomer;
+    GncCustomer* pCustomer;
 
-	g_return_val_if_fail( be != NULL, NULL );
-	g_return_val_if_fail( row != NULL, NULL );
+    g_return_val_if_fail( be != NULL, NULL );
+    g_return_val_if_fail( row != NULL, NULL );
 
     guid = gnc_sql_load_guid( be, row );
     pCustomer = gncCustomerLookup( be->primary_book, guid );
-    if( pCustomer == NULL ) {
+    if ( pCustomer == NULL )
+    {
         pCustomer = gncCustomerCreate( be->primary_book );
     }
     gnc_sql_load_object( be, row, GNC_ID_CUSTOMER, pCustomer, col_table );
     qof_instance_mark_clean( QOF_INSTANCE(pCustomer) );
 
-	return pCustomer;
+    return pCustomer;
 }
 
 static void
@@ -105,30 +112,34 @@
     GncSqlResult* result;
     QofBook* pBook;
 
-	g_return_if_fail( be != NULL );
+    g_return_if_fail( be != NULL );
 
     pBook = be->primary_book;
 
     stmt = gnc_sql_create_select_statement( be, TABLE_NAME );
     result = gnc_sql_execute_select_statement( be, stmt );
-	gnc_sql_statement_dispose( stmt );
-    if( result != NULL ) {
-		GList* list = NULL;
-		GncSqlRow* row;
+    gnc_sql_statement_dispose( stmt );
+    if ( result != NULL )
+    {
+        GList* list = NULL;
+        GncSqlRow* row;
 
-		row = gnc_sql_result_get_first_row( result );
-        while( row != NULL ) {
+        row = gnc_sql_result_get_first_row( result );
+        while ( row != NULL )
+        {
             GncCustomer* pCustomer = load_single_customer( be, row );
-			if( pCustomer != NULL ) {
-				list = g_list_append( list, pCustomer );
-			}
-			row = gnc_sql_result_get_next_row( result );
-		}
-		gnc_sql_result_dispose( result );
+            if ( pCustomer != NULL )
+            {
+                list = g_list_append( list, pCustomer );
+            }
+            row = gnc_sql_result_get_next_row( result );
+        }
+        gnc_sql_result_dispose( result );
 
-		if( list != NULL ) {
-			gnc_sql_slots_load_for_list( be, list );
-		}
+        if ( list != NULL )
+        {
+            gnc_sql_slots_load_for_list( be, list );
+        }
     }
 }
 
@@ -136,35 +147,39 @@
 static void
 create_customer_tables( GncSqlBackend* be )
 {
-	gint version;
+    gint version;
 
-	g_return_if_fail( be != NULL );
+    g_return_if_fail( be != NULL );
 
-	version = gnc_sql_get_table_version( be, TABLE_NAME );
-    if( version == 0 ) {
+    version = gnc_sql_get_table_version( be, TABLE_NAME );
+    if ( version == 0 )
+    {
         gnc_sql_create_table( be, TABLE_NAME, TABLE_VERSION, col_table );
-    } else if( version == 1 ) {
-		/* Upgrade 64 bit int handling */
-		gnc_sql_upgrade_table( be, TABLE_NAME, col_table );
-		gnc_sql_set_table_version( be, TABLE_NAME, TABLE_VERSION );
     }
+    else if ( version == 1 )
+    {
+        /* Upgrade 64 bit int handling */
+        gnc_sql_upgrade_table( be, TABLE_NAME, col_table );
+        gnc_sql_set_table_version( be, TABLE_NAME, TABLE_VERSION );
+    }
 }
 
 /* ================================================================= */
 static gboolean
 save_customer( GncSqlBackend* be, QofInstance* inst )
 {
-	g_return_val_if_fail( inst != NULL, FALSE );
-	g_return_val_if_fail( GNC_CUSTOMER(inst), FALSE );
-	g_return_val_if_fail( be != NULL, FALSE );
+    g_return_val_if_fail( inst != NULL, FALSE );
+    g_return_val_if_fail( GNC_CUSTOMER(inst), FALSE );
+    g_return_val_if_fail( be != NULL, FALSE );
 
     return gnc_sql_commit_standard_item( be, inst, TABLE_NAME, GNC_ID_CUSTOMER, col_table );
 }
 
 /* ================================================================= */
-typedef struct {
-	GncSqlBackend* be;
-	gboolean is_ok;
+typedef struct
+{
+    GncSqlBackend* be;
+    gboolean is_ok;
 } write_customers_t;
 
 static gboolean
@@ -172,13 +187,14 @@
 {
     const char *id;
 
-	g_return_val_if_fail( customer != NULL, FALSE );
+    g_return_val_if_fail( customer != NULL, FALSE );
 
     /* Make sure this is a valid customer before we save it -- should have an ID */
     id = gncCustomerGetID( customer );
-    if( id == NULL || *id == '\0' ) {
+    if ( id == NULL || *id == '\0' )
+    {
         return FALSE;
-	}
+    }
 
     return TRUE;
 }
@@ -186,28 +202,29 @@
 static void
 write_single_customer( QofInstance *term_p, gpointer data_p )
 {
-	write_customers_t* data = (write_customers_t*)data_p;
+    write_customers_t* data = (write_customers_t*)data_p;
 
-	g_return_if_fail( term_p != NULL );
-	g_return_if_fail( GNC_IS_CUSTOMER(term_p) );
-	g_return_if_fail( data_p != NULL );
+    g_return_if_fail( term_p != NULL );
+    g_return_if_fail( GNC_IS_CUSTOMER(term_p) );
+    g_return_if_fail( data_p != NULL );
 
-	if( customer_should_be_saved( GNC_CUSTOMER(term_p) ) && data->is_ok ) {
-    	data->is_ok = save_customer( data->be, term_p );
-	}
+    if ( customer_should_be_saved( GNC_CUSTOMER(term_p) ) && data->is_ok )
+    {
+        data->is_ok = save_customer( data->be, term_p );
+    }
 }
 
 static gboolean
 write_customers( GncSqlBackend* be )
 {
-	write_customers_t data;
+    write_customers_t data;
 
-	g_return_val_if_fail( be != NULL, FALSE );
+    g_return_val_if_fail( be != NULL, FALSE );
 
-	data.be = be;
-	data.is_ok = TRUE;
+    data.be = be;
+    data.is_ok = TRUE;
     qof_object_foreach( GNC_ID_CUSTOMER, be->primary_book, write_single_customer, (gpointer)&data );
-	return data.is_ok;
+    return data.is_ok;
 }
 
 /* ================================================================= */
@@ -221,8 +238,8 @@
         save_customer,						/* commit */
         load_all_customers,					/* initial_load */
         create_customer_tables,				/* create_tables */
-		NULL, NULL, NULL,
-		write_customers						/* write */
+        NULL, NULL, NULL,
+        write_customers						/* write */
     };
 
     qof_object_register_backend( GNC_ID_CUSTOMER, GNC_SQL_BACKEND, &be_data );

Modified: gnucash/trunk/src/business/business-core/sql/gnc-employee-sql.c
===================================================================
--- gnucash/trunk/src/business/business-core/sql/gnc-employee-sql.c	2010-03-02 21:40:28 UTC (rev 18788)
+++ gnucash/trunk/src/business/business-core/sql/gnc-employee-sql.c	2010-03-02 21:41:05 UTC (rev 18789)
@@ -58,18 +58,20 @@
 
 static GncSqlColumnTableEntry col_table[] =
 {
-	{ "guid",       CT_GUID,          0,                COL_NNUL|COL_PKEY, "guid" },
-	{ "username",   CT_STRING,        MAX_USERNAME_LEN, COL_NNUL,          "username" },
-	{ "id",         CT_STRING,        MAX_ID_LEN,       COL_NNUL,          NULL, EMPLOYEE_ID },
-	{ "language",   CT_STRING,        MAX_LANGUAGE_LEN, COL_NNUL,          NULL, EMPLOYEE_LANGUAGE },
-	{ "acl",        CT_STRING,        MAX_ACL_LEN,      COL_NNUL,          NULL, EMPLOYEE_ACL },
-	{ "active",     CT_BOOLEAN,       0,                COL_NNUL,          NULL, QOF_PARAM_ACTIVE },
-	{ "currency",   CT_COMMODITYREF,  0,                COL_NNUL,          NULL, NULL,
-			(QofAccessFunc)gncEmployeeGetCurrency, (QofSetterFunc)gncEmployeeSetCurrency },
-	{ "ccard_guid", CT_ACCOUNTREF,    0,                0,                 NULL, EMPLOYEE_CC },
-	{ "workday",    CT_NUMERIC,       0,                COL_NNUL,          NULL, EMPLOYEE_WORKDAY },
-	{ "rate",       CT_NUMERIC,       0,                COL_NNUL,          NULL, EMPLOYEE_RATE },
-	{ "addr",       CT_ADDRESS,       0,                0,                 NULL, EMPLOYEE_ADDR },
+    { "guid",       CT_GUID,          0,                COL_NNUL | COL_PKEY, "guid" },
+    { "username",   CT_STRING,        MAX_USERNAME_LEN, COL_NNUL,          "username" },
+    { "id",         CT_STRING,        MAX_ID_LEN,       COL_NNUL,          NULL, EMPLOYEE_ID },
+    { "language",   CT_STRING,        MAX_LANGUAGE_LEN, COL_NNUL,          NULL, EMPLOYEE_LANGUAGE },
+    { "acl",        CT_STRING,        MAX_ACL_LEN,      COL_NNUL,          NULL, EMPLOYEE_ACL },
+    { "active",     CT_BOOLEAN,       0,                COL_NNUL,          NULL, QOF_PARAM_ACTIVE },
+    {
+        "currency",   CT_COMMODITYREF,  0,                COL_NNUL,          NULL, NULL,
+        (QofAccessFunc)gncEmployeeGetCurrency, (QofSetterFunc)gncEmployeeSetCurrency
+    },
+    { "ccard_guid", CT_ACCOUNTREF,    0,                0,                 NULL, EMPLOYEE_CC },
+    { "workday",    CT_NUMERIC,       0,                COL_NNUL,          NULL, EMPLOYEE_WORKDAY },
+    { "rate",       CT_NUMERIC,       0,                COL_NNUL,          NULL, EMPLOYEE_RATE },
+    { "addr",       CT_ADDRESS,       0,                0,                 NULL, EMPLOYEE_ADDR },
     { NULL }
 };
 
@@ -77,20 +79,21 @@
 load_single_employee( GncSqlBackend* be, GncSqlRow* row )
 {
     const GUID* guid;
-	GncEmployee* pEmployee;
+    GncEmployee* pEmployee;
 
-	g_return_val_if_fail( be != NULL, NULL );
-	g_return_val_if_fail( row != NULL, NULL );
+    g_return_val_if_fail( be != NULL, NULL );
+    g_return_val_if_fail( row != NULL, NULL );
 
     guid = gnc_sql_load_guid( be, row );
     pEmployee = gncEmployeeLookup( be->primary_book, guid );
-    if( pEmployee == NULL ) {
+    if ( pEmployee == NULL )
+    {
         pEmployee = gncEmployeeCreate( be->primary_book );
     }
     gnc_sql_load_object( be, row, GNC_ID_EMPLOYEE, pEmployee, col_table );
     qof_instance_mark_clean( QOF_INSTANCE(pEmployee) );
 
-	return pEmployee;
+    return pEmployee;
 }
 
 static void
@@ -101,31 +104,35 @@
     QofBook* pBook;
     gnc_commodity_table* pTable;
 
-	g_return_if_fail( be != NULL );
+    g_return_if_fail( be != NULL );
 
     pBook = be->primary_book;
     pTable = gnc_commodity_table_get_table( pBook );
 
     stmt = gnc_sql_create_select_statement( be, TABLE_NAME );
     result = gnc_sql_execute_select_statement( be, stmt );
-	gnc_sql_statement_dispose( stmt );
-    if( result != NULL ) {
+    gnc_sql_statement_dispose( stmt );
+    if ( result != NULL )
+    {
         GncSqlRow* row;
-		GList* list = NULL;
+        GList* list = NULL;
 
-		row = gnc_sql_result_get_first_row( result );
-        while( row != NULL ) {
+        row = gnc_sql_result_get_first_row( result );
+        while ( row != NULL )
+        {
             GncEmployee* pEmployee = load_single_employee( be, row );
-			if( pEmployee != NULL ) {
-				list = g_list_append( list, pEmployee );
-			}
-			row = gnc_sql_result_get_next_row( result );
-		}
-		gnc_sql_result_dispose( result );
+            if ( pEmployee != NULL )
+            {
+                list = g_list_append( list, pEmployee );
+            }
+            row = gnc_sql_result_get_next_row( result );
+        }
+        gnc_sql_result_dispose( result );
 
-		if( list != NULL ) {
-			gnc_sql_slots_load_for_list( be, list );
-		}
+        if ( list != NULL )
+        {
+            gnc_sql_slots_load_for_list( be, list );
+        }
     }
 }
 
@@ -133,18 +140,21 @@
 static void
 create_employee_tables( GncSqlBackend* be )
 {
-	gint version;
+    gint version;
 
-	g_return_if_fail( be != NULL );
+    g_return_if_fail( be != NULL );
 
-	version = gnc_sql_get_table_version( be, TABLE_NAME );
-    if( version == 0 ) {
+    version = gnc_sql_get_table_version( be, TABLE_NAME );
+    if ( version == 0 )
+    {
         gnc_sql_create_table( be, TABLE_NAME, TABLE_VERSION, col_table );
-    } else if( version == 1 ) {
-		/* Upgrade 64 bit int handling */
-		gnc_sql_upgrade_table( be, TABLE_NAME, col_table );
-		gnc_sql_set_table_version( be, TABLE_NAME, TABLE_VERSION );
     }
+    else if ( version == 1 )
+    {
+        /* Upgrade 64 bit int handling */
+        gnc_sql_upgrade_table( be, TABLE_NAME, col_table );
+        gnc_sql_set_table_version( be, TABLE_NAME, TABLE_VERSION );
+    }
 }
 
 /* ================================================================= */
@@ -153,44 +163,55 @@
 {
     GncEmployee* emp;
     const GUID* guid;
-	gint op;
-	gboolean is_infant;
-	gboolean is_ok = TRUE;
+    gint op;
+    gboolean is_infant;
+    gboolean is_ok = TRUE;
 
-	g_return_val_if_fail( inst != NULL, FALSE );
-	g_return_val_if_fail( GNC_IS_EMPLOYEE(inst), FALSE );
-	g_return_val_if_fail( be != NULL, FALSE );
+    g_return_val_if_fail( inst != NULL, FALSE );
+    g_return_val_if_fail( GNC_IS_EMPLOYEE(inst), FALSE );
+    g_return_val_if_fail( be != NULL, FALSE );
 
     emp = GNC_EMPLOYEE(inst);
 
-	is_infant = qof_instance_get_infant( inst );
-	if( qof_instance_get_destroying( inst ) ) {
-		op = OP_DB_DELETE;
-	} else if( be->is_pristine_db || is_infant ) {
-		op = OP_DB_INSERT;
-	} else {
-		op = OP_DB_UPDATE;
-	}
-	if( op != OP_DB_DELETE ) {
-    	// Ensure the commodity is in the db
-    	is_ok = gnc_sql_save_commodity( be, gncEmployeeGetCurrency( emp ) );
-	}
+    is_infant = qof_instance_get_infant( inst );
+    if ( qof_instance_get_destroying( inst ) )
+    {
+        op = OP_DB_DELETE;
+    }
+    else if ( be->is_pristine_db || is_infant )
+    {
+        op = OP_DB_INSERT;
+    }
+    else
+    {
+        op = OP_DB_UPDATE;
+    }
+    if ( op != OP_DB_DELETE )
+    {
+        // Ensure the commodity is in the db
+        is_ok = gnc_sql_save_commodity( be, gncEmployeeGetCurrency( emp ) );
+    }
 
-	if( is_ok ) {
-    	is_ok = gnc_sql_do_db_operation( be, op, TABLE_NAME, GNC_ID_EMPLOYEE, emp, col_table );
-	}
+    if ( is_ok )
+    {
+        is_ok = gnc_sql_do_db_operation( be, op, TABLE_NAME, GNC_ID_EMPLOYEE, emp, col_table );
+    }
 
-	if( is_ok ) {
-		// Now, commit or delete any slots
-    	guid = qof_instance_get_guid( inst );
-    	if( !qof_instance_get_destroying(inst) ) {
-        	is_ok = gnc_sql_slots_save( be, guid, is_infant, qof_instance_get_slots( inst ) );
-    	} else {
-        	is_ok = gnc_sql_slots_delete( be, guid );
-    	}
-	}
+    if ( is_ok )
+    {
+        // Now, commit or delete any slots
+        guid = qof_instance_get_guid( inst );
+        if ( !qof_instance_get_destroying(inst) )
+        {
+            is_ok = gnc_sql_slots_save( be, guid, is_infant, qof_instance_get_slots( inst ) );
+        }
+        else
+        {
+            is_ok = gnc_sql_slots_delete( be, guid );
+        }
+    }
 
-	return is_ok;
+    return is_ok;
 }
 
 /* ================================================================= */
@@ -199,13 +220,14 @@
 {
     const char *id;
 
-	g_return_val_if_fail( employee != NULL, FALSE );
+    g_return_val_if_fail( employee != NULL, FALSE );
 
     /* make sure this is a valid employee before we save it -- should have an ID */
     id = gncEmployeeGetID( employee );
-    if( id == NULL || *id == '\0' ) {
+    if ( id == NULL || *id == '\0' )
+    {
         return FALSE;
-	}
+    }
 
     return TRUE;
 }
@@ -213,29 +235,30 @@
 static void
 write_single_employee( QofInstance *term_p, gpointer data_p )
 {
-	write_objects_t* s = (write_objects_t*)data_p;
+    write_objects_t* s = (write_objects_t*)data_p;
 
-	g_return_if_fail( term_p != NULL );
-	g_return_if_fail( GNC_IS_EMPLOYEE(term_p) );
-	g_return_if_fail( data_p != NULL );
+    g_return_if_fail( term_p != NULL );
+    g_return_if_fail( GNC_IS_EMPLOYEE(term_p) );
+    g_return_if_fail( data_p != NULL );
 
-	if( s->is_ok && employee_should_be_saved( GNC_EMPLOYEE(term_p) ) ) {
-    	s->is_ok = save_employee( s->be, term_p );
-	}
+    if ( s->is_ok && employee_should_be_saved( GNC_EMPLOYEE(term_p) ) )
+    {
+        s->is_ok = save_employee( s->be, term_p );
+    }
 }
 
 static gboolean
 write_employees( GncSqlBackend* be )
 {
-	write_objects_t data;
+    write_objects_t data;
 
-	g_return_val_if_fail( be != NULL, FALSE );
+    g_return_val_if_fail( be != NULL, FALSE );
 
-	data.be = be;
-	data.is_ok = TRUE;
+    data.be = be;
+    data.is_ok = TRUE;
     qof_object_foreach( GNC_ID_EMPLOYEE, be->primary_book, write_single_employee, &data );
 
-	return data.is_ok;
+    return data.is_ok;
 }
 
 /* ================================================================= */
@@ -249,8 +272,8 @@
         save_employee,						/* commit */
         load_all_employees,					/* initial_load */
         create_employee_tables,				/* create_tables */
-		NULL, NULL, NULL,
-		write_employees						/* write */
+        NULL, NULL, NULL,
+        write_employees						/* write */
     };
 
     qof_object_register_backend( GNC_ID_EMPLOYEE, GNC_SQL_BACKEND, &be_data );

Modified: gnucash/trunk/src/business/business-core/sql/gnc-entry-sql.c
===================================================================
--- gnucash/trunk/src/business/business-core/sql/gnc-entry-sql.c	2010-03-02 21:40:28 UTC (rev 18788)
+++ gnucash/trunk/src/business/business-core/sql/gnc-entry-sql.c	2010-03-02 21:41:05 UTC (rev 18789)
@@ -65,94 +65,109 @@
 
 static GncSqlColumnTableEntry col_table[] =
 {
-	{ "guid",          CT_GUID,        0,                   COL_NNUL|COL_PKEY, "guid" },
-	{ "date",          CT_TIMESPEC,    0,                   COL_NNUL,          NULL, ENTRY_DATE },
-	{ "date_entered",  CT_TIMESPEC,    0,                   0,                 NULL, ENTRY_DATE_ENTERED },
-	{ "description",   CT_STRING,      MAX_DESCRIPTION_LEN, 0,                 "description" },
-	{ "action",        CT_STRING,      MAX_ACTION_LEN,      0,                 NULL, ENTRY_ACTION },
-	{ "notes",         CT_STRING,      MAX_NOTES_LEN,       0,                 NULL, ENTRY_NOTES },
-	{ "quantity",      CT_NUMERIC,     0,                   0,                 NULL, ENTRY_QTY },
-	{ "i_acct",        CT_ACCOUNTREF,  0,                   0,                 NULL, ENTRY_IACCT },
-	{ "i_price",       CT_NUMERIC,     0,                   0,                 NULL, ENTRY_IPRICE },
-	{ "i_discount",    CT_NUMERIC,     0,                   0,                 NULL, NULL,
-			(QofAccessFunc)gncEntryGetInvDiscount, (QofSetterFunc)gncEntrySetInvDiscount },
-	{ "invoice",       CT_INVOICEREF,  0,                   0,                 NULL, NULL,
-			(QofAccessFunc)gncEntryGetInvoice, (QofSetterFunc)entry_set_invoice },
-	{ "i_disc_type",   CT_STRING,      MAX_DISCTYPE_LEN,    0,        			NULL, ENTRY_INV_DISC_TYPE },
-	{ "i_disc_how",    CT_STRING,      MAX_DISCHOW_LEN,     0,        			NULL, ENTRY_INV_DISC_HOW },
-	{ "i_taxable",     CT_BOOLEAN,     0,                   0,        			NULL, ENTRY_INV_TAXABLE },
-	{ "i_taxincluded", CT_BOOLEAN,     0,                   0,        			NULL, ENTRY_INV_TAX_INC },
-	{ "i_taxtable",    CT_TAXTABLEREF, 0,                   0,        			NULL, NULL,
-			(QofAccessFunc)gncEntryGetInvTaxTable, (QofSetterFunc)gncEntrySetInvTaxTable },
-	{ "b_acct",        CT_ACCOUNTREF,  0,                   0,        			NULL, ENTRY_BACCT },
-	{ "b_price",       CT_NUMERIC,     0,                   0,        			NULL, ENTRY_BPRICE },
-	{ "bill",          CT_INVOICEREF,  0,                   0,        			NULL, NULL,
-			(QofAccessFunc)gncEntryGetBill, (QofSetterFunc)entry_set_bill },
-	{ "b_taxable",     CT_BOOLEAN,     0,                   0,        			NULL, ENTRY_BILL_TAXABLE },
-	{ "b_taxincluded", CT_BOOLEAN,     0,                   0,        			NULL, ENTRY_BILL_TAX_INC },
-	{ "b_taxtable",    CT_TAXTABLEREF, 0,                   0,        			NULL, NULL,
-			(QofAccessFunc)gncEntryGetBillTaxTable, (QofSetterFunc)gncEntrySetBillTaxTable },
-	{ "b_paytype",     CT_INT,         0,                   0,        			NULL, NULL,
-			(QofAccessFunc)gncEntryGetBillPayment, (QofSetterFunc)gncEntrySetBillPayment },
-	{ "billable",      CT_BOOLEAN,     0,                   0,        			NULL, ENTRY_BILLABLE },
-	{ "billto",        CT_OWNERREF,    0,                   0,        			NULL, ENTRY_BILLTO },
-	{ "order_guid",    CT_ORDERREF,    0,                   0,        			NULL, NULL,
-			(QofAccessFunc)gncEntryGetOrder, (QofSetterFunc)gncEntrySetOrder },
-	{ NULL }
+    { "guid",          CT_GUID,        0,                   COL_NNUL | COL_PKEY, "guid" },
+    { "date",          CT_TIMESPEC,    0,                   COL_NNUL,          NULL, ENTRY_DATE },
+    { "date_entered",  CT_TIMESPEC,    0,                   0,                 NULL, ENTRY_DATE_ENTERED },
+    { "description",   CT_STRING,      MAX_DESCRIPTION_LEN, 0,                 "description" },
+    { "action",        CT_STRING,      MAX_ACTION_LEN,      0,                 NULL, ENTRY_ACTION },
+    { "notes",         CT_STRING,      MAX_NOTES_LEN,       0,                 NULL, ENTRY_NOTES },
+    { "quantity",      CT_NUMERIC,     0,                   0,                 NULL, ENTRY_QTY },
+    { "i_acct",        CT_ACCOUNTREF,  0,                   0,                 NULL, ENTRY_IACCT },
+    { "i_price",       CT_NUMERIC,     0,                   0,                 NULL, ENTRY_IPRICE },
+    {
+        "i_discount",    CT_NUMERIC,     0,                   0,                 NULL, NULL,
+        (QofAccessFunc)gncEntryGetInvDiscount, (QofSetterFunc)gncEntrySetInvDiscount
+    },
+    {
+        "invoice",       CT_INVOICEREF,  0,                   0,                 NULL, NULL,
+        (QofAccessFunc)gncEntryGetInvoice, (QofSetterFunc)entry_set_invoice
+    },
+    { "i_disc_type",   CT_STRING,      MAX_DISCTYPE_LEN,    0,        			NULL, ENTRY_INV_DISC_TYPE },
+    { "i_disc_how",    CT_STRING,      MAX_DISCHOW_LEN,     0,        			NULL, ENTRY_INV_DISC_HOW },
+    { "i_taxable",     CT_BOOLEAN,     0,                   0,        			NULL, ENTRY_INV_TAXABLE },
+    { "i_taxincluded", CT_BOOLEAN,     0,                   0,        			NULL, ENTRY_INV_TAX_INC },
+    {
+        "i_taxtable",    CT_TAXTABLEREF, 0,                   0,        			NULL, NULL,
+        (QofAccessFunc)gncEntryGetInvTaxTable, (QofSetterFunc)gncEntrySetInvTaxTable
+    },
+    { "b_acct",        CT_ACCOUNTREF,  0,                   0,        			NULL, ENTRY_BACCT },
+    { "b_price",       CT_NUMERIC,     0,                   0,        			NULL, ENTRY_BPRICE },
+    {
+        "bill",          CT_INVOICEREF,  0,                   0,        			NULL, NULL,
+        (QofAccessFunc)gncEntryGetBill, (QofSetterFunc)entry_set_bill
+    },
+    { "b_taxable",     CT_BOOLEAN,     0,                   0,        			NULL, ENTRY_BILL_TAXABLE },
+    { "b_taxincluded", CT_BOOLEAN,     0,                   0,        			NULL, ENTRY_BILL_TAX_INC },
+    {
+        "b_taxtable",    CT_TAXTABLEREF, 0,                   0,        			NULL, NULL,
+        (QofAccessFunc)gncEntryGetBillTaxTable, (QofSetterFunc)gncEntrySetBillTaxTable
+    },
+    {
+        "b_paytype",     CT_INT,         0,                   0,        			NULL, NULL,
+        (QofAccessFunc)gncEntryGetBillPayment, (QofSetterFunc)gncEntrySetBillPayment
+    },
+    { "billable",      CT_BOOLEAN,     0,                   0,        			NULL, ENTRY_BILLABLE },
+    { "billto",        CT_OWNERREF,    0,                   0,        			NULL, ENTRY_BILLTO },
+    {
+        "order_guid",    CT_ORDERREF,    0,                   0,        			NULL, NULL,
+        (QofAccessFunc)gncEntryGetOrder, (QofSetterFunc)gncEntrySetOrder
+    },
+    { NULL }
 };
 
 static void
 entry_set_invoice( gpointer pObject, gpointer val )
 {
-	GncEntry* entry;
-	GncInvoice* invoice;
+    GncEntry* entry;
+    GncInvoice* invoice;
 
-	g_return_if_fail( pObject != NULL );
-	g_return_if_fail( GNC_IS_ENTRY(pObject) );
-	g_return_if_fail( val != NULL );
-	g_return_if_fail( GNC_IS_INVOICE(val) );
+    g_return_if_fail( pObject != NULL );
+    g_return_if_fail( GNC_IS_ENTRY(pObject) );
+    g_return_if_fail( val != NULL );
+    g_return_if_fail( GNC_IS_INVOICE(val) );
 
-	entry = GNC_ENTRY(pObject);
-	invoice = GNC_INVOICE(val);
+    entry = GNC_ENTRY(pObject);
+    invoice = GNC_INVOICE(val);
 
-	gncInvoiceAddEntry( invoice, entry );
+    gncInvoiceAddEntry( invoice, entry );
 }
 
 static void
 entry_set_bill( gpointer pObject, gpointer val )
 {
-	GncEntry* entry;
-	GncInvoice* bill;
+    GncEntry* entry;
+    GncInvoice* bill;
 
-	g_return_if_fail( pObject != NULL );
-	g_return_if_fail( GNC_IS_ENTRY(pObject) );
-	g_return_if_fail( val != NULL );
-	g_return_if_fail( GNC_IS_INVOICE(val) );
+    g_return_if_fail( pObject != NULL );
+    g_return_if_fail( GNC_IS_ENTRY(pObject) );
+    g_return_if_fail( val != NULL );
+    g_return_if_fail( GNC_IS_INVOICE(val) );
 
-	entry = GNC_ENTRY(pObject);
-	bill = GNC_INVOICE(val);
+    entry = GNC_ENTRY(pObject);
+    bill = GNC_INVOICE(val);
 
-	gncBillAddEntry( bill, entry );
+    gncBillAddEntry( bill, entry );
 }
 
 static GncEntry*
 load_single_entry( GncSqlBackend* be, GncSqlRow* row )
 {
     const GUID* guid;
-	GncEntry* pEntry;
+    GncEntry* pEntry;
 
-	g_return_val_if_fail( be != NULL, NULL );
-	g_return_val_if_fail( row != NULL, NULL );
+    g_return_val_if_fail( be != NULL, NULL );
+    g_return_val_if_fail( row != NULL, NULL );
 
     guid = gnc_sql_load_guid( be, row );
     pEntry = gncEntryLookup( be->primary_book, guid );
-    if( pEntry == NULL ) {
+    if ( pEntry == NULL )
+    {
         pEntry = gncEntryCreate( be->primary_book );
     }
     gnc_sql_load_object( be, row, GNC_ID_ENTRY, pEntry, col_table );
     qof_instance_mark_clean( QOF_INSTANCE(pEntry) );
 
-	return pEntry;
+    return pEntry;
 }
 
 static void
@@ -162,30 +177,34 @@
     GncSqlResult* result;
     QofBook* pBook;
 
-	g_return_if_fail( be != NULL );
+    g_return_if_fail( be != NULL );
 
     pBook = be->primary_book;
 
     stmt = gnc_sql_create_select_statement( be, TABLE_NAME );
     result = gnc_sql_execute_select_statement( be, stmt );
-	gnc_sql_statement_dispose( stmt );
-    if( result != NULL ) {
+    gnc_sql_statement_dispose( stmt );
+    if ( result != NULL )
+    {
         GncSqlRow* row;
-		GList* list = NULL;
+        GList* list = NULL;
 
-		row = gnc_sql_result_get_first_row( result );
-        while( row != NULL ) {
+        row = gnc_sql_result_get_first_row( result );
+        while ( row != NULL )
+        {
             GncEntry* pEntry = load_single_entry( be, row );
-			if( pEntry != NULL ) {
-				list = g_list_append( list, pEntry );
-			}
-			row = gnc_sql_result_get_next_row( result );
-		}
-		gnc_sql_result_dispose( result );
+            if ( pEntry != NULL )
+            {
+                list = g_list_append( list, pEntry );
+            }
+            row = gnc_sql_result_get_next_row( result );
+        }
+        gnc_sql_result_dispose( result );
 
-		if( list != NULL ) {
-			gnc_sql_slots_load_for_list( be, list );
-		}
+        if ( list != NULL )
+        {
+            gnc_sql_slots_load_for_list( be, list );
+        }
     }
 }
 
@@ -193,30 +212,33 @@
 static void
 create_entry_tables( GncSqlBackend* be )
 {
-	gint version;
+    gint version;
 
-	g_return_if_fail( be != NULL );
+    g_return_if_fail( be != NULL );
 
-	version = gnc_sql_get_table_version( be, TABLE_NAME );
-    if( version == 0 ) {
+    version = gnc_sql_get_table_version( be, TABLE_NAME );
+    if ( version == 0 )
+    {
         gnc_sql_create_table( be, TABLE_NAME, TABLE_VERSION, col_table );
-    } else if( version < TABLE_VERSION ) {
-		/* Upgrade:
-		    1->2: 64 bit int handling
-			2->3: "entered" -> "date_entered", and it can be NULL
-		*/
-		gnc_sql_upgrade_table( be, TABLE_NAME, col_table );
-		gnc_sql_set_table_version( be, TABLE_NAME, TABLE_VERSION );
     }
+    else if ( version < TABLE_VERSION )
+    {
+        /* Upgrade:
+            1->2: 64 bit int handling
+        	2->3: "entered" -> "date_entered", and it can be NULL
+        */
+        gnc_sql_upgrade_table( be, TABLE_NAME, col_table );
+        gnc_sql_set_table_version( be, TABLE_NAME, TABLE_VERSION );
+    }
 }
 
 /* ================================================================= */
 static gboolean
 save_entry( GncSqlBackend* be, QofInstance* inst )
 {
-	g_return_val_if_fail( inst != NULL, FALSE );
-	g_return_val_if_fail( GNC_IS_ENTRY(inst), FALSE );
-	g_return_val_if_fail( be != NULL, FALSE );
+    g_return_val_if_fail( inst != NULL, FALSE );
+    g_return_val_if_fail( GNC_IS_ENTRY(inst), FALSE );
+    g_return_val_if_fail( be != NULL, FALSE );
 
     return gnc_sql_commit_standard_item( be, inst, TABLE_NAME, GNC_ID_ENTRY, col_table );
 }
@@ -225,32 +247,33 @@
 static void
 write_single_entry( QofInstance *term_p, gpointer data_p )
 {
-	write_objects_t* s = (write_objects_t*)data_p;
-	GncEntry* entry = GNC_ENTRY(term_p);
+    write_objects_t* s = (write_objects_t*)data_p;
+    GncEntry* entry = GNC_ENTRY(term_p);
 
-	g_return_if_fail( term_p != NULL );
-	g_return_if_fail( GNC_IS_ENTRY(term_p) );
-	g_return_if_fail( data_p != NULL );
+    g_return_if_fail( term_p != NULL );
+    g_return_if_fail( GNC_IS_ENTRY(term_p) );
+    g_return_if_fail( data_p != NULL );
 
-  	/* Only save if attached */
-  	if( s->is_ok && (gncEntryGetOrder( entry ) != NULL || gncEntryGetInvoice( entry ) != NULL ||
-			gncEntryGetBill( entry ) != NULL) ) {
-    	s->is_ok = save_entry( s->be, term_p );
-	}
+    /* Only save if attached */
+    if ( s->is_ok && (gncEntryGetOrder( entry ) != NULL || gncEntryGetInvoice( entry ) != NULL ||
+                      gncEntryGetBill( entry ) != NULL) )
+    {
+        s->is_ok = save_entry( s->be, term_p );
+    }
 }
 
 static gboolean
 write_entries( GncSqlBackend* be )
 {
-	write_objects_t data;
+    write_objects_t data;
 
-	g_return_val_if_fail( be != NULL, FALSE );
+    g_return_val_if_fail( be != NULL, FALSE );
 
-	data.be = be;
-	data.is_ok = TRUE;
+    data.be = be;
+    data.is_ok = TRUE;
     qof_object_foreach( GNC_ID_ENTRY, be->primary_book, write_single_entry, &data );
 
-	return data.is_ok;
+    return data.is_ok;
 }
 
 /* ================================================================= */
@@ -264,8 +287,8 @@
         save_entry,							/* commit */
         load_all_entries,					/* initial_load */
         create_entry_tables,				/* create_tables */
-		NULL, NULL, NULL,
-		write_entries						/* write */
+        NULL, NULL, NULL,
+        write_entries						/* write */
     };
 
     qof_object_register_backend( GNC_ID_ENTRY, GNC_SQL_BACKEND, &be_data );

Modified: gnucash/trunk/src/business/business-core/sql/gnc-invoice-sql.c
===================================================================
--- gnucash/trunk/src/business/business-core/sql/gnc-invoice-sql.c	2010-03-02 21:40:28 UTC (rev 18788)
+++ gnucash/trunk/src/business/business-core/sql/gnc-invoice-sql.c	2010-03-02 21:41:05 UTC (rev 18789)
@@ -59,47 +59,58 @@
 
 static GncSqlColumnTableEntry col_table[] =
 {
-	{ "guid",         CT_GUID,         0,                  COL_NNUL|COL_PKEY, "guid" },
-	{ "id",           CT_STRING,       MAX_ID_LEN,         COL_NNUL,          NULL, INVOICE_ID },
-	{ "date_opened",  CT_TIMESPEC,     0,                  0,                 NULL, INVOICE_OPENED },
-	{ "date_posted",  CT_TIMESPEC,     0,                  0,                 NULL, INVOICE_POSTED },
-	{ "notes",        CT_STRING,       MAX_NOTES_LEN,      COL_NNUL,          "notes" },
-	{ "active",       CT_BOOLEAN,      0,                  COL_NNUL,          NULL, QOF_PARAM_ACTIVE },
-	{ "currency",     CT_COMMODITYREF, 0,                  COL_NNUL,          NULL, NULL,
-			(QofAccessFunc)gncInvoiceGetCurrency, (QofSetterFunc)gncInvoiceSetCurrency },
-	{ "owner",        CT_OWNERREF,     0,                  0,                 NULL, NULL,
-			(QofAccessFunc)gncInvoiceGetOwner, (QofSetterFunc)gncInvoiceSetOwner },
-	{ "terms",        CT_BILLTERMREF,  0,                  0,                 NULL, INVOICE_TERMS },
-	{ "billing_id",   CT_STRING,       MAX_BILLING_ID_LEN, 0,                 NULL, INVOICE_BILLINGID },
-	{ "post_txn",     CT_TXREF,        0,                  0,                 NULL, INVOICE_POST_TXN },
-	{ "post_lot",     CT_LOTREF,       0,                  0,                 NULL, NULL,
-			(QofAccessFunc)gncInvoiceGetPostedLot, (QofSetterFunc)gncInvoiceSetPostedLot },
-	{ "post_acc",     CT_ACCOUNTREF,   0,                  0,                 NULL, INVOICE_ACC },
-	{ "billto",       CT_OWNERREF,     0,                  0,                 NULL, NULL,
-			(QofAccessFunc)gncInvoiceGetBillTo, (QofSetterFunc)gncInvoiceSetBillTo },
-	{ "charge_amt",   CT_NUMERIC,      0,                  0,                 NULL, NULL,
-			(QofAccessFunc)gncInvoiceGetToChargeAmount, (QofSetterFunc)gncInvoiceSetToChargeAmount },
-	{ NULL }
+    { "guid",         CT_GUID,         0,                  COL_NNUL | COL_PKEY, "guid" },
+    { "id",           CT_STRING,       MAX_ID_LEN,         COL_NNUL,          NULL, INVOICE_ID },
+    { "date_opened",  CT_TIMESPEC,     0,                  0,                 NULL, INVOICE_OPENED },
+    { "date_posted",  CT_TIMESPEC,     0,                  0,                 NULL, INVOICE_POSTED },
+    { "notes",        CT_STRING,       MAX_NOTES_LEN,      COL_NNUL,          "notes" },
+    { "active",       CT_BOOLEAN,      0,                  COL_NNUL,          NULL, QOF_PARAM_ACTIVE },
+    {
+        "currency",     CT_COMMODITYREF, 0,                  COL_NNUL,          NULL, NULL,
+        (QofAccessFunc)gncInvoiceGetCurrency, (QofSetterFunc)gncInvoiceSetCurrency
+    },
+    {
+        "owner",        CT_OWNERREF,     0,                  0,                 NULL, NULL,
+        (QofAccessFunc)gncInvoiceGetOwner, (QofSetterFunc)gncInvoiceSetOwner
+    },
+    { "terms",        CT_BILLTERMREF,  0,                  0,                 NULL, INVOICE_TERMS },
+    { "billing_id",   CT_STRING,       MAX_BILLING_ID_LEN, 0,                 NULL, INVOICE_BILLINGID },
+    { "post_txn",     CT_TXREF,        0,                  0,                 NULL, INVOICE_POST_TXN },
+    {
+        "post_lot",     CT_LOTREF,       0,                  0,                 NULL, NULL,
+        (QofAccessFunc)gncInvoiceGetPostedLot, (QofSetterFunc)gncInvoiceSetPostedLot
+    },
+    { "post_acc",     CT_ACCOUNTREF,   0,                  0,                 NULL, INVOICE_ACC },
+    {
+        "billto",       CT_OWNERREF,     0,                  0,                 NULL, NULL,
+        (QofAccessFunc)gncInvoiceGetBillTo, (QofSetterFunc)gncInvoiceSetBillTo
+    },
+    {
+        "charge_amt",   CT_NUMERIC,      0,                  0,                 NULL, NULL,
+        (QofAccessFunc)gncInvoiceGetToChargeAmount, (QofSetterFunc)gncInvoiceSetToChargeAmount
+    },
+    { NULL }
 };
 
 static GncInvoice*
 load_single_invoice( GncSqlBackend* be, GncSqlRow* row )
 {
     const GUID* guid;
-	GncInvoice* pInvoice;
+    GncInvoice* pInvoice;
 
-	g_return_val_if_fail( be != NULL, NULL );
-	g_return_val_if_fail( row != NULL, NULL );
+    g_return_val_if_fail( be != NULL, NULL );
+    g_return_val_if_fail( row != NULL, NULL );
 
     guid = gnc_sql_load_guid( be, row );
     pInvoice = gncInvoiceLookup( be->primary_book, guid );
-    if( pInvoice == NULL ) {
+    if ( pInvoice == NULL )
+    {
         pInvoice = gncInvoiceCreate( be->primary_book );
     }
     gnc_sql_load_object( be, row, GNC_ID_INVOICE, pInvoice, col_table );
     qof_instance_mark_clean( QOF_INSTANCE(pInvoice) );
 
-	return pInvoice;
+    return pInvoice;
 }
 
 static void
@@ -109,30 +120,34 @@
     GncSqlResult* result;
     QofBook* pBook;
 
-	g_return_if_fail( be != NULL );
+    g_return_if_fail( be != NULL );
 
     pBook = be->primary_book;
 
     stmt = gnc_sql_create_select_statement( be, TABLE_NAME );
     result = gnc_sql_execute_select_statement( be, stmt );
-	gnc_sql_statement_dispose( stmt );
-    if( result != NULL ) {
+    gnc_sql_statement_dispose( stmt );
+    if ( result != NULL )
+    {
         GncSqlRow* row;
-		GList* list = NULL;
+        GList* list = NULL;
 
-		row = gnc_sql_result_get_first_row( result );
-        while( row != NULL ) {
-			GncInvoice* pInvoice = load_single_invoice( be, row );
-			if( pInvoice != NULL ) {
-				list = g_list_append( list, pInvoice );
-			}
-			row = gnc_sql_result_get_next_row( result );
-		}
-		gnc_sql_result_dispose( result );
+        row = gnc_sql_result_get_first_row( result );
+        while ( row != NULL )
+        {
+            GncInvoice* pInvoice = load_single_invoice( be, row );
+            if ( pInvoice != NULL )
+            {
+                list = g_list_append( list, pInvoice );
+            }
+            row = gnc_sql_result_get_next_row( result );
+        }
+        gnc_sql_result_dispose( result );
 
-		if( list != NULL ) {
-			gnc_sql_slots_load_for_list( be, list );
-		}
+        if ( list != NULL )
+        {
+            gnc_sql_slots_load_for_list( be, list );
+        }
     }
 }
 
@@ -140,21 +155,24 @@
 static void
 create_invoice_tables( GncSqlBackend* be )
 {
-	gint version;
+    gint version;
 
-	g_return_if_fail( be != NULL );
+    g_return_if_fail( be != NULL );
 
-	version = gnc_sql_get_table_version( be, TABLE_NAME );
-    if( version == 0 ) {
+    version = gnc_sql_get_table_version( be, TABLE_NAME );
+    if ( version == 0 )
+    {
         gnc_sql_create_table( be, TABLE_NAME, TABLE_VERSION, col_table );
-    } else if( version < TABLE_VERSION ) {
-		/* Upgrade:
-		     1->2: 64 bit int handling
-			 2->3: invoice open date can be NULL
-		*/
-		gnc_sql_upgrade_table( be, TABLE_NAME, col_table );
-		gnc_sql_set_table_version( be, TABLE_NAME, TABLE_VERSION );
     }
+    else if ( version < TABLE_VERSION )
+    {
+        /* Upgrade:
+             1->2: 64 bit int handling
+        	 2->3: invoice open date can be NULL
+        */
+        gnc_sql_upgrade_table( be, TABLE_NAME, col_table );
+        gnc_sql_set_table_version( be, TABLE_NAME, TABLE_VERSION );
+    }
 }
 
 /* ================================================================= */
@@ -162,45 +180,56 @@
 save_invoice( GncSqlBackend* be, QofInstance* inst )
 {
     const GUID* guid;
-	GncInvoice* invoice;
-	gint op;
-	gboolean is_infant;
-	gboolean is_ok = TRUE;
+    GncInvoice* invoice;
+    gint op;
+    gboolean is_infant;
+    gboolean is_ok = TRUE;
 
-	g_return_val_if_fail( inst != NULL, FALSE );
-	g_return_val_if_fail( GNC_IS_INVOICE(inst), FALSE );
-	g_return_val_if_fail( be != NULL, FALSE );
+    g_return_val_if_fail( inst != NULL, FALSE );
+    g_return_val_if_fail( GNC_IS_INVOICE(inst), FALSE );
+    g_return_val_if_fail( be != NULL, FALSE );
 
-	invoice = GNC_INVOICE(inst);
+    invoice = GNC_INVOICE(inst);
 
-	is_infant = qof_instance_get_infant( inst );
-	if( qof_instance_get_destroying( inst ) ) {
-		op = OP_DB_DELETE;
-	} else if( be->is_pristine_db || is_infant ) {
-		op = OP_DB_INSERT;
-	} else {
-		op = OP_DB_UPDATE;
-	}
-	if( op != OP_DB_DELETE ) {
-    	// Ensure the commodity is in the db
-    	is_ok = gnc_sql_save_commodity( be, gncInvoiceGetCurrency( invoice ) );
-	}
+    is_infant = qof_instance_get_infant( inst );
+    if ( qof_instance_get_destroying( inst ) )
+    {
+        op = OP_DB_DELETE;
+    }
+    else if ( be->is_pristine_db || is_infant )
+    {
+        op = OP_DB_INSERT;
+    }
+    else
+    {
+        op = OP_DB_UPDATE;
+    }
+    if ( op != OP_DB_DELETE )
+    {
+        // Ensure the commodity is in the db
+        is_ok = gnc_sql_save_commodity( be, gncInvoiceGetCurrency( invoice ) );
+    }
 
-	if( is_ok ) {
-    	is_ok = gnc_sql_do_db_operation( be, op, TABLE_NAME, GNC_ID_INVOICE, inst, col_table );
-	}
+    if ( is_ok )
+    {
+        is_ok = gnc_sql_do_db_operation( be, op, TABLE_NAME, GNC_ID_INVOICE, inst, col_table );
+    }
 
-	if( is_ok ) {
-    	// Now, commit or delete any slots
-    	guid = qof_instance_get_guid( inst );
-    	if( !qof_instance_get_destroying(inst) ) {
-        	is_ok = gnc_sql_slots_save( be, guid, is_infant, qof_instance_get_slots( inst ) );
-    	} else {
-        	is_ok = gnc_sql_slots_delete( be, guid );
-    	}
-	}
+    if ( is_ok )
+    {
+        // Now, commit or delete any slots
+        guid = qof_instance_get_guid( inst );
+        if ( !qof_instance_get_destroying(inst) )
+        {
+            is_ok = gnc_sql_slots_save( be, guid, is_infant, qof_instance_get_slots( inst ) );
+        }
+        else
+        {
+            is_ok = gnc_sql_slots_delete( be, guid );
+        }
+    }
 
-	return is_ok;
+    return is_ok;
 }
 
 /* ================================================================= */
@@ -209,13 +238,14 @@
 {
     const char *id;
 
-	g_return_val_if_fail( invoice != NULL, FALSE );
+    g_return_val_if_fail( invoice != NULL, FALSE );
 
     /* make sure this is a valid invoice before we save it -- should have an ID */
     id = gncInvoiceGetID( invoice );
-    if( id == NULL || *id == '\0' ) {
+    if ( id == NULL || *id == '\0' )
+    {
         return FALSE;
-	}
+    }
 
     return TRUE;
 }
@@ -223,67 +253,76 @@
 static void
 write_single_invoice( QofInstance *term_p, gpointer data_p )
 {
-	write_objects_t* s = (write_objects_t*)data_p;
+    write_objects_t* s = (write_objects_t*)data_p;
 
-	g_return_if_fail( term_p != NULL );
-	g_return_if_fail( GNC_IS_INVOICE(term_p) );
-	g_return_if_fail( data_p != NULL );
+    g_return_if_fail( term_p != NULL );
+    g_return_if_fail( GNC_IS_INVOICE(term_p) );
+    g_return_if_fail( data_p != NULL );
 
-	if( s->is_ok && invoice_should_be_saved( GNC_INVOICE(term_p) ) ) {
-    	s->is_ok = save_invoice( s->be, term_p );
-	}
+    if ( s->is_ok && invoice_should_be_saved( GNC_INVOICE(term_p) ) )
+    {
+        s->is_ok = save_invoice( s->be, term_p );
+    }
 }
 
 static gboolean
 write_invoices( GncSqlBackend* be )
 {
-	write_objects_t data;
+    write_objects_t data;
 
-	g_return_val_if_fail( be != NULL, FALSE );
+    g_return_val_if_fail( be != NULL, FALSE );
 
-	data.be = be;
-	data.is_ok = TRUE;
+    data.be = be;
+    data.is_ok = TRUE;
     qof_object_foreach( GNC_ID_INVOICE, be->primary_book, write_single_invoice, &data );
 
-	return data.is_ok;
+    return data.is_ok;
 }
 
 /* ================================================================= */
 static void
 load_invoice_guid( const GncSqlBackend* be, GncSqlRow* row,
-            QofSetterFunc setter, gpointer pObject,
-            const GncSqlColumnTableEntry* table_row )
+                   QofSetterFunc setter, gpointer pObject,
+                   const GncSqlColumnTableEntry* table_row )
 {
     const GValue* val;
     GUID guid;
-	GncInvoice* invoice = NULL;
+    GncInvoice* invoice = NULL;
 
-	g_return_if_fail( be != NULL );
-	g_return_if_fail( row != NULL );
-	g_return_if_fail( pObject != NULL );
-	g_return_if_fail( table_row != NULL );
+    g_return_if_fail( be != NULL );
+    g_return_if_fail( row != NULL );
+    g_return_if_fail( pObject != NULL );
+    g_return_if_fail( table_row != NULL );
 
     val = gnc_sql_row_get_value_at_col_name( row, table_row->col_name );
-    if( val != NULL && G_VALUE_HOLDS_STRING( val ) && g_value_get_string( val ) != NULL ) {
+    if ( val != NULL && G_VALUE_HOLDS_STRING( val ) && g_value_get_string( val ) != NULL )
+    {
         string_to_guid( g_value_get_string( val ), &guid );
-		invoice = gncInvoiceLookup( be->primary_book, &guid );
-		if( invoice != NULL ) {
-        	if( table_row->gobj_param_name != NULL ) {
-		    	g_object_set( pObject, table_row->gobj_param_name, invoice, NULL );
-        	} else {
-		    	(*setter)( pObject, (const gpointer)invoice );
-        	}
-		} else {
-	    	PWARN( "Invoice ref '%s' not found", g_value_get_string( val ) );
-		}
-	}
+        invoice = gncInvoiceLookup( be->primary_book, &guid );
+        if ( invoice != NULL )
+        {
+            if ( table_row->gobj_param_name != NULL )
+            {
+                g_object_set( pObject, table_row->gobj_param_name, invoice, NULL );
+            }
+            else
+            {
+                (*setter)( pObject, (const gpointer)invoice );
+            }
+        }
+        else
+        {
+            PWARN( "Invoice ref '%s' not found", g_value_get_string( val ) );
+        }
+    }
 }
 
 static GncSqlColumnTypeHandler invoice_guid_handler
-	= { load_invoice_guid,
-		gnc_sql_add_objectref_guid_col_info_to_list,
-		gnc_sql_add_colname_to_list,
-		gnc_sql_add_gvalue_objectref_guid_to_slist };
+= { load_invoice_guid,
+    gnc_sql_add_objectref_guid_col_info_to_list,
+    gnc_sql_add_colname_to_list,
+    gnc_sql_add_gvalue_objectref_guid_to_slist
+  };
 /* ================================================================= */
 void
 gnc_invoice_sql_initialize( void )
@@ -295,12 +334,12 @@
         save_invoice,						/* commit */
         load_all_invoices,					/* initial_load */
         create_invoice_tables,				/* create_tables */
-		NULL, NULL, NULL,
-		write_invoices						/* write */
+        NULL, NULL, NULL,
+        write_invoices						/* write */
     };
 
     qof_object_register_backend( GNC_ID_INVOICE, GNC_SQL_BACKEND, &be_data );
 
-	gnc_sql_register_col_type_handler( CT_INVOICEREF, &invoice_guid_handler );
+    gnc_sql_register_col_type_handler( CT_INVOICEREF, &invoice_guid_handler );
 }
 /* ========================== END OF FILE ===================== */

Modified: gnucash/trunk/src/business/business-core/sql/gnc-job-sql.c
===================================================================
--- gnucash/trunk/src/business/business-core/sql/gnc-job-sql.c	2010-03-02 21:40:28 UTC (rev 18788)
+++ gnucash/trunk/src/business/business-core/sql/gnc-job-sql.c	2010-03-02 21:41:05 UTC (rev 18789)
@@ -54,35 +54,40 @@
 
 static GncSqlColumnTableEntry col_table[] =
 {
-	{ "guid",      CT_GUID,     0,                 COL_NNUL|COL_PKEY, "guid" },
-	{ "id",        CT_STRING,   MAX_ID_LEN,        COL_NNUL,          NULL, JOB_ID },
-	{ "name",      CT_STRING,   MAX_NAME_LEN,      COL_NNUL,          "name" },
-	{ "reference", CT_STRING,   MAX_REFERENCE_LEN, COL_NNUL,          NULL, JOB_REFERENCE },
-	{ "active",    CT_BOOLEAN,  0,                 COL_NNUL,          NULL, NULL,
-		(QofAccessFunc)gncJobGetActive, (QofSetterFunc)gncJobSetActive },
-	{ "owner",     CT_OWNERREF, 0,                 0,                 NULL, NULL,
-		(QofAccessFunc)gncJobGetOwner, (QofSetterFunc)gncJobSetOwner },
-	{ NULL }
+    { "guid",      CT_GUID,     0,                 COL_NNUL | COL_PKEY, "guid" },
+    { "id",        CT_STRING,   MAX_ID_LEN,        COL_NNUL,          NULL, JOB_ID },
+    { "name",      CT_STRING,   MAX_NAME_LEN,      COL_NNUL,          "name" },
+    { "reference", CT_STRING,   MAX_REFERENCE_LEN, COL_NNUL,          NULL, JOB_REFERENCE },
+    {
+        "active",    CT_BOOLEAN,  0,                 COL_NNUL,          NULL, NULL,
+        (QofAccessFunc)gncJobGetActive, (QofSetterFunc)gncJobSetActive
+    },
+    {
+        "owner",     CT_OWNERREF, 0,                 0,                 NULL, NULL,
+        (QofAccessFunc)gncJobGetOwner, (QofSetterFunc)gncJobSetOwner
+    },
+    { NULL }
 };
 
 static GncJob*
 load_single_job( GncSqlBackend* be, GncSqlRow* row )
 {
     const GUID* guid;
-	GncJob* pJob;
+    GncJob* pJob;
 
-	g_return_val_if_fail( be != NULL, NULL );
-	g_return_val_if_fail( row != NULL, NULL );
+    g_return_val_if_fail( be != NULL, NULL );
+    g_return_val_if_fail( row != NULL, NULL );
 
     guid = gnc_sql_load_guid( be, row );
     pJob = gncJobLookup( be->primary_book, guid );
-    if( pJob == NULL ) {
+    if ( pJob == NULL )
+    {
         pJob = gncJobCreate( be->primary_book );
     }
     gnc_sql_load_object( be, row, GNC_ID_JOB, pJob, col_table );
     qof_instance_mark_clean( QOF_INSTANCE(pJob) );
 
-	return pJob;
+    return pJob;
 }
 
 static void
@@ -92,30 +97,34 @@
     GncSqlResult* result;
     QofBook* pBook;
 
-	g_return_if_fail( be != NULL );
+    g_return_if_fail( be != NULL );
 
     pBook = be->primary_book;
 
     stmt = gnc_sql_create_select_statement( be, TABLE_NAME );
     result = gnc_sql_execute_select_statement( be, stmt );
-	gnc_sql_statement_dispose( stmt );
-    if( result != NULL ) {
+    gnc_sql_statement_dispose( stmt );
+    if ( result != NULL )
+    {
         GncSqlRow* row;
-		GList* list = NULL;
+        GList* list = NULL;
 
-		row = gnc_sql_result_get_first_row( result );
-        while( row != NULL ) {
+        row = gnc_sql_result_get_first_row( result );
+        while ( row != NULL )
+        {
             GncJob* pJob = load_single_job( be, row );
-			if( pJob != NULL ) {
-				list = g_list_append( list, pJob );
-			}
-			row = gnc_sql_result_get_next_row( result );
-		}
-		gnc_sql_result_dispose( result );
+            if ( pJob != NULL )
+            {
+                list = g_list_append( list, pJob );
+            }
+            row = gnc_sql_result_get_next_row( result );
+        }
+        gnc_sql_result_dispose( result );
 
-		if( list != NULL ) {
-			gnc_sql_slots_load_for_list( be, list );
-		}
+        if ( list != NULL )
+        {
+            gnc_sql_slots_load_for_list( be, list );
+        }
     }
 }
 
@@ -123,12 +132,13 @@
 static void
 create_job_tables( GncSqlBackend* be )
 {
-	gint version;
+    gint version;
 
-	g_return_if_fail( be != NULL );
+    g_return_if_fail( be != NULL );
 
-	version = gnc_sql_get_table_version( be, TABLE_NAME );
-    if( version == 0 ) {
+    version = gnc_sql_get_table_version( be, TABLE_NAME );
+    if ( version == 0 )
+    {
         gnc_sql_create_table( be, TABLE_NAME, TABLE_VERSION, col_table );
     }
 }
@@ -137,9 +147,9 @@
 static gboolean
 save_job( GncSqlBackend* be, QofInstance* inst )
 {
-	g_return_val_if_fail( inst != NULL, FALSE );
-	g_return_val_if_fail( GNC_IS_JOB(inst), FALSE );
-	g_return_val_if_fail( be != NULL, FALSE );
+    g_return_val_if_fail( inst != NULL, FALSE );
+    g_return_val_if_fail( GNC_IS_JOB(inst), FALSE );
+    g_return_val_if_fail( be != NULL, FALSE );
 
     return gnc_sql_commit_standard_item( be, inst, TABLE_NAME, GNC_ID_JOB, col_table );
 }
@@ -150,13 +160,14 @@
 {
     const char *id;
 
-	g_return_val_if_fail( job != NULL, FALSE );
+    g_return_val_if_fail( job != NULL, FALSE );
 
     /* make sure this is a valid job before we save it -- should have an ID */
     id = gncJobGetID( job );
-    if( id == NULL || *id == '\0' ) {
+    if ( id == NULL || *id == '\0' )
+    {
         return FALSE;
-	}
+    }
 
     return TRUE;
 }
@@ -164,29 +175,30 @@
 static void
 write_single_job( QofInstance *term_p, gpointer data_p )
 {
-	write_objects_t* s = (write_objects_t*)data_p;
+    write_objects_t* s = (write_objects_t*)data_p;
 
-	g_return_if_fail( term_p != NULL );
-	g_return_if_fail( GNC_IS_JOB(term_p) );
-	g_return_if_fail( data_p != NULL );
+    g_return_if_fail( term_p != NULL );
+    g_return_if_fail( GNC_IS_JOB(term_p) );
+    g_return_if_fail( data_p != NULL );
 
-	if( s->is_ok && job_should_be_saved( GNC_JOB(term_p) ) ) {
-    	s->is_ok = save_job( s->be, term_p );
-	}
+    if ( s->is_ok && job_should_be_saved( GNC_JOB(term_p) ) )
+    {
+        s->is_ok = save_job( s->be, term_p );
+    }
 }
 
 static gboolean
 write_jobs( GncSqlBackend* be )
 {
-	write_objects_t data;
+    write_objects_t data;
 
-	g_return_val_if_fail( be != NULL, FALSE );
+    g_return_val_if_fail( be != NULL, FALSE );
 
-	data.be = be;
-	data.is_ok = TRUE;
+    data.be = be;
+    data.is_ok = TRUE;
     qof_object_foreach( GNC_ID_JOB, be->primary_book, write_single_job, &data );
 
-	return data.is_ok;
+    return data.is_ok;
 }
 
 /* ================================================================= */
@@ -200,8 +212,8 @@
         save_job,						/* commit */
         load_all_jobs,					/* initial_load */
         create_job_tables,				/* create_tables */
-		NULL, NULL, NULL,
-		write_jobs						/* write */
+        NULL, NULL, NULL,
+        write_jobs						/* write */
     };
 
     qof_object_register_backend( GNC_ID_JOB, GNC_SQL_BACKEND, &be_data );

Modified: gnucash/trunk/src/business/business-core/sql/gnc-order-sql.c
===================================================================
--- gnucash/trunk/src/business/business-core/sql/gnc-order-sql.c	2010-03-02 21:40:28 UTC (rev 18788)
+++ gnucash/trunk/src/business/business-core/sql/gnc-order-sql.c	2010-03-02 21:41:05 UTC (rev 18789)
@@ -55,35 +55,36 @@
 
 static GncSqlColumnTableEntry col_table[] =
 {
-	{ "guid",        CT_GUID,     0,                 COL_NNUL|COL_PKEY, "guid" },
-	{ "id",          CT_STRING,   MAX_ID_LEN,        COL_NNUL,          NULL, ORDER_ID },
-	{ "notes",       CT_STRING,   MAX_NOTES_LEN,     COL_NNUL,          "notes" },
-	{ "reference",   CT_STRING,   MAX_REFERENCE_LEN, COL_NNUL,          NULL, ORDER_REFERENCE },
-	{ "active",      CT_BOOLEAN,  0,                 COL_NNUL,          NULL, QOF_PARAM_ACTIVE },
-	{ "date_opened", CT_TIMESPEC, 0,                 COL_NNUL,          NULL, ORDER_OPENED },
-	{ "date_closed", CT_TIMESPEC, 0,                 COL_NNUL,          NULL, ORDER_CLOSED },
-	{ "owner",       CT_OWNERREF, 0,                 COL_NNUL,          NULL, ORDER_OWNER },
-	{ NULL },
+    { "guid",        CT_GUID,     0,                 COL_NNUL | COL_PKEY, "guid" },
+    { "id",          CT_STRING,   MAX_ID_LEN,        COL_NNUL,          NULL, ORDER_ID },
+    { "notes",       CT_STRING,   MAX_NOTES_LEN,     COL_NNUL,          "notes" },
+    { "reference",   CT_STRING,   MAX_REFERENCE_LEN, COL_NNUL,          NULL, ORDER_REFERENCE },
+    { "active",      CT_BOOLEAN,  0,                 COL_NNUL,          NULL, QOF_PARAM_ACTIVE },
+    { "date_opened", CT_TIMESPEC, 0,                 COL_NNUL,          NULL, ORDER_OPENED },
+    { "date_closed", CT_TIMESPEC, 0,                 COL_NNUL,          NULL, ORDER_CLOSED },
+    { "owner",       CT_OWNERREF, 0,                 COL_NNUL,          NULL, ORDER_OWNER },
+    { NULL },
 };
 
 static GncOrder*
 load_single_order( GncSqlBackend* be, GncSqlRow* row )
 {
     const GUID* guid;
-	GncOrder* pOrder;
+    GncOrder* pOrder;
 
-	g_return_val_if_fail( be != NULL, NULL );
-	g_return_val_if_fail( row != NULL, NULL );
+    g_return_val_if_fail( be != NULL, NULL );
+    g_return_val_if_fail( row != NULL, NULL );
 
     guid = gnc_sql_load_guid( be, row );
     pOrder = gncOrderLookup( be->primary_book, guid );
-    if( pOrder == NULL ) {
+    if ( pOrder == NULL )
+    {
         pOrder = gncOrderCreate( be->primary_book );
     }
     gnc_sql_load_object( be, row, GNC_ID_ORDER, pOrder, col_table );
     qof_instance_mark_clean( QOF_INSTANCE(pOrder) );
 
-	return pOrder;
+    return pOrder;
 }
 
 static void
@@ -93,30 +94,34 @@
     GncSqlResult* result;
     QofBook* pBook;
 
-	g_return_if_fail( be != NULL );
+    g_return_if_fail( be != NULL );
 
     pBook = be->primary_book;
 
     stmt = gnc_sql_create_select_statement( be, TABLE_NAME );
     result = gnc_sql_execute_select_statement( be, stmt );
-	gnc_sql_statement_dispose( stmt );
-    if( result != NULL ) {
+    gnc_sql_statement_dispose( stmt );
+    if ( result != NULL )
+    {
         GncSqlRow* row;
-		GList* list = NULL;
+        GList* list = NULL;
 
-		row = gnc_sql_result_get_first_row( result );
-        while( row != NULL ) {
+        row = gnc_sql_result_get_first_row( result );
+        while ( row != NULL )
+        {
             GncOrder* pOrder = load_single_order( be, row );
-			if( pOrder != NULL ) {
-				list = g_list_append( list, pOrder );
-			}
-			row = gnc_sql_result_get_next_row( result );
-		}
-		gnc_sql_result_dispose( result );
+            if ( pOrder != NULL )
+            {
+                list = g_list_append( list, pOrder );
+            }
+            row = gnc_sql_result_get_next_row( result );
+        }
+        gnc_sql_result_dispose( result );
 
-		if( list != NULL ) {
-			gnc_sql_slots_load_for_list( be, list );
-		}
+        if ( list != NULL )
+        {
+            gnc_sql_slots_load_for_list( be, list );
+        }
     }
 }
 
@@ -124,12 +129,13 @@
 static void
 create_order_tables( GncSqlBackend* be )
 {
-	gint version;
+    gint version;
 
-	g_return_if_fail( be != NULL );
+    g_return_if_fail( be != NULL );
 
-	version = gnc_sql_get_table_version( be, TABLE_NAME );
-    if( version == 0 ) {
+    version = gnc_sql_get_table_version( be, TABLE_NAME );
+    if ( version == 0 )
+    {
         gnc_sql_create_table( be, TABLE_NAME, TABLE_VERSION, col_table );
     }
 }
@@ -138,9 +144,9 @@
 static gboolean
 save_order( GncSqlBackend* be, QofInstance* inst )
 {
-	g_return_val_if_fail( inst != NULL, FALSE );
-	g_return_val_if_fail( GNC_IS_ORDER(inst), FALSE );
-	g_return_val_if_fail( be != NULL, FALSE );
+    g_return_val_if_fail( inst != NULL, FALSE );
+    g_return_val_if_fail( GNC_IS_ORDER(inst), FALSE );
+    g_return_val_if_fail( be != NULL, FALSE );
 
     return gnc_sql_commit_standard_item( be, inst, TABLE_NAME, GNC_ID_ORDER, col_table );
 }
@@ -151,13 +157,14 @@
 {
     const char *id;
 
-	g_return_val_if_fail( order != NULL, FALSE );
+    g_return_val_if_fail( order != NULL, FALSE );
 
     /* make sure this is a valid order before we save it -- should have an ID */
     id = gncOrderGetID( order );
-    if( id == NULL || *id == '\0' ) {
+    if ( id == NULL || *id == '\0' )
+    {
         return FALSE;
-	}
+    }
 
     return TRUE;
 }
@@ -165,67 +172,76 @@
 static void
 write_single_order( QofInstance *term_p, gpointer data_p )
 {
-	write_objects_t* s = (write_objects_t*)data_p;
+    write_objects_t* s = (write_objects_t*)data_p;
 
-	g_return_if_fail( term_p != NULL );
-	g_return_if_fail( GNC_IS_ORDER(term_p) );
-	g_return_if_fail( data_p != NULL );
+    g_return_if_fail( term_p != NULL );
+    g_return_if_fail( GNC_IS_ORDER(term_p) );
+    g_return_if_fail( data_p != NULL );
 
-	if( s->is_ok && order_should_be_saved( GNC_ORDER(term_p) ) ) {
-    	s->is_ok = save_order( s->be, term_p );
-	}
+    if ( s->is_ok && order_should_be_saved( GNC_ORDER(term_p) ) )
+    {
+        s->is_ok = save_order( s->be, term_p );
+    }
 }
 
 static gboolean
 write_orders( GncSqlBackend* be )
 {
-	write_objects_t data;
+    write_objects_t data;
 
-	g_return_val_if_fail( be != NULL, FALSE );
+    g_return_val_if_fail( be != NULL, FALSE );
 
-	data.be = be;
-	data.is_ok = TRUE;
+    data.be = be;
+    data.is_ok = TRUE;
     qof_object_foreach( GNC_ID_ORDER, be->primary_book, write_single_order, &data );
 
-	return data.is_ok;
+    return data.is_ok;
 }
 
 /* ================================================================= */
 static void
 load_order_guid( const GncSqlBackend* be, GncSqlRow* row,
-            QofSetterFunc setter, gpointer pObject,
-            const GncSqlColumnTableEntry* table_row )
+                 QofSetterFunc setter, gpointer pObject,
+                 const GncSqlColumnTableEntry* table_row )
 {
     const GValue* val;
     GUID guid;
-	GncOrder* order = NULL;
+    GncOrder* order = NULL;
 
-	g_return_if_fail( be != NULL );
-	g_return_if_fail( row != NULL );
-	g_return_if_fail( pObject != NULL );
-	g_return_if_fail( table_row != NULL );
+    g_return_if_fail( be != NULL );
+    g_return_if_fail( row != NULL );
+    g_return_if_fail( pObject != NULL );
+    g_return_if_fail( table_row != NULL );
 
     val = gnc_sql_row_get_value_at_col_name( row, table_row->col_name );
-    if( val != NULL && G_VALUE_HOLDS_STRING( val ) && g_value_get_string( val ) != NULL ) {
+    if ( val != NULL && G_VALUE_HOLDS_STRING( val ) && g_value_get_string( val ) != NULL )
+    {
         string_to_guid( g_value_get_string( val ), &guid );
-		order = gncOrderLookup( be->primary_book, &guid );
-		if( order != NULL ) {
-        	if( table_row->gobj_param_name != NULL ) {
-		    	g_object_set( pObject, table_row->gobj_param_name, order, NULL );
-        	} else {
-		    	(*setter)( pObject, (const gpointer)order );
-        	}
-		} else {
-	    	PWARN( "Order ref '%s' not found", g_value_get_string( val ) );
-		}
-	}
+        order = gncOrderLookup( be->primary_book, &guid );
+        if ( order != NULL )
+        {
+            if ( table_row->gobj_param_name != NULL )
+            {
+                g_object_set( pObject, table_row->gobj_param_name, order, NULL );
+            }
+            else
+            {
+                (*setter)( pObject, (const gpointer)order );
+            }
+        }
+        else
+        {
+            PWARN( "Order ref '%s' not found", g_value_get_string( val ) );
+        }
+    }
 }
 
 static GncSqlColumnTypeHandler order_guid_handler
-	= { load_order_guid,
-		gnc_sql_add_objectref_guid_col_info_to_list,
-		gnc_sql_add_colname_to_list,
-		gnc_sql_add_gvalue_objectref_guid_to_slist };
+= { load_order_guid,
+    gnc_sql_add_objectref_guid_col_info_to_list,
+    gnc_sql_add_colname_to_list,
+    gnc_sql_add_gvalue_objectref_guid_to_slist
+  };
 /* ================================================================= */
 void
 gnc_order_sql_initialize( void )
@@ -237,12 +253,12 @@
         save_order,						/* commit */
         load_all_orders,				/* initial_load */
         create_order_tables,			/* create_tables */
-		NULL, NULL, NULL,
-		write_orders					/* write */
+        NULL, NULL, NULL,
+        write_orders					/* write */
     };
 
     qof_object_register_backend( GNC_ID_ORDER, GNC_SQL_BACKEND, &be_data );
 
-	gnc_sql_register_col_type_handler( CT_ORDERREF, &order_guid_handler );
+    gnc_sql_register_col_type_handler( CT_ORDERREF, &order_guid_handler );
 }
 /* ========================== END OF FILE ===================== */

Modified: gnucash/trunk/src/business/business-core/sql/gnc-owner-sql.c
===================================================================
--- gnucash/trunk/src/business/business-core/sql/gnc-owner-sql.c	2010-03-02 21:40:28 UTC (rev 18788)
+++ gnucash/trunk/src/business/business-core/sql/gnc-owner-sql.c	2010-03-02 21:41:05 UTC (rev 18789)
@@ -54,134 +54,147 @@
 {
     const GValue* val;
     gchar* buf;
-	GncOwnerType type;
+    GncOwnerType type;
     GUID guid;
-	QofBook* book;
-	GncOwner owner;
-	GUID* pGuid = NULL;
+    QofBook* book;
+    GncOwner owner;
+    GUID* pGuid = NULL;
 
-	g_return_if_fail( be != NULL );
-	g_return_if_fail( row != NULL );
-	g_return_if_fail( pObject != NULL );
-	g_return_if_fail( table_row != NULL );
+    g_return_if_fail( be != NULL );
+    g_return_if_fail( row != NULL );
+    g_return_if_fail( pObject != NULL );
+    g_return_if_fail( table_row != NULL );
 
-	book = be->primary_book;
+    book = be->primary_book;
     buf = g_strdup_printf( "%s_type", table_row->col_name );
     val = gnc_sql_row_get_value_at_col_name( row, buf );
-	type = (GncOwnerType)gnc_sql_get_integer_value( val );
+    type = (GncOwnerType)gnc_sql_get_integer_value( val );
     g_free( buf );
     buf = g_strdup_printf( "%s_guid", table_row->col_name );
     val = gnc_sql_row_get_value_at_col_name( row, buf );
     g_free( buf );
 
-    if( val != NULL && G_VALUE_HOLDS_STRING( val ) && g_value_get_string( val ) != NULL ) {
+    if ( val != NULL && G_VALUE_HOLDS_STRING( val ) && g_value_get_string( val ) != NULL )
+    {
         string_to_guid( g_value_get_string( val ), &guid );
-		pGuid = &guid;
-	}
+        pGuid = &guid;
+    }
 
-    switch( type ) {
-  	case GNC_OWNER_CUSTOMER:
-  		{
-    		GncCustomer *cust = NULL;
+    switch ( type )
+    {
+    case GNC_OWNER_CUSTOMER:
+    {
+        GncCustomer *cust = NULL;
 
-			if( pGuid != NULL ) {
-    			cust = gncCustomerLookup( book, pGuid );
-    			if( cust == NULL ) {
-      				cust = gncCustomerCreate( book );
-      				gncCustomerSetGUID( cust, &guid );
-				}
-    		}
-    		gncOwnerInitCustomer( &owner, cust );
-    		break; 
-  		}
+        if ( pGuid != NULL )
+        {
+            cust = gncCustomerLookup( book, pGuid );
+            if ( cust == NULL )
+            {
+                cust = gncCustomerCreate( book );
+                gncCustomerSetGUID( cust, &guid );
+            }
+        }
+        gncOwnerInitCustomer( &owner, cust );
+        break;
+    }
 
-  	case GNC_OWNER_JOB:
-  		{
-    		GncJob *job = NULL;
+    case GNC_OWNER_JOB:
+    {
+        GncJob *job = NULL;
 
-			if( pGuid != NULL ) {
-				job = gncJobLookup( book, pGuid );
-    			if( job == NULL ) {
-      				job = gncJobCreate( book );
-      				gncJobSetGUID( job, &guid );
-				}
-    		}
-    		gncOwnerInitJob( &owner, job );
-    		break; 
-  		}
+        if ( pGuid != NULL )
+        {
+            job = gncJobLookup( book, pGuid );
+            if ( job == NULL )
+            {
+                job = gncJobCreate( book );
+                gncJobSetGUID( job, &guid );
+            }
+        }
+        gncOwnerInitJob( &owner, job );
+        break;
+    }
 
-  	case GNC_OWNER_VENDOR:
-  		{
-    		GncVendor *vendor = NULL;
+    case GNC_OWNER_VENDOR:
+    {
+        GncVendor *vendor = NULL;
 
-			if( pGuid != NULL ) {
-    			vendor = gncVendorLookup( book, pGuid );
-    			if( vendor == NULL ) {
-      				vendor = gncVendorCreate( book );
-    		  		gncVendorSetGUID( vendor, &guid );
-				}
-    		}
-    		gncOwnerInitVendor( &owner, vendor );
-    		break; 
-  		}
+        if ( pGuid != NULL )
+        {
+            vendor = gncVendorLookup( book, pGuid );
+            if ( vendor == NULL )
+            {
+                vendor = gncVendorCreate( book );
+                gncVendorSetGUID( vendor, &guid );
+            }
+        }
+        gncOwnerInitVendor( &owner, vendor );
+        break;
+    }
 
-  	case GNC_OWNER_EMPLOYEE:
-  		{
-    		GncEmployee *employee = NULL;
+    case GNC_OWNER_EMPLOYEE:
+    {
+        GncEmployee *employee = NULL;
 
-			if( pGuid != NULL ) {
-    			employee = gncEmployeeLookup( book, pGuid );
-    			if( employee == NULL ) {
-      				employee = gncEmployeeCreate( book );
-      				gncEmployeeSetGUID( employee, &guid );
-				}
-    		}
-    		gncOwnerInitEmployee( &owner, employee );
-    		break; 
-  		}
+        if ( pGuid != NULL )
+        {
+            employee = gncEmployeeLookup( book, pGuid );
+            if ( employee == NULL )
+            {
+                employee = gncEmployeeCreate( book );
+                gncEmployeeSetGUID( employee, &guid );
+            }
+        }
+        gncOwnerInitEmployee( &owner, employee );
+        break;
+    }
 
-  	default:
-    	PWARN("Invalid owner type: %d\n", type );
-	}
+    default:
+        PWARN("Invalid owner type: %d\n", type );
+    }
 
-	if( table_row->gobj_param_name != NULL ) {
-		g_object_set( pObject, table_row->gobj_param_name, &owner, NULL );
-	} else {
-    	(*setter)( pObject, &owner );
-	}
+    if ( table_row->gobj_param_name != NULL )
+    {
+        g_object_set( pObject, table_row->gobj_param_name, &owner, NULL );
+    }
+    else
+    {
+        (*setter)( pObject, &owner );
+    }
 }
 
 static void
 add_owner_col_info_to_list( const GncSqlBackend* be, const GncSqlColumnTableEntry* table_row,
-								GList** pList )
+                            GList** pList )
 {
-	GncSqlColumnInfo* info;
+    GncSqlColumnInfo* info;
     gchar* buf;
-	const gchar* type;
+    const gchar* type;
 
-	g_return_if_fail( be != NULL );
-	g_return_if_fail( table_row != NULL );
-	g_return_if_fail( pList != NULL );
+    g_return_if_fail( be != NULL );
+    g_return_if_fail( table_row != NULL );
+    g_return_if_fail( pList != NULL );
 
     buf = g_strdup_printf( "%s_type", table_row->col_name );
-	info = g_new0( GncSqlColumnInfo, 1 );
-	info->name = buf;
-	info->type = BCT_INT;
-	info->is_primary_key = (table_row->flags & COL_PKEY) ? TRUE : FALSE;
-	info->null_allowed = (table_row->flags & COL_NNUL) ? FALSE : TRUE;
-	info->size = table_row->size;
-	info->is_unicode = FALSE;
-	*pList = g_list_append( *pList, info );
+    info = g_new0( GncSqlColumnInfo, 1 );
+    info->name = buf;
+    info->type = BCT_INT;
+    info->is_primary_key = (table_row->flags & COL_PKEY) ? TRUE : FALSE;
+    info->null_allowed = (table_row->flags & COL_NNUL) ? FALSE : TRUE;
+    info->size = table_row->size;
+    info->is_unicode = FALSE;
+    *pList = g_list_append( *pList, info );
 
-   	buf = g_strdup_printf( "%s_guid", table_row->col_name );
-	info = g_new0( GncSqlColumnInfo, 1 );
-	info->name = buf;
-	info->type = BCT_STRING;
-	info->size = GUID_ENCODING_LENGTH;
-	info->is_primary_key = (table_row->flags & COL_PKEY) ? TRUE : FALSE;
-	info->null_allowed = (table_row->flags & COL_NNUL) ? FALSE : TRUE;
-	info->is_unicode = FALSE;
-	*pList = g_list_append( *pList, info );
+    buf = g_strdup_printf( "%s_guid", table_row->col_name );
+    info = g_new0( GncSqlColumnInfo, 1 );
+    info->name = buf;
+    info->type = BCT_STRING;
+    info->size = GUID_ENCODING_LENGTH;
+    info->is_primary_key = (table_row->flags & COL_PKEY) ? TRUE : FALSE;
+    info->null_allowed = (table_row->flags & COL_NNUL) ? FALSE : TRUE;
+    info->is_unicode = FALSE;
+    *pList = g_list_append( *pList, info );
 }
 
 static void
@@ -190,95 +203,102 @@
     gchar* buf;
 
     buf = g_strdup_printf( "%s_type", table_row->col_name );
-	(*pList) = g_list_append( (*pList), buf );
+    (*pList) = g_list_append( (*pList), buf );
     buf = g_strdup_printf( "%s_guid", table_row->col_name );
-	(*pList) = g_list_append( (*pList), buf );
+    (*pList) = g_list_append( (*pList), buf );
 }
 
 static void
 add_gvalue_owner_to_slist( const GncSqlBackend* be, QofIdTypeConst obj_name,
-                	const gpointer pObject, const GncSqlColumnTableEntry* table_row, GSList** pList )
+                           const gpointer pObject, const GncSqlColumnTableEntry* table_row, GSList** pList )
 {
     GValue* subfield_value;
     GncOwner* owner;
-	gchar* buf;
+    gchar* buf;
     const GUID* guid;
     gchar guid_buf[GUID_ENCODING_LENGTH+1];
-	GncOwnerType type;
-	QofInstance* inst = NULL;
+    GncOwnerType type;
+    QofInstance* inst = NULL;
     OwnerGetterFunc getter;
 
-	g_return_if_fail( be != NULL );
-	g_return_if_fail( obj_name != NULL );
-	g_return_if_fail( pObject != NULL );
-	g_return_if_fail( table_row != NULL );
+    g_return_if_fail( be != NULL );
+    g_return_if_fail( obj_name != NULL );
+    g_return_if_fail( pObject != NULL );
+    g_return_if_fail( table_row != NULL );
 
-	getter = (OwnerGetterFunc)gnc_sql_get_getter( obj_name, table_row );
+    getter = (OwnerGetterFunc)gnc_sql_get_getter( obj_name, table_row );
     owner = (*getter)( pObject );
 
-	if( owner != NULL ) {
-    	buf = g_strdup_printf( "%s_type", table_row->col_name );
-		subfield_value = g_new0( GValue, 1 );
+    if ( owner != NULL )
+    {
+        buf = g_strdup_printf( "%s_type", table_row->col_name );
+        subfield_value = g_new0( GValue, 1 );
         g_value_init( subfield_value, G_TYPE_INT );
         type = gncOwnerGetType( owner );
         g_value_set_int( subfield_value, type );
-		(*pList) = g_slist_append( (*pList), subfield_value );
-		g_free( buf );
+        (*pList) = g_slist_append( (*pList), subfield_value );
+        g_free( buf );
 
-    	buf = g_strdup_printf( "%s_guid", table_row->col_name );
-		subfield_value = g_new0( GValue, 1 );
-    	switch( type ) {
-  		case GNC_OWNER_CUSTOMER:
-    		inst = QOF_INSTANCE(gncOwnerGetCustomer( owner ));
-    		break; 
+        buf = g_strdup_printf( "%s_guid", table_row->col_name );
+        subfield_value = g_new0( GValue, 1 );
+        switch ( type )
+        {
+        case GNC_OWNER_CUSTOMER:
+            inst = QOF_INSTANCE(gncOwnerGetCustomer( owner ));
+            break;
 
-  		case GNC_OWNER_JOB:
-    		inst = QOF_INSTANCE(gncOwnerGetJob( owner ));
-    		break; 
+        case GNC_OWNER_JOB:
+            inst = QOF_INSTANCE(gncOwnerGetJob( owner ));
+            break;
 
-  		case GNC_OWNER_VENDOR:
-    		inst = QOF_INSTANCE(gncOwnerGetVendor( owner ));
-    		break; 
+        case GNC_OWNER_VENDOR:
+            inst = QOF_INSTANCE(gncOwnerGetVendor( owner ));
+            break;
 
-  		case GNC_OWNER_EMPLOYEE:
-    		inst = QOF_INSTANCE(gncOwnerGetEmployee( owner ));
-    		break; 
+        case GNC_OWNER_EMPLOYEE:
+            inst = QOF_INSTANCE(gncOwnerGetEmployee( owner ));
+            break;
 
-  		default:
-    		PWARN("Invalid owner type: %d\n", type );
-		}
+        default:
+            PWARN("Invalid owner type: %d\n", type );
+        }
         g_value_init( subfield_value, G_TYPE_STRING );
-		if( inst != NULL ) {
-			guid = qof_instance_get_guid( inst );
-    		if( guid != NULL ) {
-        		(void)guid_to_string_buff( guid, guid_buf );
-        		g_value_take_string( subfield_value, g_strdup_printf( "%s", guid_buf ) );
-			}
-		}
-		(*pList) = g_slist_append( (*pList), subfield_value );
-		g_free( buf );
-    } else {
-		subfield_value = g_new0( GValue, 1 );
-		g_value_init( subfield_value, G_TYPE_STRING );
-		g_value_set_string( subfield_value, "NULL" );
-		(*pList) = g_slist_append( (*pList), subfield_value );
-		subfield_value = g_new0( GValue, 1 );
-		g_value_init( subfield_value, G_TYPE_STRING );
-		g_value_set_string( subfield_value, "NULL" );
-		(*pList) = g_slist_append( (*pList), subfield_value );
-	}
+        if ( inst != NULL )
+        {
+            guid = qof_instance_get_guid( inst );
+            if ( guid != NULL )
+            {
+                (void)guid_to_string_buff( guid, guid_buf );
+                g_value_take_string( subfield_value, g_strdup_printf( "%s", guid_buf ) );
+            }
+        }
+        (*pList) = g_slist_append( (*pList), subfield_value );
+        g_free( buf );
+    }
+    else
+    {
+        subfield_value = g_new0( GValue, 1 );
+        g_value_init( subfield_value, G_TYPE_STRING );
+        g_value_set_string( subfield_value, "NULL" );
+        (*pList) = g_slist_append( (*pList), subfield_value );
+        subfield_value = g_new0( GValue, 1 );
+        g_value_init( subfield_value, G_TYPE_STRING );
+        g_value_set_string( subfield_value, "NULL" );
+        (*pList) = g_slist_append( (*pList), subfield_value );
+    }
 }
 
 static GncSqlColumnTypeHandler owner_handler
-	= { load_owner,
-		add_owner_col_info_to_list,
-		add_colname_to_list,
-        add_gvalue_owner_to_slist };
+= { load_owner,
+    add_owner_col_info_to_list,
+    add_colname_to_list,
+    add_gvalue_owner_to_slist
+  };
 
 /* ================================================================= */
 void
 gnc_owner_sql_initialize( void )
 {
-	gnc_sql_register_col_type_handler( CT_OWNERREF, &owner_handler );
+    gnc_sql_register_col_type_handler( CT_OWNERREF, &owner_handler );
 }
 /* ========================== END OF FILE ===================== */

Modified: gnucash/trunk/src/business/business-core/sql/gnc-tax-table-sql.c
===================================================================
--- gnucash/trunk/src/business/business-core/sql/gnc-tax-table-sql.c	2010-03-02 21:40:28 UTC (rev 18788)
+++ gnucash/trunk/src/business/business-core/sql/gnc-tax-table-sql.c	2010-03-02 21:41:05 UTC (rev 18789)
@@ -48,7 +48,8 @@
 
 static void set_invisible( gpointer data, gboolean value );
 
-typedef struct {
+typedef struct
+{
     GncSqlBackend* be;
     const GUID* guid;
 } guid_info_t;
@@ -65,16 +66,20 @@
 
 static GncSqlColumnTableEntry tt_col_table[] =
 {
-	{ "guid",      CT_GUID,        0,            COL_NNUL|COL_PKEY, "guid" },
-	{ "name",      CT_STRING,      MAX_NAME_LEN, COL_NNUL,          "name" },
-	{ "refcount",  CT_INT64,       0,            COL_NNUL,          NULL, GNC_TT_REFCOUNT },
-	{ "invisible", CT_BOOLEAN,     0,            COL_NNUL,          NULL, NULL,
-			(QofAccessFunc)gncTaxTableGetInvisible, (QofSetterFunc)set_invisible },
-/*	{ "child",     CT_TAXTABLEREF, 0,			 0,                 NULL, NULL,
-			get_child, (QofSetterFunc)gncTaxTableSetChild }, */
-	{ "parent",    CT_TAXTABLEREF, 0,			 0,                 NULL, NULL,
-			(QofAccessFunc)gncTaxTableGetParent, set_parent },
-	{ NULL }
+    { "guid",      CT_GUID,        0,            COL_NNUL | COL_PKEY, "guid" },
+    { "name",      CT_STRING,      MAX_NAME_LEN, COL_NNUL,          "name" },
+    { "refcount",  CT_INT64,       0,            COL_NNUL,          NULL, GNC_TT_REFCOUNT },
+    {
+        "invisible", CT_BOOLEAN,     0,            COL_NNUL,          NULL, NULL,
+        (QofAccessFunc)gncTaxTableGetInvisible, (QofSetterFunc)set_invisible
+    },
+    /*	{ "child",     CT_TAXTABLEREF, 0,			 0,                 NULL, NULL,
+    			get_child, (QofSetterFunc)gncTaxTableSetChild }, */
+    {
+        "parent",    CT_TAXTABLEREF, 0,			 0,                 NULL, NULL,
+        (QofAccessFunc)gncTaxTableGetParent, set_parent
+    },
+    { NULL }
 };
 
 #define TTENTRIES_TABLE_NAME "taxtable_entries"
@@ -82,16 +87,24 @@
 
 static GncSqlColumnTableEntry ttentries_col_table[] =
 {
-	{ "id",       CT_INT,         0, COL_PKEY|COL_NNUL|COL_AUTOINC },
-	{ "taxtable", CT_TAXTABLEREF, 0, COL_NNUL, NULL, NULL,
-			(QofAccessFunc)gncTaxTableEntryGetTable, set_obj_guid },
-	{ "account",  CT_ACCOUNTREF,  0, COL_NNUL, NULL, NULL,
-			(QofAccessFunc)gncTaxTableEntryGetAccount, (QofSetterFunc)gncTaxTableEntrySetAccount },
-	{ "amount",   CT_NUMERIC,     0, COL_NNUL, NULL, NULL,
-			(QofAccessFunc)gncTaxTableEntryGetAmount, (QofSetterFunc)gncTaxTableEntrySetAmount },
-	{ "type",     CT_INT,         0, COL_NNUL, NULL, NULL,
-			(QofAccessFunc)gncTaxTableEntryGetType, (QofSetterFunc)gncTaxTableEntrySetType },
-	{ NULL }
+    { "id",       CT_INT,         0, COL_PKEY | COL_NNUL | COL_AUTOINC },
+    {
+        "taxtable", CT_TAXTABLEREF, 0, COL_NNUL, NULL, NULL,
+        (QofAccessFunc)gncTaxTableEntryGetTable, set_obj_guid
+    },
+    {
+        "account",  CT_ACCOUNTREF,  0, COL_NNUL, NULL, NULL,
+        (QofAccessFunc)gncTaxTableEntryGetAccount, (QofSetterFunc)gncTaxTableEntrySetAccount
+    },
+    {
+        "amount",   CT_NUMERIC,     0, COL_NNUL, NULL, NULL,
+        (QofAccessFunc)gncTaxTableEntryGetAmount, (QofSetterFunc)gncTaxTableEntrySetAmount
+    },
+    {
+        "type",     CT_INT,         0, COL_NNUL, NULL, NULL,
+        (QofAccessFunc)gncTaxTableEntryGetType, (QofSetterFunc)gncTaxTableEntrySetType
+    },
+    { NULL }
 };
 
 /* Special column table because we need to be able to access the table by
@@ -107,7 +120,7 @@
 {
     guid_info_t* pInfo = (guid_info_t*)pObject;
 
-	g_return_val_if_fail( pInfo != NULL, NULL );
+    g_return_val_if_fail( pInfo != NULL, NULL );
 
     return (gpointer)pInfo->guid;
 }
@@ -121,54 +134,56 @@
 static void
 set_invisible( gpointer data, gboolean value )
 {
-	GncTaxTable* tt = GNC_TAXTABLE(data);
+    GncTaxTable* tt = GNC_TAXTABLE(data);
 
-	g_return_if_fail( data != NULL );
-	g_return_if_fail( GNC_IS_TAXTABLE(data) );
+    g_return_if_fail( data != NULL );
+    g_return_if_fail( GNC_IS_TAXTABLE(data) );
 
-	if( value ) {
-		gncTaxTableMakeInvisible( tt );
-	}
+    if ( value )
+    {
+        gncTaxTableMakeInvisible( tt );
+    }
 }
 
 static gpointer
 get_child( gpointer pObject, const QofParam* param )
 {
-	GncTaxTable* tt = GNC_TAXTABLE(pObject);
+    GncTaxTable* tt = GNC_TAXTABLE(pObject);
 
-	g_return_val_if_fail( pObject != NULL, NULL );
-	g_return_val_if_fail( GNC_IS_TAXTABLE(pObject), NULL );
+    g_return_val_if_fail( pObject != NULL, NULL );
+    g_return_val_if_fail( GNC_IS_TAXTABLE(pObject), NULL );
 
-	return gncTaxTableGetChild( tt );
+    return gncTaxTableGetChild( tt );
 }
 
 static void
 set_parent( gpointer data, gpointer value )
 {
-	GncTaxTable* tt = GNC_TAXTABLE(data);
-	GncTaxTable* parent;
+    GncTaxTable* tt = GNC_TAXTABLE(data);
+    GncTaxTable* parent;
 
-	g_return_if_fail( data != NULL );
-	g_return_if_fail( GNC_IS_TAXTABLE(data) );
+    g_return_if_fail( data != NULL );
+    g_return_if_fail( GNC_IS_TAXTABLE(data) );
 
-	if( value != NULL ) {
-		parent = GNC_TAXTABLE(value);
-		gncTaxTableSetParent( tt, parent );
-		gncTaxTableSetChild( parent, tt );
-	}
+    if ( value != NULL )
+    {
+        parent = GNC_TAXTABLE(value);
+        gncTaxTableSetParent( tt, parent );
+        gncTaxTableSetChild( parent, tt );
+    }
 }
 
 static void
 load_single_ttentry( GncSqlBackend* be, GncSqlRow* row, GncTaxTable* tt )
 {
-	GncTaxTableEntry* e = gncTaxTableEntryCreate();
+    GncTaxTableEntry* e = gncTaxTableEntryCreate();
 
-	g_return_if_fail( be != NULL );
-	g_return_if_fail( row!= NULL );
-	g_return_if_fail( tt != NULL );
+    g_return_if_fail( be != NULL );
+    g_return_if_fail( row != NULL );
+    g_return_if_fail( tt != NULL );
 
     gnc_sql_load_object( be, row, GNC_ID_TAXTABLE, e, ttentries_col_table );
-	gncTaxTableAddEntry( tt, e );
+    gncTaxTableAddEntry( tt, e );
 }
 
 static void
@@ -177,31 +192,33 @@
     GncSqlResult* result;
     gchar guid_buf[GUID_ENCODING_LENGTH+1];
     GValue value;
-	gchar* buf;
-	GncSqlStatement* stmt;
-	GError* error = NULL;
+    gchar* buf;
+    GncSqlStatement* stmt;
+    GError* error = NULL;
 
-	g_return_if_fail( be != NULL );
-	g_return_if_fail( tt != NULL );
+    g_return_if_fail( be != NULL );
+    g_return_if_fail( tt != NULL );
 
     guid_to_string_buff( qof_instance_get_guid( QOF_INSTANCE(tt) ), guid_buf );
     memset( &value, 0, sizeof( GValue ) );
     g_value_init( &value, G_TYPE_STRING );
     g_value_set_string( &value, guid_buf );
-	buf = g_strdup_printf( "SELECT * FROM %s WHERE taxtable='%s'", TTENTRIES_TABLE_NAME, guid_buf );
-	stmt = gnc_sql_connection_create_statement_from_sql( be->conn, buf );
-	g_free( buf );
+    buf = g_strdup_printf( "SELECT * FROM %s WHERE taxtable='%s'", TTENTRIES_TABLE_NAME, guid_buf );
+    stmt = gnc_sql_connection_create_statement_from_sql( be->conn, buf );
+    g_free( buf );
     result = gnc_sql_execute_select_statement( be, stmt );
-	gnc_sql_statement_dispose( stmt );
-    if( result != NULL ) {
+    gnc_sql_statement_dispose( stmt );
+    if ( result != NULL )
+    {
         GncSqlRow* row;
 
-		row = gnc_sql_result_get_first_row( result );
-        while( row != NULL ) {
+        row = gnc_sql_result_get_first_row( result );
+        while ( row != NULL )
+        {
             load_single_ttentry( be, row, tt );
-			row = gnc_sql_result_get_next_row( result );
+            row = gnc_sql_result_get_next_row( result );
         }
-		gnc_sql_result_dispose( result );
+        gnc_sql_result_dispose( result );
     }
 }
 
@@ -209,19 +226,20 @@
 load_single_taxtable( GncSqlBackend* be, GncSqlRow* row )
 {
     const GUID* guid;
-	GncTaxTable* tt;
+    GncTaxTable* tt;
 
-	g_return_if_fail( be != NULL );
-	g_return_if_fail( row != NULL );
+    g_return_if_fail( be != NULL );
+    g_return_if_fail( row != NULL );
 
     guid = gnc_sql_load_guid( be, row );
     tt = gncTaxTableLookup( be->primary_book, guid );
-    if( tt == NULL ) {
+    if ( tt == NULL )
+    {
         tt = gncTaxTableCreate( be->primary_book );
     }
     gnc_sql_load_object( be, row, GNC_ID_TAXTABLE, tt, tt_col_table );
     gnc_sql_slots_load( be, QOF_INSTANCE(tt) );
-	load_taxtable_entries( be, tt );
+    load_taxtable_entries( be, tt );
 
     qof_instance_mark_clean( QOF_INSTANCE(tt) );
 }
@@ -232,21 +250,23 @@
     GncSqlStatement* stmt;
     GncSqlResult* result;
 
-	g_return_if_fail( be != NULL );
+    g_return_if_fail( be != NULL );
 
     /* First time, create the query */
     stmt = gnc_sql_create_select_statement( be, TT_TABLE_NAME );
     result = gnc_sql_execute_select_statement( be, stmt );
-	gnc_sql_statement_dispose( stmt );
-    if( result != NULL ) {
+    gnc_sql_statement_dispose( stmt );
+    if ( result != NULL )
+    {
         GncSqlRow* row;
 
-		row = gnc_sql_result_get_first_row( result );
-        while( row != NULL ) {
+        row = gnc_sql_result_get_first_row( result );
+        while ( row != NULL )
+        {
             load_single_taxtable( be, row );
-			row = gnc_sql_result_get_next_row( result );
-		}
-		gnc_sql_result_dispose( result );
+            row = gnc_sql_result_get_next_row( result );
+        }
+        gnc_sql_result_dispose( result );
     }
 }
 
@@ -254,27 +274,33 @@
 static void
 create_taxtable_tables( GncSqlBackend* be )
 {
-	gint version;
+    gint version;
 
-	g_return_if_fail( be != NULL );
+    g_return_if_fail( be != NULL );
 
-	version = gnc_sql_get_table_version( be, TT_TABLE_NAME );
-    if( version == 0 ) {
+    version = gnc_sql_get_table_version( be, TT_TABLE_NAME );
+    if ( version == 0 )
+    {
         gnc_sql_create_table( be, TT_TABLE_NAME, TT_TABLE_VERSION, tt_col_table );
-    } else if( version == 1 ) {
-		/* Upgrade 64 bit int handling */
-		gnc_sql_upgrade_table( be, TT_TABLE_NAME, tt_col_table );
-		gnc_sql_set_table_version( be, TT_TABLE_NAME, TT_TABLE_VERSION );
     }
+    else if ( version == 1 )
+    {
+        /* Upgrade 64 bit int handling */
+        gnc_sql_upgrade_table( be, TT_TABLE_NAME, tt_col_table );
+        gnc_sql_set_table_version( be, TT_TABLE_NAME, TT_TABLE_VERSION );
+    }
 
-	version = gnc_sql_get_table_version( be, TTENTRIES_TABLE_NAME );
-    if( version == 0 ) {
+    version = gnc_sql_get_table_version( be, TTENTRIES_TABLE_NAME );
+    if ( version == 0 )
+    {
         gnc_sql_create_table( be, TTENTRIES_TABLE_NAME, TTENTRIES_TABLE_VERSION, ttentries_col_table );
-    } else if( version == 1 ) {
-		/* Upgrade 64 bit int handling */
-		gnc_sql_upgrade_table( be, TTENTRIES_TABLE_NAME, ttentries_col_table );
-		gnc_sql_set_table_version( be, TTENTRIES_TABLE_NAME, TTENTRIES_TABLE_VERSION );
     }
+    else if ( version == 1 )
+    {
+        /* Upgrade 64 bit int handling */
+        gnc_sql_upgrade_table( be, TTENTRIES_TABLE_NAME, ttentries_col_table );
+        gnc_sql_set_table_version( be, TTENTRIES_TABLE_NAME, TTENTRIES_TABLE_VERSION );
+    }
 }
 
 /* ================================================================= */
@@ -283,37 +309,38 @@
 {
     guid_info_t guid_info;
 
-	g_return_val_if_fail( be != NULL, FALSE );
-	g_return_val_if_fail( guid != NULL, FALSE );
+    g_return_val_if_fail( be != NULL, FALSE );
+    g_return_val_if_fail( guid != NULL, FALSE );
 
     guid_info.be = be;
     guid_info.guid = guid;
     return gnc_sql_do_db_operation( be, OP_DB_DELETE, TTENTRIES_TABLE_NAME,
-                                TTENTRIES_TABLE_NAME, &guid_info, guid_col_table );
+                                    TTENTRIES_TABLE_NAME, &guid_info, guid_col_table );
 }
 
 static gboolean
 save_tt_entries( GncSqlBackend* be, const GUID* guid, GList* entries )
 {
-	GList* entry;
-	gboolean is_ok;
+    GList* entry;
+    gboolean is_ok;
 
-	g_return_val_if_fail( be != NULL, FALSE );
-	g_return_val_if_fail( guid != NULL, FALSE );
+    g_return_val_if_fail( be != NULL, FALSE );
+    g_return_val_if_fail( guid != NULL, FALSE );
 
     /* First, delete the old entries for this object */
     is_ok = delete_all_tt_entries( be, guid );
 
-	for( entry = entries; entry != NULL && is_ok; entry = entry->next ) {
-		GncTaxTableEntry* e = (GncTaxTableEntry*)entry->data;
-    	is_ok = gnc_sql_do_db_operation( be,
-                        			OP_DB_INSERT,
-                        			TTENTRIES_TABLE_NAME,
-                        			GNC_ID_TAXTABLE, e,
-                        			ttentries_col_table );
+    for ( entry = entries; entry != NULL && is_ok; entry = entry->next )
+    {
+        GncTaxTableEntry* e = (GncTaxTableEntry*)entry->data;
+        is_ok = gnc_sql_do_db_operation( be,
+                                         OP_DB_INSERT,
+                                         TTENTRIES_TABLE_NAME,
+                                         GNC_ID_TAXTABLE, e,
+                                         ttentries_col_table );
     }
 
-	return is_ok;
+    return is_ok;
 }
 
 static gboolean
@@ -321,106 +348,126 @@
 {
     GncTaxTable* tt;
     const GUID* guid;
-	gint op;
-	gboolean is_infant;
-	gboolean is_ok;
+    gint op;
+    gboolean is_infant;
+    gboolean is_ok;
 
-	g_return_val_if_fail( inst != NULL, FALSE );
-	g_return_val_if_fail( GNC_IS_TAXTABLE(inst), FALSE );
-	g_return_val_if_fail( be != NULL, FALSE );
+    g_return_val_if_fail( inst != NULL, FALSE );
+    g_return_val_if_fail( GNC_IS_TAXTABLE(inst), FALSE );
+    g_return_val_if_fail( be != NULL, FALSE );
 
     tt = GNC_TAXTABLE(inst);
 
-	is_infant = qof_instance_get_infant( inst );
-	if( qof_instance_get_destroying( inst ) ) {
-		op = OP_DB_DELETE;
-	} else if( be->is_pristine_db || is_infant ) {
-		op = OP_DB_INSERT;
-	} else {
-		op = OP_DB_UPDATE;
-	}
+    is_infant = qof_instance_get_infant( inst );
+    if ( qof_instance_get_destroying( inst ) )
+    {
+        op = OP_DB_DELETE;
+    }
+    else if ( be->is_pristine_db || is_infant )
+    {
+        op = OP_DB_INSERT;
+    }
+    else
+    {
+        op = OP_DB_UPDATE;
+    }
     is_ok = gnc_sql_do_db_operation( be, op, TT_TABLE_NAME, GNC_ID_TAXTABLE, tt, tt_col_table );
 
-	if( is_ok ) {
-    	// Now, commit or delete any slots and tax table entries
-    	guid = qof_instance_get_guid( inst );
-    	if( !qof_instance_get_destroying(inst) ) {
-        	is_ok = gnc_sql_slots_save( be, guid, is_infant, qof_instance_get_slots( inst ) );
-			if( is_ok ) {
-				is_ok = save_tt_entries( be, guid, gncTaxTableGetEntries( tt ) );
-			}
-    	} else {
-        	is_ok = gnc_sql_slots_delete( be, guid );
-			if( is_ok ) {
-				is_ok = delete_all_tt_entries( be, guid );
-			}
-    	}
-	}
+    if ( is_ok )
+    {
+        // Now, commit or delete any slots and tax table entries
+        guid = qof_instance_get_guid( inst );
+        if ( !qof_instance_get_destroying(inst) )
+        {
+            is_ok = gnc_sql_slots_save( be, guid, is_infant, qof_instance_get_slots( inst ) );
+            if ( is_ok )
+            {
+                is_ok = save_tt_entries( be, guid, gncTaxTableGetEntries( tt ) );
+            }
+        }
+        else
+        {
+            is_ok = gnc_sql_slots_delete( be, guid );
+            if ( is_ok )
+            {
+                is_ok = delete_all_tt_entries( be, guid );
+            }
+        }
+    }
 
-	return is_ok;
+    return is_ok;
 }
 
 /* ================================================================= */
 static void
 save_next_taxtable( QofInstance* inst, gpointer data )
 {
-	write_objects_t* s = (write_objects_t*)data;
+    write_objects_t* s = (write_objects_t*)data;
 
-	if( s->is_ok ) {
-		s->is_ok = save_taxtable( s->be, inst );
-	}
+    if ( s->is_ok )
+    {
+        s->is_ok = save_taxtable( s->be, inst );
+    }
 }
 
 static gboolean
 write_taxtables( GncSqlBackend* be )
 {
-	write_objects_t data;
+    write_objects_t data;
 
-	g_return_val_if_fail( be != NULL, FALSE );
+    g_return_val_if_fail( be != NULL, FALSE );
 
-	data.be = be;
-	data.is_ok = TRUE;
+    data.be = be;
+    data.is_ok = TRUE;
     qof_object_foreach( GNC_ID_TAXTABLE, be->primary_book, save_next_taxtable, &data );
 
-	return data.is_ok;
+    return data.is_ok;
 }
 
 /* ================================================================= */
 static void
 load_taxtable_guid( const GncSqlBackend* be, GncSqlRow* row,
-            QofSetterFunc setter, gpointer pObject,
-            const GncSqlColumnTableEntry* table_row )
+                    QofSetterFunc setter, gpointer pObject,
+                    const GncSqlColumnTableEntry* table_row )
 {
     const GValue* val;
     GUID guid;
-	GncTaxTable* taxtable = NULL;
+    GncTaxTable* taxtable = NULL;
 
-	g_return_if_fail( be != NULL );
-	g_return_if_fail( row != NULL );
-	g_return_if_fail( pObject != NULL );
-	g_return_if_fail( table_row != NULL );
+    g_return_if_fail( be != NULL );
+    g_return_if_fail( row != NULL );
+    g_return_if_fail( pObject != NULL );
+    g_return_if_fail( table_row != NULL );
 
     val = gnc_sql_row_get_value_at_col_name( row, table_row->col_name );
-    if( val != NULL && G_VALUE_HOLDS_STRING( val ) && g_value_get_string( val ) != NULL ) {
+    if ( val != NULL && G_VALUE_HOLDS_STRING( val ) && g_value_get_string( val ) != NULL )
+    {
         string_to_guid( g_value_get_string( val ), &guid );
-		taxtable = gncTaxTableLookup( be->primary_book, &guid );
-		if( taxtable != NULL ) {
-    		if( table_row->gobj_param_name != NULL ) {
-				g_object_set( pObject, table_row->gobj_param_name, taxtable, NULL );
-    		} else {
-				(*setter)( pObject, (const gpointer)taxtable );
-    		}
-		} else {
-	    	PWARN( "Taxtable ref '%s' not found", g_value_get_string( val ) );
-		}
+        taxtable = gncTaxTableLookup( be->primary_book, &guid );
+        if ( taxtable != NULL )
+        {
+            if ( table_row->gobj_param_name != NULL )
+            {
+                g_object_set( pObject, table_row->gobj_param_name, taxtable, NULL );
+            }
+            else
+            {
+                (*setter)( pObject, (const gpointer)taxtable );
+            }
+        }
+        else
+        {
+            PWARN( "Taxtable ref '%s' not found", g_value_get_string( val ) );
+        }
     }
 }
 
 static GncSqlColumnTypeHandler taxtable_guid_handler
-	= { load_taxtable_guid,
-		gnc_sql_add_objectref_guid_col_info_to_list,
-		gnc_sql_add_colname_to_list,
-		gnc_sql_add_gvalue_objectref_guid_to_slist };
+= { load_taxtable_guid,
+    gnc_sql_add_objectref_guid_col_info_to_list,
+    gnc_sql_add_colname_to_list,
+    gnc_sql_add_gvalue_objectref_guid_to_slist
+  };
 /* ================================================================= */
 void
 gnc_taxtable_sql_initialize( void )
@@ -432,13 +479,13 @@
         save_taxtable,						/* commit */
         load_all_taxtables,					/* initial_load */
         create_taxtable_tables,				/* create_tables */
-		NULL, NULL, NULL,
-		write_taxtables						/* write */
+        NULL, NULL, NULL,
+        write_taxtables						/* write */
     };
 
     qof_object_register_backend( GNC_ID_TAXTABLE, GNC_SQL_BACKEND, &be_data );
 
-	gnc_sql_register_col_type_handler( CT_TAXTABLEREF, &taxtable_guid_handler );
+    gnc_sql_register_col_type_handler( CT_TAXTABLEREF, &taxtable_guid_handler );
 }
 /* ========================== END OF FILE ===================== */
 

Modified: gnucash/trunk/src/business/business-core/sql/gnc-vendor-sql.c
===================================================================
--- gnucash/trunk/src/business/business-core/sql/gnc-vendor-sql.c	2010-03-02 21:40:28 UTC (rev 18788)
+++ gnucash/trunk/src/business/business-core/sql/gnc-vendor-sql.c	2010-03-02 21:41:05 UTC (rev 18789)
@@ -63,40 +63,45 @@
 
 static GncSqlColumnTableEntry col_table[] =
 {
-	{ "guid",         CT_GUID,          0,               COL_NNUL|COL_PKEY, "guid" },
-	{ "name",         CT_STRING,        MAX_NAME_LEN,    COL_NNUL,          "name" },
-	{ "id",           CT_STRING,        MAX_ID_LEN,      COL_NNUL,          NULL, VENDOR_ID },
-	{ "notes",        CT_STRING,        MAX_NOTES_LEN,   COL_NNUL,          NULL, VENDOR_NOTES },
-	{ "currency",     CT_COMMODITYREF,  0,               COL_NNUL,          NULL, NULL,
-			(QofAccessFunc)gncVendorGetCurrency, (QofSetterFunc)gncVendorSetCurrency },
-	{ "active",       CT_BOOLEAN,       0,               COL_NNUL,          NULL, NULL,
-			(QofAccessFunc)gncVendorGetActive, (QofSetterFunc)gncVendorSetActive },
-	{ "tax_override", CT_BOOLEAN,       0,               COL_NNUL,          NULL, VENDOR_TAX_OVERRIDE },
-	{ "addr",         CT_ADDRESS,       0,               0,                 NULL, VENDOR_ADDR },
-	{ "terms",        CT_BILLTERMREF,   0,               0,                 NULL, VENDOR_TERMS },
-	{ "tax_inc",      CT_STRING,        MAX_TAX_INC_LEN, 0,                 NULL, VENDOR_TAX_INC },
-	{ "tax_table",    CT_TAXTABLEREF,   0,               0,                 NULL, VENDOR_TAX_TABLE },
-	{ NULL }
+    { "guid",         CT_GUID,          0,               COL_NNUL | COL_PKEY, "guid" },
+    { "name",         CT_STRING,        MAX_NAME_LEN,    COL_NNUL,          "name" },
+    { "id",           CT_STRING,        MAX_ID_LEN,      COL_NNUL,          NULL, VENDOR_ID },
+    { "notes",        CT_STRING,        MAX_NOTES_LEN,   COL_NNUL,          NULL, VENDOR_NOTES },
+    {
+        "currency",     CT_COMMODITYREF,  0,               COL_NNUL,          NULL, NULL,
+        (QofAccessFunc)gncVendorGetCurrency, (QofSetterFunc)gncVendorSetCurrency
+    },
+    {
+        "active",       CT_BOOLEAN,       0,               COL_NNUL,          NULL, NULL,
+        (QofAccessFunc)gncVendorGetActive, (QofSetterFunc)gncVendorSetActive
+    },
+    { "tax_override", CT_BOOLEAN,       0,               COL_NNUL,          NULL, VENDOR_TAX_OVERRIDE },
+    { "addr",         CT_ADDRESS,       0,               0,                 NULL, VENDOR_ADDR },
+    { "terms",        CT_BILLTERMREF,   0,               0,                 NULL, VENDOR_TERMS },
+    { "tax_inc",      CT_STRING,        MAX_TAX_INC_LEN, 0,                 NULL, VENDOR_TAX_INC },
+    { "tax_table",    CT_TAXTABLEREF,   0,               0,                 NULL, VENDOR_TAX_TABLE },
+    { NULL }
 };
 
 static GncVendor*
 load_single_vendor( GncSqlBackend* be, GncSqlRow* row )
 {
     const GUID* guid;
-	GncVendor* pVendor;
+    GncVendor* pVendor;
 
-	g_return_val_if_fail( be != NULL, NULL );
-	g_return_val_if_fail( row != NULL, NULL );
+    g_return_val_if_fail( be != NULL, NULL );
+    g_return_val_if_fail( row != NULL, NULL );
 
     guid = gnc_sql_load_guid( be, row );
     pVendor = gncVendorLookup( be->primary_book, guid );
-    if( pVendor == NULL ) {
+    if ( pVendor == NULL )
+    {
         pVendor = gncVendorCreate( be->primary_book );
     }
     gnc_sql_load_object( be, row, GNC_ID_VENDOR, pVendor, col_table );
     qof_instance_mark_clean( QOF_INSTANCE(pVendor) );
 
-	return pVendor;
+    return pVendor;
 }
 
 static void
@@ -106,30 +111,34 @@
     GncSqlResult* result;
     QofBook* pBook;
 
-	g_return_if_fail( be != NULL );
+    g_return_if_fail( be != NULL );
 
     pBook = be->primary_book;
 
     stmt = gnc_sql_create_select_statement( be, TABLE_NAME );
     result = gnc_sql_execute_select_statement( be, stmt );
-	gnc_sql_statement_dispose( stmt );
-    if( result != NULL ) {
+    gnc_sql_statement_dispose( stmt );
+    if ( result != NULL )
+    {
         GncSqlRow* row;
-		GList* list = NULL;
+        GList* list = NULL;
 
-		row = gnc_sql_result_get_first_row( result );
-        while( row != NULL ) {
+        row = gnc_sql_result_get_first_row( result );
+        while ( row != NULL )
+        {
             GncVendor* pVendor = load_single_vendor( be, row );
-			if( pVendor != NULL ) {
-				list = g_list_append( list, pVendor );
-			}
-			row = gnc_sql_result_get_next_row( result );
-		}
-		gnc_sql_result_dispose( result );
+            if ( pVendor != NULL )
+            {
+                list = g_list_append( list, pVendor );
+            }
+            row = gnc_sql_result_get_next_row( result );
+        }
+        gnc_sql_result_dispose( result );
 
-		if( list != NULL ) {
-			gnc_sql_slots_load_for_list( be, list );
-		}
+        if ( list != NULL )
+        {
+            gnc_sql_slots_load_for_list( be, list );
+        }
     }
 }
 
@@ -137,12 +146,13 @@
 static void
 create_vendor_tables( GncSqlBackend* be )
 {
-	gint version;
+    gint version;
 
-	g_return_if_fail( be != NULL );
+    g_return_if_fail( be != NULL );
 
-	version = gnc_sql_get_table_version( be, TABLE_NAME );
-    if( version == 0 ) {
+    version = gnc_sql_get_table_version( be, TABLE_NAME );
+    if ( version == 0 )
+    {
         gnc_sql_create_table( be, TABLE_NAME, TABLE_VERSION, col_table );
     }
 }
@@ -153,43 +163,54 @@
 {
     GncVendor* v;
     const GUID* guid;
-	gint op;
-	gboolean is_infant;
-	gboolean is_ok = TRUE;
+    gint op;
+    gboolean is_infant;
+    gboolean is_ok = TRUE;
 
-	g_return_val_if_fail( inst != NULL, FALSE );
-	g_return_val_if_fail( GNC_IS_VENDOR(inst), FALSE );
-	g_return_val_if_fail( be != NULL, FALSE );
+    g_return_val_if_fail( inst != NULL, FALSE );
+    g_return_val_if_fail( GNC_IS_VENDOR(inst), FALSE );
+    g_return_val_if_fail( be != NULL, FALSE );
 
     v = GNC_VENDOR(inst);
 
-	is_infant = qof_instance_get_infant( inst );
-	if( qof_instance_get_destroying( inst ) ) {
-		op = OP_DB_DELETE;
-	} else if( be->is_pristine_db || is_infant ) {
-		op = OP_DB_INSERT;
-	} else {
-		op = OP_DB_UPDATE;
-	}
-	if( op != OP_DB_DELETE ) {
-    	// Ensure the commodity is in the db
-    	is_ok = gnc_sql_save_commodity( be, gncVendorGetCurrency( v ) );
-	}
-	if( is_ok ) {
-    	is_ok = gnc_sql_do_db_operation( be, op, TABLE_NAME, GNC_ID_VENDOR, v, col_table );
-	}
+    is_infant = qof_instance_get_infant( inst );
+    if ( qof_instance_get_destroying( inst ) )
+    {
+        op = OP_DB_DELETE;
+    }
+    else if ( be->is_pristine_db || is_infant )
+    {
+        op = OP_DB_INSERT;
+    }
+    else
+    {
+        op = OP_DB_UPDATE;
+    }
+    if ( op != OP_DB_DELETE )
+    {
+        // Ensure the commodity is in the db
+        is_ok = gnc_sql_save_commodity( be, gncVendorGetCurrency( v ) );
+    }
+    if ( is_ok )
+    {
+        is_ok = gnc_sql_do_db_operation( be, op, TABLE_NAME, GNC_ID_VENDOR, v, col_table );
+    }
 
-	if( is_ok ) {
-    	// Now, commit or delete any slots
-    	guid = qof_instance_get_guid( inst );
-    	if( !qof_instance_get_destroying(inst) ) {
-        	is_ok = gnc_sql_slots_save( be, guid, is_infant, qof_instance_get_slots( inst ) );
-    	} else {
-        	is_ok = gnc_sql_slots_delete( be, guid );
-    	}
-	}
+    if ( is_ok )
+    {
+        // Now, commit or delete any slots
+        guid = qof_instance_get_guid( inst );
+        if ( !qof_instance_get_destroying(inst) )
+        {
+            is_ok = gnc_sql_slots_save( be, guid, is_infant, qof_instance_get_slots( inst ) );
+        }
+        else
+        {
+            is_ok = gnc_sql_slots_delete( be, guid );
+        }
+    }
 
-	return is_ok;
+    return is_ok;
 }
 
 /* ================================================================= */
@@ -198,13 +219,14 @@
 {
     const char *id;
 
-	g_return_val_if_fail( vendor != NULL, FALSE );
+    g_return_val_if_fail( vendor != NULL, FALSE );
 
     /* make sure this is a valid vendor before we save it -- should have an ID */
     id = gncVendorGetID( vendor );
-    if( id == NULL || *id == '\0' ) {
+    if ( id == NULL || *id == '\0' )
+    {
         return FALSE;
-	}
+    }
 
     return TRUE;
 }
@@ -212,29 +234,30 @@
 static void
 write_single_vendor( QofInstance *term_p, gpointer data_p )
 {
-	write_objects_t* s = (write_objects_t*)data_p;
+    write_objects_t* s = (write_objects_t*)data_p;
 
-	g_return_if_fail( term_p != NULL );
-	g_return_if_fail( GNC_IS_VENDOR(term_p) );
-	g_return_if_fail( data_p != NULL );
+    g_return_if_fail( term_p != NULL );
+    g_return_if_fail( GNC_IS_VENDOR(term_p) );
+    g_return_if_fail( data_p != NULL );
 
-	if( s->is_ok && vendor_should_be_saved( GNC_VENDOR(term_p) ) ) {
-    	s->is_ok = save_vendor( s->be, term_p );
-	}
+    if ( s->is_ok && vendor_should_be_saved( GNC_VENDOR(term_p) ) )
+    {
+        s->is_ok = save_vendor( s->be, term_p );
+    }
 }
 
 static gboolean
 write_vendors( GncSqlBackend* be )
 {
-	write_objects_t data;
+    write_objects_t data;
 
-	g_return_val_if_fail( be != NULL, FALSE );
+    g_return_val_if_fail( be != NULL, FALSE );
 
-	data.be = be;
-	data.is_ok = TRUE;
+    data.be = be;
+    data.is_ok = TRUE;
     qof_object_foreach( GNC_ID_VENDOR, be->primary_book, write_single_vendor, &data );
 
-	return data.is_ok;
+    return data.is_ok;
 }
 
 /* ================================================================= */
@@ -248,8 +271,8 @@
         save_vendor,						/* commit */
         load_all_vendors,					/* initial_load */
         create_vendor_tables,				/* create_tables */
-		NULL, NULL, NULL,
-		write_vendors						/* write */
+        NULL, NULL, NULL,
+        write_vendors						/* write */
     };
 
     qof_object_register_backend( GNC_ID_VENDOR, GNC_SQL_BACKEND, &be_data );

Modified: gnucash/trunk/src/business/business-core/test/test-address.c
===================================================================
--- gnucash/trunk/src/business/business-core/test/test-address.c	2010-03-02 21:40:28 UTC (rev 18788)
+++ gnucash/trunk/src/business/business-core/test/test-address.c	2010-03-02 21:41:05 UTC (rev 18789)
@@ -1,7 +1,7 @@
 /*********************************************************************
  * test-address.c
  * object definition/initialization for Address
- * 
+ *
  * Copyright (c) 2001 Derek Atkins <warlord at MIT.EDU>
  * Copyright (c) 2005 Neil Williams <linux at codehelp.co.uk>
  *
@@ -32,67 +32,68 @@
 
 static void
 test_string_fcn (GncAddress *address, const char *message,
-		 void (*set) (GncAddress *, const char *str),
-		 const char * (*get)(const GncAddress *));
+                 void (*set) (GncAddress *, const char *str),
+                 const char * (*get)(const GncAddress *));
 
 static void
 test_address (void)
 {
-  QofInstance *ent;
-  GncAddress *address;
-  QofBook *book = qof_book_new ();
+    QofInstance *ent;
+    GncAddress *address;
+    QofBook *book = qof_book_new ();
 
-  ent = g_object_new(QOF_TYPE_INSTANCE, "guid", guid_null(), NULL);
-  ent->e_type = "asdf";
+    ent = g_object_new(QOF_TYPE_INSTANCE, "guid", guid_null(), NULL);
+    ent->e_type = "asdf";
 
-  /* Test creation/destruction */
-  {
-    do_test (gncAddressCreate (NULL,  NULL) == NULL, "address create NULL");
+    /* Test creation/destruction */
+    {
+        do_test (gncAddressCreate (NULL,  NULL) == NULL, "address create NULL");
 
-    address = gncAddressCreate (book, ent);
-    do_test (address != NULL, "address create");
+        address = gncAddressCreate (book, ent);
+        do_test (address != NULL, "address create");
 
-    gncAddressBeginEdit (address);
-    gncAddressDestroy (address);
-    success ("create/destroy");
-  }
+        gncAddressBeginEdit (address);
+        gncAddressDestroy (address);
+        success ("create/destroy");
+    }
 
-  /* Test setting routines */
-  {
-    address = gncAddressCreate (book, ent);
-    test_string_fcn (address, "Name", gncAddressSetName, gncAddressGetName);
-    test_string_fcn (address, "Addr1", gncAddressSetAddr1, gncAddressGetAddr1);
-    test_string_fcn (address, "Addr2", gncAddressSetAddr2, gncAddressGetAddr2);
-    test_string_fcn (address, "Addr3", gncAddressSetAddr3, gncAddressGetAddr3);
-    test_string_fcn (address, "Addr4", gncAddressSetAddr4, gncAddressGetAddr4);
-    test_string_fcn (address, "Phone", gncAddressSetPhone, gncAddressGetPhone);
-    test_string_fcn (address, "Fax", gncAddressSetFax, gncAddressGetFax);
-    test_string_fcn (address, "Email", gncAddressSetEmail, gncAddressGetEmail);
-  }
+    /* Test setting routines */
+    {
+        address = gncAddressCreate (book, ent);
+        test_string_fcn (address, "Name", gncAddressSetName, gncAddressGetName);
+        test_string_fcn (address, "Addr1", gncAddressSetAddr1, gncAddressGetAddr1);
+        test_string_fcn (address, "Addr2", gncAddressSetAddr2, gncAddressGetAddr2);
+        test_string_fcn (address, "Addr3", gncAddressSetAddr3, gncAddressGetAddr3);
+        test_string_fcn (address, "Addr4", gncAddressSetAddr4, gncAddressGetAddr4);
+        test_string_fcn (address, "Phone", gncAddressSetPhone, gncAddressGetPhone);
+        test_string_fcn (address, "Fax", gncAddressSetFax, gncAddressGetFax);
+        test_string_fcn (address, "Email", gncAddressSetEmail, gncAddressGetEmail);
+    }
 }
 
 static void
 test_string_fcn (GncAddress *address, const char *message,
-		 void (*set) (GncAddress *, const char *str),
-		 const char * (*get)(const GncAddress *))
+                 void (*set) (GncAddress *, const char *str),
+                 const char * (*get)(const GncAddress *))
 {
-  char const *str = get_random_string ();
+    char const *str = get_random_string ();
 
-  do_test (!gncAddressIsDirty (address), "test if start dirty");
-  set (address, str);
-  do_test (gncAddressIsDirty (address), "test dirty later");
-  do_test (safe_strcmp (get (address), str) == 0, message);
-  gncAddressClearDirty (address);
+    do_test (!gncAddressIsDirty (address), "test if start dirty");
+    set (address, str);
+    do_test (gncAddressIsDirty (address), "test dirty later");
+    do_test (safe_strcmp (get (address), str) == 0, message);
+    gncAddressClearDirty (address);
 }
 
 int
 main (int argc, char **argv)
 {
-	qof_init();
-	if(cashobjects_register()) {
-	test_address();
-	print_test_results();
-	}
-	qof_close();
-  return 0;
+    qof_init();
+    if (cashobjects_register())
+    {
+        test_address();
+        print_test_results();
+    }
+    qof_close();
+    return 0;
 }

Modified: gnucash/trunk/src/business/business-core/test/test-business.c
===================================================================
--- gnucash/trunk/src/business/business-core/test/test-business.c	2010-03-02 21:40:28 UTC (rev 18788)
+++ gnucash/trunk/src/business/business-core/test/test-business.c	2010-03-02 21:41:05 UTC (rev 18789)
@@ -1,7 +1,7 @@
 /*********************************************************************
  * test-business.c
  * Test the business code.
- * 
+ *
  * Copyright (c) 2001 Derek Atkins <warlord at MIT.EDU>
  *
  * This program is free software; you can redistribute it and/or
@@ -42,96 +42,97 @@
 static void test_printable (const char *name, gpointer obj);
 static void test_get_list (QofBook *, const char *);
 
-static GncBusinessObject bus_obj = {
-  GNC_BUSINESS_VERSION,
-  TEST_MODULE_NAME,
-  TEST_MODULE_DESC,
-  NULL,				/* create */
-  NULL,				/* destroy */
-  get_list,
-  printable,
+static GncBusinessObject bus_obj =
+{
+    GNC_BUSINESS_VERSION,
+    TEST_MODULE_NAME,
+    TEST_MODULE_DESC,
+    NULL,				/* create */
+    NULL,				/* destroy */
+    get_list,
+    printable,
 };
 
 static void test_business (void)
 {
-  /* Test the global registration and lookup functions */
-  {
-    do_test (!gncBusinessRegister (NULL), "register NULL");
-    do_test (gncBusinessRegister (&bus_obj), "register test object");
-    do_test (!gncBusinessRegister (&bus_obj), "register test object again");
-    do_test (gncBusinessLookup (TEST_MODULE_NAME) == &bus_obj,
-	     "lookup our installed object");
-    do_test (gncBusinessLookup ("snm98sn snml say  dyikh9y9ha") == NULL,
-	     "lookup non-existant business object");
+    /* Test the global registration and lookup functions */
+    {
+        do_test (!gncBusinessRegister (NULL), "register NULL");
+        do_test (gncBusinessRegister (&bus_obj), "register test object");
+        do_test (!gncBusinessRegister (&bus_obj), "register test object again");
+        do_test (gncBusinessLookup (TEST_MODULE_NAME) == &bus_obj,
+                 "lookup our installed object");
+        do_test (gncBusinessLookup ("snm98sn snml say  dyikh9y9ha") == NULL,
+                 "lookup non-existant business object");
 
-    do_test (!safe_strcmp (gncBusinessGetTypeLabel (TEST_MODULE_NAME),
-		      _(TEST_MODULE_DESC)),
-	     "test description return");
-  }
+        do_test (!safe_strcmp (gncBusinessGetTypeLabel (TEST_MODULE_NAME),
+                               _(TEST_MODULE_DESC)),
+                 "test description return");
+    }
 
-  test_get_list ((QofBook*)1, TEST_MODULE_NAME);
-  test_printable (TEST_MODULE_NAME, (gpointer)1);
+    test_get_list ((QofBook*)1, TEST_MODULE_NAME);
+    test_printable (TEST_MODULE_NAME, (gpointer)1);
 }
 
 static GList *
 get_list (QofBook *book, gboolean show_all)
 {
-  do_test (book != NULL, "get_list: NULL business");
-  success ("called get_list callback");
-  return ((GList *)1);
+    do_test (book != NULL, "get_list: NULL business");
+    success ("called get_list callback");
+    return ((GList *)1);
 }
 
 static const char *
 printable (gpointer obj)
 {
-  do_test (obj != NULL, "printable: object is NULL");
-  success ("called printable callback");
-  return ((const char *)obj);
+    do_test (obj != NULL, "printable: object is NULL");
+    success ("called printable callback");
+    return ((const char *)obj);
 }
 
 static void
 test_get_list (QofBook *book, const char *name)
 {
-  GList *res;
+    GList *res;
 
-  do_test (gncBusinessGetList (NULL, NULL, FALSE) == NULL,
-	   "business: GetList: NULL, NULL, FALSE");
-  do_test (gncBusinessGetList (NULL, name, FALSE) == NULL,
-	   "business: GetList: NULL, mod_name, FALSE");
-  do_test (gncBusinessGetList (book, NULL, FALSE) == NULL,
-	   "business: GetList: book, NULL, FALSE");
-  res = gncBusinessGetList (book, name, FALSE);
-  do_test (res != NULL, "business: GetList: book, mod_name, FALSE");
+    do_test (gncBusinessGetList (NULL, NULL, FALSE) == NULL,
+             "business: GetList: NULL, NULL, FALSE");
+    do_test (gncBusinessGetList (NULL, name, FALSE) == NULL,
+             "business: GetList: NULL, mod_name, FALSE");
+    do_test (gncBusinessGetList (book, NULL, FALSE) == NULL,
+             "business: GetList: book, NULL, FALSE");
+    res = gncBusinessGetList (book, name, FALSE);
+    do_test (res != NULL, "business: GetList: book, mod_name, FALSE");
 }
 
 static void
 test_printable (const char *name, gpointer obj)
 {
-  const char *res;
+    const char *res;
 
-  do_test (gncBusinessPrintable (NULL, NULL) == NULL,
-	   "business: Printable: NULL, NULL");
-  do_test (gncBusinessPrintable (NULL, obj) == NULL,
-	   "business: Printable: NULL, object");
-  do_test (gncBusinessPrintable (name, NULL) == NULL,
-	   "business: Printable: mod_name, NULL");
-  res = gncBusinessPrintable (name, obj);
-  do_test (res != NULL, "business: Printable: mod_name, object");
+    do_test (gncBusinessPrintable (NULL, NULL) == NULL,
+             "business: Printable: NULL, NULL");
+    do_test (gncBusinessPrintable (NULL, obj) == NULL,
+             "business: Printable: NULL, object");
+    do_test (gncBusinessPrintable (name, NULL) == NULL,
+             "business: Printable: mod_name, NULL");
+    res = gncBusinessPrintable (name, obj);
+    do_test (res != NULL, "business: Printable: mod_name, object");
 }
 
 static void
 main_helper (void *closure, int argc, char **argv)
 {
-  gnc_module_load("gnucash/business-core", 0);
-  test_business();
-  print_test_results();
-  exit(get_rv());
+    gnc_module_load("gnucash/business-core", 0);
+    test_business();
+    print_test_results();
+    exit(get_rv());
 }
 #endif
 
 int
 main (int argc, char **argv)
 {
-  //  scm_boot_guile (argc, argv, main_helper, NULL);
-  return 0;
+    //  scm_boot_guile (argc, argv, main_helper, NULL);
+    return 0;
 }

Modified: gnucash/trunk/src/business/business-core/test/test-customer.c
===================================================================
--- gnucash/trunk/src/business/business-core/test/test-customer.c	2010-03-02 21:40:28 UTC (rev 18788)
+++ gnucash/trunk/src/business/business-core/test/test-customer.c	2010-03-02 21:41:05 UTC (rev 18789)
@@ -1,7 +1,7 @@
 /*********************************************************************
  * test-customer.c
  * Test the customer object (without Guile/Scheme)
- * 
+ *
  * Copyright (c) 2001 Derek Atkins <warlord at MIT.EDU>
  * Copyright (c) 2005 Neil Williams <linux at codehelp.co.uk>
  *
@@ -37,184 +37,185 @@
 
 static void
 test_string_fcn (QofBook *book, const char *message,
-		 void (*set) (GncCustomer *, const char *str),
-		 const char * (*get)(const GncCustomer *));
+                 void (*set) (GncCustomer *, const char *str),
+                 const char * (*get)(const GncCustomer *));
 
 static void
 test_numeric_fcn (QofBook *book, const char *message,
-		  void (*set) (GncCustomer *, gnc_numeric),
-		  gnc_numeric (*get)(const GncCustomer *));
+                  void (*set) (GncCustomer *, gnc_numeric),
+                  gnc_numeric (*get)(const GncCustomer *));
 
 static void
 test_bool_fcn (QofBook *book, const char *message,
-		  void (*set) (GncCustomer *, gboolean),
-		  gboolean (*get) (const GncCustomer *));
+               void (*set) (GncCustomer *, gboolean),
+               gboolean (*get) (const GncCustomer *));
 
 static void
 test_customer (void)
 {
-  QofBackend *be;
-  QofSession *session;
-  QofBook *book;
-  GncCustomer *customer;
+    QofBackend *be;
+    QofSession *session;
+    QofBook *book;
+    GncCustomer *customer;
 
-  session = qof_session_new();
-  be = NULL;
-  qof_session_begin(session, QOF_STDOUT, FALSE, FALSE);
-  book = qof_session_get_book(session);
-  be = qof_book_get_backend(book);
+    session = qof_session_new();
+    be = NULL;
+    qof_session_begin(session, QOF_STDOUT, FALSE, FALSE);
+    book = qof_session_get_book(session);
+    be = qof_book_get_backend(book);
 
-  /* The book *must* have a backend to pass the test of the 'dirty' flag 
-  so use a session to use the default QSF. However, until the SQL backend can be used, 
-  entities remain dirty until the session is saved or closed. */
-  do_test (be != NULL, "qsf backend could not be set");
+    /* The book *must* have a backend to pass the test of the 'dirty' flag
+    so use a session to use the default QSF. However, until the SQL backend can be used,
+    entities remain dirty until the session is saved or closed. */
+    do_test (be != NULL, "qsf backend could not be set");
 
-  /* Test creation/destruction */
-  {
-    do_test (gncCustomerCreate (NULL) == NULL, "customer create NULL");
-    customer = gncCustomerCreate (book);
-    do_test (customer != NULL, "customer create");
-    do_test (gncCustomerGetBook (customer) == book, "getbook");
+    /* Test creation/destruction */
+    {
+        do_test (gncCustomerCreate (NULL) == NULL, "customer create NULL");
+        customer = gncCustomerCreate (book);
+        do_test (customer != NULL, "customer create");
+        do_test (gncCustomerGetBook (customer) == book, "getbook");
 
-    gncCustomerBeginEdit (customer);
-    gncCustomerDestroy (customer);
-    success ("create/destroy");
-  }
+        gncCustomerBeginEdit (customer);
+        gncCustomerDestroy (customer);
+        success ("create/destroy");
+    }
 
-  /* Test setting/getting routines; does the active flag get set right? */
-  {
-    GUID guid;
+    /* Test setting/getting routines; does the active flag get set right? */
+    {
+        GUID guid;
 
-    test_string_fcn (book, "Id", gncCustomerSetID, gncCustomerGetID);
-    test_string_fcn (book, "Name", gncCustomerSetName, gncCustomerGetName);
-    test_string_fcn (book, "Notes", gncCustomerSetNotes, gncCustomerGetNotes);
+        test_string_fcn (book, "Id", gncCustomerSetID, gncCustomerGetID);
+        test_string_fcn (book, "Name", gncCustomerSetName, gncCustomerGetName);
+        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, "Credit", gncCustomerSetCredit, gncCustomerGetCredit);
+        test_numeric_fcn (book, "Discount", gncCustomerSetDiscount, gncCustomerGetDiscount);
+        test_numeric_fcn (book, "Credit", gncCustomerSetCredit, gncCustomerGetCredit);
 
-    test_bool_fcn (book, "Active", gncCustomerSetActive, gncCustomerGetActive);
+        test_bool_fcn (book, "Active", gncCustomerSetActive, gncCustomerGetActive);
 
-    do_test (gncCustomerGetAddr (customer) != NULL, "Addr");
-    do_test (gncCustomerGetShipAddr (customer) != NULL, "ShipAddr");
+        do_test (gncCustomerGetAddr (customer) != NULL, "Addr");
+        do_test (gncCustomerGetShipAddr (customer) != NULL, "ShipAddr");
 
-    guid_new (&guid);
-    customer = gncCustomerCreate (book); count++;
-    gncCustomerSetGUID (customer, &guid);
-    do_test (guid_equal (&guid, gncCustomerGetGUID (customer)), "guid compare");
-  }
+        guid_new (&guid);
+        customer = gncCustomerCreate (book);
+        count++;
+        gncCustomerSetGUID (customer, &guid);
+        do_test (guid_equal (&guid, gncCustomerGetGUID (customer)), "guid compare");
+    }
 #if 0
-  {
-    GList *list;
+    {
+        GList *list;
 
-    list = gncBusinessGetList (book, GNC_ID_CUSTOMER, TRUE);
-    do_test (list != NULL, "getList all");
-    do_test (g_list_length (list) == count, "correct length: all");
-    g_list_free (list);
+        list = gncBusinessGetList (book, GNC_ID_CUSTOMER, TRUE);
+        do_test (list != NULL, "getList all");
+        do_test (g_list_length (list) == count, "correct length: all");
+        g_list_free (list);
 
-    list = gncBusinessGetList (book, GNC_ID_CUSTOMER, FALSE);
-    do_test (list != NULL, "getList active");
-    do_test (g_list_length (list) == 1, "correct length: active");
-    g_list_free (list);
-  }
+        list = gncBusinessGetList (book, GNC_ID_CUSTOMER, FALSE);
+        do_test (list != NULL, "getList active");
+        do_test (g_list_length (list) == 1, "correct length: active");
+        g_list_free (list);
+    }
 #endif
-  {
-    const char *str = get_random_string();
-    const char *res;
+    {
+        const char *str = get_random_string();
+        const char *res;
 
-    res = NULL;
-    gncCustomerBeginEdit(customer);
-    gncCustomerSetName (customer, str);
-    gncCustomerCommitEdit(customer);
-    res = qof_object_printable (GNC_ID_CUSTOMER, customer);
-    do_test (res != NULL, "Printable NULL?");
-    do_test (safe_strcmp (str, res) == 0, "Printable equals");
-  }    
+        res = NULL;
+        gncCustomerBeginEdit(customer);
+        gncCustomerSetName (customer, str);
+        gncCustomerCommitEdit(customer);
+        res = qof_object_printable (GNC_ID_CUSTOMER, customer);
+        do_test (res != NULL, "Printable NULL?");
+        do_test (safe_strcmp (str, res) == 0, "Printable equals");
+    }
 
-  do_test (gncCustomerGetJoblist (customer, TRUE) == NULL, "joblist empty");
+    do_test (gncCustomerGetJoblist (customer, TRUE) == NULL, "joblist empty");
 
-  /* Test the Entity Table */
-  {
-    const GUID *guid;
+    /* Test the Entity Table */
+    {
+        const GUID *guid;
 
-    guid = gncCustomerGetGUID (customer);
-    do_test (gncCustomerLookup (book, guid) == customer, "Entity Table");
-  }
+        guid = gncCustomerGetGUID (customer);
+        do_test (gncCustomerLookup (book, guid) == customer, "Entity Table");
+    }
 
-  /* Note: JobList is tested from the Job tests */
-  qof_session_end(session);
+    /* Note: JobList is tested from the Job tests */
+    qof_session_end(session);
 }
 
 static void
 test_string_fcn (QofBook *book, const char *message,
-		 void (*set) (GncCustomer *, const char *str),
-		 const char * (*get)(const GncCustomer *))
+                 void (*set) (GncCustomer *, const char *str),
+                 const char * (*get)(const GncCustomer *))
 {
-  GncCustomer *customer = gncCustomerCreate (book);
-  char const *str = get_random_string ();
+    GncCustomer *customer = gncCustomerCreate (book);
+    char const *str = get_random_string ();
 
-  do_test (!gncCustomerIsDirty (customer), "test if start dirty");
-  gncCustomerBeginEdit (customer);
-  set (customer, str);
-  do_test (gncCustomerIsDirty (customer), "test dirty later");
-  gncCustomerCommitEdit (customer);
-  do_test (gncCustomerIsDirty (customer), "test dirty after commit");
-  do_test (safe_strcmp (get (customer), str) == 0, message);
-  gncCustomerSetActive (customer, FALSE);
-  count++;
+    do_test (!gncCustomerIsDirty (customer), "test if start dirty");
+    gncCustomerBeginEdit (customer);
+    set (customer, str);
+    do_test (gncCustomerIsDirty (customer), "test dirty later");
+    gncCustomerCommitEdit (customer);
+    do_test (gncCustomerIsDirty (customer), "test dirty after commit");
+    do_test (safe_strcmp (get (customer), str) == 0, message);
+    gncCustomerSetActive (customer, FALSE);
+    count++;
 }
 
 static void
 test_numeric_fcn (QofBook *book, const char *message,
-		  void (*set) (GncCustomer *, gnc_numeric),
-		  gnc_numeric (*get)(const GncCustomer *))
+                  void (*set) (GncCustomer *, gnc_numeric),
+                  gnc_numeric (*get)(const GncCustomer *))
 {
-  GncCustomer *customer = gncCustomerCreate (book);
-  gnc_numeric num = gnc_numeric_create (17, 1);
+    GncCustomer *customer = gncCustomerCreate (book);
+    gnc_numeric num = gnc_numeric_create (17, 1);
 
-  do_test (!gncCustomerIsDirty (customer), "test if start dirty");
-  gncCustomerBeginEdit (customer);
-  set (customer, num);
-  do_test (gncCustomerIsDirty (customer), "test dirty later");
-  gncCustomerCommitEdit (customer);
-  do_test (gncCustomerIsDirty (customer), "test dirty after commit");
-  do_test (gnc_numeric_equal (get (customer), num), message);
-  gncCustomerSetActive (customer, FALSE);
-  count++;
+    do_test (!gncCustomerIsDirty (customer), "test if start dirty");
+    gncCustomerBeginEdit (customer);
+    set (customer, num);
+    do_test (gncCustomerIsDirty (customer), "test dirty later");
+    gncCustomerCommitEdit (customer);
+    do_test (gncCustomerIsDirty (customer), "test dirty after commit");
+    do_test (gnc_numeric_equal (get (customer), num), message);
+    gncCustomerSetActive (customer, FALSE);
+    count++;
 }
 
 static void
 test_bool_fcn (QofBook *book, const char *message,
-	       void (*set) (GncCustomer *, gboolean),
-	       gboolean (*get) (const GncCustomer *))
+               void (*set) (GncCustomer *, gboolean),
+               gboolean (*get) (const GncCustomer *))
 {
-  GncCustomer *customer = gncCustomerCreate (book);
-  gboolean num = get_random_boolean ();
+    GncCustomer *customer = gncCustomerCreate (book);
+    gboolean num = get_random_boolean ();
 
-  do_test (!gncCustomerIsDirty (customer), "test if start dirty");
-  gncCustomerBeginEdit (customer);
-  set (customer, FALSE);
-  set (customer, TRUE);
-  set (customer, num);
-  do_test (gncCustomerIsDirty (customer), "test dirty later");
-  gncCustomerCommitEdit (customer);
-  do_test (gncCustomerIsDirty (customer), "test dirty after commit");
-  do_test (get (customer) == num, message);
-  gncCustomerSetActive (customer, FALSE);
-  count++;
+    do_test (!gncCustomerIsDirty (customer), "test if start dirty");
+    gncCustomerBeginEdit (customer);
+    set (customer, FALSE);
+    set (customer, TRUE);
+    set (customer, num);
+    do_test (gncCustomerIsDirty (customer), "test dirty later");
+    gncCustomerCommitEdit (customer);
+    do_test (gncCustomerIsDirty (customer), "test dirty after commit");
+    do_test (get (customer) == num, message);
+    gncCustomerSetActive (customer, FALSE);
+    count++;
 }
 
 int
 main (int argc, char **argv)
 {
-  qof_init();
-  do_test (cashobjects_register(), "Cannot register cash objects");
-  do_test (gncInvoiceRegister(), "Cannot register GncInvoice");
-  do_test (gncJobRegister (),  "Cannot register GncJob");
-  do_test (gncCustomerRegister(), "Cannot register GncCustomer");
-  test_customer();
-  print_test_results();
-  qof_close ();
-  return 0;
+    qof_init();
+    do_test (cashobjects_register(), "Cannot register cash objects");
+    do_test (gncInvoiceRegister(), "Cannot register GncInvoice");
+    do_test (gncJobRegister (),  "Cannot register GncJob");
+    do_test (gncCustomerRegister(), "Cannot register GncCustomer");
+    test_customer();
+    print_test_results();
+    qof_close ();
+    return 0;
 }

Modified: gnucash/trunk/src/business/business-core/test/test-employee.c
===================================================================
--- gnucash/trunk/src/business/business-core/test/test-employee.c	2010-03-02 21:40:28 UTC (rev 18788)
+++ gnucash/trunk/src/business/business-core/test/test-employee.c	2010-03-02 21:41:05 UTC (rev 18789)
@@ -1,7 +1,7 @@
 /*********************************************************************
  * test-employee.c
  * Test the employee object (without Guile).
- * 
+ *
  * Copyright (c) 2001 Derek Atkins <warlord at MIT.EDU>
  * Copyright (c) 2005 Neil Williams <linux at codehelp.co.uk>
  *
@@ -37,194 +37,195 @@
 
 static void
 test_string_fcn (QofBook *book, const char *message,
-		 void (*set) (GncEmployee *, const char *str),
-		 const char * (*get)(const GncEmployee *));
+                 void (*set) (GncEmployee *, const char *str),
+                 const char * (*get)(const GncEmployee *));
 
 static void
 test_numeric_fcn (QofBook *book, const char *message,
-		  void (*set) (GncEmployee *, gnc_numeric),
-		  gnc_numeric (*get)(const GncEmployee *));
+                  void (*set) (GncEmployee *, gnc_numeric),
+                  gnc_numeric (*get)(const GncEmployee *));
 
 static void
 test_bool_fcn (QofBook *book, const char *message,
-		  void (*set) (GncEmployee *, gboolean),
-		  gboolean (*get) (const GncEmployee *));
+               void (*set) (GncEmployee *, gboolean),
+               gboolean (*get) (const GncEmployee *));
 
 #if 0
 static void
 test_gint_fcn (QofBook *book, const char *message,
-	       void (*set) (GncEmployee *, gint),
-	       gint (*get) (GncEmployee *));
+               void (*set) (GncEmployee *, gint),
+               gint (*get) (GncEmployee *));
 #endif
 
 static void
 test_employee (void)
 {
-  QofBackend *be;
-  QofBook *book;
-  QofSession *session;
-  GncEmployee *employee;
+    QofBackend *be;
+    QofBook *book;
+    QofSession *session;
+    GncEmployee *employee;
 
-  session = qof_session_new();
-  qof_session_begin(session, QOF_STDOUT, FALSE, FALSE);
-  book = qof_session_get_book(session);
-  /* The book *must* have a backend to pass the test of the 'dirty' flag */
-  /* See the README file for details */
-  
-  be = qof_book_get_backend (book);
+    session = qof_session_new();
+    qof_session_begin(session, QOF_STDOUT, FALSE, FALSE);
+    book = qof_session_get_book(session);
+    /* The book *must* have a backend to pass the test of the 'dirty' flag */
+    /* See the README file for details */
 
-  /* Test creation/destruction */
-  {
-    do_test (gncEmployeeCreate (NULL) == NULL, "employee create NULL");
-    employee = gncEmployeeCreate (book);
-    do_test (employee != NULL, "employee create");
-    do_test (qof_instance_get_book(QOF_INSTANCE(employee)) == book,
-	     "getbook");
+    be = qof_book_get_backend (book);
 
-    gncEmployeeBeginEdit (employee);
-    gncEmployeeDestroy (employee);
-    success ("create/destroy");
-  }
+    /* Test creation/destruction */
+    {
+        do_test (gncEmployeeCreate (NULL) == NULL, "employee create NULL");
+        employee = gncEmployeeCreate (book);
+        do_test (employee != NULL, "employee create");
+        do_test (qof_instance_get_book(QOF_INSTANCE(employee)) == book,
+                 "getbook");
 
-  /* Test setting/getting routines; does the active flag get set right? */
-  {
-    GUID guid;
+        gncEmployeeBeginEdit (employee);
+        gncEmployeeDestroy (employee);
+        success ("create/destroy");
+    }
 
-    test_string_fcn (book, "Id", gncEmployeeSetID, gncEmployeeGetID);
-    test_string_fcn (book, "Username", gncEmployeeSetUsername, gncEmployeeGetUsername);
-    test_string_fcn (book, "Language", gncEmployeeSetLanguage, gncEmployeeGetLanguage);
-    test_string_fcn (book, "Acl", gncEmployeeSetAcl, gncEmployeeGetAcl);
+    /* Test setting/getting routines; does the active flag get set right? */
+    {
+        GUID guid;
 
-    test_numeric_fcn (book, "Workday", gncEmployeeSetWorkday, gncEmployeeGetWorkday);
-    test_numeric_fcn (book, "Rate", gncEmployeeSetRate, gncEmployeeGetRate);
+        test_string_fcn (book, "Id", gncEmployeeSetID, gncEmployeeGetID);
+        test_string_fcn (book, "Username", gncEmployeeSetUsername, gncEmployeeGetUsername);
+        test_string_fcn (book, "Language", gncEmployeeSetLanguage, gncEmployeeGetLanguage);
+        test_string_fcn (book, "Acl", gncEmployeeSetAcl, gncEmployeeGetAcl);
 
-    test_bool_fcn (book, "Active", gncEmployeeSetActive, gncEmployeeGetActive);
+        test_numeric_fcn (book, "Workday", gncEmployeeSetWorkday, gncEmployeeGetWorkday);
+        test_numeric_fcn (book, "Rate", gncEmployeeSetRate, gncEmployeeGetRate);
 
-    do_test (gncEmployeeGetAddr (employee) != NULL, "Addr");
+        test_bool_fcn (book, "Active", gncEmployeeSetActive, gncEmployeeGetActive);
 
-    guid_new (&guid);
-    employee = gncEmployeeCreate (book); count++;
-    gncEmployeeSetGUID (employee, &guid);
-    do_test (guid_equal (&guid, qof_instance_get_guid(QOF_INSTANCE(employee))), "guid compare");
-  }
+        do_test (gncEmployeeGetAddr (employee) != NULL, "Addr");
+
+        guid_new (&guid);
+        employee = gncEmployeeCreate (book);
+        count++;
+        gncEmployeeSetGUID (employee, &guid);
+        do_test (guid_equal (&guid, qof_instance_get_guid(QOF_INSTANCE(employee))), "guid compare");
+    }
 #if 0
-  {
-    GList *list;
+    {
+        GList *list;
 
-    list = gncBusinessGetList (book, GNC_EMPLOYEE_MODULE_NAME, TRUE);
-    do_test (list != NULL, "getList all");
-    do_test (g_list_length (list) == count, "correct length: all");
-    g_list_free (list);
+        list = gncBusinessGetList (book, GNC_EMPLOYEE_MODULE_NAME, TRUE);
+        do_test (list != NULL, "getList all");
+        do_test (g_list_length (list) == count, "correct length: all");
+        g_list_free (list);
 
-    list = gncBusinessGetList (book, GNC_EMPLOYEE_MODULE_NAME, FALSE);
-    do_test (list != NULL, "getList active");
-    do_test (g_list_length (list) == 1, "correct length: active");
-    g_list_free (list);
-  }
+        list = gncBusinessGetList (book, GNC_EMPLOYEE_MODULE_NAME, FALSE);
+        do_test (list != NULL, "getList active");
+        do_test (g_list_length (list) == 1, "correct length: active");
+        g_list_free (list);
+    }
 #endif
-  {
-    const char *str = get_random_string();
-    const char *res;
-    GncAddress *addr;
+    {
+        const char *str = get_random_string();
+        const char *res;
+        GncAddress *addr;
 
-    addr = gncEmployeeGetAddr (employee);
-    gncAddressSetName (addr, str);
-    res = qof_object_printable (GNC_ID_EMPLOYEE, employee);
-    do_test (res != NULL, "Printable NULL?");
-    do_test (safe_strcmp (str, res) == 0, "Printable equals");
-  }    
+        addr = gncEmployeeGetAddr (employee);
+        gncAddressSetName (addr, str);
+        res = qof_object_printable (GNC_ID_EMPLOYEE, employee);
+        do_test (res != NULL, "Printable NULL?");
+        do_test (safe_strcmp (str, res) == 0, "Printable equals");
+    }
 }
 
 static void
 test_string_fcn (QofBook *book, const char *message,
-		 void (*set) (GncEmployee *, const char *str),
-		 const char * (*get)(const GncEmployee *))
+                 void (*set) (GncEmployee *, const char *str),
+                 const char * (*get)(const GncEmployee *))
 {
-  GncEmployee *employee = gncEmployeeCreate (book);
-  char const *str = get_random_string ();
+    GncEmployee *employee = gncEmployeeCreate (book);
+    char const *str = get_random_string ();
 
-  do_test (!gncEmployeeIsDirty (employee), "test if start dirty");
-  gncEmployeeBeginEdit (employee);
-  set (employee, str);
-  do_test (gncEmployeeIsDirty (employee), "test dirty later");
-  gncEmployeeCommitEdit (employee);
-  do_test (gncEmployeeIsDirty (employee), "test dirty after commit");
-  do_test (safe_strcmp (get (employee), str) == 0, message);
-  gncEmployeeSetActive (employee, FALSE);
-  count++;
+    do_test (!gncEmployeeIsDirty (employee), "test if start dirty");
+    gncEmployeeBeginEdit (employee);
+    set (employee, str);
+    do_test (gncEmployeeIsDirty (employee), "test dirty later");
+    gncEmployeeCommitEdit (employee);
+    do_test (gncEmployeeIsDirty (employee), "test dirty after commit");
+    do_test (safe_strcmp (get (employee), str) == 0, message);
+    gncEmployeeSetActive (employee, FALSE);
+    count++;
 }
 
 static void
 test_numeric_fcn (QofBook *book, const char *message,
-		  void (*set) (GncEmployee *, gnc_numeric),
-		  gnc_numeric (*get)(const GncEmployee *))
+                  void (*set) (GncEmployee *, gnc_numeric),
+                  gnc_numeric (*get)(const GncEmployee *))
 {
-  GncEmployee *employee = gncEmployeeCreate (book);
-  gnc_numeric num = gnc_numeric_create (17, 1);
+    GncEmployee *employee = gncEmployeeCreate (book);
+    gnc_numeric num = gnc_numeric_create (17, 1);
 
-  do_test (!gncEmployeeIsDirty (employee), "test if start dirty");
-  gncEmployeeBeginEdit (employee);
-  set (employee, num);
-  do_test (gncEmployeeIsDirty (employee), "test dirty later");
-  gncEmployeeCommitEdit (employee);
-  do_test (gncEmployeeIsDirty (employee), "test dirty after commit");
-  do_test (gnc_numeric_equal (get (employee), num), message);
-  gncEmployeeSetActive (employee, FALSE);
-  count++;
+    do_test (!gncEmployeeIsDirty (employee), "test if start dirty");
+    gncEmployeeBeginEdit (employee);
+    set (employee, num);
+    do_test (gncEmployeeIsDirty (employee), "test dirty later");
+    gncEmployeeCommitEdit (employee);
+    do_test (gncEmployeeIsDirty (employee), "test dirty after commit");
+    do_test (gnc_numeric_equal (get (employee), num), message);
+    gncEmployeeSetActive (employee, FALSE);
+    count++;
 }
 
 static void
 test_bool_fcn (QofBook *book, const char *message,
-	       void (*set) (GncEmployee *, gboolean),
-	       gboolean (*get) (const GncEmployee *))
+               void (*set) (GncEmployee *, gboolean),
+               gboolean (*get) (const GncEmployee *))
 {
-  GncEmployee *employee = gncEmployeeCreate (book);
-  gboolean num = get_random_boolean ();
+    GncEmployee *employee = gncEmployeeCreate (book);
+    gboolean num = get_random_boolean ();
 
-  do_test (!gncEmployeeIsDirty (employee), "test if start dirty");
-  gncEmployeeBeginEdit (employee);
-  set (employee, FALSE);
-  set (employee, TRUE);
-  set (employee, num);
-  do_test (gncEmployeeIsDirty (employee), "test dirty later");
-  gncEmployeeCommitEdit (employee);
-  do_test (gncEmployeeIsDirty (employee), "test dirty after commit");
-  do_test (get (employee) == num, message);
-  gncEmployeeSetActive (employee, FALSE);
-  count++;
+    do_test (!gncEmployeeIsDirty (employee), "test if start dirty");
+    gncEmployeeBeginEdit (employee);
+    set (employee, FALSE);
+    set (employee, TRUE);
+    set (employee, num);
+    do_test (gncEmployeeIsDirty (employee), "test dirty later");
+    gncEmployeeCommitEdit (employee);
+    do_test (gncEmployeeIsDirty (employee), "test dirty after commit");
+    do_test (get (employee) == num, message);
+    gncEmployeeSetActive (employee, FALSE);
+    count++;
 }
 
 #if 0
 static void
 test_gint_fcn (QofBook *book, const char *message,
-	       void (*set) (GncEmployee *, gint),
-	       gint (*get) (GncEmployee *))
+               void (*set) (GncEmployee *, gint),
+               gint (*get) (GncEmployee *))
 {
-  GncEmployee *employee = gncEmployeeCreate (book);
-  gint num = 17;
+    GncEmployee *employee = gncEmployeeCreate (book);
+    gint num = 17;
 
-  do_test (!gncEmployeeIsDirty (employee), "test if start dirty");
-  gncEmployeeBeginEdit (employee);
-  set (employee, num);
-  do_test (gncEmployeeIsDirty (employee), "test dirty later");
-  gncEmployeeCommitEdit (employee);
-  do_test (!gncEmployeeIsDirty (employee), "test dirty after commit");
-  do_test (get (employee) == num, message);
-  gncEmployeeSetActive (employee, FALSE);
-  count++;
+    do_test (!gncEmployeeIsDirty (employee), "test if start dirty");
+    gncEmployeeBeginEdit (employee);
+    set (employee, num);
+    do_test (gncEmployeeIsDirty (employee), "test dirty later");
+    gncEmployeeCommitEdit (employee);
+    do_test (!gncEmployeeIsDirty (employee), "test dirty after commit");
+    do_test (get (employee) == num, message);
+    gncEmployeeSetActive (employee, FALSE);
+    count++;
 }
 #endif
 
 int
 main (int argc, char **argv)
-{ 
-  qof_init();
-  do_test (gncInvoiceRegister(), "Cannot register GncInvoice");
-  do_test (gncJobRegister (),  "Cannot register GncJob");
-  do_test (gncCustomerRegister(), "Cannot register GncCustomer");
-  do_test (gncEmployeeRegister(), "Cannot register GncEmployee");
-  test_employee();
-  print_test_results();
-  qof_close();
-  return 0;
+{
+    qof_init();
+    do_test (gncInvoiceRegister(), "Cannot register GncInvoice");
+    do_test (gncJobRegister (),  "Cannot register GncJob");
+    do_test (gncCustomerRegister(), "Cannot register GncCustomer");
+    do_test (gncEmployeeRegister(), "Cannot register GncEmployee");
+    test_employee();
+    print_test_results();
+    qof_close();
+    return 0;
 }

Modified: gnucash/trunk/src/business/business-core/test/test-job.c
===================================================================
--- gnucash/trunk/src/business/business-core/test/test-job.c	2010-03-02 21:40:28 UTC (rev 18788)
+++ gnucash/trunk/src/business/business-core/test/test-job.c	2010-03-02 21:41:05 UTC (rev 18789)
@@ -1,7 +1,7 @@
 /*********************************************************************
  * test-job.c
  * Test the job object.
- * 
+ *
  * Copyright (c) 2001 Derek Atkins <warlord at MIT.EDU>
  * Copyright (c) 2005 Neil Williams <linux at codehelp.co.uk>
  *
@@ -37,211 +37,216 @@
 
 static void
 test_string_fcn (QofBook *book, const char *message,
-		 void (*set) (GncJob *, const char *str),
-		 const char * (*get)(const GncJob *));
+                 void (*set) (GncJob *, const char *str),
+                 const char * (*get)(const GncJob *));
 
 #if 0
 static void
 test_numeric_fcn (QofBook *book, const char *message,
-		  void (*set) (GncJob *, gnc_numeric),
-		  gnc_numeric (*get)(const GncJob *));
+                  void (*set) (GncJob *, gnc_numeric),
+                  gnc_numeric (*get)(const GncJob *));
 #endif
 
 static void
 test_bool_fcn (QofBook *book, const char *message,
-		  void (*set) (GncJob *, gboolean),
-		  gboolean (*get) (const GncJob *));
+               void (*set) (GncJob *, gboolean),
+               gboolean (*get) (const GncJob *));
 
 #if 0
 static void
 test_gint_fcn (QofBook *book, const char *message,
-	       void (*set) (GncJob *, gint),
-	       gint (*get) (const GncJob *));
+               void (*set) (GncJob *, gint),
+               gint (*get) (const GncJob *));
 #endif
 
 static void
 test_job (void)
 {
-  QofBackend *be;
-  QofSession *session;
-  QofBook *book;
-  GncJob *job;
+    QofBackend *be;
+    QofSession *session;
+    QofBook *book;
+    GncJob *job;
 
-  session = qof_session_new();
-  be = NULL;
-  qof_session_begin(session, QOF_STDOUT, FALSE, FALSE);
-  book = qof_session_get_book (session);
-  be = qof_book_get_backend(book);
+    session = qof_session_new();
+    be = NULL;
+    qof_session_begin(session, QOF_STDOUT, FALSE, FALSE);
+    book = qof_session_get_book (session);
+    be = qof_book_get_backend(book);
 
-  /* The book *must* have a backend to pass the test of the 'dirty' flag */
-  /* See the README file for details */
-  do_test (be != NULL, "qsf backend could not be set");
+    /* The book *must* have a backend to pass the test of the 'dirty' flag */
+    /* See the README file for details */
+    do_test (be != NULL, "qsf backend could not be set");
 
-  /* Test creation/destruction */
-  {
-    do_test (gncJobCreate (NULL) == NULL, "job create NULL");
-    job = gncJobCreate (book);
-    do_test (job != NULL, "job create");
-    do_test (qof_instance_get_book(QOF_INSTANCE(job)) == book,
-	     "getbook");
+    /* Test creation/destruction */
+    {
+        do_test (gncJobCreate (NULL) == NULL, "job create NULL");
+        job = gncJobCreate (book);
+        do_test (job != NULL, "job create");
+        do_test (qof_instance_get_book(QOF_INSTANCE(job)) == book,
+                 "getbook");
 
-    gncJobBeginEdit (job);
-    gncJobDestroy (job);
-    success ("create/destroy");
-  }
+        gncJobBeginEdit (job);
+        gncJobDestroy (job);
+        success ("create/destroy");
+    }
 
-  /* Test setting/getting routines; does the active flag get set right? */
-  {
-    GUID guid;
+    /* Test setting/getting routines; does the active flag get set right? */
+    {
+        GUID guid;
 
-    test_string_fcn (book, "Id", gncJobSetID, gncJobGetID);
-    test_string_fcn (book, "Name", gncJobSetName, gncJobGetName);
-    test_string_fcn (book, "Reference", gncJobSetReference, gncJobGetReference);
+        test_string_fcn (book, "Id", gncJobSetID, gncJobGetID);
+        test_string_fcn (book, "Name", gncJobSetName, gncJobGetName);
+        test_string_fcn (book, "Reference", gncJobSetReference, gncJobGetReference);
 
-    test_bool_fcn (book, "Active", gncJobSetActive, gncJobGetActive);
+        test_bool_fcn (book, "Active", gncJobSetActive, gncJobGetActive);
 
-    guid_new (&guid);
-    job = gncJobCreate (book); count++;
-    gncJobSetGUID (job, &guid);
-    do_test (guid_equal (&guid, qof_instance_get_guid(QOF_INSTANCE(job))), "guid compare");
-  }
+        guid_new (&guid);
+        job = gncJobCreate (book);
+        count++;
+        gncJobSetGUID (job, &guid);
+        do_test (guid_equal (&guid, qof_instance_get_guid(QOF_INSTANCE(job))), "guid compare");
+    }
 #if 0
-  {
-    GList *list;
+    {
+        GList *list;
 
-    list = gncBusinessGetList (book, GNC_ID_JOB, TRUE);
-    do_test (list != NULL, "getList all");
-    do_test (g_list_length (list) == count, "correct length: all");
-    g_list_free (list);
+        list = gncBusinessGetList (book, GNC_ID_JOB, TRUE);
+        do_test (list != NULL, "getList all");
+        do_test (g_list_length (list) == count, "correct length: all");
+        g_list_free (list);
 
-    list = gncBusinessGetList (book, GNC_ID_JOB, FALSE);
-    do_test (list != NULL, "getList active");
-    do_test (g_list_length (list) == 1, "correct length: active");
-    g_list_free (list);
-  }
+        list = gncBusinessGetList (book, GNC_ID_JOB, FALSE);
+        do_test (list != NULL, "getList active");
+        do_test (g_list_length (list) == 1, "correct length: active");
+        g_list_free (list);
+    }
 #endif
-  {
-    const char *str = get_random_string();
-    const char *res;
+    {
+        const char *str = get_random_string();
+        const char *res;
 
-    gncJobSetName (job, str);
-    res = qof_object_printable (GNC_ID_JOB, job);
-    do_test (res != NULL, "Printable NULL?");
-    do_test (safe_strcmp (str, res) == 0, "Printable equals");
-  }    
-  {
-    GList *list;
-    GncOwner owner;
-    GncCustomer *cust = gncCustomerCreate (book);
+        gncJobSetName (job, str);
+        res = qof_object_printable (GNC_ID_JOB, job);
+        do_test (res != NULL, "Printable NULL?");
+        do_test (safe_strcmp (str, res) == 0, "Printable equals");
+    }
+    {
+        GList *list;
+        GncOwner owner;
+        GncCustomer *cust = gncCustomerCreate (book);
 
-    gncOwnerInitCustomer (&owner, cust);
+        gncOwnerInitCustomer (&owner, cust);
 
-    do_test (gncCustomerGetJoblist (cust, TRUE) == NULL, "empty list at start");
-    gncJobSetOwner (job, &owner);
-    list = gncCustomerGetJoblist (cust, FALSE);
-    do_test (list != NULL, "added to cust");
-    do_test (g_list_length (list) == 1, "correct joblist length");
-    do_test (list->data == job, "verify job in list");
-    gncJobSetActive (job, FALSE);
-    list = gncCustomerGetJoblist (cust, FALSE);
-    do_test (list == NULL, "no active jobs");
-    list = gncCustomerGetJoblist (cust, TRUE);
-    do_test (list != NULL, "all jobs");
-    gncJobBeginEdit (job);
-    gncJobDestroy (job);
-    list = gncCustomerGetJoblist (cust, TRUE);
-    do_test (list == NULL, "no more jobs");
-  }
+        do_test (gncCustomerGetJoblist (cust, TRUE) == NULL, "empty list at start");
+        gncJobSetOwner (job, &owner);
+        list = gncCustomerGetJoblist (cust, FALSE);
+        do_test (list != NULL, "added to cust");
+        do_test (g_list_length (list) == 1, "correct joblist length");
+        do_test (list->data == job, "verify job in list");
+        gncJobSetActive (job, FALSE);
+        list = gncCustomerGetJoblist (cust, FALSE);
+        do_test (list == NULL, "no active jobs");
+        list = gncCustomerGetJoblist (cust, TRUE);
+        do_test (list != NULL, "all jobs");
+        gncJobBeginEdit (job);
+        gncJobDestroy (job);
+        list = gncCustomerGetJoblist (cust, TRUE);
+        do_test (list == NULL, "no more jobs");
+    }
 }
 
 static void
 test_string_fcn (QofBook *book, const char *message,
-		 void (*set) (GncJob *, const char *str),
-		 const char * (*get)(const GncJob *))
+                 void (*set) (GncJob *, const char *str),
+                 const char * (*get)(const GncJob *))
 {
-  GncJob *job = gncJobCreate (book);
-  char const *str = get_random_string ();
+    GncJob *job = gncJobCreate (book);
+    char const *str = get_random_string ();
 
-  do_test (!qof_instance_is_dirty (QOF_INSTANCE(job)), "test if start dirty");
-  gncJobBeginEdit (job);
-  set (job, str);
-  do_test (qof_instance_is_dirty (QOF_INSTANCE(job)), "test dirty later");
-  gncJobCommitEdit (job);
-  do_test (qof_instance_is_dirty (QOF_INSTANCE(job)), "test dirty after commit");
-  do_test (safe_strcmp (get (job), str) == 0, message);
-  gncJobSetActive (job, FALSE); count++;
+    do_test (!qof_instance_is_dirty (QOF_INSTANCE(job)), "test if start dirty");
+    gncJobBeginEdit (job);
+    set (job, str);
+    do_test (qof_instance_is_dirty (QOF_INSTANCE(job)), "test dirty later");
+    gncJobCommitEdit (job);
+    do_test (qof_instance_is_dirty (QOF_INSTANCE(job)), "test dirty after commit");
+    do_test (safe_strcmp (get (job), str) == 0, message);
+    gncJobSetActive (job, FALSE);
+    count++;
 }
 
 #if 0
 static void
 test_numeric_fcn (QofBook *book, const char *message,
-		  void (*set) (GncJob *, gnc_numeric),
-		  gnc_numeric (*get)(const GncJob *))
+                  void (*set) (GncJob *, gnc_numeric),
+                  gnc_numeric (*get)(const GncJob *))
 {
-  GncJob *job = gncJobCreate (book);
-  gnc_numeric num = gnc_numeric_create (17, 1);
+    GncJob *job = gncJobCreate (book);
+    gnc_numeric num = gnc_numeric_create (17, 1);
 
-  do_test (!qof_instance_is_dirty (QOF_INSTANCE(job)), "test if start dirty");
-  gncJobBeginEdit (job);
-  set (job, num);
-  do_test (qof_instance_is_dirty (QOF_INSTANCE(job)), "test dirty later");
-  gncJobCommitEdit (job);
-  do_test (!qof_instance_is_dirty (QOF_INSTANCE(job)), "test dirty after commit");
-  do_test (gnc_numeric_equal (get (job), num), message);
-  gncJobSetActive (job, FALSE); count++;
+    do_test (!qof_instance_is_dirty (QOF_INSTANCE(job)), "test if start dirty");
+    gncJobBeginEdit (job);
+    set (job, num);
+    do_test (qof_instance_is_dirty (QOF_INSTANCE(job)), "test dirty later");
+    gncJobCommitEdit (job);
+    do_test (!qof_instance_is_dirty (QOF_INSTANCE(job)), "test dirty after commit");
+    do_test (gnc_numeric_equal (get (job), num), message);
+    gncJobSetActive (job, FALSE);
+    count++;
 }
 #endif
 
 static void
 test_bool_fcn (QofBook *book, const char *message,
-	       void (*set) (GncJob *, gboolean),
-	       gboolean (*get) (const GncJob *))
+               void (*set) (GncJob *, gboolean),
+               gboolean (*get) (const GncJob *))
 {
-  GncJob *job = gncJobCreate (book);
-  gboolean num = get_random_boolean ();
+    GncJob *job = gncJobCreate (book);
+    gboolean num = get_random_boolean ();
 
-  do_test (!qof_instance_is_dirty (QOF_INSTANCE(job)), "test if start dirty");
-  gncJobBeginEdit (job);
-  set (job, FALSE);
-  set (job, TRUE);
-  set (job, num);
-  do_test (qof_instance_is_dirty (QOF_INSTANCE(job)), "test dirty later");
-  gncJobCommitEdit (job);
-  do_test (qof_instance_is_dirty (QOF_INSTANCE(job)), "test dirty after commit");
-  do_test (get (job) == num, message);
-  gncJobSetActive (job, FALSE); count++;
+    do_test (!qof_instance_is_dirty (QOF_INSTANCE(job)), "test if start dirty");
+    gncJobBeginEdit (job);
+    set (job, FALSE);
+    set (job, TRUE);
+    set (job, num);
+    do_test (qof_instance_is_dirty (QOF_INSTANCE(job)), "test dirty later");
+    gncJobCommitEdit (job);
+    do_test (qof_instance_is_dirty (QOF_INSTANCE(job)), "test dirty after commit");
+    do_test (get (job) == num, message);
+    gncJobSetActive (job, FALSE);
+    count++;
 }
 
 #if 0
 static void
 test_gint_fcn (QofBook *book, const char *message,
-	       void (*set) (GncJob *, gint),
-	       gint (*get) (const GncJob *))
+               void (*set) (GncJob *, gint),
+               gint (*get) (const GncJob *))
 {
-  GncJob *job = gncJobCreate (book);
-  gint num = 17;
+    GncJob *job = gncJobCreate (book);
+    gint num = 17;
 
-  do_test (!qof_instance_is_dirty (QOF_INSTANCE(job)), "test if start dirty");
-  gncJobBeginEdit (job);
-  set (job, num);
-  do_test (qof_instance_is_dirty (QOF_INSTANCE(job)), "test dirty later");
-  gncJobCommitEdit (job);
-  do_test (!qof_instance_is_dirty (QOF_INSTANCE(job)), "test dirty after commit");
-  do_test (get (job) == num, message);
-  gncJobSetActive (job, FALSE); count++;
+    do_test (!qof_instance_is_dirty (QOF_INSTANCE(job)), "test if start dirty");
+    gncJobBeginEdit (job);
+    set (job, num);
+    do_test (qof_instance_is_dirty (QOF_INSTANCE(job)), "test dirty later");
+    gncJobCommitEdit (job);
+    do_test (!qof_instance_is_dirty (QOF_INSTANCE(job)), "test dirty after commit");
+    do_test (get (job) == num, message);
+    gncJobSetActive (job, FALSE);
+    count++;
 }
 #endif
 
 int
 main (int argc, char **argv)
 {
-  qof_init();
-  do_test (gncInvoiceRegister(), "Cannot register GncInvoice");
-  do_test (gncJobRegister (),  "Cannot register GncJob");
-  do_test (gncCustomerRegister(), "Cannot register GncCustomer");
-  test_job();
-  print_test_results();
-  qof_close();
-  return 0;
+    qof_init();
+    do_test (gncInvoiceRegister(), "Cannot register GncInvoice");
+    do_test (gncJobRegister (),  "Cannot register GncJob");
+    do_test (gncCustomerRegister(), "Cannot register GncCustomer");
+    test_job();
+    print_test_results();
+    qof_close();
+    return 0;
 }
 

Modified: gnucash/trunk/src/business/business-core/test/test-load-module.c
===================================================================
--- gnucash/trunk/src/business/business-core/test/test-load-module.c	2010-03-02 21:40:28 UTC (rev 18788)
+++ gnucash/trunk/src/business/business-core/test/test-load-module.c	2010-03-02 21:41:05 UTC (rev 18789)
@@ -1,6 +1,6 @@
 /*********************************************************************
  * test-load-module.c
- * 
+ *
  * Copyright (c) 2001 Derek Atkins <warlord at MIT.EDU>
  *
  * This program is free software; you can redistribute it and/or
@@ -31,30 +31,32 @@
 static void
 guile_main (void *closure, int argc, char ** argv)
 {
-  GNCModule module;
+    GNCModule module;
 
-  printf("  test-load-module.c: loading/unloading business-core module ... ");
+    printf("  test-load-module.c: loading/unloading business-core module ... ");
 
-  gnc_module_system_init();
-  module = gnc_module_load("gnucash/business-core", 0);
-  
-  if(!module) {
-    printf("  Failed to load engine\n");
-    exit(-1);
-  }
-  
-  if(!gnc_module_unload(module)) {
-    printf("  Failed to unload engine\n");
-    exit(-1);
-  }
-  printf(" successful.\n");
+    gnc_module_system_init();
+    module = gnc_module_load("gnucash/business-core", 0);
 
-  exit(0);
+    if (!module)
+    {
+        printf("  Failed to load engine\n");
+        exit(-1);
+    }
+
+    if (!gnc_module_unload(module))
+    {
+        printf("  Failed to unload engine\n");
+        exit(-1);
+    }
+    printf(" successful.\n");
+
+    exit(0);
 }
 
 int
 main (int argc, char ** argv)
 {
-  scm_boot_guile(argc, argv, guile_main, NULL);
-  return 0;
+    scm_boot_guile(argc, argv, guile_main, NULL);
+    return 0;
 }

Modified: gnucash/trunk/src/business/business-core/test/test-vendor.c
===================================================================
--- gnucash/trunk/src/business/business-core/test/test-vendor.c	2010-03-02 21:40:28 UTC (rev 18788)
+++ gnucash/trunk/src/business/business-core/test/test-vendor.c	2010-03-02 21:41:05 UTC (rev 18789)
@@ -1,7 +1,7 @@
 /*********************************************************************
  * test-vendor.c
  * Test the vendor object.
- * 
+ *
  * Copyright (c) 2001 Derek Atkins <warlord at MIT.EDU>
  * Copyright (c) 2005 Neil Williams <linux at codehelp.co.uk>
  *
@@ -36,193 +36,198 @@
 
 static void
 test_string_fcn (QofBook *book, const char *message,
-		 void (*set) (GncVendor *, const char *str),
-		 const char * (*get)(const GncVendor *));
+                 void (*set) (GncVendor *, const char *str),
+                 const char * (*get)(const GncVendor *));
 
 #if 0
 static void
 test_numeric_fcn (QofBook *book, const char *message,
-		  void (*set) (GncVendor *, gnc_numeric),
-		  gnc_numeric (*get)(const GncVendor *));
+                  void (*set) (GncVendor *, gnc_numeric),
+                  gnc_numeric (*get)(const GncVendor *));
 #endif
 
 static void
 test_bool_fcn (QofBook *book, const char *message,
-		  void (*set) (GncVendor *, gboolean),
-		  gboolean (*get) (const GncVendor *));
+               void (*set) (GncVendor *, gboolean),
+               gboolean (*get) (const GncVendor *));
 
 #if 0
 static void
 test_gint_fcn (QofBook *book, const char *message,
-	       void (*set) (GncVendor *, gint),
-	       gint (*get) (const GncVendor *));
+               void (*set) (GncVendor *, gint),
+               gint (*get) (const GncVendor *));
 #endif
 
 static void
 test_vendor (void)
 {
-  QofBackend *be;
-  QofSession *session;
-  QofBook *book;
-  GncVendor *vendor;
+    QofBackend *be;
+    QofSession *session;
+    QofBook *book;
+    GncVendor *vendor;
 
-  session = qof_session_new();
-  be = NULL;
-  qof_session_begin(session, QOF_STDOUT, FALSE, FALSE);
-  book = qof_session_get_book (session);
-  be = qof_book_get_backend(book);
+    session = qof_session_new();
+    be = NULL;
+    qof_session_begin(session, QOF_STDOUT, FALSE, FALSE);
+    book = qof_session_get_book (session);
+    be = qof_book_get_backend(book);
 
-  /* The book *must* have a backend to pass the test of the 'dirty' flag */
-  /* See the README file for details */
-  do_test (be != NULL, "qsf backend could not be set");
+    /* The book *must* have a backend to pass the test of the 'dirty' flag */
+    /* See the README file for details */
+    do_test (be != NULL, "qsf backend could not be set");
 
-  /* Test creation/destruction */
-  {
-    do_test (gncVendorCreate (NULL) == NULL, "vendor create NULL");
-    vendor = gncVendorCreate (book);
-    do_test (vendor != NULL, "vendor create");
-    do_test (qof_instance_get_book (QOF_INSTANCE(vendor)) == book,
-	     "getbook");
+    /* Test creation/destruction */
+    {
+        do_test (gncVendorCreate (NULL) == NULL, "vendor create NULL");
+        vendor = gncVendorCreate (book);
+        do_test (vendor != NULL, "vendor create");
+        do_test (qof_instance_get_book (QOF_INSTANCE(vendor)) == book,
+                 "getbook");
 
-    gncVendorBeginEdit (vendor);
-    gncVendorDestroy (vendor);
-    success ("create/destroy");
-  }
+        gncVendorBeginEdit (vendor);
+        gncVendorDestroy (vendor);
+        success ("create/destroy");
+    }
 
-  /* Test setting/getting routines; does the active flag get set right? */
-  {
-    GUID guid;
+    /* Test setting/getting routines; does the active flag get set right? */
+    {
+        GUID guid;
 
-    test_string_fcn (book, "Id", gncVendorSetID, gncVendorGetID);
-    test_string_fcn (book, "Name", gncVendorSetName, gncVendorGetName);
-    test_string_fcn (book, "Notes", gncVendorSetNotes, gncVendorGetNotes);
+        test_string_fcn (book, "Id", gncVendorSetID, gncVendorGetID);
+        test_string_fcn (book, "Name", gncVendorSetName, gncVendorGetName);
+        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, "Active", gncVendorSetActive, gncVendorGetActive);
+        //test_bool_fcn (book, "TaxIncluded", gncVendorSetTaxIncluded, gncVendorGetTaxIncluded);
+        test_bool_fcn (book, "Active", gncVendorSetActive, gncVendorGetActive);
 
-    do_test (gncVendorGetAddr (vendor) != NULL, "Addr");
+        do_test (gncVendorGetAddr (vendor) != NULL, "Addr");
 
-    guid_new (&guid);
-    vendor = gncVendorCreate (book); count++;
-    gncVendorSetGUID (vendor, &guid);
-    do_test (guid_equal (&guid, qof_instance_get_guid(QOF_INSTANCE(vendor))), "guid compare");
-  }
+        guid_new (&guid);
+        vendor = gncVendorCreate (book);
+        count++;
+        gncVendorSetGUID (vendor, &guid);
+        do_test (guid_equal (&guid, qof_instance_get_guid(QOF_INSTANCE(vendor))), "guid compare");
+    }
 #if 0
-  {
-    GList *list;
+    {
+        GList *list;
 
-    list = gncBusinessGetList (book, GNC_ID_VENDOR, TRUE);
-    do_test (list != NULL, "getList all");
-    do_test (g_list_length (list) == count, "correct length: all");
-    g_list_free (list);
+        list = gncBusinessGetList (book, GNC_ID_VENDOR, TRUE);
+        do_test (list != NULL, "getList all");
+        do_test (g_list_length (list) == count, "correct length: all");
+        g_list_free (list);
 
-    list = gncBusinessGetList (book, GNC_ID_VENDOR, FALSE);
-    do_test (list != NULL, "getList active");
-    do_test (g_list_length (list) == 1, "correct length: active");
-    g_list_free (list);
-  }
+        list = gncBusinessGetList (book, GNC_ID_VENDOR, FALSE);
+        do_test (list != NULL, "getList active");
+        do_test (g_list_length (list) == 1, "correct length: active");
+        g_list_free (list);
+    }
 #endif
-  {
-    const char *str = get_random_string();
-    const char *res;
+    {
+        const char *str = get_random_string();
+        const char *res;
 
-    gncVendorSetName (vendor, str);
-    res = qof_object_printable (GNC_ID_VENDOR, vendor);
-    do_test (res != NULL, "Printable NULL?");
-    do_test (safe_strcmp (str, res) == 0, "Printable equals");
-  }    
+        gncVendorSetName (vendor, str);
+        res = qof_object_printable (GNC_ID_VENDOR, vendor);
+        do_test (res != NULL, "Printable NULL?");
+        do_test (safe_strcmp (str, res) == 0, "Printable equals");
+    }
 }
 
 static void
 test_string_fcn (QofBook *book, const char *message,
-		 void (*set) (GncVendor *, const char *str),
-		 const char * (*get)(const GncVendor *))
+                 void (*set) (GncVendor *, const char *str),
+                 const char * (*get)(const GncVendor *))
 {
-  GncVendor *vendor = gncVendorCreate (book);
-  char const *str = get_random_string ();
+    GncVendor *vendor = gncVendorCreate (book);
+    char const *str = get_random_string ();
 
-  do_test (!gncVendorIsDirty (vendor), "test if start dirty");
-  gncVendorBeginEdit (vendor);
-  set (vendor, str);
-  do_test (gncVendorIsDirty (vendor), "test dirty later");
-  gncVendorCommitEdit (vendor);
-  do_test (gncVendorIsDirty (vendor), "test dirty after commit");
-  do_test (safe_strcmp (get (vendor), str) == 0, message);
-  gncVendorSetActive (vendor, FALSE); count++;
+    do_test (!gncVendorIsDirty (vendor), "test if start dirty");
+    gncVendorBeginEdit (vendor);
+    set (vendor, str);
+    do_test (gncVendorIsDirty (vendor), "test dirty later");
+    gncVendorCommitEdit (vendor);
+    do_test (gncVendorIsDirty (vendor), "test dirty after commit");
+    do_test (safe_strcmp (get (vendor), str) == 0, message);
+    gncVendorSetActive (vendor, FALSE);
+    count++;
 }
 
 #if 0
 static void
 test_numeric_fcn (QofBook *book, const char *message,
-		  void (*set) (GncVendor *, gnc_numeric),
-		  gnc_numeric (*get)(const GncVendor *))
+                  void (*set) (GncVendor *, gnc_numeric),
+                  gnc_numeric (*get)(const GncVendor *))
 {
-  GncVendor *vendor = gncVendorCreate (book);
-  gnc_numeric num = gnc_numeric_create (17, 1);
+    GncVendor *vendor = gncVendorCreate (book);
+    gnc_numeric num = gnc_numeric_create (17, 1);
 
-  do_test (!gncVendorIsDirty (vendor), "test if start dirty");
-  gncVendoryBeginEdit (vendor);
-  set (vendor, num);
-  do_test (gncVendorIsDirty (vendor), "test dirty later");
-  gncVendorCommitEdit (vendor);
-  do_test (!gncVendorIsDirty (vendor), "test dirty after commit");
-  do_test (gnc_numeric_equal (get (vendor), num), message);
-  gncVendorSetActive (vendor, FALSE); count++;
+    do_test (!gncVendorIsDirty (vendor), "test if start dirty");
+    gncVendoryBeginEdit (vendor);
+    set (vendor, num);
+    do_test (gncVendorIsDirty (vendor), "test dirty later");
+    gncVendorCommitEdit (vendor);
+    do_test (!gncVendorIsDirty (vendor), "test dirty after commit");
+    do_test (gnc_numeric_equal (get (vendor), num), message);
+    gncVendorSetActive (vendor, FALSE);
+    count++;
 }
 #endif
 
 static void
 test_bool_fcn (QofBook *book, const char *message,
-	       void (*set) (GncVendor *, gboolean),
-	       gboolean (*get) (const GncVendor *))
+               void (*set) (GncVendor *, gboolean),
+               gboolean (*get) (const GncVendor *))
 {
-  GncVendor *vendor = gncVendorCreate (book);
-  gboolean num = get_random_boolean ();
+    GncVendor *vendor = gncVendorCreate (book);
+    gboolean num = get_random_boolean ();
 
-  do_test (!gncVendorIsDirty (vendor), "test if start dirty");
-  gncVendorBeginEdit (vendor);
-  set (vendor, FALSE);
-  set (vendor, TRUE);
-  set (vendor, num);
-  do_test (gncVendorIsDirty (vendor), "test dirty later");
-  gncVendorCommitEdit (vendor);
-  do_test (gncVendorIsDirty (vendor), "test dirty after commit");
-  do_test (get (vendor) == num, message);
-  gncVendorSetActive (vendor, FALSE); count++;
+    do_test (!gncVendorIsDirty (vendor), "test if start dirty");
+    gncVendorBeginEdit (vendor);
+    set (vendor, FALSE);
+    set (vendor, TRUE);
+    set (vendor, num);
+    do_test (gncVendorIsDirty (vendor), "test dirty later");
+    gncVendorCommitEdit (vendor);
+    do_test (gncVendorIsDirty (vendor), "test dirty after commit");
+    do_test (get (vendor) == num, message);
+    gncVendorSetActive (vendor, FALSE);
+    count++;
 }
 
 #if 0
 static void
 test_gint_fcn (QofBook *book, const char *message,
-	       void (*set) (GncVendor *, gint),
-	       gint (*get) (const GncVendor *))
+               void (*set) (GncVendor *, gint),
+               gint (*get) (const GncVendor *))
 {
-  GncVendor *vendor = gncVendorCreate (book);
-  gint num = 17;
+    GncVendor *vendor = gncVendorCreate (book);
+    gint num = 17;
 
-  do_test (!gncVendorIsDirty (vendor), "test if start dirty");
-  gncVendorBeginEdit (vendor);
-  set (vendor, num);
-  do_test (gncVendorIsDirty (vendor), "test dirty later");
-  gncVendorCommitEdit (vendor);
-  do_test (!gncVendorIsDirty (vendor), "test dirty after commit");
-  do_test (get (vendor) == num, message);
-  gncVendorSetActive (vendor, FALSE); count++;
+    do_test (!gncVendorIsDirty (vendor), "test if start dirty");
+    gncVendorBeginEdit (vendor);
+    set (vendor, num);
+    do_test (gncVendorIsDirty (vendor), "test dirty later");
+    gncVendorCommitEdit (vendor);
+    do_test (!gncVendorIsDirty (vendor), "test dirty after commit");
+    do_test (get (vendor) == num, message);
+    gncVendorSetActive (vendor, FALSE);
+    count++;
 }
 #endif
 
 int
 main (int argc, char **argv)
 {
-  qof_init();
-  do_test (gncInvoiceRegister(), "Cannot register GncInvoice");
-  do_test (gncJobRegister (),  "Cannot register GncJob");
-  do_test (gncCustomerRegister(), "Cannot register GncCustomer");
-  do_test (gncVendorRegister(), "Cannot register GncVendor");		
-  test_vendor();
-  print_test_results();
-  qof_close();
-  return 0;
+    qof_init();
+    do_test (gncInvoiceRegister(), "Cannot register GncInvoice");
+    do_test (gncJobRegister (),  "Cannot register GncJob");
+    do_test (gncCustomerRegister(), "Cannot register GncCustomer");
+    do_test (gncVendorRegister(), "Cannot register GncVendor");
+    test_vendor();
+    print_test_results();
+    qof_close();
+    return 0;
 }

Modified: gnucash/trunk/src/business/business-core/xml/gnc-address-xml-v2.c
===================================================================
--- gnucash/trunk/src/business/business-core/xml/gnc-address-xml-v2.c	2010-03-02 21:40:28 UTC (rev 18788)
+++ gnucash/trunk/src/business/business-core/xml/gnc-address-xml-v2.c	2010-03-02 21:41:05 UTC (rev 18789)
@@ -61,8 +61,8 @@
 static void
 maybe_add_string (xmlNodePtr ptr, const char *tag, const char *str)
 {
-  if (str && strlen(str) > 0)
-    xmlAddChild (ptr, text_to_dom_tree (tag, str));
+    if (str && strlen(str) > 0)
+        xmlAddChild (ptr, text_to_dom_tree (tag, str));
 }
 
 xmlNodePtr
@@ -74,7 +74,7 @@
     xmlSetProp(ret, BAD_CAST "version", BAD_CAST address_version_string);
 
     maybe_add_string (ret, addr_name_string, gncAddressGetName (addr));
-    
+
     maybe_add_string (ret, addr_addr1_string, gncAddressGetAddr1 (addr));
     maybe_add_string (ret, addr_addr2_string, gncAddressGetAddr2 (addr));
     maybe_add_string (ret, addr_addr3_string, gncAddressGetAddr3 (addr));
@@ -91,7 +91,7 @@
 
 struct address_pdata
 {
-  GncAddress *address;
+    GncAddress *address;
 };
 
 static gboolean
@@ -100,11 +100,11 @@
 {
     gchar* txt = dom_tree_to_text(node);
     g_return_val_if_fail(txt, FALSE);
-    
+
     func(addr, txt);
 
     g_free(txt);
-    
+
     return TRUE;
 }
 
@@ -175,10 +175,11 @@
 static gboolean
 address_slots_handler (xmlNodePtr node, gpointer addr_pdata)
 {
-  return TRUE;
+    return TRUE;
 }
 
-static struct dom_tree_handler address_handlers_v2[] = {
+static struct dom_tree_handler address_handlers_v2[] =
+{
     { addr_name_string, address_name_handler, 0, 0 },
     { addr_addr1_string, address_addr1_handler, 0, 0 },
     { addr_addr2_string, address_addr2_handler, 0, 0 },
@@ -220,18 +221,19 @@
 void
 gnc_address_xml_initialize (void)
 {
-  static GncXmlDataType_t be_data = {
-    GNC_FILE_BACKEND_VERS,
-    "gnc:Address",
-    NULL,			/* parser_create */
-    NULL,			/* add_item */
-    NULL,			/* get_count */
-    NULL,			/* write */
-    NULL,			/* scrub */
-    address_ns,
-  };
+    static GncXmlDataType_t be_data =
+    {
+        GNC_FILE_BACKEND_VERS,
+        "gnc:Address",
+        NULL,			/* parser_create */
+        NULL,			/* add_item */
+        NULL,			/* get_count */
+        NULL,			/* write */
+        NULL,			/* scrub */
+        address_ns,
+    };
 
-  qof_object_register_backend ("gnc:Address",
-			    GNC_FILE_BACKEND,
-			    &be_data);
+    qof_object_register_backend ("gnc:Address",
+                                 GNC_FILE_BACKEND,
+                                 &be_data);
 }

Modified: gnucash/trunk/src/business/business-core/xml/gnc-bill-term-xml-v2.c
===================================================================
--- gnucash/trunk/src/business/business-core/xml/gnc-bill-term-xml-v2.c	2010-03-02 21:40:28 UTC (rev 18788)
+++ gnucash/trunk/src/business/business-core/xml/gnc-bill-term-xml-v2.c	2010-03-02 21:41:05 UTC (rev 18789)
@@ -86,47 +86,48 @@
 
     maybe_add_guid(ret, billterm_guid_string, QOF_INSTANCE(term));
     xmlAddChild(ret, text_to_dom_tree (billterm_name_string,
-				       gncBillTermGetName (term)));
+                                       gncBillTermGetName (term)));
     xmlAddChild(ret, text_to_dom_tree (billterm_desc_string,
-				       gncBillTermGetDescription (term)));
+                                       gncBillTermGetDescription (term)));
 
     xmlAddChild(ret, int_to_dom_tree (billterm_refcount_string,
-				      gncBillTermGetRefcount (term)));
+                                      gncBillTermGetRefcount (term)));
     xmlAddChild(ret, int_to_dom_tree (billterm_invisible_string,
-				      gncBillTermGetInvisible (term)));
+                                      gncBillTermGetInvisible (term)));
 
     kvpnode = kvp_frame_to_dom_tree (billterm_slots_string,
-                 qof_instance_get_slots (QOF_INSTANCE(term)));
+                                     qof_instance_get_slots (QOF_INSTANCE(term)));
     if (kvpnode) xmlAddChild (ret, kvpnode);
 
 
     /* We should not be our own child */
     if (gncBillTermGetChild(term) != term)
-      maybe_add_guid(ret, billterm_child_string, 
-                    QOF_INSTANCE(gncBillTermGetChild (term)));
+        maybe_add_guid(ret, billterm_child_string,
+                       QOF_INSTANCE(gncBillTermGetChild (term)));
 
     maybe_add_guid(ret, billterm_parent_string,
-                    QOF_INSTANCE(gncBillTermGetParent (term)));
+                   QOF_INSTANCE(gncBillTermGetParent (term)));
 
-    switch (gncBillTermGetType (term)) {
+    switch (gncBillTermGetType (term))
+    {
     case GNC_TERM_TYPE_DAYS:
-      data = xmlNewChild (ret, NULL, BAD_CAST gnc_daystype_string, NULL);
-      maybe_add_int (data, days_duedays_string, gncBillTermGetDueDays (term));
-      maybe_add_int (data, days_discdays_string,
-		     gncBillTermGetDiscountDays (term));
-      maybe_add_numeric (data, days_discount_string,
-			 gncBillTermGetDiscount (term));
-      break;
+        data = xmlNewChild (ret, NULL, BAD_CAST gnc_daystype_string, NULL);
+        maybe_add_int (data, days_duedays_string, gncBillTermGetDueDays (term));
+        maybe_add_int (data, days_discdays_string,
+                       gncBillTermGetDiscountDays (term));
+        maybe_add_numeric (data, days_discount_string,
+                           gncBillTermGetDiscount (term));
+        break;
 
     case GNC_TERM_TYPE_PROXIMO:
-      data = xmlNewChild (ret, NULL, BAD_CAST gnc_proximotype_string, NULL);
-      maybe_add_int (data, prox_dueday_string, gncBillTermGetDueDays (term));
-      maybe_add_int (data, prox_discday_string,
-		     gncBillTermGetDiscountDays (term));
-      maybe_add_numeric (data, prox_discount_string,
-			 gncBillTermGetDiscount (term));
-      maybe_add_int (data, prox_cutoff_string, gncBillTermGetCutoff (term));
-      break;
+        data = xmlNewChild (ret, NULL, BAD_CAST gnc_proximotype_string, NULL);
+        maybe_add_int (data, prox_dueday_string, gncBillTermGetDueDays (term));
+        maybe_add_int (data, prox_discday_string,
+                       gncBillTermGetDiscountDays (term));
+        maybe_add_numeric (data, prox_discount_string,
+                           gncBillTermGetDiscount (term));
+        maybe_add_int (data, prox_cutoff_string, gncBillTermGetCutoff (term));
+        break;
     }
 
     return ret;
@@ -136,30 +137,30 @@
 
 struct billterm_pdata
 {
-  GncBillTerm *term;
-  QofBook *book;
+    GncBillTerm *term;
+    QofBook *book;
 };
 
 static gboolean
 set_int (xmlNodePtr node, GncBillTerm *term,
-	 void (*func)(GncBillTerm *, gint))
+         void (*func)(GncBillTerm *, gint))
 {
-  gint64 val;
-  dom_tree_to_integer (node, &val);
-  func (term, val);
-  return TRUE;
+    gint64 val;
+    dom_tree_to_integer (node, &val);
+    func (term, val);
+    return TRUE;
 }
 
 static gboolean
 set_numeric (xmlNodePtr node, GncBillTerm *term,
-	     void (*func)(GncBillTerm *, gnc_numeric))
+             void (*func)(GncBillTerm *, gnc_numeric))
 {
-  gnc_numeric* num = dom_tree_to_gnc_numeric (node);
-  g_return_val_if_fail (num, FALSE);
-    
-  func (term, *num);
-  g_free (num);
-  return TRUE;
+    gnc_numeric* num = dom_tree_to_gnc_numeric (node);
+    g_return_val_if_fail (num, FALSE);
+
+    func (term, *num);
+    g_free (num);
+    return TRUE;
 }
 
 /***********************************************************************/
@@ -167,42 +168,43 @@
 static gboolean
 days_duedays_handler (xmlNodePtr node, gpointer billterm_pdata)
 {
-  struct billterm_pdata *pdata = billterm_pdata;
-  return set_int (node, pdata->term, gncBillTermSetDueDays);
+    struct billterm_pdata *pdata = billterm_pdata;
+    return set_int (node, pdata->term, gncBillTermSetDueDays);
 }
 
 static gboolean
 days_discdays_handler (xmlNodePtr node, gpointer billterm_pdata)
 {
-  struct billterm_pdata *pdata = billterm_pdata;
-  return set_int (node, pdata->term, gncBillTermSetDiscountDays);
+    struct billterm_pdata *pdata = billterm_pdata;
+    return set_int (node, pdata->term, gncBillTermSetDiscountDays);
 }
 
 static gboolean
 days_discount_handler (xmlNodePtr node, gpointer billterm_pdata)
 {
-  struct billterm_pdata *pdata = billterm_pdata;
-  return set_numeric (node, pdata->term, gncBillTermSetDiscount);
+    struct billterm_pdata *pdata = billterm_pdata;
+    return set_numeric (node, pdata->term, gncBillTermSetDiscount);
 }
 
-static struct dom_tree_handler days_data_handlers_v2[] = {
-  { days_duedays_string, days_duedays_handler, 0, 0 },
-  { days_discdays_string, days_discdays_handler, 0, 0 },
-  { days_discount_string, days_discount_handler, 0, 0 },
-  { NULL, 0, 0, 0 }
+static struct dom_tree_handler days_data_handlers_v2[] =
+{
+    { days_duedays_string, days_duedays_handler, 0, 0 },
+    { days_discdays_string, days_discdays_handler, 0, 0 },
+    { days_discount_string, days_discount_handler, 0, 0 },
+    { NULL, 0, 0, 0 }
 };
 
 static gboolean
 dom_tree_to_days_data (xmlNodePtr node, struct billterm_pdata *pdata)
 {
-  gboolean successful;
-  
-  successful = dom_tree_generic_parse (node, days_data_handlers_v2, pdata);
+    gboolean successful;
 
-  if (!successful)
-    PERR ("failed to parse billing term days data");
+    successful = dom_tree_generic_parse (node, days_data_handlers_v2, pdata);
 
-  return successful;
+    if (!successful)
+        PERR ("failed to parse billing term days data");
+
+    return successful;
 }
 
 /***********************************************************************/
@@ -210,86 +212,88 @@
 static gboolean
 prox_dueday_handler (xmlNodePtr node, gpointer billterm_pdata)
 {
-  struct billterm_pdata *pdata = billterm_pdata;
-  return set_int (node, pdata->term, gncBillTermSetDueDays);
+    struct billterm_pdata *pdata = billterm_pdata;
+    return set_int (node, pdata->term, gncBillTermSetDueDays);
 }
 
 static gboolean
 prox_discday_handler (xmlNodePtr node, gpointer billterm_pdata)
 {
-  struct billterm_pdata *pdata = billterm_pdata;
-  return set_int (node, pdata->term, gncBillTermSetDiscountDays);
+    struct billterm_pdata *pdata = billterm_pdata;
+    return set_int (node, pdata->term, gncBillTermSetDiscountDays);
 }
 
 static gboolean
 prox_discount_handler (xmlNodePtr node, gpointer billterm_pdata)
 {
-  struct billterm_pdata *pdata = billterm_pdata;
-  return set_numeric (node, pdata->term, gncBillTermSetDiscount);
+    struct billterm_pdata *pdata = billterm_pdata;
+    return set_numeric (node, pdata->term, gncBillTermSetDiscount);
 }
 
 static gboolean
 prox_cutoff_handler (xmlNodePtr node, gpointer billterm_pdata)
 {
-  struct billterm_pdata *pdata = billterm_pdata;
-  return set_int (node, pdata->term, gncBillTermSetCutoff);
+    struct billterm_pdata *pdata = billterm_pdata;
+    return set_int (node, pdata->term, gncBillTermSetCutoff);
 }
 
-static struct dom_tree_handler prox_data_handlers_v2[] = {
-  { prox_dueday_string, prox_dueday_handler, 0, 0 },
-  { prox_discday_string, prox_discday_handler, 0, 0 },
-  { prox_discount_string, prox_discount_handler, 0, 0 },
-  { prox_cutoff_string, prox_cutoff_handler, 0, 0 },
-  { NULL, 0, 0, 0 }
+static struct dom_tree_handler prox_data_handlers_v2[] =
+{
+    { prox_dueday_string, prox_dueday_handler, 0, 0 },
+    { prox_discday_string, prox_discday_handler, 0, 0 },
+    { prox_discount_string, prox_discount_handler, 0, 0 },
+    { prox_cutoff_string, prox_cutoff_handler, 0, 0 },
+    { NULL, 0, 0, 0 }
 };
 
 static gboolean
 dom_tree_to_prox_data (xmlNodePtr node, struct billterm_pdata *pdata)
 {
-  gboolean successful;
-  
-  successful = dom_tree_generic_parse (node, prox_data_handlers_v2, pdata);
+    gboolean successful;
 
-  if (!successful)
-    PERR ("failed to parse billing term prox data");
+    successful = dom_tree_generic_parse (node, prox_data_handlers_v2, pdata);
 
-  return successful;
+    if (!successful)
+        PERR ("failed to parse billing term prox data");
+
+    return successful;
 }
 
 /***********************************************************************/
 
 static gboolean
 set_parent_child (xmlNodePtr node, struct billterm_pdata *pdata,
-		  void (*func)(GncBillTerm *, GncBillTerm *))
+                  void (*func)(GncBillTerm *, GncBillTerm *))
 {
-  GUID *guid;
-  GncBillTerm *term;
+    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);
-    gncBillTermBeginEdit (term);
-    gncBillTermSetGUID (term, guid);
-    gncBillTermCommitEdit (term);
-  }
-  g_free (guid);
-  g_return_val_if_fail (term, FALSE);
-  func (pdata->term, 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);
+        gncBillTermBeginEdit (term);
+        gncBillTermSetGUID (term, guid);
+        gncBillTermCommitEdit (term);
+    }
+    g_free (guid);
+    g_return_val_if_fail (term, FALSE);
+    func (pdata->term, term);
 
-  return TRUE;
+    return TRUE;
 }
 
 static gboolean
 set_string (xmlNodePtr node, GncBillTerm *term,
-	    void (*func)(GncBillTerm *, const char *))
+            void (*func)(GncBillTerm *, const char *))
 {
-  char* txt = dom_tree_to_text(node);
-  g_return_val_if_fail(txt, FALSE);
-  func (term, txt);
-  g_free(txt);
-  return TRUE;
+    char* txt = dom_tree_to_text(node);
+    g_return_val_if_fail(txt, FALSE);
+    func (term, txt);
+    g_free(txt);
+    return TRUE;
 }
 
 static gboolean
@@ -302,103 +306,107 @@
     guid = dom_tree_to_guid(node);
     g_return_val_if_fail (guid, FALSE);
     term = gncBillTermLookup (pdata->book, guid);
-    if (term) {
-      gncBillTermDestroy (pdata->term);
-      pdata->term = term;
-      gncBillTermBeginEdit (term);
-    } else {
-      gncBillTermSetGUID(pdata->term, guid);
+    if (term)
+    {
+        gncBillTermDestroy (pdata->term);
+        pdata->term = term;
+        gncBillTermBeginEdit (term);
     }
+    else
+    {
+        gncBillTermSetGUID(pdata->term, guid);
+    }
 
     g_free(guid);
-    
+
     return TRUE;
 }
 
 static gboolean
 billterm_name_handler (xmlNodePtr node, gpointer billterm_pdata)
 {
-  struct billterm_pdata *pdata = billterm_pdata;
-  return set_string (node, pdata->term, gncBillTermSetName);
+    struct billterm_pdata *pdata = billterm_pdata;
+    return set_string (node, pdata->term, gncBillTermSetName);
 }
 
 static gboolean
 billterm_desc_handler (xmlNodePtr node, gpointer billterm_pdata)
 {
-  struct billterm_pdata *pdata = billterm_pdata;
-  return set_string (node, pdata->term, gncBillTermSetDescription);
+    struct billterm_pdata *pdata = billterm_pdata;
+    return set_string (node, pdata->term, gncBillTermSetDescription);
 }
 
 static gboolean
 billterm_refcount_handler (xmlNodePtr node, gpointer billterm_pdata)
 {
-  struct billterm_pdata *pdata = billterm_pdata;
-  gint64 val;
+    struct billterm_pdata *pdata = billterm_pdata;
+    gint64 val;
 
-  dom_tree_to_integer(node, &val);
-  gncBillTermSetRefcount (pdata->term, val);
-  return TRUE;
+    dom_tree_to_integer(node, &val);
+    gncBillTermSetRefcount (pdata->term, val);
+    return TRUE;
 }
 
 static gboolean
 billterm_invisible_handler (xmlNodePtr node, gpointer billterm_pdata)
 {
-  struct billterm_pdata *pdata = billterm_pdata;
-  gint64 val;
+    struct billterm_pdata *pdata = billterm_pdata;
+    gint64 val;
 
-  dom_tree_to_integer(node, &val);
-  if (val)
-    gncBillTermMakeInvisible (pdata->term);
-  return TRUE;
+    dom_tree_to_integer(node, &val);
+    if (val)
+        gncBillTermMakeInvisible (pdata->term);
+    return TRUE;
 }
 
 static gboolean
 billterm_parent_handler (xmlNodePtr node, gpointer billterm_pdata)
 {
-  struct billterm_pdata *pdata = billterm_pdata;
-  return set_parent_child (node, pdata, gncBillTermSetParent);
+    struct billterm_pdata *pdata = billterm_pdata;
+    return set_parent_child (node, pdata, gncBillTermSetParent);
 }
 
 static gboolean
 billterm_child_handler (xmlNodePtr node, gpointer billterm_pdata)
 {
-  struct billterm_pdata *pdata = billterm_pdata;
-  return set_parent_child (node, pdata, gncBillTermSetChild);
+    struct billterm_pdata *pdata = billterm_pdata;
+    return set_parent_child (node, pdata, gncBillTermSetChild);
 }
 
 static gboolean
 billterm_days_data_handler (xmlNodePtr node, gpointer billterm_pdata)
 {
-  struct billterm_pdata *pdata = billterm_pdata;
+    struct billterm_pdata *pdata = billterm_pdata;
 
-  g_return_val_if_fail (node, FALSE);
-  g_return_val_if_fail (gncBillTermGetType (pdata->term) == 0, FALSE);
+    g_return_val_if_fail (node, FALSE);
+    g_return_val_if_fail (gncBillTermGetType (pdata->term) == 0, FALSE);
 
-  gncBillTermSetType (pdata->term, GNC_TERM_TYPE_DAYS);
-  return dom_tree_to_days_data (node, pdata);
+    gncBillTermSetType (pdata->term, GNC_TERM_TYPE_DAYS);
+    return dom_tree_to_days_data (node, pdata);
 }
 
 static gboolean
 billterm_prox_data_handler (xmlNodePtr node, gpointer billterm_pdata)
 {
-  struct billterm_pdata *pdata = billterm_pdata;
+    struct billterm_pdata *pdata = billterm_pdata;
 
-  g_return_val_if_fail (node, FALSE);
-  g_return_val_if_fail (gncBillTermGetType (pdata->term) == 0, FALSE);
+    g_return_val_if_fail (node, FALSE);
+    g_return_val_if_fail (gncBillTermGetType (pdata->term) == 0, FALSE);
 
-  gncBillTermSetType (pdata->term, GNC_TERM_TYPE_PROXIMO);
-  return dom_tree_to_prox_data (node, pdata);
+    gncBillTermSetType (pdata->term, GNC_TERM_TYPE_PROXIMO);
+    return dom_tree_to_prox_data (node, pdata);
 }
 
 static gboolean
 billterm_slots_handler (xmlNodePtr node, gpointer billterm_pdata)
 {
-  struct billterm_pdata *pdata = billterm_pdata;
-  return dom_tree_to_kvp_frame_given (node, 
-        qof_instance_get_slots (QOF_INSTANCE(pdata->term)));
+    struct billterm_pdata *pdata = billterm_pdata;
+    return dom_tree_to_kvp_frame_given (node,
+                                        qof_instance_get_slots (QOF_INSTANCE(pdata->term)));
 }
 
-static struct dom_tree_handler billterm_handlers_v2[] = {
+static struct dom_tree_handler billterm_handlers_v2[] =
+{
     { billterm_guid_string, billterm_guid_handler, 1, 0 },
     { billterm_name_string, billterm_name_handler, 1, 0 },
     { billterm_desc_string, billterm_desc_handler, 1, 0 },
@@ -415,32 +423,35 @@
 static GncBillTerm*
 dom_tree_to_billterm (xmlNodePtr node, QofBook *book)
 {
-  struct billterm_pdata billterm_pdata;
-  gboolean successful;
-  
-  billterm_pdata.term = gncBillTermCreate (book);
-  billterm_pdata.book = book;
-  gncBillTermBeginEdit (billterm_pdata.term);
+    struct billterm_pdata billterm_pdata;
+    gboolean successful;
 
-  successful = dom_tree_generic_parse (node, billterm_handlers_v2,
-				       &billterm_pdata);
+    billterm_pdata.term = gncBillTermCreate (book);
+    billterm_pdata.book = book;
+    gncBillTermBeginEdit (billterm_pdata.term);
 
-  if (successful) {
-    gncBillTermCommitEdit (billterm_pdata.term);
-  } else {
-    PERR ("failed to parse billing term tree");
-    gncBillTermDestroy (billterm_pdata.term);
-    billterm_pdata.term = NULL;
-  }
+    successful = dom_tree_generic_parse (node, billterm_handlers_v2,
+                                         &billterm_pdata);
 
-  return billterm_pdata.term;
+    if (successful)
+    {
+        gncBillTermCommitEdit (billterm_pdata.term);
+    }
+    else
+    {
+        PERR ("failed to parse billing term tree");
+        gncBillTermDestroy (billterm_pdata.term);
+        billterm_pdata.term = NULL;
+    }
+
+    return billterm_pdata.term;
 }
 
 static gboolean
 gnc_billterm_end_handler(gpointer data_for_children,
-			 GSList* data_from_children, GSList* sibling_data,
-			 gpointer parent_data, gpointer global_data,
-			 gpointer *result, const gchar *tag)
+                         GSList* data_from_children, GSList* sibling_data,
+                         gpointer parent_data, gpointer global_data,
+                         gpointer *result, const gchar *tag)
 {
     int successful;
     GncBillTerm *term;
@@ -450,14 +461,14 @@
 
     successful = TRUE;
 
-    if(parent_data)
+    if (parent_data)
     {
         return TRUE;
     }
 
     /* OK.  For some messed up reason this is getting called again with a
        NULL tag.  So we ignore those cases */
-    if(!tag)
+    if (!tag)
     {
         return TRUE;
     }
@@ -465,7 +476,7 @@
     g_return_val_if_fail(tree, FALSE);
 
     term = dom_tree_to_billterm (tree, book);
-    if(term != NULL)
+    if (term != NULL)
     {
         gdata->cb(tag, gdata->parsedata, term);
     }
@@ -478,117 +489,125 @@
 static sixtp *
 billterm_sixtp_parser_create(void)
 {
-  return sixtp_dom_parser_new(gnc_billterm_end_handler, NULL, NULL);
+    return sixtp_dom_parser_new(gnc_billterm_end_handler, NULL, NULL);
 }
 
 static void
 do_count (QofInstance *term_p, gpointer count_p)
 {
-  int *count = count_p;
-  (*count)++;
+    int *count = count_p;
+    (*count)++;
 }
 
 static int
 billterm_get_count (QofBook *book)
 {
-  int count = 0;
-  qof_object_foreach (_GNC_MOD_NAME, book, do_count, (gpointer) &count);
-  return count;
+    int count = 0;
+    qof_object_foreach (_GNC_MOD_NAME, book, do_count, (gpointer) &count);
+    return count;
 }
 
 static void
 xml_add_billterm (QofInstance *term_p, gpointer out_p)
 {
-  xmlNodePtr node;
-  GncBillTerm *term = (GncBillTerm *) term_p;
-  FILE *out = out_p;
+    xmlNodePtr node;
+    GncBillTerm *term = (GncBillTerm *) term_p;
+    FILE *out = out_p;
 
-  if (ferror(out))
-    return;
+    if (ferror(out))
+        return;
 
-  node = billterm_dom_tree_create (term);
-  xmlElemDump(out, NULL, node);
-  xmlFreeNode (node);
-  if (ferror(out) || fprintf(out, "\n") < 0)
-    return;
+    node = billterm_dom_tree_create (term);
+    xmlElemDump(out, NULL, node);
+    xmlFreeNode (node);
+    if (ferror(out) || fprintf(out, "\n") < 0)
+        return;
 }
 
 static gboolean
 billterm_write (FILE *out, QofBook *book)
 {
-  qof_object_foreach (_GNC_MOD_NAME, book, xml_add_billterm, (gpointer) out);
-  return ferror(out) == 0;
+    qof_object_foreach (_GNC_MOD_NAME, book, xml_add_billterm, (gpointer) out);
+    return ferror(out) == 0;
 }
 
 static gboolean
 billterm_is_grandchild (GncBillTerm *term)
 {
-  return (gncBillTermGetParent(gncBillTermGetParent(term)) != NULL);
+    return (gncBillTermGetParent(gncBillTermGetParent(term)) != NULL);
 }
 
 static GncBillTerm *
 billterm_find_senior (GncBillTerm *term)
 {
-  GncBillTerm *temp, *parent, *gp = NULL;
+    GncBillTerm *temp, *parent, *gp = NULL;
 
-  temp = term;
-  do {
-    /* See if "temp" is a grandchild */
-    parent = gncBillTermGetParent(temp);
-    if (!parent)
-      break;
-    gp = gncBillTermGetParent(parent);
-    if (!gp)
-      break;
+    temp = term;
+    do
+    {
+        /* See if "temp" is a grandchild */
+        parent = gncBillTermGetParent(temp);
+        if (!parent)
+            break;
+        gp = gncBillTermGetParent(parent);
+        if (!gp)
+            break;
 
-    /* Yep, this is a grandchild.  Move up one generation and try again */
-    temp = parent;
-  } while (TRUE);
+        /* Yep, this is a grandchild.  Move up one generation and try again */
+        temp = parent;
+    }
+    while (TRUE);
 
-  /* Ok, at this point temp points to the most senior child and parent
-   * should point to the top billterm (and gp should be NULL).  If
-   * parent is NULL then we are the most senior child (and have no
-   * children), so do nothing.  If temp == term then there is no
-   * grandparent, so do nothing.
-   *
-   * Do something if parent != NULL && temp != term
-   */
-  g_assert (gp == NULL);
+    /* Ok, at this point temp points to the most senior child and parent
+     * should point to the top billterm (and gp should be NULL).  If
+     * parent is NULL then we are the most senior child (and have no
+     * children), so do nothing.  If temp == term then there is no
+     * grandparent, so do nothing.
+     *
+     * Do something if parent != NULL && temp != term
+     */
+    g_assert (gp == NULL);
 
-  /* return the most senior term */
-  return temp;
+    /* return the most senior term */
+    return temp;
 }
 
 /* build a list of bill terms that are grandchildren or bogus (empty entry list). */
 static void
 billterm_scrub_cb (QofInstance *term_p, gpointer list_p)
 {
-  GncBillTerm *term = GNC_BILLTERM(term_p);
-  GList **list = list_p;
+    GncBillTerm *term = GNC_BILLTERM(term_p);
+    GList **list = list_p;
 
-  if (billterm_is_grandchild(term)) {
-    *list = g_list_prepend(*list, term);
+    if (billterm_is_grandchild(term))
+    {
+        *list = g_list_prepend(*list, term);
 
-  } else if (!gncBillTermGetType(term)) {
-    GncBillTerm *t = gncBillTermGetParent(term);
-    if (t) {
-      /* Fix up the broken "copy" function */
-      PWARN("Fixing broken child billterm: %s",
-	    guid_to_string(qof_instance_get_guid(QOF_INSTANCE(term))));
+    }
+    else if (!gncBillTermGetType(term))
+    {
+        GncBillTerm *t = gncBillTermGetParent(term);
+        if (t)
+        {
+            /* Fix up the broken "copy" function */
+            PWARN("Fixing broken child billterm: %s",
+                  guid_to_string(qof_instance_get_guid(QOF_INSTANCE(term))));
 
-      gncBillTermBeginEdit(term);
-      gncBillTermSetType(term, gncBillTermGetType(t));
-      gncBillTermSetDueDays (term, gncBillTermGetDueDays(t));
-      gncBillTermSetDiscountDays (term, gncBillTermGetDiscountDays(t));
-      gncBillTermSetDiscount (term, gncBillTermGetDiscount(t));
-      gncBillTermSetCutoff (term, gncBillTermGetCutoff(t));
-      gncBillTermCommitEdit(term);
+            gncBillTermBeginEdit(term);
+            gncBillTermSetType(term, gncBillTermGetType(t));
+            gncBillTermSetDueDays (term, gncBillTermGetDueDays(t));
+            gncBillTermSetDiscountDays (term, gncBillTermGetDiscountDays(t));
+            gncBillTermSetDiscount (term, gncBillTermGetDiscount(t));
+            gncBillTermSetCutoff (term, gncBillTermGetCutoff(t));
+            gncBillTermCommitEdit(term);
 
-    } else {
-      /* No parent?  Must be a standalone */
-      *list = g_list_prepend(*list, term);
+        }
+        else
+        {
+            /* No parent?  Must be a standalone */
+            *list = g_list_prepend(*list, term);
+        }
     }
-  }
 }
 
 /* for each invoice, check the bill terms.  If the bill terms are
@@ -597,167 +616,177 @@
 static void
 billterm_scrub_invoices (QofInstance * invoice_p, gpointer ht_p)
 {
-  GHashTable *ht = ht_p;
-  GncInvoice *invoice = GNC_INVOICE(invoice_p);
-  GncBillTerm *term, *new_bt;
-  gint32 count;
+    GHashTable *ht = ht_p;
+    GncInvoice *invoice = GNC_INVOICE(invoice_p);
+    GncBillTerm *term, *new_bt;
+    gint32 count;
 
-  term = gncInvoiceGetTerms(invoice);
-  if (term) {
-    if (billterm_is_grandchild(term)) {
-      PWARN("Fixing i-billterm on invoice %s\n",
-	     guid_to_string(qof_instance_get_guid(QOF_INSTANCE(invoice))));
-      new_bt = billterm_find_senior(term);
-      gncInvoiceBeginEdit(invoice);
-      gncInvoiceSetTerms(invoice, new_bt);
-      gncInvoiceCommitEdit(invoice);
-      term = new_bt;
+    term = gncInvoiceGetTerms(invoice);
+    if (term)
+    {
+        if (billterm_is_grandchild(term))
+        {
+            PWARN("Fixing i-billterm on invoice %s\n",
+                  guid_to_string(qof_instance_get_guid(QOF_INSTANCE(invoice))));
+            new_bt = billterm_find_senior(term);
+            gncInvoiceBeginEdit(invoice);
+            gncInvoiceSetTerms(invoice, new_bt);
+            gncInvoiceCommitEdit(invoice);
+            term = new_bt;
+        }
+        if (term)
+        {
+            count = GPOINTER_TO_INT(g_hash_table_lookup(ht, term));
+            count++;
+            g_hash_table_insert(ht, term, GINT_TO_POINTER(count));
+        }
     }
-    if (term) {
-      count = GPOINTER_TO_INT(g_hash_table_lookup(ht, term));
-      count++;
-      g_hash_table_insert(ht, term, GINT_TO_POINTER(count));
-    }
-  }
 }
 
 static void
 billterm_scrub_cust (QofInstance * cust_p, gpointer ht_p)
 {
-  GHashTable *ht = ht_p;
-  GncCustomer *cust = GNC_CUSTOMER(cust_p);
-  GncBillTerm *term;
-  gint32 count;
-  
-  term = gncCustomerGetTerms(cust);
-  if (term) {
-    count = GPOINTER_TO_INT(g_hash_table_lookup(ht, term));
-    count++;
-    g_hash_table_insert(ht, term, GINT_TO_POINTER(count));
-    if (billterm_is_grandchild(term))
-      PWARN("customer %s has grandchild billterm %s\n",
-	    guid_to_string(qof_instance_get_guid(QOF_INSTANCE(cust))),
-	    guid_to_string(qof_instance_get_guid(QOF_INSTANCE(term))));
-  }
+    GHashTable *ht = ht_p;
+    GncCustomer *cust = GNC_CUSTOMER(cust_p);
+    GncBillTerm *term;
+    gint32 count;
+
+    term = gncCustomerGetTerms(cust);
+    if (term)
+    {
+        count = GPOINTER_TO_INT(g_hash_table_lookup(ht, term));
+        count++;
+        g_hash_table_insert(ht, term, GINT_TO_POINTER(count));
+        if (billterm_is_grandchild(term))
+            PWARN("customer %s has grandchild billterm %s\n",
+                  guid_to_string(qof_instance_get_guid(QOF_INSTANCE(cust))),
+                  guid_to_string(qof_instance_get_guid(QOF_INSTANCE(term))));
+    }
 }
 
 static void
 billterm_scrub_vendor (QofInstance * vendor_p, gpointer ht_p)
 {
-  GHashTable *ht = ht_p;
-  GncVendor *vendor = GNC_VENDOR(vendor_p);
-  GncBillTerm *term;
-  gint32 count;
+    GHashTable *ht = ht_p;
+    GncVendor *vendor = GNC_VENDOR(vendor_p);
+    GncBillTerm *term;
+    gint32 count;
 
-  term = gncVendorGetTerms(vendor);
-  if (term) {
-    count = GPOINTER_TO_INT(g_hash_table_lookup(ht, term));
-    count++;
-    g_hash_table_insert(ht, term, GINT_TO_POINTER(count));
-    if (billterm_is_grandchild(term))
-      PWARN("vendor %s has grandchild billterm %s\n",
-	    guid_to_string(qof_instance_get_guid(QOF_INSTANCE(vendor))),
-	    guid_to_string(qof_instance_get_guid(QOF_INSTANCE(term))));
-  }
+    term = gncVendorGetTerms(vendor);
+    if (term)
+    {
+        count = GPOINTER_TO_INT(g_hash_table_lookup(ht, term));
+        count++;
+        g_hash_table_insert(ht, term, GINT_TO_POINTER(count));
+        if (billterm_is_grandchild(term))
+            PWARN("vendor %s has grandchild billterm %s\n",
+                  guid_to_string(qof_instance_get_guid(QOF_INSTANCE(vendor))),
+                  guid_to_string(qof_instance_get_guid(QOF_INSTANCE(term))));
+    }
 }
 
 static void
 billterm_reset_refcount (gpointer key, gpointer value, gpointer notused)
 {
-  GncBillTerm *term = key;
-  gint32 count = GPOINTER_TO_INT(value);
+    GncBillTerm *term = key;
+    gint32 count = GPOINTER_TO_INT(value);
 
-  if (count != gncBillTermGetRefcount(term) && !gncBillTermGetInvisible(term)) {
-    PWARN("Fixing refcount on billterm %s (%" G_GINT64_FORMAT " -> %d)\n",
-	  guid_to_string(qof_instance_get_guid(QOF_INSTANCE(term))),
-	  gncBillTermGetRefcount(term), count);
-      gncBillTermSetRefcount(term, count);
-  }
+    if (count != gncBillTermGetRefcount(term) && !gncBillTermGetInvisible(term))
+    {
+        PWARN("Fixing refcount on billterm %s (%" G_GINT64_FORMAT " -> %d)\n",
+              guid_to_string(qof_instance_get_guid(QOF_INSTANCE(term))),
+              gncBillTermGetRefcount(term), count);
+        gncBillTermSetRefcount(term, count);
+    }
 }
 
 static void
 billterm_scrub (QofBook *book)
 {
-  GList *list = NULL;
-  GList *node;
-  GncBillTerm *parent, *term;
-  GHashTable *ht = g_hash_table_new(g_direct_hash, g_direct_equal);
+    GList *list = NULL;
+    GList *node;
+    GncBillTerm *parent, *term;
+    GHashTable *ht = g_hash_table_new(g_direct_hash, g_direct_equal);
 
-  DEBUG("scrubbing billterms...");
-  qof_object_foreach (GNC_ID_INVOICE,  book, billterm_scrub_invoices, ht);
-  qof_object_foreach (GNC_ID_CUSTOMER, book, billterm_scrub_cust, ht);
-  qof_object_foreach (GNC_ID_VENDOR,   book, billterm_scrub_vendor, ht);
-  qof_object_foreach (GNC_ID_BILLTERM, book, billterm_scrub_cb, &list);
+    DEBUG("scrubbing billterms...");
+    qof_object_foreach (GNC_ID_INVOICE,  book, billterm_scrub_invoices, ht);
+    qof_object_foreach (GNC_ID_CUSTOMER, book, billterm_scrub_cust, ht);
+    qof_object_foreach (GNC_ID_VENDOR,   book, billterm_scrub_vendor, ht);
+    qof_object_foreach (GNC_ID_BILLTERM, book, billterm_scrub_cb, &list);
 
-  /* destroy the list of "grandchildren" bill terms */
-  for (node = list; node; node = node->next) {
-    term = node->data;
+    /* destroy the list of "grandchildren" bill terms */
+    for (node = list; node; node = node->next)
+    {
+        term = node->data;
 
-    PWARN ("deleting grandchild billterm: %s\n",
-	   guid_to_string(qof_instance_get_guid(QOF_INSTANCE(term))));
+        PWARN ("deleting grandchild billterm: %s\n",
+               guid_to_string(qof_instance_get_guid(QOF_INSTANCE(term))));
 
-    /* Make sure the parent has no children */
-    parent = gncBillTermGetParent(term);
-    gncBillTermSetChild(parent, NULL);
+        /* Make sure the parent has no children */
+        parent = gncBillTermGetParent(term);
+        gncBillTermSetChild(parent, NULL);
 
-    /* Destroy this bill term */
-    gncBillTermBeginEdit(term);
-    gncBillTermDestroy(term);
-  }
+        /* Destroy this bill term */
+        gncBillTermBeginEdit(term);
+        gncBillTermDestroy(term);
+    }
 
-  /* reset the refcounts as necessary */
-  g_hash_table_foreach(ht, billterm_reset_refcount, NULL);
+    /* reset the refcounts as necessary */
+    g_hash_table_foreach(ht, billterm_reset_refcount, NULL);
 
-  g_list_free(list);
-  g_hash_table_destroy(ht);
+    g_list_free(list);
+    g_hash_table_destroy(ht);
 }
 
 static gboolean
 billterm_ns(FILE *out)
 {
-  g_return_val_if_fail(out, FALSE);
-  return
-    gnc_xml2_write_namespace_decl(out, "billterm")
-    && gnc_xml2_write_namespace_decl(out, "bt-days")
-    && gnc_xml2_write_namespace_decl(out, "bt-prox");
+    g_return_val_if_fail(out, FALSE);
+    return
+        gnc_xml2_write_namespace_decl(out, "billterm")
+        && gnc_xml2_write_namespace_decl(out, "bt-days")
+        && gnc_xml2_write_namespace_decl(out, "bt-prox");
 }
 
 void
 gnc_billterm_xml_initialize (void)
 {
-  static GncXmlDataType_t be_data = {
-    GNC_FILE_BACKEND_VERS,
-    gnc_billterm_string,
-    billterm_sixtp_parser_create,
-    NULL,			/* add_item */
-    billterm_get_count,
-    billterm_write,
-    billterm_scrub,
-    billterm_ns,
-  };
+    static GncXmlDataType_t be_data =
+    {
+        GNC_FILE_BACKEND_VERS,
+        gnc_billterm_string,
+        billterm_sixtp_parser_create,
+        NULL,			/* add_item */
+        billterm_get_count,
+        billterm_write,
+        billterm_scrub,
+        billterm_ns,
+    };
 
-  qof_object_register_backend (_GNC_MOD_NAME,
-			    GNC_FILE_BACKEND,
-			    &be_data);
+    qof_object_register_backend (_GNC_MOD_NAME,
+                                 GNC_FILE_BACKEND,
+                                 &be_data);
 }
 
 GncBillTerm *
 gnc_billterm_xml_find_or_create(QofBook *book, GUID *guid)
 {
-  GncBillTerm *term;
+    GncBillTerm *term;
 
-  g_return_val_if_fail(book, NULL);
-  g_return_val_if_fail(guid, NULL);
-  term = gncBillTermLookup(book, guid);
-  DEBUG("looking for billterm %s, found %p", guid_to_string(guid), term);
-  if (!term) {
-    term = gncBillTermCreate(book);
-    gncBillTermBeginEdit(term);
-    gncBillTermSetGUID(term, guid);
-    gncBillTermCommitEdit(term);
-    DEBUG("Created term: %p", term);
-  } else
-    gncBillTermDecRef(term);
+    g_return_val_if_fail(book, NULL);
+    g_return_val_if_fail(guid, NULL);
+    term = gncBillTermLookup(book, guid);
+    DEBUG("looking for billterm %s, found %p", guid_to_string(guid), term);
+    if (!term)
+    {
+        term = gncBillTermCreate(book);
+        gncBillTermBeginEdit(term);
+        gncBillTermSetGUID(term, guid);
+        gncBillTermCommitEdit(term);
+        DEBUG("Created term: %p", term);
+    }
+    else
+        gncBillTermDecRef(term);
 
-  return term;
+    return term;
 }

Modified: gnucash/trunk/src/business/business-core/xml/gnc-customer-xml-v2.c
===================================================================
--- gnucash/trunk/src/business/business-core/xml/gnc-customer-xml-v2.c	2010-03-02 21:40:28 UTC (rev 18788)
+++ gnucash/trunk/src/business/business-core/xml/gnc-customer-xml-v2.c	2010-03-02 21:41:05 UTC (rev 18789)
@@ -86,54 +86,54 @@
     xmlSetProp(ret, BAD_CAST "version", BAD_CAST customer_version_string);
 
     xmlAddChild(ret, guid_to_dom_tree(cust_guid_string,
-				      qof_instance_get_guid(QOF_INSTANCE(cust))));
+                                      qof_instance_get_guid(QOF_INSTANCE(cust))));
 
     xmlAddChild(ret, text_to_dom_tree(cust_name_string,
                                       gncCustomerGetName (cust)));
-    
+
     xmlAddChild(ret, text_to_dom_tree(cust_id_string,
                                       gncCustomerGetID (cust)));
 
     xmlAddChild(ret, gnc_address_to_dom_tree(cust_addr_string,
-					     gncCustomerGetAddr (cust)));
-    
+                gncCustomerGetAddr (cust)));
+
     xmlAddChild(ret, gnc_address_to_dom_tree(cust_shipaddr_string,
-					     gncCustomerGetShipAddr (cust)));
-    
+                gncCustomerGetShipAddr (cust)));
+
     maybe_add_string (ret, cust_notes_string, gncCustomerGetNotes (cust));
 
     term = gncCustomerGetTerms (cust);
     if (term)
-      xmlAddChild(ret, guid_to_dom_tree(cust_terms_string,
-					qof_instance_get_guid (QOF_INSTANCE(term))));
+        xmlAddChild(ret, guid_to_dom_tree(cust_terms_string,
+                                          qof_instance_get_guid (QOF_INSTANCE(term))));
 
     xmlAddChild(ret, text_to_dom_tree(cust_taxincluded_string,
-				      gncTaxIncludedTypeToString (
-				     gncCustomerGetTaxIncluded (cust))));
+                                      gncTaxIncludedTypeToString (
+                                          gncCustomerGetTaxIncluded (cust))));
 
     xmlAddChild(ret, int_to_dom_tree(cust_active_string,
-				     gncCustomerGetActive (cust)));
+                                     gncCustomerGetActive (cust)));
 
     num = gncCustomerGetDiscount (cust);
     xmlAddChild(ret, gnc_numeric_to_dom_tree(cust_discount_string, &num));
-					     
+
     num = gncCustomerGetCredit (cust);
     xmlAddChild(ret, gnc_numeric_to_dom_tree(cust_credit_string, &num));
 
     xmlAddChild
-      (ret,
-       commodity_ref_to_dom_tree(cust_currency_string,
-				 gncCustomerGetCurrency (cust)));
+    (ret,
+     commodity_ref_to_dom_tree(cust_currency_string,
+                               gncCustomerGetCurrency (cust)));
 
     xmlAddChild (ret, int_to_dom_tree (cust_taxtableoverride_string,
-				       gncCustomerGetTaxTableOverride (cust)));
+                                       gncCustomerGetTaxTableOverride (cust)));
     taxtable = gncCustomerGetTaxTable (cust);
     if (taxtable)
-      xmlAddChild (ret, guid_to_dom_tree (cust_taxtable_string,
-					  qof_instance_get_guid(QOF_INSTANCE(taxtable))));
+        xmlAddChild (ret, guid_to_dom_tree (cust_taxtable_string,
+                                            qof_instance_get_guid(QOF_INSTANCE(taxtable))));
 
-    kvpnode = kvp_frame_to_dom_tree (cust_slots_string, 
-                 qof_instance_get_slots (QOF_INSTANCE(cust)));
+    kvpnode = kvp_frame_to_dom_tree (cust_slots_string,
+                                     qof_instance_get_slots (QOF_INSTANCE(cust)));
     if (kvpnode) xmlAddChild (ret, kvpnode);
 
     return ret;
@@ -143,34 +143,34 @@
 
 struct customer_pdata
 {
-  GncCustomer *customer;
-  QofBook *book;
+    GncCustomer *customer;
+    QofBook *book;
 };
 
 static gboolean
 set_string(xmlNodePtr node, GncCustomer* cust,
            void (*func)(GncCustomer *cust, const char *txt))
 {
-  char* txt = dom_tree_to_text(node);
-  g_return_val_if_fail(txt, FALSE);
-    
-  func(cust, txt);
-  
-  g_free(txt);
-    
-  return TRUE;
+    char* txt = dom_tree_to_text(node);
+    g_return_val_if_fail(txt, FALSE);
+
+    func(cust, txt);
+
+    g_free(txt);
+
+    return TRUE;
 }
 
 static gboolean
 set_boolean(xmlNodePtr node, GncCustomer* cust,
-	    void (*func)(GncCustomer* cust, gboolean b))
+            void (*func)(GncCustomer* cust, gboolean b))
 {
     gint64 val;
     gboolean ret;
 
     ret = dom_tree_to_integer(node, &val);
     if (ret)
-      func(cust, (gboolean)val);
+        func(cust, (gboolean)val);
 
     return ret;
 }
@@ -193,16 +193,19 @@
     guid = dom_tree_to_guid(node);
     g_return_val_if_fail(guid, FALSE);
     cust = gncCustomerLookup (pdata->book, guid);
-    if (cust) {
-      gncCustomerDestroy (pdata->customer);
-      pdata->customer = cust;
-      gncCustomerBeginEdit (cust);
-    } else {
-      gncCustomerSetGUID(pdata->customer, guid);
+    if (cust)
+    {
+        gncCustomerDestroy (pdata->customer);
+        pdata->customer = cust;
+        gncCustomerBeginEdit (cust);
     }
+    else
+    {
+        gncCustomerSetGUID(pdata->customer, guid);
+    }
 
     g_free(guid);
-    
+
     return TRUE;
 }
 
@@ -235,7 +238,7 @@
     g_assert(term);
     g_free (guid);
     gncCustomerSetTerms (pdata->customer, term);
-    
+
     return TRUE;
 }
 
@@ -253,7 +256,7 @@
     struct customer_pdata *pdata = cust_pdata;
 
     return gnc_dom_tree_to_address (node,
-				    gncCustomerGetShipAddr(pdata->customer));
+                                    gncCustomerGetShipAddr(pdata->customer));
 }
 
 
@@ -272,7 +275,7 @@
     g_free (str);
 
     if (ret)
-      gncCustomerSetTaxIncluded(pdata->customer, type);
+        gncCustomerSetTaxIncluded(pdata->customer, type);
 
     return ret;
 }
@@ -338,13 +341,15 @@
     guid = dom_tree_to_guid (node);
     g_return_val_if_fail (guid, FALSE);
     taxtable = gncTaxTableLookup (pdata->book, guid);
-    if (!taxtable) {
-      taxtable = gncTaxTableCreate (pdata->book);
-      gncTaxTableBeginEdit (taxtable);
-      gncTaxTableSetGUID (taxtable, guid);
-      gncTaxTableCommitEdit (taxtable);
-    } else
-      gncTaxTableDecRef (taxtable);
+    if (!taxtable)
+    {
+        taxtable = gncTaxTableCreate (pdata->book);
+        gncTaxTableBeginEdit (taxtable);
+        gncTaxTableSetGUID (taxtable, guid);
+        gncTaxTableCommitEdit (taxtable);
+    }
+    else
+        gncTaxTableDecRef (taxtable);
 
     gncCustomerSetTaxTable (pdata->customer, taxtable);
     g_free(guid);
@@ -361,12 +366,13 @@
 static gboolean
 customer_slots_handler (xmlNodePtr node, gpointer cust_pdata)
 {
-  struct customer_pdata *pdata = cust_pdata;
-  return dom_tree_to_kvp_frame_given (node, 
-       qof_instance_get_slots (QOF_INSTANCE(pdata->customer)));
+    struct customer_pdata *pdata = cust_pdata;
+    return dom_tree_to_kvp_frame_given (node,
+                                        qof_instance_get_slots (QOF_INSTANCE(pdata->customer)));
 }
 
-static struct dom_tree_handler customer_handlers_v2[] = {
+static struct dom_tree_handler customer_handlers_v2[] =
+{
     { cust_name_string, customer_name_handler, 1, 0 },
     { cust_guid_string, customer_guid_handler, 1, 0 },
     { cust_id_string, customer_id_handler, 1, 0 },
@@ -400,7 +406,7 @@
                                          &cust_pdata);
 
     if (successful)
-      gncCustomerCommitEdit (cust_pdata.customer);
+        gncCustomerCommitEdit (cust_pdata.customer);
     else
     {
         PERR ("failed to parse customer tree");
@@ -413,9 +419,9 @@
 
 static gboolean
 gnc_customer_end_handler(gpointer data_for_children,
-			 GSList* data_from_children, GSList* sibling_data,
-			 gpointer parent_data, gpointer global_data,
-			 gpointer *result, const gchar *tag)
+                         GSList* data_from_children, GSList* sibling_data,
+                         gpointer parent_data, gpointer global_data,
+                         gpointer *result, const gchar *tag)
 {
     int successful;
     GncCustomer *cust;
@@ -425,14 +431,14 @@
 
     successful = TRUE;
 
-    if(parent_data)
+    if (parent_data)
     {
         return TRUE;
     }
 
     /* OK.  For some messed up reason this is getting called again with a
        NULL tag.  So we ignore those cases */
-    if(!tag)
+    if (!tag)
     {
         return TRUE;
     }
@@ -440,7 +446,7 @@
     g_return_val_if_fail(tree, FALSE);
 
     cust = dom_tree_to_customer(tree, book);
-    if(cust != NULL)
+    if (cust != NULL)
     {
         gdata->cb(tag, gdata->parsedata, cust);
     }
@@ -453,86 +459,87 @@
 static sixtp *
 customer_sixtp_parser_create(void)
 {
-  return sixtp_dom_parser_new(gnc_customer_end_handler, NULL, NULL);
+    return sixtp_dom_parser_new(gnc_customer_end_handler, NULL, NULL);
 }
 
 static gboolean
 customer_should_be_saved (GncCustomer *customer)
 {
-  const char *id;
+    const char *id;
 
-  /* make sure this is a valid customer before we save it -- should have an ID */
-  id = gncCustomerGetID (customer);
-  if (id == NULL || *id == '\0')
-    return FALSE;
+    /* make sure this is a valid customer before we save it -- should have an ID */
+    id = gncCustomerGetID (customer);
+    if (id == NULL || *id == '\0')
+        return FALSE;
 
-  return TRUE;
+    return TRUE;
 }
 
 static void
 do_count (QofInstance * cust_p, gpointer count_p)
 {
-  int *count = count_p;
-  if (customer_should_be_saved ((GncCustomer *)cust_p))
-    (*count)++;
+    int *count = count_p;
+    if (customer_should_be_saved ((GncCustomer *)cust_p))
+        (*count)++;
 }
 
 static int
 customer_get_count (QofBook *book)
 {
-  int count = 0;
-  qof_object_foreach (_GNC_MOD_NAME, book, do_count, (gpointer) &count);
-  return count;
+    int count = 0;
+    qof_object_foreach (_GNC_MOD_NAME, book, do_count, (gpointer) &count);
+    return count;
 }
 
 static void
 xml_add_customer (QofInstance * cust_p, gpointer out_p)
 {
-  xmlNodePtr node;
-  GncCustomer *cust = (GncCustomer *) cust_p;
-  FILE *out = out_p;
+    xmlNodePtr node;
+    GncCustomer *cust = (GncCustomer *) cust_p;
+    FILE *out = out_p;
 
-  if (ferror(out))
-    return;
-  if (!customer_should_be_saved (cust))
-    return;
+    if (ferror(out))
+        return;
+    if (!customer_should_be_saved (cust))
+        return;
 
-  node = customer_dom_tree_create (cust);
-  xmlElemDump(out, NULL, node);
-  xmlFreeNode (node);
-  if (ferror(out) || fprintf(out, "\n") < 0)
-    return;
+    node = customer_dom_tree_create (cust);
+    xmlElemDump(out, NULL, node);
+    xmlFreeNode (node);
+    if (ferror(out) || fprintf(out, "\n") < 0)
+        return;
 }
 
 static gboolean
 customer_write (FILE *out, QofBook *book)
 {
-  qof_object_foreach (_GNC_MOD_NAME, book, xml_add_customer, (gpointer) out);
-  return ferror(out) == 0;
+    qof_object_foreach (_GNC_MOD_NAME, book, xml_add_customer, (gpointer) out);
+    return ferror(out) == 0;
 }
 
 static gboolean
 customer_ns(FILE *out)
 {
-  g_return_val_if_fail(out, FALSE);
-  return gnc_xml2_write_namespace_decl(out, "cust");
+    g_return_val_if_fail(out, FALSE);
+    return gnc_xml2_write_namespace_decl(out, "cust");
 }
 
 void
 gnc_customer_xml_initialize (void)
 {
-  static GncXmlDataType_t be_data = {
-    GNC_FILE_BACKEND_VERS,
-    gnc_customer_string,
-    customer_sixtp_parser_create,
-    NULL,			/* add_item */
-    customer_get_count,
-    customer_write,
-    NULL,			/* scrub */
-    customer_ns,
-  };
+    static GncXmlDataType_t be_data =
+    {
+        GNC_FILE_BACKEND_VERS,
+        gnc_customer_string,
+        customer_sixtp_parser_create,
+        NULL,			/* add_item */
+        customer_get_count,
+        customer_write,
+        NULL,			/* scrub */
+        customer_ns,
+    };
 
-  qof_object_register_backend (_GNC_MOD_NAME,
-			    GNC_FILE_BACKEND,
-			    &be_data);
+    qof_object_register_backend (_GNC_MOD_NAME,
+                                 GNC_FILE_BACKEND,
+                                 &be_data);
 }

Modified: gnucash/trunk/src/business/business-core/xml/gnc-employee-xml-v2.c
===================================================================
--- gnucash/trunk/src/business/business-core/xml/gnc-employee-xml-v2.c	2010-03-02 21:40:28 UTC (rev 18788)
+++ gnucash/trunk/src/business/business-core/xml/gnc-employee-xml-v2.c	2010-03-02 21:41:05 UTC (rev 18789)
@@ -69,8 +69,8 @@
 static void
 maybe_add_string (xmlNodePtr ptr, const char *tag, const char *str)
 {
-  if (str && strlen(str) > 0)
-    xmlAddChild (ptr, text_to_dom_tree (tag, str));
+    if (str && strlen(str) > 0)
+        xmlAddChild (ptr, text_to_dom_tree (tag, str));
 }
 
 static xmlNodePtr
@@ -84,23 +84,23 @@
     xmlSetProp(ret, BAD_CAST "version", BAD_CAST employee_version_string);
 
     xmlAddChild(ret, guid_to_dom_tree(employee_guid_string,
-				      qof_instance_get_guid(QOF_INSTANCE (employee))));
+                                      qof_instance_get_guid(QOF_INSTANCE (employee))));
 
     xmlAddChild(ret, text_to_dom_tree(employee_username_string,
                                       gncEmployeeGetUsername (employee)));
-    
+
     xmlAddChild(ret, text_to_dom_tree(employee_id_string,
                                       gncEmployeeGetID (employee)));
 
     xmlAddChild(ret, gnc_address_to_dom_tree(employee_addr_string,
-					     gncEmployeeGetAddr (employee)));
-    
+                gncEmployeeGetAddr (employee)));
+
     maybe_add_string (ret, employee_language_string,
-		      gncEmployeeGetLanguage (employee));
+                      gncEmployeeGetLanguage (employee));
     maybe_add_string (ret, employee_acl_string, gncEmployeeGetAcl (employee));
 
     xmlAddChild(ret, int_to_dom_tree(employee_active_string,
-				     gncEmployeeGetActive (employee)));
+                                     gncEmployeeGetActive (employee)));
 
     num = gncEmployeeGetWorkday (employee);
     xmlAddChild(ret, gnc_numeric_to_dom_tree (employee_workday_string, &num));
@@ -109,17 +109,17 @@
     xmlAddChild(ret, gnc_numeric_to_dom_tree (employee_rate_string, &num));
 
     xmlAddChild
-      (ret,
-       commodity_ref_to_dom_tree(employee_currency_string,
-				 gncEmployeeGetCurrency (employee)));
+    (ret,
+     commodity_ref_to_dom_tree(employee_currency_string,
+                               gncEmployeeGetCurrency (employee)));
 
     ccard_acc = gncEmployeeGetCCard (employee);
     if (ccard_acc)
-      xmlAddChild(ret, guid_to_dom_tree(employee_ccard_string,
-					qof_instance_get_guid(QOF_INSTANCE(ccard_acc))));
+        xmlAddChild(ret, guid_to_dom_tree(employee_ccard_string,
+                                          qof_instance_get_guid(QOF_INSTANCE(ccard_acc))));
 
     kvpnode = kvp_frame_to_dom_tree (employee_slots_string,
-				     qof_instance_get_slots (QOF_INSTANCE(employee)));
+                                     qof_instance_get_slots (QOF_INSTANCE(employee)));
     if (kvpnode) xmlAddChild (ret, kvpnode);
 
     return ret;
@@ -129,22 +129,22 @@
 
 struct employee_pdata
 {
-  GncEmployee *employee;
-  QofBook *book;
+    GncEmployee *employee;
+    QofBook *book;
 };
 
 static gboolean
 set_string(xmlNodePtr node, GncEmployee* employee,
            void (*func)(GncEmployee *employee, const char *txt))
 {
-  char* txt = dom_tree_to_text(node);
-  g_return_val_if_fail(txt, FALSE);
-    
-  func(employee, txt);
-  
-  g_free(txt);
-    
-  return TRUE;
+    char* txt = dom_tree_to_text(node);
+    g_return_val_if_fail(txt, FALSE);
+
+    func(employee, txt);
+
+    g_free(txt);
+
+    return TRUE;
 }
 
 static gboolean
@@ -167,16 +167,19 @@
 
     /* See if we've already created this one */
     employee = gncEmployeeLookup (pdata->book, guid);
-    if (employee) {
-      gncEmployeeDestroy (pdata->employee);
-      pdata->employee = employee;
-      gncEmployeeBeginEdit (employee);
-    } else {
-      gncEmployeeSetGUID(pdata->employee, guid);
+    if (employee)
+    {
+        gncEmployeeDestroy (pdata->employee);
+        pdata->employee = employee;
+        gncEmployeeBeginEdit (employee);
     }
+    else
+    {
+        gncEmployeeSetGUID(pdata->employee, guid);
+    }
 
     g_free(guid);
-    
+
     return TRUE;
 }
 
@@ -221,7 +224,7 @@
 
     ret = dom_tree_to_integer(node, &val);
     if (ret)
-      gncEmployeeSetActive(pdata->employee, (gboolean)val);
+        gncEmployeeSetActive(pdata->employee, (gboolean)val);
 
     return ret;
 }
@@ -292,10 +295,11 @@
 {
     struct employee_pdata *pdata = employee_pdata;
     return dom_tree_to_kvp_frame_given (
-	node, qof_instance_get_slots (QOF_INSTANCE(pdata->employee)));
+               node, qof_instance_get_slots (QOF_INSTANCE(pdata->employee)));
 }
 
-static struct dom_tree_handler employee_handlers_v2[] = {
+static struct dom_tree_handler employee_handlers_v2[] =
+{
     { employee_username_string, employee_username_handler, 1, 0 },
     { employee_guid_string, employee_guid_handler, 1, 0 },
     { employee_id_string, employee_id_handler, 1, 0 },
@@ -325,7 +329,7 @@
     successful = dom_tree_generic_parse (node, employee_handlers_v2,
                                          &employee_pdata);
     if (successful)
-      gncEmployeeCommitEdit (employee_pdata.employee);
+        gncEmployeeCommitEdit (employee_pdata.employee);
     else
     {
         PERR ("failed to parse employee tree");
@@ -338,9 +342,9 @@
 
 static gboolean
 gnc_employee_end_handler(gpointer data_for_children,
-			 GSList* data_from_children, GSList* sibling_data,
-			 gpointer parent_data, gpointer global_data,
-			 gpointer *result, const gchar *tag)
+                         GSList* data_from_children, GSList* sibling_data,
+                         gpointer parent_data, gpointer global_data,
+                         gpointer *result, const gchar *tag)
 {
     int successful;
     GncEmployee *employee;
@@ -350,14 +354,14 @@
 
     successful = TRUE;
 
-    if(parent_data)
+    if (parent_data)
     {
         return TRUE;
     }
 
     /* OK.  For some messed up reason this is getting called again with a
        NULL tag.  So we ignore those cases */
-    if(!tag)
+    if (!tag)
     {
         return TRUE;
     }
@@ -365,7 +369,7 @@
     g_return_val_if_fail(tree, FALSE);
 
     employee = dom_tree_to_employee(tree, book);
-    if(employee != NULL)
+    if (employee != NULL)
     {
         gdata->cb(tag, gdata->parsedata, employee);
     }
@@ -378,86 +382,87 @@
 static sixtp *
 employee_sixtp_parser_create(void)
 {
-  return sixtp_dom_parser_new(gnc_employee_end_handler, NULL, NULL);
+    return sixtp_dom_parser_new(gnc_employee_end_handler, NULL, NULL);
 }
 
 static gboolean
 employee_should_be_saved (GncEmployee *employee)
 {
-  const char *id;
+    const char *id;
 
-  /* make sure this is a valid employee before we save it -- should have an ID */
-  id = gncEmployeeGetID (employee);
-  if (id == NULL || *id == '\0')
-    return FALSE;
+    /* make sure this is a valid employee before we save it -- should have an ID */
+    id = gncEmployeeGetID (employee);
+    if (id == NULL || *id == '\0')
+        return FALSE;
 
-  return TRUE;
+    return TRUE;
 }
 
 static void
 do_count (QofInstance * employee_p, gpointer count_p)
 {
-  int *count = count_p;
-  if (employee_should_be_saved ((GncEmployee *) employee_p))
-    (*count)++;
+    int *count = count_p;
+    if (employee_should_be_saved ((GncEmployee *) employee_p))
+        (*count)++;
 }
 
 static int
 employee_get_count (QofBook *book)
 {
-  int count = 0;
-  qof_object_foreach (_GNC_MOD_NAME, book, do_count, (gpointer) &count);
-  return count;
+    int count = 0;
+    qof_object_foreach (_GNC_MOD_NAME, book, do_count, (gpointer) &count);
+    return count;
 }
 
 static void
 xml_add_employee (QofInstance * employee_p, gpointer out_p)
 {
-  xmlNodePtr node;
-  GncEmployee *employee = (GncEmployee *) employee_p;
-  FILE *out = out_p;
+    xmlNodePtr node;
+    GncEmployee *employee = (GncEmployee *) employee_p;
+    FILE *out = out_p;
 
-  if (ferror(out))
-    return;
-  if (!employee_should_be_saved (employee))
-    return;
+    if (ferror(out))
+        return;
+    if (!employee_should_be_saved (employee))
+        return;
 
-  node = employee_dom_tree_create (employee);
-  xmlElemDump(out, NULL, node);
-  xmlFreeNode (node);
-  if (ferror(out) || fprintf(out, "\n") < 0)
-    return;
+    node = employee_dom_tree_create (employee);
+    xmlElemDump(out, NULL, node);
+    xmlFreeNode (node);
+    if (ferror(out) || fprintf(out, "\n") < 0)
+        return;
 }
 
 static gboolean
 employee_write (FILE *out, QofBook *book)
 {
-  qof_object_foreach (_GNC_MOD_NAME, book, xml_add_employee, (gpointer) out);
-  return ferror(out) == 0;
+    qof_object_foreach (_GNC_MOD_NAME, book, xml_add_employee, (gpointer) out);
+    return ferror(out) == 0;
 }
 
 static gboolean
 employee_ns(FILE *out)
 {
-  g_return_val_if_fail(out, FALSE);
-  return gnc_xml2_write_namespace_decl(out, "employee");
+    g_return_val_if_fail(out, FALSE);
+    return gnc_xml2_write_namespace_decl(out, "employee");
 }
 
 void
 gnc_employee_xml_initialize (void)
 {
-  static GncXmlDataType_t be_data = {
-    GNC_FILE_BACKEND_VERS,
-    gnc_employee_string,
-    employee_sixtp_parser_create,
-    NULL,			/* add_item */
-    employee_get_count,
-    employee_write,
-    NULL,			/* scrub */
-    employee_ns,
-  };
+    static GncXmlDataType_t be_data =
+    {
+        GNC_FILE_BACKEND_VERS,
+        gnc_employee_string,
+        employee_sixtp_parser_create,
+        NULL,			/* add_item */
+        employee_get_count,
+        employee_write,
+        NULL,			/* scrub */
+        employee_ns,
+    };
 
-  qof_object_register_backend (_GNC_MOD_NAME,
-			    GNC_FILE_BACKEND,
-			    &be_data);
+    qof_object_register_backend (_GNC_MOD_NAME,
+                                 GNC_FILE_BACKEND,
+                                 &be_data);
 }

Modified: gnucash/trunk/src/business/business-core/xml/gnc-entry-xml-v2.c
===================================================================
--- gnucash/trunk/src/business/business-core/xml/gnc-entry-xml-v2.c	2010-03-02 21:40:28 UTC (rev 18788)
+++ gnucash/trunk/src/business/business-core/xml/gnc-entry-xml-v2.c	2010-03-02 21:41:05 UTC (rev 18789)
@@ -95,15 +95,15 @@
 static void
 maybe_add_string (xmlNodePtr ptr, const char *tag, const char *str)
 {
-  if (str && strlen(str) > 0)
-    xmlAddChild (ptr, text_to_dom_tree (tag, str));
+    if (str && strlen(str) > 0)
+        xmlAddChild (ptr, text_to_dom_tree (tag, str));
 }
 
 static void
 maybe_add_numeric (xmlNodePtr ptr, const char *tag, gnc_numeric num)
 {
-  if (!gnc_numeric_zero_p (num))
-    xmlAddChild (ptr, gnc_numeric_to_dom_tree (tag, &num));
+    if (!gnc_numeric_zero_p (num))
+        xmlAddChild (ptr, gnc_numeric_to_dom_tree (tag, &num));
 }
 
 static xmlNodePtr
@@ -120,16 +120,16 @@
     xmlSetProp(ret, BAD_CAST "version", BAD_CAST entry_version_string);
 
     xmlAddChild(ret, guid_to_dom_tree(entry_guid_string,
-				      qof_instance_get_guid(QOF_INSTANCE(entry))));
+                                      qof_instance_get_guid(QOF_INSTANCE(entry))));
 
     ts = gncEntryGetDate (entry);
     xmlAddChild(ret, timespec_to_dom_tree (entry_date_string, &ts));
 
     ts = gncEntryGetDateEntered (entry);
     xmlAddChild(ret, timespec_to_dom_tree (entry_dateentered_string, &ts));
-    
+
     maybe_add_string (ret, entry_description_string,
-		      gncEntryGetDescription (entry));
+                      gncEntryGetDescription (entry));
     maybe_add_string (ret, entry_action_string, gncEntryGetAction (entry));
     maybe_add_string (ret, entry_notes_string, gncEntryGetNotes (entry));
 
@@ -139,75 +139,77 @@
 
     acc = gncEntryGetInvAccount (entry);
     if (acc)
-      xmlAddChild (ret, guid_to_dom_tree (entry_invacct_string,
-					  qof_instance_get_guid(QOF_INSTANCE(acc))));
+        xmlAddChild (ret, guid_to_dom_tree (entry_invacct_string,
+                                            qof_instance_get_guid(QOF_INSTANCE(acc))));
 
     maybe_add_numeric (ret, entry_iprice_string, gncEntryGetInvPrice (entry));
 
     maybe_add_numeric (ret, entry_idiscount_string, gncEntryGetInvDiscount (entry));
-    
+
     invoice = gncEntryGetInvoice (entry);
-    if (invoice) {
-      xmlAddChild (ret, guid_to_dom_tree (entry_invoice_string,
-					  qof_instance_get_guid(QOF_INSTANCE(invoice))));
+    if (invoice)
+    {
+        xmlAddChild (ret, guid_to_dom_tree (entry_invoice_string,
+                                            qof_instance_get_guid(QOF_INSTANCE(invoice))));
 
-      xmlAddChild(ret, text_to_dom_tree(entry_idisctype_string,
-					gncAmountTypeToString (
-				       gncEntryGetInvDiscountType (entry))));
-      xmlAddChild(ret, text_to_dom_tree(entry_idischow_string,
-					gncEntryDiscountHowToString (
-				     gncEntryGetInvDiscountHow (entry))));
+        xmlAddChild(ret, text_to_dom_tree(entry_idisctype_string,
+                                          gncAmountTypeToString (
+                                              gncEntryGetInvDiscountType (entry))));
+        xmlAddChild(ret, text_to_dom_tree(entry_idischow_string,
+                                          gncEntryDiscountHowToString (
+                                              gncEntryGetInvDiscountHow (entry))));
 
-      xmlAddChild(ret, int_to_dom_tree(entry_itaxable_string,
-				       gncEntryGetInvTaxable (entry)));
-      xmlAddChild(ret, int_to_dom_tree(entry_itaxincluded_string,
-				       gncEntryGetInvTaxIncluded (entry)));
+        xmlAddChild(ret, int_to_dom_tree(entry_itaxable_string,
+                                         gncEntryGetInvTaxable (entry)));
+        xmlAddChild(ret, int_to_dom_tree(entry_itaxincluded_string,
+                                         gncEntryGetInvTaxIncluded (entry)));
     }
 
     taxtable = gncEntryGetInvTaxTable (entry);
     if (taxtable)
-      xmlAddChild (ret, guid_to_dom_tree (entry_itaxtable_string,
-					  qof_instance_get_guid (QOF_INSTANCE(taxtable))));
+        xmlAddChild (ret, guid_to_dom_tree (entry_itaxtable_string,
+                                            qof_instance_get_guid (QOF_INSTANCE(taxtable))));
 
     /* vendor bills */
 
     acc = gncEntryGetBillAccount (entry);
     if (acc)
-      xmlAddChild (ret, guid_to_dom_tree (entry_billacct_string,
-					  qof_instance_get_guid (QOF_INSTANCE(acc))));
+        xmlAddChild (ret, guid_to_dom_tree (entry_billacct_string,
+                                            qof_instance_get_guid (QOF_INSTANCE(acc))));
 
     maybe_add_numeric (ret, entry_bprice_string, gncEntryGetBillPrice (entry));
 
     invoice = gncEntryGetBill (entry);
-    if (invoice) {
-      GncOwner *owner;
-      xmlAddChild (ret, guid_to_dom_tree (entry_bill_string,
-					  qof_instance_get_guid(QOF_INSTANCE(invoice))));
-      xmlAddChild(ret, int_to_dom_tree(entry_billable_string,
-				       gncEntryGetBillable (entry)));
-      owner = gncEntryGetBillTo (entry);
-      if (owner && owner->owner.undefined != NULL)
-	xmlAddChild (ret, gnc_owner_to_dom_tree (entry_billto_string, owner));
+    if (invoice)
+    {
+        GncOwner *owner;
+        xmlAddChild (ret, guid_to_dom_tree (entry_bill_string,
+                                            qof_instance_get_guid(QOF_INSTANCE(invoice))));
+        xmlAddChild(ret, int_to_dom_tree(entry_billable_string,
+                                         gncEntryGetBillable (entry)));
+        owner = gncEntryGetBillTo (entry);
+        if (owner && owner->owner.undefined != NULL)
+            xmlAddChild (ret, gnc_owner_to_dom_tree (entry_billto_string, owner));
 
-      xmlAddChild(ret, int_to_dom_tree(entry_btaxable_string,
-				       gncEntryGetBillTaxable (entry)));
-      xmlAddChild(ret, int_to_dom_tree(entry_btaxincluded_string,
-				       gncEntryGetBillTaxIncluded (entry)));
-      maybe_add_string (ret, entry_billpayment_string,
-		gncEntryPaymentTypeToString (gncEntryGetBillPayment (entry)));
+        xmlAddChild(ret, int_to_dom_tree(entry_btaxable_string,
+                                         gncEntryGetBillTaxable (entry)));
+        xmlAddChild(ret, int_to_dom_tree(entry_btaxincluded_string,
+                                         gncEntryGetBillTaxIncluded (entry)));
+        maybe_add_string (ret, entry_billpayment_string,
+                          gncEntryPaymentTypeToString (gncEntryGetBillPayment (entry)));
     }
 
     taxtable = gncEntryGetBillTaxTable (entry);
     if (taxtable)
-      xmlAddChild (ret, guid_to_dom_tree (entry_btaxtable_string,
-					  qof_instance_get_guid (QOF_INSTANCE(taxtable))));
+        xmlAddChild (ret, guid_to_dom_tree (entry_btaxtable_string,
+                                            qof_instance_get_guid (QOF_INSTANCE(taxtable))));
 
     /* Other stuff */
 
     order = gncEntryGetOrder (entry);
     if (order)
-      xmlAddChild (ret, guid_to_dom_tree (entry_order_string,
-					  qof_instance_get_guid(QOF_INSTANCE (order))));
+        xmlAddChild (ret, guid_to_dom_tree (entry_order_string,
+                                            qof_instance_get_guid(QOF_INSTANCE (order))));
 
     return ret;
 }
@@ -216,61 +218,61 @@
 
 struct entry_pdata
 {
-  GncEntry *entry;
-  QofBook *book;
-  Account *acc;
+    GncEntry *entry;
+    QofBook *book;
+    Account *acc;
 };
 
 static inline gboolean
 set_string(xmlNodePtr node, GncEntry* entry,
            void (*func)(GncEntry *entry, const char *txt))
 {
-  char* txt = dom_tree_to_text(node);
-  g_return_val_if_fail(txt, FALSE);
-    
-  func(entry, txt);
-  g_free(txt);
-  return TRUE;
+    char* txt = dom_tree_to_text(node);
+    g_return_val_if_fail(txt, FALSE);
+
+    func(entry, txt);
+    g_free(txt);
+    return TRUE;
 }
 
 static inline gboolean
 set_timespec(xmlNodePtr node, GncEntry* entry,
-           void (*func)(GncEntry *entry, Timespec ts))
+             void (*func)(GncEntry *entry, Timespec ts))
 {
-  Timespec ts = dom_tree_to_timespec (node);
-  if (!dom_tree_valid_timespec(&ts, node->name)) return FALSE;
-    
-  func(entry, ts);
-  return TRUE;
+    Timespec ts = dom_tree_to_timespec (node);
+    if (!dom_tree_valid_timespec(&ts, node->name)) return FALSE;
+
+    func(entry, ts);
+    return TRUE;
 }
 
 static inline gboolean
 set_numeric(xmlNodePtr node, GncEntry* entry,
-           void (*func)(GncEntry *entry, gnc_numeric num))
+            void (*func)(GncEntry *entry, gnc_numeric num))
 {
-  gnc_numeric* num = dom_tree_to_gnc_numeric(node);
-  g_return_val_if_fail(num, FALSE);
-    
-  func(entry, *num);
-  g_free(num);
-  return TRUE;
+    gnc_numeric* num = dom_tree_to_gnc_numeric(node);
+    g_return_val_if_fail(num, FALSE);
+
+    func(entry, *num);
+    g_free(num);
+    return TRUE;
 }
 
 static inline gboolean
 set_boolean(xmlNodePtr node, GncEntry* entry,
-	    void (*func)(GncEntry *entry, gboolean val))
+            void (*func)(GncEntry *entry, gboolean val))
 {
     gint64 val;
 
     if (!dom_tree_to_integer(node, &val))
-      return FALSE;
+        return FALSE;
     func (entry, (gboolean)val);
     return TRUE;
 }
 
 static inline gboolean
 set_account(xmlNodePtr node, struct entry_pdata *pdata,
-	    void (*func)(GncEntry *entry, Account *acc))
+            void (*func)(GncEntry *entry, Account *acc))
 {
     GUID *guid;
     Account * acc;
@@ -282,15 +284,15 @@
     g_return_val_if_fail (acc, FALSE);
 
     if (func)
-      func (pdata->entry, acc);
+        func (pdata->entry, acc);
     else
-      pdata->acc = acc;
+        pdata->acc = acc;
     return TRUE;
 }
 
 static inline gboolean
 set_taxtable (xmlNodePtr node, struct entry_pdata *pdata,
-	      void (*func)(GncEntry *entry, GncTaxTable *taxtable))
+              void (*func)(GncEntry *entry, GncTaxTable *taxtable))
 {
     GUID *guid;
     GncTaxTable *taxtable;
@@ -298,13 +300,15 @@
     guid = dom_tree_to_guid (node);
     g_return_val_if_fail (guid, FALSE);
     taxtable = gncTaxTableLookup (pdata->book, guid);
-    if (!taxtable) {
-      taxtable = gncTaxTableCreate (pdata->book);
-      gncTaxTableBeginEdit (taxtable);
-      gncTaxTableSetGUID (taxtable, guid);
-      gncTaxTableCommitEdit (taxtable);
-    } else
-      gncTaxTableDecRef (taxtable);
+    if (!taxtable)
+    {
+        taxtable = gncTaxTableCreate (pdata->book);
+        gncTaxTableBeginEdit (taxtable);
+        gncTaxTableSetGUID (taxtable, guid);
+        gncTaxTableCommitEdit (taxtable);
+    }
+    else
+        gncTaxTableDecRef (taxtable);
 
     func (pdata->entry, taxtable);
     g_free(guid);
@@ -321,16 +325,19 @@
     guid = dom_tree_to_guid(node);
     g_return_val_if_fail (guid, FALSE);
     entry = gncEntryLookup (pdata->book, guid);
-    if (entry) {
-      gncEntryDestroy (pdata->entry);
-      pdata->entry = entry;
-      gncEntryBeginEdit (entry);
-    } else {
-      gncEntrySetGUID(pdata->entry, guid);
+    if (entry)
+    {
+        gncEntryDestroy (pdata->entry);
+        pdata->entry = entry;
+        gncEntryBeginEdit (entry);
     }
+    else
+    {
+        gncEntrySetGUID(pdata->entry, guid);
+    }
 
     g_free(guid);
-    
+
     return TRUE;
 }
 
@@ -422,7 +429,7 @@
     g_free (str);
 
     if (ret)
-      gncEntrySetInvDiscountType(pdata->entry, type);
+        gncEntrySetInvDiscountType(pdata->entry, type);
 
     return ret;
 }
@@ -442,7 +449,7 @@
     g_free (str);
 
     if (ret)
-      gncEntrySetInvDiscountHow(pdata->entry, how);
+        gncEntrySetInvDiscountHow(pdata->entry, how);
 
     return ret;
 }
@@ -516,15 +523,15 @@
 static gboolean
 entry_billto_handler (xmlNodePtr node, gpointer entry_pdata)
 {
-  struct entry_pdata *pdata = entry_pdata;
-  GncOwner billto;
-  gboolean ret;
+    struct entry_pdata *pdata = entry_pdata;
+    GncOwner billto;
+    gboolean ret;
 
-  ret = gnc_dom_tree_to_owner (node, &billto, pdata->book);
-  if (ret)
-    gncEntrySetBillTo (pdata->entry, &billto);
+    ret = gnc_dom_tree_to_owner (node, &billto, pdata->book);
+    if (ret)
+        gncEntrySetBillTo (pdata->entry, &billto);
 
-  return ret;
+    return ret;
 }
 
 /* employee bills */
@@ -543,7 +550,7 @@
     g_free (str);
 
     if (ret)
-      gncEntrySetBillPayment(pdata->entry, type);
+        gncEntrySetBillPayment(pdata->entry, type);
 
     return ret;
 }
@@ -560,11 +567,12 @@
     guid = dom_tree_to_guid (node);
     g_return_val_if_fail (guid, FALSE);
     order = gncOrderLookup (pdata->book, guid);
-    if (!order) {
-      order = gncOrderCreate (pdata->book);
-      gncOrderBeginEdit (order);
-      gncOrderSetGUID (order, guid);
-      gncOrderCommitEdit (order);
+    if (!order)
+    {
+        order = gncOrderCreate (pdata->book);
+        gncOrderBeginEdit (order);
+        gncOrderSetGUID (order, guid);
+        gncOrderCommitEdit (order);
     }
     gncOrderBeginEdit (order);
     gncOrderAddEntry (order, pdata->entry);
@@ -584,11 +592,12 @@
     guid = dom_tree_to_guid (node);
     g_return_val_if_fail (guid, FALSE);
     invoice = gncInvoiceLookup (pdata->book, guid);
-    if (!invoice) {
-      invoice = gncInvoiceCreate (pdata->book);
-      gncInvoiceBeginEdit (invoice);
-      gncInvoiceSetGUID (invoice, guid);
-      gncInvoiceCommitEdit (invoice);
+    if (!invoice)
+    {
+        invoice = gncInvoiceCreate (pdata->book);
+        gncInvoiceBeginEdit (invoice);
+        gncInvoiceSetGUID (invoice, guid);
+        gncInvoiceCommitEdit (invoice);
     }
     gncInvoiceBeginEdit (invoice);
     gncInvoiceAddEntry (invoice, pdata->entry);
@@ -608,11 +617,12 @@
     guid = dom_tree_to_guid (node);
     g_return_val_if_fail (guid, FALSE);
     invoice = gncInvoiceLookup (pdata->book, guid);
-    if (!invoice) {
-      invoice = gncInvoiceCreate (pdata->book);
-      gncInvoiceBeginEdit (invoice);
-      gncInvoiceSetGUID (invoice, guid);
-      gncInvoiceCommitEdit (invoice);
+    if (!invoice)
+    {
+        invoice = gncInvoiceCreate (pdata->book);
+        gncInvoiceBeginEdit (invoice);
+        gncInvoiceSetGUID (invoice, guid);
+        gncInvoiceCommitEdit (invoice);
     }
     gncInvoiceBeginEdit (invoice);
     gncBillAddEntry (invoice, pdata->entry);
@@ -644,17 +654,18 @@
     /* just set both.. Don't worry about extra data if it's wrong */
     res = set_numeric(node, pdata->entry, gncEntrySetInvPrice);
     if (res)
-      gncEntrySetBillPrice (pdata->entry, gncEntryGetInvPrice (pdata->entry));
+        gncEntrySetBillPrice (pdata->entry, gncEntryGetInvPrice (pdata->entry));
     return res;
 }
 
 static gboolean
 entry_slots_handler (xmlNodePtr node, gpointer entry_pdata)
 {
-  return TRUE;
+    return TRUE;
 }
 
-static struct dom_tree_handler entry_handlers_v2[] = {
+static struct dom_tree_handler entry_handlers_v2[] =
+{
     { entry_guid_string, entry_guid_handler, 1, 0 },
     { entry_date_string, entry_date_handler, 1, 0 },
     { entry_dateentered_string, entry_dateentered_handler, 1, 0 },
@@ -716,15 +727,16 @@
 
     successful = dom_tree_generic_parse (node, entry_handlers_v2,
                                          &entry_pdata);
-    if (entry_pdata.acc != NULL) {
-      if (gncEntryGetBill (entry_pdata.entry))
-	gncEntrySetBillAccount (entry_pdata.entry, entry_pdata.acc);
-      else
-	gncEntrySetInvAccount (entry_pdata.entry, entry_pdata.acc);
+    if (entry_pdata.acc != NULL)
+    {
+        if (gncEntryGetBill (entry_pdata.entry))
+            gncEntrySetBillAccount (entry_pdata.entry, entry_pdata.acc);
+        else
+            gncEntrySetInvAccount (entry_pdata.entry, entry_pdata.acc);
     }
 
     if (successful)
-      gncEntryCommitEdit (entry_pdata.entry);
+        gncEntryCommitEdit (entry_pdata.entry);
     else
     {
         PERR ("failed to parse entry tree");
@@ -737,9 +749,9 @@
 
 static gboolean
 gnc_entry_end_handler(gpointer data_for_children,
-			 GSList* data_from_children, GSList* sibling_data,
-			 gpointer parent_data, gpointer global_data,
-			 gpointer *result, const gchar *tag)
+                      GSList* data_from_children, GSList* sibling_data,
+                      gpointer parent_data, gpointer global_data,
+                      gpointer *result, const gchar *tag)
 {
     int successful;
     GncEntry *entry;
@@ -749,14 +761,14 @@
 
     successful = TRUE;
 
-    if(parent_data)
+    if (parent_data)
     {
         return TRUE;
     }
 
     /* OK.  For some messed up reason this is getting called again with a
        NULL tag.  So we ignore those cases */
-    if(!tag)
+    if (!tag)
     {
         return TRUE;
     }
@@ -764,7 +776,7 @@
     g_return_val_if_fail(tree, FALSE);
 
     entry = dom_tree_to_entry(tree, book);
-    if(entry != NULL)
+    if (entry != NULL)
     {
         gdata->cb(tag, gdata->parsedata, entry);
     }
@@ -777,75 +789,76 @@
 static sixtp *
 entry_sixtp_parser_create(void)
 {
-  return sixtp_dom_parser_new(gnc_entry_end_handler, NULL, NULL);
+    return sixtp_dom_parser_new(gnc_entry_end_handler, NULL, NULL);
 }
 
 static void
 do_count (QofInstance * entry_p, gpointer count_p)
 {
-  int *count = count_p;
-  (*count)++;
+    int *count = count_p;
+    (*count)++;
 }
 
 static int
 entry_get_count (QofBook *book)
 {
-  int count = 0;
-  qof_object_foreach (_GNC_MOD_NAME, book, do_count, (gpointer) &count);
-  return count;
+    int count = 0;
+    qof_object_foreach (_GNC_MOD_NAME, book, do_count, (gpointer) &count);
+    return count;
 }
 
 static void
 xml_add_entry (QofInstance * entry_p, gpointer out_p)
 {
-  xmlNodePtr node;
-  GncEntry *entry = (GncEntry *) entry_p;
-  FILE *out = out_p;
+    xmlNodePtr node;
+    GncEntry *entry = (GncEntry *) entry_p;
+    FILE *out = out_p;
 
-  if (ferror(out))
-    return;
+    if (ferror(out))
+        return;
 
-  /* Don't save non-attached entries! */
-  if (!(gncEntryGetOrder (entry) || gncEntryGetInvoice (entry) ||
-	gncEntryGetBill (entry)))
-    return;
+    /* Don't save non-attached entries! */
+    if (!(gncEntryGetOrder (entry) || gncEntryGetInvoice (entry) ||
+            gncEntryGetBill (entry)))
+        return;
 
-  node = entry_dom_tree_create (entry);
-  xmlElemDump(out, NULL, node);
-  xmlFreeNode (node);
-  if (ferror(out) || fprintf(out, "\n") < 0)
-    return;
+    node = entry_dom_tree_create (entry);
+    xmlElemDump(out, NULL, node);
+    xmlFreeNode (node);
+    if (ferror(out) || fprintf(out, "\n") < 0)
+        return;
 }
 
 static gboolean
 entry_write (FILE *out, QofBook *book)
 {
-  qof_object_foreach (_GNC_MOD_NAME, book, xml_add_entry, (gpointer) out);
-  return ferror(out) == 0;
+    qof_object_foreach (_GNC_MOD_NAME, book, xml_add_entry, (gpointer) out);
+    return ferror(out) == 0;
 }
 
 static gboolean
 entry_ns(FILE *out)
 {
-  g_return_val_if_fail(out, FALSE);
-  return gnc_xml2_write_namespace_decl(out, "entry");
+    g_return_val_if_fail(out, FALSE);
+    return gnc_xml2_write_namespace_decl(out, "entry");
 }
 
 void
 gnc_entry_xml_initialize (void)
 {
-  static GncXmlDataType_t be_data = {
-    GNC_FILE_BACKEND_VERS,
-    gnc_entry_string,
-    entry_sixtp_parser_create,
-    NULL,			/* add_item */
-    entry_get_count,
-    entry_write,
-    NULL,			/* scrub */
-    entry_ns,
-  };
+    static GncXmlDataType_t be_data =
+    {
+        GNC_FILE_BACKEND_VERS,
+        gnc_entry_string,
+        entry_sixtp_parser_create,
+        NULL,			/* add_item */
+        entry_get_count,
+        entry_write,
+        NULL,			/* scrub */
+        entry_ns,
+    };
 
-  qof_object_register_backend (_GNC_MOD_NAME,
-			    GNC_FILE_BACKEND,
-			    &be_data);
+    qof_object_register_backend (_GNC_MOD_NAME,
+                                 GNC_FILE_BACKEND,
+                                 &be_data);
 }

Modified: gnucash/trunk/src/business/business-core/xml/gnc-invoice-xml-v2.c
===================================================================
--- gnucash/trunk/src/business/business-core/xml/gnc-invoice-xml-v2.c	2010-03-02 21:40:28 UTC (rev 18788)
+++ gnucash/trunk/src/business/business-core/xml/gnc-invoice-xml-v2.c	2010-03-02 21:41:05 UTC (rev 18789)
@@ -75,15 +75,15 @@
 static void
 maybe_add_string (xmlNodePtr ptr, const char *tag, const char *str)
 {
-  if (str && strlen(str) > 0)
-    xmlAddChild (ptr, text_to_dom_tree (tag, str));
+    if (str && strlen(str) > 0)
+        xmlAddChild (ptr, text_to_dom_tree (tag, str));
 }
 
 static void
 maybe_add_timespec (xmlNodePtr ptr, const char *tag, Timespec ts)
 {
-  if (ts.tv_sec || ts.tv_nsec)
-    xmlAddChild (ptr, timespec_to_dom_tree (tag, &ts));
+    if (ts.tv_sec || ts.tv_nsec)
+        xmlAddChild (ptr, timespec_to_dom_tree (tag, &ts));
 }
 
 static xmlNodePtr
@@ -102,59 +102,59 @@
     xmlSetProp(ret, BAD_CAST "version", BAD_CAST invoice_version_string);
 
     xmlAddChild(ret, guid_to_dom_tree(invoice_guid_string,
-				      qof_instance_get_guid(QOF_INSTANCE(invoice))));
+                                      qof_instance_get_guid(QOF_INSTANCE(invoice))));
 
     xmlAddChild(ret, text_to_dom_tree(invoice_id_string,
                                       gncInvoiceGetID (invoice)));
 
     xmlAddChild(ret, gnc_owner_to_dom_tree (invoice_owner_string,
-					    gncInvoiceGetOwner (invoice)));
+                                            gncInvoiceGetOwner (invoice)));
 
     ts = gncInvoiceGetDateOpened (invoice);
     xmlAddChild(ret, timespec_to_dom_tree (invoice_opened_string, &ts));
 
     maybe_add_timespec (ret, invoice_posted_string,
-			gncInvoiceGetDatePosted (invoice));
-    
+                        gncInvoiceGetDatePosted (invoice));
+
     term = gncInvoiceGetTerms (invoice);
     if (term)
-      xmlAddChild(ret, guid_to_dom_tree(invoice_terms_string,
-					qof_instance_get_guid (QOF_INSTANCE(term))));
-      
+        xmlAddChild(ret, guid_to_dom_tree(invoice_terms_string,
+                                          qof_instance_get_guid (QOF_INSTANCE(term))));
+
     maybe_add_string (ret, invoice_billing_id_string,
-		      gncInvoiceGetBillingID (invoice));
+                      gncInvoiceGetBillingID (invoice));
     maybe_add_string (ret, invoice_notes_string, gncInvoiceGetNotes (invoice));
 
     xmlAddChild(ret, int_to_dom_tree(invoice_active_string,
-				     gncInvoiceGetActive (invoice)));
+                                     gncInvoiceGetActive (invoice)));
 
     txn = gncInvoiceGetPostedTxn (invoice);
     if (txn)
-      xmlAddChild (ret, guid_to_dom_tree (invoice_posttxn_string,
-					  xaccTransGetGUID (txn)));
+        xmlAddChild (ret, guid_to_dom_tree (invoice_posttxn_string,
+                                            xaccTransGetGUID (txn)));
 
     lot = gncInvoiceGetPostedLot (invoice);
     if (lot)
-      xmlAddChild (ret, guid_to_dom_tree (invoice_postlot_string,
-					  gnc_lot_get_guid (lot)));
+        xmlAddChild (ret, guid_to_dom_tree (invoice_postlot_string,
+                                            gnc_lot_get_guid (lot)));
 
     acc = gncInvoiceGetPostedAcc (invoice);
     if (acc)
-      xmlAddChild (ret, guid_to_dom_tree (invoice_postacc_string,
-					  qof_instance_get_guid(QOF_INSTANCE(acc))));
+        xmlAddChild (ret, guid_to_dom_tree (invoice_postacc_string,
+                                            qof_instance_get_guid(QOF_INSTANCE(acc))));
 
     xmlAddChild
-      (ret,
-       commodity_ref_to_dom_tree(invoice_currency_string,
-				 gncInvoiceGetCurrency (invoice)));
+    (ret,
+     commodity_ref_to_dom_tree(invoice_currency_string,
+                               gncInvoiceGetCurrency (invoice)));
 
     billto = gncInvoiceGetBillTo (invoice);
     if (billto && billto->owner.undefined != NULL)
-      xmlAddChild (ret, gnc_owner_to_dom_tree (invoice_billto_string, billto));
+        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));
+        xmlAddChild (ret, gnc_numeric_to_dom_tree (invoice_tochargeamt_string, &amt));
 
     return ret;
 }
@@ -163,32 +163,32 @@
 
 struct invoice_pdata
 {
-  GncInvoice *invoice;
-  QofBook *book;
+    GncInvoice *invoice;
+    QofBook *book;
 };
 
 static inline gboolean
 set_string(xmlNodePtr node, GncInvoice* invoice,
            void (*func)(GncInvoice *invoice, const char *txt))
 {
-  char* txt = dom_tree_to_text(node);
-  g_return_val_if_fail(txt, FALSE);
-    
-  func(invoice, txt);
-  
-  g_free(txt);
-  return TRUE;
+    char* txt = dom_tree_to_text(node);
+    g_return_val_if_fail(txt, FALSE);
+
+    func(invoice, txt);
+
+    g_free(txt);
+    return TRUE;
 }
 
 static inline gboolean
 set_timespec(xmlNodePtr node, GncInvoice* invoice,
-           void (*func)(GncInvoice *invoice, Timespec ts))
+             void (*func)(GncInvoice *invoice, Timespec ts))
 {
-  Timespec ts = dom_tree_to_timespec(node);
-  if (!dom_tree_valid_timespec(&ts, node->name)) return FALSE;
-    
-  func(invoice, ts);
-  return TRUE;
+    Timespec ts = dom_tree_to_timespec(node);
+    if (!dom_tree_valid_timespec(&ts, node->name)) return FALSE;
+
+    func(invoice, ts);
+    return TRUE;
 }
 
 static gboolean
@@ -201,16 +201,19 @@
     guid = dom_tree_to_guid(node);
     g_return_val_if_fail (guid, FALSE);
     invoice = gncInvoiceLookup (pdata->book, guid);
-    if (invoice) {
-      gncInvoiceDestroy (pdata->invoice);
-      pdata->invoice = invoice;
-      gncInvoiceBeginEdit (invoice);
-    } else {
-      gncInvoiceSetGUID(pdata->invoice, guid);
+    if (invoice)
+    {
+        gncInvoiceDestroy (pdata->invoice);
+        pdata->invoice = invoice;
+        gncInvoiceBeginEdit (invoice);
     }
+    else
+    {
+        gncInvoiceSetGUID(pdata->invoice, guid);
+    }
 
     g_free(guid);
-    
+
     return TRUE;
 }
 
@@ -225,15 +228,15 @@
 static gboolean
 invoice_owner_handler (xmlNodePtr node, gpointer invoice_pdata)
 {
-  struct invoice_pdata *pdata = invoice_pdata;
-  GncOwner owner;
-  gboolean ret;
+    struct invoice_pdata *pdata = invoice_pdata;
+    GncOwner owner;
+    gboolean ret;
 
-  ret = gnc_dom_tree_to_owner (node, &owner, pdata->book);
-  if (ret)
-    gncInvoiceSetOwner (pdata->invoice, &owner);
+    ret = gnc_dom_tree_to_owner (node, &owner, pdata->book);
+    if (ret)
+        gncInvoiceSetOwner (pdata->invoice, &owner);
 
-  return ret;
+    return ret;
 }
 
 static gboolean
@@ -277,7 +280,7 @@
 
     ret = dom_tree_to_integer(node, &val);
     if (ret)
-      gncInvoiceSetActive(pdata->invoice, (gboolean)val);
+        gncInvoiceSetActive(pdata->invoice, (gboolean)val);
 
     return ret;
 }
@@ -295,7 +298,7 @@
     g_assert(term);
     g_free (guid);
     gncInvoiceSetTerms (pdata->invoice, term);
-    
+
     return TRUE;
 }
 
@@ -367,36 +370,37 @@
 static gboolean
 invoice_billto_handler (xmlNodePtr node, gpointer invoice_pdata)
 {
-  struct invoice_pdata *pdata = invoice_pdata;
-  GncOwner owner;
-  gboolean ret;
+    struct invoice_pdata *pdata = invoice_pdata;
+    GncOwner owner;
+    gboolean ret;
 
-  ret = gnc_dom_tree_to_owner (node, &owner, pdata->book);
-  if (ret)
-    gncInvoiceSetBillTo (pdata->invoice, &owner);
+    ret = gnc_dom_tree_to_owner (node, &owner, pdata->book);
+    if (ret)
+        gncInvoiceSetBillTo (pdata->invoice, &owner);
 
-  return ret;
+    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;
+    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 gboolean
 invoice_slots_handler (xmlNodePtr node, gpointer invoice_pdata)
 {
-  return TRUE;
+    return TRUE;
 }
 
-static struct dom_tree_handler invoice_handlers_v2[] = {
+static struct dom_tree_handler invoice_handlers_v2[] =
+{
     { invoice_guid_string, invoice_guid_handler, 1, 0 },
     { invoice_id_string, invoice_id_handler, 1, 0 },
     { invoice_owner_string, invoice_owner_handler, 1, 0 },
@@ -431,7 +435,7 @@
                                          &invoice_pdata);
 
     if (successful)
-      gncInvoiceCommitEdit (invoice_pdata.invoice);
+        gncInvoiceCommitEdit (invoice_pdata.invoice);
     else
     {
         PERR ("failed to parse invoice tree");
@@ -444,9 +448,9 @@
 
 static gboolean
 gnc_invoice_end_handler(gpointer data_for_children,
-			 GSList* data_from_children, GSList* sibling_data,
-			 gpointer parent_data, gpointer global_data,
-			 gpointer *result, const gchar *tag)
+                        GSList* data_from_children, GSList* sibling_data,
+                        gpointer parent_data, gpointer global_data,
+                        gpointer *result, const gchar *tag)
 {
     int successful;
     GncInvoice *invoice;
@@ -456,14 +460,14 @@
 
     successful = TRUE;
 
-    if(parent_data)
+    if (parent_data)
     {
         return TRUE;
     }
 
     /* OK.  For some messed up reason this is getting called again with a
        NULL tag.  So we ignore those cases */
-    if(!tag)
+    if (!tag)
     {
         return TRUE;
     }
@@ -471,7 +475,7 @@
     g_return_val_if_fail(tree, FALSE);
 
     invoice = dom_tree_to_invoice(tree, book);
-    if(invoice != NULL)
+    if (invoice != NULL)
     {
         gdata->cb(tag, gdata->parsedata, invoice);
     }
@@ -484,86 +488,87 @@
 static sixtp *
 invoice_sixtp_parser_create(void)
 {
-  return sixtp_dom_parser_new(gnc_invoice_end_handler, NULL, NULL);
+    return sixtp_dom_parser_new(gnc_invoice_end_handler, NULL, NULL);
 }
 
 static gboolean
 invoice_should_be_saved (GncInvoice *invoice)
 {
-  const char *id;
+    const char *id;
 
-  /* make sure this is a valid invoice before we save it -- should have an ID */
-  id = gncInvoiceGetID (invoice);
-  if (id == NULL || *id == '\0')
-    return FALSE;
+    /* make sure this is a valid invoice before we save it -- should have an ID */
+    id = gncInvoiceGetID (invoice);
+    if (id == NULL || *id == '\0')
+        return FALSE;
 
-  return TRUE;
+    return TRUE;
 }
 
 static void
 do_count (QofInstance * invoice_p, gpointer count_p)
 {
-  int *count = count_p;
-  if (invoice_should_be_saved ((GncInvoice *)invoice_p))
-    (*count)++;
+    int *count = count_p;
+    if (invoice_should_be_saved ((GncInvoice *)invoice_p))
+        (*count)++;
 }
 
 static int
 invoice_get_count (QofBook *book)
 {
-  int count = 0;
-  qof_object_foreach (_GNC_MOD_NAME, book, do_count, (gpointer) &count);
-  return count;
+    int count = 0;
+    qof_object_foreach (_GNC_MOD_NAME, book, do_count, (gpointer) &count);
+    return count;
 }
 
 static void
 xml_add_invoice (QofInstance * invoice_p, gpointer out_p)
 {
-  xmlNodePtr node;
-  GncInvoice *invoice = (GncInvoice *) invoice_p;
-  FILE *out = out_p;
+    xmlNodePtr node;
+    GncInvoice *invoice = (GncInvoice *) invoice_p;
+    FILE *out = out_p;
 
-  if (ferror(out))
-    return;
-  if (!invoice_should_be_saved (invoice))
-    return;
+    if (ferror(out))
+        return;
+    if (!invoice_should_be_saved (invoice))
+        return;
 
-  node = invoice_dom_tree_create (invoice);
-  xmlElemDump(out, NULL, node);
-  xmlFreeNode (node);
-  if (ferror(out) || fprintf(out, "\n") < 0)
-    return;
+    node = invoice_dom_tree_create (invoice);
+    xmlElemDump(out, NULL, node);
+    xmlFreeNode (node);
+    if (ferror(out) || fprintf(out, "\n") < 0)
+        return;
 }
 
 static gboolean
 invoice_write (FILE *out, QofBook *book)
 {
-  qof_object_foreach (_GNC_MOD_NAME, book, xml_add_invoice, (gpointer) out);
-  return ferror(out) == 0;
+    qof_object_foreach (_GNC_MOD_NAME, book, xml_add_invoice, (gpointer) out);
+    return ferror(out) == 0;
 }
 
 static gboolean
 invoice_ns(FILE *out)
 {
-  g_return_val_if_fail(out, FALSE);
-  return gnc_xml2_write_namespace_decl(out, "invoice");
+    g_return_val_if_fail(out, FALSE);
+    return gnc_xml2_write_namespace_decl(out, "invoice");
 }
 
 void
 gnc_invoice_xml_initialize (void)
 {
-  static GncXmlDataType_t be_data = {
-    GNC_FILE_BACKEND_VERS,
-    gnc_invoice_string,
-    invoice_sixtp_parser_create,
-    NULL,			/* add_item */
-    invoice_get_count,
-    invoice_write,
-    NULL,			/* scrub */
-    invoice_ns,
-  };
+    static GncXmlDataType_t be_data =
+    {
+        GNC_FILE_BACKEND_VERS,
+        gnc_invoice_string,
+        invoice_sixtp_parser_create,
+        NULL,			/* add_item */
+        invoice_get_count,
+        invoice_write,
+        NULL,			/* scrub */
+        invoice_ns,
+    };
 
-  qof_object_register_backend (_GNC_MOD_NAME,
-			    GNC_FILE_BACKEND,
-			    &be_data);
+    qof_object_register_backend (_GNC_MOD_NAME,
+                                 GNC_FILE_BACKEND,
+                                 &be_data);
 }

Modified: gnucash/trunk/src/business/business-core/xml/gnc-job-xml-v2.c
===================================================================
--- gnucash/trunk/src/business/business-core/xml/gnc-job-xml-v2.c	2010-03-02 21:40:28 UTC (rev 18788)
+++ gnucash/trunk/src/business/business-core/xml/gnc-job-xml-v2.c	2010-03-02 21:41:05 UTC (rev 18789)
@@ -71,21 +71,21 @@
     xmlSetProp(ret, BAD_CAST "version", BAD_CAST job_version_string);
 
     xmlAddChild(ret, guid_to_dom_tree(job_guid_string,
-				      qof_instance_get_guid (QOF_INSTANCE (job))));
+                                      qof_instance_get_guid (QOF_INSTANCE (job))));
 
     xmlAddChild(ret, text_to_dom_tree(job_id_string,
                                       gncJobGetID (job)));
 
     xmlAddChild(ret, text_to_dom_tree(job_name_string,
                                       gncJobGetName (job)));
-    
+
     maybe_add_string (ret, job_reference_string, gncJobGetReference (job));
 
     xmlAddChild(ret, gnc_owner_to_dom_tree (job_owner_string,
-					    gncJobGetOwner (job)));
+                                            gncJobGetOwner (job)));
 
     xmlAddChild(ret, int_to_dom_tree(job_active_string,
-				     gncJobGetActive (job)));
+                                     gncJobGetActive (job)));
 
     return ret;
 }
@@ -94,22 +94,22 @@
 
 struct job_pdata
 {
-  GncJob *job;
-  QofBook *book;
+    GncJob *job;
+    QofBook *book;
 };
 
 static gboolean
 set_string(xmlNodePtr node, GncJob* job,
            void (*func)(GncJob *job, const char *txt))
 {
-  char* txt = dom_tree_to_text(node);
-  g_return_val_if_fail(txt, FALSE);
-    
-  func(job, txt);
-  
-  g_free(txt);
-    
-  return TRUE;
+    char* txt = dom_tree_to_text(node);
+    g_return_val_if_fail(txt, FALSE);
+
+    func(job, txt);
+
+    g_free(txt);
+
+    return TRUE;
 }
 
 static gboolean
@@ -130,16 +130,19 @@
     guid = dom_tree_to_guid(node);
     g_return_val_if_fail(guid, FALSE);
     job = gncJobLookup (pdata->book, guid);
-    if (job) {
-      gncJobDestroy (pdata->job);
-      pdata->job = job;
-      gncJobBeginEdit (job);
-    } else {
-      gncJobSetGUID(pdata->job, guid);
+    if (job)
+    {
+        gncJobDestroy (pdata->job);
+        pdata->job = job;
+        gncJobBeginEdit (job);
     }
+    else
+    {
+        gncJobSetGUID(pdata->job, guid);
+    }
 
     g_free(guid);
-    
+
     return TRUE;
 }
 
@@ -162,15 +165,15 @@
 static gboolean
 job_owner_handler (xmlNodePtr node, gpointer job_pdata)
 {
-  struct job_pdata *pdata = job_pdata;
-  GncOwner owner;
-  gboolean ret;
+    struct job_pdata *pdata = job_pdata;
+    GncOwner owner;
+    gboolean ret;
 
-  ret = gnc_dom_tree_to_owner (node, &owner, pdata->book);
-  if (ret)
-    gncJobSetOwner (pdata->job, &owner);
+    ret = gnc_dom_tree_to_owner (node, &owner, pdata->book);
+    if (ret)
+        gncJobSetOwner (pdata->job, &owner);
 
-  return ret;
+    return ret;
 }
 
 static gboolean
@@ -182,7 +185,7 @@
 
     ret = dom_tree_to_integer(node, &val);
     if (ret)
-      gncJobSetActive(pdata->job, (gboolean)val);
+        gncJobSetActive(pdata->job, (gboolean)val);
 
     return ret;
 }
@@ -190,10 +193,11 @@
 static gboolean
 job_slots_handler (xmlNodePtr node, gpointer job_pdata)
 {
-  return TRUE;
+    return TRUE;
 }
 
-static struct dom_tree_handler job_handlers_v2[] = {
+static struct dom_tree_handler job_handlers_v2[] =
+{
     { job_guid_string, job_guid_handler, 1, 0 },
     { job_id_string, job_id_handler, 1, 0 },
     { job_name_string, job_name_handler, 1, 0 },
@@ -218,7 +222,7 @@
                                          &job_pdata);
 
     if (successful)
-      gncJobCommitEdit (job_pdata.job);
+        gncJobCommitEdit (job_pdata.job);
     else
     {
         PERR ("failed to parse job tree");
@@ -231,9 +235,9 @@
 
 static gboolean
 gnc_job_end_handler(gpointer data_for_children,
-			 GSList* data_from_children, GSList* sibling_data,
-			 gpointer parent_data, gpointer global_data,
-			 gpointer *result, const gchar *tag)
+                    GSList* data_from_children, GSList* sibling_data,
+                    gpointer parent_data, gpointer global_data,
+                    gpointer *result, const gchar *tag)
 {
     int successful;
     GncJob *job;
@@ -243,14 +247,14 @@
 
     successful = TRUE;
 
-    if(parent_data)
+    if (parent_data)
     {
         return TRUE;
     }
 
     /* OK.  For some messed up reason this is getting called again with a
        NULL tag.  So we ignore those cases */
-    if(!tag)
+    if (!tag)
     {
         return TRUE;
     }
@@ -258,7 +262,7 @@
     g_return_val_if_fail(tree, FALSE);
 
     job = dom_tree_to_job(tree, book);
-    if(job != NULL)
+    if (job != NULL)
     {
         gdata->cb(tag, gdata->parsedata, job);
     }
@@ -271,86 +275,87 @@
 static sixtp *
 job_sixtp_parser_create(void)
 {
-  return sixtp_dom_parser_new(gnc_job_end_handler, NULL, NULL);
+    return sixtp_dom_parser_new(gnc_job_end_handler, NULL, NULL);
 }
 
 static gboolean
 job_should_be_saved (GncJob *job)
 {
-  const char *id;
+    const char *id;
 
-  /* make sure this is a valid job before we save it -- should have an ID */
-  id = gncJobGetID (job);
-  if (id == NULL || *id == '\0')
-    return FALSE;
+    /* make sure this is a valid job before we save it -- should have an ID */
+    id = gncJobGetID (job);
+    if (id == NULL || *id == '\0')
+        return FALSE;
 
-  return TRUE;
+    return TRUE;
 }
 
 static void
 do_count (QofInstance * job_p, gpointer count_p)
 {
-  int *count = count_p;
-  if (job_should_be_saved ((GncJob *)job_p))
-    (*count)++;
+    int *count = count_p;
+    if (job_should_be_saved ((GncJob *)job_p))
+        (*count)++;
 }
 
 static int
 job_get_count (QofBook *book)
 {
-  int count = 0;
-  qof_object_foreach (_GNC_MOD_NAME, book, do_count, (gpointer) &count);
-  return count;
+    int count = 0;
+    qof_object_foreach (_GNC_MOD_NAME, book, do_count, (gpointer) &count);
+    return count;
 }
 
 static void
 xml_add_job (QofInstance * job_p, gpointer out_p)
 {
-  xmlNodePtr node;
-  GncJob *job = (GncJob *) job_p;
-  FILE *out = out_p;
+    xmlNodePtr node;
+    GncJob *job = (GncJob *) job_p;
+    FILE *out = out_p;
 
-  if (ferror(out))
-    return;
-  if (!job_should_be_saved (job))
-    return;
+    if (ferror(out))
+        return;
+    if (!job_should_be_saved (job))
+        return;
 
-  node = job_dom_tree_create (job);
-  xmlElemDump(out, NULL, node);
-  xmlFreeNode (node);
-  if (ferror(out) || fprintf(out, "\n") < 0)
-    return;
+    node = job_dom_tree_create (job);
+    xmlElemDump(out, NULL, node);
+    xmlFreeNode (node);
+    if (ferror(out) || fprintf(out, "\n") < 0)
+        return;
 }
 
 static gboolean
 job_write (FILE *out, QofBook *book)
 {
-  qof_object_foreach (_GNC_MOD_NAME, book, xml_add_job, (gpointer) out);
-  return ferror(out) == 0;
+    qof_object_foreach (_GNC_MOD_NAME, book, xml_add_job, (gpointer) out);
+    return ferror(out) == 0;
 }
 
 static gboolean
 job_ns(FILE *out)
 {
-  g_return_val_if_fail(out, FALSE);
-  return gnc_xml2_write_namespace_decl(out, "job");
+    g_return_val_if_fail(out, FALSE);
+    return gnc_xml2_write_namespace_decl(out, "job");
 }
 
 void
 gnc_job_xml_initialize (void)
 {
-  static GncXmlDataType_t be_data = {
-    GNC_FILE_BACKEND_VERS,
-    gnc_job_string,
-    job_sixtp_parser_create,
-    NULL,			/* add_item */
-    job_get_count,
-    job_write,
-    NULL,			/* scrub */
-    job_ns,
-  };
+    static GncXmlDataType_t be_data =
+    {
+        GNC_FILE_BACKEND_VERS,
+        gnc_job_string,
+        job_sixtp_parser_create,
+        NULL,			/* add_item */
+        job_get_count,
+        job_write,
+        NULL,			/* scrub */
+        job_ns,
+    };
 
-  qof_object_register_backend (_GNC_MOD_NAME,
-			    GNC_FILE_BACKEND,
-			    &be_data);
+    qof_object_register_backend (_GNC_MOD_NAME,
+                                 GNC_FILE_BACKEND,
+                                 &be_data);
 }

Modified: gnucash/trunk/src/business/business-core/xml/gnc-order-xml-v2.c
===================================================================
--- gnucash/trunk/src/business/business-core/xml/gnc-order-xml-v2.c	2010-03-02 21:40:28 UTC (rev 18788)
+++ gnucash/trunk/src/business/business-core/xml/gnc-order-xml-v2.c	2010-03-02 21:41:05 UTC (rev 18789)
@@ -67,8 +67,8 @@
 static void
 maybe_add_string (xmlNodePtr ptr, const char *tag, const char *str)
 {
-  if (str && strlen(str) > 0)
-    xmlAddChild (ptr, text_to_dom_tree (tag, str));
+    if (str && strlen(str) > 0)
+        xmlAddChild (ptr, text_to_dom_tree (tag, str));
 }
 
 static xmlNodePtr
@@ -81,26 +81,26 @@
     xmlSetProp(ret, BAD_CAST "version", BAD_CAST order_version_string);
 
     xmlAddChild(ret, guid_to_dom_tree(order_guid_string,
-				      qof_instance_get_guid(QOF_INSTANCE (order))));
+                                      qof_instance_get_guid(QOF_INSTANCE (order))));
 
     xmlAddChild(ret, text_to_dom_tree(order_id_string,
                                       gncOrderGetID (order)));
 
     xmlAddChild(ret, gnc_owner_to_dom_tree (order_owner_string,
-					    gncOrderGetOwner (order)));
+                                            gncOrderGetOwner (order)));
 
     ts = gncOrderGetDateOpened (order);
     xmlAddChild(ret, timespec_to_dom_tree (order_opened_string, &ts));
 
     ts = gncOrderGetDateClosed (order);
     if (ts.tv_sec || ts.tv_nsec)
-      xmlAddChild(ret, timespec_to_dom_tree (order_closed_string, &ts));
-    
+        xmlAddChild(ret, timespec_to_dom_tree (order_closed_string, &ts));
+
     maybe_add_string (ret, order_notes_string, gncOrderGetNotes (order));
     maybe_add_string (ret, order_reference_string, gncOrderGetReference (order));
 
     xmlAddChild(ret, int_to_dom_tree(order_active_string,
-				     gncOrderGetActive (order)));
+                                     gncOrderGetActive (order)));
 
     return ret;
 }
@@ -109,32 +109,32 @@
 
 struct order_pdata
 {
-  GncOrder *order;
-  QofBook *book;
+    GncOrder *order;
+    QofBook *book;
 };
 
 static inline gboolean
 set_string(xmlNodePtr node, GncOrder* order,
            void (*func)(GncOrder *order, const char *txt))
 {
-  char* txt = dom_tree_to_text(node);
-  g_return_val_if_fail(txt, FALSE);
-    
-  func(order, txt);
-  
-  g_free(txt);
-  return TRUE;
+    char* txt = dom_tree_to_text(node);
+    g_return_val_if_fail(txt, FALSE);
+
+    func(order, txt);
+
+    g_free(txt);
+    return TRUE;
 }
 
 static inline gboolean
 set_timespec(xmlNodePtr node, GncOrder* order,
-           void (*func)(GncOrder *order, Timespec ts))
+             void (*func)(GncOrder *order, Timespec ts))
 {
-  Timespec ts = dom_tree_to_timespec(node);
-  if (!dom_tree_valid_timespec(&ts, node->name)) return FALSE;
-    
-  func(order, ts);
-  return TRUE;
+    Timespec ts = dom_tree_to_timespec(node);
+    if (!dom_tree_valid_timespec(&ts, node->name)) return FALSE;
+
+    func(order, ts);
+    return TRUE;
 }
 
 static gboolean
@@ -147,16 +147,19 @@
     guid = dom_tree_to_guid(node);
     g_return_val_if_fail (guid, FALSE);
     order = gncOrderLookup (pdata->book, guid);
-    if (order) {
-      gncOrderDestroy (pdata->order);
-      pdata->order = order;
-      gncOrderBeginEdit (order);
-    } else {
-      gncOrderSetGUID(pdata->order, guid);
+    if (order)
+    {
+        gncOrderDestroy (pdata->order);
+        pdata->order = order;
+        gncOrderBeginEdit (order);
     }
+    else
+    {
+        gncOrderSetGUID(pdata->order, guid);
+    }
 
     g_free(guid);
-    
+
     return TRUE;
 }
 
@@ -171,15 +174,15 @@
 static gboolean
 order_owner_handler (xmlNodePtr node, gpointer order_pdata)
 {
-  struct order_pdata *pdata = order_pdata;
-  GncOwner owner;
-  gboolean ret;
+    struct order_pdata *pdata = order_pdata;
+    GncOwner owner;
+    gboolean ret;
 
-  ret = gnc_dom_tree_to_owner (node, &owner, pdata->book);
-  if (ret)
-    gncOrderSetOwner (pdata->order, &owner);
+    ret = gnc_dom_tree_to_owner (node, &owner, pdata->book);
+    if (ret)
+        gncOrderSetOwner (pdata->order, &owner);
 
-  return ret;
+    return ret;
 }
 
 static gboolean
@@ -223,7 +226,7 @@
 
     ret = dom_tree_to_integer(node, &val);
     if (ret)
-      gncOrderSetActive(pdata->order, (gboolean)val);
+        gncOrderSetActive(pdata->order, (gboolean)val);
 
     return ret;
 }
@@ -231,10 +234,11 @@
 static gboolean
 order_slots_handler (xmlNodePtr node, gpointer order_pdata)
 {
-  return TRUE;
+    return TRUE;
 }
 
-static struct dom_tree_handler order_handlers_v2[] = {
+static struct dom_tree_handler order_handlers_v2[] =
+{
     { order_guid_string, order_guid_handler, 1, 0 },
     { order_id_string, order_id_handler, 1, 0 },
     { order_owner_string, order_owner_handler, 1, 0 },
@@ -261,7 +265,7 @@
                                          &order_pdata);
 
     if (successful)
-      gncOrderCommitEdit (order_pdata.order);
+        gncOrderCommitEdit (order_pdata.order);
     else
     {
         PERR ("failed to parse order tree");
@@ -274,9 +278,9 @@
 
 static gboolean
 gnc_order_end_handler(gpointer data_for_children,
-			 GSList* data_from_children, GSList* sibling_data,
-			 gpointer parent_data, gpointer global_data,
-			 gpointer *result, const gchar *tag)
+                      GSList* data_from_children, GSList* sibling_data,
+                      gpointer parent_data, gpointer global_data,
+                      gpointer *result, const gchar *tag)
 {
     int successful;
     GncOrder *order;
@@ -286,14 +290,14 @@
 
     successful = TRUE;
 
-    if(parent_data)
+    if (parent_data)
     {
         return TRUE;
     }
 
     /* OK.  For some messed up reason this is getting called again with a
        NULL tag.  So we ignore those cases */
-    if(!tag)
+    if (!tag)
     {
         return TRUE;
     }
@@ -301,7 +305,7 @@
     g_return_val_if_fail(tree, FALSE);
 
     order = dom_tree_to_order(tree, book);
-    if(order != NULL)
+    if (order != NULL)
     {
         gdata->cb(tag, gdata->parsedata, order);
     }
@@ -314,86 +318,87 @@
 static sixtp *
 order_sixtp_parser_create(void)
 {
-  return sixtp_dom_parser_new(gnc_order_end_handler, NULL, NULL);
+    return sixtp_dom_parser_new(gnc_order_end_handler, NULL, NULL);
 }
 
 static gboolean
 order_should_be_saved (GncOrder *order)
 {
-  const char *id;
+    const char *id;
 
-  /* make sure this is a valid order before we save it -- should have an ID */
-  id = gncOrderGetID (order);
-  if (id == NULL || *id == '\0')
-    return FALSE;
+    /* make sure this is a valid order before we save it -- should have an ID */
+    id = gncOrderGetID (order);
+    if (id == NULL || *id == '\0')
+        return FALSE;
 
-  return TRUE;
+    return TRUE;
 }
 
 static void
 do_count (QofInstance * order_p, gpointer count_p)
 {
-  int *count = count_p;
-  if (order_should_be_saved ((GncOrder *) order_p))
-    (*count)++;
+    int *count = count_p;
+    if (order_should_be_saved ((GncOrder *) order_p))
+        (*count)++;
 }
 
 static int
 order_get_count (QofBook *book)
 {
-  int count = 0;
-  qof_object_foreach (_GNC_MOD_NAME, book, do_count, (gpointer) &count);
-  return count;
+    int count = 0;
+    qof_object_foreach (_GNC_MOD_NAME, book, do_count, (gpointer) &count);
+    return count;
 }
 
 static void
 xml_add_order (QofInstance * order_p, gpointer out_p)
 {
-  xmlNodePtr node;
-  GncOrder *order = (GncOrder *) order_p;
-  FILE *out = out_p;
+    xmlNodePtr node;
+    GncOrder *order = (GncOrder *) order_p;
+    FILE *out = out_p;
 
-  if (ferror(out))
-    return;
-  if (!order_should_be_saved (order))
-    return;
+    if (ferror(out))
+        return;
+    if (!order_should_be_saved (order))
+        return;
 
-  node = order_dom_tree_create (order);
-  xmlElemDump(out, NULL, node);
-  xmlFreeNode (node);
-  if (ferror(out) || fprintf(out, "\n") < 0)
-    return;
+    node = order_dom_tree_create (order);
+    xmlElemDump(out, NULL, node);
+    xmlFreeNode (node);
+    if (ferror(out) || fprintf(out, "\n") < 0)
+        return;
 }
 
 static gboolean
 order_write (FILE *out, QofBook *book)
 {
-  qof_object_foreach (_GNC_MOD_NAME, book, xml_add_order, (gpointer) out);
-  return ferror(out) == 0;
+    qof_object_foreach (_GNC_MOD_NAME, book, xml_add_order, (gpointer) out);
+    return ferror(out) == 0;
 }
 
 static gboolean
 order_ns(FILE *out)
 {
-  g_return_val_if_fail(out, FALSE);
-  return gnc_xml2_write_namespace_decl(out, "order");
+    g_return_val_if_fail(out, FALSE);
+    return gnc_xml2_write_namespace_decl(out, "order");
 }
 
 void
 gnc_order_xml_initialize (void)
 {
-  static GncXmlDataType_t be_data = {
-    GNC_FILE_BACKEND_VERS,
-    gnc_order_string,
-    order_sixtp_parser_create,
-    NULL,			/* add_item */
-    order_get_count,
-    order_write,
-    NULL,			/* scrub */
-    order_ns,
-  };
+    static GncXmlDataType_t be_data =
+    {
+        GNC_FILE_BACKEND_VERS,
+        gnc_order_string,
+        order_sixtp_parser_create,
+        NULL,			/* add_item */
+        order_get_count,
+        order_write,
+        NULL,			/* scrub */
+        order_ns,
+    };
 
-  qof_object_register_backend (_GNC_MOD_NAME,
-			    GNC_FILE_BACKEND,
-			    &be_data);
+    qof_object_register_backend (_GNC_MOD_NAME,
+                                 GNC_FILE_BACKEND,
+                                 &be_data);
 }

Modified: gnucash/trunk/src/business/business-core/xml/gnc-owner-xml-v2.c
===================================================================
--- gnucash/trunk/src/business/business-core/xml/gnc-owner-xml-v2.c	2010-03-02 21:40:28 UTC (rev 18788)
+++ gnucash/trunk/src/business/business-core/xml/gnc-owner-xml-v2.c	2010-03-02 21:41:05 UTC (rev 18789)
@@ -61,22 +61,23 @@
     xmlNodePtr ret;
     const char *type_str;
 
-    switch (gncOwnerGetType (owner)) {
+    switch (gncOwnerGetType (owner))
+    {
     case GNC_OWNER_CUSTOMER:
-      type_str = GNC_ID_CUSTOMER;
-      break;
+        type_str = GNC_ID_CUSTOMER;
+        break;
     case GNC_OWNER_JOB:
-      type_str = GNC_ID_JOB;
-      break;
+        type_str = GNC_ID_JOB;
+        break;
     case GNC_OWNER_VENDOR:
-      type_str = GNC_ID_VENDOR;
-      break;
+        type_str = GNC_ID_VENDOR;
+        break;
     case GNC_OWNER_EMPLOYEE:
-      type_str = GNC_ID_EMPLOYEE;
-      break;
+        type_str = GNC_ID_EMPLOYEE;
+        break;
     default:
-      PWARN ("Invalid owner type: %d", gncOwnerGetType (owner));
-      return NULL;
+        PWARN ("Invalid owner type: %d", gncOwnerGetType (owner));
+        return NULL;
     }
 
     ret = xmlNewNode(NULL, BAD_CAST tag);
@@ -84,7 +85,7 @@
 
     xmlAddChild (ret, text_to_dom_tree (owner_type_string, type_str));
     xmlAddChild (ret, guid_to_dom_tree (owner_id_string,
-					gncOwnerGetGUID (owner)));
+                                        gncOwnerGetGUID (owner)));
 
     return ret;
 }
@@ -93,96 +94,103 @@
 
 struct owner_pdata
 {
-  GncOwner *owner;
-  QofBook *book;
+    GncOwner *owner;
+    QofBook *book;
 };
 
 static gboolean
 owner_type_handler (xmlNodePtr node, gpointer owner_pdata)
 {
-  struct owner_pdata *pdata = owner_pdata;
-  char* txt = dom_tree_to_text(node);
-  g_return_val_if_fail(txt, FALSE);
+    struct owner_pdata *pdata = owner_pdata;
+    char* txt = dom_tree_to_text(node);
+    g_return_val_if_fail(txt, FALSE);
 
-  if (!safe_strcmp (txt, GNC_ID_CUSTOMER))
-    gncOwnerInitCustomer (pdata->owner, NULL);
-  else if (!safe_strcmp (txt, GNC_ID_JOB))
-    gncOwnerInitJob (pdata->owner, NULL);
-  else if (!safe_strcmp (txt, GNC_ID_VENDOR))
-    gncOwnerInitVendor (pdata->owner, NULL);
-  else if (!safe_strcmp (txt, GNC_ID_EMPLOYEE))
-    gncOwnerInitEmployee (pdata->owner, NULL);
-  else {
-    PWARN ("Unknown owner type: %s", txt);
+    if (!safe_strcmp (txt, GNC_ID_CUSTOMER))
+        gncOwnerInitCustomer (pdata->owner, NULL);
+    else if (!safe_strcmp (txt, GNC_ID_JOB))
+        gncOwnerInitJob (pdata->owner, NULL);
+    else if (!safe_strcmp (txt, GNC_ID_VENDOR))
+        gncOwnerInitVendor (pdata->owner, NULL);
+    else if (!safe_strcmp (txt, GNC_ID_EMPLOYEE))
+        gncOwnerInitEmployee (pdata->owner, NULL);
+    else
+    {
+        PWARN ("Unknown owner type: %s", txt);
+        g_free(txt);
+        return FALSE;
+    }
+
     g_free(txt);
-    return FALSE;
-  }
-
-  g_free(txt);
-  return TRUE;
+    return TRUE;
 }
 
 static gboolean
 owner_id_handler (xmlNodePtr node, gpointer owner_pdata)
 {
-  struct owner_pdata *pdata = owner_pdata;
-  GUID *guid;
+    struct owner_pdata *pdata = owner_pdata;
+    GUID *guid;
 
-  guid = dom_tree_to_guid(node);
-  g_return_val_if_fail (guid, FALSE);
+    guid = dom_tree_to_guid(node);
+    g_return_val_if_fail (guid, FALSE);
 
-  switch (gncOwnerGetType (pdata->owner)) {
-  case GNC_OWNER_CUSTOMER:
-  {
-    GncCustomer *cust = gncCustomerLookup (pdata->book, guid);
-    if (!cust) {
-      cust = gncCustomerCreate (pdata->book);
-      gncCustomerSetGUID (cust, guid);
+    switch (gncOwnerGetType (pdata->owner))
+    {
+    case GNC_OWNER_CUSTOMER:
+    {
+        GncCustomer *cust = gncCustomerLookup (pdata->book, guid);
+        if (!cust)
+        {
+            cust = gncCustomerCreate (pdata->book);
+            gncCustomerSetGUID (cust, guid);
+        }
+        gncOwnerInitCustomer (pdata->owner, cust);
+        break;
     }
-    gncOwnerInitCustomer (pdata->owner, cust);
-    break; 
-  }
-  case GNC_OWNER_JOB:
-  {
-    GncJob *job = gncJobLookup (pdata->book, guid);
-    if (!job) {
-      job = gncJobCreate (pdata->book);
-      gncJobSetGUID (job, guid);
+    case GNC_OWNER_JOB:
+    {
+        GncJob *job = gncJobLookup (pdata->book, guid);
+        if (!job)
+        {
+            job = gncJobCreate (pdata->book);
+            gncJobSetGUID (job, guid);
+        }
+        gncOwnerInitJob (pdata->owner, job);
+        break;
     }
-    gncOwnerInitJob (pdata->owner, job);
-    break; 
-  }
-  case GNC_OWNER_VENDOR:
-  {
-    GncVendor *vendor = gncVendorLookup (pdata->book, guid);
-    if (!vendor) {
-      vendor = gncVendorCreate (pdata->book);
-      gncVendorSetGUID (vendor, guid);
+    case GNC_OWNER_VENDOR:
+    {
+        GncVendor *vendor = gncVendorLookup (pdata->book, guid);
+        if (!vendor)
+        {
+            vendor = gncVendorCreate (pdata->book);
+            gncVendorSetGUID (vendor, guid);
+        }
+        gncOwnerInitVendor (pdata->owner, vendor);
+        break;
     }
-    gncOwnerInitVendor (pdata->owner, vendor);
-    break; 
-  }
-  case GNC_OWNER_EMPLOYEE:
-  {
-    GncEmployee *employee = gncEmployeeLookup (pdata->book, guid);
-    if (!employee) {
-      employee = gncEmployeeCreate (pdata->book);
-      gncEmployeeSetGUID (employee, guid);
+    case GNC_OWNER_EMPLOYEE:
+    {
+        GncEmployee *employee = gncEmployeeLookup (pdata->book, guid);
+        if (!employee)
+        {
+            employee = gncEmployeeCreate (pdata->book);
+            gncEmployeeSetGUID (employee, guid);
+        }
+        gncOwnerInitEmployee (pdata->owner, employee);
+        break;
     }
-    gncOwnerInitEmployee (pdata->owner, employee);
-    break; 
-  }
-  default:
-    PWARN ("Invalid owner type: %d\n", gncOwnerGetType (pdata->owner));
+    default:
+        PWARN ("Invalid owner type: %d\n", gncOwnerGetType (pdata->owner));
+        g_free (guid);
+        return FALSE;
+    }
+
     g_free (guid);
-    return FALSE;
-  }
-
-  g_free (guid);
-  return TRUE;
+    return TRUE;
 }
 
-static struct dom_tree_handler owner_handlers_v2[] = {
+static struct dom_tree_handler owner_handlers_v2[] =
+{
     { owner_type_string, owner_type_handler, 1, 0 },
     { owner_id_string, owner_id_handler, 1, 0 },
     { NULL, 0, 0, 0 }
@@ -211,25 +219,26 @@
 static gboolean
 owner_ns(FILE *out)
 {
-  g_return_val_if_fail(out, FALSE);
-  return gnc_xml2_write_namespace_decl(out, "owner");
+    g_return_val_if_fail(out, FALSE);
+    return gnc_xml2_write_namespace_decl(out, "owner");
 }
 
 void
 gnc_owner_xml_initialize (void)
 {
-  static GncXmlDataType_t be_data = {
-    GNC_FILE_BACKEND_VERS,
-    "gnc:Owner",
-    NULL,			/* parser_create */
-    NULL,			/* add_item */
-    NULL,			/* get_count */
-    NULL,			/* write */
-    NULL,			/* scrub */
-    owner_ns,
-  };
+    static GncXmlDataType_t be_data =
+    {
+        GNC_FILE_BACKEND_VERS,
+        "gnc:Owner",
+        NULL,			/* parser_create */
+        NULL,			/* add_item */
+        NULL,			/* get_count */
+        NULL,			/* write */
+        NULL,			/* scrub */
+        owner_ns,
+    };
 
-  qof_object_register_backend ("gnc:Owner",
-			    GNC_FILE_BACKEND,
-			    &be_data);
+    qof_object_register_backend ("gnc:Owner",
+                                 GNC_FILE_BACKEND,
+                                 &be_data);
 }

Modified: gnucash/trunk/src/business/business-core/xml/gnc-owner-xml-v2.h
===================================================================
--- gnucash/trunk/src/business/business-core/xml/gnc-owner-xml-v2.h	2010-03-02 21:40:28 UTC (rev 18788)
+++ gnucash/trunk/src/business/business-core/xml/gnc-owner-xml-v2.h	2010-03-02 21:41:05 UTC (rev 18789)
@@ -27,7 +27,7 @@
 #include "qof.h"
 
 gboolean   gnc_dom_tree_to_owner (xmlNodePtr node, GncOwner *owner,
-				  QofBook *book);
+                                  QofBook *book);
 xmlNodePtr gnc_owner_to_dom_tree (const char *tag, GncOwner *addr);
 void gnc_owner_xml_initialize (void);
 

Modified: gnucash/trunk/src/business/business-core/xml/gnc-tax-table-xml-v2.c
===================================================================
--- gnucash/trunk/src/business/business-core/xml/gnc-tax-table-xml-v2.c	2010-03-02 21:40:28 UTC (rev 18788)
+++ gnucash/trunk/src/business/business-core/xml/gnc-tax-table-xml-v2.c	2010-03-02 21:41:05 UTC (rev 18789)
@@ -70,33 +70,33 @@
 static void
 maybe_add_guid (xmlNodePtr ptr, const char *tag, GncTaxTable *table)
 {
-  if (table)
-    xmlAddChild (ptr, guid_to_dom_tree (tag, 
-            qof_instance_get_guid(QOF_INSTANCE(table))));
+    if (table)
+        xmlAddChild (ptr, guid_to_dom_tree (tag,
+                                            qof_instance_get_guid(QOF_INSTANCE(table))));
 }
 
 static xmlNodePtr
 ttentry_dom_tree_create (GncTaxTableEntry *entry)
 {
-  xmlNodePtr ret;
-  Account *account;
-  gnc_numeric amount;
+    xmlNodePtr ret;
+    Account *account;
+    gnc_numeric amount;
 
-  ret = xmlNewNode(NULL, BAD_CAST gnc_taxtableentry_string);
+    ret = xmlNewNode(NULL, BAD_CAST gnc_taxtableentry_string);
 
-  account = gncTaxTableEntryGetAccount (entry);
-  if (account)
-    xmlAddChild(ret, guid_to_dom_tree (ttentry_account_string,
-				       qof_instance_get_guid (QOF_INSTANCE(account))));
+    account = gncTaxTableEntryGetAccount (entry);
+    if (account)
+        xmlAddChild(ret, guid_to_dom_tree (ttentry_account_string,
+                                           qof_instance_get_guid (QOF_INSTANCE(account))));
 
-  amount = gncTaxTableEntryGetAmount (entry);
-  xmlAddChild (ret, gnc_numeric_to_dom_tree (ttentry_amount_string, &amount));
+    amount = gncTaxTableEntryGetAmount (entry);
+    xmlAddChild (ret, gnc_numeric_to_dom_tree (ttentry_amount_string, &amount));
 
-  xmlAddChild(ret, text_to_dom_tree (ttentry_type_string,
-				     gncAmountTypeToString (
-				    gncTaxTableEntryGetType (entry))));
+    xmlAddChild(ret, text_to_dom_tree (ttentry_type_string,
+                                       gncAmountTypeToString (
+                                           gncTaxTableEntryGetType (entry))));
 
-  return ret;
+    return ret;
 }
 
 static xmlNodePtr
@@ -110,23 +110,24 @@
 
     maybe_add_guid(ret, taxtable_guid_string, table);
     xmlAddChild(ret, text_to_dom_tree (taxtable_name_string,
-				       gncTaxTableGetName (table)));
+                                       gncTaxTableGetName (table)));
 
     xmlAddChild(ret, int_to_dom_tree (taxtable_refcount_string,
-				      gncTaxTableGetRefcount (table)));
+                                      gncTaxTableGetRefcount (table)));
     xmlAddChild(ret, int_to_dom_tree (taxtable_invisible_string,
-				      gncTaxTableGetInvisible (table)));
+                                      gncTaxTableGetInvisible (table)));
 
     /* We should not be our own child */
     if (gncTaxTableGetChild(table) != table)
-      maybe_add_guid(ret, taxtable_child_string, gncTaxTableGetChild (table));
+        maybe_add_guid(ret, taxtable_child_string, gncTaxTableGetChild (table));
 
     maybe_add_guid(ret, taxtable_parent_string, gncTaxTableGetParent (table));
 
     entries = xmlNewChild (ret, NULL, BAD_CAST taxtable_entries_string, NULL);
-    for (list = gncTaxTableGetEntries (table); list; list = list->next) {
-      GncTaxTableEntry *entry = list->data;
-      xmlAddChild(entries, ttentry_dom_tree_create (entry));
+    for (list = gncTaxTableGetEntries (table); list; list = list->next)
+    {
+        GncTaxTableEntry *entry = list->data;
+        xmlAddChild(entries, ttentry_dom_tree_create (entry));
     }
 
     return ret;
@@ -136,123 +137,127 @@
 
 struct ttentry_pdata
 {
-  GncTaxTableEntry *ttentry;
-  QofBook *book;
+    GncTaxTableEntry *ttentry;
+    QofBook *book;
 };
 
 static gboolean
 ttentry_acct_handler (xmlNodePtr node, gpointer ttentry_pdata)
 {
-  struct ttentry_pdata *pdata = ttentry_pdata;
-  GUID *guid;
-  Account * acc;
+    struct ttentry_pdata *pdata = ttentry_pdata;
+    GUID *guid;
+    Account * acc;
 
-  guid = dom_tree_to_guid (node);
-  g_return_val_if_fail (guid, FALSE);
-  acc = xaccAccountLookup (guid, pdata->book);
-  g_free (guid);
-  g_return_val_if_fail (acc, FALSE);
+    guid = dom_tree_to_guid (node);
+    g_return_val_if_fail (guid, FALSE);
+    acc = xaccAccountLookup (guid, pdata->book);
+    g_free (guid);
+    g_return_val_if_fail (acc, FALSE);
 
-  gncTaxTableEntrySetAccount (pdata->ttentry, acc);
-  return TRUE;
+    gncTaxTableEntrySetAccount (pdata->ttentry, acc);
+    return TRUE;
 }
 
 static gboolean
 ttentry_type_handler (xmlNodePtr node, gpointer taxtable_pdata)
 {
-  struct ttentry_pdata *pdata = taxtable_pdata;
-  GncAmountType type;
-  char *str;
-  gboolean ret;
+    struct ttentry_pdata *pdata = taxtable_pdata;
+    GncAmountType type;
+    char *str;
+    gboolean ret;
 
-  str = dom_tree_to_text (node);
-  g_return_val_if_fail (str, FALSE);
+    str = dom_tree_to_text (node);
+    g_return_val_if_fail (str, FALSE);
 
-  ret = gncAmountStringToType (str, &type);
-  g_free (str);
+    ret = gncAmountStringToType (str, &type);
+    g_free (str);
 
-  if (ret)
-    gncTaxTableEntrySetType (pdata->ttentry, type);
+    if (ret)
+        gncTaxTableEntrySetType (pdata->ttentry, type);
 
-  return ret;
+    return ret;
 }
 
 static gboolean
 ttentry_amount_handler (xmlNodePtr node, gpointer ttentry_pdata)
 {
-  struct ttentry_pdata *pdata = ttentry_pdata;
-  gnc_numeric* num = dom_tree_to_gnc_numeric(node);
-  g_return_val_if_fail(num, FALSE);
-    
-  gncTaxTableEntrySetAmount (pdata->ttentry, *num);
-  g_free(num);
-  return TRUE;
+    struct ttentry_pdata *pdata = ttentry_pdata;
+    gnc_numeric* num = dom_tree_to_gnc_numeric(node);
+    g_return_val_if_fail(num, FALSE);
+
+    gncTaxTableEntrySetAmount (pdata->ttentry, *num);
+    g_free(num);
+    return TRUE;
 }
 
-static struct dom_tree_handler ttentry_handlers_v2[] = {
-  { ttentry_account_string, ttentry_acct_handler, 0, 0 },
-  { ttentry_type_string, ttentry_type_handler, 1, 0 },
-  { ttentry_amount_string, ttentry_amount_handler, 1, 0 },
-  { NULL, 0, 0, 0 }
+static struct dom_tree_handler ttentry_handlers_v2[] =
+{
+    { ttentry_account_string, ttentry_acct_handler, 0, 0 },
+    { ttentry_type_string, ttentry_type_handler, 1, 0 },
+    { ttentry_amount_string, ttentry_amount_handler, 1, 0 },
+    { NULL, 0, 0, 0 }
 };
 
 static GncTaxTableEntry*
 dom_tree_to_ttentry (xmlNodePtr node, QofBook *book)
 {
-  struct ttentry_pdata ttentry_pdata;
-  gboolean successful;
-  
-  ttentry_pdata.ttentry = gncTaxTableEntryCreate ();
-  ttentry_pdata.book = book;
+    struct ttentry_pdata ttentry_pdata;
+    gboolean successful;
 
-  successful = dom_tree_generic_parse (node, ttentry_handlers_v2,
-				       &ttentry_pdata);
+    ttentry_pdata.ttentry = gncTaxTableEntryCreate ();
+    ttentry_pdata.book = book;
 
-  if (!successful) {
-    PERR ("failed to parse tax table entry tree");
-    gncTaxTableEntryDestroy (ttentry_pdata.ttentry);
-    ttentry_pdata.ttentry = NULL;
-  }
+    successful = dom_tree_generic_parse (node, ttentry_handlers_v2,
+                                         &ttentry_pdata);
 
-  return ttentry_pdata.ttentry;
+    if (!successful)
+    {
+        PERR ("failed to parse tax table entry tree");
+        gncTaxTableEntryDestroy (ttentry_pdata.ttentry);
+        ttentry_pdata.ttentry = NULL;
+    }
+
+    return ttentry_pdata.ttentry;
 }
 
 /***********************************************************************/
 
 struct taxtable_pdata
 {
-  GncTaxTable *table;
-  QofBook *book;
+    GncTaxTable *table;
+    QofBook *book;
 };
 
 static gboolean
 set_parent_child (xmlNodePtr node, struct taxtable_pdata *pdata,
-		  void (*func)(GncTaxTable *, GncTaxTable *))
+                  void (*func)(GncTaxTable *, GncTaxTable *))
 {
-  GUID *guid;
-  GncTaxTable *table;
+    GUID *guid;
+    GncTaxTable *table;
 
-  guid = dom_tree_to_guid(node);
-  g_return_val_if_fail (guid, FALSE);
-  table = gncTaxTableLookup (pdata->book, guid);
+    guid = dom_tree_to_guid(node);
+    g_return_val_if_fail (guid, FALSE);
+    table = gncTaxTableLookup (pdata->book, guid);
 
-  /* Ignore pointers to self */
-  if (table == pdata->table) {
-    PINFO ("found a self-referential parent/child; ignoring.\n");
-    return TRUE;
-  }
+    /* Ignore pointers to self */
+    if (table == pdata->table)
+    {
+        PINFO ("found a self-referential parent/child; ignoring.\n");
+        return TRUE;
+    }
 
-  if (!table) {
-    table = gncTaxTableCreate (pdata->book);
-    gncTaxTableBeginEdit (table);
-    gncTaxTableSetGUID (table, guid);
-    gncTaxTableCommitEdit (table);
-  }
-  g_free (guid);
-  g_return_val_if_fail (table, FALSE);
-  func (pdata->table, table);
+    if (!table)
+    {
+        table = gncTaxTableCreate (pdata->book);
+        gncTaxTableBeginEdit (table);
+        gncTaxTableSetGUID (table, guid);
+        gncTaxTableCommitEdit (table);
+    }
+    g_free (guid);
+    g_return_val_if_fail (table, FALSE);
+    func (pdata->table, table);
 
-  return TRUE;
+    return TRUE;
 }
 
 static gboolean
@@ -265,104 +270,109 @@
     guid = dom_tree_to_guid(node);
     g_return_val_if_fail (guid, FALSE);
     table = gncTaxTableLookup (pdata->book, guid);
-    if (table) {
-      gncTaxTableDestroy (pdata->table);
-      pdata->table = table;
-      gncTaxTableBeginEdit (table);
-    } else {
-      gncTaxTableSetGUID(pdata->table, guid);
+    if (table)
+    {
+        gncTaxTableDestroy (pdata->table);
+        pdata->table = table;
+        gncTaxTableBeginEdit (table);
     }
+    else
+    {
+        gncTaxTableSetGUID(pdata->table, guid);
+    }
 
     g_free(guid);
-    
+
     return TRUE;
 }
 
 static gboolean
 taxtable_name_handler (xmlNodePtr node, gpointer taxtable_pdata)
 {
-  struct taxtable_pdata *pdata = taxtable_pdata;
-  char* txt = dom_tree_to_text(node);
-  g_return_val_if_fail(txt, FALSE);
-    
-  gncTaxTableSetName (pdata->table, txt);
-  g_free(txt);
-  return TRUE;
+    struct taxtable_pdata *pdata = taxtable_pdata;
+    char* txt = dom_tree_to_text(node);
+    g_return_val_if_fail(txt, FALSE);
+
+    gncTaxTableSetName (pdata->table, txt);
+    g_free(txt);
+    return TRUE;
 }
 
 static gboolean
 taxtable_refcount_handler (xmlNodePtr node, gpointer taxtable_pdata)
 {
-  struct taxtable_pdata *pdata = taxtable_pdata;
-  gint64 val;
+    struct taxtable_pdata *pdata = taxtable_pdata;
+    gint64 val;
 
-  dom_tree_to_integer(node, &val);
-  gncTaxTableSetRefcount (pdata->table, val);
-  return TRUE;
+    dom_tree_to_integer(node, &val);
+    gncTaxTableSetRefcount (pdata->table, val);
+    return TRUE;
 }
 
 static gboolean
 taxtable_invisible_handler (xmlNodePtr node, gpointer taxtable_pdata)
 {
-  struct taxtable_pdata *pdata = taxtable_pdata;
-  gint64 val;
+    struct taxtable_pdata *pdata = taxtable_pdata;
+    gint64 val;
 
-  dom_tree_to_integer(node, &val);
-  if (val)
-    gncTaxTableMakeInvisible (pdata->table);
-  return TRUE;
+    dom_tree_to_integer(node, &val);
+    if (val)
+        gncTaxTableMakeInvisible (pdata->table);
+    return TRUE;
 }
 
 static gboolean
 taxtable_parent_handler (xmlNodePtr node, gpointer taxtable_pdata)
 {
-  struct taxtable_pdata *pdata = taxtable_pdata;
-  return set_parent_child (node, pdata, gncTaxTableSetParent);
+    struct taxtable_pdata *pdata = taxtable_pdata;
+    return set_parent_child (node, pdata, gncTaxTableSetParent);
 }
 
 static gboolean
 taxtable_child_handler (xmlNodePtr node, gpointer taxtable_pdata)
 {
-  struct taxtable_pdata *pdata = taxtable_pdata;
-  return set_parent_child (node, pdata, gncTaxTableSetChild);
+    struct taxtable_pdata *pdata = taxtable_pdata;
+    return set_parent_child (node, pdata, gncTaxTableSetChild);
 }
 
 static gboolean
 taxtable_entries_handler (xmlNodePtr node, gpointer taxtable_pdata)
 {
-  struct taxtable_pdata *pdata = taxtable_pdata;
-  xmlNodePtr mark;
+    struct taxtable_pdata *pdata = taxtable_pdata;
+    xmlNodePtr mark;
 
-  g_return_val_if_fail (node, FALSE);
-  g_return_val_if_fail (node->xmlChildrenNode, FALSE);
+    g_return_val_if_fail (node, FALSE);
+    g_return_val_if_fail (node->xmlChildrenNode, FALSE);
 
-  for (mark = node->xmlChildrenNode; mark; mark = mark->next) {
-    GncTaxTableEntry *entry;
-        
-    if (safe_strcmp ("text", (char*)mark->name) == 0)
-      continue;
+    for (mark = node->xmlChildrenNode; mark; mark = mark->next)
+    {
+        GncTaxTableEntry *entry;
 
-    if (safe_strcmp (gnc_taxtableentry_string, (char*)mark->name))
-      return FALSE;
+        if (safe_strcmp ("text", (char*)mark->name) == 0)
+            continue;
 
-    entry = dom_tree_to_ttentry (mark, pdata->book);
+        if (safe_strcmp (gnc_taxtableentry_string, (char*)mark->name))
+            return FALSE;
 
-    if (entry)
-      gncTaxTableAddEntry (pdata->table, entry);
-    else
-      return FALSE;
+        entry = dom_tree_to_ttentry (mark, pdata->book);
 
-  }
-  return TRUE;
+        if (entry)
+            gncTaxTableAddEntry (pdata->table, entry);
+        else
+            return FALSE;
+
+    }
+    return TRUE;
 }
 
 static gboolean
 taxtable_slots_handler (xmlNodePtr node, gpointer taxtable_pdata)
 {
-  return TRUE;
+    return TRUE;
 }
 
-static struct dom_tree_handler taxtable_handlers_v2[] = {
+static struct dom_tree_handler taxtable_handlers_v2[] =
+{
     { taxtable_guid_string, taxtable_guid_handler, 1, 0 },
     { taxtable_name_string, taxtable_name_handler, 1, 0 },
     { taxtable_refcount_string, taxtable_refcount_handler, 1, 0 },
@@ -377,33 +387,33 @@
 static GncTaxTable*
 dom_tree_to_taxtable (xmlNodePtr node, QofBook *book)
 {
-  struct taxtable_pdata taxtable_pdata;
-  gboolean successful;
-  
-  taxtable_pdata.table = gncTaxTableCreate (book);
-  taxtable_pdata.book = book;
-  gncTaxTableBeginEdit (taxtable_pdata.table);
+    struct taxtable_pdata taxtable_pdata;
+    gboolean successful;
 
-  successful = dom_tree_generic_parse (node, taxtable_handlers_v2,
-				       &taxtable_pdata);
+    taxtable_pdata.table = gncTaxTableCreate (book);
+    taxtable_pdata.book = book;
+    gncTaxTableBeginEdit (taxtable_pdata.table);
 
-  if (successful)
-    gncTaxTableCommitEdit (taxtable_pdata.table);
-  else
-  {
-    PERR ("failed to parse tax table tree");
-    gncTaxTableDestroy (taxtable_pdata.table);
-    taxtable_pdata.table = NULL;
-  }
+    successful = dom_tree_generic_parse (node, taxtable_handlers_v2,
+                                         &taxtable_pdata);
 
-  return taxtable_pdata.table;
+    if (successful)
+        gncTaxTableCommitEdit (taxtable_pdata.table);
+    else
+    {
+        PERR ("failed to parse tax table tree");
+        gncTaxTableDestroy (taxtable_pdata.table);
+        taxtable_pdata.table = NULL;
+    }
+
+    return taxtable_pdata.table;
 }
 
 static gboolean
 gnc_taxtable_end_handler(gpointer data_for_children,
-			 GSList* data_from_children, GSList* sibling_data,
-			 gpointer parent_data, gpointer global_data,
-			 gpointer *result, const gchar *tag)
+                         GSList* data_from_children, GSList* sibling_data,
+                         gpointer parent_data, gpointer global_data,
+                         gpointer *result, const gchar *tag)
 {
     int successful;
     GncTaxTable *table;
@@ -413,14 +423,14 @@
 
     successful = TRUE;
 
-    if(parent_data)
+    if (parent_data)
     {
         return TRUE;
     }
 
     /* OK.  For some messed up reason this is getting called again with a
        NULL tag.  So we ignore those cases */
-    if(!tag)
+    if (!tag)
     {
         return TRUE;
     }
@@ -428,7 +438,7 @@
     g_return_val_if_fail(tree, FALSE);
 
     table = dom_tree_to_taxtable (tree, book);
-    if(table != NULL)
+    if (table != NULL)
     {
         gdata->cb(tag, gdata->parsedata, table);
     }
@@ -441,97 +451,99 @@
 static sixtp *
 taxtable_sixtp_parser_create(void)
 {
-  return sixtp_dom_parser_new(gnc_taxtable_end_handler, NULL, NULL);
+    return sixtp_dom_parser_new(gnc_taxtable_end_handler, NULL, NULL);
 }
 
 static void
 do_count (QofInstance * table_p, gpointer count_p)
 {
-  int *count = count_p;
-  (*count)++;
+    int *count = count_p;
+    (*count)++;
 }
 
 static int
 taxtable_get_count (QofBook *book)
 {
-  int count = 0;
-  qof_object_foreach (_GNC_MOD_NAME, book, do_count, (gpointer) &count);
-  return count;
+    int count = 0;
+    qof_object_foreach (_GNC_MOD_NAME, book, do_count, (gpointer) &count);
+    return count;
 }
 
 static void
 xml_add_taxtable (QofInstance * table_p, gpointer out_p)
 {
-  xmlNodePtr node;
-  GncTaxTable *table = (GncTaxTable *) table_p;
-  FILE *out = out_p;
+    xmlNodePtr node;
+    GncTaxTable *table = (GncTaxTable *) table_p;
+    FILE *out = out_p;
 
-  if (ferror(out))
-    return;
+    if (ferror(out))
+        return;
 
-  node = taxtable_dom_tree_create (table);
-  xmlElemDump(out, NULL, node);
-  xmlFreeNode (node);
-  if (ferror(out) || fprintf(out, "\n") < 0)
-    return;
+    node = taxtable_dom_tree_create (table);
+    xmlElemDump(out, NULL, node);
+    xmlFreeNode (node);
+    if (ferror(out) || fprintf(out, "\n") < 0)
+        return;
 }
 
 static gboolean
 taxtable_write (FILE *out, QofBook *book)
 {
-  qof_object_foreach (_GNC_MOD_NAME, book, xml_add_taxtable, (gpointer) out);
-  return ferror(out) == 0;
+    qof_object_foreach (_GNC_MOD_NAME, book, xml_add_taxtable, (gpointer) out);
+    return ferror(out) == 0;
 }
 
 
 static gboolean
 taxtable_is_grandchild (GncTaxTable *table)
 {
-  return (gncTaxTableGetParent(gncTaxTableGetParent(table)) != NULL);
+    return (gncTaxTableGetParent(gncTaxTableGetParent(table)) != NULL);
 }
 
 static GncTaxTable *
 taxtable_find_senior (GncTaxTable *table)
 {
-  GncTaxTable *temp, *parent, *gp = NULL;
+    GncTaxTable *temp, *parent, *gp = NULL;
 
-  temp = table;
-  do {
-    /* See if "temp" is a grandchild */
-    parent = gncTaxTableGetParent(temp);
-    if (!parent)
-      break;
-    gp = gncTaxTableGetParent(parent);
-    if (!gp)
-      break;
+    temp = table;
+    do
+    {
+        /* See if "temp" is a grandchild */
+        parent = gncTaxTableGetParent(temp);
+        if (!parent)
+            break;
+        gp = gncTaxTableGetParent(parent);
+        if (!gp)
+            break;
 
-    /* Yep, this is a grandchild.  Move up one generation and try again */
-    temp = parent;
-  } while (TRUE);
+        /* Yep, this is a grandchild.  Move up one generation and try again */
+        temp = parent;
+    }
+    while (TRUE);
 
-  /* Ok, at this point temp points to the most senior child and parent
-   * should point to the top taxtable (and gp should be NULL).  If
-   * parent is NULL then we are the most senior child (and have no
-   * children), so do nothing.  If temp == table then there is no
-   * grandparent, so do nothing.
-   *
-   * Do something if parent != NULL && temp != table
-   */
-  g_assert (gp == NULL);
+    /* Ok, at this point temp points to the most senior child and parent
+     * should point to the top taxtable (and gp should be NULL).  If
+     * parent is NULL then we are the most senior child (and have no
+     * children), so do nothing.  If temp == table then there is no
+     * grandparent, so do nothing.
+     *
+     * Do something if parent != NULL && temp != table
+     */
+    g_assert (gp == NULL);
 
-  /* return the most senior table */
-  return temp;
+    /* return the most senior table */
+    return temp;
 }
 
 /* build a list of tax tables that are grandchildren or bogus (empty entry list). */
 static void
 taxtable_scrub_cb (QofInstance * table_p, gpointer list_p)
 {
-  GncTaxTable *table = GNC_TAXTABLE(table_p);
-  GList **list = list_p;
+    GncTaxTable *table = GNC_TAXTABLE(table_p);
+    GList **list = list_p;
 
-  if (taxtable_is_grandchild(table) || gncTaxTableGetEntries(table) == NULL)
-    *list = g_list_prepend(*list, table);
+    if (taxtable_is_grandchild(table) || gncTaxTableGetEntries(table) == NULL)
+        *list = g_list_prepend(*list, table);
 }
 
 /* for each entry, check the tax tables.  If the tax tables are
@@ -540,154 +552,165 @@
 static void
 taxtable_scrub_entries (QofInstance * entry_p, gpointer ht_p)
 {
-  GHashTable *ht = ht_p;
-  GncEntry *entry = GNC_ENTRY(entry_p);
-  GncTaxTable *table, *new_tt;
-  gint32 count;
+    GHashTable *ht = ht_p;
+    GncEntry *entry = GNC_ENTRY(entry_p);
+    GncTaxTable *table, *new_tt;
+    gint32 count;
 
-  table = gncEntryGetInvTaxTable(entry);
-  if (table) {
-    if (taxtable_is_grandchild(table)) {
-      PINFO("Fixing i-taxtable on entry %s\n",
-	     guid_to_string(qof_instance_get_guid(QOF_INSTANCE(entry))));
-      new_tt = taxtable_find_senior(table);
-      gncEntryBeginEdit(entry);
-      gncEntrySetInvTaxTable(entry, new_tt);
-      gncEntryCommitEdit(entry);
-      table = new_tt;
+    table = gncEntryGetInvTaxTable(entry);
+    if (table)
+    {
+        if (taxtable_is_grandchild(table))
+        {
+            PINFO("Fixing i-taxtable on entry %s\n",
+                  guid_to_string(qof_instance_get_guid(QOF_INSTANCE(entry))));
+            new_tt = taxtable_find_senior(table);
+            gncEntryBeginEdit(entry);
+            gncEntrySetInvTaxTable(entry, new_tt);
+            gncEntryCommitEdit(entry);
+            table = new_tt;
+        }
+        if (table)
+        {
+            count = GPOINTER_TO_INT(g_hash_table_lookup(ht, table));
+            count++;
+            g_hash_table_insert(ht, table, GINT_TO_POINTER(count));
+        }
     }
-    if (table) {
-      count = GPOINTER_TO_INT(g_hash_table_lookup(ht, table));
-      count++;
-      g_hash_table_insert(ht, table, GINT_TO_POINTER(count));
-    }
-  }
 
-  table = gncEntryGetBillTaxTable(entry);
-  if (table) {
-    if (taxtable_is_grandchild(table)) {
-      PINFO("Fixing b-taxtable on entry %s\n",
-	     guid_to_string(qof_instance_get_guid(QOF_INSTANCE(entry))));
-      new_tt = taxtable_find_senior(table);
-      gncEntryBeginEdit(entry);
-      gncEntrySetBillTaxTable(entry, new_tt);
-      gncEntryCommitEdit(entry);
-      table = new_tt;
+    table = gncEntryGetBillTaxTable(entry);
+    if (table)
+    {
+        if (taxtable_is_grandchild(table))
+        {
+            PINFO("Fixing b-taxtable on entry %s\n",
+                  guid_to_string(qof_instance_get_guid(QOF_INSTANCE(entry))));
+            new_tt = taxtable_find_senior(table);
+            gncEntryBeginEdit(entry);
+            gncEntrySetBillTaxTable(entry, new_tt);
+            gncEntryCommitEdit(entry);
+            table = new_tt;
+        }
+        if (table)
+        {
+            count = GPOINTER_TO_INT(g_hash_table_lookup(ht, table));
+            count++;
+            g_hash_table_insert(ht, table, GINT_TO_POINTER(count));
+        }
     }
-    if (table) {
-      count = GPOINTER_TO_INT(g_hash_table_lookup(ht, table));
-      count++;
-      g_hash_table_insert(ht, table, GINT_TO_POINTER(count));
-    }
-  }
 }
 
 static void
 taxtable_scrub_cust (QofInstance * cust_p, gpointer ht_p)
 {
-  GHashTable *ht = ht_p;
-  GncCustomer *cust = GNC_CUSTOMER(cust_p);
-  GncTaxTable *table;
-  gint32 count;
-  
-  table = gncCustomerGetTaxTable(cust);
-  if (table) {
-    count = GPOINTER_TO_INT(g_hash_table_lookup(ht, table));
-    count++;
-    g_hash_table_insert(ht, table, GINT_TO_POINTER(count));
-  }
+    GHashTable *ht = ht_p;
+    GncCustomer *cust = GNC_CUSTOMER(cust_p);
+    GncTaxTable *table;
+    gint32 count;
+
+    table = gncCustomerGetTaxTable(cust);
+    if (table)
+    {
+        count = GPOINTER_TO_INT(g_hash_table_lookup(ht, table));
+        count++;
+        g_hash_table_insert(ht, table, GINT_TO_POINTER(count));
+    }
 }
 
 static void
 taxtable_scrub_vendor (QofInstance * vendor_p, gpointer ht_p)
 {
-  GHashTable *ht = ht_p;
-  GncVendor *vendor = GNC_VENDOR(vendor_p);
-  GncTaxTable *table;
-  gint32 count;
+    GHashTable *ht = ht_p;
+    GncVendor *vendor = GNC_VENDOR(vendor_p);
+    GncTaxTable *table;
+    gint32 count;
 
-  table = gncVendorGetTaxTable(vendor);
-  if (table) {
-    count = GPOINTER_TO_INT(g_hash_table_lookup(ht, table));
-    count++;
-    g_hash_table_insert(ht, table, GINT_TO_POINTER(count));
-  }
+    table = gncVendorGetTaxTable(vendor);
+    if (table)
+    {
+        count = GPOINTER_TO_INT(g_hash_table_lookup(ht, table));
+        count++;
+        g_hash_table_insert(ht, table, GINT_TO_POINTER(count));
+    }
 }
 
 static void
 taxtable_reset_refcount (gpointer key, gpointer value, gpointer notused)
 {
-  GncTaxTable *table = key;
-  gint32 count = GPOINTER_TO_INT(value);
+    GncTaxTable *table = key;
+    gint32 count = GPOINTER_TO_INT(value);
 
-  if (count != gncTaxTableGetRefcount(table) && !gncTaxTableGetInvisible(table)) {
-    PWARN("Fixing refcount on taxtable %s (%" G_GINT64_FORMAT " -> %d)\n",
-	  guid_to_string(qof_instance_get_guid(QOF_INSTANCE(table))),
-	  gncTaxTableGetRefcount(table), count);
-      gncTaxTableSetRefcount(table, count);
-  }
+    if (count != gncTaxTableGetRefcount(table) && !gncTaxTableGetInvisible(table))
+    {
+        PWARN("Fixing refcount on taxtable %s (%" G_GINT64_FORMAT " -> %d)\n",
+              guid_to_string(qof_instance_get_guid(QOF_INSTANCE(table))),
+              gncTaxTableGetRefcount(table), count);
+        gncTaxTableSetRefcount(table, count);
+    }
 }
 
 static void
 taxtable_scrub (QofBook *book)
 {
-  GList *list = NULL;
-  GList *node;
-  GncTaxTable *parent, *table;
-  GHashTable *ht = g_hash_table_new(g_direct_hash, g_direct_equal);
+    GList *list = NULL;
+    GList *node;
+    GncTaxTable *parent, *table;
+    GHashTable *ht = g_hash_table_new(g_direct_hash, g_direct_equal);
 
-  qof_object_foreach (GNC_ID_ENTRY, book, taxtable_scrub_entries, ht);
-  qof_object_foreach (GNC_ID_CUSTOMER, book, taxtable_scrub_cust, ht);
-  qof_object_foreach (GNC_ID_VENDOR, book, taxtable_scrub_vendor, ht);
-  qof_object_foreach (GNC_ID_TAXTABLE, book, taxtable_scrub_cb, &list);
+    qof_object_foreach (GNC_ID_ENTRY, book, taxtable_scrub_entries, ht);
+    qof_object_foreach (GNC_ID_CUSTOMER, book, taxtable_scrub_cust, ht);
+    qof_object_foreach (GNC_ID_VENDOR, book, taxtable_scrub_vendor, ht);
+    qof_object_foreach (GNC_ID_TAXTABLE, book, taxtable_scrub_cb, &list);
 
-  /* destroy the list of "grandchildren" tax tables */
-  for (node = list; node; node = node->next) {
-    table = node->data;
+    /* destroy the list of "grandchildren" tax tables */
+    for (node = list; node; node = node->next)
+    {
+        table = node->data;
 
-    PINFO ("deleting grandchild taxtable: %s\n",
-	   guid_to_string(qof_instance_get_guid(QOF_INSTANCE(table))));
+        PINFO ("deleting grandchild taxtable: %s\n",
+               guid_to_string(qof_instance_get_guid(QOF_INSTANCE(table))));
 
-    /* Make sure the parent has no children */
-    parent = gncTaxTableGetParent(table);
-    gncTaxTableSetChild(parent, NULL);
+        /* Make sure the parent has no children */
+        parent = gncTaxTableGetParent(table);
+        gncTaxTableSetChild(parent, NULL);
 
-    /* Destroy this tax table */
-    gncTaxTableBeginEdit(table);
-    gncTaxTableDestroy(table);
-  }
+        /* Destroy this tax table */
+        gncTaxTableBeginEdit(table);
+        gncTaxTableDestroy(table);
+    }
 
-  /* reset the refcounts as necessary */
-  g_hash_table_foreach(ht, taxtable_reset_refcount, NULL);
+    /* reset the refcounts as necessary */
+    g_hash_table_foreach(ht, taxtable_reset_refcount, NULL);
 
-  g_list_free(list);
-  g_hash_table_destroy(ht);
+    g_list_free(list);
+    g_hash_table_destroy(ht);
 }
 
 static gboolean
 taxtable_ns(FILE *out)
 {
-  g_return_val_if_fail(out, FALSE);
-  return
-    gnc_xml2_write_namespace_decl(out, "taxtable")
-    && gnc_xml2_write_namespace_decl(out, "tte");
+    g_return_val_if_fail(out, FALSE);
+    return
+        gnc_xml2_write_namespace_decl(out, "taxtable")
+        && gnc_xml2_write_namespace_decl(out, "tte");
 }
 
 void
 gnc_taxtable_xml_initialize (void)
 {
-  static GncXmlDataType_t be_data = {
-    GNC_FILE_BACKEND_VERS,
-    gnc_taxtable_string,
-    taxtable_sixtp_parser_create,
-    NULL,			/* add_item */
-    taxtable_get_count,
-    taxtable_write,
-    taxtable_scrub,
-    taxtable_ns,
-  };
+    static GncXmlDataType_t be_data =
+    {
+        GNC_FILE_BACKEND_VERS,
+        gnc_taxtable_string,
+        taxtable_sixtp_parser_create,
+        NULL,			/* add_item */
+        taxtable_get_count,
+        taxtable_write,
+        taxtable_scrub,
+        taxtable_ns,
+    };
 
-  qof_object_register_backend (_GNC_MOD_NAME,
-			    GNC_FILE_BACKEND,
-			    &be_data);
+    qof_object_register_backend (_GNC_MOD_NAME,
+                                 GNC_FILE_BACKEND,
+                                 &be_data);
 }

Modified: gnucash/trunk/src/business/business-core/xml/gnc-vendor-xml-v2.c
===================================================================
--- gnucash/trunk/src/business/business-core/xml/gnc-vendor-xml-v2.c	2010-03-02 21:40:28 UTC (rev 18788)
+++ gnucash/trunk/src/business/business-core/xml/gnc-vendor-xml-v2.c	2010-03-02 21:41:05 UTC (rev 18789)
@@ -81,45 +81,45 @@
     xmlSetProp(ret, BAD_CAST "version", BAD_CAST vendor_version_string);
 
     xmlAddChild(ret, guid_to_dom_tree(vendor_guid_string,
-				      qof_instance_get_guid (QOF_INSTANCE(vendor))));
+                                      qof_instance_get_guid (QOF_INSTANCE(vendor))));
 
     xmlAddChild(ret, text_to_dom_tree(vendor_name_string,
                                       gncVendorGetName (vendor)));
-    
+
     xmlAddChild(ret, text_to_dom_tree(vendor_id_string,
                                       gncVendorGetID (vendor)));
 
     xmlAddChild(ret, gnc_address_to_dom_tree(vendor_addr_string,
-					     gncVendorGetAddr (vendor)));
-    
+                gncVendorGetAddr (vendor)));
+
     maybe_add_string (ret, vendor_notes_string, gncVendorGetNotes (vendor));
 
     term = gncVendorGetTerms (vendor);
     if (term)
-      xmlAddChild(ret, guid_to_dom_tree(vendor_terms_string,
-					qof_instance_get_guid(QOF_INSTANCE(term))));
+        xmlAddChild(ret, guid_to_dom_tree(vendor_terms_string,
+                                          qof_instance_get_guid(QOF_INSTANCE(term))));
 
     xmlAddChild(ret, text_to_dom_tree(vendor_taxincluded_string,
-				      gncTaxIncludedTypeToString (
-				     gncVendorGetTaxIncluded (vendor))));
+                                      gncTaxIncludedTypeToString (
+                                          gncVendorGetTaxIncluded (vendor))));
 
     xmlAddChild(ret, int_to_dom_tree(vendor_active_string,
-				     gncVendorGetActive (vendor)));
+                                     gncVendorGetActive (vendor)));
 
     xmlAddChild
-      (ret,
-       commodity_ref_to_dom_tree(vendor_currency_string,
-				 gncVendorGetCurrency (vendor)));
+    (ret,
+     commodity_ref_to_dom_tree(vendor_currency_string,
+                               gncVendorGetCurrency (vendor)));
 
     xmlAddChild (ret, int_to_dom_tree (vendor_taxtableoverride_string,
-				       gncVendorGetTaxTableOverride (vendor)));
+                                       gncVendorGetTaxTableOverride (vendor)));
     taxtable = gncVendorGetTaxTable (vendor);
     if (taxtable)
-      xmlAddChild (ret, guid_to_dom_tree (vendor_taxtable_string,
-					  qof_instance_get_guid(QOF_INSTANCE(taxtable))));
+        xmlAddChild (ret, guid_to_dom_tree (vendor_taxtable_string,
+                                            qof_instance_get_guid(QOF_INSTANCE(taxtable))));
 
-    kvpnode = kvp_frame_to_dom_tree (vendor_slots_string, 
-				     qof_instance_get_slots (QOF_INSTANCE(vendor)));
+    kvpnode = kvp_frame_to_dom_tree (vendor_slots_string,
+                                     qof_instance_get_slots (QOF_INSTANCE(vendor)));
     if (kvpnode) xmlAddChild (ret, kvpnode);
 
     return ret;
@@ -129,34 +129,34 @@
 
 struct vendor_pdata
 {
-  GncVendor *vendor;
-  QofBook *book;
+    GncVendor *vendor;
+    QofBook *book;
 };
 
 static gboolean
 set_string(xmlNodePtr node, GncVendor* vendor,
            void (*func)(GncVendor *vendor, const char *txt))
 {
-  char* txt = dom_tree_to_text(node);
-  g_return_val_if_fail(txt, FALSE);
-    
-  func(vendor, txt);
-  
-  g_free(txt);
-    
-  return TRUE;
+    char* txt = dom_tree_to_text(node);
+    g_return_val_if_fail(txt, FALSE);
+
+    func(vendor, txt);
+
+    g_free(txt);
+
+    return TRUE;
 }
 
 static gboolean
 set_boolean(xmlNodePtr node, GncVendor* vendor,
-	    void (*func)(GncVendor* vendor, gboolean b))
+            void (*func)(GncVendor* vendor, gboolean b))
 {
     gint64 val;
     gboolean ret;
 
     ret = dom_tree_to_integer(node, &val);
     if (ret)
-      func(vendor, (gboolean)val);
+        func(vendor, (gboolean)val);
 
     return ret;
 }
@@ -179,16 +179,19 @@
     guid = dom_tree_to_guid(node);
     g_return_val_if_fail(guid, FALSE);
     vendor = gncVendorLookup (pdata->book, guid);
-    if (vendor) {
-      gncVendorDestroy (pdata->vendor);
-      pdata->vendor = vendor;
-      gncVendorBeginEdit (vendor);
-    } else {
-      gncVendorSetGUID(pdata->vendor, guid);
+    if (vendor)
+    {
+        gncVendorDestroy (pdata->vendor);
+        pdata->vendor = vendor;
+        gncVendorBeginEdit (vendor);
     }
+    else
+    {
+        gncVendorSetGUID(pdata->vendor, guid);
+    }
 
     g_free(guid);
-    
+
     return TRUE;
 }
 
@@ -221,7 +224,7 @@
     g_assert(term);
     g_free (guid);
     gncVendorSetTerms (pdata->vendor, term);
-    
+
     return TRUE;
 }
 
@@ -248,7 +251,7 @@
     g_free (str);
 
     if (ret)
-      gncVendorSetTaxIncluded(pdata->vendor, type);
+        gncVendorSetTaxIncluded(pdata->vendor, type);
 
     return ret;
 }
@@ -284,13 +287,15 @@
     guid = dom_tree_to_guid (node);
     g_return_val_if_fail (guid, FALSE);
     taxtable = gncTaxTableLookup (pdata->book, guid);
-    if (!taxtable) {
-      taxtable = gncTaxTableCreate (pdata->book);
-      gncTaxTableBeginEdit (taxtable);
-      gncTaxTableSetGUID (taxtable, guid);
-      gncTaxTableCommitEdit (taxtable);
-    } else
-      gncTaxTableDecRef (taxtable);
+    if (!taxtable)
+    {
+        taxtable = gncTaxTableCreate (pdata->book);
+        gncTaxTableBeginEdit (taxtable);
+        gncTaxTableSetGUID (taxtable, guid);
+        gncTaxTableCommitEdit (taxtable);
+    }
+    else
+        gncTaxTableDecRef (taxtable);
 
     gncVendorSetTaxTable (pdata->vendor, taxtable);
     g_free(guid);
@@ -309,11 +314,12 @@
 {
     struct vendor_pdata *pdata = vendor_pdata;
     return dom_tree_to_kvp_frame_given (
-	node, qof_instance_get_slots (QOF_INSTANCE(pdata->vendor)));
+               node, qof_instance_get_slots (QOF_INSTANCE(pdata->vendor)));
 
 }
 
-static struct dom_tree_handler vendor_handlers_v2[] = {
+static struct dom_tree_handler vendor_handlers_v2[] =
+{
     { vendor_name_string, vendor_name_handler, 1, 0 },
     { vendor_guid_string, vendor_guid_handler, 1, 0 },
     { vendor_id_string, vendor_id_handler, 1, 0 },
@@ -344,7 +350,7 @@
                                          &vendor_pdata);
 
     if (successful)
-      gncVendorCommitEdit (vendor_pdata.vendor);
+        gncVendorCommitEdit (vendor_pdata.vendor);
     else
     {
         PERR ("failed to parse vendor tree");
@@ -357,9 +363,9 @@
 
 static gboolean
 gnc_vendor_end_handler(gpointer data_for_children,
-			 GSList* data_from_children, GSList* sibling_data,
-			 gpointer parent_data, gpointer global_data,
-			 gpointer *result, const gchar *tag)
+                       GSList* data_from_children, GSList* sibling_data,
+                       gpointer parent_data, gpointer global_data,
+                       gpointer *result, const gchar *tag)
 {
     int successful;
     GncVendor *vendor;
@@ -369,14 +375,14 @@
 
     successful = TRUE;
 
-    if(parent_data)
+    if (parent_data)
     {
         return TRUE;
     }
 
     /* OK.  For some messed up reason this is getting called again with a
        NULL tag.  So we ignore those cases */
-    if(!tag)
+    if (!tag)
     {
         return TRUE;
     }
@@ -384,7 +390,7 @@
     g_return_val_if_fail(tree, FALSE);
 
     vendor = dom_tree_to_vendor(tree, book);
-    if(vendor != NULL)
+    if (vendor != NULL)
     {
         gdata->cb(tag, gdata->parsedata, vendor);
     }
@@ -397,86 +403,87 @@
 static sixtp *
 vendor_sixtp_parser_create(void)
 {
-  return sixtp_dom_parser_new(gnc_vendor_end_handler, NULL, NULL);
+    return sixtp_dom_parser_new(gnc_vendor_end_handler, NULL, NULL);
 }
 
 static gboolean
 vendor_should_be_saved (GncVendor *vendor)
 {
-  const char *id;
+    const char *id;
 
-  /* make sure this is a valid vendor before we save it -- should have an ID */
-  id = gncVendorGetID (vendor);
-  if (id == NULL || *id == '\0')
-    return FALSE;
+    /* make sure this is a valid vendor before we save it -- should have an ID */
+    id = gncVendorGetID (vendor);
+    if (id == NULL || *id == '\0')
+        return FALSE;
 
-  return TRUE;
+    return TRUE;
 }
 
 static void
 do_count (QofInstance * vendor_p, gpointer count_p)
 {
-  int *count = count_p;
-  if (vendor_should_be_saved ((GncVendor *)vendor_p))
-    (*count)++;
+    int *count = count_p;
+    if (vendor_should_be_saved ((GncVendor *)vendor_p))
+        (*count)++;
 }
 
 static int
 vendor_get_count (QofBook *book)
 {
-  int count = 0;
-  qof_object_foreach (_GNC_MOD_NAME, book, do_count, (gpointer) &count);
-  return count;
+    int count = 0;
+    qof_object_foreach (_GNC_MOD_NAME, book, do_count, (gpointer) &count);
+    return count;
 }
 
 static void
 xml_add_vendor (QofInstance * vendor_p, gpointer out_p)
 {
-  xmlNodePtr node;
-  GncVendor *vendor = (GncVendor *) vendor_p;
-  FILE *out = out_p;
+    xmlNodePtr node;
+    GncVendor *vendor = (GncVendor *) vendor_p;
+    FILE *out = out_p;
 
-  if (ferror(out))
-    return;
-  if (!vendor_should_be_saved (vendor))
-    return;
+    if (ferror(out))
+        return;
+    if (!vendor_should_be_saved (vendor))
+        return;
 
-  node = vendor_dom_tree_create (vendor);
-  xmlElemDump(out, NULL, node);
-  xmlFreeNode (node);
-  if (ferror(out) || fprintf(out, "\n") < 0)
-    return;
+    node = vendor_dom_tree_create (vendor);
+    xmlElemDump(out, NULL, node);
+    xmlFreeNode (node);
+    if (ferror(out) || fprintf(out, "\n") < 0)
+        return;
 }
 
 static gboolean
 vendor_write (FILE *out, QofBook *book)
 {
-  qof_object_foreach (_GNC_MOD_NAME, book, xml_add_vendor, (gpointer) out);
-  return ferror(out) == 0;
+    qof_object_foreach (_GNC_MOD_NAME, book, xml_add_vendor, (gpointer) out);
+    return ferror(out) == 0;
 }
 
 static gboolean
 vendor_ns(FILE *out)
 {
-  g_return_val_if_fail(out, FALSE);
-  return gnc_xml2_write_namespace_decl(out, "vendor");
+    g_return_val_if_fail(out, FALSE);
+    return gnc_xml2_write_namespace_decl(out, "vendor");
 }
 
 void
 gnc_vendor_xml_initialize (void)
 {
-  static GncXmlDataType_t be_data = {
-    GNC_FILE_BACKEND_VERS,
-    gnc_vendor_string,
-    vendor_sixtp_parser_create,
-    NULL,			/* add_item */
-    vendor_get_count,
-    vendor_write,
-    NULL,			/* scrub */
-    vendor_ns,
-  };
+    static GncXmlDataType_t be_data =
+    {
+        GNC_FILE_BACKEND_VERS,
+        gnc_vendor_string,
+        vendor_sixtp_parser_create,
+        NULL,			/* add_item */
+        vendor_get_count,
+        vendor_write,
+        NULL,			/* scrub */
+        vendor_ns,
+    };
 
-  qof_object_register_backend (_GNC_MOD_NAME,
-			    GNC_FILE_BACKEND,
-			    &be_data);
+    qof_object_register_backend (_GNC_MOD_NAME,
+                                 GNC_FILE_BACKEND,
+                                 &be_data);
 }

Modified: gnucash/trunk/src/business/business-core/xml/xml-helpers.h
===================================================================
--- gnucash/trunk/src/business/business-core/xml/xml-helpers.h	2010-03-02 21:40:28 UTC (rev 18788)
+++ gnucash/trunk/src/business/business-core/xml/xml-helpers.h	2010-03-02 21:41:05 UTC (rev 18789)
@@ -6,29 +6,29 @@
 static inline void
 maybe_add_int (xmlNodePtr ptr, const char *tag, gint val)
 {
-  if (val)
-    xmlAddChild (ptr, int_to_dom_tree (tag, val));
+    if (val)
+        xmlAddChild (ptr, int_to_dom_tree (tag, val));
 }
 
 static inline void
 maybe_add_numeric (xmlNodePtr ptr, const char *tag, gnc_numeric val)
 {
-  if (!gnc_numeric_zero_p (val))
-    xmlAddChild (ptr, gnc_numeric_to_dom_tree (tag, &val));
+    if (!gnc_numeric_zero_p (val))
+        xmlAddChild (ptr, gnc_numeric_to_dom_tree (tag, &val));
 }
 
 static inline void
 maybe_add_string (xmlNodePtr ptr, const char *tag, const char *str)
 {
-  if (str && strlen(str) > 0)
-    xmlAddChild (ptr, text_to_dom_tree (tag, str));
+    if (str && strlen(str) > 0)
+        xmlAddChild (ptr, text_to_dom_tree (tag, str));
 }
 
 static inline void
 maybe_add_guid (xmlNodePtr ptr, const char *tag, QofInstance *inst)
 {
-  if (inst)
-    xmlAddChild (ptr, guid_to_dom_tree (tag,
-          qof_instance_get_guid (inst)));
+    if (inst)
+        xmlAddChild (ptr, guid_to_dom_tree (tag,
+                                            qof_instance_get_guid (inst)));
 }
 

Modified: gnucash/trunk/src/business/business-gnome/business-gnome-utils.c
===================================================================
--- gnucash/trunk/src/business/business-gnome/business-gnome-utils.c	2010-03-02 21:40:28 UTC (rev 18788)
+++ gnucash/trunk/src/business/business-gnome/business-gnome-utils.c	2010-03-02 21:41:05 UTC (rev 18789)
@@ -51,344 +51,357 @@
 
 #include "gnc-commodity.h"
 
-typedef enum {
-  GNCSEARCH_TYPE_SELECT,
-  GNCSEARCH_TYPE_EDIT
+typedef enum
+{
+    GNCSEARCH_TYPE_SELECT,
+    GNCSEARCH_TYPE_EDIT
 } GNCSearchType;
 
 static GtkWidget * gnc_owner_new (GtkWidget *label, GtkWidget *hbox,
-				  QofBook *book, GncOwner *owner,
-				  GNCSearchType type)
+                                  QofBook *book, GncOwner *owner,
+                                  GNCSearchType type)
 {
-  GtkWidget *edit;
-  GNCSearchCB search_cb = NULL;
-  const char *type_name = NULL;
-  const char *text = NULL;
-  gboolean text_editable = FALSE;
+    GtkWidget *edit;
+    GNCSearchCB search_cb = NULL;
+    const char *type_name = NULL;
+    const char *text = NULL;
+    gboolean text_editable = FALSE;
 
-  switch (type) {
-  case GNCSEARCH_TYPE_SELECT:
-    text = _("Select...");
-    text_editable = TRUE;
-    break;
-  case GNCSEARCH_TYPE_EDIT:
-    text = _("Edit...");
-    text_editable = FALSE;
-  };
+    switch (type)
+    {
+    case GNCSEARCH_TYPE_SELECT:
+        text = _("Select...");
+        text_editable = TRUE;
+        break;
+    case GNCSEARCH_TYPE_EDIT:
+        text = _("Edit...");
+        text_editable = FALSE;
+    };
 
-  switch (owner->type) {
-  case GNC_OWNER_NONE:
-  case GNC_OWNER_UNDEFINED:
-    return NULL;
+    switch (owner->type)
+    {
+    case GNC_OWNER_NONE:
+    case GNC_OWNER_UNDEFINED:
+        return NULL;
 
-  case GNC_OWNER_CUSTOMER:
-    if (type == GNCSEARCH_TYPE_SELECT)
-      search_cb = gnc_customer_search_select;
-    else
-      search_cb = gnc_customer_search_edit;
-    type_name = GNC_CUSTOMER_MODULE_NAME;
-    break;
+    case GNC_OWNER_CUSTOMER:
+        if (type == GNCSEARCH_TYPE_SELECT)
+            search_cb = gnc_customer_search_select;
+        else
+            search_cb = gnc_customer_search_edit;
+        type_name = GNC_CUSTOMER_MODULE_NAME;
+        break;
 
-  case GNC_OWNER_JOB:
-    if (type == GNCSEARCH_TYPE_SELECT)
-      search_cb = gnc_job_search_select;
-    else
-      search_cb = gnc_job_search_edit;
-    type_name = GNC_JOB_MODULE_NAME;
-    break;
+    case GNC_OWNER_JOB:
+        if (type == GNCSEARCH_TYPE_SELECT)
+            search_cb = gnc_job_search_select;
+        else
+            search_cb = gnc_job_search_edit;
+        type_name = GNC_JOB_MODULE_NAME;
+        break;
 
-  case GNC_OWNER_VENDOR:
-    if (type == GNCSEARCH_TYPE_SELECT)
-      search_cb = gnc_vendor_search_select;
-    else
-      search_cb = gnc_vendor_search_edit;
-    type_name = GNC_VENDOR_MODULE_NAME;
-    break;
+    case GNC_OWNER_VENDOR:
+        if (type == GNCSEARCH_TYPE_SELECT)
+            search_cb = gnc_vendor_search_select;
+        else
+            search_cb = gnc_vendor_search_edit;
+        type_name = GNC_VENDOR_MODULE_NAME;
+        break;
 
-  case GNC_OWNER_EMPLOYEE:
-    if (type == GNCSEARCH_TYPE_SELECT)
-      search_cb = gnc_employee_search_select;
-    else
-      search_cb = gnc_employee_search_edit;
-    type_name = GNC_EMPLOYEE_MODULE_NAME;
-    break;
+    case GNC_OWNER_EMPLOYEE:
+        if (type == GNCSEARCH_TYPE_SELECT)
+            search_cb = gnc_employee_search_select;
+        else
+            search_cb = gnc_employee_search_edit;
+        type_name = GNC_EMPLOYEE_MODULE_NAME;
+        break;
 
-  default:
-    g_warning ("Unknown type");
-    return NULL;
-  }
+    default:
+        g_warning ("Unknown type");
+        return NULL;
+    }
 
-  edit = gnc_general_search_new (type_name, text, text_editable, search_cb, book, book);
-  if (!edit)
-    return NULL;
+    edit = gnc_general_search_new (type_name, text, text_editable, search_cb, book, book);
+    if (!edit)
+        return NULL;
 
-  gnc_general_search_set_selected (GNC_GENERAL_SEARCH (edit),
-				   owner->owner.undefined);
-  gtk_box_pack_start (GTK_BOX (hbox), edit, FALSE, FALSE, 0);
-  if (label)
-    gtk_label_set_text (GTK_LABEL (label), _(gncObjectGetTypeLabel (type_name)));
+    gnc_general_search_set_selected (GNC_GENERAL_SEARCH (edit),
+                                     owner->owner.undefined);
+    gtk_box_pack_start (GTK_BOX (hbox), edit, FALSE, FALSE, 0);
+    if (label)
+        gtk_label_set_text (GTK_LABEL (label), _(gncObjectGetTypeLabel (type_name)));
 
-  return edit;
+    return edit;
 }
 
 GtkWidget * gnc_owner_select_create (GtkWidget *label, GtkWidget *hbox,
-				     QofBook *book, GncOwner *owner)
+                                     QofBook *book, GncOwner *owner)
 {
-  g_return_val_if_fail (hbox != NULL, NULL);
-  g_return_val_if_fail (book != NULL, NULL);
-  g_return_val_if_fail (owner != NULL, NULL);
+    g_return_val_if_fail (hbox != NULL, NULL);
+    g_return_val_if_fail (book != NULL, NULL);
+    g_return_val_if_fail (owner != NULL, NULL);
 
-  return gnc_owner_new (label, hbox, book, owner, GNCSEARCH_TYPE_SELECT);
+    return gnc_owner_new (label, hbox, book, owner, GNCSEARCH_TYPE_SELECT);
 }
 
 GtkWidget * gnc_owner_edit_create (GtkWidget *label, GtkWidget *hbox,
-				   QofBook *book, GncOwner *owner)
+                                   QofBook *book, GncOwner *owner)
 {
-  g_return_val_if_fail (hbox != NULL, NULL);
-  g_return_val_if_fail (book != NULL, NULL);
-  g_return_val_if_fail (owner != NULL, NULL);
+    g_return_val_if_fail (hbox != NULL, NULL);
+    g_return_val_if_fail (book != NULL, NULL);
+    g_return_val_if_fail (owner != NULL, NULL);
 
-  return gnc_owner_new (label, hbox, book, owner, GNCSEARCH_TYPE_EDIT);
+    return gnc_owner_new (label, hbox, book, owner, GNCSEARCH_TYPE_EDIT);
 }
 
 void gnc_owner_get_owner (GtkWidget *widget, GncOwner *owner)
 {
-  g_return_if_fail (widget != NULL);
-  g_return_if_fail (owner != NULL);
+    g_return_if_fail (widget != NULL);
+    g_return_if_fail (owner != NULL);
 
-  /* We'll assume that the owner has the proper 'type' because we
-   * can't change it here.  Hopefully the caller has it set properly
-   */
-  owner->owner.undefined =
-    gnc_general_search_get_selected (GNC_GENERAL_SEARCH (widget));
+    /* We'll assume that the owner has the proper 'type' because we
+     * can't change it here.  Hopefully the caller has it set properly
+     */
+    owner->owner.undefined =
+        gnc_general_search_get_selected (GNC_GENERAL_SEARCH (widget));
 }
 
 void gnc_owner_set_owner (GtkWidget *widget, GncOwner *owner)
 {
-  g_return_if_fail (widget != NULL);
-  g_return_if_fail (owner != NULL);
+    g_return_if_fail (widget != NULL);
+    g_return_if_fail (owner != NULL);
 
-  /* We'll assume that the owner has the proper 'type' because we
-   * can't change it here.  Hopefully the caller has it set properly
-   */
+    /* We'll assume that the owner has the proper 'type' because we
+     * can't change it here.  Hopefully the caller has it set properly
+     */
 
-  gnc_general_search_set_selected (GNC_GENERAL_SEARCH (widget),
-				   owner->owner.undefined);
+    gnc_general_search_set_selected (GNC_GENERAL_SEARCH (widget),
+                                     owner->owner.undefined);
 }
 
-typedef struct _invoice_select_info {
-  GtkWidget *label;
-  QofBook *book;
-  GncOwner owner;
-  gboolean have_owner;
+typedef struct _invoice_select_info
+{
+    GtkWidget *label;
+    QofBook *book;
+    GncOwner owner;
+    gboolean have_owner;
 } GncISI;
 
 static GNCSearchWindow *
 gnc_invoice_select_search_cb (gpointer start, gpointer isip)
 {
-  GncISI *isi = isip;
+    GncISI *isi = isip;
 
-  if (!isi) return NULL;
-  g_assert(isi->book);
+    if (!isi) return NULL;
+    g_assert(isi->book);
 
-  return gnc_invoice_search (start,
-			     isi->have_owner ? &isi->owner : NULL,
-			     isi->book);
+    return gnc_invoice_search (start,
+                               isi->have_owner ? &isi->owner : NULL,
+                               isi->book);
 }
 
 static void
 gnc_invoice_select_search_set_label(GncISI* isi)
 {
-  GncOwnerType owner_type;
-  GncOwner *tmp;
-  char *label;
+    GncOwnerType owner_type;
+    GncOwner *tmp;
+    char *label;
 
-  g_assert(isi);
-  if (!isi->label) return;
+    g_assert(isi);
+    if (!isi->label) return;
 
-  tmp = &isi->owner;
-  owner_type = gncOwnerGetType(tmp);
-  while (owner_type == GNC_OWNER_JOB) {
-    tmp = gncOwnerGetEndOwner(tmp);
+    tmp = &isi->owner;
     owner_type = gncOwnerGetType(tmp);
-  }
+    while (owner_type == GNC_OWNER_JOB)
+    {
+        tmp = gncOwnerGetEndOwner(tmp);
+        owner_type = gncOwnerGetType(tmp);
+    }
 
-  /* Translators:  See comments in dialog-invoice.c:gnc_invoice_search() */
-  switch (owner_type) {
-  case GNC_OWNER_VENDOR:
-    label = _("Bill");
-    break;
-  case GNC_OWNER_EMPLOYEE:
-    label = _("Voucher");
-    break;
-  default:
-    label = _("Invoice");
-  }
+    /* Translators:  See comments in dialog-invoice.c:gnc_invoice_search() */
+    switch (owner_type)
+    {
+    case GNC_OWNER_VENDOR:
+        label = _("Bill");
+        break;
+    case GNC_OWNER_EMPLOYEE:
+        label = _("Voucher");
+        break;
+    default:
+        label = _("Invoice");
+    }
 
-  gtk_label_set_text(GTK_LABEL(isi->label), label);
+    gtk_label_set_text(GTK_LABEL(isi->label), label);
 }
 
 GtkWidget * gnc_invoice_select_create (GtkWidget *hbox, QofBook *book,
-				       const GncOwner *owner,
-				       GncInvoice *invoice,
-				       GtkWidget *label)
+                                       const GncOwner *owner,
+                                       GncInvoice *invoice,
+                                       GtkWidget *label)
 {
-  GtkWidget *edit;
-  GncISI *isi;
+    GtkWidget *edit;
+    GncISI *isi;
 
-  g_return_val_if_fail (hbox != NULL, NULL);
-  g_return_val_if_fail (book != NULL, NULL);
-  /* Note: it is legal to have no owner or invoice */
+    g_return_val_if_fail (hbox != NULL, NULL);
+    g_return_val_if_fail (book != NULL, NULL);
+    /* Note: it is legal to have no owner or invoice */
 
-  isi = g_new0(GncISI, 1);
-  if (!isi)
-    return NULL;
+    isi = g_new0(GncISI, 1);
+    if (!isi)
+        return NULL;
 
-  if (owner) {
-    gncOwnerCopy(owner, &isi->owner);
-    isi->have_owner = TRUE;
-  } else {
-    gncOwnerInitCustomer(&isi->owner, NULL);
-  }
-  isi->book = book;
-  isi->label = label;
+    if (owner)
+    {
+        gncOwnerCopy(owner, &isi->owner);
+        isi->have_owner = TRUE;
+    }
+    else
+    {
+        gncOwnerInitCustomer(&isi->owner, NULL);
+    }
+    isi->book = book;
+    isi->label = label;
 
-  edit = gnc_general_search_new (GNC_INVOICE_MODULE_NAME, _("Select..."),
-				 TRUE, gnc_invoice_select_search_cb, isi, isi->book);
-  if (!edit) {
-    g_free(isi);
-    return NULL;
-  }
+    edit = gnc_general_search_new (GNC_INVOICE_MODULE_NAME, _("Select..."),
+                                   TRUE, gnc_invoice_select_search_cb, isi, isi->book);
+    if (!edit)
+    {
+        g_free(isi);
+        return NULL;
+    }
 
-  gnc_general_search_set_selected (GNC_GENERAL_SEARCH (edit), invoice);
-  gtk_box_pack_start (GTK_BOX (hbox), edit, FALSE, FALSE, 0);
-  g_object_set_data_full(G_OBJECT(edit), "isi-state", isi, g_free);
+    gnc_general_search_set_selected (GNC_GENERAL_SEARCH (edit), invoice);
+    gtk_box_pack_start (GTK_BOX (hbox), edit, FALSE, FALSE, 0);
+    g_object_set_data_full(G_OBJECT(edit), "isi-state", isi, g_free);
 
-  /* Set the label */
-  gnc_invoice_select_search_set_label(isi);
+    /* Set the label */
+    gnc_invoice_select_search_set_label(isi);
 
-  return edit;
+    return edit;
 }
 
 GncInvoice * gnc_invoice_get_invoice (GtkWidget *widget)
 {
-  g_return_val_if_fail (widget != NULL, NULL);
+    g_return_val_if_fail (widget != NULL, NULL);
 
-  return gnc_general_search_get_selected (GNC_GENERAL_SEARCH (widget));
+    return gnc_general_search_get_selected (GNC_GENERAL_SEARCH (widget));
 }
 
 void gnc_invoice_set_invoice (GtkWidget *widget, GncInvoice *invoice)
 {
-  g_return_if_fail (widget != NULL);
-  g_return_if_fail (invoice != NULL);
+    g_return_if_fail (widget != NULL);
+    g_return_if_fail (invoice != NULL);
 
-  gnc_general_search_set_selected (GNC_GENERAL_SEARCH (widget), invoice);
+    gnc_general_search_set_selected (GNC_GENERAL_SEARCH (widget), invoice);
 }
 
 void gnc_invoice_set_owner (GtkWidget *widget, GncOwner *owner)
 {
-  GncISI *isi;
+    GncISI *isi;
 
-  g_return_if_fail (widget != NULL);
-  g_return_if_fail (owner != NULL);
+    g_return_if_fail (widget != NULL);
+    g_return_if_fail (owner != NULL);
 
-  isi = g_object_get_data(G_OBJECT(widget), "isi-state");
-  g_assert(isi);
+    isi = g_object_get_data(G_OBJECT(widget), "isi-state");
+    g_assert(isi);
 
-  if (isi->owner.owner.undefined == owner->owner.undefined)
-    return;
+    if (isi->owner.owner.undefined == owner->owner.undefined)
+        return;
 
-  gncOwnerCopy(owner, &isi->owner);
-  isi->have_owner = TRUE;
-  gnc_general_search_set_selected(GNC_GENERAL_SEARCH(widget), NULL);
+    gncOwnerCopy(owner, &isi->owner);
+    isi->have_owner = TRUE;
+    gnc_general_search_set_selected(GNC_GENERAL_SEARCH(widget), NULL);
 
-  /* Reset the label */
-  gnc_invoice_select_search_set_label(isi);
+    /* Reset the label */
+    gnc_invoice_select_search_set_label(isi);
 }
 
 void
 gnc_fill_account_select_combo (GtkWidget *combo, QofBook *book,
-			       GList *acct_types, GList *acct_commodities)
+                               GList *acct_types, GList *acct_commodities)
 {
-  GtkListStore *store;
-  GtkEntry *entry;
-  GList *list, *node;
-  char *text;
+    GtkListStore *store;
+    GtkEntry *entry;
+    GList *list, *node;
+    char *text;
 
-  g_return_if_fail (combo && GTK_IS_COMBO_BOX_ENTRY(combo));
-  g_return_if_fail (book);
-  g_return_if_fail (acct_types);
+    g_return_if_fail (combo && GTK_IS_COMBO_BOX_ENTRY(combo));
+    g_return_if_fail (book);
+    g_return_if_fail (acct_types);
 
-  /* Figure out if anything is set in the combo */
-  text = gtk_combo_box_get_active_text(GTK_COMBO_BOX(combo));
+    /* Figure out if anything is set in the combo */
+    text = gtk_combo_box_get_active_text(GTK_COMBO_BOX(combo));
 
-  list = gnc_account_get_descendants (gnc_book_get_root_account (book));
+    list = gnc_account_get_descendants (gnc_book_get_root_account (book));
 
-  /* Clear the existing list */
-  entry = GTK_ENTRY(gtk_bin_get_child(GTK_BIN(combo)));
-  gtk_entry_set_text(entry, "");
-  store = GTK_LIST_STORE(gtk_combo_box_get_model(GTK_COMBO_BOX(combo)));
-  gtk_list_store_clear(store);
+    /* Clear the existing list */
+    entry = GTK_ENTRY(gtk_bin_get_child(GTK_BIN(combo)));
+    gtk_entry_set_text(entry, "");
+    store = GTK_LIST_STORE(gtk_combo_box_get_model(GTK_COMBO_BOX(combo)));
+    gtk_list_store_clear(store);
 
- /* Add the account names to the combo box */
-  for (node = list; node; node = node->next) {
-    Account *account = node->data;
-    char *name;
+    /* Add the account names to the combo box */
+    for (node = list; node; node = node->next)
+    {
+        Account *account = node->data;
+        char *name;
 
-    /* Only present accounts of the appropriate type */
-    if (g_list_index (acct_types, (gpointer)xaccAccountGetType (account))
-	== -1)
-      continue;
+        /* Only present accounts of the appropriate type */
+        if (g_list_index (acct_types, (gpointer)xaccAccountGetType (account))
+                == -1)
+            continue;
 
-    /* Only present accounts with the right commodity, if that's a
-       restriction */
-    if (acct_commodities)
-    {
-        if ( g_list_find_custom( acct_commodities,
-                                 GINT_TO_POINTER(xaccAccountGetCommodity(account)),
-                                 gnc_commodity_compare_void) == NULL ) {
-            continue;
+        /* Only present accounts with the right commodity, if that's a
+           restriction */
+        if (acct_commodities)
+        {
+            if ( g_list_find_custom( acct_commodities,
+                                     GINT_TO_POINTER(xaccAccountGetCommodity(account)),
+                                     gnc_commodity_compare_void) == NULL )
+            {
+                continue;
+            }
         }
+
+        name = gnc_account_get_full_name (account);
+        gtk_combo_box_append_text(GTK_COMBO_BOX(combo), name);
+        g_free(name);
     }
+    gtk_combo_box_set_active(GTK_COMBO_BOX(combo), 0);
 
-    name = gnc_account_get_full_name (account);
-    gtk_combo_box_append_text(GTK_COMBO_BOX(combo), name);
-    g_free(name);
-  }
-  gtk_combo_box_set_active(GTK_COMBO_BOX(combo), 0);
+    g_list_free (list);
 
-  g_list_free (list);
+    gnc_cbe_set_by_string(GTK_COMBO_BOX_ENTRY(combo), text);
 
-  gnc_cbe_set_by_string(GTK_COMBO_BOX_ENTRY(combo), text);
-
-  if (text)
-    g_free (text);
+    if (text)
+        g_free (text);
 }
 
 GList *
 gnc_business_account_types (GncOwner *owner)
 {
-  g_return_val_if_fail (owner, NULL);
+    g_return_val_if_fail (owner, NULL);
 
-  switch (gncOwnerGetType (owner)) {
-  case GNC_OWNER_CUSTOMER:
-    return (g_list_prepend (NULL, (gpointer)ACCT_TYPE_RECEIVABLE));
-  case GNC_OWNER_VENDOR:
-  case GNC_OWNER_EMPLOYEE:
-    return (g_list_prepend (NULL, (gpointer)ACCT_TYPE_PAYABLE));
-    break;
-  default:
-    return (g_list_prepend (NULL, (gpointer)ACCT_TYPE_NONE));
-  }
+    switch (gncOwnerGetType (owner))
+    {
+    case GNC_OWNER_CUSTOMER:
+        return (g_list_prepend (NULL, (gpointer)ACCT_TYPE_RECEIVABLE));
+    case GNC_OWNER_VENDOR:
+    case GNC_OWNER_EMPLOYEE:
+        return (g_list_prepend (NULL, (gpointer)ACCT_TYPE_PAYABLE));
+        break;
+    default:
+        return (g_list_prepend (NULL, (gpointer)ACCT_TYPE_NONE));
+    }
 }
 
 GList *
 gnc_business_commodities (GncOwner *owner)
 {
-  g_return_val_if_fail (owner, NULL);
-  g_return_val_if_fail (gncOwnerGetCurrency(owner), NULL);
+    g_return_val_if_fail (owner, NULL);
+    g_return_val_if_fail (gncOwnerGetCurrency(owner), NULL);
 
-  return (g_list_prepend (NULL, gncOwnerGetCurrency(owner)));
+    return (g_list_prepend (NULL, gncOwnerGetCurrency(owner)));
 }
 
 /*********************************************************************/
@@ -396,20 +409,21 @@
 
 typedef const char * (*GenericLookup_t)(gpointer);
 
-typedef struct {
-  gint		component_id;
-  GtkWidget *	omenu;
-  QofBook *	book;
-  gboolean	none_ok;
-  const char *	(*get_name)(gpointer);
-  GList *	(*get_list)(QofBook*);
+typedef struct
+{
+    gint		component_id;
+    GtkWidget *	omenu;
+    QofBook *	book;
+    gboolean	none_ok;
+    const char *	(*get_name)(gpointer);
+    GList *	(*get_list)(QofBook*);
 
-  gboolean	building_menu;
-  gpointer	result;
-  gpointer *	result_p;
+    gboolean	building_menu;
+    gpointer	result;
+    gpointer *	result_p;
 
-  void		(*changed_cb)(GtkWidget*, gpointer);
-  gpointer	cb_arg;
+    void		(*changed_cb)(GtkWidget*, gpointer);
+    gpointer	cb_arg;
 } OpMenuData;
 
 #define DO_ADD_ITEM(s,o) { \
@@ -421,188 +435,191 @@
 static void
 business_option_changed (GtkWidget *widget, gpointer data)
 {
-  OpMenuData *omd = data;
+    OpMenuData *omd = data;
 
-  g_return_if_fail (omd);
-  omd->result = g_object_get_data (G_OBJECT (widget), "this_item");
+    g_return_if_fail (omd);
+    omd->result = g_object_get_data (G_OBJECT (widget), "this_item");
 
-  if (!omd->building_menu) {
-    if (omd->result_p)
-      *(omd->result_p) = omd->result;
+    if (!omd->building_menu)
+    {
+        if (omd->result_p)
+            *(omd->result_p) = omd->result;
 
-    if (omd->changed_cb)
-      (omd->changed_cb)(omd->omenu, omd->cb_arg);
-  }
+        if (omd->changed_cb)
+            (omd->changed_cb)(omd->omenu, omd->cb_arg);
+    }
 }
 
 static void
 add_menu_item (GtkWidget *menu, const char *label, OpMenuData *omd,
-	       gpointer this_item)
+               gpointer this_item)
 {
-  GtkWidget *item = gtk_menu_item_new_with_label (label);
-  g_object_set_data (G_OBJECT (item), "this_item", this_item);
-  g_signal_connect (G_OBJECT (item), "activate",
-		    G_CALLBACK (business_option_changed), omd);
-  gtk_menu_shell_append (GTK_MENU_SHELL (menu), item);
-  gtk_widget_show (item);
+    GtkWidget *item = gtk_menu_item_new_with_label (label);
+    g_object_set_data (G_OBJECT (item), "this_item", this_item);
+    g_signal_connect (G_OBJECT (item), "activate",
+                      G_CALLBACK (business_option_changed), omd);
+    gtk_menu_shell_append (GTK_MENU_SHELL (menu), item);
+    gtk_widget_show (item);
 }
 
 static void
 generic_omenu_destroy_cb (GtkWidget *widget, gpointer data)
 {
-  OpMenuData *omd = data;
+    OpMenuData *omd = data;
 
-  gnc_unregister_gui_component (omd->component_id);
-  g_free (omd);
+    gnc_unregister_gui_component (omd->component_id);
+    g_free (omd);
 }
 
 static void
 build_generic_optionmenu (OpMenuData *omd)
 {
-  GList *items;
-  GtkWidget *menu;
-  int current = 0, index = 0;
+    GList *items;
+    GtkWidget *menu;
+    int current = 0, index = 0;
 
-  /* Make sure we can "get_list" */
-  if (omd->get_list == NULL)
-    return;
+    /* Make sure we can "get_list" */
+    if (omd->get_list == NULL)
+        return;
 
-  /* Get the list of items */
-  items = (omd->get_list)(omd->book);
+    /* Get the list of items */
+    items = (omd->get_list)(omd->book);
 
-  /* Make a menu */
-  menu = gtk_menu_new ();
+    /* Make a menu */
+    menu = gtk_menu_new ();
 
-  omd->building_menu = TRUE;
+    omd->building_menu = TRUE;
 
-  if (omd->none_ok || items == NULL)
-    DO_ADD_ITEM (_("None"), NULL);
+    if (omd->none_ok || items == NULL)
+        DO_ADD_ITEM (_("None"), NULL);
 
-  for ( ; items; items = items->next)
-    DO_ADD_ITEM ((omd->get_name)(items->data), items->data);
+    for ( ; items; items = items->next)
+        DO_ADD_ITEM ((omd->get_name)(items->data), items->data);
 
-  gtk_option_menu_set_menu (GTK_OPTION_MENU (omd->omenu), menu);
-  gtk_option_menu_set_history (GTK_OPTION_MENU (omd->omenu), current);
-  gtk_widget_show (menu);
+    gtk_option_menu_set_menu (GTK_OPTION_MENU (omd->omenu), menu);
+    gtk_option_menu_set_history (GTK_OPTION_MENU (omd->omenu), current);
+    gtk_widget_show (menu);
 
-  omd->building_menu = FALSE;
+    omd->building_menu = FALSE;
 }
 
 static void
 generic_omenu_refresh_handler (GHashTable *changes, gpointer user_data)
 {
-  OpMenuData *omd = user_data;
-  build_generic_optionmenu (omd);
+    OpMenuData *omd = user_data;
+    build_generic_optionmenu (omd);
 }
 
 static OpMenuData *
 make_generic_optionmenu (GtkWidget *omenu, QofBook *book,
-			 gboolean none_ok, GNCIdType type_name,
-			 GList * (*get_list)(QofBook*),
-			 GenericLookup_t get_name,
-			 gpointer *result)
+                         gboolean none_ok, GNCIdType type_name,
+                         GList * (*get_list)(QofBook*),
+                         GenericLookup_t get_name,
+                         gpointer *result)
 {
-  OpMenuData *omd;
+    OpMenuData *omd;
 
-  omd = g_object_get_data (G_OBJECT (omenu), "menu-data");
+    omd = g_object_get_data (G_OBJECT (omenu), "menu-data");
 
-  /* If this is the first time we've been called, then build the
-   * Option Menu Data object, register with the component manager, and
-   * watch for changed items.  Then register for deletion, so we can
-   * unregister and free the data when this menu is destroyed.
-   */
-  if (!omd) {
-    omd = g_new0 (OpMenuData, 1);
-    omd->omenu = omenu;
-    omd->book = book;
-    omd->result_p = result;
-    omd->none_ok = none_ok;
-    omd->get_name = get_name;
-    omd->get_list = get_list;
-    g_object_set_data (G_OBJECT (omenu), "menu-data", omd);
+    /* If this is the first time we've been called, then build the
+     * Option Menu Data object, register with the component manager, and
+     * watch for changed items.  Then register for deletion, so we can
+     * unregister and free the data when this menu is destroyed.
+     */
+    if (!omd)
+    {
+        omd = g_new0 (OpMenuData, 1);
+        omd->omenu = omenu;
+        omd->book = book;
+        omd->result_p = result;
+        omd->none_ok = none_ok;
+        omd->get_name = get_name;
+        omd->get_list = get_list;
+        g_object_set_data (G_OBJECT (omenu), "menu-data", omd);
 
-    if (result)
-      omd->result = *result;
+        if (result)
+            omd->result = *result;
 
-    omd->component_id =
-      gnc_register_gui_component ("generic-omenu-refresh-hook",
-				  generic_omenu_refresh_handler,
-				  NULL, omd);
+        omd->component_id =
+            gnc_register_gui_component ("generic-omenu-refresh-hook",
+                                        generic_omenu_refresh_handler,
+                                        NULL, omd);
 
 
-    if (type_name)
-      gnc_gui_component_watch_entity_type (omd->component_id,
-					   type_name,
-					   QOF_EVENT_MODIFY | QOF_EVENT_DESTROY);
+        if (type_name)
+            gnc_gui_component_watch_entity_type (omd->component_id,
+                                                 type_name,
+                                                 QOF_EVENT_MODIFY | QOF_EVENT_DESTROY);
 
-    g_signal_connect (G_OBJECT (omenu), "destroy",
-		      G_CALLBACK (generic_omenu_destroy_cb), omd);
+        g_signal_connect (G_OBJECT (omenu), "destroy",
+                          G_CALLBACK (generic_omenu_destroy_cb), omd);
 
-  }
+    }
 
-  build_generic_optionmenu (omd);
+    build_generic_optionmenu (omd);
 
-  return omd;
+    return omd;
 }
 
 void
 gnc_ui_optionmenu_set_changed_callback (GtkWidget *omenu,
-					void (*changed_cb)(GtkWidget*,gpointer),
-					gpointer cb_arg)
+                                        void (*changed_cb)(GtkWidget*, gpointer),
+                                        gpointer cb_arg)
 {
-  OpMenuData *omd;
+    OpMenuData *omd;
 
-  if (!omenu) return;
+    if (!omenu) return;
 
-  omd = g_object_get_data (G_OBJECT (omenu), "menu-data");
-  g_return_if_fail (omd);
+    omd = g_object_get_data (G_OBJECT (omenu), "menu-data");
+    g_return_if_fail (omd);
 
-  omd->changed_cb = changed_cb;
-  omd->cb_arg = cb_arg;
+    omd->changed_cb = changed_cb;
+    omd->cb_arg = cb_arg;
 }
 
 gpointer
 gnc_ui_optionmenu_get_value (GtkWidget *omenu)
 {
-  OpMenuData *omd;
+    OpMenuData *omd;
 
-  if (!omenu) return NULL;
+    if (!omenu) return NULL;
 
-  omd = g_object_get_data (G_OBJECT (omenu), "menu-data");
-  g_return_val_if_fail (omd, NULL);
+    omd = g_object_get_data (G_OBJECT (omenu), "menu-data");
+    g_return_val_if_fail (omd, NULL);
 
-  return omd->result;
+    return omd->result;
 }
 
 void
 gnc_ui_optionmenu_set_value (GtkWidget *omenu, gpointer data)
 {
-  OpMenuData *omd;
-  GtkWidget *menu;
-  GList *node;
-  gint counter;
+    OpMenuData *omd;
+    GtkWidget *menu;
+    GList *node;
+    gint counter;
 
-  if (!omenu) return;
+    if (!omenu) return;
 
-  omd = g_object_get_data (G_OBJECT (omenu), "menu-data");
-  g_return_if_fail (omd);
+    omd = g_object_get_data (G_OBJECT (omenu), "menu-data");
+    g_return_if_fail (omd);
 
-  menu = gtk_option_menu_get_menu (GTK_OPTION_MENU (omenu));
-  g_return_if_fail (menu);
+    menu = gtk_option_menu_get_menu (GTK_OPTION_MENU (omenu));
+    g_return_if_fail (menu);
 
-  /* now walk all the children until we find our object */
-  for (counter = 0, node = ((GTK_MENU_SHELL (menu))->children);
-       node;
-       node = node->next, counter++)
-  {
-    GObject *menuitem = node->data;
-    gpointer this_object = g_object_get_data (menuitem, "this_item");
+    /* now walk all the children until we find our object */
+    for (counter = 0, node = ((GTK_MENU_SHELL (menu))->children);
+            node;
+            node = node->next, counter++)
+    {
+        GObject *menuitem = node->data;
+        gpointer this_object = g_object_get_data (menuitem, "this_item");
 
-    if (this_object == data) {
-      gtk_option_menu_set_history (GTK_OPTION_MENU (omd->omenu), counter);
-      return;
+        if (this_object == data)
+        {
+            gtk_option_menu_set_history (GTK_OPTION_MENU (omd->omenu), counter);
+            return;
+        }
     }
-  }
 }
 
 /* Create an optionmenu of available billing terms and attach it to
@@ -614,60 +631,60 @@
  */
 void
 gnc_ui_billterms_optionmenu (GtkWidget *omenu, QofBook *book,
-			     gboolean none_ok, GncBillTerm **choice)
+                             gboolean none_ok, GncBillTerm **choice)
 {
-  if (!omenu || !book) return;
+    if (!omenu || !book) return;
 
-  make_generic_optionmenu (omenu, book, none_ok, GNC_BILLTERM_MODULE_NAME,
-			   gncBillTermGetTerms,
-			   (GenericLookup_t)gncBillTermGetName,
-			   (gpointer *)choice);
+    make_generic_optionmenu (omenu, book, none_ok, GNC_BILLTERM_MODULE_NAME,
+                             gncBillTermGetTerms,
+                             (GenericLookup_t)gncBillTermGetName,
+                             (gpointer *)choice);
 }
 
 void
 gnc_ui_taxtables_optionmenu (GtkWidget *omenu, QofBook *book,
-			     gboolean none_ok, GncTaxTable **choice)
+                             gboolean none_ok, GncTaxTable **choice)
 {
-  if (!omenu || !book) return;
+    if (!omenu || !book) return;
 
-  make_generic_optionmenu (omenu, book, none_ok, GNC_TAXTABLE_MODULE_NAME,
-			   gncTaxTableGetTables,
-			   (GenericLookup_t)gncTaxTableGetName,
-			   (gpointer *)choice);
+    make_generic_optionmenu (omenu, book, none_ok, GNC_TAXTABLE_MODULE_NAME,
+                             gncTaxTableGetTables,
+                             (GenericLookup_t)gncTaxTableGetName,
+                             (gpointer *)choice);
 }
 
 void
 gnc_ui_taxincluded_optionmenu (GtkWidget *omenu, GncTaxIncluded *choice)
 {
-  GtkWidget *menu;
-  OpMenuData *omd;
-  int current = 0, index = 0;
+    GtkWidget *menu;
+    OpMenuData *omd;
+    int current = 0, index = 0;
 
-  if (!omenu) return;
+    if (!omenu) return;
 
-  omd = make_generic_optionmenu (omenu, NULL, FALSE, NULL, NULL, NULL,
-				 (gpointer *)choice);
+    omd = make_generic_optionmenu (omenu, NULL, FALSE, NULL, NULL, NULL,
+                                   (gpointer *)choice);
 
-  g_return_if_fail (omd);
+    g_return_if_fail (omd);
 
-  menu = gtk_menu_new ();
+    menu = gtk_menu_new ();
 
-  add_menu_item (menu, _("Yes"), omd,
-		 GINT_TO_POINTER (GNC_TAXINCLUDED_YES));
-  if (*choice == GNC_TAXINCLUDED_YES) current = index;
-  index++;
+    add_menu_item (menu, _("Yes"), omd,
+                   GINT_TO_POINTER (GNC_TAXINCLUDED_YES));
+    if (*choice == GNC_TAXINCLUDED_YES) current = index;
+    index++;
 
-  add_menu_item (menu, _("No"), omd,
-		 GINT_TO_POINTER (GNC_TAXINCLUDED_NO));
-  if (*choice == GNC_TAXINCLUDED_NO) current = index;
-  index++;
+    add_menu_item (menu, _("No"), omd,
+                   GINT_TO_POINTER (GNC_TAXINCLUDED_NO));
+    if (*choice == GNC_TAXINCLUDED_NO) current = index;
+    index++;
 
-  add_menu_item (menu, _("Use Global"), omd,
-		 GINT_TO_POINTER (GNC_TAXINCLUDED_USEGLOBAL));
-  if (*choice == GNC_TAXINCLUDED_USEGLOBAL) current = index;
-  index++;
+    add_menu_item (menu, _("Use Global"), omd,
+                   GINT_TO_POINTER (GNC_TAXINCLUDED_USEGLOBAL));
+    if (*choice == GNC_TAXINCLUDED_USEGLOBAL) current = index;
+    index++;
 
-  gtk_option_menu_set_menu (GTK_OPTION_MENU (omenu), menu);
-  gtk_option_menu_set_history (GTK_OPTION_MENU (omenu), current);
-  gtk_widget_show (menu);
+    gtk_option_menu_set_menu (GTK_OPTION_MENU (omenu), menu);
+    gtk_option_menu_set_history (GTK_OPTION_MENU (omenu), current);
+    gtk_widget_show (menu);
 }

Modified: gnucash/trunk/src/business/business-gnome/business-gnome-utils.h
===================================================================
--- gnucash/trunk/src/business/business-gnome/business-gnome-utils.h	2010-03-02 21:40:28 UTC (rev 18788)
+++ gnucash/trunk/src/business/business-gnome/business-gnome-utils.h	2010-03-02 21:41:05 UTC (rev 18789)
@@ -38,22 +38,22 @@
 #define GCONF_SECTION_EMPLOYEE "dialogs/business/employee"
 
 GtkWidget * gnc_owner_select_create (GtkWidget *label, GtkWidget *hbox,
-				     QofBook *book, GncOwner *owner);
+                                     QofBook *book, GncOwner *owner);
 
 GtkWidget * gnc_owner_edit_create (GtkWidget *label, GtkWidget *hbox,
-				   QofBook *book, GncOwner *owner);
+                                   QofBook *book, GncOwner *owner);
 
 void gnc_owner_get_owner (GtkWidget *widget, GncOwner *owner);
 void gnc_owner_set_owner (GtkWidget *widget, GncOwner *owner);
 
 
-/* An invoice select widget.. 
+/* An invoice select widget..
  * the owner, invoice, and label parameters are optional
  */
 GtkWidget * gnc_invoice_select_create (GtkWidget *hbox, QofBook *book,
-				       const GncOwner *owner,
-				       GncInvoice *invoice,
-				       GtkWidget *label);
+                                       const GncOwner *owner,
+                                       GncInvoice *invoice,
+                                       GtkWidget *label);
 
 GncInvoice * gnc_invoice_get_invoice (GtkWidget *widget);
 void gnc_invoice_set_invoice (GtkWidget *widget, GncInvoice *invoice);
@@ -67,8 +67,8 @@
 
 /* Fill in a combo box with the appropriate list of accounts */
 void gnc_fill_account_select_combo (GtkWidget *combo, QofBook *book,
-				    GList *acct_types, 
-				    GList *acct_commodities);
+                                    GList *acct_types,
+                                    GList *acct_commodities);
 
 
 /* Create an optionmenu of available billing terms and attach it to
@@ -79,12 +79,12 @@
  * created.
  */
 void gnc_ui_billterms_optionmenu (GtkWidget *omenu, QofBook *book,
-				  gboolean none_ok, GncBillTerm **choice);
+                                  gboolean none_ok, GncBillTerm **choice);
 
 /* Same thing except for the tax tables */
 void
 gnc_ui_taxtables_optionmenu (GtkWidget *omenu, QofBook *book,
-			     gboolean none_ok, GncTaxTable **choice);
+                             gboolean none_ok, GncTaxTable **choice);
 
 /* Build an option menu for choosing a GncTaxIncluded */
 void gnc_ui_taxincluded_optionmenu (GtkWidget *omenu, GncTaxIncluded *choice);
@@ -97,8 +97,8 @@
  */
 
 void gnc_ui_optionmenu_set_changed_callback (GtkWidget *omenu,
-					     void (*changed_cb)(GtkWidget*,gpointer),
-					     gpointer cb_arg);
+        void (*changed_cb)(GtkWidget*, gpointer),
+        gpointer cb_arg);
 gpointer gnc_ui_optionmenu_get_value (GtkWidget *omenu);
 void gnc_ui_optionmenu_set_value (GtkWidget *omenu, gpointer data);
 

Modified: gnucash/trunk/src/business/business-gnome/business-options-gnome.c
===================================================================
--- gnucash/trunk/src/business/business-gnome/business-options-gnome.c	2010-03-02 21:40:28 UTC (rev 18788)
+++ gnucash/trunk/src/business/business-gnome/business-options-gnome.c	2010-03-02 21:41:05 UTC (rev 18789)
@@ -44,48 +44,49 @@
 static GtkWidget *
 create_owner_widget (GNCOption *option, GncOwnerType type, GtkWidget *hbox)
 {
-  GtkWidget *widget;
-  GncOwner owner;
+    GtkWidget *widget;
+    GncOwner owner;
 
-  switch (type) {
-  case GNC_OWNER_CUSTOMER:
-    gncOwnerInitCustomer (&owner, NULL);
-    break;
-  case GNC_OWNER_VENDOR:
-    gncOwnerInitVendor (&owner, NULL);
-    break;
-  case GNC_OWNER_EMPLOYEE:
-    gncOwnerInitEmployee (&owner, NULL);
-    break;
-  case GNC_OWNER_JOB:
-    gncOwnerInitJob (&owner, NULL);
-    break;
-  default:
-    return NULL;
-  }
+    switch (type)
+    {
+    case GNC_OWNER_CUSTOMER:
+        gncOwnerInitCustomer (&owner, NULL);
+        break;
+    case GNC_OWNER_VENDOR:
+        gncOwnerInitVendor (&owner, NULL);
+        break;
+    case GNC_OWNER_EMPLOYEE:
+        gncOwnerInitEmployee (&owner, NULL);
+        break;
+    case GNC_OWNER_JOB:
+        gncOwnerInitJob (&owner, NULL);
+        break;
+    default:
+        return NULL;
+    }
 
-  widget = gnc_owner_select_create (NULL, hbox,
-				    gnc_get_current_book (), &owner);
-  gnc_option_set_widget (option, widget);
+    widget = gnc_owner_select_create (NULL, hbox,
+                                      gnc_get_current_book (), &owner);
+    gnc_option_set_widget (option, widget);
 
-  g_signal_connect (G_OBJECT (widget), "changed", 
-		    G_CALLBACK (gnc_option_changed_option_cb), option);
+    g_signal_connect (G_OBJECT (widget), "changed",
+                      G_CALLBACK (gnc_option_changed_option_cb), option);
 
-  return widget;
+    return widget;
 }
 
 static GtkWidget *
 make_name_label (char *name)
 {
-  GtkWidget *label;
-  gchar *colon_name;
+    GtkWidget *label;
+    gchar *colon_name;
 
-  colon_name = g_strconcat (name, ":", (char *)NULL);
-  label = gtk_label_new (colon_name);
-  gtk_misc_set_alignment (GTK_MISC (label), 1.0, 0.5);
-  g_free (colon_name);
+    colon_name = g_strconcat (name, ":", (char *)NULL);
+    label = gtk_label_new (colon_name);
+    gtk_misc_set_alignment (GTK_MISC (label), 1.0, 0.5);
+    g_free (colon_name);
 
-  return label;
+    return label;
 }
 
 /********************************************************************/
@@ -95,75 +96,76 @@
 static GncOwnerType
 get_owner_type_from_option (GNCOption *option)
 {
-  SCM odata = gnc_option_get_option_data (option);
+    SCM odata = gnc_option_get_option_data (option);
 
-  /* The option data is enum-typed.  It's just the enum value. */
-  return (GncOwnerType) scm_num2int(odata, SCM_ARG1, G_STRFUNC);
+    /* The option data is enum-typed.  It's just the enum value. */
+    return (GncOwnerType) scm_num2int(odata, SCM_ARG1, G_STRFUNC);
 }
 
 
 /* Function to set the UI widget based upon the option */
 static GtkWidget *
 owner_set_widget (GNCOption *option, GtkBox *page_box,
-		  GtkTooltips *tooltips,
-		  char *name, char *documentation,
-		  /* Return values */
-		  GtkWidget **enclosing, gboolean *packed)
+                  GtkTooltips *tooltips,
+                  char *name, char *documentation,
+                  /* Return values */
+                  GtkWidget **enclosing, gboolean *packed)
 {
-  GtkWidget *value;
-  GtkWidget *label;
+    GtkWidget *value;
+    GtkWidget *label;
 
-  *enclosing = gtk_hbox_new (FALSE, 5);
-  label = make_name_label (name);
-  gtk_box_pack_start (GTK_BOX (*enclosing), label, FALSE, FALSE, 0);
+    *enclosing = gtk_hbox_new (FALSE, 5);
+    label = make_name_label (name);
+    gtk_box_pack_start (GTK_BOX (*enclosing), label, FALSE, FALSE, 0);
 
-  value = create_owner_widget (option, get_owner_type_from_option (option),
-			       *enclosing);
+    value = create_owner_widget (option, get_owner_type_from_option (option),
+                                 *enclosing);
 
-  gnc_option_set_ui_value (option, FALSE);
+    gnc_option_set_ui_value (option, FALSE);
 
-  gtk_widget_show_all (*enclosing);
-  return value;
+    gtk_widget_show_all (*enclosing);
+    return value;
 }
 
 /* Function to set the UI Value for a particular option */
 static gboolean
 owner_set_value (GNCOption *option, gboolean use_default,
-		 GtkWidget *widget, SCM value)
+                 GtkWidget *widget, SCM value)
 {
-  GncOwner owner_def;
-  GncOwner *owner;
+    GncOwner owner_def;
+    GncOwner *owner;
 
-  if (!SWIG_IsPointer (value))
-    scm_misc_error("business_options:owner_set_value",
-		   "SCM is not a wrapped pointer.", value);
+    if (!SWIG_IsPointer (value))
+        scm_misc_error("business_options:owner_set_value",
+                       "SCM is not a wrapped pointer.", value);
 
-  owner = SWIG_MustGetPtr(value, SWIG_TypeQuery("_p__gncOwner"), 1, 0);
+    owner = SWIG_MustGetPtr(value, SWIG_TypeQuery("_p__gncOwner"), 1, 0);
 
-  /* XXX: should we verify that the owner type is correct? */
-  if (!owner) {
-    owner_def.type = get_owner_type_from_option (option);
-    owner_def.owner.undefined = NULL;
-    owner = &owner_def;
-  }
+    /* XXX: should we verify that the owner type is correct? */
+    if (!owner)
+    {
+        owner_def.type = get_owner_type_from_option (option);
+        owner_def.owner.undefined = NULL;
+        owner = &owner_def;
+    }
 
-  widget = gnc_option_get_widget (option);
-  gnc_owner_set_owner (widget, owner);
-  return FALSE;
+    widget = gnc_option_get_widget (option);
+    gnc_owner_set_owner (widget, owner);
+    return FALSE;
 }
 
 /* Function to get the UI Value for a particular option */
 static SCM
 owner_get_value (GNCOption *option, GtkWidget *widget)
 {
-  static GncOwner owner;	/* XXX: might cause trouble? */
-  GncOwnerType type;
+    static GncOwner owner;	/* XXX: might cause trouble? */
+    GncOwnerType type;
 
-  type = get_owner_type_from_option (option);
-  owner.type = type;
-  gnc_owner_get_owner (widget, &owner);
+    type = get_owner_type_from_option (option);
+    owner.type = type;
+    gnc_owner_get_owner (widget, &owner);
 
-  return SWIG_NewPointerObj(&owner, SWIG_TypeQuery("_p__gncOwner"), 0);
+    return SWIG_NewPointerObj(&owner, SWIG_TypeQuery("_p__gncOwner"), 0);
 }
 
 
@@ -174,55 +176,55 @@
 /* Function to set the UI widget based upon the option */
 static GtkWidget *
 customer_set_widget (GNCOption *option, GtkBox *page_box,
-		     GtkTooltips *tooltips,
-		     char *name, char *documentation,
-		     /* Return values */
-		     GtkWidget **enclosing, gboolean *packed)
+                     GtkTooltips *tooltips,
+                     char *name, char *documentation,
+                     /* Return values */
+                     GtkWidget **enclosing, gboolean *packed)
 {
-  GtkWidget *value;
-  GtkWidget *label;
+    GtkWidget *value;
+    GtkWidget *label;
 
-  *enclosing = gtk_hbox_new (FALSE, 5);
-  label = make_name_label (name);
-  gtk_box_pack_start (GTK_BOX (*enclosing), label, FALSE, FALSE, 0);
+    *enclosing = gtk_hbox_new (FALSE, 5);
+    label = make_name_label (name);
+    gtk_box_pack_start (GTK_BOX (*enclosing), label, FALSE, FALSE, 0);
 
-  value = create_owner_widget (option, GNC_OWNER_CUSTOMER, *enclosing);
+    value = create_owner_widget (option, GNC_OWNER_CUSTOMER, *enclosing);
 
-  gnc_option_set_ui_value (option, FALSE);
+    gnc_option_set_ui_value (option, FALSE);
 
-  gtk_widget_show_all (*enclosing);
-  return value;
+    gtk_widget_show_all (*enclosing);
+    return value;
 }
 
 /* Function to set the UI Value for a particular option */
 static gboolean
 customer_set_value (GNCOption *option, gboolean use_default,
-		    GtkWidget *widget, SCM value)
+                    GtkWidget *widget, SCM value)
 {
-  GncOwner owner;
-  GncCustomer *customer;
+    GncOwner owner;
+    GncCustomer *customer;
 
-  if (!SWIG_IsPointer (value))
-    scm_misc_error("business_options:customer_set_value",
-		   "SCM is not a wrapped pointer.", value);
+    if (!SWIG_IsPointer (value))
+        scm_misc_error("business_options:customer_set_value",
+                       "SCM is not a wrapped pointer.", value);
 
-  customer = SWIG_MustGetPtr(value, SWIG_TypeQuery("_p__gncCustomer"), 1, 0);
-  gncOwnerInitCustomer (&owner, customer);
+    customer = SWIG_MustGetPtr(value, SWIG_TypeQuery("_p__gncCustomer"), 1, 0);
+    gncOwnerInitCustomer (&owner, customer);
 
-  widget = gnc_option_get_widget (option);
-  gnc_owner_set_owner (widget, &owner);
-  return FALSE;
+    widget = gnc_option_get_widget (option);
+    gnc_owner_set_owner (widget, &owner);
+    return FALSE;
 }
 
 /* Function to get the UI Value for a particular option */
 static SCM
 customer_get_value (GNCOption *option, GtkWidget *widget)
 {
-  GncOwner owner;
+    GncOwner owner;
 
-  gnc_owner_get_owner (widget, &owner);
-  return SWIG_NewPointerObj(owner.owner.undefined,
-                            SWIG_TypeQuery("_p__gncCustomer"), 0);
+    gnc_owner_get_owner (widget, &owner);
+    return SWIG_NewPointerObj(owner.owner.undefined,
+                              SWIG_TypeQuery("_p__gncCustomer"), 0);
 }
 
 
@@ -233,55 +235,55 @@
 /* Function to set the UI widget based upon the option */
 static GtkWidget *
 vendor_set_widget (GNCOption *option, GtkBox *page_box,
-		     GtkTooltips *tooltips,
-		     char *name, char *documentation,
-		     /* Return values */
-		     GtkWidget **enclosing, gboolean *packed)
+                   GtkTooltips *tooltips,
+                   char *name, char *documentation,
+                   /* Return values */
+                   GtkWidget **enclosing, gboolean *packed)
 {
-  GtkWidget *value;
-  GtkWidget *label;
+    GtkWidget *value;
+    GtkWidget *label;
 
-  *enclosing = gtk_hbox_new (FALSE, 5);
-  label = make_name_label (name);
-  gtk_box_pack_start (GTK_BOX (*enclosing), label, FALSE, FALSE, 0);
+    *enclosing = gtk_hbox_new (FALSE, 5);
+    label = make_name_label (name);
+    gtk_box_pack_start (GTK_BOX (*enclosing), label, FALSE, FALSE, 0);
 
-  value = create_owner_widget (option, GNC_OWNER_VENDOR, *enclosing);
+    value = create_owner_widget (option, GNC_OWNER_VENDOR, *enclosing);
 
-  gnc_option_set_ui_value (option, FALSE);
+    gnc_option_set_ui_value (option, FALSE);
 
-  gtk_widget_show_all (*enclosing);
-  return value;
+    gtk_widget_show_all (*enclosing);
+    return value;
 }
 
 /* Function to set the UI Value for a particular option */
 static gboolean
 vendor_set_value (GNCOption *option, gboolean use_default,
-		    GtkWidget *widget, SCM value)
+                  GtkWidget *widget, SCM value)
 {
-  GncOwner owner;
-  GncVendor *vendor;
+    GncOwner owner;
+    GncVendor *vendor;
 
-  if (!SWIG_IsPointer (value))
-    scm_misc_error("business_options:vendor_set_value",
-		   "SCM is not a wrapped pointer.", value);
+    if (!SWIG_IsPointer (value))
+        scm_misc_error("business_options:vendor_set_value",
+                       "SCM is not a wrapped pointer.", value);
 
-  vendor = SWIG_MustGetPtr(value, SWIG_TypeQuery("_p__gncVendor"), 1, 0);
-  gncOwnerInitVendor (&owner, vendor);
+    vendor = SWIG_MustGetPtr(value, SWIG_TypeQuery("_p__gncVendor"), 1, 0);
+    gncOwnerInitVendor (&owner, vendor);
 
-  widget = gnc_option_get_widget (option);
-  gnc_owner_set_owner (widget, &owner);
-  return FALSE;
+    widget = gnc_option_get_widget (option);
+    gnc_owner_set_owner (widget, &owner);
+    return FALSE;
 }
 
 /* Function to get the UI Value for a particular option */
 static SCM
 vendor_get_value (GNCOption *option, GtkWidget *widget)
 {
-  GncOwner owner;
+    GncOwner owner;
 
-  gnc_owner_get_owner (widget, &owner);
-  return SWIG_NewPointerObj(owner.owner.undefined,
-                            SWIG_TypeQuery("_p__gncVendor"), 0);
+    gnc_owner_get_owner (widget, &owner);
+    return SWIG_NewPointerObj(owner.owner.undefined,
+                              SWIG_TypeQuery("_p__gncVendor"), 0);
 }
 
 /********************************************************************/
@@ -291,56 +293,56 @@
 /* Function to set the UI widget based upon the option */
 static GtkWidget *
 employee_set_widget (GNCOption *option, GtkBox *page_box,
-		     GtkTooltips *tooltips,
-		     char *name, char *documentation,
-		     /* Return values */
-		     GtkWidget **enclosing, gboolean *packed)
+                     GtkTooltips *tooltips,
+                     char *name, char *documentation,
+                     /* Return values */
+                     GtkWidget **enclosing, gboolean *packed)
 {
-  GtkWidget *value;
-  GtkWidget *label;
+    GtkWidget *value;
+    GtkWidget *label;
 
-  *enclosing = gtk_hbox_new (FALSE, 5);
-  label = make_name_label (name);
-  gtk_box_pack_start (GTK_BOX (*enclosing), label, FALSE, FALSE, 0);
+    *enclosing = gtk_hbox_new (FALSE, 5);
+    label = make_name_label (name);
+    gtk_box_pack_start (GTK_BOX (*enclosing), label, FALSE, FALSE, 0);
 
-  value = create_owner_widget (option, GNC_OWNER_EMPLOYEE, *enclosing);
+    value = create_owner_widget (option, GNC_OWNER_EMPLOYEE, *enclosing);
 
-  gnc_option_set_ui_value (option, FALSE);
+    gnc_option_set_ui_value (option, FALSE);
 
-  gtk_widget_show_all (*enclosing);
-  return value;
+    gtk_widget_show_all (*enclosing);
+    return value;
 }
 
 /* Function to set the UI Value for a particular option */
 static gboolean
 employee_set_value (GNCOption *option, gboolean use_default,
-		    GtkWidget *widget, SCM value)
+                    GtkWidget *widget, SCM value)
 {
-  GncOwner owner;
-  GncEmployee *employee;
+    GncOwner owner;
+    GncEmployee *employee;
 
-  if (!SWIG_IsPointer (value))
-    scm_misc_error("business_options:employee_set_value",
-		   "SCM is not a wrapped pointer.", value);
+    if (!SWIG_IsPointer (value))
+        scm_misc_error("business_options:employee_set_value",
+                       "SCM is not a wrapped pointer.", value);
 
-  employee = SWIG_MustGetPtr(value, SWIG_TypeQuery("_p__gncEmployee"), 1, 0);
-  gncOwnerInitEmployee (&owner, employee);
+    employee = SWIG_MustGetPtr(value, SWIG_TypeQuery("_p__gncEmployee"), 1, 0);
+    gncOwnerInitEmployee (&owner, employee);
 
-  widget = gnc_option_get_widget (option);
-  gnc_owner_set_owner (widget, &owner);
-  return FALSE;
+    widget = gnc_option_get_widget (option);
+    gnc_owner_set_owner (widget, &owner);
+    return FALSE;
 }
 
 /* Function to get the UI Value for a particular option */
 static SCM
 employee_get_value (GNCOption *option, GtkWidget *widget)
 {
-  GncOwner owner;
+    GncOwner owner;
 
-  gnc_owner_get_owner (widget, &owner);
+    gnc_owner_get_owner (widget, &owner);
 
-  return SWIG_NewPointerObj(owner.owner.undefined,
-                            SWIG_TypeQuery("_p__gncEmployee"), 0);
+    return SWIG_NewPointerObj(owner.owner.undefined,
+                              SWIG_TypeQuery("_p__gncEmployee"), 0);
 }
 
 /********************************************************************/
@@ -350,68 +352,68 @@
 static GtkWidget *
 create_invoice_widget (GNCOption *option, GtkWidget *hbox)
 {
-  GtkWidget *widget;
+    GtkWidget *widget;
 
-  /* No owner or starting invoice here, but that's okay. */
-  widget = gnc_invoice_select_create (hbox, gnc_get_current_book(),
-				      NULL, NULL, NULL);
+    /* No owner or starting invoice here, but that's okay. */
+    widget = gnc_invoice_select_create (hbox, gnc_get_current_book(),
+                                        NULL, NULL, NULL);
 
-  gnc_option_set_widget (option, widget);
-  g_signal_connect (G_OBJECT (widget), "changed", 
-		    G_CALLBACK (gnc_option_changed_option_cb), option);
+    gnc_option_set_widget (option, widget);
+    g_signal_connect (G_OBJECT (widget), "changed",
+                      G_CALLBACK (gnc_option_changed_option_cb), option);
 
-  return widget;
+    return widget;
 }
 
 /* Function to set the UI widget based upon the option */
 static GtkWidget *
 invoice_set_widget (GNCOption *option, GtkBox *page_box,
-		     GtkTooltips *tooltips,
-		     char *name, char *documentation,
-		     /* Return values */
-		     GtkWidget **enclosing, gboolean *packed)
+                    GtkTooltips *tooltips,
+                    char *name, char *documentation,
+                    /* Return values */
+                    GtkWidget **enclosing, gboolean *packed)
 {
-  GtkWidget *value;
-  GtkWidget *label;
+    GtkWidget *value;
+    GtkWidget *label;
 
-  *enclosing = gtk_hbox_new (FALSE, 5);
-  label = make_name_label (name);
-  gtk_box_pack_start (GTK_BOX (*enclosing), label, FALSE, FALSE, 0);
+    *enclosing = gtk_hbox_new (FALSE, 5);
+    label = make_name_label (name);
+    gtk_box_pack_start (GTK_BOX (*enclosing), label, FALSE, FALSE, 0);
 
-  value = create_invoice_widget (option, *enclosing);
+    value = create_invoice_widget (option, *enclosing);
 
-  gnc_option_set_ui_value (option, FALSE);
+    gnc_option_set_ui_value (option, FALSE);
 
-  gtk_widget_show_all (*enclosing);
-  return value;
+    gtk_widget_show_all (*enclosing);
+    return value;
 }
 
 /* Function to set the UI Value for a particular option */
 static gboolean
 invoice_set_value (GNCOption *option, gboolean use_default,
-		    GtkWidget *widget, SCM value)
+                   GtkWidget *widget, SCM value)
 {
-  GncInvoice *invoice;
+    GncInvoice *invoice;
 
-  if (!SWIG_IsPointer (value))
-    scm_misc_error("business_options:invoice_set_value",
-		   "SCM is not a wrapped pointer.", value);
+    if (!SWIG_IsPointer (value))
+        scm_misc_error("business_options:invoice_set_value",
+                       "SCM is not a wrapped pointer.", value);
 
-  invoice = SWIG_MustGetPtr(value, SWIG_TypeQuery("_p__gncInvoice"), 1, 0);
+    invoice = SWIG_MustGetPtr(value, SWIG_TypeQuery("_p__gncInvoice"), 1, 0);
 
-  widget = gnc_option_get_widget (option);
-  gnc_general_search_set_selected (GNC_GENERAL_SEARCH (widget), invoice);
-  return FALSE;
+    widget = gnc_option_get_widget (option);
+    gnc_general_search_set_selected (GNC_GENERAL_SEARCH (widget), invoice);
+    return FALSE;
 }
 
 /* Function to get the UI Value for a particular option */
 static SCM
 invoice_get_value (GNCOption *option, GtkWidget *widget)
 {
-  GncInvoice *invoice;
+    GncInvoice *invoice;
 
-  invoice = gnc_general_search_get_selected (GNC_GENERAL_SEARCH (widget));
-  return SWIG_NewPointerObj(invoice, SWIG_TypeQuery("_p__gncInvoice"), 0);
+    invoice = gnc_general_search_get_selected (GNC_GENERAL_SEARCH (widget));
+    return SWIG_NewPointerObj(invoice, SWIG_TypeQuery("_p__gncInvoice"), 0);
 }
 
 
@@ -422,71 +424,71 @@
 static GtkWidget *
 create_taxtable_widget (GNCOption *option, GtkWidget *hbox)
 {
-  GtkWidget *widget;
+    GtkWidget *widget;
 
-  widget = gtk_option_menu_new ();
+    widget = gtk_option_menu_new ();
 
-  gnc_ui_taxtables_optionmenu (widget, gnc_get_current_book (), TRUE, NULL);
-  
-  gtk_box_pack_start (GTK_BOX (hbox), widget, FALSE, FALSE, 0);
-  gnc_option_set_widget (option, widget);
+    gnc_ui_taxtables_optionmenu (widget, gnc_get_current_book (), TRUE, NULL);
 
-  gnc_ui_optionmenu_set_changed_callback (widget,
-					  (void(*)(GtkWidget*,gpointer))gnc_option_changed_option_cb,
-					  option);
+    gtk_box_pack_start (GTK_BOX (hbox), widget, FALSE, FALSE, 0);
+    gnc_option_set_widget (option, widget);
 
-  return widget;
+    gnc_ui_optionmenu_set_changed_callback (widget,
+                                            (void(*)(GtkWidget*, gpointer))gnc_option_changed_option_cb,
+                                            option);
+
+    return widget;
 }
 
 /* Function to set the UI widget based upon the option */
 static GtkWidget *
 taxtable_set_widget (GNCOption *option, GtkBox *page_box,
-		     GtkTooltips *tooltips,
-		     char *name, char *documentation,
-		     /* Return values */
-		     GtkWidget **enclosing, gboolean *packed)
+                     GtkTooltips *tooltips,
+                     char *name, char *documentation,
+                     /* Return values */
+                     GtkWidget **enclosing, gboolean *packed)
 {
-  GtkWidget *value;
-  GtkWidget *label;
+    GtkWidget *value;
+    GtkWidget *label;
 
-  *enclosing = gtk_hbox_new (FALSE, 5);
-  label = make_name_label (name);
-  gtk_box_pack_start (GTK_BOX (*enclosing), label, FALSE, FALSE, 0);
+    *enclosing = gtk_hbox_new (FALSE, 5);
+    label = make_name_label (name);
+    gtk_box_pack_start (GTK_BOX (*enclosing), label, FALSE, FALSE, 0);
 
-  value = create_taxtable_widget (option, *enclosing);
+    value = create_taxtable_widget (option, *enclosing);
 
-  gnc_option_set_ui_value (option, FALSE);
+    gnc_option_set_ui_value (option, FALSE);
 
-  gtk_widget_show_all (*enclosing);
-  return value;
+    gtk_widget_show_all (*enclosing);
+    return value;
 }
 
 /* Function to set the UI Value for a particular option */
 static gboolean
 taxtable_set_value (GNCOption *option, gboolean use_default,
-		    GtkWidget *widget, SCM value)
+                    GtkWidget *widget, SCM value)
 {
-  GncTaxTable *taxtable;
+    GncTaxTable *taxtable;
 
-  if (!SWIG_IsPointer (value))
-    scm_misc_error("business_options:taxtable_set_value",
-		   "SCM is not a wrapped pointer.", value);
+    if (!SWIG_IsPointer (value))
+        scm_misc_error("business_options:taxtable_set_value",
+                       "SCM is not a wrapped pointer.", value);
 
-  taxtable = SWIG_MustGetPtr(value, SWIG_TypeQuery("_p__gncTaxTable"), 1, 0);
+    taxtable = SWIG_MustGetPtr(value, SWIG_TypeQuery("_p__gncTaxTable"), 1, 0);
 
-  widget = gnc_option_get_widget (option);
-  gnc_ui_optionmenu_set_value (widget, taxtable);
-  return FALSE;
+    widget = gnc_option_get_widget (option);
+    gnc_ui_optionmenu_set_value (widget, taxtable);
+    return FALSE;
 }
 
 /* Function to get the UI Value for a particular option */
 static SCM
 taxtable_get_value (GNCOption *option, GtkWidget *widget)
 {
-  GncTaxTable *taxtable;
+    GncTaxTable *taxtable;
 
-  taxtable = gnc_ui_optionmenu_get_value (widget);
-  return SWIG_NewPointerObj(taxtable, SWIG_TypeQuery("_p__gncTaxTable"), 0);
+    taxtable = gnc_ui_optionmenu_get_value (widget);
+    return SWIG_NewPointerObj(taxtable, SWIG_TypeQuery("_p__gncTaxTable"), 0);
 }
 
 
@@ -495,19 +497,22 @@
 void
 gnc_business_options_gnome_initialize (void)
 {
-  int i;
-  static GNCOptionDef_t options[] = {
-    { "owner", owner_set_widget, owner_set_value, owner_get_value },
-    { "customer", customer_set_widget, customer_set_value,
-      customer_get_value },
-    { "vendor", vendor_set_widget, vendor_set_value, vendor_get_value },
-    { "employee", employee_set_widget, employee_set_value, employee_get_value },
-    { "invoice", invoice_set_widget, invoice_set_value, invoice_get_value },
-    { "taxtable", taxtable_set_widget, taxtable_set_value, taxtable_get_value },
-    { NULL }
-  };
+    int i;
+    static GNCOptionDef_t options[] =
+    {
+        { "owner", owner_set_widget, owner_set_value, owner_get_value },
+        {
+            "customer", customer_set_widget, customer_set_value,
+            customer_get_value
+        },
+        { "vendor", vendor_set_widget, vendor_set_value, vendor_get_value },
+        { "employee", employee_set_widget, employee_set_value, employee_get_value },
+        { "invoice", invoice_set_widget, invoice_set_value, invoice_get_value },
+        { "taxtable", taxtable_set_widget, taxtable_set_value, taxtable_get_value },
+        { NULL }
+    };
 
-  SWIG_GetModule(NULL); /* Work-around for SWIG bug. */
-  for (i = 0; options[i].option_name; i++)
-    gnc_options_ui_register_option (&(options[i]));
+    SWIG_GetModule(NULL); /* Work-around for SWIG bug. */
+    for (i = 0; options[i].option_name; i++)
+        gnc_options_ui_register_option (&(options[i]));
 }

Modified: gnucash/trunk/src/business/business-gnome/business-urls.c
===================================================================
--- gnucash/trunk/src/business/business-gnome/business-urls.c	2010-03-02 21:40:28 UTC (rev 18788)
+++ gnucash/trunk/src/business/business-gnome/business-urls.c	2010-03-02 21:41:05 UTC (rev 18789)
@@ -87,78 +87,78 @@
 
 static gboolean
 customerCB (const char *location, const char *label,
-           gboolean new_window, GNCURLResult * result)
+            gboolean new_window, GNCURLResult * result)
 {
-  QofInstance *entity;
-  GncCustomer *customer;
+    QofInstance *entity;
+    GncCustomer *customer;
 
-  /* href="...:customer=<guid>" */
-  HANDLE_TYPE ("customer=", GNC_ID_CUSTOMER);
-  customer = (GncCustomer *) entity;
-  gnc_ui_customer_edit (customer);
+    /* href="...:customer=<guid>" */
+    HANDLE_TYPE ("customer=", GNC_ID_CUSTOMER);
+    customer = (GncCustomer *) entity;
+    gnc_ui_customer_edit (customer);
 
-  return TRUE;
+    return TRUE;
 }
 
 static gboolean
 vendorCB (const char *location, const char *label,
-           gboolean new_window, GNCURLResult * result)
+          gboolean new_window, GNCURLResult * result)
 {
-  QofInstance *entity;
-  GncVendor *vendor;
+    QofInstance *entity;
+    GncVendor *vendor;
 
-  /* href="...:vendor=<guid>" */
-  HANDLE_TYPE ("vendor=", GNC_ID_VENDOR);
-  vendor = (GncVendor *) entity;
-  gnc_ui_vendor_edit (vendor);
+    /* href="...:vendor=<guid>" */
+    HANDLE_TYPE ("vendor=", GNC_ID_VENDOR);
+    vendor = (GncVendor *) entity;
+    gnc_ui_vendor_edit (vendor);
 
-  return TRUE;
+    return TRUE;
 }
 
 static gboolean
 employeeCB (const char *location, const char *label,
-           gboolean new_window, GNCURLResult * result)
+            gboolean new_window, GNCURLResult * result)
 {
-  QofInstance *entity;
-  GncEmployee *employee;
+    QofInstance *entity;
+    GncEmployee *employee;
 
-  /* href="...:employee=<guid>" */
-  HANDLE_TYPE ("employee=", GNC_ID_EMPLOYEE);
+    /* href="...:employee=<guid>" */
+    HANDLE_TYPE ("employee=", GNC_ID_EMPLOYEE);
 
-  employee = (GncEmployee *) entity;
-  gnc_ui_employee_edit (employee);
+    employee = (GncEmployee *) entity;
+    gnc_ui_employee_edit (employee);
 
-  return TRUE;
+    return TRUE;
 }
 
 static gboolean
 invoiceCB (const char *location, const char *label,
            gboolean new_window, GNCURLResult * result)
 {
-  QofInstance *entity;
-  GncInvoice *invoice;
+    QofInstance *entity;
+    GncInvoice *invoice;
 
-  /* href="...:invoice=<guid>" */
-  HANDLE_TYPE ("invoice=", GNC_ID_INVOICE);
-  invoice = (GncInvoice *) entity;
-  gnc_ui_invoice_edit (invoice);
+    /* href="...:invoice=<guid>" */
+    HANDLE_TYPE ("invoice=", GNC_ID_INVOICE);
+    invoice = (GncInvoice *) entity;
+    gnc_ui_invoice_edit (invoice);
 
-  return TRUE;
+    return TRUE;
 }
 
 static gboolean
 jobCB (const char *location, const char *label,
-           gboolean new_window, GNCURLResult * result)
+       gboolean new_window, GNCURLResult * result)
 {
-  QofInstance *entity;
-  GncJob *job;
+    QofInstance *entity;
+    GncJob *job;
 
-  /* href="...:job=<guid>" */
-  HANDLE_TYPE ("job=", GNC_ID_JOB);
-  job = (GncJob *) entity;
-  gnc_ui_job_edit (job);
+    /* href="...:job=<guid>" */
+    HANDLE_TYPE ("job=", GNC_ID_JOB);
+    job = (GncJob *) entity;
+    gnc_ui_job_edit (job);
 
-  return TRUE;
+    return TRUE;
 }
 
 /* ================================================================= */
@@ -175,160 +175,167 @@
 ownerreportCB (const char *location, const char *label,
                gboolean new_window, GNCURLResult * result)
 {
-  const char *ownerptr;
-  const char *acctptr;
-  GUID guid;
-  GncOwner owner;
-  GncOwnerType type;
-  char *etype = NULL;
-  Account *acc = NULL;
+    const char *ownerptr;
+    const char *acctptr;
+    GUID guid;
+    GncOwner owner;
+    GncOwnerType type;
+    char *etype = NULL;
+    Account *acc = NULL;
 
-  g_return_val_if_fail (location != NULL, FALSE);
-  g_return_val_if_fail (result != NULL, FALSE);
+    g_return_val_if_fail (location != NULL, FALSE);
+    g_return_val_if_fail (result != NULL, FALSE);
 
-  result->load_to_stream = FALSE;
+    result->load_to_stream = FALSE;
 
-  /* href="...:owner=<owner-type>:guid=<guid>[&acct=<guid>]" */
-  
-  acctptr = strchr (location, '&');
-  if (acctptr)
-    acctptr++;
+    /* href="...:owner=<owner-type>:guid=<guid>[&acct=<guid>]" */
 
-  if (strncmp ("owner=", location, 6) != 0) {
-    result->error_message = g_strdup_printf (_("Badly formed URL %s"),
-                                             location);
-    return FALSE;
-  }
+    acctptr = strchr (location, '&');
+    if (acctptr)
+        acctptr++;
 
-  memset (&owner, 0, sizeof (owner));
-    
-  ownerptr = location+6;
-  switch (*ownerptr) {
-  case 'c':
-    type = GNC_OWNER_CUSTOMER;
-    break;
-  case 'v':
-    type = GNC_OWNER_VENDOR;
-    break;
-  case 'e':
-    type = GNC_OWNER_EMPLOYEE;
-    break;
-  case 'j':
-    type = GNC_OWNER_JOB;
-    break;
-  default:
-    result->error_message = g_strdup_printf (_("Bad URL: %s"), location);
-    return FALSE;
-  }
+    if (strncmp ("owner=", location, 6) != 0)
+    {
+        result->error_message = g_strdup_printf (_("Badly formed URL %s"),
+                                location);
+        return FALSE;
+    }
 
-  if (!string_to_guid (ownerptr+2, &guid)) {
-    result->error_message = g_strdup_printf (_("Bad URL: %s"), location);
-    return FALSE;
-  }
+    memset (&owner, 0, sizeof (owner));
 
+    ownerptr = location + 6;
+    switch (*ownerptr)
+    {
+    case 'c':
+        type = GNC_OWNER_CUSTOMER;
+        break;
+    case 'v':
+        type = GNC_OWNER_VENDOR;
+        break;
+    case 'e':
+        type = GNC_OWNER_EMPLOYEE;
+        break;
+    case 'j':
+        type = GNC_OWNER_JOB;
+        break;
+    default:
+        result->error_message = g_strdup_printf (_("Bad URL: %s"), location);
+        return FALSE;
+    }
 
-  switch (type) {
+    if (!string_to_guid (ownerptr + 2, &guid))
+    {
+        result->error_message = g_strdup_printf (_("Bad URL: %s"), location);
+        return FALSE;
+    }
+
+
+    switch (type)
+    {
     case GNC_OWNER_CUSTOMER:
     {
-      GncCustomer *customer = 
-                      gncCustomerLookup (gnc_get_current_book (), &guid);
-      RETURN_IF_NULL (customer);
-      gncOwnerInitCustomer (&owner, customer);
-      etype = "Customer";
-      break;
+        GncCustomer *customer =
+            gncCustomerLookup (gnc_get_current_book (), &guid);
+        RETURN_IF_NULL (customer);
+        gncOwnerInitCustomer (&owner, customer);
+        etype = "Customer";
+        break;
     }
     case GNC_OWNER_VENDOR:
     {
-      GncVendor *vendor =
-                            gncVendorLookup (gnc_get_current_book (), &guid);
-      RETURN_IF_NULL (vendor);
+        GncVendor *vendor =
+            gncVendorLookup (gnc_get_current_book (), &guid);
+        RETURN_IF_NULL (vendor);
         gncOwnerInitVendor (&owner, vendor);
-      etype = "Vendor";
-      break;
+        etype = "Vendor";
+        break;
     }
     case GNC_OWNER_EMPLOYEE:
     {
-      GncEmployee *employee = 
-           gncEmployeeLookup (gnc_get_current_book (), &guid);
-      RETURN_IF_NULL(employee);
-      gncOwnerInitEmployee (&owner, employee);
-      etype = "Employee";
-      break;
+        GncEmployee *employee =
+            gncEmployeeLookup (gnc_get_current_book (), &guid);
+        RETURN_IF_NULL(employee);
+        gncOwnerInitEmployee (&owner, employee);
+        etype = "Employee";
+        break;
     }
     case GNC_OWNER_JOB:
     {
-      GncJob *job = 
-           gncJobLookup (gnc_get_current_book (), &guid);
-      RETURN_IF_NULL(job);
-      gncOwnerInitJob (&owner, job);
-      etype = "Job";
-      break;
+        GncJob *job =
+            gncJobLookup (gnc_get_current_book (), &guid);
+        RETURN_IF_NULL(job);
+        gncOwnerInitJob (&owner, job);
+        etype = "Job";
+        break;
     }
     default:
-      etype = "OTHER";
-  }
+        etype = "OTHER";
+    }
 
-  if (owner.owner.undefined == NULL)
-  {
-    result->error_message =
-      g_strdup_printf (_("Entity type does not match %s: %s"),
-                       etype, location);
-    return FALSE;
-  }
-
-  /* Deal with acctptr, if it exists */
-  if (acctptr)
-  {
-    if (strncmp ("acct=", acctptr, 5) != 0)
+    if (owner.owner.undefined == NULL)
     {
-      result->error_message = g_strdup_printf (_("Bad URL %s"), location);
-      return FALSE;
+        result->error_message =
+            g_strdup_printf (_("Entity type does not match %s: %s"),
+                             etype, location);
+        return FALSE;
     }
 
-    if (!string_to_guid (acctptr+5, &guid)) {
-      result->error_message = g_strdup_printf (_("Bad URL: %s"), location);
-      return FALSE;
-    }
+    /* Deal with acctptr, if it exists */
+    if (acctptr)
+    {
+        if (strncmp ("acct=", acctptr, 5) != 0)
+        {
+            result->error_message = g_strdup_printf (_("Bad URL %s"), location);
+            return FALSE;
+        }
 
-    acc = xaccAccountLookup (&guid, gnc_get_current_book ());
-    if (NULL == acc)
-    {
-      result->error_message = g_strdup_printf (_("No such Account entity: %s"),
-                                               location);
-      return FALSE;
+        if (!string_to_guid (acctptr + 5, &guid))
+        {
+            result->error_message = g_strdup_printf (_("Bad URL: %s"), location);
+            return FALSE;
+        }
+
+        acc = xaccAccountLookup (&guid, gnc_get_current_book ());
+        if (NULL == acc)
+        {
+            result->error_message = g_strdup_printf (_("No such Account entity: %s"),
+                                    location);
+            return FALSE;
+        }
     }
-  }
 
-  /* Ok, let's run this report */
-  gnc_business_call_owner_report (&owner, acc);
+    /* Ok, let's run this report */
+    gnc_business_call_owner_report (&owner, acc);
 
-  return TRUE;
+    return TRUE;
 }
 
 void
 gnc_business_urls_initialize (void)
 {
-  int i;
-  static struct {
-    URLType urltype;
-    char *  protocol;
-    GncHTMLUrlCB handler;
-  } types[] = {
-    { GNC_ID_CUSTOMER, GNC_ID_CUSTOMER, customerCB },
-    { GNC_ID_VENDOR, GNC_ID_VENDOR, vendorCB },
-    { GNC_ID_EMPLOYEE, GNC_ID_EMPLOYEE, employeeCB },
-    { GNC_ID_JOB, GNC_ID_JOB, jobCB },
-    { GNC_ID_INVOICE, GNC_ID_INVOICE, invoiceCB },
-    { URL_TYPE_OWNERREPORT, "gnc-ownerreport", ownerreportCB },
-    { NULL, NULL }
-  };
+    int i;
+    static struct
+    {
+        URLType urltype;
+        char *  protocol;
+        GncHTMLUrlCB handler;
+    } types[] =
+    {
+        { GNC_ID_CUSTOMER, GNC_ID_CUSTOMER, customerCB },
+        { GNC_ID_VENDOR, GNC_ID_VENDOR, vendorCB },
+        { GNC_ID_EMPLOYEE, GNC_ID_EMPLOYEE, employeeCB },
+        { GNC_ID_JOB, GNC_ID_JOB, jobCB },
+        { GNC_ID_INVOICE, GNC_ID_INVOICE, invoiceCB },
+        { URL_TYPE_OWNERREPORT, "gnc-ownerreport", ownerreportCB },
+        { NULL, NULL }
+    };
 
-  for (i = 0; types[i].urltype; i++)
-    gnc_html_register_urltype (types[i].urltype, types[i].protocol);
+    for (i = 0; types[i].urltype; i++)
+        gnc_html_register_urltype (types[i].urltype, types[i].protocol);
 
-  for (i = 0; types[i].urltype; i++)
-    if (types[i].handler)
-      gnc_html_register_url_handler (types[i].urltype, types[i].handler);
+    for (i = 0; types[i].urltype; i++)
+        if (types[i].handler)
+            gnc_html_register_url_handler (types[i].urltype, types[i].handler);
 
 }
 

Modified: gnucash/trunk/src/business/business-gnome/dialog-billterms.c
===================================================================
--- gnucash/trunk/src/business/business-gnome/dialog-billterms.c	2010-03-02 21:40:28 UTC (rev 18788)
+++ gnucash/trunk/src/business/business-gnome/dialog-billterms.c	2010-03-02 21:41:05 UTC (rev 18789)
@@ -40,10 +40,11 @@
 
 #define DIALOG_BILLTERMS_CM_CLASS "billterms-dialog"
 
-enum term_cols {
-  BILL_TERM_COL_NAME = 0,
-  BILL_TERM_COL_TERM,
-  NUM_BILL_TERM_COLS
+enum term_cols
+{
+    BILL_TERM_COL_NAME = 0,
+    BILL_TERM_COL_TERM,
+    NUM_BILL_TERM_COLS
 };
 
 void billterms_new_term_cb (GtkButton *button, BillTermsWindow *btw);
@@ -53,395 +54,413 @@
 void billterms_window_destroy_cb (GtkWidget *widget, gpointer data);
 void billterms_type_combobox_changed (GtkComboBox *cb, gpointer data);
 
-typedef struct _billterm_notebook {
-  GtkTooltips *		tooltips;
-  GtkWidget *		notebook;
+typedef struct _billterm_notebook
+{
+    GtkTooltips *		tooltips;
+    GtkWidget *		notebook;
 
-  /* "Days" widgets */
-  GtkWidget *		days_due_days;
-  GtkWidget *		days_disc_days;
-  GtkWidget *		days_disc;
+    /* "Days" widgets */
+    GtkWidget *		days_due_days;
+    GtkWidget *		days_disc_days;
+    GtkWidget *		days_disc;
 
-  /* "Proximo" widgets */
-  GtkWidget *		prox_due_day;
-  GtkWidget *		prox_disc_day;
-  GtkWidget *		prox_disc;
-  GtkWidget *		prox_cutoff;
+    /* "Proximo" widgets */
+    GtkWidget *		prox_due_day;
+    GtkWidget *		prox_disc_day;
+    GtkWidget *		prox_disc;
+    GtkWidget *		prox_cutoff;
 
-  /* What kind of term is this? */
-  GncBillTermType	type;
+    /* What kind of term is this? */
+    GncBillTermType	type;
 } BillTermNB;
 
-struct _billterms_window {
-  GtkWidget *	dialog;
-  GtkWidget *	terms_view;
-  GtkWidget *	desc_entry;
-  GtkWidget *	type_label;
-  GtkWidget *	term_vbox;
-  BillTermNB	notebook;
+struct _billterms_window
+{
+    GtkWidget *	dialog;
+    GtkWidget *	terms_view;
+    GtkWidget *	desc_entry;
+    GtkWidget *	type_label;
+    GtkWidget *	term_vbox;
+    BillTermNB	notebook;
 
-  GncBillTerm *	current_term;
-  QofBook *	book;
-  gint		component_id;
+    GncBillTerm *	current_term;
+    QofBook *	book;
+    gint		component_id;
 };
 
-typedef struct _new_billterms {
-  GtkWidget *	dialog;
-  GtkWidget *	name_entry;
-  GtkWidget *	desc_entry;
-  BillTermNB	notebook;
+typedef struct _new_billterms
+{
+    GtkWidget *	dialog;
+    GtkWidget *	name_entry;
+    GtkWidget *	desc_entry;
+    BillTermNB	notebook;
 
-  BillTermsWindow *	btw;
-  GncBillTerm *	this_term;
+    BillTermsWindow *	btw;
+    GncBillTerm *	this_term;
 } NewBillTerm;
 
 
 static GtkWidget *
 read_widget (GladeXML *xml, char *name, gboolean read_only)
 {
-  GtkWidget *widget = glade_xml_get_widget (xml, name);
-  if (read_only) {
-    GtkAdjustment *adj;
-    gtk_editable_set_editable (GTK_EDITABLE (widget), FALSE);
-    adj = gtk_spin_button_get_adjustment (GTK_SPIN_BUTTON (widget));
-    adj->step_increment = 0.0;
-    adj->page_increment = 0.0;
-    gtk_adjustment_changed (adj);
-  }
+    GtkWidget *widget = glade_xml_get_widget (xml, name);
+    if (read_only)
+    {
+        GtkAdjustment *adj;
+        gtk_editable_set_editable (GTK_EDITABLE (widget), FALSE);
+        adj = gtk_spin_button_get_adjustment (GTK_SPIN_BUTTON (widget));
+        adj->step_increment = 0.0;
+        adj->page_increment = 0.0;
+        gtk_adjustment_changed (adj);
+    }
 
-  return widget;
+    return widget;
 }
 
 /* NOTE: The caller needs to unref once they attach */
 static void
 init_notebook_widgets (BillTermNB *notebook, gboolean read_only,
-		       GtkDialog *dialog, gpointer user_data)
+                       GtkDialog *dialog, gpointer user_data)
 {
-  GladeXML *xml;
-  GtkWidget *parent;
+    GladeXML *xml;
+    GtkWidget *parent;
 
-  /* Initialize the tooltips */
-  notebook->tooltips = gtk_tooltips_new ();
+    /* Initialize the tooltips */
+    notebook->tooltips = gtk_tooltips_new ();
 
-  /* Load the notebook from XML */
-  xml = gnc_glade_xml_new ("billterms.glade", "Term Notebook");
-  notebook->notebook = glade_xml_get_widget (xml, "term_notebook");
-  parent = glade_xml_get_widget (xml, "Term Notebook");
+    /* Load the notebook from XML */
+    xml = gnc_glade_xml_new ("billterms.glade", "Term Notebook");
+    notebook->notebook = glade_xml_get_widget (xml, "term_notebook");
+    parent = glade_xml_get_widget (xml, "Term Notebook");
 
-  /* load the "days" widgets */
-  notebook->days_due_days = read_widget (xml, "days:due_days", read_only);
-  notebook->days_disc_days = read_widget (xml, "days:discount_days", read_only);
-  notebook->days_disc = read_widget (xml, "days:discount", read_only);
+    /* load the "days" widgets */
+    notebook->days_due_days = read_widget (xml, "days:due_days", read_only);
+    notebook->days_disc_days = read_widget (xml, "days:discount_days", read_only);
+    notebook->days_disc = read_widget (xml, "days:discount", read_only);
 
-  /* load the "proximo" widgets */
-  notebook->prox_due_day = read_widget (xml, "prox:due_day", read_only);
-  notebook->prox_disc_day = read_widget (xml, "prox:discount_day", read_only);
-  notebook->prox_disc = read_widget (xml, "prox:discount", read_only);
-  notebook->prox_cutoff = read_widget (xml, "prox:cutoff_day", read_only);
+    /* load the "proximo" widgets */
+    notebook->prox_due_day = read_widget (xml, "prox:due_day", read_only);
+    notebook->prox_disc_day = read_widget (xml, "prox:discount_day", read_only);
+    notebook->prox_disc = read_widget (xml, "prox:discount", read_only);
+    notebook->prox_cutoff = read_widget (xml, "prox:cutoff_day", read_only);
 
-  /* Disconnect the notebook from the window */
-  g_object_ref (notebook->notebook);
-  gtk_container_remove (GTK_CONTAINER (parent), notebook->notebook);
-  gtk_widget_destroy (parent);
+    /* Disconnect the notebook from the window */
+    g_object_ref (notebook->notebook);
+    gtk_container_remove (GTK_CONTAINER (parent), notebook->notebook);
+    gtk_widget_destroy (parent);
 
-  /* NOTE: The caller needs to unref once they attach */
+    /* NOTE: The caller needs to unref once they attach */
 }
 
 static void
 set_numeric (GtkWidget *widget, GncBillTerm *term,
-	     void (*func)(GncBillTerm *, gnc_numeric))
+             void (*func)(GncBillTerm *, gnc_numeric))
 {
-  gnc_numeric val;
-  gdouble fl = 0.0;
+    gnc_numeric val;
+    gdouble fl = 0.0;
 
-  fl = gtk_spin_button_get_value (GTK_SPIN_BUTTON (widget));
-  val = double_to_gnc_numeric (fl, 100000, GNC_RND_ROUND);
-  func (term, val);
+    fl = gtk_spin_button_get_value (GTK_SPIN_BUTTON (widget));
+    val = double_to_gnc_numeric (fl, 100000, GNC_RND_ROUND);
+    func (term, val);
 }
 
 static void
 get_numeric (GtkWidget *widget, GncBillTerm *term,
-	     gnc_numeric (*func)(const GncBillTerm *))
+             gnc_numeric (*func)(const GncBillTerm *))
 {
-  gnc_numeric val;
-  gdouble fl;
+    gnc_numeric val;
+    gdouble fl;
 
-  val = func (term);
-  fl = gnc_numeric_to_double (val);
-  gtk_spin_button_set_value (GTK_SPIN_BUTTON (widget), fl);
+    val = func (term);
+    fl = gnc_numeric_to_double (val);
+    gtk_spin_button_set_value (GTK_SPIN_BUTTON (widget), fl);
 }
 
 static void
 set_int (GtkWidget *widget, GncBillTerm *term,
-	     void (*func)(GncBillTerm *, gint))
+         void (*func)(GncBillTerm *, gint))
 {
-  gint val;
+    gint val;
 
-  val = gtk_spin_button_get_value_as_int (GTK_SPIN_BUTTON (widget));
-  func (term, val);
+    val = gtk_spin_button_get_value_as_int (GTK_SPIN_BUTTON (widget));
+    func (term, val);
 }
 
 static void
 get_int (GtkWidget *widget, GncBillTerm *term,
-	     gint (*func)(const GncBillTerm *))
+         gint (*func)(const GncBillTerm *))
 {
-  gint val;
+    gint val;
 
-  val = func (term);
-  gtk_spin_button_set_value (GTK_SPIN_BUTTON (widget), (gfloat)val);
+    val = func (term);
+    gtk_spin_button_set_value (GTK_SPIN_BUTTON (widget), (gfloat)val);
 }
 
 /* return TRUE if anything truly changed */
 static gboolean
 ui_to_billterm (NewBillTerm *nbt)
 {
-  BillTermNB *notebook;
-  GncBillTerm *term;
-  const char *text;
+    BillTermNB *notebook;
+    GncBillTerm *term;
+    const char *text;
 
-  term = nbt->this_term;
-  notebook = &nbt->notebook;
+    term = nbt->this_term;
+    notebook = &nbt->notebook;
 
-  text = gtk_entry_get_text (GTK_ENTRY (nbt->desc_entry));
-  if (text)
-    gncBillTermSetDescription (term, text);
+    text = gtk_entry_get_text (GTK_ENTRY (nbt->desc_entry));
+    if (text)
+        gncBillTermSetDescription (term, text);
 
-  gncBillTermSetType (nbt->this_term, nbt->notebook.type);
+    gncBillTermSetType (nbt->this_term, nbt->notebook.type);
 
-  switch (nbt->notebook.type) {
-  case GNC_TERM_TYPE_DAYS:
-    set_int (notebook->days_due_days, term, gncBillTermSetDueDays);
-    set_int (notebook->days_disc_days, term, gncBillTermSetDiscountDays);
-    set_numeric (notebook->days_disc, term, gncBillTermSetDiscount);
-    break;
+    switch (nbt->notebook.type)
+    {
+    case GNC_TERM_TYPE_DAYS:
+        set_int (notebook->days_due_days, term, gncBillTermSetDueDays);
+        set_int (notebook->days_disc_days, term, gncBillTermSetDiscountDays);
+        set_numeric (notebook->days_disc, term, gncBillTermSetDiscount);
+        break;
 
-  case GNC_TERM_TYPE_PROXIMO:
-    set_int (notebook->prox_due_day, term, gncBillTermSetDueDays);
-    set_int (notebook->prox_disc_day, term, gncBillTermSetDiscountDays);
-    set_numeric (notebook->prox_disc, term, gncBillTermSetDiscount);
-    set_int (notebook->prox_cutoff, term, gncBillTermSetCutoff);
-    break;
-  }
+    case GNC_TERM_TYPE_PROXIMO:
+        set_int (notebook->prox_due_day, term, gncBillTermSetDueDays);
+        set_int (notebook->prox_disc_day, term, gncBillTermSetDiscountDays);
+        set_numeric (notebook->prox_disc, term, gncBillTermSetDiscount);
+        set_int (notebook->prox_cutoff, term, gncBillTermSetCutoff);
+        break;
+    }
 
-  return gncBillTermIsDirty (term);
+    return gncBillTermIsDirty (term);
 }
 
 static void
 billterm_to_ui (GncBillTerm *term, GtkWidget *desc, BillTermNB *notebook)
 {
-  gtk_entry_set_text (GTK_ENTRY (desc), gncBillTermGetDescription (term));
-  notebook->type = gncBillTermGetType (term);
+    gtk_entry_set_text (GTK_ENTRY (desc), gncBillTermGetDescription (term));
+    notebook->type = gncBillTermGetType (term);
 
-  switch (notebook->type) {
-  case GNC_TERM_TYPE_DAYS:
-    get_int (notebook->days_due_days, term, gncBillTermGetDueDays);
-    get_int (notebook->days_disc_days, term, gncBillTermGetDiscountDays);
-    get_numeric (notebook->days_disc, term, gncBillTermGetDiscount);
-    break;
+    switch (notebook->type)
+    {
+    case GNC_TERM_TYPE_DAYS:
+        get_int (notebook->days_due_days, term, gncBillTermGetDueDays);
+        get_int (notebook->days_disc_days, term, gncBillTermGetDiscountDays);
+        get_numeric (notebook->days_disc, term, gncBillTermGetDiscount);
+        break;
 
-  case GNC_TERM_TYPE_PROXIMO:
-    get_int (notebook->prox_due_day, term, gncBillTermGetDueDays);
-    get_int (notebook->prox_disc_day, term, gncBillTermGetDiscountDays);
-    get_numeric (notebook->prox_disc, term, gncBillTermGetDiscount);
-    get_int (notebook->prox_cutoff, term, gncBillTermGetCutoff);
-    break;
-  }
+    case GNC_TERM_TYPE_PROXIMO:
+        get_int (notebook->prox_due_day, term, gncBillTermGetDueDays);
+        get_int (notebook->prox_disc_day, term, gncBillTermGetDiscountDays);
+        get_numeric (notebook->prox_disc, term, gncBillTermGetDiscount);
+        get_int (notebook->prox_cutoff, term, gncBillTermGetCutoff);
+        break;
+    }
 }
 
 static gboolean
 verify_term_ok (NewBillTerm *nbt)
 {
-  char *message;
-  gnc_numeric num;
+    char *message;
+    gnc_numeric num;
 
-  return TRUE;
+    return TRUE;
 
-  /* verify the discount day(s) is less than the due day(s) */
-  num = gnc_numeric_zero ();
-  if (gnc_numeric_negative_p (num)) {
-    message = _("Negative amounts are not allowed.");
-    gnc_error_dialog (nbt->dialog, "%s", message);
-    return FALSE;
-  }
-  if (gnc_numeric_compare (num, gnc_numeric_create (100, 1)) > 0) {
-    message = _("Percentage amount must be between 0 and 100.");
-    gnc_error_dialog (nbt->dialog, "%s", message);
-    return FALSE;
-  }
-  return TRUE;
+    /* verify the discount day(s) is less than the due day(s) */
+    num = gnc_numeric_zero ();
+    if (gnc_numeric_negative_p (num))
+    {
+        message = _("Negative amounts are not allowed.");
+        gnc_error_dialog (nbt->dialog, "%s", message);
+        return FALSE;
+    }
+    if (gnc_numeric_compare (num, gnc_numeric_create (100, 1)) > 0)
+    {
+        message = _("Percentage amount must be between 0 and 100.");
+        gnc_error_dialog (nbt->dialog, "%s", message);
+        return FALSE;
+    }
+    return TRUE;
 }
 
 static gboolean
 new_billterm_ok_cb (NewBillTerm *nbt)
 {
-  BillTermsWindow *btw;
-  const char *name = NULL;
-  char *message;
+    BillTermsWindow *btw;
+    const char *name = NULL;
+    char *message;
 
-  g_return_val_if_fail (nbt, FALSE);
-  btw = nbt->btw;
+    g_return_val_if_fail (nbt, FALSE);
+    btw = nbt->btw;
 
-  /* Verify that we've got real, valid data */
+    /* Verify that we've got real, valid data */
 
-  /* verify the name, maybe */
-  if (nbt->this_term == NULL) {
-    name = gtk_entry_get_text (GTK_ENTRY (nbt->name_entry));
-    if (name == NULL || *name == '\0') {
-      message = _("You must provide a name for this Billing Term.");
-      gnc_error_dialog (nbt->dialog, "%s", message);
-      return FALSE;
+    /* verify the name, maybe */
+    if (nbt->this_term == NULL)
+    {
+        name = gtk_entry_get_text (GTK_ENTRY (nbt->name_entry));
+        if (name == NULL || *name == '\0')
+        {
+            message = _("You must provide a name for this Billing Term.");
+            gnc_error_dialog (nbt->dialog, "%s", message);
+            return FALSE;
+        }
+        if (gncBillTermLookupByName (btw->book, name))
+        {
+            message = g_strdup_printf(_(
+                                          "You must provide a unique name for this Billing Term. "
+                                          "Your choice \"%s\" is already in use."), name);
+            gnc_error_dialog (nbt->dialog, "%s", message);
+            g_free (message);
+            return FALSE;
+        }
     }
-    if (gncBillTermLookupByName (btw->book, name)) {
-      message = g_strdup_printf(_(
-			 "You must provide a unique name for this Billing Term. "
-			 "Your choice \"%s\" is already in use."), name);
-      gnc_error_dialog (nbt->dialog, "%s", message);
-      g_free (message);
-      return FALSE;
-    }
-  }
 
-  /* Verify the actual data */
-  if (!verify_term_ok (nbt))
-    return FALSE;
+    /* Verify the actual data */
+    if (!verify_term_ok (nbt))
+        return FALSE;
 
-  gnc_suspend_gui_refresh ();
+    gnc_suspend_gui_refresh ();
 
-  /* Ok, it's all valid, now either change or add this thing */
-  if (nbt->this_term == NULL) {
-    nbt->this_term = gncBillTermCreate (btw->book);
-    gncBillTermBeginEdit (nbt->this_term);
-    gncBillTermSetName (nbt->this_term, name);
-    /* Reset the current term */
-    btw->current_term = nbt->this_term;
-  } else
-    gncBillTermBeginEdit (btw->current_term);
+    /* Ok, it's all valid, now either change or add this thing */
+    if (nbt->this_term == NULL)
+    {
+        nbt->this_term = gncBillTermCreate (btw->book);
+        gncBillTermBeginEdit (nbt->this_term);
+        gncBillTermSetName (nbt->this_term, name);
+        /* Reset the current term */
+        btw->current_term = nbt->this_term;
+    }
+    else
+        gncBillTermBeginEdit (btw->current_term);
 
-  /* Fill in the rest of the term */
-  if (ui_to_billterm (nbt))
-    gncBillTermChanged (btw->current_term);
+    /* Fill in the rest of the term */
+    if (ui_to_billterm (nbt))
+        gncBillTermChanged (btw->current_term);
 
-  /* Mark the table as changed and commit it */
-  gncBillTermCommitEdit (btw->current_term);
+    /* Mark the table as changed and commit it */
+    gncBillTermCommitEdit (btw->current_term);
 
-  gnc_resume_gui_refresh();
-  return TRUE;
+    gnc_resume_gui_refresh();
+    return TRUE;
 }
 
 static void
 show_notebook (BillTermNB *notebook)
 {
-  g_return_if_fail (notebook->type > 0);
-  gtk_notebook_set_current_page (GTK_NOTEBOOK (notebook->notebook),
-				 notebook->type-1);
+    g_return_if_fail (notebook->type > 0);
+    gtk_notebook_set_current_page (GTK_NOTEBOOK (notebook->notebook),
+                                   notebook->type - 1);
 }
 
 static void
 maybe_set_type (NewBillTerm *nbt, GncBillTermType type)
 {
-  /* See if anything to do? */
-  if (type == nbt->notebook.type)
-    return;
+    /* See if anything to do? */
+    if (type == nbt->notebook.type)
+        return;
 
-  /* Yep.  Let's refresh */
-  nbt->notebook.type = type;
-  show_notebook (&nbt->notebook);
+    /* Yep.  Let's refresh */
+    nbt->notebook.type = type;
+    show_notebook (&nbt->notebook);
 }
 
 void
 billterms_type_combobox_changed (GtkComboBox *cb, gpointer data)
 {
-  NewBillTerm *nbt = data;
-  gint value;
+    NewBillTerm *nbt = data;
+    gint value;
 
-  value = gtk_combo_box_get_active(cb);
-  maybe_set_type (nbt, value + 1);
+    value = gtk_combo_box_get_active(cb);
+    maybe_set_type (nbt, value + 1);
 }
 
 static GncBillTerm *
 new_billterm_dialog (BillTermsWindow *btw, GncBillTerm *term,
-		     const char *name)
+                     const char *name)
 {
-  GncBillTerm *created_term = NULL;
-  NewBillTerm *nbt;
-  GladeXML *xml;
-  GtkWidget *box, *combo_box;
-  gint response;
-  gboolean done;
-  const gchar *dialog_name;
+    GncBillTerm *created_term = NULL;
+    NewBillTerm *nbt;
+    GladeXML *xml;
+    GtkWidget *box, *combo_box;
+    gint response;
+    gboolean done;
+    const gchar *dialog_name;
 
-  if (!btw) return NULL;
+    if (!btw) return NULL;
 
-  nbt = g_new0 (NewBillTerm, 1);
-  nbt->btw = btw;
-  nbt->this_term = term;
+    nbt = g_new0 (NewBillTerm, 1);
+    nbt->btw = btw;
+    nbt->this_term = term;
 
-  /* Open and read the XML */
-  dialog_name = term ? "Edit Term Dialog" : "New Term Dialog";
-  xml = gnc_glade_xml_new ("billterms.glade", dialog_name);
-  nbt->dialog = glade_xml_get_widget (xml, dialog_name);
-  nbt->name_entry = glade_xml_get_widget (xml, "name_entry");
-  nbt->desc_entry = glade_xml_get_widget (xml, "desc_entry");
-  if (name)
-    gtk_entry_set_text (GTK_ENTRY (nbt->name_entry), name);
+    /* Open and read the XML */
+    dialog_name = term ? "Edit Term Dialog" : "New Term Dialog";
+    xml = gnc_glade_xml_new ("billterms.glade", dialog_name);
+    nbt->dialog = glade_xml_get_widget (xml, dialog_name);
+    nbt->name_entry = glade_xml_get_widget (xml, "name_entry");
+    nbt->desc_entry = glade_xml_get_widget (xml, "desc_entry");
+    if (name)
+        gtk_entry_set_text (GTK_ENTRY (nbt->name_entry), name);
 
-  /* Initialize the notebook widgets */
-  init_notebook_widgets (&nbt->notebook, FALSE,
-			 GTK_DIALOG (nbt->dialog), nbt);
+    /* Initialize the notebook widgets */
+    init_notebook_widgets (&nbt->notebook, FALSE,
+                           GTK_DIALOG (nbt->dialog), nbt);
 
-  /* Attach the notebook */
-  box = glade_xml_get_widget (xml, "notebook_box");
-  gtk_box_pack_start (GTK_BOX (box), nbt->notebook.notebook, TRUE, TRUE, 0);
-  g_object_unref (nbt->notebook.notebook);
+    /* Attach the notebook */
+    box = glade_xml_get_widget (xml, "notebook_box");
+    gtk_box_pack_start (GTK_BOX (box), nbt->notebook.notebook, TRUE, TRUE, 0);
+    g_object_unref (nbt->notebook.notebook);
 
-  /* Fill in the widgets appropriately */
-  if (term)
-    billterm_to_ui (term, nbt->desc_entry, &nbt->notebook);
-  else
-    nbt->notebook.type = GNC_TERM_TYPE_DAYS;
+    /* Fill in the widgets appropriately */
+    if (term)
+        billterm_to_ui (term, nbt->desc_entry, &nbt->notebook);
+    else
+        nbt->notebook.type = GNC_TERM_TYPE_DAYS;
 
-  /* Create the menu */
-  combo_box = glade_xml_get_widget (xml, "type_combobox");
-  gtk_combo_box_set_active(GTK_COMBO_BOX(combo_box), nbt->notebook.type - 1);
+    /* Create the menu */
+    combo_box = glade_xml_get_widget (xml, "type_combobox");
+    gtk_combo_box_set_active(GTK_COMBO_BOX(combo_box), nbt->notebook.type - 1);
 
-  /* Show the right notebook page */
-  show_notebook (&nbt->notebook);
+    /* Show the right notebook page */
+    show_notebook (&nbt->notebook);
 
-  /* Setup signals */
-  glade_xml_signal_autoconnect_full( xml,
-                                     gnc_glade_autoconnect_full_func,
-                                     nbt);
+    /* Setup signals */
+    glade_xml_signal_autoconnect_full( xml,
+                                       gnc_glade_autoconnect_full_func,
+                                       nbt);
 
-  gtk_window_set_transient_for (GTK_WINDOW(nbt->dialog),
-				GTK_WINDOW(btw->dialog));
+    gtk_window_set_transient_for (GTK_WINDOW(nbt->dialog),
+                                  GTK_WINDOW(btw->dialog));
 
-  /* Show what we should */
-  gtk_widget_show_all (nbt->dialog);
-  if (term) {
-    gtk_widget_grab_focus (nbt->desc_entry);
-  } else
-    gtk_widget_grab_focus (nbt->name_entry);
+    /* Show what we should */
+    gtk_widget_show_all (nbt->dialog);
+    if (term)
+    {
+        gtk_widget_grab_focus (nbt->desc_entry);
+    }
+    else
+        gtk_widget_grab_focus (nbt->name_entry);
 
-  done = FALSE;
-  while (!done) {
-    response = gtk_dialog_run (GTK_DIALOG (nbt->dialog));
-    switch (response) {
-     case GTK_RESPONSE_OK:
-      if (new_billterm_ok_cb (nbt)) {
-	created_term = nbt->this_term;
-	done = TRUE;
-      }
-      break;
-     default:
-      done = TRUE;
-      break;
+    done = FALSE;
+    while (!done)
+    {
+        response = gtk_dialog_run (GTK_DIALOG (nbt->dialog));
+        switch (response)
+        {
+        case GTK_RESPONSE_OK:
+            if (new_billterm_ok_cb (nbt))
+            {
+                created_term = nbt->this_term;
+                done = TRUE;
+            }
+            break;
+        default:
+            done = TRUE;
+            break;
+        }
     }
-  }
 
-  gtk_widget_destroy(nbt->dialog);
-  g_free(nbt);
+    gtk_widget_destroy(nbt->dialog);
+    g_free(nbt);
 
-  return created_term;
+    return created_term;
 }
 
 /***********************************************************************/
@@ -449,312 +468,324 @@
 static void
 billterms_term_refresh (BillTermsWindow *btw)
 {
-  char *type_label;
+    char *type_label;
 
-  g_return_if_fail (btw);
+    g_return_if_fail (btw);
 
-  if (!btw->current_term) {
-    gtk_widget_hide_all (btw->term_vbox);
-    return;
-  }
+    if (!btw->current_term)
+    {
+        gtk_widget_hide_all (btw->term_vbox);
+        return;
+    }
 
-  gtk_widget_show_all (btw->term_vbox);
-  billterm_to_ui (btw->current_term, btw->desc_entry, &btw->notebook);
-  switch (gncBillTermGetType (btw->current_term)) {
-  case GNC_TERM_TYPE_DAYS:
-    type_label = _("Days");
-    break;
-  case GNC_TERM_TYPE_PROXIMO:
-    type_label = _("Proximo");
-    break;
-  default:
-    type_label = _("Unknown");
-    break;
-  }
-  show_notebook (&btw->notebook);
-  gtk_label_set_text (GTK_LABEL (btw->type_label), type_label);
+    gtk_widget_show_all (btw->term_vbox);
+    billterm_to_ui (btw->current_term, btw->desc_entry, &btw->notebook);
+    switch (gncBillTermGetType (btw->current_term))
+    {
+    case GNC_TERM_TYPE_DAYS:
+        type_label = _("Days");
+        break;
+    case GNC_TERM_TYPE_PROXIMO:
+        type_label = _("Proximo");
+        break;
+    default:
+        type_label = _("Unknown");
+        break;
+    }
+    show_notebook (&btw->notebook);
+    gtk_label_set_text (GTK_LABEL (btw->type_label), type_label);
 }
 
 static void
 billterms_window_refresh (BillTermsWindow *btw)
 {
-  GList *list, *node;
-  GncBillTerm *term;
-  GtkTreeView *view;
-  GtkListStore *store;
-  GtkTreeIter iter;
-  GtkTreePath *path;
-  GtkTreeSelection *selection;
-  GtkTreeRowReference *reference = NULL;
+    GList *list, *node;
+    GncBillTerm *term;
+    GtkTreeView *view;
+    GtkListStore *store;
+    GtkTreeIter iter;
+    GtkTreePath *path;
+    GtkTreeSelection *selection;
+    GtkTreeRowReference *reference = NULL;
 
-  g_return_if_fail (btw);
-  view = GTK_TREE_VIEW (btw->terms_view);
-  store = GTK_LIST_STORE(gtk_tree_view_get_model(view));
+    g_return_if_fail (btw);
+    view = GTK_TREE_VIEW (btw->terms_view);
+    store = GTK_LIST_STORE(gtk_tree_view_get_model(view));
 
-  /* Clear the list */
-  gtk_list_store_clear (store);
-  gnc_gui_component_clear_watches (btw->component_id);
+    /* Clear the list */
+    gtk_list_store_clear (store);
+    gnc_gui_component_clear_watches (btw->component_id);
 
-  /* Add the items to the list */
-  list = gncBillTermGetTerms (btw->book);
+    /* Add the items to the list */
+    list = gncBillTermGetTerms (btw->book);
 
-  /* If there are no terms, clear the term display */
-  if (list == NULL) {
-    btw->current_term = NULL;
-    billterms_term_refresh (btw);
-  } else {
-    list = g_list_reverse (g_list_copy (list));
-  }
+    /* If there are no terms, clear the term display */
+    if (list == NULL)
+    {
+        btw->current_term = NULL;
+        billterms_term_refresh (btw);
+    }
+    else
+    {
+        list = g_list_reverse (g_list_copy (list));
+    }
 
-  for ( node = list; node; node = node->next) {
-    term = node->data;
-    gnc_gui_component_watch_entity (btw->component_id,
-				    gncBillTermGetGUID (term),
-				    QOF_EVENT_MODIFY);
+    for ( node = list; node; node = node->next)
+    {
+        term = node->data;
+        gnc_gui_component_watch_entity (btw->component_id,
+                                        gncBillTermGetGUID (term),
+                                        QOF_EVENT_MODIFY);
 
-    gtk_list_store_prepend(store, &iter);
-    gtk_list_store_set(store, &iter,
-		       BILL_TERM_COL_NAME, gncBillTermGetName(term),
-		       BILL_TERM_COL_TERM, term,
-		       -1);
-    if (term == btw->current_term) {
-      path = gtk_tree_model_get_path(GTK_TREE_MODEL(store), &iter);
-      reference = gtk_tree_row_reference_new(GTK_TREE_MODEL(store), path);
-      gtk_tree_path_free(path);
+        gtk_list_store_prepend(store, &iter);
+        gtk_list_store_set(store, &iter,
+                           BILL_TERM_COL_NAME, gncBillTermGetName(term),
+                           BILL_TERM_COL_TERM, term,
+                           -1);
+        if (term == btw->current_term)
+        {
+            path = gtk_tree_model_get_path(GTK_TREE_MODEL(store), &iter);
+            reference = gtk_tree_row_reference_new(GTK_TREE_MODEL(store), path);
+            gtk_tree_path_free(path);
+        }
     }
-  }
 
-  g_list_free (list);
+    g_list_free (list);
 
-  gnc_gui_component_watch_entity_type (btw->component_id,
-				       GNC_BILLTERM_MODULE_NAME,
-				       QOF_EVENT_CREATE | QOF_EVENT_DESTROY);
+    gnc_gui_component_watch_entity_type (btw->component_id,
+                                         GNC_BILLTERM_MODULE_NAME,
+                                         QOF_EVENT_CREATE | QOF_EVENT_DESTROY);
 
-  if (reference) {
-    path = gtk_tree_row_reference_get_path(reference);
-    gtk_tree_row_reference_free(reference);
-    if (path) {
-      selection = gtk_tree_view_get_selection(view);
-      gtk_tree_selection_select_path(selection, path);
-      gtk_tree_view_scroll_to_cell(view, path, NULL, TRUE, 0.5, 0.0);
-      gtk_tree_path_free(path);
+    if (reference)
+    {
+        path = gtk_tree_row_reference_get_path(reference);
+        gtk_tree_row_reference_free(reference);
+        if (path)
+        {
+            selection = gtk_tree_view_get_selection(view);
+            gtk_tree_selection_select_path(selection, path);
+            gtk_tree_view_scroll_to_cell(view, path, NULL, TRUE, 0.5, 0.0);
+            gtk_tree_path_free(path);
+        }
     }
-  }
 }
 
 static void
 billterm_selection_changed (GtkTreeSelection *selection,
-			    BillTermsWindow  *btw) 
+                            BillTermsWindow  *btw)
 {
-  GncBillTerm *term = NULL;
-  GtkTreeModel *model;
-  GtkTreeIter iter;
+    GncBillTerm *term = NULL;
+    GtkTreeModel *model;
+    GtkTreeIter iter;
 
-  g_return_if_fail (btw);
+    g_return_if_fail (btw);
 
-  if (gtk_tree_selection_get_selected(selection, &model, &iter))
-    gtk_tree_model_get(model, &iter, BILL_TERM_COL_TERM, &term, -1);
+    if (gtk_tree_selection_get_selected(selection, &model, &iter))
+        gtk_tree_model_get(model, &iter, BILL_TERM_COL_TERM, &term, -1);
 
-  /* If we've changed, then reset the term list */
-  if (term != btw->current_term)
-    btw->current_term = term;
+    /* If we've changed, then reset the term list */
+    if (term != btw->current_term)
+        btw->current_term = term;
 
-  /* And force a refresh of the entries */
-  billterms_term_refresh (btw);
+    /* And force a refresh of the entries */
+    billterms_term_refresh (btw);
 }
 
 static void
 billterm_selection_activated (GtkTreeView       *tree_view,
-			      GtkTreePath       *path,
-			      GtkTreeViewColumn *column,
-			      BillTermsWindow   *btw)
+                              GtkTreePath       *path,
+                              GtkTreeViewColumn *column,
+                              BillTermsWindow   *btw)
 {
-  new_billterm_dialog (btw, btw->current_term, NULL);
+    new_billterm_dialog (btw, btw->current_term, NULL);
 }
 
 void
 billterms_new_term_cb (GtkButton *button, BillTermsWindow *btw)
 {
-  g_return_if_fail (btw);
-  new_billterm_dialog (btw, NULL, NULL);
+    g_return_if_fail (btw);
+    new_billterm_dialog (btw, NULL, NULL);
 }
 
 void
 billterms_delete_term_cb (GtkButton *button, BillTermsWindow *btw)
 {
-  g_return_if_fail (btw);
+    g_return_if_fail (btw);
 
-  if (!btw->current_term)
-    return;
+    if (!btw->current_term)
+        return;
 
-  if (gncBillTermGetRefcount (btw->current_term) > 0) {
-    gnc_error_dialog (btw->dialog,
-		      _("Term \"%s\" is in use.  You cannot delete it."),
-		      gncBillTermGetName (btw->current_term));
-    return;
-  }
+    if (gncBillTermGetRefcount (btw->current_term) > 0)
+    {
+        gnc_error_dialog (btw->dialog,
+                          _("Term \"%s\" is in use.  You cannot delete it."),
+                          gncBillTermGetName (btw->current_term));
+        return;
+    }
 
-  if (gnc_verify_dialog (btw->dialog, FALSE,
-			 _("Are you sure you want to delete \"%s\"?"),
-			 gncBillTermGetName (btw->current_term))) {
-    /* Ok, let's remove it */
-    gnc_suspend_gui_refresh ();
-    gncBillTermBeginEdit (btw->current_term);
-    gncBillTermDestroy (btw->current_term);
-    btw->current_term = NULL;
-    gnc_resume_gui_refresh ();
-  }
+    if (gnc_verify_dialog (btw->dialog, FALSE,
+                           _("Are you sure you want to delete \"%s\"?"),
+                           gncBillTermGetName (btw->current_term)))
+    {
+        /* Ok, let's remove it */
+        gnc_suspend_gui_refresh ();
+        gncBillTermBeginEdit (btw->current_term);
+        gncBillTermDestroy (btw->current_term);
+        btw->current_term = NULL;
+        gnc_resume_gui_refresh ();
+    }
 }
 
 void
 billterms_edit_term_cb (GtkButton *button, BillTermsWindow *btw)
 {
-  g_return_if_fail (btw);
-  if (!btw->current_term)
-    return;
-  new_billterm_dialog (btw, btw->current_term, NULL);
+    g_return_if_fail (btw);
+    if (!btw->current_term)
+        return;
+    new_billterm_dialog (btw, btw->current_term, NULL);
 }
 
 static void
 billterms_window_refresh_handler (GHashTable *changes, gpointer data)
 {
-  BillTermsWindow *btw = data;
+    BillTermsWindow *btw = data;
 
-  g_return_if_fail (data);
-  billterms_window_refresh (btw);
+    g_return_if_fail (data);
+    billterms_window_refresh (btw);
 }
 
 static void
 billterms_window_close_handler (gpointer data)
 {
-  BillTermsWindow *btw = data;
-  g_return_if_fail (btw);
+    BillTermsWindow *btw = data;
+    g_return_if_fail (btw);
 
-  gtk_widget_destroy (btw->dialog);
+    gtk_widget_destroy (btw->dialog);
 }
 
 void
 billterms_window_close (GtkWidget *widget, gpointer data)
 {
-  BillTermsWindow *btw = data;
+    BillTermsWindow *btw = data;
 
-  gnc_ui_billterms_window_destroy (btw);
+    gnc_ui_billterms_window_destroy (btw);
 }
 
 void
 billterms_window_destroy_cb (GtkWidget *widget, gpointer data)
 {
-  BillTermsWindow *btw = data;
+    BillTermsWindow *btw = data;
 
-  if (!btw) return;
+    if (!btw) return;
 
-  gnc_unregister_gui_component (btw->component_id);
+    gnc_unregister_gui_component (btw->component_id);
 
-  g_free (btw);
+    g_free (btw);
 }
 
 static gboolean
 find_handler (gpointer find_data, gpointer user_data)
 {
-  BillTermsWindow *btw = user_data;
-  QofBook *book = find_data;
+    BillTermsWindow *btw = user_data;
+    QofBook *book = find_data;
 
-  return (btw != NULL && btw->book == book);
+    return (btw != NULL && btw->book == book);
 }
 
 /* Create a billterms window */
 BillTermsWindow *
 gnc_ui_billterms_window_new (QofBook *book)
 {
-  BillTermsWindow *btw;
-  GladeXML *xml;
-  GtkWidget *widget;
-  GtkTreeView *view;
-  GtkTreeViewColumn *column;
-  GtkCellRenderer *renderer;
-  GtkListStore *store;
-  GtkTreeSelection *selection;
+    BillTermsWindow *btw;
+    GladeXML *xml;
+    GtkWidget *widget;
+    GtkTreeView *view;
+    GtkTreeViewColumn *column;
+    GtkCellRenderer *renderer;
+    GtkListStore *store;
+    GtkTreeSelection *selection;
 
-  if (!book) return NULL;
+    if (!book) return NULL;
 
-  /*
-   * Find an existing billterm window.  If found, bring it to
-   * the front.  If we have an actual owner, then set it in
-   * the window.
-   */
-  btw = gnc_find_first_gui_component (DIALOG_BILLTERMS_CM_CLASS,
-				      find_handler, book);
-  if (btw) {
-    gtk_window_present (GTK_WINDOW(btw->dialog));
-    return btw;
-  }
+    /*
+     * Find an existing billterm window.  If found, bring it to
+     * the front.  If we have an actual owner, then set it in
+     * the window.
+     */
+    btw = gnc_find_first_gui_component (DIALOG_BILLTERMS_CM_CLASS,
+                                        find_handler, book);
+    if (btw)
+    {
+        gtk_window_present (GTK_WINDOW(btw->dialog));
+        return btw;
+    }
 
-  /* Didn't find one -- create a new window */
-  btw = g_new0 (BillTermsWindow, 1);
-  btw->book = book;
+    /* Didn't find one -- create a new window */
+    btw = g_new0 (BillTermsWindow, 1);
+    btw->book = book;
 
-  /* Open and read the XML */
-  xml = gnc_glade_xml_new ("billterms.glade", "Terms Window");
-  btw->dialog = glade_xml_get_widget (xml, "Terms Window");
-  btw->terms_view = glade_xml_get_widget (xml, "terms_view");
-  btw->desc_entry = glade_xml_get_widget (xml, "desc_entry");
-  btw->type_label = glade_xml_get_widget (xml, "type_label");
-  btw->term_vbox = glade_xml_get_widget (xml, "term_vbox");
+    /* Open and read the XML */
+    xml = gnc_glade_xml_new ("billterms.glade", "Terms Window");
+    btw->dialog = glade_xml_get_widget (xml, "Terms Window");
+    btw->terms_view = glade_xml_get_widget (xml, "terms_view");
+    btw->desc_entry = glade_xml_get_widget (xml, "desc_entry");
+    btw->type_label = glade_xml_get_widget (xml, "type_label");
+    btw->term_vbox = glade_xml_get_widget (xml, "term_vbox");
 
-  /* Initialize the view */
-  view = GTK_TREE_VIEW(btw->terms_view);
-  store = gtk_list_store_new (NUM_BILL_TERM_COLS, G_TYPE_STRING, G_TYPE_POINTER);
-  gtk_tree_view_set_model(view, GTK_TREE_MODEL(store));
-  g_object_unref(store);
+    /* Initialize the view */
+    view = GTK_TREE_VIEW(btw->terms_view);
+    store = gtk_list_store_new (NUM_BILL_TERM_COLS, G_TYPE_STRING, G_TYPE_POINTER);
+    gtk_tree_view_set_model(view, GTK_TREE_MODEL(store));
+    g_object_unref(store);
 
-  renderer = gtk_cell_renderer_text_new();
-  column = gtk_tree_view_column_new_with_attributes("", renderer,
-						    "text", BILL_TERM_COL_NAME,
-						    NULL);
-  gtk_tree_view_append_column(view, column);
+    renderer = gtk_cell_renderer_text_new();
+    column = gtk_tree_view_column_new_with_attributes("", renderer,
+             "text", BILL_TERM_COL_NAME,
+             NULL);
+    gtk_tree_view_append_column(view, column);
 
-  g_signal_connect(view, "row-activated",
-		   G_CALLBACK(billterm_selection_activated), btw);
-  selection = gtk_tree_view_get_selection(view);
-  g_signal_connect(selection, "changed",
-		   G_CALLBACK(billterm_selection_changed), btw);
+    g_signal_connect(view, "row-activated",
+                     G_CALLBACK(billterm_selection_activated), btw);
+    selection = gtk_tree_view_get_selection(view);
+    g_signal_connect(selection, "changed",
+                     G_CALLBACK(billterm_selection_changed), btw);
 
-  /* Initialize the notebook widgets */
-  init_notebook_widgets (&btw->notebook, TRUE,
-			 GTK_DIALOG (btw->dialog), btw);
+    /* Initialize the notebook widgets */
+    init_notebook_widgets (&btw->notebook, TRUE,
+                           GTK_DIALOG (btw->dialog), btw);
 
-  /* Attach the notebook */
-  widget = glade_xml_get_widget (xml, "notebook_box");
-  gtk_box_pack_start (GTK_BOX (widget), btw->notebook.notebook,
-		      TRUE, TRUE, 0);
-  g_object_unref (btw->notebook.notebook);
+    /* Attach the notebook */
+    widget = glade_xml_get_widget (xml, "notebook_box");
+    gtk_box_pack_start (GTK_BOX (widget), btw->notebook.notebook,
+                        TRUE, TRUE, 0);
+    g_object_unref (btw->notebook.notebook);
 
-  /* Setup signals */
-  glade_xml_signal_autoconnect_full( xml,
-                                     gnc_glade_autoconnect_full_func,
-                                     btw);
+    /* Setup signals */
+    glade_xml_signal_autoconnect_full( xml,
+                                       gnc_glade_autoconnect_full_func,
+                                       btw);
 
-  /* register with component manager */
-  btw->component_id =
-    gnc_register_gui_component (DIALOG_BILLTERMS_CM_CLASS,
-				billterms_window_refresh_handler,
-				billterms_window_close_handler,
-				btw);
+    /* register with component manager */
+    btw->component_id =
+        gnc_register_gui_component (DIALOG_BILLTERMS_CM_CLASS,
+                                    billterms_window_refresh_handler,
+                                    billterms_window_close_handler,
+                                    btw);
 
-  gtk_widget_show_all (btw->dialog);
-  billterms_window_refresh (btw);
+    gtk_widget_show_all (btw->dialog);
+    billterms_window_refresh (btw);
 
-  return btw;
+    return btw;
 }
 
 /* Destroy a billterms window */
 void
 gnc_ui_billterms_window_destroy (BillTermsWindow *btw)
 {
-  if (!btw)
-    return;
+    if (!btw)
+        return;
 
-  gnc_close_gui_component (btw->component_id);
+    gnc_close_gui_component (btw->component_id);
 }
 
 #if 0
@@ -762,13 +793,13 @@
 GncBillTerm *
 gnc_ui_billterms_new_from_name (QofBook *book, const char *name)
 {
-  BillTermsWindow *btw;
+    BillTermsWindow *btw;
 
-  if (!book) return NULL;
+    if (!book) return NULL;
 
-  btw = gnc_ui_billterms_window_new (book);
-  if (!btw) return NULL;
+    btw = gnc_ui_billterms_window_new (book);
+    if (!btw) return NULL;
 
-  return new_billterm_dialog (btw, NULL, name);
+    return new_billterm_dialog (btw, NULL, name);
 }
 #endif

Modified: gnucash/trunk/src/business/business-gnome/dialog-choose-owner.c
===================================================================
--- gnucash/trunk/src/business/business-gnome/dialog-choose-owner.c	2010-03-02 21:40:28 UTC (rev 18788)
+++ gnucash/trunk/src/business/business-gnome/dialog-choose-owner.c	2010-03-02 21:41:05 UTC (rev 18789)
@@ -34,71 +34,75 @@
 #include "dialog-choose-owner.h"
 #include "business-gnome-utils.h"
 
-struct _choose_owner_dialog {
-  GtkWidget *	dialog;
-  GtkWidget *	owner_choice;
-  QofBook *	book;
-  GncOwner	owner;
-  Split *	split;
+struct _choose_owner_dialog
+{
+    GtkWidget *	dialog;
+    GtkWidget *	owner_choice;
+    QofBook *	book;
+    GncOwner	owner;
+    Split *	split;
 };
 
 static DialogChooseOwner *
 gcoi_create_dialog(Split* split)
 {
-  DialogChooseOwner* dco;
-  GladeXML *xml;
-  GtkWidget *widget, *box;
+    DialogChooseOwner* dco;
+    GladeXML *xml;
+    GtkWidget *widget, *box;
 
-  g_return_val_if_fail(split, NULL);
+    g_return_val_if_fail(split, NULL);
 
-  dco = g_new0(DialogChooseOwner, 1);
-  g_assert(dco);
-  dco->book = qof_instance_get_book(QOF_INSTANCE(split));
-  dco->split = split;
+    dco = g_new0(DialogChooseOwner, 1);
+    g_assert(dco);
+    dco->book = qof_instance_get_book(QOF_INSTANCE(split));
+    dco->split = split;
 
-  /* Open the Glade file */
-  xml = gnc_glade_xml_new("choose-owner.glade", "Choose Owner Dialog");
-  g_assert(xml);
+    /* Open the Glade file */
+    xml = gnc_glade_xml_new("choose-owner.glade", "Choose Owner Dialog");
+    g_assert(xml);
 
-  /* Get the dialog handle */
-  dco->dialog = glade_xml_get_widget(xml, "Choose Owner Dialog");
-  g_assert(dco->dialog);
+    /* Get the dialog handle */
+    dco->dialog = glade_xml_get_widget(xml, "Choose Owner Dialog");
+    g_assert(dco->dialog);
 
-  /* Get the title widget and set the title */
-  widget = glade_xml_get_widget(xml, "title_label");
-  if (1 == 1) {
-    gncOwnerInitCustomer(&(dco->owner), NULL);
+    /* Get the title widget and set the title */
+    widget = glade_xml_get_widget(xml, "title_label");
+    if (1 == 1)
+    {
+        gncOwnerInitCustomer(&(dco->owner), NULL);
+        gtk_label_set_text(GTK_LABEL(widget),
+                           _("This transaction needs to be assigned to a Customer."
+                             "  Please choose the Customer below."));
+    }
+    else
+    {
+        gncOwnerInitVendor(&(dco->owner), NULL);
+        gtk_label_set_text(GTK_LABEL(widget),
+                           _("This transaction needs to be assigned to a Vendor."
+                             "  Please choose the Vendor below."));
+    }
+
+    /* Get the transaction description and set it */
+    widget = glade_xml_get_widget(xml, "desc_label");
     gtk_label_set_text(GTK_LABEL(widget),
-		       _("This transaction needs to be assigned to a Customer."
-			 "  Please choose the Customer below."));
-  } else {
-    gncOwnerInitVendor(&(dco->owner), NULL);
-    gtk_label_set_text(GTK_LABEL(widget),
-		       _("This transaction needs to be assigned to a Vendor."
-			 "  Please choose the Vendor below."));
-  }
+                       xaccTransGetDescription(xaccSplitGetParent(split)));
 
-  /* Get the transaction description and set it */
-  widget = glade_xml_get_widget(xml, "desc_label");
-  gtk_label_set_text(GTK_LABEL(widget),
-		     xaccTransGetDescription(xaccSplitGetParent(split)));
+    /* Get the owner label and the owner box */
+    widget = glade_xml_get_widget(xml, "owner_label");
+    box = glade_xml_get_widget(xml, "owner_box");
+    dco->owner_choice = gnc_owner_select_create(widget, box, dco->book,
+                        &(dco->owner));
 
-  /* Get the owner label and the owner box */
-  widget = glade_xml_get_widget(xml, "owner_label");
-  box = glade_xml_get_widget(xml, "owner_box");
-  dco->owner_choice = gnc_owner_select_create(widget, box, dco->book,
-					      &(dco->owner));
-
-  gtk_widget_show_all(dco->dialog);
-  return dco;
+    gtk_widget_show_all(dco->dialog);
+    return dco;
 }
 
 
 gboolean
 gnc_split_assign_owner(GtkWidget* window, Split* split)
 {
-  if (1 == 0)
-    gcoi_create_dialog(split);
+    if (1 == 0)
+        gcoi_create_dialog(split);
 
-  return FALSE;
+    return FALSE;
 }

Modified: gnucash/trunk/src/business/business-gnome/dialog-customer.c
===================================================================
--- gnucash/trunk/src/business/business-gnome/dialog-customer.c	2010-03-02 21:40:28 UTC (rev 18788)
+++ gnucash/trunk/src/business/business-gnome/dialog-customer.c	2010-03-02 21:41:05 UTC (rev 18789)
@@ -55,7 +55,7 @@
 #define GCONF_SECTION_SEARCH "dialogs/business/customer_search"
 
 void gnc_customer_taxtable_check_cb (GtkToggleButton *togglebutton,
-				     gpointer user_data);
+                                     gpointer user_data);
 
 void gnc_customer_window_ok_cb (GtkWidget *widget, gpointer data);
 void gnc_customer_window_cancel_cb (GtkWidget *widget, gpointer data);
@@ -65,591 +65,609 @@
 
 typedef enum
 {
-  NEW_CUSTOMER,
-  EDIT_CUSTOMER
+    NEW_CUSTOMER,
+    EDIT_CUSTOMER
 } CustomerDialogType;
 
-struct _customer_select_window {
-  QofBook *	book;
-  QueryNew *	q;
+struct _customer_select_window
+{
+    QofBook *	book;
+    QueryNew *	q;
 };
 
-struct _customer_window {
-  GtkWidget *	dialog;
+struct _customer_window
+{
+    GtkWidget *	dialog;
 
-  GtkWidget *	id_entry;
-  GtkWidget *	company_entry;
+    GtkWidget *	id_entry;
+    GtkWidget *	company_entry;
 
-  GtkWidget *	name_entry;
-  GtkWidget *	addr1_entry;
-  GtkWidget *	addr2_entry;
-  GtkWidget *	addr3_entry;
-  GtkWidget *	addr4_entry;
-  GtkWidget *	phone_entry;
-  GtkWidget *	fax_entry;
-  GtkWidget *	email_entry;
+    GtkWidget *	name_entry;
+    GtkWidget *	addr1_entry;
+    GtkWidget *	addr2_entry;
+    GtkWidget *	addr3_entry;
+    GtkWidget *	addr4_entry;
+    GtkWidget *	phone_entry;
+    GtkWidget *	fax_entry;
+    GtkWidget *	email_entry;
 
-  GtkWidget *	shipname_entry;
-  GtkWidget *	shipaddr1_entry;
-  GtkWidget *	shipaddr2_entry;
-  GtkWidget *	shipaddr3_entry;
-  GtkWidget *	shipaddr4_entry;
-  GtkWidget *	shipphone_entry;
-  GtkWidget *	shipfax_entry;
-  GtkWidget *	shipemail_entry;
+    GtkWidget *	shipname_entry;
+    GtkWidget *	shipaddr1_entry;
+    GtkWidget *	shipaddr2_entry;
+    GtkWidget *	shipaddr3_entry;
+    GtkWidget *	shipaddr4_entry;
+    GtkWidget *	shipphone_entry;
+    GtkWidget *	shipfax_entry;
+    GtkWidget *	shipemail_entry;
 
-  GtkWidget *	currency_edit;
-  GtkWidget *	terms_menu;
-  GtkWidget *	discount_amount;
-  GtkWidget *	credit_amount;
+    GtkWidget *	currency_edit;
+    GtkWidget *	terms_menu;
+    GtkWidget *	discount_amount;
+    GtkWidget *	credit_amount;
 
-  GtkWidget *	active_check;
-  GtkWidget *	taxincluded_menu;
-  GtkWidget *	notes_text;
+    GtkWidget *	active_check;
+    GtkWidget *	taxincluded_menu;
+    GtkWidget *	notes_text;
 
-  GtkWidget *	taxtable_check;
-  GtkWidget *	taxtable_menu;
+    GtkWidget *	taxtable_check;
+    GtkWidget *	taxtable_menu;
 
-  GncTaxIncluded taxincluded;
-  GncBillTerm *	terms;
-  CustomerDialogType	dialog_type;
-  GUID		customer_guid;
-  gint		component_id;
-  QofBook *	book;
-  GncCustomer *	created_customer;
+    GncTaxIncluded taxincluded;
+    GncBillTerm *	terms;
+    CustomerDialogType	dialog_type;
+    GUID		customer_guid;
+    gint		component_id;
+    QofBook *	book;
+    GncCustomer *	created_customer;
 
-  GncTaxTable *	taxtable;
+    GncTaxTable *	taxtable;
 };
 
 void
 gnc_customer_taxtable_check_cb (GtkToggleButton *togglebutton,
-				gpointer user_data)
+                                gpointer user_data)
 {
-  CustomerWindow *cw = user_data;
+    CustomerWindow *cw = user_data;
 
-  if (gtk_toggle_button_get_active (togglebutton))
-    gtk_widget_set_sensitive (cw->taxtable_menu, TRUE);
-  else
-    gtk_widget_set_sensitive (cw->taxtable_menu, FALSE);
+    if (gtk_toggle_button_get_active (togglebutton))
+        gtk_widget_set_sensitive (cw->taxtable_menu, TRUE);
+    else
+        gtk_widget_set_sensitive (cw->taxtable_menu, FALSE);
 }
 
 static GncCustomer *
 cw_get_customer (CustomerWindow *cw)
 {
-  if (!cw)
-    return NULL;
+    if (!cw)
+        return NULL;
 
-  return gncCustomerLookup (cw->book, &cw->customer_guid);
+    return gncCustomerLookup (cw->book, &cw->customer_guid);
 }
 
 static void gnc_ui_to_customer (CustomerWindow *cw, GncCustomer *cust)
 {
-  GtkTextBuffer* text_buffer;
-  GtkTextIter start, end;
-  gchar *text;
-  GncAddress *addr, *shipaddr;
+    GtkTextBuffer* text_buffer;
+    GtkTextIter start, end;
+    gchar *text;
+    GncAddress *addr, *shipaddr;
 
-  addr = gncCustomerGetAddr (cust);
-  shipaddr = gncCustomerGetShipAddr (cust);
+    addr = gncCustomerGetAddr (cust);
+    shipaddr = gncCustomerGetShipAddr (cust);
 
-  gnc_suspend_gui_refresh ();
+    gnc_suspend_gui_refresh ();
 
-  gncCustomerBeginEdit (cust);
+    gncCustomerBeginEdit (cust);
 
-  gncCustomerSetID (cust, gtk_editable_get_chars
-		    (GTK_EDITABLE (cw->id_entry), 0, -1));
-  gncCustomerSetName (cust, gtk_editable_get_chars
-		      (GTK_EDITABLE (cw->company_entry), 0, -1));
+    gncCustomerSetID (cust, gtk_editable_get_chars
+                      (GTK_EDITABLE (cw->id_entry), 0, -1));
+    gncCustomerSetName (cust, gtk_editable_get_chars
+                        (GTK_EDITABLE (cw->company_entry), 0, -1));
 
-  gncAddressSetName (addr, gtk_editable_get_chars
-		     (GTK_EDITABLE (cw->name_entry), 0, -1));
-  gncAddressSetAddr1 (addr, gtk_editable_get_chars
-		      (GTK_EDITABLE (cw->addr1_entry), 0, -1));
-  gncAddressSetAddr2 (addr, gtk_editable_get_chars
-		      (GTK_EDITABLE (cw->addr2_entry), 0, -1));
-  gncAddressSetAddr3 (addr, gtk_editable_get_chars
-		      (GTK_EDITABLE (cw->addr3_entry), 0, -1));
-  gncAddressSetAddr4 (addr, gtk_editable_get_chars
-		      (GTK_EDITABLE (cw->addr4_entry), 0, -1));
-  gncAddressSetPhone (addr, gtk_editable_get_chars
-		      (GTK_EDITABLE (cw->phone_entry), 0, -1));
-  gncAddressSetFax (addr, gtk_editable_get_chars
-		    (GTK_EDITABLE (cw->fax_entry), 0, -1));
-  gncAddressSetEmail (addr, gtk_editable_get_chars
-		      (GTK_EDITABLE (cw->email_entry), 0, -1));
+    gncAddressSetName (addr, gtk_editable_get_chars
+                       (GTK_EDITABLE (cw->name_entry), 0, -1));
+    gncAddressSetAddr1 (addr, gtk_editable_get_chars
+                        (GTK_EDITABLE (cw->addr1_entry), 0, -1));
+    gncAddressSetAddr2 (addr, gtk_editable_get_chars
+                        (GTK_EDITABLE (cw->addr2_entry), 0, -1));
+    gncAddressSetAddr3 (addr, gtk_editable_get_chars
+                        (GTK_EDITABLE (cw->addr3_entry), 0, -1));
+    gncAddressSetAddr4 (addr, gtk_editable_get_chars
+                        (GTK_EDITABLE (cw->addr4_entry), 0, -1));
+    gncAddressSetPhone (addr, gtk_editable_get_chars
+                        (GTK_EDITABLE (cw->phone_entry), 0, -1));
+    gncAddressSetFax (addr, gtk_editable_get_chars
+                      (GTK_EDITABLE (cw->fax_entry), 0, -1));
+    gncAddressSetEmail (addr, gtk_editable_get_chars
+                        (GTK_EDITABLE (cw->email_entry), 0, -1));
 
-  gncAddressSetName (shipaddr, gtk_editable_get_chars
-		     (GTK_EDITABLE (cw->shipname_entry), 0, -1));
-  gncAddressSetAddr1 (shipaddr, gtk_editable_get_chars
-		      (GTK_EDITABLE (cw->shipaddr1_entry), 0, -1));
-  gncAddressSetAddr2 (shipaddr, gtk_editable_get_chars
-		      (GTK_EDITABLE (cw->shipaddr2_entry), 0, -1));
-  gncAddressSetAddr3 (shipaddr, gtk_editable_get_chars
-		      (GTK_EDITABLE (cw->shipaddr3_entry), 0, -1));
-  gncAddressSetAddr4 (shipaddr, gtk_editable_get_chars
-		      (GTK_EDITABLE (cw->shipaddr4_entry), 0, -1));
-  gncAddressSetPhone (shipaddr, gtk_editable_get_chars
-		      (GTK_EDITABLE (cw->shipphone_entry), 0, -1));
-  gncAddressSetFax (shipaddr, gtk_editable_get_chars
-		    (GTK_EDITABLE (cw->shipfax_entry), 0, -1));
-  gncAddressSetEmail (shipaddr, gtk_editable_get_chars
-		      (GTK_EDITABLE (cw->shipemail_entry), 0, -1));
+    gncAddressSetName (shipaddr, gtk_editable_get_chars
+                       (GTK_EDITABLE (cw->shipname_entry), 0, -1));
+    gncAddressSetAddr1 (shipaddr, gtk_editable_get_chars
+                        (GTK_EDITABLE (cw->shipaddr1_entry), 0, -1));
+    gncAddressSetAddr2 (shipaddr, gtk_editable_get_chars
+                        (GTK_EDITABLE (cw->shipaddr2_entry), 0, -1));
+    gncAddressSetAddr3 (shipaddr, gtk_editable_get_chars
+                        (GTK_EDITABLE (cw->shipaddr3_entry), 0, -1));
+    gncAddressSetAddr4 (shipaddr, gtk_editable_get_chars
+                        (GTK_EDITABLE (cw->shipaddr4_entry), 0, -1));
+    gncAddressSetPhone (shipaddr, gtk_editable_get_chars
+                        (GTK_EDITABLE (cw->shipphone_entry), 0, -1));
+    gncAddressSetFax (shipaddr, gtk_editable_get_chars
+                      (GTK_EDITABLE (cw->shipfax_entry), 0, -1));
+    gncAddressSetEmail (shipaddr, gtk_editable_get_chars
+                        (GTK_EDITABLE (cw->shipemail_entry), 0, -1));
 
-  gncCustomerSetActive (cust, gtk_toggle_button_get_active
-			(GTK_TOGGLE_BUTTON (cw->active_check)));
-  gncCustomerSetTaxIncluded (cust, cw->taxincluded);
+    gncCustomerSetActive (cust, gtk_toggle_button_get_active
+                          (GTK_TOGGLE_BUTTON (cw->active_check)));
+    gncCustomerSetTaxIncluded (cust, cw->taxincluded);
 
-  text_buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW(cw->notes_text));
-  gtk_text_buffer_get_bounds (text_buffer, &start, &end);
-  text = gtk_text_buffer_get_text (text_buffer, &start, &end, FALSE);
-  gncCustomerSetNotes (cust, text);
+    text_buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW(cw->notes_text));
+    gtk_text_buffer_get_bounds (text_buffer, &start, &end);
+    text = gtk_text_buffer_get_text (text_buffer, &start, &end, FALSE);
+    gncCustomerSetNotes (cust, text);
 
-  /* Parse and set the currency, terms, discount, and credit amounts */
-  gncCustomerSetCurrency (cust,
-			  gnc_currency_edit_get_currency (GNC_CURRENCY_EDIT
-							     (cw->currency_edit)));
-  gncCustomerSetTerms (cust, cw->terms);
-  gncCustomerSetDiscount (cust, gnc_amount_edit_get_amount
-			  (GNC_AMOUNT_EDIT (cw->discount_amount)));
-  gncCustomerSetCredit (cust, gnc_amount_edit_get_amount
-			(GNC_AMOUNT_EDIT (cw->credit_amount)));
+    /* Parse and set the currency, terms, discount, and credit amounts */
+    gncCustomerSetCurrency (cust,
+                            gnc_currency_edit_get_currency (GNC_CURRENCY_EDIT
+                                    (cw->currency_edit)));
+    gncCustomerSetTerms (cust, cw->terms);
+    gncCustomerSetDiscount (cust, gnc_amount_edit_get_amount
+                            (GNC_AMOUNT_EDIT (cw->discount_amount)));
+    gncCustomerSetCredit (cust, gnc_amount_edit_get_amount
+                          (GNC_AMOUNT_EDIT (cw->credit_amount)));
 
-  gncCustomerSetTaxTableOverride
+    gncCustomerSetTaxTableOverride
     (cust, gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (cw->taxtable_check)));
-  gncCustomerSetTaxTable (cust, cw->taxtable);
+    gncCustomerSetTaxTable (cust, cw->taxtable);
 
-  gncCustomerCommitEdit (cust);
-  gnc_resume_gui_refresh ();
+    gncCustomerCommitEdit (cust);
+    gnc_resume_gui_refresh ();
 }
 
 static gboolean check_edit_amount (GtkWidget *dialog, GtkWidget *amount,
-				   gnc_numeric *min, gnc_numeric *max,
-				   const char * error_message)
+                                   gnc_numeric *min, gnc_numeric *max,
+                                   const char * error_message)
 {
-  if (!gnc_amount_edit_evaluate (GNC_AMOUNT_EDIT (amount))) {
-    if (error_message)
-      gnc_error_dialog (dialog, "%s", error_message);
-    return TRUE;
-  }
-  /* We've got a valid-looking number; check mix/max */
-  if (min || max) {
-    gnc_numeric val = gnc_amount_edit_get_amount (GNC_AMOUNT_EDIT (amount));
-    if ((min && gnc_numeric_compare (*min, val) > 0) ||
-	(max && gnc_numeric_compare (val, *max) > 0)) {
-      if (error_message)
-	gnc_error_dialog (dialog, "%s", error_message);
-      return TRUE;
+    if (!gnc_amount_edit_evaluate (GNC_AMOUNT_EDIT (amount)))
+    {
+        if (error_message)
+            gnc_error_dialog (dialog, "%s", error_message);
+        return TRUE;
     }
-  }
-  return FALSE;
+    /* We've got a valid-looking number; check mix/max */
+    if (min || max)
+    {
+        gnc_numeric val = gnc_amount_edit_get_amount (GNC_AMOUNT_EDIT (amount));
+        if ((min && gnc_numeric_compare (*min, val) > 0) ||
+                (max && gnc_numeric_compare (val, *max) > 0))
+        {
+            if (error_message)
+                gnc_error_dialog (dialog, "%s", error_message);
+            return TRUE;
+        }
+    }
+    return FALSE;
 }
 
-static gboolean check_entry_nonempty (GtkWidget *dialog, GtkWidget *entry, 
-				      const char * error_message)
+static gboolean check_entry_nonempty (GtkWidget *dialog, GtkWidget *entry,
+                                      const char * error_message)
 {
-  const char *res = gtk_entry_get_text (GTK_ENTRY (entry));
-  if (safe_strcmp (res, "") == 0) {
-    if (error_message)
-      gnc_error_dialog (dialog, "%s", error_message);
-    return TRUE;
-  }
-  return FALSE;
+    const char *res = gtk_entry_get_text (GTK_ENTRY (entry));
+    if (safe_strcmp (res, "") == 0)
+    {
+        if (error_message)
+            gnc_error_dialog (dialog, "%s", error_message);
+        return TRUE;
+    }
+    return FALSE;
 }
 
 void
 gnc_customer_window_ok_cb (GtkWidget *widget, gpointer data)
 {
-  CustomerWindow *cw = data;
-  gnc_numeric min, max;
-  gchar *string;
+    CustomerWindow *cw = data;
+    gnc_numeric min, max;
+    gchar *string;
 
-  /* Check for valid company name */
-  if (check_entry_nonempty (cw->dialog, cw->company_entry,
-		   _("You must enter a company name. "
-		     "If this customer is an individual (and not a company) "
-		     "you should set the \"company name\" and \"contact name\" "
-		     "the same.")))
-    return;
+    /* Check for valid company name */
+    if (check_entry_nonempty (cw->dialog, cw->company_entry,
+                              _("You must enter a company name. "
+                                "If this customer is an individual (and not a company) "
+                                "you should set the \"company name\" and \"contact name\" "
+                                "the same.")))
+        return;
 
-  /* Make sure we have an address */
-  if (check_entry_nonempty (cw->dialog, cw->addr1_entry, NULL) &&
-      check_entry_nonempty (cw->dialog, cw->addr2_entry, NULL) &&
-      check_entry_nonempty (cw->dialog, cw->addr3_entry, NULL) &&
-      check_entry_nonempty (cw->dialog, cw->addr4_entry, NULL)) {
-    const char *msg = _("You must enter a billing address.");
-    gnc_error_dialog (cw->dialog, "%s", msg);
-    return;
-  }
+    /* Make sure we have an address */
+    if (check_entry_nonempty (cw->dialog, cw->addr1_entry, NULL) &&
+            check_entry_nonempty (cw->dialog, cw->addr2_entry, NULL) &&
+            check_entry_nonempty (cw->dialog, cw->addr3_entry, NULL) &&
+            check_entry_nonempty (cw->dialog, cw->addr4_entry, NULL))
+    {
+        const char *msg = _("You must enter a billing address.");
+        gnc_error_dialog (cw->dialog, "%s", msg);
+        return;
+    }
 
-  /* Verify terms, discount, and credit are valid (or empty) */
-  min = gnc_numeric_zero ();
-  max = gnc_numeric_create (100, 1);
+    /* Verify terms, discount, and credit are valid (or empty) */
+    min = gnc_numeric_zero ();
+    max = gnc_numeric_create (100, 1);
 
-  if (check_edit_amount (cw->dialog, cw->discount_amount, &min, &max,
-			 _("Discount percentage must be between 0-100 "
-			   "or you must leave it blank.")))
-    return;
+    if (check_edit_amount (cw->dialog, cw->discount_amount, &min, &max,
+                           _("Discount percentage must be between 0-100 "
+                             "or you must leave it blank.")))
+        return;
 
-  if (check_edit_amount (cw->dialog, cw->credit_amount, &min, NULL,
-			 _("Credit must be a positive amount or "
-			   "you must leave it blank.")))
-    return;
+    if (check_edit_amount (cw->dialog, cw->credit_amount, &min, NULL,
+                           _("Credit must be a positive amount or "
+                             "you must leave it blank.")))
+        return;
 
-  /* Set the customer id if one has not been chosen */
-  if (safe_strcmp (gtk_entry_get_text (GTK_ENTRY (cw->id_entry)), "") == 0) {
-    string = g_strdup_printf ("%.6" G_GINT64_FORMAT,
-			      gncCustomerNextID (cw->book));
-    gtk_entry_set_text (GTK_ENTRY (cw->id_entry), string);
-    g_free(string);
-  }
+    /* Set the customer id if one has not been chosen */
+    if (safe_strcmp (gtk_entry_get_text (GTK_ENTRY (cw->id_entry)), "") == 0)
+    {
+        string = g_strdup_printf ("%.6" G_GINT64_FORMAT,
+                                  gncCustomerNextID (cw->book));
+        gtk_entry_set_text (GTK_ENTRY (cw->id_entry), string);
+        g_free(string);
+    }
 
-  /* Now save it off */
-  {
-    GncCustomer *customer = cw_get_customer (cw);
-    if (customer) {
-      gnc_ui_to_customer (cw, customer);
+    /* Now save it off */
+    {
+        GncCustomer *customer = cw_get_customer (cw);
+        if (customer)
+        {
+            gnc_ui_to_customer (cw, customer);
+        }
+        cw->created_customer = customer;
+        cw->customer_guid = *xaccGUIDNULL ();
     }
-    cw->created_customer = customer;
-    cw->customer_guid = *xaccGUIDNULL ();
-  }
 
-  gnc_close_gui_component (cw->component_id);
+    gnc_close_gui_component (cw->component_id);
 }
 
 void
 gnc_customer_window_cancel_cb (GtkWidget *widget, gpointer data)
 {
-  CustomerWindow *cw = data;
+    CustomerWindow *cw = data;
 
-  gnc_close_gui_component (cw->component_id);
+    gnc_close_gui_component (cw->component_id);
 }
 
 void
 gnc_customer_window_help_cb (GtkWidget *widget, gpointer data)
 {
-  gnc_gnome_help(HF_HELP, HL_USAGE);
+    gnc_gnome_help(HF_HELP, HL_USAGE);
 }
 
 void
 gnc_customer_window_destroy_cb (GtkWidget *widget, gpointer data)
 {
-  CustomerWindow *cw = data;
-  GncCustomer *customer = cw_get_customer (cw);
+    CustomerWindow *cw = data;
+    GncCustomer *customer = cw_get_customer (cw);
 
-  gnc_suspend_gui_refresh ();
+    gnc_suspend_gui_refresh ();
 
-  if (cw->dialog_type == NEW_CUSTOMER && customer != NULL) {
-    gncCustomerBeginEdit (customer);
-    gncCustomerDestroy (customer);
-    cw->customer_guid = *xaccGUIDNULL ();
-  }
+    if (cw->dialog_type == NEW_CUSTOMER && customer != NULL)
+    {
+        gncCustomerBeginEdit (customer);
+        gncCustomerDestroy (customer);
+        cw->customer_guid = *xaccGUIDNULL ();
+    }
 
-  gnc_unregister_gui_component (cw->component_id);
-  gnc_resume_gui_refresh ();
+    gnc_unregister_gui_component (cw->component_id);
+    gnc_resume_gui_refresh ();
 
-  g_free (cw);
+    g_free (cw);
 }
 
 void
 gnc_customer_name_changed_cb (GtkWidget *widget, gpointer data)
 {
-  CustomerWindow *cw = data;
-  char *fullname, *title;
-  const char *id,  *name;
+    CustomerWindow *cw = data;
+    char *fullname, *title;
+    const char *id,  *name;
 
-  if (!cw)
-    return;
+    if (!cw)
+        return;
 
-  name = gtk_entry_get_text (GTK_ENTRY (cw->company_entry));
-  if (!name || *name == '\0')
-    name = _("<No name>");
+    name = gtk_entry_get_text (GTK_ENTRY (cw->company_entry));
+    if (!name || *name == '\0')
+        name = _("<No name>");
 
-  id = gtk_entry_get_text (GTK_ENTRY (cw->id_entry));
+    id = gtk_entry_get_text (GTK_ENTRY (cw->id_entry));
 
-  fullname = g_strconcat (name, " (", id, ")", (char *)NULL);
+    fullname = g_strconcat (name, " (", id, ")", (char *)NULL);
 
-  if (cw->dialog_type == EDIT_CUSTOMER)
-    title = g_strconcat (_("Edit Customer"), " - ", fullname, (char *)NULL);
-  else
-    title = g_strconcat (_("New Customer"), " - ", fullname, (char *)NULL);
+    if (cw->dialog_type == EDIT_CUSTOMER)
+        title = g_strconcat (_("Edit Customer"), " - ", fullname, (char *)NULL);
+    else
+        title = g_strconcat (_("New Customer"), " - ", fullname, (char *)NULL);
 
-  gtk_window_set_title (GTK_WINDOW (cw->dialog), title);
+    gtk_window_set_title (GTK_WINDOW (cw->dialog), title);
 
-  g_free (fullname);
-  g_free (title);
+    g_free (fullname);
+    g_free (title);
 }
 
 static void
 gnc_customer_window_close_handler (gpointer user_data)
 {
-  CustomerWindow *cw = user_data;
+    CustomerWindow *cw = user_data;
 
-  gtk_widget_destroy (cw->dialog);
-  // cw has already been freed by this point.
-  // cw->dialog = NULL;
+    gtk_widget_destroy (cw->dialog);
+    // cw has already been freed by this point.
+    // cw->dialog = NULL;
 }
 
 static void
 gnc_customer_window_refresh_handler (GHashTable *changes, gpointer user_data)
 {
-  CustomerWindow *cw = user_data;
-  const EventInfo *info;
-  GncCustomer *customer = cw_get_customer (cw);
+    CustomerWindow *cw = user_data;
+    const EventInfo *info;
+    GncCustomer *customer = cw_get_customer (cw);
 
-  /* If there isn't a customer behind us, close down */
-  if (!customer) {
-    gnc_close_gui_component (cw->component_id);
-    return;
-  }
+    /* If there isn't a customer behind us, close down */
+    if (!customer)
+    {
+        gnc_close_gui_component (cw->component_id);
+        return;
+    }
 
-  /* Next, close if this is a destroy event */
-  if (changes) {
-    info = gnc_gui_get_entity_events (changes, &cw->customer_guid);
-    if (info && (info->event_mask & QOF_EVENT_DESTROY)) {
-      gnc_close_gui_component (cw->component_id);
-      return;
+    /* Next, close if this is a destroy event */
+    if (changes)
+    {
+        info = gnc_gui_get_entity_events (changes, &cw->customer_guid);
+        if (info && (info->event_mask & QOF_EVENT_DESTROY))
+        {
+            gnc_close_gui_component (cw->component_id);
+            return;
+        }
     }
-  }
 }
 
 static gboolean
 find_handler (gpointer find_data, gpointer user_data)
 {
-  const GUID *customer_guid = find_data;
-  CustomerWindow *cw = user_data;
+    const GUID *customer_guid = find_data;
+    CustomerWindow *cw = user_data;
 
-  return(cw && guid_equal(&cw->customer_guid, customer_guid));
+    return(cw && guid_equal(&cw->customer_guid, customer_guid));
 }
 
 static CustomerWindow *
 gnc_customer_new_window (QofBook *bookp, GncCustomer *cust)
 {
-  CustomerWindow *cw;
-  GladeXML *xml;
-  GtkWidget *hbox, *edit;
-  gnc_commodity *currency;
-  GNCPrintAmountInfo print_info;
-  
-  /*
-   * Find an existing window for this customer.  If found, bring it to
-   * the front.
-   */
-  if (cust) {
-    GUID customer_guid;
+    CustomerWindow *cw;
+    GladeXML *xml;
+    GtkWidget *hbox, *edit;
+    gnc_commodity *currency;
+    GNCPrintAmountInfo print_info;
 
-    customer_guid = *gncCustomerGetGUID(cust);
-    cw = gnc_find_first_gui_component (DIALOG_EDIT_CUSTOMER_CM_CLASS,
-				       find_handler, &customer_guid);
-    if (cw) {
-      gtk_window_present (GTK_WINDOW(cw->dialog));
-      return(cw);
+    /*
+     * Find an existing window for this customer.  If found, bring it to
+     * the front.
+     */
+    if (cust)
+    {
+        GUID customer_guid;
+
+        customer_guid = *gncCustomerGetGUID(cust);
+        cw = gnc_find_first_gui_component (DIALOG_EDIT_CUSTOMER_CM_CLASS,
+                                           find_handler, &customer_guid);
+        if (cw)
+        {
+            gtk_window_present (GTK_WINDOW(cw->dialog));
+            return(cw);
+        }
     }
-  }
-  
-  /* Find the default currency */
-  if (cust)
-    currency = gncCustomerGetCurrency (cust);
-  else
-    currency = gnc_default_currency ();
 
-  /*
-   * No existing customer window found.  Build a new one.
-   */
-  cw = g_new0 (CustomerWindow, 1);
+    /* Find the default currency */
+    if (cust)
+        currency = gncCustomerGetCurrency (cust);
+    else
+        currency = gnc_default_currency ();
 
-  cw->book = bookp;
+    /*
+     * No existing customer window found.  Build a new one.
+     */
+    cw = g_new0 (CustomerWindow, 1);
 
-  /* Find the dialog */
-  xml = gnc_glade_xml_new ("customer.glade", "Customer Dialog");
-  cw->dialog = glade_xml_get_widget (xml, "Customer Dialog");
+    cw->book = bookp;
 
-  g_object_set_data (G_OBJECT (cw->dialog), "dialog_info", cw);
+    /* Find the dialog */
+    xml = gnc_glade_xml_new ("customer.glade", "Customer Dialog");
+    cw->dialog = glade_xml_get_widget (xml, "Customer Dialog");
 
-  /* Get entry points */
-  cw->id_entry = glade_xml_get_widget (xml, "id_entry");
-  cw->company_entry = glade_xml_get_widget (xml, "company_entry");
+    g_object_set_data (G_OBJECT (cw->dialog), "dialog_info", cw);
 
-  cw->name_entry = glade_xml_get_widget (xml, "name_entry");
-  cw->addr1_entry = glade_xml_get_widget (xml, "addr1_entry");
-  cw->addr2_entry = glade_xml_get_widget (xml, "addr2_entry");
-  cw->addr3_entry = glade_xml_get_widget (xml, "addr3_entry");
-  cw->addr4_entry = glade_xml_get_widget (xml, "addr4_entry");
-  cw->phone_entry = glade_xml_get_widget (xml, "phone_entry");
-  cw->fax_entry = glade_xml_get_widget (xml, "fax_entry");
-  cw->email_entry = glade_xml_get_widget (xml, "email_entry");
+    /* Get entry points */
+    cw->id_entry = glade_xml_get_widget (xml, "id_entry");
+    cw->company_entry = glade_xml_get_widget (xml, "company_entry");
 
-  cw->shipname_entry = glade_xml_get_widget (xml, "shipname_entry");
-  cw->shipaddr1_entry = glade_xml_get_widget (xml, "shipaddr1_entry");
-  cw->shipaddr2_entry = glade_xml_get_widget (xml, "shipaddr2_entry");
-  cw->shipaddr3_entry = glade_xml_get_widget (xml, "shipaddr3_entry");
-  cw->shipaddr4_entry = glade_xml_get_widget (xml, "shipaddr4_entry");
-  cw->shipphone_entry = glade_xml_get_widget (xml, "shipphone_entry");
-  cw->shipfax_entry = glade_xml_get_widget (xml, "shipfax_entry");
-  cw->shipemail_entry = glade_xml_get_widget (xml, "shipemail_entry");
+    cw->name_entry = glade_xml_get_widget (xml, "name_entry");
+    cw->addr1_entry = glade_xml_get_widget (xml, "addr1_entry");
+    cw->addr2_entry = glade_xml_get_widget (xml, "addr2_entry");
+    cw->addr3_entry = glade_xml_get_widget (xml, "addr3_entry");
+    cw->addr4_entry = glade_xml_get_widget (xml, "addr4_entry");
+    cw->phone_entry = glade_xml_get_widget (xml, "phone_entry");
+    cw->fax_entry = glade_xml_get_widget (xml, "fax_entry");
+    cw->email_entry = glade_xml_get_widget (xml, "email_entry");
 
-  cw->active_check = glade_xml_get_widget (xml, "active_check");
-  cw->taxincluded_menu = glade_xml_get_widget (xml, "tax_included_menu");
-  cw->notes_text = glade_xml_get_widget (xml, "notes_text");
+    cw->shipname_entry = glade_xml_get_widget (xml, "shipname_entry");
+    cw->shipaddr1_entry = glade_xml_get_widget (xml, "shipaddr1_entry");
+    cw->shipaddr2_entry = glade_xml_get_widget (xml, "shipaddr2_entry");
+    cw->shipaddr3_entry = glade_xml_get_widget (xml, "shipaddr3_entry");
+    cw->shipaddr4_entry = glade_xml_get_widget (xml, "shipaddr4_entry");
+    cw->shipphone_entry = glade_xml_get_widget (xml, "shipphone_entry");
+    cw->shipfax_entry = glade_xml_get_widget (xml, "shipfax_entry");
+    cw->shipemail_entry = glade_xml_get_widget (xml, "shipemail_entry");
 
-  cw->terms_menu = glade_xml_get_widget (xml, "terms_menu");
+    cw->active_check = glade_xml_get_widget (xml, "active_check");
+    cw->taxincluded_menu = glade_xml_get_widget (xml, "tax_included_menu");
+    cw->notes_text = glade_xml_get_widget (xml, "notes_text");
 
-  cw->taxtable_check = glade_xml_get_widget (xml, "taxtable_button");
-  cw->taxtable_menu = glade_xml_get_widget (xml, "taxtable_menu");
+    cw->terms_menu = glade_xml_get_widget (xml, "terms_menu");
 
-  /* Currency */
-  edit = gnc_currency_edit_new();
-  gnc_currency_edit_set_currency (GNC_CURRENCY_EDIT(edit), currency);
-  cw->currency_edit = edit;
+    cw->taxtable_check = glade_xml_get_widget (xml, "taxtable_button");
+    cw->taxtable_menu = glade_xml_get_widget (xml, "taxtable_menu");
 
-  hbox = glade_xml_get_widget (xml, "currency_box");
-  gtk_box_pack_start (GTK_BOX (hbox), edit, TRUE, TRUE, 0);
+    /* Currency */
+    edit = gnc_currency_edit_new();
+    gnc_currency_edit_set_currency (GNC_CURRENCY_EDIT(edit), currency);
+    cw->currency_edit = edit;
 
-  /* DISCOUNT: Percentage Value */
-  edit = gnc_amount_edit_new();
-  gnc_amount_edit_set_evaluate_on_enter (GNC_AMOUNT_EDIT (edit), TRUE);
-  print_info = gnc_integral_print_info ();
-  print_info.max_decimal_places = 5;
-  gnc_amount_edit_set_print_info (GNC_AMOUNT_EDIT (edit), print_info);
-  gnc_amount_edit_set_fraction (GNC_AMOUNT_EDIT (edit), 100000);
-  cw->discount_amount = edit;
-  gtk_widget_show (edit);
+    hbox = glade_xml_get_widget (xml, "currency_box");
+    gtk_box_pack_start (GTK_BOX (hbox), edit, TRUE, TRUE, 0);
 
-  hbox = glade_xml_get_widget (xml, "discount_box");
-  gtk_box_pack_start (GTK_BOX (hbox), edit, TRUE, TRUE, 0);
+    /* DISCOUNT: Percentage Value */
+    edit = gnc_amount_edit_new();
+    gnc_amount_edit_set_evaluate_on_enter (GNC_AMOUNT_EDIT (edit), TRUE);
+    print_info = gnc_integral_print_info ();
+    print_info.max_decimal_places = 5;
+    gnc_amount_edit_set_print_info (GNC_AMOUNT_EDIT (edit), print_info);
+    gnc_amount_edit_set_fraction (GNC_AMOUNT_EDIT (edit), 100000);
+    cw->discount_amount = edit;
+    gtk_widget_show (edit);
 
-  /* CREDIT: Monetary Value */
-  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));
-  cw->credit_amount = edit;
-  gtk_widget_show (edit);
+    hbox = glade_xml_get_widget (xml, "discount_box");
+    gtk_box_pack_start (GTK_BOX (hbox), edit, TRUE, TRUE, 0);
 
-  hbox = glade_xml_get_widget (xml, "credit_box");
-  gtk_box_pack_start (GTK_BOX (hbox), edit, TRUE, TRUE, 0);
+    /* CREDIT: Monetary Value */
+    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));
+    cw->credit_amount = edit;
+    gtk_widget_show (edit);
 
-  /* Setup signals */
-  glade_xml_signal_autoconnect_full( xml,
-                                     gnc_glade_autoconnect_full_func,
-                                     cw);
+    hbox = glade_xml_get_widget (xml, "credit_box");
+    gtk_box_pack_start (GTK_BOX (hbox), edit, TRUE, TRUE, 0);
 
-  /* Setup initial values */
-  if (cust != NULL) {
-    GtkTextBuffer* text_buffer;
-    GncAddress *addr, *shipaddr;
-    const char *string;
+    /* Setup signals */
+    glade_xml_signal_autoconnect_full( xml,
+                                       gnc_glade_autoconnect_full_func,
+                                       cw);
 
-    cw->dialog_type = EDIT_CUSTOMER;
-    cw->customer_guid = *gncCustomerGetGUID (cust);
+    /* Setup initial values */
+    if (cust != NULL)
+    {
+        GtkTextBuffer* text_buffer;
+        GncAddress *addr, *shipaddr;
+        const char *string;
 
-    addr = gncCustomerGetAddr (cust);
-    shipaddr = gncCustomerGetShipAddr (cust);
+        cw->dialog_type = EDIT_CUSTOMER;
+        cw->customer_guid = *gncCustomerGetGUID (cust);
 
-    gtk_entry_set_text (GTK_ENTRY (cw->id_entry), gncCustomerGetID (cust));
-    gtk_entry_set_text (GTK_ENTRY (cw->company_entry), gncCustomerGetName (cust));
+        addr = gncCustomerGetAddr (cust);
+        shipaddr = gncCustomerGetShipAddr (cust);
 
-    /* Setup Address */
-    gtk_entry_set_text (GTK_ENTRY (cw->name_entry), gncAddressGetName (addr));
-    gtk_entry_set_text (GTK_ENTRY (cw->addr1_entry), gncAddressGetAddr1 (addr));
-    gtk_entry_set_text (GTK_ENTRY (cw->addr2_entry), gncAddressGetAddr2 (addr));
-    gtk_entry_set_text (GTK_ENTRY (cw->addr3_entry), gncAddressGetAddr3 (addr));
-    gtk_entry_set_text (GTK_ENTRY (cw->addr4_entry), gncAddressGetAddr4 (addr));
-    gtk_entry_set_text (GTK_ENTRY (cw->phone_entry), gncAddressGetPhone (addr));
-    gtk_entry_set_text (GTK_ENTRY (cw->fax_entry), gncAddressGetFax (addr));
-    gtk_entry_set_text (GTK_ENTRY (cw->email_entry), gncAddressGetEmail (addr));
+        gtk_entry_set_text (GTK_ENTRY (cw->id_entry), gncCustomerGetID (cust));
+        gtk_entry_set_text (GTK_ENTRY (cw->company_entry), gncCustomerGetName (cust));
 
-    /* Setup Ship-to Address */
-    gtk_entry_set_text (GTK_ENTRY (cw->shipname_entry), gncAddressGetName (shipaddr));
-    gtk_entry_set_text (GTK_ENTRY (cw->shipaddr1_entry), gncAddressGetAddr1 (shipaddr));
-    gtk_entry_set_text (GTK_ENTRY (cw->shipaddr2_entry), gncAddressGetAddr2 (shipaddr));
-    gtk_entry_set_text (GTK_ENTRY (cw->shipaddr3_entry), gncAddressGetAddr3 (shipaddr));
-    gtk_entry_set_text (GTK_ENTRY (cw->shipaddr4_entry), gncAddressGetAddr4 (shipaddr));
-    gtk_entry_set_text (GTK_ENTRY (cw->shipphone_entry), gncAddressGetPhone (shipaddr));
-    gtk_entry_set_text (GTK_ENTRY (cw->shipfax_entry), gncAddressGetFax (shipaddr));
-    gtk_entry_set_text (GTK_ENTRY (cw->shipemail_entry), gncAddressGetEmail (shipaddr));
+        /* Setup Address */
+        gtk_entry_set_text (GTK_ENTRY (cw->name_entry), gncAddressGetName (addr));
+        gtk_entry_set_text (GTK_ENTRY (cw->addr1_entry), gncAddressGetAddr1 (addr));
+        gtk_entry_set_text (GTK_ENTRY (cw->addr2_entry), gncAddressGetAddr2 (addr));
+        gtk_entry_set_text (GTK_ENTRY (cw->addr3_entry), gncAddressGetAddr3 (addr));
+        gtk_entry_set_text (GTK_ENTRY (cw->addr4_entry), gncAddressGetAddr4 (addr));
+        gtk_entry_set_text (GTK_ENTRY (cw->phone_entry), gncAddressGetPhone (addr));
+        gtk_entry_set_text (GTK_ENTRY (cw->fax_entry), gncAddressGetFax (addr));
+        gtk_entry_set_text (GTK_ENTRY (cw->email_entry), gncAddressGetEmail (addr));
 
-    /* Set toggle buttons */
-    gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (cw->active_check),
-                                gncCustomerGetActive (cust));
+        /* Setup Ship-to Address */
+        gtk_entry_set_text (GTK_ENTRY (cw->shipname_entry), gncAddressGetName (shipaddr));
+        gtk_entry_set_text (GTK_ENTRY (cw->shipaddr1_entry), gncAddressGetAddr1 (shipaddr));
+        gtk_entry_set_text (GTK_ENTRY (cw->shipaddr2_entry), gncAddressGetAddr2 (shipaddr));
+        gtk_entry_set_text (GTK_ENTRY (cw->shipaddr3_entry), gncAddressGetAddr3 (shipaddr));
+        gtk_entry_set_text (GTK_ENTRY (cw->shipaddr4_entry), gncAddressGetAddr4 (shipaddr));
+        gtk_entry_set_text (GTK_ENTRY (cw->shipphone_entry), gncAddressGetPhone (shipaddr));
+        gtk_entry_set_text (GTK_ENTRY (cw->shipfax_entry), gncAddressGetFax (shipaddr));
+        gtk_entry_set_text (GTK_ENTRY (cw->shipemail_entry), gncAddressGetEmail (shipaddr));
 
-    string = gncCustomerGetNotes (cust);
-    text_buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW(cw->notes_text));
-    gtk_text_buffer_set_text (text_buffer, string, -1);
+        /* Set toggle buttons */
+        gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (cw->active_check),
+                                      gncCustomerGetActive (cust));
 
-    cw->component_id =
-      gnc_register_gui_component (DIALOG_EDIT_CUSTOMER_CM_CLASS,
-				  gnc_customer_window_refresh_handler,
-				  gnc_customer_window_close_handler,
-				  cw);
-    cw->terms = gncCustomerGetTerms (cust);
+        string = gncCustomerGetNotes (cust);
+        text_buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW(cw->notes_text));
+        gtk_text_buffer_set_text (text_buffer, string, -1);
 
-  } else {
-    cust = gncCustomerCreate (bookp);
-    cw->customer_guid = *gncCustomerGetGUID (cust);
+        cw->component_id =
+            gnc_register_gui_component (DIALOG_EDIT_CUSTOMER_CM_CLASS,
+                                        gnc_customer_window_refresh_handler,
+                                        gnc_customer_window_close_handler,
+                                        cw);
+        cw->terms = gncCustomerGetTerms (cust);
 
-    cw->dialog_type = NEW_CUSTOMER;
-    cw->component_id =
-      gnc_register_gui_component (DIALOG_NEW_CUSTOMER_CM_CLASS,
-				  gnc_customer_window_refresh_handler,
-				  gnc_customer_window_close_handler,
-				  cw);
+    }
+    else
+    {
+        cust = gncCustomerCreate (bookp);
+        cw->customer_guid = *gncCustomerGetGUID (cust);
 
-    /* XXX: get the global-default terms */
-    cw->terms = NULL;
-  }
+        cw->dialog_type = NEW_CUSTOMER;
+        cw->component_id =
+            gnc_register_gui_component (DIALOG_NEW_CUSTOMER_CM_CLASS,
+                                        gnc_customer_window_refresh_handler,
+                                        gnc_customer_window_close_handler,
+                                        cw);
 
-  /* I know that cust exists here -- either passed in or just created */
+        /* XXX: get the global-default terms */
+        cw->terms = NULL;
+    }
 
-  cw->taxincluded = gncCustomerGetTaxIncluded (cust);
-  gnc_ui_taxincluded_optionmenu (cw->taxincluded_menu, &cw->taxincluded);
-  gnc_ui_billterms_optionmenu (cw->terms_menu, bookp, TRUE, &cw->terms);
+    /* I know that cust exists here -- either passed in or just created */
 
-  cw->taxtable = gncCustomerGetTaxTable (cust);
-  gnc_ui_taxtables_optionmenu (cw->taxtable_menu, bookp, TRUE, &cw->taxtable);
-  gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (cw->taxtable_check),
-                                gncCustomerGetTaxTableOverride (cust));
-  gnc_customer_taxtable_check_cb (GTK_TOGGLE_BUTTON (cw->taxtable_check), cw);
+    cw->taxincluded = gncCustomerGetTaxIncluded (cust);
+    gnc_ui_taxincluded_optionmenu (cw->taxincluded_menu, &cw->taxincluded);
+    gnc_ui_billterms_optionmenu (cw->terms_menu, bookp, TRUE, &cw->terms);
 
-  /* Set the Discount, and Credit amounts */
-  gnc_amount_edit_set_amount (GNC_AMOUNT_EDIT (cw->discount_amount),
-			      gncCustomerGetDiscount (cust));
-  gnc_amount_edit_set_amount (GNC_AMOUNT_EDIT (cw->credit_amount),
-			      gncCustomerGetCredit (cust));
+    cw->taxtable = gncCustomerGetTaxTable (cust);
+    gnc_ui_taxtables_optionmenu (cw->taxtable_menu, bookp, TRUE, &cw->taxtable);
+    gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (cw->taxtable_check),
+                                  gncCustomerGetTaxTableOverride (cust));
+    gnc_customer_taxtable_check_cb (GTK_TOGGLE_BUTTON (cw->taxtable_check), cw);
 
-  gnc_gui_component_watch_entity_type (cw->component_id,
-				       GNC_CUSTOMER_MODULE_NAME,
-				       QOF_EVENT_MODIFY | QOF_EVENT_DESTROY);
+    /* Set the Discount, and Credit amounts */
+    gnc_amount_edit_set_amount (GNC_AMOUNT_EDIT (cw->discount_amount),
+                                gncCustomerGetDiscount (cust));
+    gnc_amount_edit_set_amount (GNC_AMOUNT_EDIT (cw->credit_amount),
+                                gncCustomerGetCredit (cust));
 
-  gtk_widget_show_all (cw->dialog);
+    gnc_gui_component_watch_entity_type (cw->component_id,
+                                         GNC_CUSTOMER_MODULE_NAME,
+                                         QOF_EVENT_MODIFY | QOF_EVENT_DESTROY);
 
-  return cw;
+    gtk_widget_show_all (cw->dialog);
+
+    return cw;
 }
 
 CustomerWindow *
 gnc_ui_customer_edit (GncCustomer *cust)
 {
-  CustomerWindow *cw;
+    CustomerWindow *cw;
 
-  if (!cust) return NULL;
+    if (!cust) return NULL;
 
-  cw = gnc_customer_new_window (gncCustomerGetBook(cust), cust);
+    cw = gnc_customer_new_window (gncCustomerGetBook(cust), cust);
 
-  return cw;
+    return cw;
 }
 
 CustomerWindow *
 gnc_ui_customer_new (QofBook *bookp)
 {
-  CustomerWindow *cw;
+    CustomerWindow *cw;
 
-  /* Make sure required options exist */
-  if (!bookp) return NULL;
+    /* Make sure required options exist */
+    if (!bookp) return NULL;
 
-  cw = gnc_customer_new_window (bookp, NULL);
+    cw = gnc_customer_new_window (bookp, NULL);
 
-  return cw;
+    return cw;
 }
 
 /* Functions for customer selection widgets */
@@ -657,197 +675,201 @@
 static void
 invoice_customer_cb (gpointer *cust_p, gpointer user_data)
 {
-  struct _customer_select_window *sw = user_data;
-  GncOwner owner;
-  GncCustomer *cust;
+    struct _customer_select_window *sw = user_data;
+    GncOwner owner;
+    GncCustomer *cust;
 
-  g_return_if_fail (cust_p && user_data);
+    g_return_if_fail (cust_p && user_data);
 
-  cust = *cust_p;
+    cust = *cust_p;
 
-  if (!cust)
+    if (!cust)
+        return;
+
+    gncOwnerInitCustomer (&owner, cust);
+    gnc_invoice_search (NULL, &owner, sw->book);
     return;
-
-  gncOwnerInitCustomer (&owner, cust);
-  gnc_invoice_search (NULL, &owner, sw->book);
-  return;
 }
 
 static void
 order_customer_cb (gpointer *cust_p, gpointer user_data)
 {
-  struct _customer_select_window *sw = user_data;
-  GncOwner owner;
-  GncCustomer *cust;
+    struct _customer_select_window *sw = user_data;
+    GncOwner owner;
+    GncCustomer *cust;
 
-  g_return_if_fail (cust_p && user_data);
+    g_return_if_fail (cust_p && user_data);
 
-  cust = *cust_p;
+    cust = *cust_p;
 
-  if (!cust)
+    if (!cust)
+        return;
+
+    gncOwnerInitCustomer (&owner, cust);
+    gnc_order_search (NULL, &owner, sw->book);
     return;
-
-  gncOwnerInitCustomer (&owner, cust);
-  gnc_order_search (NULL, &owner, sw->book);
-  return;
 }
 
 static void
 jobs_customer_cb (gpointer *cust_p, gpointer user_data)
 {
-  struct _customer_select_window *sw = user_data;
-  GncOwner owner;
-  GncCustomer *cust;
+    struct _customer_select_window *sw = user_data;
+    GncOwner owner;
+    GncCustomer *cust;
 
-  g_return_if_fail (cust_p && user_data);
+    g_return_if_fail (cust_p && user_data);
 
-  cust = *cust_p;
+    cust = *cust_p;
 
-  if (!cust)
+    if (!cust)
+        return;
+
+    gncOwnerInitCustomer (&owner, cust);
+    gnc_job_search (NULL, &owner, sw->book);
     return;
-
-  gncOwnerInitCustomer (&owner, cust);
-  gnc_job_search (NULL, &owner, sw->book);
-  return;
 }
 
 static void
 payment_customer_cb (gpointer *cust_p, gpointer user_data)
 {
-  struct _customer_select_window *sw = user_data;
-  GncOwner owner;
-  GncCustomer *cust;
+    struct _customer_select_window *sw = user_data;
+    GncOwner owner;
+    GncCustomer *cust;
 
-  g_return_if_fail (cust_p && user_data);
+    g_return_if_fail (cust_p && user_data);
 
-  cust = *cust_p;
+    cust = *cust_p;
 
-  if (!cust)
+    if (!cust)
+        return;
+
+    gncOwnerInitCustomer (&owner, cust);
+    gnc_ui_payment_new (&owner, sw->book);
     return;
-
-  gncOwnerInitCustomer (&owner, cust);
-  gnc_ui_payment_new (&owner, sw->book);
-  return;
 }
 
 static void
 edit_customer_cb (gpointer *cust_p, gpointer user_data)
 {
-  GncCustomer *cust;
+    GncCustomer *cust;
 
-  g_return_if_fail (cust_p);
-  cust = *cust_p;
+    g_return_if_fail (cust_p);
+    cust = *cust_p;
 
-  if (!cust)
-    return;
+    if (!cust)
+        return;
 
-  gnc_ui_customer_edit (cust);
+    gnc_ui_customer_edit (cust);
 
-  return;
+    return;
 }
 
 static gpointer
 new_customer_cb (gpointer user_data)
 {
-  struct _customer_select_window *sw = user_data;
-  CustomerWindow *cw;
-  
-  g_return_val_if_fail (sw, NULL);
+    struct _customer_select_window *sw = user_data;
+    CustomerWindow *cw;
 
-  cw = gnc_ui_customer_new (sw->book);
-  return cw_get_customer (cw);
+    g_return_val_if_fail (sw, NULL);
+
+    cw = gnc_ui_customer_new (sw->book);
+    return cw_get_customer (cw);
 }
 
 static void
 free_userdata_cb (gpointer user_data)
 {
-  struct _customer_select_window *sw = user_data;
+    struct _customer_select_window *sw = user_data;
 
-  g_return_if_fail (sw);
+    g_return_if_fail (sw);
 
-  gncQueryDestroy (sw->q);
-  g_free (sw);
+    gncQueryDestroy (sw->q);
+    g_free (sw);
 }
 
 GNCSearchWindow *
 gnc_customer_search (GncCustomer *start, QofBook *book)
 {
-  QueryNew *q, *q2 = NULL;
-  GNCIdType type = GNC_CUSTOMER_MODULE_NAME;
-  struct _customer_select_window *sw;
-  static GList *params = NULL;
-  static GList *columns = NULL;
-  static GNCSearchCallbackButton buttons[] = { 
-    { N_("View/Edit Customer"), edit_customer_cb},
-    { N_("Customer's Jobs"), jobs_customer_cb},
-    //    { N_("Customer's Orders"), order_customer_cb},
-    { N_("Customer's Invoices"), invoice_customer_cb},
-    { N_("Process Payment"), payment_customer_cb},
-    { NULL },
-  };
-  (void)order_customer_cb;
+    QueryNew *q, *q2 = NULL;
+    GNCIdType type = GNC_CUSTOMER_MODULE_NAME;
+    struct _customer_select_window *sw;
+    static GList *params = NULL;
+    static GList *columns = NULL;
+    static GNCSearchCallbackButton buttons[] =
+    {
+        { N_("View/Edit Customer"), edit_customer_cb},
+        { N_("Customer's Jobs"), jobs_customer_cb},
+        //    { N_("Customer's Orders"), order_customer_cb},
+        { N_("Customer's Invoices"), invoice_customer_cb},
+        { N_("Process Payment"), payment_customer_cb},
+        { NULL },
+    };
+    (void)order_customer_cb;
 
-  g_return_val_if_fail (book, NULL);
+    g_return_val_if_fail (book, NULL);
 
-  /* Build parameter list in reverse order*/
-  if (params == NULL) {
-    params = gnc_search_param_prepend (params, _("Shipping Contact"), NULL, type,
-				       CUSTOMER_SHIPADDR, ADDRESS_NAME, NULL);
-    params = gnc_search_param_prepend (params, _("Billing Contact"), NULL, type,
-				       CUSTOMER_ADDR, ADDRESS_NAME, NULL);
-    params = gnc_search_param_prepend (params, _("Customer ID"), NULL, type,
-				       CUSTOMER_ID, NULL);
-    params = gnc_search_param_prepend (params, _("Company Name"), NULL, type,
-				       CUSTOMER_NAME, NULL);
-  }
+    /* Build parameter list in reverse order*/
+    if (params == NULL)
+    {
+        params = gnc_search_param_prepend (params, _("Shipping Contact"), NULL, type,
+                                           CUSTOMER_SHIPADDR, ADDRESS_NAME, NULL);
+        params = gnc_search_param_prepend (params, _("Billing Contact"), NULL, type,
+                                           CUSTOMER_ADDR, ADDRESS_NAME, NULL);
+        params = gnc_search_param_prepend (params, _("Customer ID"), NULL, type,
+                                           CUSTOMER_ID, NULL);
+        params = gnc_search_param_prepend (params, _("Company Name"), NULL, type,
+                                           CUSTOMER_NAME, NULL);
+    }
 
-  /* Build the column list in reverse order */
-  if (columns == NULL) {
-    columns = gnc_search_param_prepend (columns, _("Contact"), NULL, type,
-					CUSTOMER_ADDR, ADDRESS_NAME, NULL);
-    columns = gnc_search_param_prepend (columns, _("Company"), NULL, type,
-					CUSTOMER_NAME, NULL);
-    columns = gnc_search_param_prepend (columns, _("ID #"), NULL, type,
-					CUSTOMER_ID, NULL);
-  }
+    /* Build the column list in reverse order */
+    if (columns == NULL)
+    {
+        columns = gnc_search_param_prepend (columns, _("Contact"), NULL, type,
+                                            CUSTOMER_ADDR, ADDRESS_NAME, NULL);
+        columns = gnc_search_param_prepend (columns, _("Company"), NULL, type,
+                                            CUSTOMER_NAME, NULL);
+        columns = gnc_search_param_prepend (columns, _("ID #"), NULL, type,
+                                            CUSTOMER_ID, NULL);
+    }
 
-  /* Build the queries */
-  q = gncQueryCreateFor (type);
-  gncQuerySetBook (q, book);
+    /* Build the queries */
+    q = gncQueryCreateFor (type);
+    gncQuerySetBook (q, book);
 
 #if 0
-  if (start) {
-    q2 = gncQueryCopy (q);
-    gncQueryAddGUIDMatch (q2, g_slist_prepend (NULL, QUERY_PARAM_GUID),
-			  gncCustomerGetGUID (start), QUERY_AND);
-  }
+    if (start)
+    {
+        q2 = gncQueryCopy (q);
+        gncQueryAddGUIDMatch (q2, g_slist_prepend (NULL, QUERY_PARAM_GUID),
+                              gncCustomerGetGUID (start), QUERY_AND);
+    }
 #endif
 
-  /* launch select dialog and return the result */
-  sw = g_new0 (struct _customer_select_window, 1);
+    /* launch select dialog and return the result */
+    sw = g_new0 (struct _customer_select_window, 1);
 
-  sw->book = book;
-  sw->q = q;
+    sw->book = book;
+    sw->q = q;
 
-  return gnc_search_dialog_create (type, _("Find Customer"),
-				   params, columns, q, q2, buttons, NULL,
-				   new_customer_cb, sw, free_userdata_cb,
-				   GCONF_SECTION_SEARCH, NULL);
+    return gnc_search_dialog_create (type, _("Find Customer"),
+                                     params, columns, q, q2, buttons, NULL,
+                                     new_customer_cb, sw, free_userdata_cb,
+                                     GCONF_SECTION_SEARCH, NULL);
 }
 
 GNCSearchWindow *
 gnc_customer_search_select (gpointer start, gpointer book)
 {
-  if (!book) return NULL;
+    if (!book) return NULL;
 
-  return gnc_customer_search (start, book);
+    return gnc_customer_search (start, book);
 }
 
 GNCSearchWindow *
 gnc_customer_search_edit (gpointer start, gpointer book)
 {
-  if (start)
-    gnc_ui_customer_edit (start);
+    if (start)
+        gnc_ui_customer_edit (start);
 
-  return NULL;
+    return NULL;
 }

Modified: gnucash/trunk/src/business/business-gnome/dialog-date-close.c
===================================================================
--- gnucash/trunk/src/business/business-gnome/dialog-date-close.c	2010-03-02 21:40:28 UTC (rev 18788)
+++ gnucash/trunk/src/business/business-gnome/dialog-date-close.c	2010-03-02 21:41:05 UTC (rev 18789)
@@ -37,22 +37,23 @@
 #include "business-gnome-utils.h"
 #include "dialog-date-close.h"
 
-typedef struct _dialog_date_close_window {
-  GtkWidget *dialog;
-  GtkWidget *date;
-  GtkWidget *post_date;
-  GtkWidget *acct_combo;
-  GtkWidget *memo_entry;
-  GtkWidget *question_check;
-  GncBillTerm *terms;
-  Timespec *ts, *ts2;
-  GList * acct_types;
-  GList * acct_commodities;
-  QofBook *book;
-  Account *acct;
-  char **memo;
-  gboolean retval;
-  gboolean answer;
+typedef struct _dialog_date_close_window
+{
+    GtkWidget *dialog;
+    GtkWidget *date;
+    GtkWidget *post_date;
+    GtkWidget *acct_combo;
+    GtkWidget *memo_entry;
+    GtkWidget *question_check;
+    GncBillTerm *terms;
+    Timespec *ts, *ts2;
+    GList * acct_types;
+    GList * acct_commodities;
+    QofBook *book;
+    Account *acct;
+    char **memo;
+    gboolean retval;
+    gboolean answer;
 } DialogDateClose;
 
 void gnc_dialog_date_close_ok_cb (GtkWidget *widget, gpointer user_data);
@@ -61,369 +62,383 @@
 void
 gnc_dialog_date_close_ok_cb (GtkWidget *widget, gpointer user_data)
 {
-  DialogDateClose *ddc = user_data;
+    DialogDateClose *ddc = user_data;
 
-  if (ddc->acct_combo) {
-    Account *acc;
+    if (ddc->acct_combo)
+    {
+        Account *acc;
 
-    acc = gnc_account_sel_get_account( GNC_ACCOUNT_SEL(ddc->acct_combo) );
+        acc = gnc_account_sel_get_account( GNC_ACCOUNT_SEL(ddc->acct_combo) );
 
-    if (!acc) {
-      gnc_error_dialog (ddc->dialog, "%s",
-			_("No Account selected.  Please try again."));
-      return;
-    }
+        if (!acc)
+        {
+            gnc_error_dialog (ddc->dialog, "%s",
+                              _("No Account selected.  Please try again."));
+            return;
+        }
 
-    if (xaccAccountGetPlaceholder (acc)) {
-      gnc_error_dialog (ddc->dialog, "%s",
-			_("Placeholder account selected.  Please try again."));
-      return;
+        if (xaccAccountGetPlaceholder (acc))
+        {
+            gnc_error_dialog (ddc->dialog, "%s",
+                              _("Placeholder account selected.  Please try again."));
+            return;
+        }
+
+        ddc->acct = acc;
     }
 
-    ddc->acct = acc;
-  }
+    if (ddc->post_date)
+        *(ddc->ts2) = gnc_date_edit_get_date_ts (GNC_DATE_EDIT (ddc->post_date));
 
-  if (ddc->post_date)
-    *(ddc->ts2) = gnc_date_edit_get_date_ts (GNC_DATE_EDIT (ddc->post_date));
+    if (ddc->date)
+    {
+        if (ddc->terms)
+            *(ddc->ts) = gncBillTermComputeDueDate (ddc->terms, *(ddc->ts2));
+        else
+            *(ddc->ts) = gnc_date_edit_get_date_ts (GNC_DATE_EDIT (ddc->date));
+    }
 
-  if (ddc->date) {
-    if (ddc->terms)
-      *(ddc->ts) = gncBillTermComputeDueDate (ddc->terms, *(ddc->ts2));
-    else
-      *(ddc->ts) = gnc_date_edit_get_date_ts (GNC_DATE_EDIT (ddc->date));
-  }
-
-  if (ddc->memo_entry && ddc->memo)
-    *(ddc->memo) = gtk_editable_get_chars (GTK_EDITABLE (ddc->memo_entry),
-					   0, -1);
-  if (ddc->question_check)
-	  ddc->answer = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(ddc->question_check));
-  ddc->retval = TRUE;
+    if (ddc->memo_entry && ddc->memo)
+        *(ddc->memo) = gtk_editable_get_chars (GTK_EDITABLE (ddc->memo_entry),
+                                               0, -1);
+    if (ddc->question_check)
+        ddc->answer = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(ddc->question_check));
+    ddc->retval = TRUE;
 }
 
 static void
 fill_in_acct_info (DialogDateClose *ddc, gboolean set_default_acct)
 {
-  GNCAccountSel *gas = GNC_ACCOUNT_SEL (ddc->acct_combo);
+    GNCAccountSel *gas = GNC_ACCOUNT_SEL (ddc->acct_combo);
 
-  /* How do I set the book? */
-  gnc_account_sel_set_acct_filters( gas, ddc->acct_types, ddc->acct_commodities );
-  gnc_account_sel_set_new_account_ability( gas, TRUE );
-  gnc_account_sel_set_new_account_modal( gas, TRUE );
-  gnc_account_sel_set_account( gas, ddc->acct, set_default_acct );
+    /* How do I set the book? */
+    gnc_account_sel_set_acct_filters( gas, ddc->acct_types, ddc->acct_commodities );
+    gnc_account_sel_set_new_account_ability( gas, TRUE );
+    gnc_account_sel_set_new_account_modal( gas, TRUE );
+    gnc_account_sel_set_account( gas, ddc->acct, set_default_acct );
 }
 
 static void
 build_date_close_window (GtkWidget *hbox, const char *message)
 {
-  GtkWidget *pixmap = NULL;
-  GtkWidget *label;
-  GtkWidget *alignment;
-  char *s;
+    GtkWidget *pixmap = NULL;
+    GtkWidget *label;
+    GtkWidget *alignment;
+    char *s;
 
-  s = gnome_program_locate_file (NULL,
-				 GNOME_FILE_DOMAIN_PIXMAP,
-				 "gnome-question.png", TRUE, NULL);
-  if (s) {
-    pixmap = gtk_image_new_from_file(s);
-    g_free(s);
-  }
+    s = gnome_program_locate_file (NULL,
+                                   GNOME_FILE_DOMAIN_PIXMAP,
+                                   "gnome-question.png", TRUE, NULL);
+    if (s)
+    {
+        pixmap = gtk_image_new_from_file(s);
+        g_free(s);
+    }
 
-  if (pixmap) {
-    gtk_box_pack_start (GTK_BOX(hbox), pixmap, FALSE, TRUE, 0);
-    gtk_widget_show (pixmap);
-  }
+    if (pixmap)
+    {
+        gtk_box_pack_start (GTK_BOX(hbox), pixmap, FALSE, TRUE, 0);
+        gtk_widget_show (pixmap);
+    }
 
-  label = gtk_label_new (message);
-  gtk_label_set_justify (GTK_LABEL (label), GTK_JUSTIFY_LEFT);
-  gtk_misc_set_padding (GTK_MISC (label), GNOME_PAD, 0);
-  gtk_box_pack_start (GTK_BOX (hbox), label, TRUE, TRUE, 0);
-  gtk_widget_show (label);
+    label = gtk_label_new (message);
+    gtk_label_set_justify (GTK_LABEL (label), GTK_JUSTIFY_LEFT);
+    gtk_misc_set_padding (GTK_MISC (label), GNOME_PAD, 0);
+    gtk_box_pack_start (GTK_BOX (hbox), label, TRUE, TRUE, 0);
+    gtk_widget_show (label);
 
-  /* Add some extra space on the right to balance the pixmap */
-  if (pixmap) {
-    alignment = gtk_alignment_new (0., 0., 0., 0.);
-    gtk_widget_set_size_request (alignment, GNOME_PAD, -1);
-    gtk_widget_show (alignment);
-    
-    gtk_box_pack_start (GTK_BOX (hbox), alignment, FALSE, FALSE, 0);
-  }
+    /* Add some extra space on the right to balance the pixmap */
+    if (pixmap)
+    {
+        alignment = gtk_alignment_new (0., 0., 0., 0.);
+        gtk_widget_set_size_request (alignment, GNOME_PAD, -1);
+        gtk_widget_show (alignment);
+
+        gtk_box_pack_start (GTK_BOX (hbox), alignment, FALSE, FALSE, 0);
+    }
 }
 
 gboolean
 gnc_dialog_date_close_parented (GtkWidget *parent, const char *message,
-				const char *label_message,
-				gboolean ok_is_default,
-				/* Returned data ... */
-				Timespec *ts)
+                                const char *label_message,
+                                gboolean ok_is_default,
+                                /* Returned data ... */
+                                Timespec *ts)
 {
-  DialogDateClose *ddc;
-  GtkWidget *date_box;
-  GtkWidget *hbox;
-  GtkWidget *label;
-  GladeXML *xml;
-  gboolean retval;
+    DialogDateClose *ddc;
+    GtkWidget *date_box;
+    GtkWidget *hbox;
+    GtkWidget *label;
+    GladeXML *xml;
+    gboolean retval;
 
-  if (!message || !label_message || !ts)
-    return FALSE;
+    if (!message || !label_message || !ts)
+        return FALSE;
 
-  ddc = g_new0 (DialogDateClose, 1);
-  ddc->ts = ts;
+    ddc = g_new0 (DialogDateClose, 1);
+    ddc->ts = ts;
 
-  xml = gnc_glade_xml_new ("date-close.glade", "Date Close Dialog");
-  ddc->dialog = glade_xml_get_widget (xml, "Date Close Dialog");
-  hbox = glade_xml_get_widget (xml, "the_hbox");
-  label = glade_xml_get_widget (xml, "label");
+    xml = gnc_glade_xml_new ("date-close.glade", "Date Close Dialog");
+    ddc->dialog = glade_xml_get_widget (xml, "Date Close Dialog");
+    hbox = glade_xml_get_widget (xml, "the_hbox");
+    label = glade_xml_get_widget (xml, "label");
 
-  date_box = glade_xml_get_widget (xml, "date_box");
-  ddc->date = gnc_date_edit_new (time(NULL), FALSE, FALSE);
-  gtk_box_pack_start (GTK_BOX(date_box), ddc->date, TRUE, TRUE, 0);
+    date_box = glade_xml_get_widget (xml, "date_box");
+    ddc->date = gnc_date_edit_new (time(NULL), FALSE, FALSE);
+    gtk_box_pack_start (GTK_BOX(date_box), ddc->date, TRUE, TRUE, 0);
 
-  if (parent)
-    gtk_window_set_transient_for (GTK_WINDOW(ddc->dialog), GTK_WINDOW(parent));
+    if (parent)
+        gtk_window_set_transient_for (GTK_WINDOW(ddc->dialog), GTK_WINDOW(parent));
 
-  build_date_close_window (hbox, message);
+    build_date_close_window (hbox, message);
 
-  gnc_date_edit_set_time_ts (GNC_DATE_EDIT (ddc->date), *ts);
-  gtk_label_set_text (GTK_LABEL (label), label_message);
+    gnc_date_edit_set_time_ts (GNC_DATE_EDIT (ddc->date), *ts);
+    gtk_label_set_text (GTK_LABEL (label), label_message);
 
-  /* Setup signals */
-  glade_xml_signal_autoconnect_full( xml,
-                                     gnc_glade_autoconnect_full_func,
-                                     ddc);
+    /* Setup signals */
+    glade_xml_signal_autoconnect_full( xml,
+                                       gnc_glade_autoconnect_full_func,
+                                       ddc);
 
-  gtk_widget_show_all (ddc->dialog);
+    gtk_widget_show_all (ddc->dialog);
 
-  ddc->retval = FALSE;
-  while (gtk_dialog_run (GTK_DIALOG (ddc->dialog)) == GTK_RESPONSE_OK) {
-    /* If reponse is OK but flag is not set, try again */
-    if (ddc->retval)
-      break;
-  }
+    ddc->retval = FALSE;
+    while (gtk_dialog_run (GTK_DIALOG (ddc->dialog)) == GTK_RESPONSE_OK)
+    {
+        /* If reponse is OK but flag is not set, try again */
+        if (ddc->retval)
+            break;
+    }
 
-  gtk_widget_destroy(ddc->dialog);
-  retval = ddc->retval;
-  g_list_free (ddc->acct_types);
-  g_free (ddc);
+    gtk_widget_destroy(ddc->dialog);
+    retval = ddc->retval;
+    g_list_free (ddc->acct_types);
+    g_free (ddc);
 
-  return retval;
+    return retval;
 }
 
 static void
 post_date_changed_cb (GNCDateEdit *gde, gpointer d)
 {
-  DialogDateClose *ddc = d;
-  Timespec post_date;
-  Timespec due_date;
+    DialogDateClose *ddc = d;
+    Timespec post_date;
+    Timespec due_date;
 
-  post_date = gnc_date_edit_get_date_ts (gde);
-  due_date = gncBillTermComputeDueDate (ddc->terms, post_date);
-  gnc_date_edit_set_time_ts (GNC_DATE_EDIT (ddc->date), due_date);
+    post_date = gnc_date_edit_get_date_ts (gde);
+    due_date = gncBillTermComputeDueDate (ddc->terms, post_date);
+    gnc_date_edit_set_time_ts (GNC_DATE_EDIT (ddc->date), due_date);
 }
 
 gboolean
 gnc_dialog_dates_acct_question_parented (GtkWidget *parent, const char *message,
-				const char *ddue_label_message,
-				const char *post_label_message,
-				const char *acct_label_message,
-				const char *question_check_message,
-				gboolean ok_is_default,
-                                gboolean set_default_acct,
-				GList * acct_types, GList * acct_commodities, 
-                                QofBook *book, GncBillTerm *terms,
-				/* Returned Data... */
-				Timespec *ddue, Timespec *post,
-				char **memo, Account **acct, gboolean *answer)
+        const char *ddue_label_message,
+        const char *post_label_message,
+        const char *acct_label_message,
+        const char *question_check_message,
+        gboolean ok_is_default,
+        gboolean set_default_acct,
+        GList * acct_types, GList * acct_commodities,
+        QofBook *book, GncBillTerm *terms,
+        /* Returned Data... */
+        Timespec *ddue, Timespec *post,
+        char **memo, Account **acct, gboolean *answer)
 {
-  DialogDateClose *ddc;
-  GtkWidget *hbox;
-  GtkWidget *label;
-  GtkWidget *date_box;
-  GtkWidget *acct_box;
-  GladeXML *xml;
-  gboolean retval;
+    DialogDateClose *ddc;
+    GtkWidget *hbox;
+    GtkWidget *label;
+    GtkWidget *date_box;
+    GtkWidget *acct_box;
+    GladeXML *xml;
+    gboolean retval;
 
-  if (!message || !ddue_label_message || !post_label_message ||
-      !acct_label_message || !acct_types || !book || !ddue || !post || !acct)
-    return FALSE;
-  if (question_check_message && !answer)
-	  return FALSE;
+    if (!message || !ddue_label_message || !post_label_message ||
+            !acct_label_message || !acct_types || !book || !ddue || !post || !acct)
+        return FALSE;
+    if (question_check_message && !answer)
+        return FALSE;
 
-  ddc = g_new0 (DialogDateClose, 1);
-  ddc->ts = ddue;
-  ddc->ts2 = post;
-  ddc->book = book;
-  ddc->acct_types = acct_types;
-  ddc->acct_commodities = acct_commodities;
-  ddc->acct = *acct;
-  ddc->memo = memo;
-  ddc->terms = terms;
+    ddc = g_new0 (DialogDateClose, 1);
+    ddc->ts = ddue;
+    ddc->ts2 = post;
+    ddc->book = book;
+    ddc->acct_types = acct_types;
+    ddc->acct_commodities = acct_commodities;
+    ddc->acct = *acct;
+    ddc->memo = memo;
+    ddc->terms = terms;
 
-  xml = gnc_glade_xml_new ("date-close.glade", "Date Account Dialog");
-  ddc->dialog = glade_xml_get_widget (xml, "Date Account Dialog");
-  ddc->memo_entry = glade_xml_get_widget (xml, "memo_entry");
-  hbox = glade_xml_get_widget (xml, "the_hbox");
+    xml = gnc_glade_xml_new ("date-close.glade", "Date Account Dialog");
+    ddc->dialog = glade_xml_get_widget (xml, "Date Account Dialog");
+    ddc->memo_entry = glade_xml_get_widget (xml, "memo_entry");
+    hbox = glade_xml_get_widget (xml, "the_hbox");
 
-  acct_box = glade_xml_get_widget (xml, "acct_hbox");
-  ddc->acct_combo = gnc_account_sel_new();
-  gtk_box_pack_start (GTK_BOX(acct_box), ddc->acct_combo, TRUE, TRUE, 0);
+    acct_box = glade_xml_get_widget (xml, "acct_hbox");
+    ddc->acct_combo = gnc_account_sel_new();
+    gtk_box_pack_start (GTK_BOX(acct_box), ddc->acct_combo, TRUE, TRUE, 0);
 
-  date_box = glade_xml_get_widget (xml, "date_box");
-  ddc->date = gnc_date_edit_new (time(NULL), FALSE, FALSE);
-  gtk_box_pack_start (GTK_BOX(date_box), ddc->date, TRUE, TRUE, 0);
+    date_box = glade_xml_get_widget (xml, "date_box");
+    ddc->date = gnc_date_edit_new (time(NULL), FALSE, FALSE);
+    gtk_box_pack_start (GTK_BOX(date_box), ddc->date, TRUE, TRUE, 0);
 
-  date_box = glade_xml_get_widget (xml, "post_date_box");
-  ddc->post_date = gnc_date_edit_new (time(NULL), FALSE, FALSE);
-  gtk_box_pack_start (GTK_BOX(date_box), ddc->post_date, TRUE, TRUE, 0);
+    date_box = glade_xml_get_widget (xml, "post_date_box");
+    ddc->post_date = gnc_date_edit_new (time(NULL), FALSE, FALSE);
+    gtk_box_pack_start (GTK_BOX(date_box), ddc->post_date, TRUE, TRUE, 0);
 
-  ddc->question_check = glade_xml_get_widget(xml, "question_check");
-  
-  if (parent)
-    gtk_window_set_transient_for (GTK_WINDOW(ddc->dialog), GTK_WINDOW(parent));
+    ddc->question_check = glade_xml_get_widget(xml, "question_check");
 
-  build_date_close_window (hbox, message);
+    if (parent)
+        gtk_window_set_transient_for (GTK_WINDOW(ddc->dialog), GTK_WINDOW(parent));
 
-  /* Set the labels */
-  label = glade_xml_get_widget (xml, "date_label");
-  gtk_label_set_text (GTK_LABEL (label), ddue_label_message);
-  label = glade_xml_get_widget (xml, "postdate_label");
-  gtk_label_set_text (GTK_LABEL (label), post_label_message);
-  label = glade_xml_get_widget (xml, "acct_label");
-  gtk_label_set_text (GTK_LABEL (label), acct_label_message);
+    build_date_close_window (hbox, message);
 
-  if (question_check_message)
-  {
-	  gtk_label_set_text(GTK_LABEL(GTK_BIN(ddc->question_check)->child), question_check_message);
-	  gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(ddc->question_check), *answer);
-  } else {
-	  gtk_widget_hide(ddc->question_check);
-	  gtk_widget_hide(glade_xml_get_widget(xml, "hide1"));
-  }
+    /* Set the labels */
+    label = glade_xml_get_widget (xml, "date_label");
+    gtk_label_set_text (GTK_LABEL (label), ddue_label_message);
+    label = glade_xml_get_widget (xml, "postdate_label");
+    gtk_label_set_text (GTK_LABEL (label), post_label_message);
+    label = glade_xml_get_widget (xml, "acct_label");
+    gtk_label_set_text (GTK_LABEL (label), acct_label_message);
 
+    if (question_check_message)
+    {
+        gtk_label_set_text(GTK_LABEL(GTK_BIN(ddc->question_check)->child), question_check_message);
+        gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(ddc->question_check), *answer);
+    }
+    else
+    {
+        gtk_widget_hide(ddc->question_check);
+        gtk_widget_hide(glade_xml_get_widget(xml, "hide1"));
+    }
 
-  /* Set the post date widget */
-  gnc_date_edit_set_time_ts (GNC_DATE_EDIT (ddc->post_date), *post);
 
-  /* Deal with the terms handling of the due date */
-  if (terms) {
-    g_signal_connect (G_OBJECT (ddc->post_date), "date_changed",
-		      G_CALLBACK (post_date_changed_cb), ddc);
-    gtk_widget_set_sensitive (ddc->date, FALSE);
-    post_date_changed_cb (GNC_DATE_EDIT (ddc->post_date), ddc);
-  } else
-    gnc_date_edit_set_time_ts (GNC_DATE_EDIT (ddc->date), *ddue);
+    /* Set the post date widget */
+    gnc_date_edit_set_time_ts (GNC_DATE_EDIT (ddc->post_date), *post);
 
-  /* Setup the account widget */
-  fill_in_acct_info (ddc, set_default_acct);
+    /* Deal with the terms handling of the due date */
+    if (terms)
+    {
+        g_signal_connect (G_OBJECT (ddc->post_date), "date_changed",
+                          G_CALLBACK (post_date_changed_cb), ddc);
+        gtk_widget_set_sensitive (ddc->date, FALSE);
+        post_date_changed_cb (GNC_DATE_EDIT (ddc->post_date), ddc);
+    }
+    else
+        gnc_date_edit_set_time_ts (GNC_DATE_EDIT (ddc->date), *ddue);
 
-  /* Setup signals */
-  glade_xml_signal_autoconnect_full( xml,
-                                     gnc_glade_autoconnect_full_func,
-                                     ddc);
+    /* Setup the account widget */
+    fill_in_acct_info (ddc, set_default_acct);
 
-  gtk_widget_show_all (ddc->dialog);
+    /* Setup signals */
+    glade_xml_signal_autoconnect_full( xml,
+                                       gnc_glade_autoconnect_full_func,
+                                       ddc);
 
-  /* Set the focus on the date widget */
-  gnc_date_grab_focus (GNC_DATE_EDIT (ddc->post_date));
+    gtk_widget_show_all (ddc->dialog);
 
-  ddc->retval = FALSE;
-  while (gtk_dialog_run (GTK_DIALOG (ddc->dialog)) == GTK_RESPONSE_OK) {
-    /* If reponse is OK but flag is not set, try again */
-    if (ddc->retval)
-      break;
-  }
+    /* Set the focus on the date widget */
+    gnc_date_grab_focus (GNC_DATE_EDIT (ddc->post_date));
 
-  gtk_widget_destroy(ddc->dialog);
-  retval = ddc->retval;
-  *acct = ddc->acct;
-  if (question_check_message)
-	  *answer = ddc->answer;
-  g_free (ddc);
+    ddc->retval = FALSE;
+    while (gtk_dialog_run (GTK_DIALOG (ddc->dialog)) == GTK_RESPONSE_OK)
+    {
+        /* If reponse is OK but flag is not set, try again */
+        if (ddc->retval)
+            break;
+    }
 
-  return retval;
+    gtk_widget_destroy(ddc->dialog);
+    retval = ddc->retval;
+    *acct = ddc->acct;
+    if (question_check_message)
+        *answer = ddc->answer;
+    g_free (ddc);
+
+    return retval;
 }
 
 gboolean
 gnc_dialog_date_acct_parented (GtkWidget *parent, const char *message,
-			       const char *date_label_message,
-			       const char *acct_label_message,
-			       gboolean ok_is_default,
-			       GList * acct_types, QofBook *book,
-			       /* Returned Data... */
-			       Timespec *date, Account **acct)
+                               const char *date_label_message,
+                               const char *acct_label_message,
+                               gboolean ok_is_default,
+                               GList * acct_types, QofBook *book,
+                               /* Returned Data... */
+                               Timespec *date, Account **acct)
 {
-  DialogDateClose *ddc;
-  GtkWidget *hbox;
-  GtkWidget *label;
-  GtkWidget *date_box;
-  GtkWidget *acct_box;
-  GladeXML *xml;
-  gboolean retval;
+    DialogDateClose *ddc;
+    GtkWidget *hbox;
+    GtkWidget *label;
+    GtkWidget *date_box;
+    GtkWidget *acct_box;
+    GladeXML *xml;
+    gboolean retval;
 
-  if (!message || !date_label_message || !acct_label_message ||
-      !acct_types || !book || !date || !acct)
-    return FALSE;
+    if (!message || !date_label_message || !acct_label_message ||
+            !acct_types || !book || !date || !acct)
+        return FALSE;
 
-  ddc = g_new0 (DialogDateClose, 1);
-  ddc->ts = date;
-  ddc->book = book;
-  ddc->acct_types = acct_types;
-  ddc->acct = *acct;
+    ddc = g_new0 (DialogDateClose, 1);
+    ddc->ts = date;
+    ddc->book = book;
+    ddc->acct_types = acct_types;
+    ddc->acct = *acct;
 
-  xml = gnc_glade_xml_new ("date-close.glade", "Date Account Dialog");
-  ddc->dialog = glade_xml_get_widget (xml, "Date Account Dialog");
-  hbox = glade_xml_get_widget (xml, "the_hbox");
+    xml = gnc_glade_xml_new ("date-close.glade", "Date Account Dialog");
+    ddc->dialog = glade_xml_get_widget (xml, "Date Account Dialog");
+    hbox = glade_xml_get_widget (xml, "the_hbox");
 
-  acct_box = glade_xml_get_widget (xml, "acct_hbox");
-  ddc->acct_combo = gnc_account_sel_new();
-  if (*acct)
-    gnc_account_sel_set_account (GNC_ACCOUNT_SEL(ddc->acct_combo), *acct, FALSE);
-  gtk_box_pack_start (GTK_BOX(acct_box), ddc->acct_combo, TRUE, TRUE, 0);
+    acct_box = glade_xml_get_widget (xml, "acct_hbox");
+    ddc->acct_combo = gnc_account_sel_new();
+    if (*acct)
+        gnc_account_sel_set_account (GNC_ACCOUNT_SEL(ddc->acct_combo), *acct, FALSE);
+    gtk_box_pack_start (GTK_BOX(acct_box), ddc->acct_combo, TRUE, TRUE, 0);
 
-  date_box = glade_xml_get_widget (xml, "date_box");
-  ddc->date = gnc_date_edit_new (time(NULL), FALSE, FALSE);
-  gtk_box_pack_start (GTK_BOX(date_box), ddc->date, TRUE, TRUE, 0);
+    date_box = glade_xml_get_widget (xml, "date_box");
+    ddc->date = gnc_date_edit_new (time(NULL), FALSE, FALSE);
+    gtk_box_pack_start (GTK_BOX(date_box), ddc->date, TRUE, TRUE, 0);
 
-  if (parent)
-    gtk_window_set_transient_for (GTK_WINDOW(ddc->dialog), GTK_WINDOW(parent));
+    if (parent)
+        gtk_window_set_transient_for (GTK_WINDOW(ddc->dialog), GTK_WINDOW(parent));
 
-  build_date_close_window (hbox, message);
+    build_date_close_window (hbox, message);
 
-  /* Set the labels */
-  label = glade_xml_get_widget (xml, "date_label");
-  gtk_label_set_text (GTK_LABEL (label), date_label_message);
-  label = glade_xml_get_widget (xml, "acct_label");
-  gtk_label_set_text (GTK_LABEL (label), acct_label_message);
+    /* Set the labels */
+    label = glade_xml_get_widget (xml, "date_label");
+    gtk_label_set_text (GTK_LABEL (label), date_label_message);
+    label = glade_xml_get_widget (xml, "acct_label");
+    gtk_label_set_text (GTK_LABEL (label), acct_label_message);
 
-  /* Set the date widget */
-  gnc_date_edit_set_time_ts (GNC_DATE_EDIT (ddc->date), *date);
+    /* Set the date widget */
+    gnc_date_edit_set_time_ts (GNC_DATE_EDIT (ddc->date), *date);
 
-  /* Setup the account widget */
-  fill_in_acct_info (ddc, FALSE);
+    /* Setup the account widget */
+    fill_in_acct_info (ddc, FALSE);
 
-  /* Setup signals */
-  glade_xml_signal_autoconnect_full( xml,
-                                     gnc_glade_autoconnect_full_func,
-                                     ddc);
+    /* Setup signals */
+    glade_xml_signal_autoconnect_full( xml,
+                                       gnc_glade_autoconnect_full_func,
+                                       ddc);
 
-  gtk_widget_show_all (ddc->dialog);
+    gtk_widget_show_all (ddc->dialog);
 
-  gtk_widget_hide_all (glade_xml_get_widget (xml, "postdate_label"));
-  gtk_widget_hide_all (glade_xml_get_widget (xml, "post_date"));
-  gtk_widget_hide_all (glade_xml_get_widget (xml, "memo_entry"));
-  gtk_widget_hide_all (glade_xml_get_widget (xml, "memo_label"));
+    gtk_widget_hide_all (glade_xml_get_widget (xml, "postdate_label"));
+    gtk_widget_hide_all (glade_xml_get_widget (xml, "post_date"));
+    gtk_widget_hide_all (glade_xml_get_widget (xml, "memo_entry"));
+    gtk_widget_hide_all (glade_xml_get_widget (xml, "memo_label"));
 
-  ddc->retval = FALSE;
-  while (gtk_dialog_run (GTK_DIALOG (ddc->dialog)) == GTK_RESPONSE_OK) {
-    /* If reponse is OK but flag is not set, try again */
-    if (ddc->retval)
-      break;
-  }
+    ddc->retval = FALSE;
+    while (gtk_dialog_run (GTK_DIALOG (ddc->dialog)) == GTK_RESPONSE_OK)
+    {
+        /* If reponse is OK but flag is not set, try again */
+        if (ddc->retval)
+            break;
+    }
 
-  gtk_widget_destroy(ddc->dialog);
-  retval = ddc->retval;
-  *acct = ddc->acct;
-  g_free (ddc);
+    gtk_widget_destroy(ddc->dialog);
+    retval = ddc->retval;
+    *acct = ddc->acct;
+    g_free (ddc);
 
-  return retval;
+    return retval;
 }

Modified: gnucash/trunk/src/business/business-gnome/dialog-date-close.h
===================================================================
--- gnucash/trunk/src/business/business-gnome/dialog-date-close.h	2010-03-02 21:40:28 UTC (rev 18788)
+++ gnucash/trunk/src/business/business-gnome/dialog-date-close.h	2010-03-02 21:41:05 UTC (rev 18789)
@@ -31,13 +31,13 @@
 
 gboolean
 gnc_dialog_date_close_parented (GtkWidget *parent, const char *message,
-				const char *label_message,
-				gboolean ok_is_default,
-				/* Returned data ... */
-				Timespec *date);
+                                const char *label_message,
+                                gboolean ok_is_default,
+                                /* Returned data ... */
+                                Timespec *date);
 
 
-/* 
+/*
  * Note that the dialog will "own" (and free) the acct_types list.
  * it should be a list of GNCAccountTypes.  If memo is non-NULL,
  * it will g_malloc() a string.  The caller should g_free() it.
@@ -47,17 +47,17 @@
 
 gboolean
 gnc_dialog_dates_acct_question_parented (GtkWidget *parent, const char *message,
-				const char *ddue_label_message,
-				const char *post_label_message,
-				const char *acct_label_message,
-				const char *question_check_message,
-				gboolean ok_is_default,
-                                gboolean set_default_acct,
-				GList * acct_types, GList * acct_commodities, 
-                                QofBook *book, GncBillTerm *terms,
-				/* Returned Data... */
-				Timespec *ddue, Timespec *post,
-				char **memo, Account **acct, gboolean *answer);
+        const char *ddue_label_message,
+        const char *post_label_message,
+        const char *acct_label_message,
+        const char *question_check_message,
+        gboolean ok_is_default,
+        gboolean set_default_acct,
+        GList * acct_types, GList * acct_commodities,
+        QofBook *book, GncBillTerm *terms,
+        /* Returned Data... */
+        Timespec *ddue, Timespec *post,
+        char **memo, Account **acct, gboolean *answer);
 
 #define gnc_dialog_dates_acct_parented(parent, message,	\
 				ddue_label_message,							\
@@ -80,15 +80,15 @@
 				/* Returned Data... */						\
 				ddue, post,									\
 				memo, acct, NULL)									\
+ 
 
-
 gboolean
 gnc_dialog_date_acct_parented (GtkWidget *parent, const char *message,
-			       const char *date_label_message,
-			       const char *acct_label_message,
-			       gboolean ok_is_default,
-			       GList * acct_types, QofBook *book,
-				/* Returned Data... */
-			       Timespec *date, Account **acct);
+                               const char *date_label_message,
+                               const char *acct_label_message,
+                               gboolean ok_is_default,
+                               GList * acct_types, QofBook *book,
+                               /* Returned Data... */
+                               Timespec *date, Account **acct);
 
 #endif /* _DIALOG_DATE_CLOSE_H */

Modified: gnucash/trunk/src/business/business-gnome/dialog-employee.c
===================================================================
--- gnucash/trunk/src/business/business-gnome/dialog-employee.c	2010-03-02 21:40:28 UTC (rev 18788)
+++ gnucash/trunk/src/business/business-gnome/dialog-employee.c	2010-03-02 21:41:05 UTC (rev 18789)
@@ -61,534 +61,558 @@
 
 typedef enum
 {
-  NEW_EMPLOYEE,
-  EDIT_EMPLOYEE
+    NEW_EMPLOYEE,
+    EDIT_EMPLOYEE
 } EmployeeDialogType;
 
-struct _employee_select_window {
-  QofBook *	book;
-  QueryNew *	q;
+struct _employee_select_window
+{
+    QofBook *	book;
+    QueryNew *	q;
 };
 
-struct _employee_window {
-  GtkWidget *	dialog;
+struct _employee_window
+{
+    GtkWidget *	dialog;
 
-  GtkWidget *	id_entry;
-  GtkWidget *	username_entry;
+    GtkWidget *	id_entry;
+    GtkWidget *	username_entry;
 
-  GtkWidget *	name_entry;
-  GtkWidget *	addr1_entry;
-  GtkWidget *	addr2_entry;
-  GtkWidget *	addr3_entry;
-  GtkWidget *	addr4_entry;
-  GtkWidget *	phone_entry;
-  GtkWidget *	fax_entry;
-  GtkWidget *	email_entry;
+    GtkWidget *	name_entry;
+    GtkWidget *	addr1_entry;
+    GtkWidget *	addr2_entry;
+    GtkWidget *	addr3_entry;
+    GtkWidget *	addr4_entry;
+    GtkWidget *	phone_entry;
+    GtkWidget *	fax_entry;
+    GtkWidget *	email_entry;
 
-  GtkWidget *	language_entry;
+    GtkWidget *	language_entry;
 
-  GtkWidget *	workday_amount;
-  GtkWidget *	rate_amount;
-  GtkWidget *	currency_edit;
-  GtkWidget *	ccard_acct_check;
-  GtkWidget *	ccard_acct_sel;
+    GtkWidget *	workday_amount;
+    GtkWidget *	rate_amount;
+    GtkWidget *	currency_edit;
+    GtkWidget *	ccard_acct_check;
+    GtkWidget *	ccard_acct_sel;
 
-  GtkWidget *	active_check;
+    GtkWidget *	active_check;
 
-  /* ACL? */
+    /* ACL? */
 
-  EmployeeDialogType	dialog_type;
-  GUID		employee_guid;
-  gint		component_id;
-  QofBook *	book;
-  GncEmployee *	created_employee;
+    EmployeeDialogType	dialog_type;
+    GUID		employee_guid;
+    gint		component_id;
+    QofBook *	book;
+    GncEmployee *	created_employee;
 };
 
 static GncEmployee *
 ew_get_employee (EmployeeWindow *ew)
 {
-  if (!ew)
-    return NULL;
+    if (!ew)
+        return NULL;
 
-  return gncEmployeeLookup (ew->book, &ew->employee_guid);
+    return gncEmployeeLookup (ew->book, &ew->employee_guid);
 }
 
 static void gnc_ui_to_employee (EmployeeWindow *ew, GncEmployee *employee)
 {
-  GncAddress *addr;
+    GncAddress *addr;
 
-  addr = gncEmployeeGetAddr (employee);
+    addr = gncEmployeeGetAddr (employee);
 
-  gnc_suspend_gui_refresh ();
+    gnc_suspend_gui_refresh ();
 
-  gncEmployeeBeginEdit (employee);
+    gncEmployeeBeginEdit (employee);
 
-  gncEmployeeSetID (employee, gtk_editable_get_chars
-		    (GTK_EDITABLE (ew->id_entry), 0, -1));
-  gncEmployeeSetUsername (employee, gtk_editable_get_chars
-		      (GTK_EDITABLE (ew->username_entry), 0, -1));
+    gncEmployeeSetID (employee, gtk_editable_get_chars
+                      (GTK_EDITABLE (ew->id_entry), 0, -1));
+    gncEmployeeSetUsername (employee, gtk_editable_get_chars
+                            (GTK_EDITABLE (ew->username_entry), 0, -1));
 
-  gncAddressSetName (addr, gtk_editable_get_chars
-		     (GTK_EDITABLE (ew->name_entry), 0, -1));
-  gncAddressSetAddr1 (addr, gtk_editable_get_chars
-		      (GTK_EDITABLE (ew->addr1_entry), 0, -1));
-  gncAddressSetAddr2 (addr, gtk_editable_get_chars
-		      (GTK_EDITABLE (ew->addr2_entry), 0, -1));
-  gncAddressSetAddr3 (addr, gtk_editable_get_chars
-		      (GTK_EDITABLE (ew->addr3_entry), 0, -1));
-  gncAddressSetAddr4 (addr, gtk_editable_get_chars
-		      (GTK_EDITABLE (ew->addr4_entry), 0, -1));
-  gncAddressSetPhone (addr, gtk_editable_get_chars
-		      (GTK_EDITABLE (ew->phone_entry), 0, -1));
-  gncAddressSetFax (addr, gtk_editable_get_chars
-		    (GTK_EDITABLE (ew->fax_entry), 0, -1));
-  gncAddressSetEmail (addr, gtk_editable_get_chars
-		      (GTK_EDITABLE (ew->email_entry), 0, -1));
+    gncAddressSetName (addr, gtk_editable_get_chars
+                       (GTK_EDITABLE (ew->name_entry), 0, -1));
+    gncAddressSetAddr1 (addr, gtk_editable_get_chars
+                        (GTK_EDITABLE (ew->addr1_entry), 0, -1));
+    gncAddressSetAddr2 (addr, gtk_editable_get_chars
+                        (GTK_EDITABLE (ew->addr2_entry), 0, -1));
+    gncAddressSetAddr3 (addr, gtk_editable_get_chars
+                        (GTK_EDITABLE (ew->addr3_entry), 0, -1));
+    gncAddressSetAddr4 (addr, gtk_editable_get_chars
+                        (GTK_EDITABLE (ew->addr4_entry), 0, -1));
+    gncAddressSetPhone (addr, gtk_editable_get_chars
+                        (GTK_EDITABLE (ew->phone_entry), 0, -1));
+    gncAddressSetFax (addr, gtk_editable_get_chars
+                      (GTK_EDITABLE (ew->fax_entry), 0, -1));
+    gncAddressSetEmail (addr, gtk_editable_get_chars
+                        (GTK_EDITABLE (ew->email_entry), 0, -1));
 
-  gncEmployeeSetActive (employee, gtk_toggle_button_get_active
-			(GTK_TOGGLE_BUTTON (ew->active_check)));
-  gncEmployeeSetLanguage (employee, gtk_editable_get_chars
-		       (GTK_EDITABLE (ew->language_entry), 0, -1));
+    gncEmployeeSetActive (employee, gtk_toggle_button_get_active
+                          (GTK_TOGGLE_BUTTON (ew->active_check)));
+    gncEmployeeSetLanguage (employee, gtk_editable_get_chars
+                            (GTK_EDITABLE (ew->language_entry), 0, -1));
 
-  /* Parse and set the workday and rate amounts */
-  gncEmployeeSetWorkday (employee, gnc_amount_edit_get_amount
-		       (GNC_AMOUNT_EDIT (ew->workday_amount)));
-  gncEmployeeSetRate (employee, gnc_amount_edit_get_amount
-		       (GNC_AMOUNT_EDIT (ew->rate_amount)));
-  gncEmployeeSetCurrency (employee, gnc_currency_edit_get_currency
-			  (GNC_CURRENCY_EDIT (ew->currency_edit)));
+    /* Parse and set the workday and rate amounts */
+    gncEmployeeSetWorkday (employee, gnc_amount_edit_get_amount
+                           (GNC_AMOUNT_EDIT (ew->workday_amount)));
+    gncEmployeeSetRate (employee, gnc_amount_edit_get_amount
+                        (GNC_AMOUNT_EDIT (ew->rate_amount)));
+    gncEmployeeSetCurrency (employee, gnc_currency_edit_get_currency
+                            (GNC_CURRENCY_EDIT (ew->currency_edit)));
 
-  /* Fill in the CCard Acct */
-  gncEmployeeSetCCard (employee,
-		       (gtk_toggle_button_get_active
-			(GTK_TOGGLE_BUTTON (ew->ccard_acct_check)) ?
-			gnc_account_sel_get_account
-			(GNC_ACCOUNT_SEL (ew->ccard_acct_sel)) : NULL));
+    /* Fill in the CCard Acct */
+    gncEmployeeSetCCard (employee,
+                         (gtk_toggle_button_get_active
+                          (GTK_TOGGLE_BUTTON (ew->ccard_acct_check)) ?
+                          gnc_account_sel_get_account
+                          (GNC_ACCOUNT_SEL (ew->ccard_acct_sel)) : NULL));
 
-  gncEmployeeCommitEdit (employee);
-  gnc_resume_gui_refresh ();
+    gncEmployeeCommitEdit (employee);
+    gnc_resume_gui_refresh ();
 }
 
 #if 0
 static gboolean check_edit_amount (GtkWidget *dialog, GtkWidget *amount,
-				   gnc_numeric *min, gnc_numeric *max,
-				   const char * error_message)
+                                   gnc_numeric *min, gnc_numeric *max,
+                                   const char * error_message)
 {
-  if (!gnc_amount_edit_evaluate (GNC_AMOUNT_EDIT (amount))) {
-    if (error_message)
-      gnc_error_dialog (dialog, error_message);
-    return TRUE;
-  }
-  /* We've got a valid-looking number; check mix/max */
-  if (min || max) {
-    gnc_numeric val = gnc_amount_edit_get_amount (GNC_AMOUNT_EDIT (amount));
-    if ((min && gnc_numeric_compare (*min, val) > 0) ||
-	(max && gnc_numeric_compare (val, *max) > 0)) {
-      if (error_message)
-	gnc_error_dialog (dialog, error_message);
-      return TRUE;
+    if (!gnc_amount_edit_evaluate (GNC_AMOUNT_EDIT (amount)))
+    {
+        if (error_message)
+            gnc_error_dialog (dialog, error_message);
+        return TRUE;
     }
-  }
-  return FALSE;
+    /* We've got a valid-looking number; check mix/max */
+    if (min || max)
+    {
+        gnc_numeric val = gnc_amount_edit_get_amount (GNC_AMOUNT_EDIT (amount));
+        if ((min && gnc_numeric_compare (*min, val) > 0) ||
+                (max && gnc_numeric_compare (val, *max) > 0))
+        {
+            if (error_message)
+                gnc_error_dialog (dialog, error_message);
+            return TRUE;
+        }
+    }
+    return FALSE;
 }
 #endif
 
-static gboolean check_entry_nonempty (GtkWidget *dialog, GtkWidget *entry, 
-				      const char * error_message)
+static gboolean check_entry_nonempty (GtkWidget *dialog, GtkWidget *entry,
+                                      const char * error_message)
 {
-  const char *res = gtk_entry_get_text (GTK_ENTRY (entry));
-  if (safe_strcmp (res, "") == 0) {
-    if (error_message)
-      gnc_error_dialog (dialog, "%s", error_message);
-    return TRUE;
-  }
-  return FALSE;
+    const char *res = gtk_entry_get_text (GTK_ENTRY (entry));
+    if (safe_strcmp (res, "") == 0)
+    {
+        if (error_message)
+            gnc_error_dialog (dialog, "%s", error_message);
+        return TRUE;
+    }
+    return FALSE;
 }
 
 void
 gnc_employee_window_ok_cb (GtkWidget *widget, gpointer data)
 {
-  EmployeeWindow *ew = data;
-  gchar *string;
+    EmployeeWindow *ew = data;
+    gchar *string;
 
-  /* Check for valid username */
-  if (check_entry_nonempty (ew->dialog, ew->username_entry,
-		   _("You must enter a username.")))
-    return;
+    /* Check for valid username */
+    if (check_entry_nonempty (ew->dialog, ew->username_entry,
+                              _("You must enter a username.")))
+        return;
 
-  /* Check for valid username */
-  if (check_entry_nonempty (ew->dialog, ew->name_entry,
-		   _("You must enter the employee's name.")))
-    return;
+    /* Check for valid username */
+    if (check_entry_nonempty (ew->dialog, ew->name_entry,
+                              _("You must enter the employee's name.")))
+        return;
 
-  /* Make sure we have an address */
-  if (check_entry_nonempty (ew->dialog, ew->addr1_entry, NULL) &&
-      check_entry_nonempty (ew->dialog, ew->addr2_entry, NULL) &&
-      check_entry_nonempty (ew->dialog, ew->addr3_entry, NULL) &&
-      check_entry_nonempty (ew->dialog, ew->addr4_entry, NULL)) {
-    const char *msg = _("You must enter an address.");
-    gnc_error_dialog (ew->dialog, "%s", msg);
-    return;
-  }
+    /* Make sure we have an address */
+    if (check_entry_nonempty (ew->dialog, ew->addr1_entry, NULL) &&
+            check_entry_nonempty (ew->dialog, ew->addr2_entry, NULL) &&
+            check_entry_nonempty (ew->dialog, ew->addr3_entry, NULL) &&
+            check_entry_nonempty (ew->dialog, ew->addr4_entry, NULL))
+    {
+        const char *msg = _("You must enter an address.");
+        gnc_error_dialog (ew->dialog, "%s", msg);
+        return;
+    }
 
-  /* Set the employee id if one has not been chosen */
-  if (safe_strcmp (gtk_entry_get_text (GTK_ENTRY (ew->id_entry)), "") == 0) {
-    string = g_strdup_printf ("%.6" G_GINT64_FORMAT,
-			      gncEmployeeNextID (ew->book));
-    gtk_entry_set_text (GTK_ENTRY (ew->id_entry), string);
-    g_free(string);
-  }
+    /* Set the employee id if one has not been chosen */
+    if (safe_strcmp (gtk_entry_get_text (GTK_ENTRY (ew->id_entry)), "") == 0)
+    {
+        string = g_strdup_printf ("%.6" G_GINT64_FORMAT,
+                                  gncEmployeeNextID (ew->book));
+        gtk_entry_set_text (GTK_ENTRY (ew->id_entry), string);
+        g_free(string);
+    }
 
-  /* Now save it off */
-  {
-    GncEmployee *employee = ew_get_employee (ew);
-    if (employee) {
-      gnc_ui_to_employee (ew, employee);
+    /* Now save it off */
+    {
+        GncEmployee *employee = ew_get_employee (ew);
+        if (employee)
+        {
+            gnc_ui_to_employee (ew, employee);
+        }
+        ew->created_employee = employee;
+        ew->employee_guid = *xaccGUIDNULL ();
     }
-    ew->created_employee = employee;
-    ew->employee_guid = *xaccGUIDNULL ();
-  }
 
-  gnc_close_gui_component (ew->component_id);
+    gnc_close_gui_component (ew->component_id);
 }
 
 void
 gnc_employee_window_cancel_cb (GtkWidget *widget, gpointer data)
 {
-  EmployeeWindow *ew = data;
+    EmployeeWindow *ew = data;
 
-  gnc_close_gui_component (ew->component_id);
+    gnc_close_gui_component (ew->component_id);
 }
 
 void
 gnc_employee_window_help_cb (GtkWidget *widget, gpointer data)
 {
-  gnc_gnome_help(HF_HELP, HL_USAGE);
+    gnc_gnome_help(HF_HELP, HL_USAGE);
 }
 
 void
 gnc_employee_window_destroy_cb (GtkWidget *widget, gpointer data)
 {
-  EmployeeWindow *ew = data;
-  GncEmployee *employee = ew_get_employee (ew);
+    EmployeeWindow *ew = data;
+    GncEmployee *employee = ew_get_employee (ew);
 
-  gnc_suspend_gui_refresh ();
+    gnc_suspend_gui_refresh ();
 
-  if (ew->dialog_type == NEW_EMPLOYEE && employee != NULL) {
-    gncEmployeeBeginEdit (employee);
-    gncEmployeeDestroy (employee);
-    ew->employee_guid = *xaccGUIDNULL ();
-  }
+    if (ew->dialog_type == NEW_EMPLOYEE && employee != NULL)
+    {
+        gncEmployeeBeginEdit (employee);
+        gncEmployeeDestroy (employee);
+        ew->employee_guid = *xaccGUIDNULL ();
+    }
 
-  gnc_unregister_gui_component (ew->component_id);
-  gnc_resume_gui_refresh ();
+    gnc_unregister_gui_component (ew->component_id);
+    gnc_resume_gui_refresh ();
 
-  g_free (ew);
+    g_free (ew);
 }
 
 void
 gnc_employee_name_changed_cb (GtkWidget *widget, gpointer data)
 {
-  EmployeeWindow *ew = data;
-  char *fullname, *title;
-  const char *name, *id;
+    EmployeeWindow *ew = data;
+    char *fullname, *title;
+    const char *name, *id;
 
-  if (!ew)
-    return;
+    if (!ew)
+        return;
 
-  name = gtk_entry_get_text (GTK_ENTRY (ew->name_entry));
-  if (!name || *name == '\0')
-    name = _("<No name>");
+    name = gtk_entry_get_text (GTK_ENTRY (ew->name_entry));
+    if (!name || *name == '\0')
+        name = _("<No name>");
 
-  id = gtk_entry_get_text (GTK_ENTRY (ew->id_entry));
+    id = gtk_entry_get_text (GTK_ENTRY (ew->id_entry));
 
-  fullname = g_strconcat (name, " (", id, ")", (char *)NULL);
+    fullname = g_strconcat (name, " (", id, ")", (char *)NULL);
 
-  if (ew->dialog_type == EDIT_EMPLOYEE)
-    title = g_strconcat (_("Edit Employee"), " - ", fullname, (char *)NULL);
-  else
-    title = g_strconcat (_("New Employee"), " - ", fullname, (char *)NULL);
+    if (ew->dialog_type == EDIT_EMPLOYEE)
+        title = g_strconcat (_("Edit Employee"), " - ", fullname, (char *)NULL);
+    else
+        title = g_strconcat (_("New Employee"), " - ", fullname, (char *)NULL);
 
-  gtk_window_set_title (GTK_WINDOW (ew->dialog), title);
+    gtk_window_set_title (GTK_WINDOW (ew->dialog), title);
 
-  g_free (fullname);
-  g_free (title);
+    g_free (fullname);
+    g_free (title);
 }
 
 void
 gnc_employee_ccard_acct_toggled_cb (GtkToggleButton *button, gpointer data)
 {
-  EmployeeWindow *ew = data;
+    EmployeeWindow *ew = data;
 
-  if (!ew)
-    return;
+    if (!ew)
+        return;
 
-  if (gtk_toggle_button_get_active (button)) {
-    gtk_widget_set_sensitive (ew->ccard_acct_sel, TRUE);
-    gtk_widget_show (ew->ccard_acct_sel);
-  } else {
-    gtk_widget_set_sensitive (ew->ccard_acct_sel, TRUE);
-    gtk_widget_hide (ew->ccard_acct_sel);
-  }
+    if (gtk_toggle_button_get_active (button))
+    {
+        gtk_widget_set_sensitive (ew->ccard_acct_sel, TRUE);
+        gtk_widget_show (ew->ccard_acct_sel);
+    }
+    else
+    {
+        gtk_widget_set_sensitive (ew->ccard_acct_sel, TRUE);
+        gtk_widget_hide (ew->ccard_acct_sel);
+    }
 }
 
 static void
 gnc_employee_window_close_handler (gpointer user_data)
 {
-  EmployeeWindow *ew = user_data;
+    EmployeeWindow *ew = user_data;
 
-  gtk_widget_destroy (ew->dialog);
+    gtk_widget_destroy (ew->dialog);
 }
 
 static void
 gnc_employee_window_refresh_handler (GHashTable *changes, gpointer user_data)
 {
-  EmployeeWindow *ew = user_data;
-  const EventInfo *info;
-  GncEmployee *employee = ew_get_employee (ew);
+    EmployeeWindow *ew = user_data;
+    const EventInfo *info;
+    GncEmployee *employee = ew_get_employee (ew);
 
-  /* If there isn't a employee behind us, close down */
-  if (!employee) {
-    gnc_close_gui_component (ew->component_id);
-    return;
-  }
+    /* If there isn't a employee behind us, close down */
+    if (!employee)
+    {
+        gnc_close_gui_component (ew->component_id);
+        return;
+    }
 
-  /* Next, close if this is a destroy event */
-  if (changes) {
-    info = gnc_gui_get_entity_events (changes, &ew->employee_guid);
-    if (info && (info->event_mask & QOF_EVENT_DESTROY)) {
-      gnc_close_gui_component (ew->component_id);
-      return;
+    /* Next, close if this is a destroy event */
+    if (changes)
+    {
+        info = gnc_gui_get_entity_events (changes, &ew->employee_guid);
+        if (info && (info->event_mask & QOF_EVENT_DESTROY))
+        {
+            gnc_close_gui_component (ew->component_id);
+            return;
+        }
     }
-  }
 }
 
 static gboolean
 find_handler (gpointer find_data, gpointer user_data)
 {
-  const GUID *employee_guid = find_data;
-  EmployeeWindow *ew = user_data;
+    const GUID *employee_guid = find_data;
+    EmployeeWindow *ew = user_data;
 
-  return(ew && guid_equal(&ew->employee_guid, employee_guid));
+    return(ew && guid_equal(&ew->employee_guid, employee_guid));
 }
 
 static EmployeeWindow *
 gnc_employee_new_window (QofBook *bookp,
-			 GncEmployee *employee)
+                         GncEmployee *employee)
 {
-  EmployeeWindow *ew;
-  GladeXML *xml;
-  GtkWidget *hbox, *edit;
-  gnc_commodity *currency;
-  GNCPrintAmountInfo print_info;
-  GList *acct_types;
-  Account *ccard_acct;
+    EmployeeWindow *ew;
+    GladeXML *xml;
+    GtkWidget *hbox, *edit;
+    gnc_commodity *currency;
+    GNCPrintAmountInfo print_info;
+    GList *acct_types;
+    Account *ccard_acct;
 
-  /*
-   * Find an existing window for this employee.  If found, bring it to
-   * the front.
-   */
-  if (employee) {
-    GUID employee_guid;
-    
-    employee_guid = *gncEmployeeGetGUID (employee);
-    ew = gnc_find_first_gui_component (DIALOG_EDIT_EMPLOYEE_CM_CLASS,
-				       find_handler, &employee_guid);
-    if (ew) {
-      gtk_window_present (GTK_WINDOW(ew->dialog));
-      return(ew);
+    /*
+     * Find an existing window for this employee.  If found, bring it to
+     * the front.
+     */
+    if (employee)
+    {
+        GUID employee_guid;
+
+        employee_guid = *gncEmployeeGetGUID (employee);
+        ew = gnc_find_first_gui_component (DIALOG_EDIT_EMPLOYEE_CM_CLASS,
+                                           find_handler, &employee_guid);
+        if (ew)
+        {
+            gtk_window_present (GTK_WINDOW(ew->dialog));
+            return(ew);
+        }
     }
-  }
-  
-  /* Find the default currency */
-  if (employee)
-    currency = gncEmployeeGetCurrency (employee);
-  else
-    currency = gnc_default_currency ();
 
-  /*
-   * No existing employee window found.  Build a new one.
-   */
-  ew = g_new0 (EmployeeWindow, 1);
+    /* Find the default currency */
+    if (employee)
+        currency = gncEmployeeGetCurrency (employee);
+    else
+        currency = gnc_default_currency ();
 
-  ew->book = bookp;
+    /*
+     * No existing employee window found.  Build a new one.
+     */
+    ew = g_new0 (EmployeeWindow, 1);
 
-  /* Find the dialog */
-  xml = gnc_glade_xml_new ("employee.glade", "Employee Dialog");
-  ew->dialog = glade_xml_get_widget (xml, "Employee Dialog");
+    ew->book = bookp;
 
-  g_object_set_data (G_OBJECT (ew->dialog), "dialog_info", ew);
+    /* Find the dialog */
+    xml = gnc_glade_xml_new ("employee.glade", "Employee Dialog");
+    ew->dialog = glade_xml_get_widget (xml, "Employee Dialog");
 
-  /* Get entry points */
-  ew->id_entry = glade_xml_get_widget (xml, "id_entry");
-  ew->username_entry = glade_xml_get_widget (xml, "username_entry");
+    g_object_set_data (G_OBJECT (ew->dialog), "dialog_info", ew);
 
-  ew->name_entry = glade_xml_get_widget (xml, "name_entry");
-  ew->addr1_entry = glade_xml_get_widget (xml, "addr1_entry");
-  ew->addr2_entry = glade_xml_get_widget (xml, "addr2_entry");
-  ew->addr3_entry = glade_xml_get_widget (xml, "addr3_entry");
-  ew->addr4_entry = glade_xml_get_widget (xml, "addr4_entry");
-  ew->phone_entry = glade_xml_get_widget (xml, "phone_entry");
-  ew->fax_entry = glade_xml_get_widget (xml, "fax_entry");
-  ew->email_entry = glade_xml_get_widget (xml, "email_entry");
+    /* Get entry points */
+    ew->id_entry = glade_xml_get_widget (xml, "id_entry");
+    ew->username_entry = glade_xml_get_widget (xml, "username_entry");
 
-  ew->language_entry = glade_xml_get_widget (xml, "language_entry");
-  ew->active_check = glade_xml_get_widget (xml, "active_check");
+    ew->name_entry = glade_xml_get_widget (xml, "name_entry");
+    ew->addr1_entry = glade_xml_get_widget (xml, "addr1_entry");
+    ew->addr2_entry = glade_xml_get_widget (xml, "addr2_entry");
+    ew->addr3_entry = glade_xml_get_widget (xml, "addr3_entry");
+    ew->addr4_entry = glade_xml_get_widget (xml, "addr4_entry");
+    ew->phone_entry = glade_xml_get_widget (xml, "phone_entry");
+    ew->fax_entry = glade_xml_get_widget (xml, "fax_entry");
+    ew->email_entry = glade_xml_get_widget (xml, "email_entry");
 
-  /* Currency */
-  edit = gnc_currency_edit_new();
-  gnc_currency_edit_set_currency (GNC_CURRENCY_EDIT(edit), currency);
-  ew->currency_edit = edit;
+    ew->language_entry = glade_xml_get_widget (xml, "language_entry");
+    ew->active_check = glade_xml_get_widget (xml, "active_check");
 
-  hbox = glade_xml_get_widget (xml, "currency_box");
-  gtk_box_pack_start (GTK_BOX (hbox), edit, TRUE, TRUE, 0);
+    /* Currency */
+    edit = gnc_currency_edit_new();
+    gnc_currency_edit_set_currency (GNC_CURRENCY_EDIT(edit), currency);
+    ew->currency_edit = edit;
 
-  /* WORKDAY: Value */
-  edit = gnc_amount_edit_new();
-  gnc_amount_edit_set_evaluate_on_enter (GNC_AMOUNT_EDIT (edit), TRUE);
-  print_info = gnc_integral_print_info ();
-  print_info.max_decimal_places = 5;
-  gnc_amount_edit_set_print_info (GNC_AMOUNT_EDIT (edit), print_info);
-  gnc_amount_edit_set_fraction (GNC_AMOUNT_EDIT (edit), 100000);
-  ew->workday_amount = edit;
-  gtk_widget_show (edit);
+    hbox = glade_xml_get_widget (xml, "currency_box");
+    gtk_box_pack_start (GTK_BOX (hbox), edit, TRUE, TRUE, 0);
 
-  hbox = glade_xml_get_widget (xml, "hours_hbox");
-  gtk_box_pack_start (GTK_BOX (hbox), edit, TRUE, TRUE, 0);
+    /* WORKDAY: Value */
+    edit = gnc_amount_edit_new();
+    gnc_amount_edit_set_evaluate_on_enter (GNC_AMOUNT_EDIT (edit), TRUE);
+    print_info = gnc_integral_print_info ();
+    print_info.max_decimal_places = 5;
+    gnc_amount_edit_set_print_info (GNC_AMOUNT_EDIT (edit), print_info);
+    gnc_amount_edit_set_fraction (GNC_AMOUNT_EDIT (edit), 100000);
+    ew->workday_amount = edit;
+    gtk_widget_show (edit);
 
-  /* RATE: Monetary Value */
-  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));
-  ew->rate_amount = edit;
-  gtk_widget_show (edit);
+    hbox = glade_xml_get_widget (xml, "hours_hbox");
+    gtk_box_pack_start (GTK_BOX (hbox), edit, TRUE, TRUE, 0);
 
-  hbox = glade_xml_get_widget (xml, "rate_hbox");
-  gtk_box_pack_start (GTK_BOX (hbox), edit, TRUE, TRUE, 0);
+    /* RATE: Monetary Value */
+    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));
+    ew->rate_amount = edit;
+    gtk_widget_show (edit);
 
-  /* CCard Account Selection */
-  ew->ccard_acct_check = glade_xml_get_widget (xml, "ccard_check");
+    hbox = glade_xml_get_widget (xml, "rate_hbox");
+    gtk_box_pack_start (GTK_BOX (hbox), edit, TRUE, TRUE, 0);
 
-  edit = gnc_account_sel_new();
-  acct_types = g_list_prepend(NULL, (gpointer)ACCT_TYPE_CREDIT);
-  gnc_account_sel_set_acct_filters (GNC_ACCOUNT_SEL(edit), acct_types, NULL);
-  g_list_free (acct_types);
+    /* CCard Account Selection */
+    ew->ccard_acct_check = glade_xml_get_widget (xml, "ccard_check");
 
-  ew->ccard_acct_sel = edit;
-  gtk_widget_show (edit);
+    edit = gnc_account_sel_new();
+    acct_types = g_list_prepend(NULL, (gpointer)ACCT_TYPE_CREDIT);
+    gnc_account_sel_set_acct_filters (GNC_ACCOUNT_SEL(edit), acct_types, NULL);
+    g_list_free (acct_types);
 
-  hbox = glade_xml_get_widget (xml, "ccard_acct_hbox");
-  gtk_box_pack_start (GTK_BOX (hbox), edit, TRUE, TRUE, 0);
+    ew->ccard_acct_sel = edit;
+    gtk_widget_show (edit);
 
-  /* Setup signals */
-  glade_xml_signal_autoconnect_full( xml,
-                                     gnc_glade_autoconnect_full_func,
-                                     ew);
+    hbox = glade_xml_get_widget (xml, "ccard_acct_hbox");
+    gtk_box_pack_start (GTK_BOX (hbox), edit, TRUE, TRUE, 0);
 
-  /* Setup initial values */
-  if (employee != NULL) {
-    GncAddress *addr;
+    /* Setup signals */
+    glade_xml_signal_autoconnect_full( xml,
+                                       gnc_glade_autoconnect_full_func,
+                                       ew);
 
-    ew->dialog_type = EDIT_EMPLOYEE;
-    ew->employee_guid = *gncEmployeeGetGUID (employee);
+    /* Setup initial values */
+    if (employee != NULL)
+    {
+        GncAddress *addr;
 
-    addr = gncEmployeeGetAddr (employee);
+        ew->dialog_type = EDIT_EMPLOYEE;
+        ew->employee_guid = *gncEmployeeGetGUID (employee);
 
-    gtk_entry_set_text (GTK_ENTRY (ew->id_entry), gncEmployeeGetID (employee));
-    gtk_entry_set_text (GTK_ENTRY (ew->username_entry), gncEmployeeGetUsername (employee));
+        addr = gncEmployeeGetAddr (employee);
 
-    /* Setup Address */
-    gtk_entry_set_text (GTK_ENTRY (ew->name_entry), gncAddressGetName (addr));
-    gtk_entry_set_text (GTK_ENTRY (ew->addr1_entry), gncAddressGetAddr1 (addr));
-    gtk_entry_set_text (GTK_ENTRY (ew->addr2_entry), gncAddressGetAddr2 (addr));
-    gtk_entry_set_text (GTK_ENTRY (ew->addr3_entry), gncAddressGetAddr3 (addr));
-    gtk_entry_set_text (GTK_ENTRY (ew->addr4_entry), gncAddressGetAddr4 (addr));
-    gtk_entry_set_text (GTK_ENTRY (ew->phone_entry), gncAddressGetPhone (addr));
-    gtk_entry_set_text (GTK_ENTRY (ew->fax_entry), gncAddressGetFax (addr));
-    gtk_entry_set_text (GTK_ENTRY (ew->email_entry), gncAddressGetEmail (addr));
+        gtk_entry_set_text (GTK_ENTRY (ew->id_entry), gncEmployeeGetID (employee));
+        gtk_entry_set_text (GTK_ENTRY (ew->username_entry), gncEmployeeGetUsername (employee));
 
-    gtk_entry_set_text (GTK_ENTRY (ew->language_entry),
-			gncEmployeeGetLanguage (employee));
+        /* Setup Address */
+        gtk_entry_set_text (GTK_ENTRY (ew->name_entry), gncAddressGetName (addr));
+        gtk_entry_set_text (GTK_ENTRY (ew->addr1_entry), gncAddressGetAddr1 (addr));
+        gtk_entry_set_text (GTK_ENTRY (ew->addr2_entry), gncAddressGetAddr2 (addr));
+        gtk_entry_set_text (GTK_ENTRY (ew->addr3_entry), gncAddressGetAddr3 (addr));
+        gtk_entry_set_text (GTK_ENTRY (ew->addr4_entry), gncAddressGetAddr4 (addr));
+        gtk_entry_set_text (GTK_ENTRY (ew->phone_entry), gncAddressGetPhone (addr));
+        gtk_entry_set_text (GTK_ENTRY (ew->fax_entry), gncAddressGetFax (addr));
+        gtk_entry_set_text (GTK_ENTRY (ew->email_entry), gncAddressGetEmail (addr));
 
-    /* Set toggle buttons */
-    gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (ew->active_check),
-                                gncEmployeeGetActive (employee));
+        gtk_entry_set_text (GTK_ENTRY (ew->language_entry),
+                            gncEmployeeGetLanguage (employee));
 
-    ew->component_id =
-      gnc_register_gui_component (DIALOG_EDIT_EMPLOYEE_CM_CLASS,
-				  gnc_employee_window_refresh_handler,
-				  gnc_employee_window_close_handler,
-				  ew);
-  } else {
-    employee = gncEmployeeCreate (bookp);
-    ew->employee_guid = *gncEmployeeGetGUID (employee);
+        /* Set toggle buttons */
+        gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (ew->active_check),
+                                      gncEmployeeGetActive (employee));
 
-    ew->dialog_type = NEW_EMPLOYEE;
-    ew->component_id =
-      gnc_register_gui_component (DIALOG_NEW_EMPLOYEE_CM_CLASS,
-				  gnc_employee_window_refresh_handler,
-				  gnc_employee_window_close_handler,
-				  ew);
-  }
+        ew->component_id =
+            gnc_register_gui_component (DIALOG_EDIT_EMPLOYEE_CM_CLASS,
+                                        gnc_employee_window_refresh_handler,
+                                        gnc_employee_window_close_handler,
+                                        ew);
+    }
+    else
+    {
+        employee = gncEmployeeCreate (bookp);
+        ew->employee_guid = *gncEmployeeGetGUID (employee);
 
+        ew->dialog_type = NEW_EMPLOYEE;
+        ew->component_id =
+            gnc_register_gui_component (DIALOG_NEW_EMPLOYEE_CM_CLASS,
+                                        gnc_employee_window_refresh_handler,
+                                        gnc_employee_window_close_handler,
+                                        ew);
+    }
 
-  /* I know that employee exists here -- either passed in or just created */
-  /* Set the workday and rate values */
-  gnc_amount_edit_set_amount (GNC_AMOUNT_EDIT (ew->workday_amount),
-			      gncEmployeeGetWorkday (employee));
-  gnc_amount_edit_set_amount (GNC_AMOUNT_EDIT (ew->rate_amount),
-			      gncEmployeeGetRate (employee));
 
+    /* I know that employee exists here -- either passed in or just created */
+    /* Set the workday and rate values */
+    gnc_amount_edit_set_amount (GNC_AMOUNT_EDIT (ew->workday_amount),
+                                gncEmployeeGetWorkday (employee));
+    gnc_amount_edit_set_amount (GNC_AMOUNT_EDIT (ew->rate_amount),
+                                gncEmployeeGetRate (employee));
 
-  ccard_acct = gncEmployeeGetCCard (employee);
-  if (ccard_acct == NULL) {
-    gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (ew->ccard_acct_check), FALSE);
-    gtk_widget_set_sensitive (ew->ccard_acct_sel, FALSE);
-  } else {
-    gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (ew->ccard_acct_check), TRUE);
-    gnc_account_sel_set_account (GNC_ACCOUNT_SEL (ew->ccard_acct_sel), ccard_acct, FALSE);
-  }
 
-  /* XXX: Set the ACL */
+    ccard_acct = gncEmployeeGetCCard (employee);
+    if (ccard_acct == NULL)
+    {
+        gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (ew->ccard_acct_check), FALSE);
+        gtk_widget_set_sensitive (ew->ccard_acct_sel, FALSE);
+    }
+    else
+    {
+        gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (ew->ccard_acct_check), TRUE);
+        gnc_account_sel_set_account (GNC_ACCOUNT_SEL (ew->ccard_acct_sel), ccard_acct, FALSE);
+    }
 
-  gnc_gui_component_watch_entity_type (ew->component_id,
-				       GNC_EMPLOYEE_MODULE_NAME,
-				       QOF_EVENT_MODIFY | QOF_EVENT_DESTROY);
+    /* XXX: Set the ACL */
 
-  gtk_widget_show_all (ew->dialog);
+    gnc_gui_component_watch_entity_type (ew->component_id,
+                                         GNC_EMPLOYEE_MODULE_NAME,
+                                         QOF_EVENT_MODIFY | QOF_EVENT_DESTROY);
 
-  if (ccard_acct == NULL)
-    gtk_widget_hide (ew->ccard_acct_sel);
+    gtk_widget_show_all (ew->dialog);
 
-  return ew;
+    if (ccard_acct == NULL)
+        gtk_widget_hide (ew->ccard_acct_sel);
+
+    return ew;
 }
 
 EmployeeWindow *
 gnc_ui_employee_new (QofBook *bookp)
 {
-  EmployeeWindow *ew;
+    EmployeeWindow *ew;
 
-  /* Make sure required options exist */
-  if (!bookp) return NULL;
+    /* Make sure required options exist */
+    if (!bookp) return NULL;
 
-  ew = gnc_employee_new_window (bookp, NULL);
+    ew = gnc_employee_new_window (bookp, NULL);
 
-  return ew;
+    return ew;
 }
 
 EmployeeWindow *
 gnc_ui_employee_edit (GncEmployee *employee)
 {
-  EmployeeWindow *ew;
+    EmployeeWindow *ew;
 
-  if (!employee) return NULL;
+    if (!employee) return NULL;
 
-  ew = gnc_employee_new_window (gncEmployeeGetBook(employee), employee);
+    ew = gnc_employee_new_window (gncEmployeeGetBook(employee), employee);
 
-  return ew;
+    return ew;
 }
 
 /* Functions for employee selection widgets */
@@ -596,154 +620,158 @@
 static void
 invoice_employee_cb (gpointer *employee_p, gpointer user_data)
 {
-  struct _employee_select_window *sw = user_data;
-  GncOwner owner;
-  GncEmployee *employee;
+    struct _employee_select_window *sw = user_data;
+    GncOwner owner;
+    GncEmployee *employee;
 
-  g_return_if_fail (employee_p && user_data);
+    g_return_if_fail (employee_p && user_data);
 
-  employee = *employee_p;
+    employee = *employee_p;
 
-  if (!employee)
+    if (!employee)
+        return;
+
+    gncOwnerInitEmployee (&owner, employee);
+    gnc_invoice_search (NULL, &owner, sw->book);
     return;
-
-  gncOwnerInitEmployee (&owner, employee);
-  gnc_invoice_search (NULL, &owner, sw->book);
-  return;
 }
 
 static void
 payment_employee_cb (gpointer *employee_p, gpointer user_data)
 {
-  struct _employee_select_window *sw = user_data;
-  GncOwner owner;
-  GncEmployee *employee;
+    struct _employee_select_window *sw = user_data;
+    GncOwner owner;
+    GncEmployee *employee;
 
-  g_return_if_fail (employee_p && user_data);
+    g_return_if_fail (employee_p && user_data);
 
-  employee = *employee_p;
+    employee = *employee_p;
 
-  if (!employee)
+    if (!employee)
+        return;
+
+    gncOwnerInitEmployee (&owner, employee);
+    gnc_ui_payment_new (&owner, sw->book);
     return;
-
-  gncOwnerInitEmployee (&owner, employee);
-  gnc_ui_payment_new (&owner, sw->book);
-  return;
 }
 
 static void
 edit_employee_cb (gpointer *employee_p, gpointer user_data)
 {
-  GncEmployee *employee;
+    GncEmployee *employee;
 
-  g_return_if_fail (employee_p && user_data);
+    g_return_if_fail (employee_p && user_data);
 
-  employee = *employee_p;
+    employee = *employee_p;
 
-  if (!employee)
+    if (!employee)
+        return;
+
+    gnc_ui_employee_edit (employee);
     return;
-
-  gnc_ui_employee_edit (employee);
-  return;
 }
 
 static gpointer
 new_employee_cb (gpointer user_data)
 {
-  struct _employee_select_window *sw = user_data;
-  EmployeeWindow *ew;
-  
-  g_return_val_if_fail (user_data, NULL);
+    struct _employee_select_window *sw = user_data;
+    EmployeeWindow *ew;
 
-  ew = gnc_ui_employee_new (sw->book);
-  return ew_get_employee (ew);
+    g_return_val_if_fail (user_data, NULL);
+
+    ew = gnc_ui_employee_new (sw->book);
+    return ew_get_employee (ew);
 }
 
 static void
 free_employee_cb (gpointer user_data)
 {
-  struct _employee_select_window *sw = user_data;
+    struct _employee_select_window *sw = user_data;
 
-  g_return_if_fail (sw);
+    g_return_if_fail (sw);
 
-  gncQueryDestroy (sw->q);
-  g_free (sw);
+    gncQueryDestroy (sw->q);
+    g_free (sw);
 }
 
 GNCSearchWindow *
 gnc_employee_search (GncEmployee *start, QofBook *book)
 {
-  GNCIdType type = GNC_EMPLOYEE_MODULE_NAME;
-  struct _employee_select_window *sw;
-  QueryNew *q, *q2 = NULL;
-  static GList *params = NULL;
-  static GList *columns = NULL;
-  static GNCSearchCallbackButton buttons[] = { 
-    { N_("View/Edit Employee"), edit_employee_cb},
-    { N_("Expense Vouchers"), invoice_employee_cb},
-    { N_("Process Payment"), payment_employee_cb},
-    { NULL },
-  };
+    GNCIdType type = GNC_EMPLOYEE_MODULE_NAME;
+    struct _employee_select_window *sw;
+    QueryNew *q, *q2 = NULL;
+    static GList *params = NULL;
+    static GList *columns = NULL;
+    static GNCSearchCallbackButton buttons[] =
+    {
+        { N_("View/Edit Employee"), edit_employee_cb},
+        { N_("Expense Vouchers"), invoice_employee_cb},
+        { N_("Process Payment"), payment_employee_cb},
+        { NULL },
+    };
 
-  g_return_val_if_fail (book, NULL);
+    g_return_val_if_fail (book, NULL);
 
-  /* Build parameter list in reverse order*/
-  if (params == NULL) {
-    params = gnc_search_param_prepend (params, _("Employee ID"), NULL, type,
-				       EMPLOYEE_ID, NULL);
-    params = gnc_search_param_prepend (params, _("Employee Username"), NULL,
-				       type, EMPLOYEE_USERNAME, NULL);
-    params = gnc_search_param_prepend (params, _("Employee Name"), NULL,
-				       type, EMPLOYEE_ADDR, ADDRESS_NAME, NULL);
-  }
+    /* Build parameter list in reverse order*/
+    if (params == NULL)
+    {
+        params = gnc_search_param_prepend (params, _("Employee ID"), NULL, type,
+                                           EMPLOYEE_ID, NULL);
+        params = gnc_search_param_prepend (params, _("Employee Username"), NULL,
+                                           type, EMPLOYEE_USERNAME, NULL);
+        params = gnc_search_param_prepend (params, _("Employee Name"), NULL,
+                                           type, EMPLOYEE_ADDR, ADDRESS_NAME, NULL);
+    }
 
-  /* Build the column list in reverse order */
-  if (columns == NULL) {
-    columns = gnc_search_param_prepend (columns, _("Username"), NULL, type,
-					EMPLOYEE_USERNAME, NULL);
-    columns = gnc_search_param_prepend (columns, _("ID #"), NULL, type,
-					EMPLOYEE_ID, NULL);
-    columns = gnc_search_param_prepend (columns, _("Name"), NULL, type,
-					EMPLOYEE_ADDR, ADDRESS_NAME, NULL);
-  }
+    /* Build the column list in reverse order */
+    if (columns == NULL)
+    {
+        columns = gnc_search_param_prepend (columns, _("Username"), NULL, type,
+                                            EMPLOYEE_USERNAME, NULL);
+        columns = gnc_search_param_prepend (columns, _("ID #"), NULL, type,
+                                            EMPLOYEE_ID, NULL);
+        columns = gnc_search_param_prepend (columns, _("Name"), NULL, type,
+                                            EMPLOYEE_ADDR, ADDRESS_NAME, NULL);
+    }
 
-  /* Build the queries */
-  q = gncQueryCreateFor (type);
-  gncQuerySetBook (q, book);
+    /* Build the queries */
+    q = gncQueryCreateFor (type);
+    gncQuerySetBook (q, book);
 
 #if 0
-  if (start) {
-    q2 = gncQueryCopy (q);
-    gncQueryAddGUIDMatch (q2, g_slist_prepend (NULL, QUERY_PARAM_GUID),
-			  gncEmployeeGetGUID (start), QUERY_AND);
-  }
+    if (start)
+    {
+        q2 = gncQueryCopy (q);
+        gncQueryAddGUIDMatch (q2, g_slist_prepend (NULL, QUERY_PARAM_GUID),
+                              gncEmployeeGetGUID (start), QUERY_AND);
+    }
 #endif
 
-  /* launch select dialog and return the result */
-  sw = g_new0 (struct _employee_select_window, 1);
-  sw->book = book;
-  sw->q = q;
+    /* launch select dialog and return the result */
+    sw = g_new0 (struct _employee_select_window, 1);
+    sw->book = book;
+    sw->q = q;
 
-  return gnc_search_dialog_create (type, _("Find Employee"),
-				   params, columns, q, q2,
-				   buttons, NULL, new_employee_cb,
-				   sw, free_employee_cb,
-				   GCONF_SECTION_SEARCH, NULL);
+    return gnc_search_dialog_create (type, _("Find Employee"),
+                                     params, columns, q, q2,
+                                     buttons, NULL, new_employee_cb,
+                                     sw, free_employee_cb,
+                                     GCONF_SECTION_SEARCH, NULL);
 }
 
 GNCSearchWindow *
 gnc_employee_search_select (gpointer start, gpointer book)
 {
-  if (!book) return NULL;
+    if (!book) return NULL;
 
-  return gnc_employee_search (start, book);
+    return gnc_employee_search (start, book);
 }
 
 GNCSearchWindow *
 gnc_employee_search_edit (gpointer start, gpointer book)
 {
-  if (start)
-    gnc_ui_employee_edit (start);
+    if (start)
+        gnc_ui_employee_edit (start);
 
-  return NULL;
+    return NULL;
 }

Modified: gnucash/trunk/src/business/business-gnome/dialog-invoice.c
===================================================================
--- gnucash/trunk/src/business/business-gnome/dialog-invoice.c	2010-03-02 21:40:28 UTC (rev 18788)
+++ gnucash/trunk/src/business/business-gnome/dialog-invoice.c	2010-03-02 21:41:05 UTC (rev 18789)
@@ -107,11 +107,12 @@
 FROM_STRING_FUNC(InvoiceDialogType, ENUM_INVOICE_TYPE)
 AS_STRING_FUNC(InvoiceDialogType, ENUM_INVOICE_TYPE)
 
-struct _invoice_select_window {
-  QofBook *	book;
-  GncOwner *	owner;
-  QueryNew *	q;
-  GncOwner	owner_def;
+struct _invoice_select_window
+{
+    QofBook *	book;
+    GncOwner *	owner;
+    QueryNew *	q;
+    GncOwner	owner_def;
 };
 
 
@@ -120,68 +121,69 @@
  *  maintain information for the "Invoice Entry" page that is embedded
  *  into a main window.  Beware, as not all fields are used by both windows.
  */
-struct _invoice_window {
-  GladeXML *	xml;
+struct _invoice_window
+{
+    GladeXML *	xml;
 
-  GtkWidget *	dialog;		/* Used by 'New Invoice Window' */
-  GncPluginPage *page;		/* Used by 'Edit Invoice' Page */
+    GtkWidget *	dialog;		/* Used by 'New Invoice Window' */
+    GncPluginPage *page;		/* Used by 'Edit Invoice' Page */
 
-  /* Summary Bar Widgets */
-  GtkWidget *	total_label;
-  GtkWidget *	total_cash_label;
-  GtkWidget *	total_charge_label;
-  GtkWidget *	total_subtotal_label;
-  GtkWidget *	total_tax_label;
+    /* Summary Bar Widgets */
+    GtkWidget *	total_label;
+    GtkWidget *	total_cash_label;
+    GtkWidget *	total_charge_label;
+    GtkWidget *	total_subtotal_label;
+    GtkWidget *	total_tax_label;
 
-  /* Data Widgets */
-  GtkWidget *	id_entry;
-  GtkWidget *	notes_text;
-  GtkWidget *	opened_date;
-  GtkWidget *	posted_date_hbox;
-  GtkWidget *	posted_date;
-  GtkWidget *	active_check;
+    /* Data Widgets */
+    GtkWidget *	id_entry;
+    GtkWidget *	notes_text;
+    GtkWidget *	opened_date;
+    GtkWidget *	posted_date_hbox;
+    GtkWidget *	posted_date;
+    GtkWidget *	active_check;
 
-  GtkWidget *	owner_box;
-  GtkWidget *	owner_label;
-  GtkWidget *	owner_choice;
-  GtkWidget *	job_label;
-  GtkWidget *	job_box;
-  GtkWidget *	job_choice;
-  GtkWidget *	billing_id_entry;
-  GtkWidget *	terms_menu;
+    GtkWidget *	owner_box;
+    GtkWidget *	owner_label;
+    GtkWidget *	owner_choice;
+    GtkWidget *	job_label;
+    GtkWidget *	job_box;
+    GtkWidget *	job_choice;
+    GtkWidget *	billing_id_entry;
+    GtkWidget *	terms_menu;
 
-  /* Project Widgets (used for Bills only) */
-  GtkWidget *	proj_frame;
-  GtkWidget *	proj_cust_box;
-  GtkWidget *	proj_cust_choice;
-  GtkWidget *	proj_job_box;
-  GtkWidget *	proj_job_choice;
+    /* Project Widgets (used for Bills only) */
+    GtkWidget *	proj_frame;
+    GtkWidget *	proj_cust_box;
+    GtkWidget *	proj_cust_choice;
+    GtkWidget *	proj_job_box;
+    GtkWidget *	proj_job_choice;
 
-  /* Exp Voucher Widgets */
-  GtkWidget *	to_charge_frame;
-  GtkWidget *	to_charge_edit;
+    /* Exp Voucher Widgets */
+    GtkWidget *	to_charge_frame;
+    GtkWidget *	to_charge_edit;
 
-  gint		width;
+    gint		width;
 
-  GncBillTerm *	terms;
-  GnucashRegister *	reg;
-  GncEntryLedger *	ledger;
+    GncBillTerm *	terms;
+    GnucashRegister *	reg;
+    GncEntryLedger *	ledger;
 
-  invoice_sort_type_t	last_sort;
+    invoice_sort_type_t	last_sort;
 
-  InvoiceDialogType	dialog_type;
-  GUID		invoice_guid;
-  gint		component_id;
-  QofBook *	book;
-  GncInvoice *	created_invoice;
-  GncOwner	owner;
-  GncOwner	job;
+    InvoiceDialogType	dialog_type;
+    GUID		invoice_guid;
+    gint		component_id;
+    QofBook *	book;
+    GncInvoice *	created_invoice;
+    GncOwner	owner;
+    GncOwner	job;
 
-  GncOwner	proj_cust;
-  GncOwner	proj_job;
+    GncOwner	proj_cust;
+    GncOwner	proj_job;
 
-  /* for Unposting */
-  gboolean	reset_tax_tables;
+    /* for Unposting */
+    gboolean	reset_tax_tables;
 };
 
 /* Forward definitions for CB functions */
@@ -202,17 +204,17 @@
 static GtkWidget *
 iw_get_window (InvoiceWindow *iw)
 {
-  if (iw->page)
-    return gnc_plugin_page_get_window(iw->page);
-  return iw->dialog;
+    if (iw->page)
+        return gnc_plugin_page_get_window(iw->page);
+    return iw->dialog;
 }
 
 GtkWidget *
 gnc_invoice_get_register(InvoiceWindow *iw)
 {
-  if (iw)
-    return (GtkWidget *)iw->reg;
-  return NULL;
+    if (iw)
+        return (GtkWidget *)iw->reg;
+    return NULL;
 }
 
 /*******************************************************************************/
@@ -221,38 +223,39 @@
 static gboolean
 iw_ask_unpost (InvoiceWindow *iw)
 {
-  GtkWidget *dialog, *toggle, *pixmap;
-  GladeXML *xml;
-  gint response;
-  char *s;
+    GtkWidget *dialog, *toggle, *pixmap;
+    GladeXML *xml;
+    gint response;
+    char *s;
 
-  xml = gnc_glade_xml_new ("invoice.glade", "Unpost Message Dialog");
-  dialog = glade_xml_get_widget (xml, "Unpost Message Dialog");
-  toggle = glade_xml_get_widget (xml, "yes_tt_reset");
-  pixmap = glade_xml_get_widget (xml, "q_pixmap");
+    xml = gnc_glade_xml_new ("invoice.glade", "Unpost Message Dialog");
+    dialog = glade_xml_get_widget (xml, "Unpost Message Dialog");
+    toggle = glade_xml_get_widget (xml, "yes_tt_reset");
+    pixmap = glade_xml_get_widget (xml, "q_pixmap");
 
-  gtk_window_set_transient_for (GTK_WINDOW(dialog),
-				GTK_WINDOW(iw_get_window(iw)));
+    gtk_window_set_transient_for (GTK_WINDOW(dialog),
+                                  GTK_WINDOW(iw_get_window(iw)));
 
-  iw->reset_tax_tables = FALSE;
+    iw->reset_tax_tables = FALSE;
 
-  s = gnome_program_locate_file (NULL,
-				 GNOME_FILE_DOMAIN_PIXMAP,
-				 "gnome-question.png", TRUE, NULL);
-  if (s) {
-    pixmap = gtk_image_new_from_file(s);
-    g_free(s);
-  }
+    s = gnome_program_locate_file (NULL,
+                                   GNOME_FILE_DOMAIN_PIXMAP,
+                                   "gnome-question.png", TRUE, NULL);
+    if (s)
+    {
+        pixmap = gtk_image_new_from_file(s);
+        g_free(s);
+    }
 
-  gtk_widget_show_all(dialog);
+    gtk_widget_show_all(dialog);
 
-  response = gtk_dialog_run(GTK_DIALOG(dialog));
-  if (response == GTK_RESPONSE_OK)
-    iw->reset_tax_tables =
-      gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(toggle));
+    response = gtk_dialog_run(GTK_DIALOG(dialog));
+    if (response == GTK_RESPONSE_OK)
+        iw->reset_tax_tables =
+            gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(toggle));
 
-  gtk_widget_destroy(dialog);
-  return (response == GTK_RESPONSE_OK);
+    gtk_widget_destroy(dialog);
+    return (response == GTK_RESPONSE_OK);
 }
 
 /*******************************************************************************/
@@ -261,632 +264,648 @@
 static GncInvoice *
 iw_get_invoice (InvoiceWindow *iw)
 {
-  if (!iw)
-    return NULL;
+    if (!iw)
+        return NULL;
 
-  return gncInvoiceLookup (iw->book, &iw->invoice_guid);
+    return gncInvoiceLookup (iw->book, &iw->invoice_guid);
 }
 
 static void gnc_ui_to_invoice (InvoiceWindow *iw, GncInvoice *invoice)
 {
-  GtkTextBuffer* text_buffer;
-  GtkTextIter start, end;
-  gchar *text;
-  Timespec ts;
+    GtkTextBuffer* text_buffer;
+    GtkTextIter start, end;
+    gchar *text;
+    Timespec ts;
 
-  if (iw->dialog_type == VIEW_INVOICE)
-    return;
+    if (iw->dialog_type == VIEW_INVOICE)
+        return;
 
-  gnc_suspend_gui_refresh ();
+    gnc_suspend_gui_refresh ();
 
-  gncInvoiceBeginEdit (invoice);
+    gncInvoiceBeginEdit (invoice);
 
-  if (iw->active_check)
-    gncInvoiceSetActive (invoice, gtk_toggle_button_get_active
-			 (GTK_TOGGLE_BUTTON (iw->active_check)));
+    if (iw->active_check)
+        gncInvoiceSetActive (invoice, gtk_toggle_button_get_active
+                             (GTK_TOGGLE_BUTTON (iw->active_check)));
 
-  text_buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW(iw->notes_text));
-  gtk_text_buffer_get_bounds (text_buffer, &start, &end);
-  text = gtk_text_buffer_get_text (text_buffer, &start, &end, FALSE);
-  gncInvoiceSetNotes (invoice, text);
+    text_buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW(iw->notes_text));
+    gtk_text_buffer_get_bounds (text_buffer, &start, &end);
+    text = gtk_text_buffer_get_text (text_buffer, &start, &end, FALSE);
+    gncInvoiceSetNotes (invoice, text);
 
-  if (iw->to_charge_edit)
-    gncInvoiceSetToChargeAmount (invoice,
-				 gnc_amount_edit_get_amount
-				 (GNC_AMOUNT_EDIT (iw->to_charge_edit)));
+    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
-		     (GTK_EDITABLE (iw->id_entry), 0, -1));
-    gncInvoiceSetBillingID (invoice, gtk_editable_get_chars
-			    (GTK_EDITABLE (iw->billing_id_entry), 0, -1));
-    gncInvoiceSetTerms (invoice, iw->terms);
+    /* Only set these values for NEW/MOD INVOICE types */
+    if (iw->dialog_type != EDIT_INVOICE)
+    {
+        gncInvoiceSetID (invoice, gtk_editable_get_chars
+                         (GTK_EDITABLE (iw->id_entry), 0, -1));
+        gncInvoiceSetBillingID (invoice, gtk_editable_get_chars
+                                (GTK_EDITABLE (iw->billing_id_entry), 0, -1));
+        gncInvoiceSetTerms (invoice, iw->terms);
 
-    ts = gnc_date_edit_get_date_ts (GNC_DATE_EDIT (iw->opened_date));
-    gncInvoiceSetDateOpened (invoice, ts);
+        ts = gnc_date_edit_get_date_ts (GNC_DATE_EDIT (iw->opened_date));
+        gncInvoiceSetDateOpened (invoice, ts);
 
-    gnc_owner_get_owner (iw->owner_choice, &(iw->owner));
-    if (iw->job_choice)
-      gnc_owner_get_owner (iw->job_choice, &(iw->job));
+        gnc_owner_get_owner (iw->owner_choice, &(iw->owner));
+        if (iw->job_choice)
+            gnc_owner_get_owner (iw->job_choice, &(iw->job));
 
-    /* Only set the job if we've actually got one */
-    if (gncOwnerGetJob (&(iw->job)))
-      gncInvoiceSetOwner (invoice, &(iw->job));
-    else
-      gncInvoiceSetOwner (invoice, &(iw->owner));
+        /* Only set the job if we've actually got one */
+        if (gncOwnerGetJob (&(iw->job)))
+            gncInvoiceSetOwner (invoice, &(iw->job));
+        else
+            gncInvoiceSetOwner (invoice, &(iw->owner));
 
-    /* Set the invoice currency based on the owner */
-    gncInvoiceSetCurrency (invoice, gncOwnerGetCurrency (&iw->owner));
+        /* Set the invoice currency based on the owner */
+        gncInvoiceSetCurrency (invoice, gncOwnerGetCurrency (&iw->owner));
 
-    /* Only set the BillTo if we've actually got one */
-    if (gncOwnerGetJob (&iw->proj_job))
-      gncInvoiceSetBillTo (invoice, &iw->proj_job);
-    else
-      gncInvoiceSetBillTo (invoice, &iw->proj_cust);
-  }
+        /* Only set the BillTo if we've actually got one */
+        if (gncOwnerGetJob (&iw->proj_job))
+            gncInvoiceSetBillTo (invoice, &iw->proj_job);
+        else
+            gncInvoiceSetBillTo (invoice, &iw->proj_cust);
+    }
 
-  gncInvoiceCommitEdit (invoice);
-  gnc_resume_gui_refresh ();
+    gncInvoiceCommitEdit (invoice);
+    gnc_resume_gui_refresh ();
 }
 
 static gboolean
 gnc_invoice_window_verify_ok (InvoiceWindow *iw)
 {
-  const char *res;
-  gchar *string;
+    const char *res;
+    gchar *string;
 
-  /* save the current entry in the ledger? */
-  if (!gnc_entry_ledger_check_close (iw_get_window(iw), iw->ledger))
-    return FALSE;
+    /* save the current entry in the ledger? */
+    if (!gnc_entry_ledger_check_close (iw_get_window(iw), iw->ledger))
+        return FALSE;
 
-  /* Check the Owner */
-  gnc_owner_get_owner (iw->owner_choice, &(iw->owner));
-  res = gncOwnerGetName (&(iw->owner));
-  if (res == NULL || safe_strcmp (res, "") == 0) {
-    gnc_error_dialog (iw_get_window(iw), "%s",
-		      /* Translators: In this context,
-		       * 'Billing information' maps to the
-		       * label in the frame and means
-		       * e.g. customer i.e. the company being
-		       * invoiced. */
-		      _("You need to supply Billing Information."));
-    return FALSE;
-  }
+    /* Check the Owner */
+    gnc_owner_get_owner (iw->owner_choice, &(iw->owner));
+    res = gncOwnerGetName (&(iw->owner));
+    if (res == NULL || safe_strcmp (res, "") == 0)
+    {
+        gnc_error_dialog (iw_get_window(iw), "%s",
+                          /* Translators: In this context,
+                           * 'Billing information' maps to the
+                           * label in the frame and means
+                           * e.g. customer i.e. the company being
+                           * invoiced. */
+                          _("You need to supply Billing Information."));
+        return FALSE;
+    }
 
-  /* Check the ID; set one if necessary */
-  res = gtk_entry_get_text (GTK_ENTRY (iw->id_entry));
-  if (safe_strcmp (res, "") == 0) {
-    /* Invoices and bills have separate counters.
-       Therefore we pass the GncOwer to gncInvoiceNextID
-       so it knows whether we are creating a bill
-       or an invoice. */
-    string = g_strdup_printf ("%.6" G_GINT64_FORMAT,
-			      gncInvoiceNextID(iw->book, &(iw->owner)));
-    gtk_entry_set_text (GTK_ENTRY (iw->id_entry), string);
-    g_free(string);
-  }
+    /* Check the ID; set one if necessary */
+    res = gtk_entry_get_text (GTK_ENTRY (iw->id_entry));
+    if (safe_strcmp (res, "") == 0)
+    {
+        /* Invoices and bills have separate counters.
+           Therefore we pass the GncOwer to gncInvoiceNextID
+           so it knows whether we are creating a bill
+           or an invoice. */
+        string = g_strdup_printf ("%.6" G_GINT64_FORMAT,
+                                  gncInvoiceNextID(iw->book, &(iw->owner)));
+        gtk_entry_set_text (GTK_ENTRY (iw->id_entry), string);
+        g_free(string);
+    }
 
-  return TRUE;
+    return TRUE;
 }
 
 static gboolean
 gnc_invoice_window_ok_save (InvoiceWindow *iw)
 {
-  if (!gnc_invoice_window_verify_ok (iw))
-    return FALSE;
+    if (!gnc_invoice_window_verify_ok (iw))
+        return FALSE;
 
-  {
-    GncInvoice *invoice = iw_get_invoice (iw);
-    if (invoice) {
-      gnc_ui_to_invoice (iw, invoice);
+    {
+        GncInvoice *invoice = iw_get_invoice (iw);
+        if (invoice)
+        {
+            gnc_ui_to_invoice (iw, invoice);
+        }
+        /* Save the invoice to return it later. */
+        iw->created_invoice = invoice;
     }
-    /* Save the invoice to return it later. */
-    iw->created_invoice = invoice;
-  }
-  return TRUE;
+    return TRUE;
 }
 
 void
 gnc_invoice_window_ok_cb (GtkWidget *widget, gpointer data)
 {
-  InvoiceWindow *iw = data;
+    InvoiceWindow *iw = data;
 
-  if (!gnc_invoice_window_ok_save (iw))
-    return;
+    if (!gnc_invoice_window_ok_save (iw))
+        return;
 
-  /* Ok, we don't need this anymore */
-  iw->invoice_guid = *xaccGUIDNULL ();
+    /* Ok, we don't need this anymore */
+    iw->invoice_guid = *xaccGUIDNULL ();
 
-  /* if this is a NEW_INVOICE, and created_invoice is NON-NULL, the
-   * open up a new window with the invoice.  This used to be done
-   * in gnc_ui_invoice_new() but cannot be done anymore
-   */
-  if (iw->dialog_type == NEW_INVOICE && iw->created_invoice)
-    gnc_ui_invoice_edit (iw->created_invoice);
+    /* if this is a NEW_INVOICE, and created_invoice is NON-NULL, the
+     * open up a new window with the invoice.  This used to be done
+     * in gnc_ui_invoice_new() but cannot be done anymore
+     */
+    if (iw->dialog_type == NEW_INVOICE && iw->created_invoice)
+        gnc_ui_invoice_edit (iw->created_invoice);
 
-  gnc_close_gui_component (iw->component_id);
+    gnc_close_gui_component (iw->component_id);
 }
 
 void
 gnc_invoice_window_cancel_cb (GtkWidget *widget, gpointer data)
 {
-  InvoiceWindow *iw = data;
+    InvoiceWindow *iw = data;
 
-  gnc_close_gui_component (iw->component_id);
+    gnc_close_gui_component (iw->component_id);
 }
 
 void
 gnc_invoice_window_help_cb (GtkWidget *widget, gpointer data)
 {
-  gnc_gnome_help(HF_HELP, HL_USAGE);
+    gnc_gnome_help(HF_HELP, HL_USAGE);
 }
 
 void
 gnc_invoice_window_destroy_cb (GtkWidget *widget, gpointer data)
 {
-  InvoiceWindow *iw = data;
-  GncInvoice *invoice = iw_get_invoice (iw);
+    InvoiceWindow *iw = data;
+    GncInvoice *invoice = iw_get_invoice (iw);
 
-  gnc_suspend_gui_refresh ();
+    gnc_suspend_gui_refresh ();
 
-  if (iw->dialog_type == NEW_INVOICE && invoice != NULL) {
-    gncInvoiceBeginEdit (invoice);
-    gncInvoiceDestroy (invoice);
-    iw->invoice_guid = *xaccGUIDNULL ();
-  }
+    if (iw->dialog_type == NEW_INVOICE && invoice != NULL)
+    {
+        gncInvoiceBeginEdit (invoice);
+        gncInvoiceDestroy (invoice);
+        iw->invoice_guid = *xaccGUIDNULL ();
+    }
 
-  gnc_entry_ledger_destroy (iw->ledger);
-  gnc_unregister_gui_component (iw->component_id);
-  gtk_widget_destroy(widget);
-  gnc_resume_gui_refresh ();
+    gnc_entry_ledger_destroy (iw->ledger);
+    gnc_unregister_gui_component (iw->component_id);
+    gtk_widget_destroy(widget);
+    gnc_resume_gui_refresh ();
 
-  g_free (iw);
+    g_free (iw);
 }
 
 void
 gnc_invoice_window_closeCB (GtkWidget *widget, gpointer data)
 {
-  gnc_invoice_window_ok_cb (widget, data);
+    gnc_invoice_window_ok_cb (widget, data);
 }
 
 void
 gnc_invoice_window_editCB (GtkWidget *widget, gpointer data)
 {
-  InvoiceWindow *iw = data;
-  GncInvoice *invoice = iw_get_invoice (iw);
+    InvoiceWindow *iw = data;
+    GncInvoice *invoice = iw_get_invoice (iw);
 
-  if (invoice)
-    gnc_ui_invoice_modify (invoice);
+    if (invoice)
+        gnc_ui_invoice_modify (invoice);
 }
 
 void
 gnc_invoice_window_recordCB (GtkWidget *widget, gpointer data)
 {
-  InvoiceWindow *iw = data;
+    InvoiceWindow *iw = data;
 
-  if (!iw || !iw->ledger)
-    return;
+    if (!iw || !iw->ledger)
+        return;
 
-  if (!gnc_entry_ledger_commit_entry (iw->ledger))
-    return;
+    if (!gnc_entry_ledger_commit_entry (iw->ledger))
+        return;
 
-  gnucash_register_goto_next_virt_row (iw->reg);
+    gnucash_register_goto_next_virt_row (iw->reg);
 }
 
 void
 gnc_invoice_window_cancelCB (GtkWidget *widget, gpointer data)
 {
-  InvoiceWindow *iw = data;
+    InvoiceWindow *iw = data;
 
-  if (!iw || !iw->ledger)
-    return;
+    if (!iw || !iw->ledger)
+        return;
 
-  gnc_entry_ledger_cancel_cursor_changes (iw->ledger);
+    gnc_entry_ledger_cancel_cursor_changes (iw->ledger);
 }
 
 void
 gnc_invoice_window_deleteCB (GtkWidget *widget, gpointer data)
 {
-  InvoiceWindow *iw = data;
-  GncEntry *entry;
+    InvoiceWindow *iw = data;
+    GncEntry *entry;
 
-  if (!iw || !iw->ledger)
-    return;
+    if (!iw || !iw->ledger)
+        return;
 
-  /* get the current entry based on cursor position */
-  entry = gnc_entry_ledger_get_current_entry (iw->ledger);
-  if (!entry) {
-    gnc_entry_ledger_cancel_cursor_changes (iw->ledger);
-    return;
-  }
+    /* get the current entry based on cursor position */
+    entry = gnc_entry_ledger_get_current_entry (iw->ledger);
+    if (!entry)
+    {
+        gnc_entry_ledger_cancel_cursor_changes (iw->ledger);
+        return;
+    }
 
-  /* deleting the blank entry just cancels */
-  if (entry == gnc_entry_ledger_get_blank_entry (iw->ledger)) {
-    gnc_entry_ledger_cancel_cursor_changes (iw->ledger);
-    return;
-  }
+    /* deleting the blank entry just cancels */
+    if (entry == gnc_entry_ledger_get_blank_entry (iw->ledger))
+    {
+        gnc_entry_ledger_cancel_cursor_changes (iw->ledger);
+        return;
+    }
 
-  /* Verify that the user really wants to delete this entry */
-  {
-    const char *message = _("Are you sure you want to delete the "
-			    "selected entry?");
-    const char *order_warn = _("This entry is attached to an order and "
-			       "will be deleted from that as well!");
-    char *msg;
-    gboolean result;
+    /* Verify that the user really wants to delete this entry */
+    {
+        const char *message = _("Are you sure you want to delete the "
+                                "selected entry?");
+        const char *order_warn = _("This entry is attached to an order and "
+                                   "will be deleted from that as well!");
+        char *msg;
+        gboolean result;
 
-    if (gncEntryGetOrder (entry))
-      msg = g_strconcat (message, "\n\n", order_warn, (char *)NULL);
-    else
-      msg = g_strdup (message);
+        if (gncEntryGetOrder (entry))
+            msg = g_strconcat (message, "\n\n", order_warn, (char *)NULL);
+        else
+            msg = g_strdup (message);
 
-    result = gnc_verify_dialog (iw_get_window(iw), FALSE, "%s", msg);
-    g_free (msg);
+        result = gnc_verify_dialog (iw_get_window(iw), FALSE, "%s", msg);
+        g_free (msg);
 
-    if (!result)
-      return;
-  }
+        if (!result)
+            return;
+    }
 
-  /* Yep, let's delete */
-  gnc_entry_ledger_delete_current_entry (iw->ledger);
-  return;
+    /* Yep, let's delete */
+    gnc_entry_ledger_delete_current_entry (iw->ledger);
+    return;
 }
 
 void
 gnc_invoice_window_duplicateCB (GtkWidget *widget, gpointer data)
 {
-  InvoiceWindow *iw = data;
+    InvoiceWindow *iw = data;
 
-  if (!iw || !iw->ledger)
-    return;
+    if (!iw || !iw->ledger)
+        return;
 
-  gnc_entry_ledger_duplicate_current_entry (iw->ledger);
+    gnc_entry_ledger_duplicate_current_entry (iw->ledger);
 }
 
 void
 gnc_invoice_window_blankCB (GtkWidget *widget, gpointer data)
 {
-  InvoiceWindow *iw = data;
+    InvoiceWindow *iw = data;
 
-  if (!iw || !iw->ledger)
-    return;
+    if (!iw || !iw->ledger)
+        return;
 
-  if (!gnc_entry_ledger_commit_entry (iw->ledger))
-    return;
+    if (!gnc_entry_ledger_commit_entry (iw->ledger))
+        return;
 
-  {
-    VirtualCellLocation vcell_loc;
-    GncEntry *blank;
+    {
+        VirtualCellLocation vcell_loc;
+        GncEntry *blank;
 
-    blank = gnc_entry_ledger_get_blank_entry (iw->ledger);
-    if (blank == NULL)
-      return;
+        blank = gnc_entry_ledger_get_blank_entry (iw->ledger);
+        if (blank == NULL)
+            return;
 
-    if (gnc_entry_ledger_get_entry_virt_loc (iw->ledger, blank, &vcell_loc))
-      gnucash_register_goto_virt_cell (iw->reg, vcell_loc);
-  }
+        if (gnc_entry_ledger_get_entry_virt_loc (iw->ledger, blank, &vcell_loc))
+            gnucash_register_goto_virt_cell (iw->reg, vcell_loc);
+    }
 }
 
 void
 gnc_invoice_window_printCB (GtkWidget *widget, gpointer data)
 {
-  InvoiceWindow *iw = data;
-  GncInvoice *invoice = iw_get_invoice (iw);
-  SCM func, arg;
-  SCM args = SCM_EOL;
-  int report_id;
+    InvoiceWindow *iw = data;
+    GncInvoice *invoice = iw_get_invoice (iw);
+    SCM func, arg;
+    SCM args = SCM_EOL;
+    int report_id;
 
-  g_return_if_fail (invoice);
+    g_return_if_fail (invoice);
 
-  func = scm_c_eval_string ("gnc:invoice-report-create");
-  g_return_if_fail (scm_is_procedure (func));
+    func = scm_c_eval_string ("gnc:invoice-report-create");
+    g_return_if_fail (scm_is_procedure (func));
 
-  arg = SWIG_NewPointerObj(invoice, SWIG_TypeQuery("_p__gncInvoice"), 0);
-  args = scm_cons (arg, args);
+    arg = SWIG_NewPointerObj(invoice, SWIG_TypeQuery("_p__gncInvoice"), 0);
+    args = scm_cons (arg, args);
 
-  /* scm_gc_protect_object(func); */
+    /* scm_gc_protect_object(func); */
 
-  arg = scm_apply (func, args, SCM_EOL);
-  g_return_if_fail (scm_is_exact (arg));
-  report_id = scm_num2int (arg, SCM_ARG1, G_STRFUNC);
+    arg = scm_apply (func, args, SCM_EOL);
+    g_return_if_fail (scm_is_exact (arg));
+    report_id = scm_num2int (arg, SCM_ARG1, G_STRFUNC);
 
-  /* scm_gc_unprotect_object(func); */
-  if (report_id >= 0)
-    reportWindow (report_id);
+    /* scm_gc_unprotect_object(func); */
+    if (report_id >= 0)
+        reportWindow (report_id);
 }
 
 void
 gnc_invoice_window_postCB (GtkWidget *widget, gpointer data)
 {
-  InvoiceWindow *iw = data;
-  GncInvoice *invoice;
-  char *message, *memo, *ddue_label, *post_label, *acct_label, *question_label;
-  Account *acc = NULL;
-  GList * acct_types = NULL;
-  GList * acct_commodities = NULL;
-  Timespec ddue, postdate;
-  gboolean accumulate;
-  QofInstance *owner_inst;
-  KvpFrame *kvpf;
-  KvpValue *kvp_val;
-  const char *text;
-  EntryList *entries;
-  GncEntry* entry;
-  gboolean reverse;
-  gboolean show_dialog=TRUE;
+    InvoiceWindow *iw = data;
+    GncInvoice *invoice;
+    char *message, *memo, *ddue_label, *post_label, *acct_label, *question_label;
+    Account *acc = NULL;
+    GList * acct_types = NULL;
+    GList * acct_commodities = NULL;
+    Timespec ddue, postdate;
+    gboolean accumulate;
+    QofInstance *owner_inst;
+    KvpFrame *kvpf;
+    KvpValue *kvp_val;
+    const char *text;
+    EntryList *entries;
+    GncEntry* entry;
+    gboolean reverse;
+    gboolean show_dialog = TRUE;
 
-  /* Make sure the invoice is ok */
-  if (!gnc_invoice_window_verify_ok (iw))
-      return;
+    /* Make sure the invoice is ok */
+    if (!gnc_invoice_window_verify_ok (iw))
+        return;
 
-  invoice = iw_get_invoice (iw);
-  if (!invoice)
-    return;
+    invoice = iw_get_invoice (iw);
+    if (!invoice)
+        return;
 
-  /* Check that there is at least one Entry */
-  invoice = iw_get_invoice (iw);
-  if (gncInvoiceGetEntries (invoice) == NULL) {
-    gnc_error_dialog (iw_get_window(iw), "%s",
-		      _("The Invoice must have at least one Entry."));
-    return;
-  }
+    /* Check that there is at least one Entry */
+    invoice = iw_get_invoice (iw);
+    if (gncInvoiceGetEntries (invoice) == NULL)
+    {
+        gnc_error_dialog (iw_get_window(iw), "%s",
+                          _("The Invoice must have at least one Entry."));
+        return;
+    }
 
-  reverse = (gncInvoiceGetOwnerType (invoice) == GNC_OWNER_CUSTOMER);
+    reverse = (gncInvoiceGetOwnerType (invoice) == GNC_OWNER_CUSTOMER);
 
-  /* Make sure that the invoice has a positive balance */
-  if (gnc_numeric_negative_p(gncInvoiceGetTotal(invoice))) {
-    gnc_error_dialog(iw_get_window(iw), "%s",
-		     _("You may not post an invoice with a negative total value."));
-    return;
-  }
+    /* Make sure that the invoice has a positive balance */
+    if (gnc_numeric_negative_p(gncInvoiceGetTotal(invoice)))
+    {
+        gnc_error_dialog(iw_get_window(iw), "%s",
+                         _("You may not post an invoice with a negative total value."));
+        return;
+    }
 
-  if (iw->total_cash_label &&
-      gnc_numeric_negative_p(gncInvoiceGetTotalOf(invoice, GNC_PAYMENT_CASH))) {
-    gnc_error_dialog(iw_get_window(iw), "%s",
-		     _("You may not post an expense voucher with a negative total cash value."));
-    return;
-  }
+    if (iw->total_cash_label &&
+            gnc_numeric_negative_p(gncInvoiceGetTotalOf(invoice, GNC_PAYMENT_CASH)))
+    {
+        gnc_error_dialog(iw_get_window(iw), "%s",
+                         _("You may not post an expense voucher with a negative total cash value."));
+        return;
+    }
 
-  /* Ok, we can post this invoice.  Ask for verification, set the due date,
-   * post date, and posted account
-   */
-  message = _("Do you really want to post the invoice?");
-  ddue_label = _("Due Date");
-  post_label = _("Post Date");
-  acct_label = _("Post to Account");
-  question_label = _("Accumulate Splits?");
+    /* Ok, we can post this invoice.  Ask for verification, set the due date,
+     * post date, and posted account
+     */
+    message = _("Do you really want to post the invoice?");
+    ddue_label = _("Due Date");
+    post_label = _("Post Date");
+    acct_label = _("Post to Account");
+    question_label = _("Accumulate Splits?");
 
-  /* Determine the type of account to post to */
-  acct_types = gnc_business_account_types (&(iw->owner));
+    /* Determine the type of account to post to */
+    acct_types = gnc_business_account_types (&(iw->owner));
 
-  /* Determine which commodity we're working with */
-  acct_commodities = gnc_business_commodities(&(iw->owner));
+    /* Determine which commodity we're working with */
+    acct_commodities = gnc_business_commodities(&(iw->owner));
 
-  /* Get the due date and posted account */
-  timespecFromTime_t (&postdate, time(NULL));
-  ddue = postdate;
-  memo = NULL;
+    /* Get the due date and posted account */
+    timespecFromTime_t (&postdate, time(NULL));
+    ddue = postdate;
+    memo = NULL;
 
-  owner_inst = qofOwnerGetOwner (gncOwnerGetEndOwner (&(iw->owner)));
-  kvpf = qof_instance_get_slots (owner_inst);
-  acc = xaccAccountLookup (kvp_frame_get_guid (kvpf, LAST_POSTED_TO_ACCT),
-			   iw->book);
+    owner_inst = qofOwnerGetOwner (gncOwnerGetEndOwner (&(iw->owner)));
+    kvpf = qof_instance_get_slots (owner_inst);
+    acc = xaccAccountLookup (kvp_frame_get_guid (kvpf, LAST_POSTED_TO_ACCT),
+                             iw->book);
 
-  /* Get the default for the accumulate option */
-  accumulate = gnc_gconf_get_bool(GCONF_SECTION_INVOICE, "accumulate_splits", NULL);
+    /* Get the default for the accumulate option */
+    accumulate = gnc_gconf_get_bool(GCONF_SECTION_INVOICE, "accumulate_splits", NULL);
 
-  if (!gnc_dialog_dates_acct_question_parented (iw_get_window(iw), message, ddue_label,
-				       post_label, acct_label, question_label, TRUE, TRUE,
-				       acct_types, acct_commodities, iw->book, iw->terms,
-				       &ddue, &postdate, &memo, &acc, &accumulate))
-    return;
+    if (!gnc_dialog_dates_acct_question_parented (iw_get_window(iw), message, ddue_label,
+            post_label, acct_label, question_label, TRUE, TRUE,
+            acct_types, acct_commodities, iw->book, iw->terms,
+            &ddue, &postdate, &memo, &acc, &accumulate))
+        return;
 
-  /* Yep, we're posting.  So, save the invoice...
-   * Note that we can safely ignore the return value; we checked
-   * the verify_ok earlier, so we know it's ok.
-   */
-  gnc_suspend_gui_refresh ();
-  gncInvoiceBeginEdit (invoice);
-  gnc_invoice_window_ok_save (iw);
+    /* Yep, we're posting.  So, save the invoice...
+     * Note that we can safely ignore the return value; we checked
+     * the verify_ok earlier, so we know it's ok.
+     */
+    gnc_suspend_gui_refresh ();
+    gncInvoiceBeginEdit (invoice);
+    gnc_invoice_window_ok_save (iw);
 
-  /* Fill in the conversion prices with feedback from the user */
-  text = _("One or more of the entries are for accounts different from the invoice/bill currency.  You will be asked a conversion rate for each.");
+    /* Fill in the conversion prices with feedback from the user */
+    text = _("One or more of the entries are for accounts different from the invoice/bill currency.  You will be asked a conversion rate for each.");
 
-  for (entries=gncInvoiceGetEntries(invoice); entries != NULL; entries=g_list_next(entries))
-  {
-    Account *this_acc;
+    for (entries = gncInvoiceGetEntries(invoice); entries != NULL; entries = g_list_next(entries))
+    {
+        Account *this_acc;
 
-    entry = (GncEntry*)entries->data;
-    this_acc = (reverse ? gncEntryGetInvAccount (entry) :
-		gncEntryGetBillAccount (entry));
+        entry = (GncEntry*)entries->data;
+        this_acc = (reverse ? gncEntryGetInvAccount (entry) :
+                    gncEntryGetBillAccount (entry));
 
-    if (!gnc_commodity_equal(gncInvoiceGetCurrency (invoice), xaccAccountGetCommodity(this_acc)))
-    {
-      GNCPrice *convprice;
+        if (!gnc_commodity_equal(gncInvoiceGetCurrency (invoice), xaccAccountGetCommodity(this_acc)))
+        {
+            GNCPrice *convprice;
 
-      if (show_dialog)
-      {
-        gnc_info_dialog(iw_get_window(iw), "%s", text);
-        show_dialog=FALSE;
-      }
+            if (show_dialog)
+            {
+                gnc_info_dialog(iw_get_window(iw), "%s", text);
+                show_dialog = FALSE;
+            }
 
-      convprice = gncInvoiceGetPrice(invoice, xaccAccountGetCommodity(this_acc));
-      if (convprice == NULL)
-      {
-        XferDialog *xfer;
-        gnc_numeric exch_rate;
-        Timespec date;
-        gnc_numeric amount = gnc_numeric_create(1,1);
+            convprice = gncInvoiceGetPrice(invoice, xaccAccountGetCommodity(this_acc));
+            if (convprice == NULL)
+            {
+                XferDialog *xfer;
+                gnc_numeric exch_rate;
+                Timespec date;
+                gnc_numeric amount = gnc_numeric_create(1, 1);
 
 
-        /* create the exchange-rate dialog */
-        xfer = gnc_xfer_dialog (iw_get_window(iw), this_acc);
-        gnc_xfer_dialog_select_to_account(xfer,acc);
-        gnc_xfer_dialog_set_amount(xfer, amount);
+                /* create the exchange-rate dialog */
+                xfer = gnc_xfer_dialog (iw_get_window(iw), this_acc);
+                gnc_xfer_dialog_select_to_account(xfer, acc);
+                gnc_xfer_dialog_set_amount(xfer, amount);
 
-        /* All we want is the exchange rate so prevent the user from thinking
-           it makes sense to mess with other stuff */
-        gnc_xfer_dialog_set_from_show_button_active(xfer, FALSE);
-        gnc_xfer_dialog_set_to_show_button_active(xfer, FALSE);
-        gnc_xfer_dialog_hide_from_account_tree(xfer);
-        gnc_xfer_dialog_hide_to_account_tree(xfer);
-        gnc_xfer_dialog_is_exchange_dialog(xfer, &exch_rate);
-        gnc_xfer_dialog_run_until_done(xfer);
+                /* All we want is the exchange rate so prevent the user from thinking
+                   it makes sense to mess with other stuff */
+                gnc_xfer_dialog_set_from_show_button_active(xfer, FALSE);
+                gnc_xfer_dialog_set_to_show_button_active(xfer, FALSE);
+                gnc_xfer_dialog_hide_from_account_tree(xfer);
+                gnc_xfer_dialog_hide_to_account_tree(xfer);
+                gnc_xfer_dialog_is_exchange_dialog(xfer, &exch_rate);
+                gnc_xfer_dialog_run_until_done(xfer);
 
-        convprice = gnc_price_create(iw->book);
-        gnc_price_begin_edit (convprice);
-        gnc_price_set_commodity (convprice, xaccAccountGetCommodity(this_acc));
-        gnc_price_set_currency (convprice, gncInvoiceGetCurrency (invoice));
-        date.tv_sec = time (NULL);
-        date.tv_nsec = 0;
-        gnc_price_set_time (convprice, date);
-        gnc_price_set_source (convprice, "user:invoice-post");
+                convprice = gnc_price_create(iw->book);
+                gnc_price_begin_edit (convprice);
+                gnc_price_set_commodity (convprice, xaccAccountGetCommodity(this_acc));
+                gnc_price_set_currency (convprice, gncInvoiceGetCurrency (invoice));
+                date.tv_sec = time (NULL);
+                date.tv_nsec = 0;
+                gnc_price_set_time (convprice, date);
+                gnc_price_set_source (convprice, "user:invoice-post");
 
-        /* Yes, magic strings are evil but I can't find any defined constants
-           for this..*/
-        gnc_price_set_typestr (convprice, "last");
-        gnc_price_set_value (convprice, exch_rate);
-        gncInvoiceAddPrice(invoice, convprice);
-        gnc_price_commit_edit (convprice);
-      }
+                /* Yes, magic strings are evil but I can't find any defined constants
+                   for this..*/
+                gnc_price_set_typestr (convprice, "last");
+                gnc_price_set_value (convprice, exch_rate);
+                gncInvoiceAddPrice(invoice, convprice);
+                gnc_price_commit_edit (convprice);
+            }
+        }
     }
-  }
 
 
-  /* Save acc as last used account in the kvp frame of the invoice owner */
-  kvp_val = kvp_value_new_guid (qof_instance_get_guid (QOF_INSTANCE (acc)));;
-  qof_begin_edit (owner_inst);
-  kvp_frame_set_slot_nc (kvpf, LAST_POSTED_TO_ACCT, kvp_val);
-  qof_instance_set_dirty (owner_inst);
-  qof_commit_edit (owner_inst);
+    /* Save acc as last used account in the kvp frame of the invoice owner */
+    kvp_val = kvp_value_new_guid (qof_instance_get_guid (QOF_INSTANCE (acc)));;
+    qof_begin_edit (owner_inst);
+    kvp_frame_set_slot_nc (kvpf, LAST_POSTED_TO_ACCT, kvp_val);
+    qof_instance_set_dirty (owner_inst);
+    qof_commit_edit (owner_inst);
 
-  /* ... post it; post date is set to now ... */
-  gncInvoicePostToAccount (invoice, acc, &postdate, &ddue, memo, accumulate);
-  gncInvoiceCommitEdit (invoice);
-  gnc_resume_gui_refresh ();
+    /* ... post it; post date is set to now ... */
+    gncInvoicePostToAccount (invoice, acc, &postdate, &ddue, memo, accumulate);
+    gncInvoiceCommitEdit (invoice);
+    gnc_resume_gui_refresh ();
 
-  if (memo)
-    g_free (memo);
+    if (memo)
+        g_free (memo);
 
-  /* Reset the type; change to read-only! */
-  iw->dialog_type = VIEW_INVOICE;
-  gnc_entry_ledger_set_readonly (iw->ledger, TRUE);
+    /* Reset the type; change to read-only! */
+    iw->dialog_type = VIEW_INVOICE;
+    gnc_entry_ledger_set_readonly (iw->ledger, TRUE);
 
-  /* ... and redisplay here. */
-  gnc_invoice_update_window (iw, NULL);
-  gnc_table_refresh_gui (gnc_entry_ledger_get_table (iw->ledger), FALSE);
+    /* ... and redisplay here. */
+    gnc_invoice_update_window (iw, NULL);
+    gnc_table_refresh_gui (gnc_entry_ledger_get_table (iw->ledger), FALSE);
 }
 
 void
 gnc_invoice_window_unpostCB (GtkWidget *widget, gpointer data)
 {
-  InvoiceWindow *iw = data;
-  GncInvoice *invoice;
-  gboolean result;
+    InvoiceWindow *iw = data;
+    GncInvoice *invoice;
+    gboolean result;
 
-  invoice = iw_get_invoice (iw);
-  if (!invoice)
-    return;
+    invoice = iw_get_invoice (iw);
+    if (!invoice)
+        return;
 
-  /* make sure the user REALLY wants to do this! */
-  result = iw_ask_unpost(iw);
-  if (!result) return;
+    /* make sure the user REALLY wants to do this! */
+    result = iw_ask_unpost(iw);
+    if (!result) return;
 
-  /* Attempt to unpost the invoice */
-  gnc_suspend_gui_refresh ();
-  result = gncInvoiceUnpost (invoice, iw->reset_tax_tables);
-  gnc_resume_gui_refresh ();
-  if (!result) return;
+    /* Attempt to unpost the invoice */
+    gnc_suspend_gui_refresh ();
+    result = gncInvoiceUnpost (invoice, iw->reset_tax_tables);
+    gnc_resume_gui_refresh ();
+    if (!result) return;
 
-  /* if we get here, we succeeded in unposting -- reset the ledger and redisplay */
-  iw->dialog_type = EDIT_INVOICE;
-  gnc_entry_ledger_set_readonly (iw->ledger, FALSE);
-  gnc_invoice_update_window (iw, NULL);
-  gnc_table_refresh_gui (gnc_entry_ledger_get_table (iw->ledger), FALSE);
+    /* if we get here, we succeeded in unposting -- reset the ledger and redisplay */
+    iw->dialog_type = EDIT_INVOICE;
+    gnc_entry_ledger_set_readonly (iw->ledger, FALSE);
+    gnc_invoice_update_window (iw, NULL);
+    gnc_table_refresh_gui (gnc_entry_ledger_get_table (iw->ledger), FALSE);
 }
 
 void gnc_invoice_window_cut_cb (GtkWidget *widget, gpointer data)
 {
-  InvoiceWindow *iw = data;
-  gnucash_register_cut_clipboard (iw->reg);
+    InvoiceWindow *iw = data;
+    gnucash_register_cut_clipboard (iw->reg);
 }
 
 void gnc_invoice_window_copy_cb (GtkWidget *widget, gpointer data)
 {
-  InvoiceWindow *iw = data;
-  gnucash_register_copy_clipboard (iw->reg);
+    InvoiceWindow *iw = data;
+    gnucash_register_copy_clipboard (iw->reg);
 }
 
 void gnc_invoice_window_paste_cb (GtkWidget *widget, gpointer data)
 {
-  InvoiceWindow *iw = data;
-  gnucash_register_paste_clipboard (iw->reg);
+    InvoiceWindow *iw = data;
+    gnucash_register_paste_clipboard (iw->reg);
 }
 
 void gnc_invoice_window_new_invoice_cb (GtkWidget *widget, gpointer data)
 {
-  InvoiceWindow *iw = data;
-  if (gncOwnerGetJob (&iw->job)) {
-    gnc_ui_invoice_new (&iw->job, iw->book);
-  } else {
-    gnc_ui_invoice_new (&iw->owner, iw->book);
-  }
+    InvoiceWindow *iw = data;
+    if (gncOwnerGetJob (&iw->job))
+    {
+        gnc_ui_invoice_new (&iw->job, iw->book);
+    }
+    else
+    {
+        gnc_ui_invoice_new (&iw->owner, iw->book);
+    }
 }
 
 void gnc_business_call_owner_report (GncOwner *owner, Account *acc)
 {
-  int id;
-  SCM args;
-  SCM func;
-  SCM arg;
+    int id;
+    SCM args;
+    SCM func;
+    SCM arg;
 
-  g_return_if_fail (owner);
+    g_return_if_fail (owner);
 
-  args = SCM_EOL;
+    args = SCM_EOL;
 
-  func = scm_c_eval_string ("gnc:owner-report-create");
-  g_return_if_fail (scm_is_procedure (func));
+    func = scm_c_eval_string ("gnc:owner-report-create");
+    g_return_if_fail (scm_is_procedure (func));
 
-  if (acc) {
-    swig_type_info * qtype = SWIG_TypeQuery("_p_Account");
-    g_return_if_fail (qtype);
+    if (acc)
+    {
+        swig_type_info * qtype = SWIG_TypeQuery("_p_Account");
+        g_return_if_fail (qtype);
 
-    arg = SWIG_NewPointerObj(acc, qtype, 0);
+        arg = SWIG_NewPointerObj(acc, qtype, 0);
+        g_return_if_fail (arg != SCM_UNDEFINED);
+        args = scm_cons (arg, args);
+    }
+    else
+    {
+        args = scm_cons (SCM_BOOL_F, args);
+    }
+
+    arg = SWIG_NewPointerObj(owner, SWIG_TypeQuery("_p__gncOwner"), 0);
     g_return_if_fail (arg != SCM_UNDEFINED);
     args = scm_cons (arg, args);
-  } else {
-    args = scm_cons (SCM_BOOL_F, args);
-  }
 
-  arg = SWIG_NewPointerObj(owner, SWIG_TypeQuery("_p__gncOwner"), 0);
-  g_return_if_fail (arg != SCM_UNDEFINED);
-  args = scm_cons (arg, args);
+    /* Apply the function to the args */
+    arg = scm_apply (func, args, SCM_EOL);
+    g_return_if_fail (scm_is_exact (arg));
+    id = scm_num2int (arg, SCM_ARG1, G_STRFUNC);
 
-  /* Apply the function to the args */
-  arg = scm_apply (func, args, SCM_EOL);
-  g_return_if_fail (scm_is_exact (arg));
-  id = scm_num2int (arg, SCM_ARG1, G_STRFUNC);
-
-  if (id >= 0)
-    reportWindow (id);
+    if (id >= 0)
+        reportWindow (id);
 }
 
 void gnc_invoice_window_report_owner_cb (GtkWidget *widget, gpointer data)
 {
-  InvoiceWindow *iw = data;
-  gnc_business_call_owner_report (&iw->owner, NULL);
+    InvoiceWindow *iw = data;
+    gnc_business_call_owner_report (&iw->owner, NULL);
 }
 
 void gnc_invoice_window_payment_cb (GtkWidget *widget, gpointer data)
 {
-  InvoiceWindow *iw = data;
-  GncInvoice *invoice = iw_get_invoice(iw);
+    InvoiceWindow *iw = data;
+    GncInvoice *invoice = iw_get_invoice(iw);
 
-  if (gncOwnerGetJob (&iw->job))
-    gnc_ui_payment_new_with_invoice (&iw->job, iw->book, invoice);
-  else
-    gnc_ui_payment_new_with_invoice (&iw->owner, iw->book, invoice);
+    if (gncOwnerGetJob (&iw->job))
+        gnc_ui_payment_new_with_invoice (&iw->job, iw->book, invoice);
+    else
+        gnc_ui_payment_new_with_invoice (&iw->owner, iw->book, invoice);
 }
 
 /* Sorting callbacks */
@@ -894,48 +913,48 @@
 void
 gnc_invoice_window_sort (InvoiceWindow *iw, invoice_sort_type_t sort_code)
 {
-  QueryNew *query = gnc_entry_ledger_get_query (iw->ledger);
-  GSList *p1 = NULL, *p2 = NULL, *p3 = NULL, *standard;
+    QueryNew *query = gnc_entry_ledger_get_query (iw->ledger);
+    GSList *p1 = NULL, *p2 = NULL, *p3 = NULL, *standard;
 
-  if (iw->last_sort == sort_code)
-    return;
+    if (iw->last_sort == sort_code)
+        return;
 
-  standard = g_slist_prepend (NULL, QUERY_DEFAULT_SORT);
+    standard = g_slist_prepend (NULL, QUERY_DEFAULT_SORT);
 
-  switch (sort_code)
-  {
+    switch (sort_code)
+    {
     case BY_STANDARD:
-      p1 = standard;
-      break;
+        p1 = standard;
+        break;
     case BY_DATE:
-      p1 = g_slist_prepend (p1, ENTRY_DATE);
-      p2 = standard;
-      break;
+        p1 = g_slist_prepend (p1, ENTRY_DATE);
+        p2 = standard;
+        break;
     case BY_DATE_ENTERED:
-      p1 = g_slist_prepend (p1, ENTRY_DATE_ENTERED);
-      p2 = standard;
-      break;
+        p1 = g_slist_prepend (p1, ENTRY_DATE_ENTERED);
+        p2 = standard;
+        break;
     case BY_DESC:
-      p1 = g_slist_prepend (p1, ENTRY_DESC);
-      p2 = standard;
-      break;
+        p1 = g_slist_prepend (p1, ENTRY_DESC);
+        p2 = standard;
+        break;
     case BY_QTY:
-      p1 = g_slist_prepend (p1, ENTRY_QTY);
-      p2 = standard;
-      break;
+        p1 = g_slist_prepend (p1, ENTRY_QTY);
+        p2 = standard;
+        break;
     case BY_PRICE:
-      p1 = g_slist_prepend (p1, ((iw->owner.type == GNC_OWNER_CUSTOMER) ?
-				 ENTRY_IPRICE : ENTRY_BPRICE));
-      p2 = standard;
-      break;
+        p1 = g_slist_prepend (p1, ((iw->owner.type == GNC_OWNER_CUSTOMER) ?
+                                   ENTRY_IPRICE : ENTRY_BPRICE));
+        p2 = standard;
+        break;
     default:
-      g_slist_free (standard);
-      g_return_if_fail (FALSE);
-  }
+        g_slist_free (standard);
+        g_return_if_fail (FALSE);
+    }
 
-  gncQuerySetSortOrder (query, p1, p2, p3);
-  iw->last_sort = sort_code;
-  gnc_entry_ledger_display_refresh (iw->ledger);
+    gncQuerySetSortOrder (query, p1, p2, p3);
+    iw->last_sort = sort_code;
+    gnc_entry_ledger_display_refresh (iw->ledger);
 }
 
 /* Window configuration callbacks */
@@ -943,486 +962,512 @@
 void
 gnc_invoice_window_active_toggled_cb (GtkWidget *widget, gpointer data)
 {
-  InvoiceWindow *iw = data;
-  GncInvoice *invoice = iw_get_invoice(iw);
+    InvoiceWindow *iw = data;
+    GncInvoice *invoice = iw_get_invoice(iw);
 
-  if (!invoice) return;
+    if (!invoice) return;
 
-  gncInvoiceSetActive (invoice,
-		       gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (widget)));
+    gncInvoiceSetActive (invoice,
+                         gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (widget)));
 }
 
 gboolean
 gnc_invoice_window_leave_notes_cb (GtkWidget *widget, GdkEventFocus *event,
-				   gpointer data)
+                                   gpointer data)
 {
-  InvoiceWindow *iw = data;
-  GncInvoice *invoice = iw_get_invoice(iw);
-  GtkTextBuffer* text_buffer;
-  GtkTextIter start, end;
-  gchar *text;
+    InvoiceWindow *iw = data;
+    GncInvoice *invoice = iw_get_invoice(iw);
+    GtkTextBuffer* text_buffer;
+    GtkTextIter start, end;
+    gchar *text;
 
-  if (!invoice) return FALSE;
+    if (!invoice) return FALSE;
 
-  text_buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW(iw->notes_text));
-  gtk_text_buffer_get_bounds (text_buffer, &start, &end);
-  text = gtk_text_buffer_get_text (text_buffer, &start, &end, FALSE);
-  gncInvoiceSetNotes (invoice, text);
-  return FALSE;
+    text_buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW(iw->notes_text));
+    gtk_text_buffer_get_bounds (text_buffer, &start, &end);
+    text = gtk_text_buffer_get_text (text_buffer, &start, &end, FALSE);
+    gncInvoiceSetNotes (invoice, text);
+    return FALSE;
 }
 
 static gboolean
 gnc_invoice_window_leave_to_charge_cb (GtkWidget *widget, GdkEventFocus *event,
-				       gpointer data)
+                                       gpointer data)
 {
-  gnc_amount_edit_evaluate (GNC_AMOUNT_EDIT (widget));
-  return FALSE;
+    gnc_amount_edit_evaluate (GNC_AMOUNT_EDIT (widget));
+    return FALSE;
 }
 
 static void
 gnc_invoice_window_changed_to_charge_cb (GtkWidget *widget, gpointer data)
 {
-  InvoiceWindow *iw = data;
-  GncInvoice *invoice = iw_get_invoice(iw);
+    InvoiceWindow *iw = data;
+    GncInvoice *invoice = iw_get_invoice(iw);
 
-  if (!invoice) return;
+    if (!invoice) return;
 
-  gncInvoiceSetToChargeAmount (invoice, gnc_amount_edit_get_amount
-			       (GNC_AMOUNT_EDIT (widget)));
+    gncInvoiceSetToChargeAmount (invoice, gnc_amount_edit_get_amount
+                                 (GNC_AMOUNT_EDIT (widget)));
 }
 
 static GtkWidget *
 add_summary_label (GtkWidget *summarybar, const char *label_str)
 {
-  GtkWidget *hbox;
-  GtkWidget *label;
+    GtkWidget *hbox;
+    GtkWidget *label;
 
-  hbox = gtk_hbox_new(FALSE, 2);
-  gtk_box_pack_start (GTK_BOX(summarybar), hbox, FALSE, FALSE, 5);
+    hbox = gtk_hbox_new(FALSE, 2);
+    gtk_box_pack_start (GTK_BOX(summarybar), hbox, FALSE, FALSE, 5);
 
-  label = gtk_label_new (label_str);
-  gtk_misc_set_alignment (GTK_MISC(label), 1.0, 0.5);
-  gtk_box_pack_start (GTK_BOX(hbox), label, FALSE, FALSE, 0);
+    label = gtk_label_new (label_str);
+    gtk_misc_set_alignment (GTK_MISC(label), 1.0, 0.5);
+    gtk_box_pack_start (GTK_BOX(hbox), label, FALSE, FALSE, 0);
 
-  label = gtk_label_new ("");
-  gtk_misc_set_alignment (GTK_MISC(label), 1.0, 0.5);
-  gtk_box_pack_start (GTK_BOX(hbox), label, FALSE, FALSE, 0);
+    label = gtk_label_new ("");
+    gtk_misc_set_alignment (GTK_MISC(label), 1.0, 0.5);
+    gtk_box_pack_start (GTK_BOX(hbox), label, FALSE, FALSE, 0);
 
-  return label;
+    return label;
 }
 
 GtkWidget *
 gnc_invoice_window_create_summary_bar (InvoiceWindow *iw)
 {
-  GtkWidget *summarybar;
+    GtkWidget *summarybar;
 
-  iw->total_label	    = NULL;
-  iw->total_cash_label      = NULL;
-  iw->total_charge_label    = NULL;
-  iw->total_subtotal_label  = NULL;
-  iw->total_tax_label       = NULL;
+    iw->total_label	    = NULL;
+    iw->total_cash_label      = NULL;
+    iw->total_charge_label    = NULL;
+    iw->total_subtotal_label  = NULL;
+    iw->total_tax_label       = NULL;
 
-  summarybar = gtk_hbox_new (FALSE, 4);
+    summarybar = gtk_hbox_new (FALSE, 4);
 
-  iw->total_label	    = add_summary_label (summarybar, _("Total:"));
+    iw->total_label	    = add_summary_label (summarybar, _("Total:"));
 
-  switch (gncOwnerGetType (&iw->owner)) {
-  case GNC_OWNER_CUSTOMER:
-  case GNC_OWNER_VENDOR:
-    iw->total_subtotal_label= add_summary_label (summarybar, _("Subtotal:"));
-    iw->total_tax_label     = add_summary_label (summarybar, _("Tax:"));
-    break;
+    switch (gncOwnerGetType (&iw->owner))
+    {
+    case GNC_OWNER_CUSTOMER:
+    case GNC_OWNER_VENDOR:
+        iw->total_subtotal_label = add_summary_label (summarybar, _("Subtotal:"));
+        iw->total_tax_label     = add_summary_label (summarybar, _("Tax:"));
+        break;
 
-  case GNC_OWNER_EMPLOYEE:
-    iw->total_cash_label    = add_summary_label (summarybar, _("Total Cash:"));
-    iw->total_charge_label  = add_summary_label (summarybar, _("Total Charge:"));
-    break;
+    case GNC_OWNER_EMPLOYEE:
+        iw->total_cash_label    = add_summary_label (summarybar, _("Total Cash:"));
+        iw->total_charge_label  = add_summary_label (summarybar, _("Total Charge:"));
+        break;
 
-  default:
-    break;
-  }
+    default:
+        break;
+    }
 
-  gtk_widget_show_all(summarybar);
-  return summarybar;
+    gtk_widget_show_all(summarybar);
+    return summarybar;
 }
 
 static int
 gnc_invoice_job_changed_cb (GtkWidget *widget, gpointer data)
 {
-  InvoiceWindow *iw = data;
-  GncInvoice *invoice;
-  char const *msg = "";
+    InvoiceWindow *iw = data;
+    GncInvoice *invoice;
+    char const *msg = "";
 
-  if (!iw)
-    return FALSE;
+    if (!iw)
+        return FALSE;
 
-  if (iw->dialog_type == VIEW_INVOICE)
-    return FALSE;
+    if (iw->dialog_type == VIEW_INVOICE)
+        return FALSE;
 
-  gnc_owner_get_owner (iw->job_choice, &(iw->job));
-  invoice = iw_get_invoice (iw);
+    gnc_owner_get_owner (iw->job_choice, &(iw->job));
+    invoice = iw_get_invoice (iw);
 
-  if (iw->dialog_type == EDIT_INVOICE)
-    return FALSE;
+    if (iw->dialog_type == EDIT_INVOICE)
+        return FALSE;
 
-  msg = gncJobGetReference (gncOwnerGetJob (&(iw->job)));
-  gtk_entry_set_text (GTK_ENTRY (iw->billing_id_entry), msg ? msg : "");
+    msg = gncJobGetReference (gncOwnerGetJob (&(iw->job)));
+    gtk_entry_set_text (GTK_ENTRY (iw->billing_id_entry), msg ? msg : "");
 
-  return FALSE;
+    return FALSE;
 
 }
 
 static GNCSearchWindow *
 gnc_invoice_select_job_cb (gpointer jobp, gpointer user_data)
 {
-  GncJob *j = jobp;
-  InvoiceWindow *iw = user_data;
-  GncOwner owner, *ownerp;
+    GncJob *j = jobp;
+    InvoiceWindow *iw = user_data;
+    GncOwner owner, *ownerp;
 
-  if (!iw) return NULL;
+    if (!iw) return NULL;
 
-  if (j) {
-    ownerp = gncJobGetOwner (j);
-    gncOwnerCopy (ownerp, &owner);
-  } else
-    gncOwnerCopy (&(iw->owner), &owner);
+    if (j)
+    {
+        ownerp = gncJobGetOwner (j);
+        gncOwnerCopy (ownerp, &owner);
+    }
+    else
+        gncOwnerCopy (&(iw->owner), &owner);
 
-  return gnc_job_search (j, &owner, iw->book);
+    return gnc_job_search (j, &owner, iw->book);
 }
 
 static void
 gnc_invoice_update_job_choice (InvoiceWindow *iw)
 {
-  if (iw->job_choice)
-    gtk_container_remove (GTK_CONTAINER (iw->job_box), iw->job_choice);
+    if (iw->job_choice)
+        gtk_container_remove (GTK_CONTAINER (iw->job_box), iw->job_choice);
 
-  /* If we don't have a real owner, then we obviously can't have a job */
-  if (iw->owner.owner.undefined == NULL) {
-    iw->job_choice = NULL;
+    /* If we don't have a real owner, then we obviously can't have a job */
+    if (iw->owner.owner.undefined == NULL)
+    {
+        iw->job_choice = NULL;
 
-  } else
-    switch (iw->dialog_type) {
-    case VIEW_INVOICE:
-    case EDIT_INVOICE:
-      iw->job_choice =
-	gnc_owner_edit_create (NULL, iw->job_box, iw->book, &(iw->job));
-      break;
-    case NEW_INVOICE:
-    case MOD_INVOICE:
-      iw->job_choice =
-	gnc_general_search_new (GNC_JOB_MODULE_NAME, _("Select..."), TRUE,
-				gnc_invoice_select_job_cb, iw, iw->book);
+    }
+    else
+        switch (iw->dialog_type)
+        {
+        case VIEW_INVOICE:
+        case EDIT_INVOICE:
+            iw->job_choice =
+                gnc_owner_edit_create (NULL, iw->job_box, iw->book, &(iw->job));
+            break;
+        case NEW_INVOICE:
+        case MOD_INVOICE:
+            iw->job_choice =
+                gnc_general_search_new (GNC_JOB_MODULE_NAME, _("Select..."), TRUE,
+                                        gnc_invoice_select_job_cb, iw, iw->book);
 
-      gnc_general_search_set_selected (GNC_GENERAL_SEARCH (iw->job_choice),
-				       gncOwnerGetJob (&iw->job));
-      gnc_general_search_allow_clear (GNC_GENERAL_SEARCH (iw->job_choice),
-				      TRUE);
-      gtk_box_pack_start (GTK_BOX (iw->job_box), iw->job_choice,
-			  TRUE, TRUE, 0);
+            gnc_general_search_set_selected (GNC_GENERAL_SEARCH (iw->job_choice),
+                                             gncOwnerGetJob (&iw->job));
+            gnc_general_search_allow_clear (GNC_GENERAL_SEARCH (iw->job_choice),
+                                            TRUE);
+            gtk_box_pack_start (GTK_BOX (iw->job_box), iw->job_choice,
+                                TRUE, TRUE, 0);
 
-      g_signal_connect (G_OBJECT (iw->job_choice), "changed",
-			G_CALLBACK (gnc_invoice_job_changed_cb), iw);
-      break;
-    }
+            g_signal_connect (G_OBJECT (iw->job_choice), "changed",
+                              G_CALLBACK (gnc_invoice_job_changed_cb), iw);
+            break;
+        }
 
-  if (iw->job_choice)
-    gtk_widget_show_all (iw->job_choice);
+    if (iw->job_choice)
+        gtk_widget_show_all (iw->job_choice);
 }
 
 static GNCSearchWindow *
 gnc_invoice_select_proj_job_cb (gpointer jobp, gpointer user_data)
 {
-  GncJob *j = jobp;
-  InvoiceWindow *iw = user_data;
-  GncOwner owner, *ownerp;
+    GncJob *j = jobp;
+    InvoiceWindow *iw = user_data;
+    GncOwner owner, *ownerp;
 
-  if (!iw) return NULL;
+    if (!iw) return NULL;
 
-  if (j) {
-    ownerp = gncJobGetOwner (j);
-    gncOwnerCopy (ownerp, &owner);
-  } else
-    gncOwnerCopy (&(iw->proj_cust), &owner);
+    if (j)
+    {
+        ownerp = gncJobGetOwner (j);
+        gncOwnerCopy (ownerp, &owner);
+    }
+    else
+        gncOwnerCopy (&(iw->proj_cust), &owner);
 
-  return gnc_job_search (j, &owner, iw->book);
+    return gnc_job_search (j, &owner, iw->book);
 }
 
 static int
 gnc_invoice_proj_job_changed_cb (GtkWidget *widget, gpointer data)
 {
-  InvoiceWindow *iw = data;
+    InvoiceWindow *iw = data;
 
-  if (!iw)
-    return FALSE;
+    if (!iw)
+        return FALSE;
 
-  if (iw->dialog_type == VIEW_INVOICE)
+    if (iw->dialog_type == VIEW_INVOICE)
+        return FALSE;
+
+    gnc_owner_get_owner (iw->proj_job_choice, &(iw->proj_job));
     return FALSE;
-
-  gnc_owner_get_owner (iw->proj_job_choice, &(iw->proj_job));
-  return FALSE;
 }
 
 static void
 gnc_invoice_update_proj_job (InvoiceWindow *iw)
 {
-  if (iw->proj_job_choice)
-    gtk_container_remove (GTK_CONTAINER (iw->proj_job_box),
-			  iw->proj_job_choice);
+    if (iw->proj_job_choice)
+        gtk_container_remove (GTK_CONTAINER (iw->proj_job_box),
+                              iw->proj_job_choice);
 
-  switch (iw->dialog_type) {
-  case VIEW_INVOICE:
-  case EDIT_INVOICE:
-      iw->proj_job_choice =
-	gnc_owner_edit_create (NULL, iw->proj_job_box, iw->book, &(iw->job));
-    break;
-  case NEW_INVOICE:
-  case MOD_INVOICE:
-    if (iw->proj_cust.owner.undefined == NULL) {
-      iw->proj_job_choice = NULL;
-    } else {
-      iw->proj_job_choice =
-	gnc_general_search_new (GNC_JOB_MODULE_NAME, _("Select..."), TRUE,
-				gnc_invoice_select_proj_job_cb, iw, iw->book);
+    switch (iw->dialog_type)
+    {
+    case VIEW_INVOICE:
+    case EDIT_INVOICE:
+        iw->proj_job_choice =
+            gnc_owner_edit_create (NULL, iw->proj_job_box, iw->book, &(iw->job));
+        break;
+    case NEW_INVOICE:
+    case MOD_INVOICE:
+        if (iw->proj_cust.owner.undefined == NULL)
+        {
+            iw->proj_job_choice = NULL;
+        }
+        else
+        {
+            iw->proj_job_choice =
+                gnc_general_search_new (GNC_JOB_MODULE_NAME, _("Select..."), TRUE,
+                                        gnc_invoice_select_proj_job_cb, iw, iw->book);
 
-      gnc_general_search_set_selected (GNC_GENERAL_SEARCH(iw->proj_job_choice),
-				       gncOwnerGetJob (&iw->proj_job));
-      gnc_general_search_allow_clear (GNC_GENERAL_SEARCH (iw->proj_job_choice),
-				      TRUE);
-      gtk_box_pack_start (GTK_BOX (iw->proj_job_box), iw->proj_job_choice,
-			  TRUE, TRUE, 0);
+            gnc_general_search_set_selected (GNC_GENERAL_SEARCH(iw->proj_job_choice),
+                                             gncOwnerGetJob (&iw->proj_job));
+            gnc_general_search_allow_clear (GNC_GENERAL_SEARCH (iw->proj_job_choice),
+                                            TRUE);
+            gtk_box_pack_start (GTK_BOX (iw->proj_job_box), iw->proj_job_choice,
+                                TRUE, TRUE, 0);
 
-      g_signal_connect (G_OBJECT (iw->proj_job_choice), "changed",
-			G_CALLBACK (gnc_invoice_proj_job_changed_cb), iw);
+            g_signal_connect (G_OBJECT (iw->proj_job_choice), "changed",
+                              G_CALLBACK (gnc_invoice_proj_job_changed_cb), iw);
+        }
+        break;
     }
-    break;
-  }
 
-  if (iw->proj_job_choice)
-    gtk_widget_show_all (iw->proj_job_choice);
+    if (iw->proj_job_choice)
+        gtk_widget_show_all (iw->proj_job_choice);
 }
 
 static int
 gnc_invoice_owner_changed_cb (GtkWidget *widget, gpointer data)
 {
-  InvoiceWindow *iw = data;
-  GncBillTerm *term = NULL;
-  GncOwner owner;
+    InvoiceWindow *iw = data;
+    GncBillTerm *term = NULL;
+    GncOwner owner;
 
-  if (!iw)
-    return FALSE;
+    if (!iw)
+        return FALSE;
 
-  if (iw->dialog_type == VIEW_INVOICE)
-    return FALSE;
+    if (iw->dialog_type == VIEW_INVOICE)
+        return FALSE;
 
-  gncOwnerCopy (&(iw->owner), &owner);
-  gnc_owner_get_owner (iw->owner_choice, &owner);
+    gncOwnerCopy (&(iw->owner), &owner);
+    gnc_owner_get_owner (iw->owner_choice, &owner);
 
-  /* If this owner really changed, then reset ourselves */
-  if (!gncOwnerEqual (&owner, &(iw->owner))) {
-    GncInvoice *invoice;
+    /* If this owner really changed, then reset ourselves */
+    if (!gncOwnerEqual (&owner, &(iw->owner)))
+    {
+        GncInvoice *invoice;
 
-    gncOwnerCopy (&owner, &(iw->owner));
-    gncOwnerInitJob (&(iw->job), NULL);
-    invoice = iw_get_invoice (iw);
-    gnc_entry_ledger_reset_query (iw->ledger);
-  }
+        gncOwnerCopy (&owner, &(iw->owner));
+        gncOwnerInitJob (&(iw->job), NULL);
+        invoice = iw_get_invoice (iw);
+        gnc_entry_ledger_reset_query (iw->ledger);
+    }
 
-  if (iw->dialog_type == EDIT_INVOICE)
-    return FALSE;
+    if (iw->dialog_type == EDIT_INVOICE)
+        return FALSE;
 
-  switch (gncOwnerGetType (&(iw->owner))) {
-  case GNC_OWNER_CUSTOMER:
-    term = gncCustomerGetTerms (gncOwnerGetCustomer (&(iw->owner)));
-    break;
-  case GNC_OWNER_VENDOR:
-    term = gncVendorGetTerms (gncOwnerGetVendor (&(iw->owner)));
-    break;
-  case GNC_OWNER_EMPLOYEE:
-    term = NULL;
-    break;
-  default:
-    g_warning ("Unknown owner type: %d\n", gncOwnerGetType (&(iw->owner)));
-    break;
-  }
+    switch (gncOwnerGetType (&(iw->owner)))
+    {
+    case GNC_OWNER_CUSTOMER:
+        term = gncCustomerGetTerms (gncOwnerGetCustomer (&(iw->owner)));
+        break;
+    case GNC_OWNER_VENDOR:
+        term = gncVendorGetTerms (gncOwnerGetVendor (&(iw->owner)));
+        break;
+    case GNC_OWNER_EMPLOYEE:
+        term = NULL;
+        break;
+    default:
+        g_warning ("Unknown owner type: %d\n", gncOwnerGetType (&(iw->owner)));
+        break;
+    }
 
-  /* XXX: I'm not sure -- should we change the terms if this happens? */
-  iw->terms = term;
-  gnc_ui_optionmenu_set_value (iw->terms_menu, iw->terms);
+    /* XXX: I'm not sure -- should we change the terms if this happens? */
+    iw->terms = term;
+    gnc_ui_optionmenu_set_value (iw->terms_menu, iw->terms);
 
-  gnc_invoice_update_job_choice (iw);
+    gnc_invoice_update_job_choice (iw);
 
-  return FALSE;
+    return FALSE;
 }
 
 static int
 gnc_invoice_proj_cust_changed_cb (GtkWidget *widget, gpointer data)
 {
-  InvoiceWindow *iw = data;
-  GncOwner owner;
+    InvoiceWindow *iw = data;
+    GncOwner owner;
 
-  if (!iw)
-    return FALSE;
+    if (!iw)
+        return FALSE;
 
-  if (iw->dialog_type == VIEW_INVOICE)
-    return FALSE;
+    if (iw->dialog_type == VIEW_INVOICE)
+        return FALSE;
 
-  gncOwnerCopy (&(iw->proj_cust), &owner);
-  gnc_owner_get_owner (iw->proj_cust_choice, &owner);
+    gncOwnerCopy (&(iw->proj_cust), &owner);
+    gnc_owner_get_owner (iw->proj_cust_choice, &owner);
 
-  /* If this owner really changed, then reset ourselves */
-  if (!gncOwnerEqual (&owner, &(iw->proj_cust))) {
-    gncOwnerCopy (&owner, &(iw->proj_cust));
-    gncOwnerInitJob (&(iw->proj_job), NULL);
-  }
+    /* If this owner really changed, then reset ourselves */
+    if (!gncOwnerEqual (&owner, &(iw->proj_cust)))
+    {
+        gncOwnerCopy (&owner, &(iw->proj_cust));
+        gncOwnerInitJob (&(iw->proj_job), NULL);
+    }
 
-  if (iw->dialog_type == EDIT_INVOICE)
-    return FALSE;
+    if (iw->dialog_type == EDIT_INVOICE)
+        return FALSE;
 
-  gnc_invoice_update_proj_job (iw);
+    gnc_invoice_update_proj_job (iw);
 
-  return FALSE;
+    return FALSE;
 }
 
 static void
 gnc_invoice_dialog_close_handler (gpointer user_data)
 {
-  InvoiceWindow *iw = user_data;
+    InvoiceWindow *iw = user_data;
 
-  if (iw) {
-    gtk_widget_destroy (iw->dialog);
-  }
+    if (iw)
+    {
+        gtk_widget_destroy (iw->dialog);
+    }
 }
 
 static void
 gnc_invoice_window_close_handler (gpointer user_data)
 {
-  InvoiceWindow *iw = user_data;
+    InvoiceWindow *iw = user_data;
 
-  if (iw) {
-    gnc_main_window_close_page(iw->page);
-    iw->page = NULL;
-  }
+    if (iw)
+    {
+        gnc_main_window_close_page(iw->page);
+        iw->page = NULL;
+    }
 }
 
 static void
 gnc_invoice_reset_total_label (GtkLabel *label, gnc_numeric amt, gnc_commodity *com)
 {
-  char string[256];
+    char string[256];
 
-  amt = gnc_numeric_convert (amt, gnc_commodity_get_fraction(com), GNC_RND_ROUND);
-  xaccSPrintAmount (string, amt, gnc_default_print_info (TRUE));
-  gtk_label_set_text (label, string);
+    amt = gnc_numeric_convert (amt, gnc_commodity_get_fraction(com), GNC_RND_ROUND);
+    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_commodity * currency;
-  gnc_numeric amount, to_charge_amt = gnc_numeric_zero();
+    InvoiceWindow *iw = data;
+    GncInvoice * invoice;
+    gnc_commodity * currency;
+    gnc_numeric amount, to_charge_amt = gnc_numeric_zero();
 
-  if (!iw)
-    return;
+    if (!iw)
+        return;
 
-  //  if (iw)
-  //    gnc_invoice_update_window (iw, NULL);
+    //  if (iw)
+    //    gnc_invoice_update_window (iw, NULL);
 
-  invoice = iw_get_invoice (iw);
-  if (!invoice)
-    return;
+    invoice = iw_get_invoice (iw);
+    if (!invoice)
+        return;
 
-  currency = gncInvoiceGetCurrency (invoice);
+    currency = gncInvoiceGetCurrency (invoice);
 
-  if (iw->total_label) {
-    amount = gncInvoiceGetTotal (invoice);
-    gnc_invoice_reset_total_label (GTK_LABEL (iw->total_label), amount, currency);
-  }
+    if (iw->total_label)
+    {
+        amount = gncInvoiceGetTotal (invoice);
+        gnc_invoice_reset_total_label (GTK_LABEL (iw->total_label), amount, currency);
+    }
 
-  if (iw->total_subtotal_label) {
-    amount = gncInvoiceGetTotalSubtotal (invoice);
-    gnc_invoice_reset_total_label (GTK_LABEL (iw->total_subtotal_label), amount, currency);
-  }
+    if (iw->total_subtotal_label)
+    {
+        amount = gncInvoiceGetTotalSubtotal (invoice);
+        gnc_invoice_reset_total_label (GTK_LABEL (iw->total_subtotal_label), amount, currency);
+    }
 
-  if (iw->total_tax_label) {
-    amount = gncInvoiceGetTotalTax (invoice);
-    gnc_invoice_reset_total_label (GTK_LABEL (iw->total_tax_label), amount, currency);
-  }
+    if (iw->total_tax_label)
+    {
+        amount = gncInvoiceGetTotalTax (invoice);
+        gnc_invoice_reset_total_label (GTK_LABEL (iw->total_tax_label), amount, currency);
+    }
 
-  /* Deal with extra items for the expense voucher */
+    /* Deal with extra items for the expense voucher */
 
-  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->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, currency);
-  }
+    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, currency);
+    }
 
-  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, currency);
-  }
+    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, currency);
+    }
 }
 
 void
 gnc_invoice_window_changed (InvoiceWindow *iw, GtkWidget *window)
 {
-  gnc_entry_ledger_set_parent(iw->ledger, window);
+    gnc_entry_ledger_set_parent(iw->ledger, window);
 }
 
 gchar *
 gnc_invoice_get_help (InvoiceWindow *iw)
 {
-  if (!iw)
-    return NULL;
+    if (!iw)
+        return NULL;
 
-  return gnc_table_get_help (gnc_entry_ledger_get_table (iw->ledger));
+    return gnc_table_get_help (gnc_entry_ledger_get_table (iw->ledger));
 }
 
 static void
 gnc_invoice_window_refresh_handler (GHashTable *changes, gpointer user_data)
 {
-  InvoiceWindow *iw = user_data;
-  const EventInfo *info;
-  GncInvoice *invoice = iw_get_invoice (iw);
-  GncOwner *owner;
+    InvoiceWindow *iw = user_data;
+    const EventInfo *info;
+    GncInvoice *invoice = iw_get_invoice (iw);
+    GncOwner *owner;
 
- /* If there isn't a invoice behind us, close down */
-  if (!invoice) {
-    gnc_close_gui_component (iw->component_id);
-    return;
-  }
+    /* If there isn't a invoice behind us, close down */
+    if (!invoice)
+    {
+        gnc_close_gui_component (iw->component_id);
+        return;
+    }
 
-  /* Next, close if this is a destroy event */
-  if (changes) {
-    info = gnc_gui_get_entity_events (changes, &iw->invoice_guid);
-    if (info && (info->event_mask & QOF_EVENT_DESTROY)) {
-      gnc_close_gui_component (iw->component_id);
-      return;
+    /* Next, close if this is a destroy event */
+    if (changes)
+    {
+        info = gnc_gui_get_entity_events (changes, &iw->invoice_guid);
+        if (info && (info->event_mask & QOF_EVENT_DESTROY))
+        {
+            gnc_close_gui_component (iw->component_id);
+            return;
+        }
     }
-  }
 
-  /* Check the owners, and see if they have changed */
-  owner = gncInvoiceGetOwner (invoice);
+    /* Check the owners, and see if they have changed */
+    owner = gncInvoiceGetOwner (invoice);
 
-  /* Copy the owner information into our window */
-  gncOwnerCopy (gncOwnerGetEndOwner (owner), &(iw->owner));
-  gncOwnerInitJob (&(iw->job), gncOwnerGetJob (owner));
+    /* Copy the owner information into our window */
+    gncOwnerCopy (gncOwnerGetEndOwner (owner), &(iw->owner));
+    gncOwnerInitJob (&(iw->job), gncOwnerGetJob (owner));
 
-  /* Copy the billto information into our window */
-  owner = gncInvoiceGetBillTo (invoice);
-  gncOwnerCopy (gncOwnerGetEndOwner (owner), &iw->proj_cust);
-  gncOwnerInitJob (&iw->proj_job, gncOwnerGetJob (owner));
+    /* Copy the billto information into our window */
+    owner = gncInvoiceGetBillTo (invoice);
+    gncOwnerCopy (gncOwnerGetEndOwner (owner), &iw->proj_cust);
+    gncOwnerInitJob (&iw->proj_job, gncOwnerGetJob (owner));
 
-  /* Ok, NOW let's refresh ourselves */
-  gnc_invoice_update_window (iw, NULL);
+    /* Ok, NOW let's refresh ourselves */
+    gnc_invoice_update_window (iw, NULL);
 }
 
 /** Update the various widgets in the window/page vased upon the data
@@ -1438,355 +1483,375 @@
 static void
 gnc_invoice_update_window (InvoiceWindow *iw, GtkWidget *widget)
 {
-  GtkWidget *acct_entry;
-  GncInvoice *invoice;
-  gboolean is_posted = FALSE;
-  gboolean can_unpost = FALSE;
+    GtkWidget *acct_entry;
+    GncInvoice *invoice;
+    gboolean is_posted = FALSE;
+    gboolean can_unpost = FALSE;
 
-  invoice = iw_get_invoice (iw);
+    invoice = iw_get_invoice (iw);
 
-  if (iw->owner_choice)
-    gtk_container_remove (GTK_CONTAINER (iw->owner_box), iw->owner_choice);
+    if (iw->owner_choice)
+        gtk_container_remove (GTK_CONTAINER (iw->owner_box), iw->owner_choice);
 
-  if (iw->proj_cust_choice)
-    gtk_container_remove (GTK_CONTAINER (iw->proj_cust_box),
-			  iw->proj_cust_choice);
+    if (iw->proj_cust_choice)
+        gtk_container_remove (GTK_CONTAINER (iw->proj_cust_box),
+                              iw->proj_cust_choice);
 
-  switch (iw->dialog_type) {
-  case VIEW_INVOICE:
-  case EDIT_INVOICE:
-    iw->owner_choice =
-      gnc_owner_edit_create (iw->owner_label, iw->owner_box, iw->book,
-			     &(iw->owner));
-    iw->proj_cust_choice =
-      gnc_owner_edit_create (NULL, iw->proj_cust_box, iw->book,
-			     &(iw->proj_cust));
-    break;
-  case NEW_INVOICE:
-  case MOD_INVOICE:
-    iw->owner_choice =
-      gnc_owner_select_create (iw->owner_label, iw->owner_box, iw->book,
-			       &(iw->owner));
-    iw->proj_cust_choice =
-      gnc_owner_select_create (NULL, iw->proj_cust_box, iw->book,
-			       &(iw->proj_cust));
+    switch (iw->dialog_type)
+    {
+    case VIEW_INVOICE:
+    case EDIT_INVOICE:
+        iw->owner_choice =
+            gnc_owner_edit_create (iw->owner_label, iw->owner_box, iw->book,
+                                   &(iw->owner));
+        iw->proj_cust_choice =
+            gnc_owner_edit_create (NULL, iw->proj_cust_box, iw->book,
+                                   &(iw->proj_cust));
+        break;
+    case NEW_INVOICE:
+    case MOD_INVOICE:
+        iw->owner_choice =
+            gnc_owner_select_create (iw->owner_label, iw->owner_box, iw->book,
+                                     &(iw->owner));
+        iw->proj_cust_choice =
+            gnc_owner_select_create (NULL, iw->proj_cust_box, iw->book,
+                                     &(iw->proj_cust));
 
-    g_signal_connect (G_OBJECT (iw->owner_choice), "changed",
-		      G_CALLBACK (gnc_invoice_owner_changed_cb), iw);
+        g_signal_connect (G_OBJECT (iw->owner_choice), "changed",
+                          G_CALLBACK (gnc_invoice_owner_changed_cb), iw);
 
-    g_signal_connect (G_OBJECT (iw->proj_cust_choice), "changed",
-		      G_CALLBACK (gnc_invoice_proj_cust_changed_cb), iw);
+        g_signal_connect (G_OBJECT (iw->proj_cust_choice), "changed",
+                          G_CALLBACK (gnc_invoice_proj_cust_changed_cb), iw);
 
-    break;
-  }
+        break;
+    }
 
-  if (iw->owner_choice)
-    gtk_widget_show_all (iw->owner_choice);
-  if (iw->proj_cust_choice)
-    gtk_widget_show_all (iw->proj_cust_choice);
+    if (iw->owner_choice)
+        gtk_widget_show_all (iw->owner_choice);
+    if (iw->proj_cust_choice)
+        gtk_widget_show_all (iw->proj_cust_choice);
 
-  gnc_invoice_update_job_choice (iw);
-  gnc_invoice_update_proj_job (iw);
+    gnc_invoice_update_job_choice (iw);
+    gnc_invoice_update_proj_job (iw);
 
-  /* Hide the project frame for customer invoices */
-  if (iw->owner.type == GNC_OWNER_CUSTOMER)
-    gtk_widget_hide_all (iw->proj_frame);
+    /* Hide the project frame for customer invoices */
+    if (iw->owner.type == GNC_OWNER_CUSTOMER)
+        gtk_widget_hide_all (iw->proj_frame);
 
-  /* Hide the "job" label and entry for employee invoices */
-  if (iw->owner.type == GNC_OWNER_EMPLOYEE) {
-    gtk_widget_hide_all (iw->job_label);
-    gtk_widget_hide_all (iw->job_box);
-  }
+    /* Hide the "job" label and entry for employee invoices */
+    if (iw->owner.type == GNC_OWNER_EMPLOYEE)
+    {
+        gtk_widget_hide_all (iw->job_label);
+        gtk_widget_hide_all (iw->job_box);
+    }
 
-  acct_entry = glade_xml_get_widget (iw->xml, "acct_entry");
+    acct_entry = glade_xml_get_widget (iw->xml, "acct_entry");
 
-  /* We know that "invoice" (and "owner") exist now */
-  do {
-    GtkTextBuffer* text_buffer;
-    const char *string;
-    gchar * tmp_string;
-    Timespec ts, ts_zero = {0,0};
-    Account *acct;
+    /* We know that "invoice" (and "owner") exist now */
+    do
+    {
+        GtkTextBuffer* text_buffer;
+        const char *string;
+        gchar * tmp_string;
+        Timespec ts, ts_zero = {0, 0};
+        Account *acct;
 
-    gtk_entry_set_text (GTK_ENTRY (iw->id_entry), gncInvoiceGetID (invoice));
+        gtk_entry_set_text (GTK_ENTRY (iw->id_entry), gncInvoiceGetID (invoice));
 
-    gtk_entry_set_text (GTK_ENTRY (iw->billing_id_entry),
-			gncInvoiceGetBillingID (invoice));
+        gtk_entry_set_text (GTK_ENTRY (iw->billing_id_entry),
+                            gncInvoiceGetBillingID (invoice));
 
-    string = gncInvoiceGetNotes (invoice);
-    text_buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW(iw->notes_text));
-    gtk_text_buffer_set_text (text_buffer, string, -1);
+        string = gncInvoiceGetNotes (invoice);
+        text_buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW(iw->notes_text));
+        gtk_text_buffer_set_text (text_buffer, string, -1);
 
-    if (iw->active_check)
-      gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (iw->active_check),
-				    gncInvoiceGetActive (invoice));
+        if (iw->active_check)
+            gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (iw->active_check),
+                                          gncInvoiceGetActive (invoice));
 
-    ts = gncInvoiceGetDateOpened (invoice);
-    if (timespec_equal (&ts, &ts_zero)) {
-      gnc_date_edit_set_time (GNC_DATE_EDIT (iw->opened_date), time(NULL));
-    } else {
-      gnc_date_edit_set_time_ts (GNC_DATE_EDIT (iw->opened_date), ts);
-    }
+        ts = gncInvoiceGetDateOpened (invoice);
+        if (timespec_equal (&ts, &ts_zero))
+        {
+            gnc_date_edit_set_time (GNC_DATE_EDIT (iw->opened_date), time(NULL));
+        }
+        else
+        {
+            gnc_date_edit_set_time_ts (GNC_DATE_EDIT (iw->opened_date), ts);
+        }
 
-    /* fill in the terms menu */
-    iw->terms = gncInvoiceGetTerms (invoice);
-    gnc_ui_optionmenu_set_value (iw->terms_menu, iw->terms);
+        /* fill in the terms menu */
+        iw->terms = gncInvoiceGetTerms (invoice);
+        gnc_ui_optionmenu_set_value (iw->terms_menu, iw->terms);
 
-    /*
-     * Next, figure out if we've been posted, and if so set the
-     * appropriate bits of information.. Then work on hiding or
-     * unhiding as necessary.
-     */
+        /*
+         * Next, figure out if we've been posted, and if so set the
+         * appropriate bits of information.. Then work on hiding or
+         * unhiding as necessary.
+         */
 
-    acct = gncInvoiceGetPostedAcc (invoice);
-    if (!acct)
-      break;
+        acct = gncInvoiceGetPostedAcc (invoice);
+        if (!acct)
+            break;
 
-    /* Ok, it's definitely posted. Setup the 'posted-invoice' fields now */
-    is_posted = TRUE;
+        /* Ok, it's definitely posted. Setup the 'posted-invoice' fields now */
+        is_posted = TRUE;
 
-    /* Can we unpost this invoice?
-     * XXX: right now we always can, but there
-     * may be times in the future when we cannot.
-     */
-    can_unpost = TRUE;
+        /* Can we unpost this invoice?
+         * XXX: right now we always can, but there
+         * may be times in the future when we cannot.
+         */
+        can_unpost = TRUE;
 
-    ts = gncInvoiceGetDatePosted (invoice);
-    gnc_date_edit_set_time_ts (GNC_DATE_EDIT (iw->posted_date), ts);
+        ts = gncInvoiceGetDatePosted (invoice);
+        gnc_date_edit_set_time_ts (GNC_DATE_EDIT (iw->posted_date), ts);
 
-    tmp_string = gnc_account_get_full_name (acct);
-    gtk_entry_set_text (GTK_ENTRY (acct_entry), tmp_string);
-    g_free(tmp_string);
+        tmp_string = gnc_account_get_full_name (acct);
+        gtk_entry_set_text (GTK_ENTRY (acct_entry), tmp_string);
+        g_free(tmp_string);
 
-  } while (FALSE);
+    }
+    while (FALSE);
 
-  gnc_invoice_id_changed_cb(NULL, iw);
-  if (iw->dialog_type == NEW_INVOICE || iw->dialog_type == MOD_INVOICE) {
-    if (widget)
-      gtk_widget_show (widget);
-    else
-      gtk_widget_show (iw_get_window(iw));
-    return;
-  }
+    gnc_invoice_id_changed_cb(NULL, iw);
+    if (iw->dialog_type == NEW_INVOICE || iw->dialog_type == MOD_INVOICE)
+    {
+        if (widget)
+            gtk_widget_show (widget);
+        else
+            gtk_widget_show (iw_get_window(iw));
+        return;
+    }
 
-  /* Fill in the to_charge amount (only in VIEW/EDIT modes) */
-  {
-    gnc_numeric amount;
+    /* Fill in the to_charge amount (only in VIEW/EDIT modes) */
+    {
+        gnc_numeric amount;
 
-    amount = gncInvoiceGetToChargeAmount (invoice);
-    gnc_amount_edit_set_amount (GNC_AMOUNT_EDIT (iw->to_charge_edit), amount);
-  }
+        amount = gncInvoiceGetToChargeAmount (invoice);
+        gnc_amount_edit_set_amount (GNC_AMOUNT_EDIT (iw->to_charge_edit), amount);
+    }
 
-  /* Hide/show the appropriate widgets based on our posted/paid state */
+    /* Hide/show the appropriate widgets based on our posted/paid state */
 
-  {
-    GtkWidget *hide;
+    {
+        GtkWidget *hide;
 
-    if (is_posted == TRUE) {
-      hide = glade_xml_get_widget (iw->xml, "hide3");
-      gtk_widget_hide_all (hide);
-      hide = glade_xml_get_widget (iw->xml, "hide4");
-      gtk_widget_hide_all (hide);
+        if (is_posted == TRUE)
+        {
+            hide = glade_xml_get_widget (iw->xml, "hide3");
+            gtk_widget_hide_all (hide);
+            hide = glade_xml_get_widget (iw->xml, "hide4");
+            gtk_widget_hide_all (hide);
 
-    } else {			/* ! posted */
-      hide = glade_xml_get_widget (iw->xml, "posted_label");
-      gtk_widget_hide_all (hide);
-      gtk_widget_hide_all (iw->posted_date_hbox);
+        }
+        else  			/* ! posted */
+        {
+            hide = glade_xml_get_widget (iw->xml, "posted_label");
+            gtk_widget_hide_all (hide);
+            gtk_widget_hide_all (iw->posted_date_hbox);
 
-      hide = glade_xml_get_widget (iw->xml, "acct_label");
-      gtk_widget_hide_all (hide);
-      gtk_widget_hide_all (acct_entry);
+            hide = glade_xml_get_widget (iw->xml, "acct_label");
+            gtk_widget_hide_all (hide);
+            gtk_widget_hide_all (acct_entry);
 
-      hide = glade_xml_get_widget (iw->xml, "hide1");
-      gtk_widget_hide_all (hide);
-      hide = glade_xml_get_widget (iw->xml, "hide2");
-      gtk_widget_hide_all (hide);
+            hide = glade_xml_get_widget (iw->xml, "hide1");
+            gtk_widget_hide_all (hide);
+            hide = glade_xml_get_widget (iw->xml, "hide2");
+            gtk_widget_hide_all (hide);
+        }
     }
-  }
 
-  /* Set the toolbar widgets sensitivity */
-  if (iw->page)
-    gnc_plugin_page_invoice_update_menus(iw->page, is_posted, can_unpost);
+    /* Set the toolbar widgets sensitivity */
+    if (iw->page)
+        gnc_plugin_page_invoice_update_menus(iw->page, is_posted, can_unpost);
 
-  /* Set the to-change widget */
-  gtk_widget_set_sensitive (iw->to_charge_edit, !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);
-  }
+    /* 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;
+    if (is_posted)
+    {
+        //    GtkWidget *hide;
 
-    /* Setup viewer for read-only access */
-    /*
-    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? */
-  }
+        /* Setup viewer for read-only access */
+        /*
+        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? */
+    }
 
-  if (widget)
-    gtk_widget_show (widget);
-  else
-    gtk_widget_show (iw_get_window(iw));
+    if (widget)
+        gtk_widget_show (widget);
+    else
+        gtk_widget_show (iw_get_window(iw));
 }
 
 gchar *
 gnc_invoice_get_title (InvoiceWindow *iw)
 {
-  char *wintitle = NULL;
-  const char *id = NULL;
+    char *wintitle = NULL;
+    const char *id = NULL;
 
-  if (!iw) return NULL;
+    if (!iw) return NULL;
 
-  switch (gncOwnerGetType (&iw->owner))
+    switch (gncOwnerGetType (&iw->owner))
     {
     case GNC_OWNER_CUSTOMER:
-      switch (iw->dialog_type)
-	{
-	case NEW_INVOICE:
-	  wintitle = _("New Invoice");
-	  break;
-	case MOD_INVOICE:
-	case EDIT_INVOICE:
-	  wintitle = _("Edit Invoice");
-	  break;
-	case VIEW_INVOICE:
-	  wintitle = _("View Invoice");
-	  break;
-	}
-      break;
+        switch (iw->dialog_type)
+        {
+        case NEW_INVOICE:
+            wintitle = _("New Invoice");
+            break;
+        case MOD_INVOICE:
+        case EDIT_INVOICE:
+            wintitle = _("Edit Invoice");
+            break;
+        case VIEW_INVOICE:
+            wintitle = _("View Invoice");
+            break;
+        }
+        break;
     case GNC_OWNER_VENDOR:
-      switch (iw->dialog_type)
-	{
-	case NEW_INVOICE:
-	  wintitle = _("New Bill");
-	  break;
-	case MOD_INVOICE:
-	case EDIT_INVOICE:
-	  wintitle = _("Edit Bill");
-	  break;
-	case VIEW_INVOICE:
-	  wintitle = _("View Bill");
-	  break;
-	}
-      break;
+        switch (iw->dialog_type)
+        {
+        case NEW_INVOICE:
+            wintitle = _("New Bill");
+            break;
+        case MOD_INVOICE:
+        case EDIT_INVOICE:
+            wintitle = _("Edit Bill");
+            break;
+        case VIEW_INVOICE:
+            wintitle = _("View Bill");
+            break;
+        }
+        break;
     case GNC_OWNER_EMPLOYEE:
-      switch (iw->dialog_type)
-	{
-	case NEW_INVOICE:
-	  wintitle = _("New Expense Voucher");
-	  break;
-	case MOD_INVOICE:
-	case EDIT_INVOICE:
-	  wintitle = _("Edit Expense Voucher");
-	  break;
-	case VIEW_INVOICE:
-	  wintitle = _("View Expense Voucher");
-	  break;
-	}
-      break;
+        switch (iw->dialog_type)
+        {
+        case NEW_INVOICE:
+            wintitle = _("New Expense Voucher");
+            break;
+        case MOD_INVOICE:
+        case EDIT_INVOICE:
+            wintitle = _("Edit Expense Voucher");
+            break;
+        case VIEW_INVOICE:
+            wintitle = _("View Expense Voucher");
+            break;
+        }
+        break;
     default:
-      break;
+        break;
     }
 
-  if (iw->id_entry)
-    id = gtk_entry_get_text (GTK_ENTRY (iw->id_entry));
-  if (id && *id)
-    return g_strconcat (wintitle, " - ", id, (char *)NULL);
-  return g_strdup (wintitle);
+    if (iw->id_entry)
+        id = gtk_entry_get_text (GTK_ENTRY (iw->id_entry));
+    if (id && *id)
+        return g_strconcat (wintitle, " - ", id, (char *)NULL);
+    return g_strdup (wintitle);
 }
 
 void
 gnc_invoice_id_changed_cb (GtkWidget *unused, gpointer data)
 {
-  InvoiceWindow *iw = data;
-  gchar *title;
+    InvoiceWindow *iw = data;
+    gchar *title;
 
-  if (!iw) return;
-  if (iw->page) {
-    gnc_plugin_page_invoice_update_title (iw->page);
-  } else {
-    title = gnc_invoice_get_title (iw);
-    gtk_window_set_title (GTK_WINDOW (iw->dialog), title);
-    g_free (title);
-  }
+    if (!iw) return;
+    if (iw->page)
+    {
+        gnc_plugin_page_invoice_update_title (iw->page);
+    }
+    else
+    {
+        title = gnc_invoice_get_title (iw);
+        gtk_window_set_title (GTK_WINDOW (iw->dialog), title);
+        g_free (title);
+    }
 }
 
 
 static gboolean
 find_handler (gpointer find_data, gpointer user_data)
 {
-  const GUID *invoice_guid = find_data;
-  InvoiceWindow *iw = user_data;
+    const GUID *invoice_guid = find_data;
+    InvoiceWindow *iw = user_data;
 
-  return(iw && guid_equal(&iw->invoice_guid, invoice_guid));
+    return(iw && guid_equal(&iw->invoice_guid, invoice_guid));
 }
 
 static InvoiceWindow *
 gnc_invoice_new_page (QofBook *bookp, InvoiceDialogType type,
-		      GncInvoice *invoice, GncOwner *owner,
-		      GncMainWindow *window)
+                      GncInvoice *invoice, GncOwner *owner,
+                      GncMainWindow *window)
 {
-  InvoiceWindow *iw;
-  GncOwner *billto;
-  GncPluginPage *new_page;
+    InvoiceWindow *iw;
+    GncOwner *billto;
+    GncPluginPage *new_page;
 
-  g_assert (type != NEW_INVOICE && type != MOD_INVOICE);
-  g_assert (invoice != NULL);
+    g_assert (type != NEW_INVOICE && type != MOD_INVOICE);
+    g_assert (invoice != NULL);
 
-  /*
-   * Find an existing window for this invoice.  If found, bring it to
-   * the front.
-   */
-  if (invoice) {
-    GUID invoice_guid;
+    /*
+     * Find an existing window for this invoice.  If found, bring it to
+     * the front.
+     */
+    if (invoice)
+    {
+        GUID invoice_guid;
 
-    invoice_guid = *gncInvoiceGetGUID (invoice);
-    iw = gnc_find_first_gui_component (DIALOG_VIEW_INVOICE_CM_CLASS,
-				       find_handler, &invoice_guid);
-    if (iw) {
-      gnc_main_window_display_page(iw->page);
-      return(iw);
+        invoice_guid = *gncInvoiceGetGUID (invoice);
+        iw = gnc_find_first_gui_component (DIALOG_VIEW_INVOICE_CM_CLASS,
+                                           find_handler, &invoice_guid);
+        if (iw)
+        {
+            gnc_main_window_display_page(iw->page);
+            return(iw);
+        }
     }
-  }
 
-  /*
-   * No existing invoice window found.  Build a new one.
-   */
-  iw = g_new0 (InvoiceWindow, 1);
-  iw->book = bookp;
-  iw->dialog_type = type;
-  iw->invoice_guid = *gncInvoiceGetGUID (invoice);
-  iw->width = -1;
+    /*
+     * No existing invoice window found.  Build a new one.
+     */
+    iw = g_new0 (InvoiceWindow, 1);
+    iw->book = bookp;
+    iw->dialog_type = type;
+    iw->invoice_guid = *gncInvoiceGetGUID (invoice);
+    iw->width = -1;
 
-  /* Save this for later */
-  gncOwnerCopy (gncOwnerGetEndOwner (owner), &(iw->owner));
-  gncOwnerInitJob (&(iw->job), gncOwnerGetJob (owner));
+    /* Save this for later */
+    gncOwnerCopy (gncOwnerGetEndOwner (owner), &(iw->owner));
+    gncOwnerInitJob (&(iw->job), gncOwnerGetJob (owner));
 
-  billto = gncInvoiceGetBillTo (invoice);
-  gncOwnerCopy (gncOwnerGetEndOwner (billto), &(iw->proj_cust));
-  gncOwnerInitJob (&iw->proj_job, gncOwnerGetJob (billto));
+    billto = gncInvoiceGetBillTo (invoice);
+    gncOwnerCopy (gncOwnerGetEndOwner (billto), &(iw->proj_cust));
+    gncOwnerInitJob (&iw->proj_job, gncOwnerGetJob (billto));
 
-  /* Now create the plugin page for this invoice and display it. */
-  new_page = gnc_plugin_page_invoice_new (iw);
-  if (window)
-    gnc_plugin_page_set_use_new_window (new_page, FALSE);
-  else
-    window = gnc_plugin_business_get_window ();
+    /* Now create the plugin page for this invoice and display it. */
+    new_page = gnc_plugin_page_invoice_new (iw);
+    if (window)
+        gnc_plugin_page_set_use_new_window (new_page, FALSE);
+    else
+        window = gnc_plugin_business_get_window ();
 
-  gnc_main_window_open_page (window, new_page);
+    gnc_main_window_open_page (window, new_page);
 
-  /* Initialize the summary bar */
-  gnc_invoice_redraw_all_cb(iw->reg, iw);
+    /* Initialize the summary bar */
+    gnc_invoice_redraw_all_cb(iw->reg, iw);
 
-  return iw;
+    return iw;
 }
 
 #define KEY_INVOICE_TYPE        "InvoiceType"
@@ -1796,443 +1861,461 @@
 
 GncPluginPage *
 gnc_invoice_recreate_page (GncMainWindow *window,
-			   GKeyFile *key_file,
-			   const gchar *group_name)
+                           GKeyFile *key_file,
+                           const gchar *group_name)
 {
-  InvoiceWindow *iw;
-  GError *error = NULL;
-  char *tmp_string = NULL, *owner_type = NULL;
-  InvoiceDialogType type;
-  GncInvoice *invoice;
-  GUID guid;
-  QofBook *book;
-  GncOwner owner = { 0 };
+    InvoiceWindow *iw;
+    GError *error = NULL;
+    char *tmp_string = NULL, *owner_type = NULL;
+    InvoiceDialogType type;
+    GncInvoice *invoice;
+    GUID guid;
+    QofBook *book;
+    GncOwner owner = { 0 };
 
-  /* Get Invoice Type */
-  tmp_string = g_key_file_get_string(key_file, group_name,
-				     KEY_INVOICE_TYPE, &error);
-  if (error) {
-    g_warning("Error reading group %s key %s: %s.",
-	      group_name, KEY_INVOICE_TYPE, error->message);
-    goto give_up;
-  }
-  type = InvoiceDialogTypefromString(tmp_string);
-  g_free(tmp_string);
+    /* Get Invoice Type */
+    tmp_string = g_key_file_get_string(key_file, group_name,
+                                       KEY_INVOICE_TYPE, &error);
+    if (error)
+    {
+        g_warning("Error reading group %s key %s: %s.",
+                  group_name, KEY_INVOICE_TYPE, error->message);
+        goto give_up;
+    }
+    type = InvoiceDialogTypefromString(tmp_string);
+    g_free(tmp_string);
 
-  /* Get Invoice GUID */
-  tmp_string = g_key_file_get_string(key_file, group_name,
-				     KEY_INVOICE_GUID, &error);
-  if (error) {
-    g_warning("Error reading group %s key %s: %s.",
-	      group_name, KEY_INVOICE_GUID, error->message);
-    goto give_up;
-  }
-  if (!string_to_guid(tmp_string, &guid)) {
-    g_warning("Invalid invoice guid: %s.", tmp_string);
-    goto give_up;
-  }
-  book = gnc_get_current_book();
-  invoice = gncInvoiceLookup(gnc_get_current_book(), &guid);
-  if (invoice == NULL) {
-    g_warning("Can't find invoice %s in current book.", tmp_string);
-    goto give_up;
-  }
-  g_free(tmp_string);
+    /* Get Invoice GUID */
+    tmp_string = g_key_file_get_string(key_file, group_name,
+                                       KEY_INVOICE_GUID, &error);
+    if (error)
+    {
+        g_warning("Error reading group %s key %s: %s.",
+                  group_name, KEY_INVOICE_GUID, error->message);
+        goto give_up;
+    }
+    if (!string_to_guid(tmp_string, &guid))
+    {
+        g_warning("Invalid invoice guid: %s.", tmp_string);
+        goto give_up;
+    }
+    book = gnc_get_current_book();
+    invoice = gncInvoiceLookup(gnc_get_current_book(), &guid);
+    if (invoice == NULL)
+    {
+        g_warning("Can't find invoice %s in current book.", tmp_string);
+        goto give_up;
+    }
+    g_free(tmp_string);
 
-  /* Get Owner Type */
-  owner_type = g_key_file_get_string(key_file, group_name,
-				     KEY_OWNER_TYPE, &error);
-  if (error) {
-    g_warning("Error reading group %s key %s: %s.",
-	      group_name, KEY_OWNER_TYPE, error->message);
-    goto give_up;
-  }
+    /* Get Owner Type */
+    owner_type = g_key_file_get_string(key_file, group_name,
+                                       KEY_OWNER_TYPE, &error);
+    if (error)
+    {
+        g_warning("Error reading group %s key %s: %s.",
+                  group_name, KEY_OWNER_TYPE, error->message);
+        goto give_up;
+    }
 
-  /* Get Owner GUID */
-  tmp_string = g_key_file_get_string(key_file, group_name,
-				     KEY_OWNER_GUID, &error);
-  if (error) {
-    g_warning("Error reading group %s key %s: %s.",
-	      group_name, KEY_OWNER_GUID, error->message);
-    goto give_up;
-  }
-  if (!string_to_guid(tmp_string, &guid)) {
-    g_warning("Invalid owner guid: %s.", tmp_string);
-    goto give_up;
-  }
+    /* Get Owner GUID */
+    tmp_string = g_key_file_get_string(key_file, group_name,
+                                       KEY_OWNER_GUID, &error);
+    if (error)
+    {
+        g_warning("Error reading group %s key %s: %s.",
+                  group_name, KEY_OWNER_GUID, error->message);
+        goto give_up;
+    }
+    if (!string_to_guid(tmp_string, &guid))
+    {
+        g_warning("Invalid owner guid: %s.", tmp_string);
+        goto give_up;
+    }
 
-  if (!gncOwnerGetOwnerFromTypeGuid(book, &owner, owner_type, &guid)) {
-    g_warning("Can't find owner %s in current book.", tmp_string);
-    goto give_up;
-  }
-  g_free(tmp_string);
-  g_free(owner_type);
+    if (!gncOwnerGetOwnerFromTypeGuid(book, &owner, owner_type, &guid))
+    {
+        g_warning("Can't find owner %s in current book.", tmp_string);
+        goto give_up;
+    }
+    g_free(tmp_string);
+    g_free(owner_type);
 
-  iw = gnc_invoice_new_page (book, type, invoice, &owner, window);
-  return iw->page;
+    iw = gnc_invoice_new_page (book, type, invoice, &owner, window);
+    return iw->page;
 
- give_up:
-  g_warning("Giving up on restoring '%s'.", group_name);
-  if (error)
-    g_error_free(error);
-  if (tmp_string)
-    g_free(tmp_string);
-  if (owner_type)
-    g_free(owner_type);
-  return NULL;
+give_up:
+    g_warning("Giving up on restoring '%s'.", group_name);
+    if (error)
+        g_error_free(error);
+    if (tmp_string)
+        g_free(tmp_string);
+    if (owner_type)
+        g_free(owner_type);
+    return NULL;
 }
 
 void
 gnc_invoice_save_page (InvoiceWindow *iw,
-		       GKeyFile *key_file,
-		       const gchar *group_name)
+                       GKeyFile *key_file,
+                       const gchar *group_name)
 {
-  g_key_file_set_string(key_file, group_name, KEY_INVOICE_TYPE,
-			InvoiceDialogTypeasString(iw->dialog_type));
-  g_key_file_set_string(key_file, group_name, KEY_INVOICE_GUID,
-			guid_to_string(&iw->invoice_guid));
+    g_key_file_set_string(key_file, group_name, KEY_INVOICE_TYPE,
+                          InvoiceDialogTypeasString(iw->dialog_type));
+    g_key_file_set_string(key_file, group_name, KEY_INVOICE_GUID,
+                          guid_to_string(&iw->invoice_guid));
 
-  g_key_file_set_string(key_file, group_name, KEY_OWNER_TYPE,
-			qofOwnerGetType(&iw->owner));
-  g_key_file_set_string(key_file, group_name, KEY_OWNER_GUID,
-			guid_to_string(gncOwnerGetGUID(&iw->owner)));
+    g_key_file_set_string(key_file, group_name, KEY_OWNER_TYPE,
+                          qofOwnerGetType(&iw->owner));
+    g_key_file_set_string(key_file, group_name, KEY_OWNER_GUID,
+                          guid_to_string(gncOwnerGetGUID(&iw->owner)));
 }
 
 GtkWidget *
 gnc_invoice_create_page (InvoiceWindow *iw, gpointer page)
 {
-  GncInvoice *invoice;
-  GladeXML *xml;
-  GtkWidget *dialog, *hbox;
-  GncEntryLedger *entry_ledger = NULL;
-  GncOwnerType owner_type;
-  GncEntryLedgerType ledger_type;
-  const gchar *gconf_section = NULL;
+    GncInvoice *invoice;
+    GladeXML *xml;
+    GtkWidget *dialog, *hbox;
+    GncEntryLedger *entry_ledger = NULL;
+    GncOwnerType owner_type;
+    GncEntryLedgerType ledger_type;
+    const gchar *gconf_section = NULL;
 
-  invoice = gncInvoiceLookup(iw->book,&iw->invoice_guid);
+    invoice = gncInvoiceLookup(iw->book, &iw->invoice_guid);
 
-  iw->page = page;
+    iw->page = page;
 
-  /* Find the dialog */
-  iw->xml = xml = gnc_glade_xml_new ("invoice.glade", "invoice_entry_vbox");
-  dialog = glade_xml_get_widget (xml, "invoice_entry_vbox");
+    /* Find the dialog */
+    iw->xml = xml = gnc_glade_xml_new ("invoice.glade", "invoice_entry_vbox");
+    dialog = glade_xml_get_widget (xml, "invoice_entry_vbox");
 
-  /* Autoconnect all the signals */
-  glade_xml_signal_autoconnect_full (xml, gnc_glade_autoconnect_full_func, iw);
+    /* Autoconnect all the signals */
+    glade_xml_signal_autoconnect_full (xml, gnc_glade_autoconnect_full_func, iw);
 
-  /* Grab the widgets */
-  iw->id_entry = glade_xml_get_widget (xml, "id_entry");
-  iw->billing_id_entry = glade_xml_get_widget (xml, "billing_id_entry");
-  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->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");
-  iw->job_box = glade_xml_get_widget (xml, "job_hbox");
+    /* Grab the widgets */
+    iw->id_entry = glade_xml_get_widget (xml, "id_entry");
+    iw->billing_id_entry = glade_xml_get_widget (xml, "billing_id_entry");
+    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->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");
+    iw->job_box = glade_xml_get_widget (xml, "job_hbox");
 
-  /* grab the project widgets */
-  iw->proj_frame = glade_xml_get_widget (xml, "proj_frame");
-  iw->proj_cust_box = glade_xml_get_widget (xml, "proj_cust_hbox");
-  iw->proj_job_box = glade_xml_get_widget (xml, "proj_job_hbox");
+    /* grab the project widgets */
+    iw->proj_frame = glade_xml_get_widget (xml, "proj_frame");
+    iw->proj_cust_box = glade_xml_get_widget (xml, "proj_cust_hbox");
+    iw->proj_job_box = glade_xml_get_widget (xml, "proj_job_hbox");
 
-  /* grab the to_charge widgets */
-  {
-    GtkWidget *edit;
+    /* grab the to_charge widgets */
+    {
+        GtkWidget *edit;
 
-    gnc_commodity *currency = gncInvoiceGetCurrency (invoice);
-    GNCPrintAmountInfo print_info;
+        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);
+        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);
 
-    g_signal_connect(G_OBJECT(gnc_amount_edit_gtk_entry(GNC_AMOUNT_EDIT(edit))),
-		     "focus-out-event",
-		     G_CALLBACK(gnc_invoice_window_leave_to_charge_cb), iw);
-    g_signal_connect(G_OBJECT(edit), "amount_changed",
-		     G_CALLBACK(gnc_invoice_window_changed_to_charge_cb), iw);
-  }
+        g_signal_connect(G_OBJECT(gnc_amount_edit_gtk_entry(GNC_AMOUNT_EDIT(edit))),
+                         "focus-out-event",
+                         G_CALLBACK(gnc_invoice_window_leave_to_charge_cb), iw);
+        g_signal_connect(G_OBJECT(edit), "amount_changed",
+                         G_CALLBACK(gnc_invoice_window_changed_to_charge_cb), iw);
+    }
 
-  hbox = glade_xml_get_widget (xml, "date_opened_hbox");
-  iw->opened_date = gnc_date_edit_new (time(NULL), FALSE, FALSE);
-  gtk_widget_show(iw->opened_date);
-  gtk_box_pack_start (GTK_BOX(hbox), iw->opened_date, TRUE, TRUE, 0);
+    hbox = glade_xml_get_widget (xml, "date_opened_hbox");
+    iw->opened_date = gnc_date_edit_new (time(NULL), FALSE, FALSE);
+    gtk_widget_show(iw->opened_date);
+    gtk_box_pack_start (GTK_BOX(hbox), iw->opened_date, TRUE, TRUE, 0);
 
-  iw->posted_date_hbox = glade_xml_get_widget (xml, "date_posted_hbox");
-  iw->posted_date = gnc_date_edit_new (time(NULL), FALSE, FALSE);
-  gtk_widget_show(iw->posted_date);
-  gtk_box_pack_start (GTK_BOX(iw->posted_date_hbox), iw->posted_date,
-		      TRUE, TRUE, 0);
+    iw->posted_date_hbox = glade_xml_get_widget (xml, "date_posted_hbox");
+    iw->posted_date = gnc_date_edit_new (time(NULL), FALSE, FALSE);
+    gtk_widget_show(iw->posted_date);
+    gtk_box_pack_start (GTK_BOX(iw->posted_date_hbox), iw->posted_date,
+                        TRUE, TRUE, 0);
 
-  /* Make the opened and posted dates insensitive in this window */
-  gtk_widget_set_sensitive (iw->opened_date, FALSE);
-  gtk_widget_set_sensitive (iw->posted_date, FALSE);
+    /* Make the opened and posted dates insensitive in this window */
+    gtk_widget_set_sensitive (iw->opened_date, FALSE);
+    gtk_widget_set_sensitive (iw->posted_date, FALSE);
 
-  /* Build the ledger */
-  ledger_type = GNCENTRY_INVOICE_VIEWER;
-  owner_type = gncOwnerGetType (&iw->owner);
-  switch (iw->dialog_type) {
-  case EDIT_INVOICE:
-    switch (owner_type) {
-    case GNC_OWNER_CUSTOMER:
-      ledger_type = GNCENTRY_INVOICE_ENTRY;
-      break;
-    case GNC_OWNER_VENDOR:
-      ledger_type = GNCENTRY_BILL_ENTRY;
-      break;
-    case GNC_OWNER_EMPLOYEE:
-      ledger_type = GNCENTRY_EXPVOUCHER_ENTRY;
-      break;
+    /* Build the ledger */
+    ledger_type = GNCENTRY_INVOICE_VIEWER;
+    owner_type = gncOwnerGetType (&iw->owner);
+    switch (iw->dialog_type)
+    {
+    case EDIT_INVOICE:
+        switch (owner_type)
+        {
+        case GNC_OWNER_CUSTOMER:
+            ledger_type = GNCENTRY_INVOICE_ENTRY;
+            break;
+        case GNC_OWNER_VENDOR:
+            ledger_type = GNCENTRY_BILL_ENTRY;
+            break;
+        case GNC_OWNER_EMPLOYEE:
+            ledger_type = GNCENTRY_EXPVOUCHER_ENTRY;
+            break;
+        default:
+            g_warning ("Invalid owner type");
+        }
+        break;
+    case VIEW_INVOICE:
     default:
-      g_warning ("Invalid owner type");
+        switch (owner_type)
+        {
+        case GNC_OWNER_CUSTOMER:
+            ledger_type = GNCENTRY_INVOICE_VIEWER;
+            gconf_section = GCONF_SECTION_INVOICE;
+            break;
+        case GNC_OWNER_VENDOR:
+            ledger_type = GNCENTRY_BILL_VIEWER;
+            gconf_section = GCONF_SECTION_BILL;
+            break;
+        case GNC_OWNER_EMPLOYEE:
+            ledger_type = GNCENTRY_EXPVOUCHER_VIEWER;
+            gconf_section = GCONF_SECTION_BILL;
+            break;
+        default:
+            g_warning ("Invalid owner type");
+        }
     }
-    break;
-  case VIEW_INVOICE:
-  default:
-    switch (owner_type) {
-    case GNC_OWNER_CUSTOMER:
-      ledger_type = GNCENTRY_INVOICE_VIEWER;
-      gconf_section = GCONF_SECTION_INVOICE;
-      break;
-    case GNC_OWNER_VENDOR:
-      ledger_type = GNCENTRY_BILL_VIEWER;
-      gconf_section = GCONF_SECTION_BILL;
-      break;
-    case GNC_OWNER_EMPLOYEE:
-      ledger_type = GNCENTRY_EXPVOUCHER_VIEWER;
-      gconf_section = GCONF_SECTION_BILL;
-      break;
-    default:
-      g_warning ("Invalid owner type");
-    }
-  }
-  entry_ledger = gnc_entry_ledger_new (iw->book, ledger_type);
+    entry_ledger = gnc_entry_ledger_new (iw->book, ledger_type);
 
-  /* Save the ledger... */
-  iw->ledger = entry_ledger;
-  /* window will be updated in a callback */
+    /* Save the ledger... */
+    iw->ledger = entry_ledger;
+    /* window will be updated in a callback */
 
-  /* Set the entry_ledger's invoice */
-  gnc_entry_ledger_set_default_invoice (entry_ledger, invoice);
+    /* Set the entry_ledger's invoice */
+    gnc_entry_ledger_set_default_invoice (entry_ledger, invoice);
 
-  /* Set the gconf section */
-  gnc_entry_ledger_set_gconf_section (entry_ledger, gconf_section);
+    /* Set the gconf section */
+    gnc_entry_ledger_set_gconf_section (entry_ledger, gconf_section);
 
-  /* Setup initial values */
-  iw->component_id =
-    gnc_register_gui_component (DIALOG_VIEW_INVOICE_CM_CLASS,
-				gnc_invoice_window_refresh_handler,
-				gnc_invoice_window_close_handler,
-				iw);
+    /* Setup initial values */
+    iw->component_id =
+        gnc_register_gui_component (DIALOG_VIEW_INVOICE_CM_CLASS,
+                                    gnc_invoice_window_refresh_handler,
+                                    gnc_invoice_window_close_handler,
+                                    iw);
 
-  gnc_gui_component_watch_entity_type (iw->component_id,
-				       GNC_INVOICE_MODULE_NAME,
-				       QOF_EVENT_MODIFY | QOF_EVENT_DESTROY);
+    gnc_gui_component_watch_entity_type (iw->component_id,
+                                         GNC_INVOICE_MODULE_NAME,
+                                         QOF_EVENT_MODIFY | QOF_EVENT_DESTROY);
 
-  /* Create the register */
-  {
-    GtkWidget *regWidget, *frame, *window;
-    guint num_rows;
+    /* Create the register */
+    {
+        GtkWidget *regWidget, *frame, *window;
+        guint num_rows;
 
-    num_rows = gnc_gconf_get_float(GCONF_SECTION_INVOICE,
-				   KEY_NUMBER_OF_ROWS, NULL);
-    if (num_rows == 0)
-      num_rows = 10;
-    gnucash_register_set_initial_rows( num_rows );
+        num_rows = gnc_gconf_get_float(GCONF_SECTION_INVOICE,
+                                       KEY_NUMBER_OF_ROWS, NULL);
+        if (num_rows == 0)
+            num_rows = 10;
+        gnucash_register_set_initial_rows( num_rows );
 
-    /* Watch the order of operations, here... */
-    regWidget = gnucash_register_new (gnc_entry_ledger_get_table
-				      (entry_ledger));
-    gtk_widget_show(regWidget);
-    gnc_table_init_gui( regWidget, entry_ledger );
+        /* Watch the order of operations, here... */
+        regWidget = gnucash_register_new (gnc_entry_ledger_get_table
+                                          (entry_ledger));
+        gtk_widget_show(regWidget);
+        gnc_table_init_gui( regWidget, entry_ledger );
 
-    frame = glade_xml_get_widget (xml, "ledger_frame");
-    gtk_container_add (GTK_CONTAINER (frame), regWidget);
+        frame = glade_xml_get_widget (xml, "ledger_frame");
+        gtk_container_add (GTK_CONTAINER (frame), regWidget);
 
-    iw->reg = GNUCASH_REGISTER (regWidget);
-    window = gnc_plugin_page_get_window(iw->page);
-    GNUCASH_SHEET (iw->reg->sheet)->window = window;
+        iw->reg = GNUCASH_REGISTER (regWidget);
+        window = gnc_plugin_page_get_window(iw->page);
+        GNUCASH_SHEET (iw->reg->sheet)->window = window;
 
-    g_signal_connect (G_OBJECT (regWidget), "activate_cursor",
-		      G_CALLBACK (gnc_invoice_window_recordCB), iw);
-    g_signal_connect (G_OBJECT (regWidget), "redraw_all",
-		      G_CALLBACK (gnc_invoice_redraw_all_cb), iw);
-  }
+        g_signal_connect (G_OBJECT (regWidget), "activate_cursor",
+                          G_CALLBACK (gnc_invoice_window_recordCB), iw);
+        g_signal_connect (G_OBJECT (regWidget), "redraw_all",
+                          G_CALLBACK (gnc_invoice_redraw_all_cb), iw);
+    }
 
-  gnc_table_realize_gui (gnc_entry_ledger_get_table (entry_ledger));
+    gnc_table_realize_gui (gnc_entry_ledger_get_table (entry_ledger));
 
-  /* Now fill in a lot of the pieces and display properly */
-  gnc_ui_billterms_optionmenu (iw->terms_menu, iw->book, TRUE, &iw->terms);
-  gnc_invoice_update_window (iw, dialog);
+    /* Now fill in a lot of the pieces and display properly */
+    gnc_ui_billterms_optionmenu (iw->terms_menu, iw->book, TRUE, &iw->terms);
+    gnc_invoice_update_window (iw, dialog);
 
-  gnc_table_refresh_gui (gnc_entry_ledger_get_table (iw->ledger), TRUE);
+    gnc_table_refresh_gui (gnc_entry_ledger_get_table (iw->ledger), TRUE);
 
-  /* Show the dialog */
-  //  gtk_widget_show_all (dialog);
+    /* Show the dialog */
+    //  gtk_widget_show_all (dialog);
 
-  return dialog;
+    return dialog;
 }
 
 static InvoiceWindow *
 gnc_invoice_window_new_invoice (QofBook *bookp, GncOwner *owner,
-				GncInvoice *invoice)
+                                GncInvoice *invoice)
 {
-  InvoiceWindow *iw;
-  GladeXML *xml;
-  GtkWidget *hbox;
-  GncOwner *billto;
+    InvoiceWindow *iw;
+    GladeXML *xml;
+    GtkWidget *hbox;
+    GncOwner *billto;
 
-  if (invoice) {
-    /*
-     * Try to find an existing window for this invoice.  If found,
-     * bring it to the front.
-     */
-    GUID invoice_guid;
+    if (invoice)
+    {
+        /*
+         * Try to find an existing window for this invoice.  If found,
+         * bring it to the front.
+         */
+        GUID invoice_guid;
 
-    invoice_guid = *gncInvoiceGetGUID (invoice);
-    iw = gnc_find_first_gui_component (DIALOG_NEW_INVOICE_CM_CLASS,
-				       find_handler, &invoice_guid);
-    if (iw) {
-      gtk_window_present (GTK_WINDOW(iw->dialog));
-      return(iw);
+        invoice_guid = *gncInvoiceGetGUID (invoice);
+        iw = gnc_find_first_gui_component (DIALOG_NEW_INVOICE_CM_CLASS,
+                                           find_handler, &invoice_guid);
+        if (iw)
+        {
+            gtk_window_present (GTK_WINDOW(iw->dialog));
+            return(iw);
+        }
     }
-  }
 
-  /*
-   * No existing invoice window found.  Build a new one.
-   */
+    /*
+     * No existing invoice window found.  Build a new one.
+     */
 
-  iw = g_new0 (InvoiceWindow, 1);
+    iw = g_new0 (InvoiceWindow, 1);
 
-  if (invoice == NULL) {
-    iw->dialog_type = NEW_INVOICE;
-    invoice = gncInvoiceCreate (bookp);
-    gncInvoiceSetCurrency (invoice, gnc_default_currency ());
-    iw->book = bookp;
-  } else {
-    iw->dialog_type = MOD_INVOICE;
-    owner = gncInvoiceGetOwner (invoice);
-    iw->book = gncInvoiceGetBook (invoice);
-  }
+    if (invoice == NULL)
+    {
+        iw->dialog_type = NEW_INVOICE;
+        invoice = gncInvoiceCreate (bookp);
+        gncInvoiceSetCurrency (invoice, gnc_default_currency ());
+        iw->book = bookp;
+    }
+    else
+    {
+        iw->dialog_type = MOD_INVOICE;
+        owner = gncInvoiceGetOwner (invoice);
+        iw->book = gncInvoiceGetBook (invoice);
+    }
 
-  /* Save this for later */
-  gncOwnerCopy (gncOwnerGetEndOwner(owner), &(iw->owner));
-  gncOwnerInitJob (&(iw->job), gncOwnerGetJob (owner));
+    /* Save this for later */
+    gncOwnerCopy (gncOwnerGetEndOwner(owner), &(iw->owner));
+    gncOwnerInitJob (&(iw->job), gncOwnerGetJob (owner));
 
-  billto = gncInvoiceGetBillTo (invoice);
-  gncOwnerCopy (gncOwnerGetEndOwner (billto), &(iw->proj_cust));
-  gncOwnerInitJob (&iw->proj_job, gncOwnerGetJob (billto));
+    billto = gncInvoiceGetBillTo (invoice);
+    gncOwnerCopy (gncOwnerGetEndOwner (billto), &(iw->proj_cust));
+    gncOwnerInitJob (&iw->proj_job, gncOwnerGetJob (billto));
 
-  /* Find the glade page layout */
-  iw->xml = xml = gnc_glade_xml_new ("invoice.glade", "New Invoice Dialog");
-  iw->dialog = glade_xml_get_widget (xml, "New Invoice Dialog");
+    /* Find the glade page layout */
+    iw->xml = xml = gnc_glade_xml_new ("invoice.glade", "New Invoice Dialog");
+    iw->dialog = glade_xml_get_widget (xml, "New Invoice Dialog");
 
-  g_object_set_data (G_OBJECT (iw->dialog), "dialog_info", iw);
+    g_object_set_data (G_OBJECT (iw->dialog), "dialog_info", iw);
 
-  /* Grab the widgets */
-  iw->id_entry = glade_xml_get_widget (xml, "id_entry");
-  iw->billing_id_entry = glade_xml_get_widget (xml, "billing_id_entry");
-  iw->terms_menu = glade_xml_get_widget (xml, "terms_menu");
-  iw->notes_text = glade_xml_get_widget (xml, "notes_text");
-  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");
-  iw->job_box = glade_xml_get_widget (xml, "job_hbox");
+    /* Grab the widgets */
+    iw->id_entry = glade_xml_get_widget (xml, "id_entry");
+    iw->billing_id_entry = glade_xml_get_widget (xml, "billing_id_entry");
+    iw->terms_menu = glade_xml_get_widget (xml, "terms_menu");
+    iw->notes_text = glade_xml_get_widget (xml, "notes_text");
+    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");
+    iw->job_box = glade_xml_get_widget (xml, "job_hbox");
 
-  /* grab the project widgets */
-  iw->proj_frame = glade_xml_get_widget (xml, "proj_frame");
-  iw->proj_cust_box = glade_xml_get_widget (xml, "proj_cust_hbox");
-  iw->proj_job_box = glade_xml_get_widget (xml, "proj_job_hbox");
+    /* grab the project widgets */
+    iw->proj_frame = glade_xml_get_widget (xml, "proj_frame");
+    iw->proj_cust_box = glade_xml_get_widget (xml, "proj_cust_hbox");
+    iw->proj_job_box = glade_xml_get_widget (xml, "proj_job_hbox");
 
-  hbox = glade_xml_get_widget (xml, "date_opened_hbox");
-  iw->opened_date = gnc_date_edit_new (time(NULL), FALSE, FALSE);
-  gtk_widget_show(iw->opened_date);
-  gtk_box_pack_start (GTK_BOX(hbox), iw->opened_date, TRUE, TRUE, 0);
+    hbox = glade_xml_get_widget (xml, "date_opened_hbox");
+    iw->opened_date = gnc_date_edit_new (time(NULL), FALSE, FALSE);
+    gtk_widget_show(iw->opened_date);
+    gtk_box_pack_start (GTK_BOX(hbox), iw->opened_date, TRUE, TRUE, 0);
 
-  /* If this is a New Invoice, reset the Notes file to read/write */
-  gtk_widget_set_sensitive (iw->notes_text, (iw->dialog_type == NEW_INVOICE));
+    /* If this is a New Invoice, reset the Notes file to read/write */
+    gtk_widget_set_sensitive (iw->notes_text, (iw->dialog_type == NEW_INVOICE));
 
-  /* Setup signals */
-  glade_xml_signal_autoconnect_full( xml,
-                                     gnc_glade_autoconnect_full_func,
-                                     iw);
-  /* Setup initial values */
-  iw->invoice_guid = *gncInvoiceGetGUID (invoice);
+    /* Setup signals */
+    glade_xml_signal_autoconnect_full( xml,
+                                       gnc_glade_autoconnect_full_func,
+                                       iw);
+    /* Setup initial values */
+    iw->invoice_guid = *gncInvoiceGetGUID (invoice);
 
-  iw->component_id =
-    gnc_register_gui_component (DIALOG_NEW_INVOICE_CM_CLASS,
-				gnc_invoice_window_refresh_handler,
-				gnc_invoice_dialog_close_handler,
-				iw);
+    iw->component_id =
+        gnc_register_gui_component (DIALOG_NEW_INVOICE_CM_CLASS,
+                                    gnc_invoice_window_refresh_handler,
+                                    gnc_invoice_dialog_close_handler,
+                                    iw);
 
-  gnc_gui_component_watch_entity_type (iw->component_id,
-				       GNC_INVOICE_MODULE_NAME,
-				       QOF_EVENT_MODIFY | QOF_EVENT_DESTROY);
+    gnc_gui_component_watch_entity_type (iw->component_id,
+                                         GNC_INVOICE_MODULE_NAME,
+                                         QOF_EVENT_MODIFY | QOF_EVENT_DESTROY);
 
-  /* Now fill in a lot of the pieces and display properly */
-  gnc_ui_billterms_optionmenu (iw->terms_menu, iw->book, TRUE, &iw->terms);
-  gnc_invoice_update_window (iw, iw->dialog);
-  gnc_table_refresh_gui (gnc_entry_ledger_get_table (iw->ledger), TRUE);
+    /* Now fill in a lot of the pieces and display properly */
+    gnc_ui_billterms_optionmenu (iw->terms_menu, iw->book, TRUE, &iw->terms);
+    gnc_invoice_update_window (iw, iw->dialog);
+    gnc_table_refresh_gui (gnc_entry_ledger_get_table (iw->ledger), TRUE);
 
-  return iw;
+    return iw;
 }
 
 InvoiceWindow *
 gnc_ui_invoice_edit (GncInvoice *invoice)
 {
-  InvoiceWindow *iw;
-  InvoiceDialogType type;
+    InvoiceWindow *iw;
+    InvoiceDialogType type;
 
-  if (!invoice) return NULL;
+    if (!invoice) return NULL;
 
-  /* Immutable once we've been posted */
-  if (gncInvoiceGetPostedAcc (invoice))
-    type = VIEW_INVOICE;
-  else
-    type = EDIT_INVOICE;
+    /* Immutable once we've been posted */
+    if (gncInvoiceGetPostedAcc (invoice))
+        type = VIEW_INVOICE;
+    else
+        type = EDIT_INVOICE;
 
-  iw = gnc_invoice_new_page (gncInvoiceGetBook(invoice), type,
-			     invoice, gncInvoiceGetOwner (invoice), NULL);
+    iw = gnc_invoice_new_page (gncInvoiceGetBook(invoice), type,
+                               invoice, gncInvoiceGetOwner (invoice), NULL);
 
-  return iw;
+    return iw;
 }
 
 static InvoiceWindow *
 gnc_ui_invoice_modify (GncInvoice *invoice)
 {
-  InvoiceWindow *iw;
-  if (!invoice) return NULL;
+    InvoiceWindow *iw;
+    if (!invoice) return NULL;
 
-  iw = gnc_invoice_window_new_invoice (NULL, NULL, invoice);
-  return iw;
+    iw = gnc_invoice_window_new_invoice (NULL, NULL, invoice);
+    return iw;
 }
 
 InvoiceWindow *
 gnc_ui_invoice_new (GncOwner *ownerp, QofBook *bookp)
 {
-  InvoiceWindow *iw;
-  GncOwner owner;
+    InvoiceWindow *iw;
+    GncOwner owner;
 
-  if (ownerp) {
-    gncOwnerCopy (ownerp, &owner);
-  } else
-    gncOwnerInitCustomer (&owner, NULL); /* XXX: pass in the owner type? */
+    if (ownerp)
+    {
+        gncOwnerCopy (ownerp, &owner);
+    }
+    else
+        gncOwnerInitCustomer (&owner, NULL); /* XXX: pass in the owner type? */
 
-  /* Make sure required options exist */
-  if (!bookp) return NULL;
+    /* Make sure required options exist */
+    if (!bookp) return NULL;
 
-  iw = gnc_invoice_window_new_invoice (bookp, &owner, NULL);
+    iw = gnc_invoice_window_new_invoice (bookp, &owner, NULL);
 
-  return iw;
+    return iw;
 }
 
 /* Functions for invoice selection widgets */
@@ -2240,424 +2323,441 @@
 static void
 edit_invoice_direct (gpointer invoice, gpointer user_data)
 {
-  g_return_if_fail (invoice);
-  gnc_ui_invoice_edit (invoice);
+    g_return_if_fail (invoice);
+    gnc_ui_invoice_edit (invoice);
 }
 
 static void
 edit_invoice_cb (gpointer *invoice_p, gpointer user_data)
 {
-  g_return_if_fail (invoice_p && user_data);
-  if (! *invoice_p)
-    return;
-  edit_invoice_direct (*invoice_p, user_data);
+    g_return_if_fail (invoice_p && user_data);
+    if (! *invoice_p)
+        return;
+    edit_invoice_direct (*invoice_p, user_data);
 }
 
 static void
 pay_invoice_direct (gpointer inv, gpointer user_data)
 {
-  GncInvoice *invoice = inv;
+    GncInvoice *invoice = inv;
 
-  g_return_if_fail (invoice);
-  gnc_ui_payment_new_with_invoice (gncInvoiceGetOwner (invoice),
-				   gncInvoiceGetBook (invoice), invoice);
+    g_return_if_fail (invoice);
+    gnc_ui_payment_new_with_invoice (gncInvoiceGetOwner (invoice),
+                                     gncInvoiceGetBook (invoice), invoice);
 }
 
 static void
 pay_invoice_cb (gpointer *invoice_p, gpointer user_data)
 {
-  g_return_if_fail (invoice_p && user_data);
-  if (! *invoice_p)
-    return;
-  pay_invoice_direct (*invoice_p, user_data);
+    g_return_if_fail (invoice_p && user_data);
+    if (! *invoice_p)
+        return;
+    pay_invoice_direct (*invoice_p, user_data);
 }
 
 static gpointer
 new_invoice_cb (gpointer user_data)
 {
-  struct _invoice_select_window *sw = user_data;
-  InvoiceWindow *iw;
+    struct _invoice_select_window *sw = user_data;
+    InvoiceWindow *iw;
 
-  g_return_val_if_fail (user_data, NULL);
+    g_return_val_if_fail (user_data, NULL);
 
-  iw = gnc_ui_invoice_new (sw->owner, sw->book);
-  return iw_get_invoice (iw);
+    iw = gnc_ui_invoice_new (sw->owner, sw->book);
+    return iw_get_invoice (iw);
 }
 
 static void
 free_invoice_cb (gpointer user_data)
 {
-  struct _invoice_select_window *sw = user_data;
+    struct _invoice_select_window *sw = user_data;
 
-  g_return_if_fail (sw);
+    g_return_if_fail (sw);
 
-  gncQueryDestroy (sw->q);
-  g_free (sw);
+    gncQueryDestroy (sw->q);
+    g_free (sw);
 }
 
 GNCSearchWindow *
 gnc_invoice_search (GncInvoice *start, GncOwner *owner, QofBook *book)
 {
-  GNCIdType type = GNC_INVOICE_MODULE_NAME;
-  struct _invoice_select_window *sw;
-  QueryNew *q, *q2 = NULL;
-  GncOwnerType owner_type = GNC_OWNER_CUSTOMER;
-  static GList *inv_params = NULL, *bill_params = NULL, *emp_params = NULL, *params;
-  static GList *columns = NULL;
-  const gchar *title, *label;
-  static GNCSearchCallbackButton *buttons;
-  static GNCSearchCallbackButton inv_buttons[] = {
-    { N_("View/Edit Invoice"), edit_invoice_cb},
-    { N_("Process Payment"), pay_invoice_cb},
-    { NULL },
-  };
-  static GNCSearchCallbackButton bill_buttons[] = {
-    { N_("View/Edit Bill"), edit_invoice_cb},
-    { N_("Process Payment"), pay_invoice_cb},
-    { NULL },
-  };
-  static GNCSearchCallbackButton emp_buttons[] = {
-    /* Translators: The terms 'Voucher' and 'Expense Voucher' are used
-       interchangeably in gnucash and mean the same thing. */
-    { N_("View/Edit Voucher"), edit_invoice_cb},
-    { N_("Process Payment"), pay_invoice_cb},
-    { NULL },
-  };
+    GNCIdType type = GNC_INVOICE_MODULE_NAME;
+    struct _invoice_select_window *sw;
+    QueryNew *q, *q2 = NULL;
+    GncOwnerType owner_type = GNC_OWNER_CUSTOMER;
+    static GList *inv_params = NULL, *bill_params = NULL, *emp_params = NULL, *params;
+    static GList *columns = NULL;
+    const gchar *title, *label;
+    static GNCSearchCallbackButton *buttons;
+    static GNCSearchCallbackButton inv_buttons[] =
+    {
+        { N_("View/Edit Invoice"), edit_invoice_cb},
+        { N_("Process Payment"), pay_invoice_cb},
+        { NULL },
+    };
+    static GNCSearchCallbackButton bill_buttons[] =
+    {
+        { N_("View/Edit Bill"), edit_invoice_cb},
+        { N_("Process Payment"), pay_invoice_cb},
+        { NULL },
+    };
+    static GNCSearchCallbackButton emp_buttons[] =
+    {
+        /* Translators: The terms 'Voucher' and 'Expense Voucher' are used
+           interchangeably in gnucash and mean the same thing. */
+        { N_("View/Edit Voucher"), edit_invoice_cb},
+        { N_("Process Payment"), pay_invoice_cb},
+        { NULL },
+    };
 
-  g_return_val_if_fail (book, NULL);
+    g_return_val_if_fail (book, NULL);
 
-  /* Build parameter list in reverse order */
-  if (inv_params == NULL) {
-    inv_params = gnc_search_param_prepend (inv_params,
-					   _("Invoice Owner"), NULL, type,
-					   INVOICE_OWNER, NULL);
-    inv_params = gnc_search_param_prepend (inv_params,
-					   _("Invoice Notes"), NULL, type,
-					   INVOICE_NOTES, NULL);
-    inv_params = gnc_search_param_prepend (inv_params,
-					   _("Billing ID"), NULL, type,
-					   INVOICE_BILLINGID, NULL);
-    inv_params = gnc_search_param_prepend (inv_params,
-					   _("Is Paid?"), NULL, type,
-					   INVOICE_IS_PAID, NULL);
-    inv_params = gnc_search_param_prepend (inv_params,
-					   _("Date Posted"), NULL, type,
-					   INVOICE_POSTED, NULL);
-    inv_params = gnc_search_param_prepend (inv_params,
-					   _("Is Posted?"), NULL, type,
-					   INVOICE_IS_POSTED, NULL);
-    inv_params = gnc_search_param_prepend (inv_params,
-					   _("Date Opened"), NULL, type,
-					   INVOICE_OPENED, NULL);
-    inv_params = gnc_search_param_prepend (inv_params,
-					   _("Company Name "), NULL, type,
-					   INVOICE_OWNER, OWNER_PARENT,
-					   OWNER_NAME, NULL);
-    inv_params = gnc_search_param_prepend (inv_params,
-					   _("Invoice ID"), NULL, type,
-					   INVOICE_ID, NULL);
-  }
-  if (bill_params == NULL) {
-    bill_params = gnc_search_param_prepend (bill_params,
-					   _("Bill Owner"), NULL, type,
-					   INVOICE_OWNER, NULL);
-    bill_params = gnc_search_param_prepend (bill_params,
-					   _("Bill Notes"), NULL, type,
-					   INVOICE_NOTES, NULL);
-    bill_params = gnc_search_param_prepend (bill_params,
-					   _("Billing ID"), NULL, type,
-					   INVOICE_BILLINGID, NULL);
-    bill_params = gnc_search_param_prepend (bill_params,
-					   _("Is Paid?"), NULL, type,
-					   INVOICE_IS_PAID, NULL);
-    bill_params = gnc_search_param_prepend (bill_params,
-					   _("Date Posted"), NULL, type,
-					   INVOICE_POSTED, NULL);
-    bill_params = gnc_search_param_prepend (bill_params,
-					   _("Is Posted?"), NULL, type,
-					   INVOICE_IS_POSTED, NULL);
-    bill_params = gnc_search_param_prepend (bill_params,
-					   _("Date Opened"), NULL, type,
-					   INVOICE_OPENED, NULL);
-    bill_params = gnc_search_param_prepend (bill_params,
-					   _("Company Name "), NULL, type,
-					   INVOICE_OWNER, OWNER_PARENT,
-					    OWNER_NAME, NULL);
-    bill_params = gnc_search_param_prepend (bill_params,
-					   _("Bill ID"), NULL, type,
-					   INVOICE_ID, NULL);
-  }
-  if (emp_params == NULL) {
-    emp_params = gnc_search_param_prepend (emp_params,
-					   _("Voucher Owner"), NULL, type,
-					   INVOICE_OWNER, NULL);
-    emp_params = gnc_search_param_prepend (emp_params,
-					   _("Voucher Notes"), NULL, type,
-					   INVOICE_NOTES, NULL);
-    emp_params = gnc_search_param_prepend (emp_params,
-					   _("Billing ID"), NULL, type,
-					   INVOICE_BILLINGID, NULL);
-    emp_params = gnc_search_param_prepend (emp_params,
-					   _("Is Paid?"), NULL, type,
-					   INVOICE_IS_PAID, NULL);
-    emp_params = gnc_search_param_prepend (emp_params,
-					   _("Date Posted"), NULL, type,
-					   INVOICE_POSTED, NULL);
-    emp_params = gnc_search_param_prepend (emp_params,
-					   _("Is Posted?"), NULL, type,
-					   INVOICE_IS_POSTED, NULL);
-    emp_params = gnc_search_param_prepend (emp_params,
-					   _("Date Opened"), NULL, type,
-					   INVOICE_OPENED, NULL);
-    emp_params = gnc_search_param_prepend (emp_params,
-					   _("Employee Name"), NULL, type,
-					   INVOICE_OWNER, OWNER_PARENT,
-					   OWNER_NAME, NULL);
-    emp_params = gnc_search_param_prepend (emp_params,
-					   _("Voucher ID"), NULL, type,
-					   INVOICE_ID, NULL);
-  }
+    /* Build parameter list in reverse order */
+    if (inv_params == NULL)
+    {
+        inv_params = gnc_search_param_prepend (inv_params,
+                                               _("Invoice Owner"), NULL, type,
+                                               INVOICE_OWNER, NULL);
+        inv_params = gnc_search_param_prepend (inv_params,
+                                               _("Invoice Notes"), NULL, type,
+                                               INVOICE_NOTES, NULL);
+        inv_params = gnc_search_param_prepend (inv_params,
+                                               _("Billing ID"), NULL, type,
+                                               INVOICE_BILLINGID, NULL);
+        inv_params = gnc_search_param_prepend (inv_params,
+                                               _("Is Paid?"), NULL, type,
+                                               INVOICE_IS_PAID, NULL);
+        inv_params = gnc_search_param_prepend (inv_params,
+                                               _("Date Posted"), NULL, type,
+                                               INVOICE_POSTED, NULL);
+        inv_params = gnc_search_param_prepend (inv_params,
+                                               _("Is Posted?"), NULL, type,
+                                               INVOICE_IS_POSTED, NULL);
+        inv_params = gnc_search_param_prepend (inv_params,
+                                               _("Date Opened"), NULL, type,
+                                               INVOICE_OPENED, NULL);
+        inv_params = gnc_search_param_prepend (inv_params,
+                                               _("Company Name "), NULL, type,
+                                               INVOICE_OWNER, OWNER_PARENT,
+                                               OWNER_NAME, NULL);
+        inv_params = gnc_search_param_prepend (inv_params,
+                                               _("Invoice ID"), NULL, type,
+                                               INVOICE_ID, NULL);
+    }
+    if (bill_params == NULL)
+    {
+        bill_params = gnc_search_param_prepend (bill_params,
+                                                _("Bill Owner"), NULL, type,
+                                                INVOICE_OWNER, NULL);
+        bill_params = gnc_search_param_prepend (bill_params,
+                                                _("Bill Notes"), NULL, type,
+                                                INVOICE_NOTES, NULL);
+        bill_params = gnc_search_param_prepend (bill_params,
+                                                _("Billing ID"), NULL, type,
+                                                INVOICE_BILLINGID, NULL);
+        bill_params = gnc_search_param_prepend (bill_params,
+                                                _("Is Paid?"), NULL, type,
+                                                INVOICE_IS_PAID, NULL);
+        bill_params = gnc_search_param_prepend (bill_params,
+                                                _("Date Posted"), NULL, type,
+                                                INVOICE_POSTED, NULL);
+        bill_params = gnc_search_param_prepend (bill_params,
+                                                _("Is Posted?"), NULL, type,
+                                                INVOICE_IS_POSTED, NULL);
+        bill_params = gnc_search_param_prepend (bill_params,
+                                                _("Date Opened"), NULL, type,
+                                                INVOICE_OPENED, NULL);
+        bill_params = gnc_search_param_prepend (bill_params,
+                                                _("Company Name "), NULL, type,
+                                                INVOICE_OWNER, OWNER_PARENT,
+                                                OWNER_NAME, NULL);
+        bill_params = gnc_search_param_prepend (bill_params,
+                                                _("Bill ID"), NULL, type,
+                                                INVOICE_ID, NULL);
+    }
+    if (emp_params == NULL)
+    {
+        emp_params = gnc_search_param_prepend (emp_params,
+                                               _("Voucher Owner"), NULL, type,
+                                               INVOICE_OWNER, NULL);
+        emp_params = gnc_search_param_prepend (emp_params,
+                                               _("Voucher Notes"), NULL, type,
+                                               INVOICE_NOTES, NULL);
+        emp_params = gnc_search_param_prepend (emp_params,
+                                               _("Billing ID"), NULL, type,
+                                               INVOICE_BILLINGID, NULL);
+        emp_params = gnc_search_param_prepend (emp_params,
+                                               _("Is Paid?"), NULL, type,
+                                               INVOICE_IS_PAID, NULL);
+        emp_params = gnc_search_param_prepend (emp_params,
+                                               _("Date Posted"), NULL, type,
+                                               INVOICE_POSTED, NULL);
+        emp_params = gnc_search_param_prepend (emp_params,
+                                               _("Is Posted?"), NULL, type,
+                                               INVOICE_IS_POSTED, NULL);
+        emp_params = gnc_search_param_prepend (emp_params,
+                                               _("Date Opened"), NULL, type,
+                                               INVOICE_OPENED, NULL);
+        emp_params = gnc_search_param_prepend (emp_params,
+                                               _("Employee Name"), NULL, type,
+                                               INVOICE_OWNER, OWNER_PARENT,
+                                               OWNER_NAME, NULL);
+        emp_params = gnc_search_param_prepend (emp_params,
+                                               _("Voucher ID"), NULL, type,
+                                               INVOICE_ID, NULL);
+    }
 
-  /* Build the column list in reverse order */
-  if (columns == NULL) {
-    columns = gnc_search_param_prepend (columns, _("Billing ID"), NULL, type,
-					INVOICE_BILLINGID, NULL);
-    columns = gnc_search_param_prepend (columns, _("Type"), NULL, type,
-					INVOICE_TYPE, NULL);
-    columns = gnc_search_param_prepend_with_justify (columns, _("Paid"),
-						     GTK_JUSTIFY_CENTER, NULL, type,
-						     INVOICE_IS_PAID, NULL);
-    columns = gnc_search_param_prepend (columns, _("Posted"), NULL, type,
-					INVOICE_POSTED, NULL);
-    columns = gnc_search_param_prepend (columns, _("Company"), NULL, type,
-					INVOICE_OWNER, OWNER_PARENT,
-					OWNER_NAME, NULL);
-    columns = gnc_search_param_prepend (columns, _("Opened"), NULL, type,
-					INVOICE_OPENED, NULL);
-    columns = gnc_search_param_prepend (columns, _("Num"), NULL, type,
-					INVOICE_ID, NULL);
-  }
+    /* Build the column list in reverse order */
+    if (columns == NULL)
+    {
+        columns = gnc_search_param_prepend (columns, _("Billing ID"), NULL, type,
+                                            INVOICE_BILLINGID, NULL);
+        columns = gnc_search_param_prepend (columns, _("Type"), NULL, type,
+                                            INVOICE_TYPE, NULL);
+        columns = gnc_search_param_prepend_with_justify (columns, _("Paid"),
+                  GTK_JUSTIFY_CENTER, NULL, type,
+                  INVOICE_IS_PAID, NULL);
+        columns = gnc_search_param_prepend (columns, _("Posted"), NULL, type,
+                                            INVOICE_POSTED, NULL);
+        columns = gnc_search_param_prepend (columns, _("Company"), NULL, type,
+                                            INVOICE_OWNER, OWNER_PARENT,
+                                            OWNER_NAME, NULL);
+        columns = gnc_search_param_prepend (columns, _("Opened"), NULL, type,
+                                            INVOICE_OPENED, NULL);
+        columns = gnc_search_param_prepend (columns, _("Num"), NULL, type,
+                                            INVOICE_ID, NULL);
+    }
 
-  /* Build the queries */
-  q = gncQueryCreateFor (type);
-  gncQuerySetBook (q, book);
+    /* Build the queries */
+    q = gncQueryCreateFor (type);
+    gncQuerySetBook (q, book);
 
-  /* If owner is supplied, limit all searches to invoices who's owner
-   * or end-owner is the supplied owner!  Show all invoices by this
-   * owner.  If a Job is supplied, search for all invoices for that
-   * job, but if a Customer is supplied, search for all invoices owned
-   * by that Customer or any of that Customer's Jobs.  In other words,
-   * match on <supplied-owner's guid> == Invoice->Owner->GUID or
-   * Invoice->owner->parentGUID.
-   */
-  if (owner) {
-    GncOwner *tmp = owner;
+    /* If owner is supplied, limit all searches to invoices who's owner
+     * or end-owner is the supplied owner!  Show all invoices by this
+     * owner.  If a Job is supplied, search for all invoices for that
+     * job, but if a Customer is supplied, search for all invoices owned
+     * by that Customer or any of that Customer's Jobs.  In other words,
+     * match on <supplied-owner's guid> == Invoice->Owner->GUID or
+     * Invoice->owner->parentGUID.
+     */
+    if (owner)
+    {
+        GncOwner *tmp = owner;
 
-    /* First, figure out the type of owner here.. */
-    owner_type = gncOwnerGetType(owner);
-    while (owner_type == GNC_OWNER_JOB) {
-      tmp = gncOwnerGetEndOwner(tmp);
-      owner_type = gncOwnerGetType(tmp);
-    }
+        /* First, figure out the type of owner here.. */
+        owner_type = gncOwnerGetType(owner);
+        while (owner_type == GNC_OWNER_JOB)
+        {
+            tmp = gncOwnerGetEndOwner(tmp);
+            owner_type = gncOwnerGetType(tmp);
+        }
 
-    /* Then if there's an actual owner (and not just a type)
-     * then add it to the query and limit the search to this owner
-     */
-    if (gncOwnerGetGUID (owner)) {
-      q2 = gncQueryCreate ();
-      gncQueryAddGUIDMatch (q2, g_slist_prepend
-			    (g_slist_prepend (NULL, QUERY_PARAM_GUID),
-			     INVOICE_OWNER),
-			    gncOwnerGetGUID (owner), QUERY_OR);
+        /* Then if there's an actual owner (and not just a type)
+         * then add it to the query and limit the search to this owner
+         */
+        if (gncOwnerGetGUID (owner))
+        {
+            q2 = gncQueryCreate ();
+            gncQueryAddGUIDMatch (q2, g_slist_prepend
+                                  (g_slist_prepend (NULL, QUERY_PARAM_GUID),
+                                   INVOICE_OWNER),
+                                  gncOwnerGetGUID (owner), QUERY_OR);
 
-      gncQueryAddGUIDMatch (q2, g_slist_prepend
-			    (g_slist_prepend (NULL, OWNER_PARENTG),
-			     INVOICE_OWNER),
-			    gncOwnerGetGUID (owner), QUERY_OR);
+            gncQueryAddGUIDMatch (q2, g_slist_prepend
+                                  (g_slist_prepend (NULL, OWNER_PARENTG),
+                                   INVOICE_OWNER),
+                                  gncOwnerGetGUID (owner), QUERY_OR);
 
-      gncQueryMergeInPlace (q, q2, QUERY_AND);
-      gncQueryDestroy (q2);
-      q2 = gncQueryCopy (q);
+            gncQueryMergeInPlace (q, q2, QUERY_AND);
+            gncQueryDestroy (q2);
+            q2 = gncQueryCopy (q);
+        }
     }
-  }
 
 #if 0
-  if (start) {
-    if (q2 == NULL)
-      q2 = gncQueryCopy (q);
+    if (start)
+    {
+        if (q2 == NULL)
+            q2 = gncQueryCopy (q);
 
-    gncQueryAddGUIDMatch (q2, g_slist_prepend (NULL, QUERY_PARAM_GUID),
-			  gncInvoiceGetGUID (start), QUERY_AND);
-  }
+        gncQueryAddGUIDMatch (q2, g_slist_prepend (NULL, QUERY_PARAM_GUID),
+                              gncInvoiceGetGUID (start), QUERY_AND);
+    }
 #endif
 
-  /* launch select dialog and return the result */
-  sw = g_new0 (struct _invoice_select_window, 1);
+    /* launch select dialog and return the result */
+    sw = g_new0 (struct _invoice_select_window, 1);
 
-  if (owner) {
-    gncOwnerCopy (owner, &(sw->owner_def));
-    sw->owner = &(sw->owner_def);
-  }
-  sw->book = book;
-  sw->q = q;
+    if (owner)
+    {
+        gncOwnerCopy (owner, &(sw->owner_def));
+        sw->owner = &(sw->owner_def);
+    }
+    sw->book = book;
+    sw->q = q;
 
-  switch (owner_type) {
+    switch (owner_type)
+    {
     case GNC_OWNER_VENDOR:
-      title = _("Find Bill");
-      label = _("Bill");
-      params = bill_params;
-      buttons = bill_buttons;
-      break;
+        title = _("Find Bill");
+        label = _("Bill");
+        params = bill_params;
+        buttons = bill_buttons;
+        break;
     case GNC_OWNER_EMPLOYEE:
-      title = _("Find Expense Voucher");
-      label = _("Expense Voucher");
-      params = emp_params;
-      buttons = emp_buttons;
-      break;
+        title = _("Find Expense Voucher");
+        label = _("Expense Voucher");
+        params = emp_params;
+        buttons = emp_buttons;
+        break;
     default:
-      title = _("Find Invoice");
-      label = _("Invoice");
-      params = inv_params;
-      buttons = inv_buttons;
-      break;
-  }
-  return gnc_search_dialog_create (type, title, params, columns, q, q2,
-				   buttons, NULL, new_invoice_cb,
-				   sw, free_invoice_cb, GCONF_SECTION_SEARCH,
-				   label);
+        title = _("Find Invoice");
+        label = _("Invoice");
+        params = inv_params;
+        buttons = inv_buttons;
+        break;
+    }
+    return gnc_search_dialog_create (type, title, params, columns, q, q2,
+                                     buttons, NULL, new_invoice_cb,
+                                     sw, free_invoice_cb, GCONF_SECTION_SEARCH,
+                                     label);
 }
 
 GNCSearchWindow *
 gnc_invoice_search_select (gpointer start, gpointer book)
 {
-  GncInvoice *i = start;
-  GncOwner owner, *ownerp;
+    GncInvoice *i = start;
+    GncOwner owner, *ownerp;
 
-  if (!book) return NULL;
+    if (!book) return NULL;
 
-  if (i) {
-    ownerp = gncInvoiceGetOwner (i);
-    gncOwnerCopy (ownerp, &owner);
-  } else
-    gncOwnerInitCustomer (&owner, NULL); /* XXX */
+    if (i)
+    {
+        ownerp = gncInvoiceGetOwner (i);
+        gncOwnerCopy (ownerp, &owner);
+    }
+    else
+        gncOwnerInitCustomer (&owner, NULL); /* XXX */
 
-  return gnc_invoice_search (start, NULL, book);
+    return gnc_invoice_search (start, NULL, book);
 }
 
 GNCSearchWindow *
 gnc_invoice_search_edit (gpointer start, gpointer book)
 {
-  if (start)
-    gnc_ui_invoice_edit (start);
+    if (start)
+        gnc_ui_invoice_edit (start);
 
-  return NULL;
+    return NULL;
 }
 
 DialogQueryList *
 gnc_invoice_show_bills_due (QofBook *book, double days_in_advance)
 {
-  GNCIdType type = GNC_INVOICE_MODULE_NAME;
-  Query *q;
-  QueryPredData_t pred_data;
-  time_t end_date;
-  GList *res;
-  gint len;
-  Timespec ts;
-  static GList *param_list = NULL;
-  static GNCDisplayListButton buttons[] = {
-    { N_("View/Edit Bill"), edit_invoice_direct },
-    { N_("Process Payment"), pay_invoice_direct },
-    { NULL },
-  };
+    GNCIdType type = GNC_INVOICE_MODULE_NAME;
+    Query *q;
+    QueryPredData_t pred_data;
+    time_t end_date;
+    GList *res;
+    gint len;
+    Timespec ts;
+    static GList *param_list = NULL;
+    static GNCDisplayListButton buttons[] =
+    {
+        { N_("View/Edit Bill"), edit_invoice_direct },
+        { N_("Process Payment"), pay_invoice_direct },
+        { NULL },
+    };
 
-  /* create the param list (in reverse order) */
-  if (param_list == NULL) {
-    param_list = gnc_search_param_prepend (param_list, _("Amount"), NULL, type,
-					   INVOICE_POST_LOT, LOT_BALANCE, NULL);
-    param_list = gnc_search_param_prepend (param_list, _("Company"), NULL, type,
-					   INVOICE_OWNER, OWNER_NAME, NULL);
-    param_list = gnc_search_param_prepend (param_list, _("Due"), NULL, type,
-					   INVOICE_DUE, NULL);
-  }
+    /* create the param list (in reverse order) */
+    if (param_list == NULL)
+    {
+        param_list = gnc_search_param_prepend (param_list, _("Amount"), NULL, type,
+                                               INVOICE_POST_LOT, LOT_BALANCE, NULL);
+        param_list = gnc_search_param_prepend (param_list, _("Company"), NULL, type,
+                                               INVOICE_OWNER, OWNER_NAME, NULL);
+        param_list = gnc_search_param_prepend (param_list, _("Due"), NULL, type,
+                                               INVOICE_DUE, NULL);
+    }
 
-  /* Create the query to search for invoices; set the book */
-  q = gncQueryCreate();
-  gncQuerySearchFor(q, GNC_INVOICE_MODULE_NAME);
-  gncQuerySetBook (q, book);
+    /* Create the query to search for invoices; set the book */
+    q = gncQueryCreate();
+    gncQuerySearchFor(q, GNC_INVOICE_MODULE_NAME);
+    gncQuerySetBook (q, book);
 
-  /* we want to find all invoices where:
-   *      invoice -> is_posted == TRUE
-   * AND  invoice -> lot -> is_closed? == FALSE
-   * AND  invoice -> type != "Invoice"
-   * AND  invoice -> due >= (today - days_in_advance)
-   */
+    /* we want to find all invoices where:
+     *      invoice -> is_posted == TRUE
+     * AND  invoice -> lot -> is_closed? == FALSE
+     * AND  invoice -> type != "Invoice"
+     * AND  invoice -> due >= (today - days_in_advance)
+     */
 
-  gncQueryAddBooleanMatch (q, g_slist_prepend(NULL, INVOICE_IS_POSTED), TRUE,
-			   QUERY_AND);
+    gncQueryAddBooleanMatch (q, g_slist_prepend(NULL, INVOICE_IS_POSTED), TRUE,
+                             QUERY_AND);
 
-  gncQueryAddBooleanMatch (q, g_slist_prepend(g_slist_prepend(NULL, LOT_IS_CLOSED),
-					      INVOICE_POST_LOT), FALSE, QUERY_AND);
+    gncQueryAddBooleanMatch (q, g_slist_prepend(g_slist_prepend(NULL, LOT_IS_CLOSED),
+                             INVOICE_POST_LOT), FALSE, QUERY_AND);
 
-  /* Watch out: Do *not* translate the string "Invoice" here because
-     it must match the QofObject.type_label string exactly, which
-     implies it is used in untranslated form! */
-  pred_data = gncQueryStringPredicate (COMPARE_NEQ, "Invoice",
-				       STRING_MATCH_NORMAL, FALSE);
-  gncQueryAddTerm (q, g_slist_prepend(NULL, INVOICE_TYPE), pred_data, QUERY_AND);
+    /* Watch out: Do *not* translate the string "Invoice" here because
+       it must match the QofObject.type_label string exactly, which
+       implies it is used in untranslated form! */
+    pred_data = gncQueryStringPredicate (COMPARE_NEQ, "Invoice",
+                                         STRING_MATCH_NORMAL, FALSE);
+    gncQueryAddTerm (q, g_slist_prepend(NULL, INVOICE_TYPE), pred_data, QUERY_AND);
 
-  end_date = time(NULL);
-  if (days_in_advance < 0)
-    days_in_advance = 0;
-  end_date += days_in_advance*60*60*24;
+    end_date = time(NULL);
+    if (days_in_advance < 0)
+        days_in_advance = 0;
+    end_date += days_in_advance * 60 * 60 * 24;
 
-  ts.tv_sec = (gint64) end_date;
-  ts.tv_nsec = 0;
-  pred_data = gncQueryDatePredicate (COMPARE_LTE, DATE_MATCH_NORMAL, ts);
-  gncQueryAddTerm (q, g_slist_prepend(NULL, INVOICE_DUE), pred_data, QUERY_AND);
+    ts.tv_sec = (gint64) end_date;
+    ts.tv_nsec = 0;
+    pred_data = gncQueryDatePredicate (COMPARE_LTE, DATE_MATCH_NORMAL, ts);
+    gncQueryAddTerm (q, g_slist_prepend(NULL, INVOICE_DUE), pred_data, QUERY_AND);
 
-  res = gncQueryRun(q);
-  len = g_list_length (res);
-  if (!res || len <= 0)
-    return NULL;
+    res = gncQueryRun(q);
+    len = g_list_length (res);
+    if (!res || len <= 0)
+        return NULL;
 
-  {
-    gchar *message = g_strdup_printf
-      (/* Translators: %d is the number of bills due. This is a
+    {
+        gchar *message = g_strdup_printf
+                         (/* Translators: %d is the number of bills due. This is a
 	  ngettext(3) message. */
-       ngettext("The following %d bill is due:",
-		"The following %d bills are due:",
-		len),
-       len);
-    DialogQueryList *dialog =
-      gnc_dialog_query_list_create(param_list, q,
-				   _("Due Bills Reminder"),
-				   message,
-				   TRUE, FALSE,
-				   buttons, NULL);
-    g_free(message);
-    return dialog;
-  }
+                             ngettext("The following %d bill is due:",
+                                      "The following %d bills are due:",
+                                      len),
+                             len);
+        DialogQueryList *dialog =
+            gnc_dialog_query_list_create(param_list, q,
+                                         _("Due Bills Reminder"),
+                                         message,
+                                         TRUE, FALSE,
+                                         buttons, NULL);
+        g_free(message);
+        return dialog;
+    }
 }
 
 void
 gnc_invoice_remind_bills_due (void)
 {
-  QofBook *book;
-  gint days;
+    QofBook *book;
+    gint days;
 
-  if (!gnc_current_session_exist()) return;
-  book = qof_session_get_book(gnc_get_current_session());
-  days = gnc_gconf_get_float(GCONF_SECTION_BILL, "days_in_advance", NULL);
+    if (!gnc_current_session_exist()) return;
+    book = qof_session_get_book(gnc_get_current_session());
+    days = gnc_gconf_get_float(GCONF_SECTION_BILL, "days_in_advance", NULL);
 
-  gnc_invoice_show_bills_due(book, days);
+    gnc_invoice_show_bills_due(book, days);
 }
 
 void
 gnc_invoice_remind_bills_due_cb (void)
 {
-  if (!gnc_gconf_get_bool(GCONF_SECTION_BILL, "notify_when_due", NULL))
-    return;
+    if (!gnc_gconf_get_bool(GCONF_SECTION_BILL, "notify_when_due", NULL))
+        return;
 
-  gnc_invoice_remind_bills_due();
+    gnc_invoice_remind_bills_due();
 }
 

Modified: gnucash/trunk/src/business/business-gnome/dialog-invoice.h
===================================================================
--- gnucash/trunk/src/business/business-gnome/dialog-invoice.h	2010-03-02 21:40:28 UTC (rev 18788)
+++ gnucash/trunk/src/business/business-gnome/dialog-invoice.h	2010-03-02 21:41:05 UTC (rev 18789)
@@ -37,12 +37,12 @@
 
 typedef enum
 {
-  BY_STANDARD = 0,
-  BY_DATE,
-  BY_DATE_ENTERED,
-  BY_DESC,
-  BY_QTY,
-  BY_PRICE
+    BY_STANDARD = 0,
+    BY_DATE,
+    BY_DATE_ENTERED,
+    BY_DESC,
+    BY_QTY,
+    BY_PRICE
 } invoice_sort_type_t;
 
 

Modified: gnucash/trunk/src/business/business-gnome/dialog-job.c
===================================================================
--- gnucash/trunk/src/business/business-gnome/dialog-job.c	2010-03-02 21:40:28 UTC (rev 18788)
+++ gnucash/trunk/src/business/business-gnome/dialog-job.c	2010-03-02 21:41:05 UTC (rev 18789)
@@ -56,374 +56,394 @@
 
 typedef enum
 {
-  NEW_JOB,
-  EDIT_JOB
+    NEW_JOB,
+    EDIT_JOB
 } JobDialogType;
 
-struct _job_select_window {
-  QofBook *	book;
-  GncOwner *	owner;
-  QueryNew *	q;
-  GncOwner	owner_def;
+struct _job_select_window
+{
+    QofBook *	book;
+    GncOwner *	owner;
+    QueryNew *	q;
+    GncOwner	owner_def;
 };
 
-struct _job_window {
-  GtkWidget *	dialog;
-  GtkWidget *	id_entry;
-  GtkWidget *	cust_edit;
-  GtkWidget *	name_entry;
-  GtkWidget *	desc_entry;
-  GtkWidget *	active_check;
+struct _job_window
+{
+    GtkWidget *	dialog;
+    GtkWidget *	id_entry;
+    GtkWidget *	cust_edit;
+    GtkWidget *	name_entry;
+    GtkWidget *	desc_entry;
+    GtkWidget *	active_check;
 
-  JobDialogType	dialog_type;
-  GUID		job_guid;
-  gint		component_id;
-  QofBook *	book;
-  GncJob *	created_job;
+    JobDialogType	dialog_type;
+    GUID		job_guid;
+    gint		component_id;
+    QofBook *	book;
+    GncJob *	created_job;
 
-  GncOwner	owner;
+    GncOwner	owner;
 
 };
 
 static GncJob *
 jw_get_job (JobWindow *jw)
 {
-  if (!jw)
-    return NULL;
+    if (!jw)
+        return NULL;
 
-  return gncJobLookup (jw->book, &jw->job_guid);
+    return gncJobLookup (jw->book, &jw->job_guid);
 }
 
 static void gnc_ui_to_job (JobWindow *jw, GncJob *job)
 {
-  gnc_suspend_gui_refresh ();
-  gncJobBeginEdit (job);
+    gnc_suspend_gui_refresh ();
+    gncJobBeginEdit (job);
 
-  gncJobSetID (job, gtk_editable_get_chars (GTK_EDITABLE (jw->id_entry),
-					    0, -1));
-  gncJobSetName (job, gtk_editable_get_chars (GTK_EDITABLE (jw->name_entry),
-					      0, -1));
-  gncJobSetReference (job, gtk_editable_get_chars
-		      (GTK_EDITABLE (jw->desc_entry), 0, -1));
-  gncJobSetActive (job, gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON
-						      (jw->active_check)));
-  {
-    GncOwner * old = gncJobGetOwner (job);
-    gnc_owner_get_owner (jw->cust_edit, &(jw->owner));
-    if (! gncOwnerEqual (old, &(jw->owner)))
-      gncJobSetOwner (job, &(jw->owner));
-  }
+    gncJobSetID (job, gtk_editable_get_chars (GTK_EDITABLE (jw->id_entry),
+                 0, -1));
+    gncJobSetName (job, gtk_editable_get_chars (GTK_EDITABLE (jw->name_entry),
+                   0, -1));
+    gncJobSetReference (job, gtk_editable_get_chars
+                        (GTK_EDITABLE (jw->desc_entry), 0, -1));
+    gncJobSetActive (job, gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON
+                     (jw->active_check)));
+    {
+        GncOwner * old = gncJobGetOwner (job);
+        gnc_owner_get_owner (jw->cust_edit, &(jw->owner));
+        if (! gncOwnerEqual (old, &(jw->owner)))
+            gncJobSetOwner (job, &(jw->owner));
+    }
 
-  gncJobCommitEdit (job);
-  gnc_resume_gui_refresh ();
+    gncJobCommitEdit (job);
+    gnc_resume_gui_refresh ();
 }
 
 static gboolean
 gnc_job_verify_ok (JobWindow *jw)
 {
-  const char *res;
-  gchar *string;
+    const char *res;
+    gchar *string;
 
-  /* Check for valid name */
-  res = gtk_entry_get_text (GTK_ENTRY (jw->name_entry));
-  if (safe_strcmp (res, "") == 0) {
-    const char *message = _("The Job must be given a name.");
-    gnc_error_dialog(jw->dialog, "%s", message);
-    return FALSE;
-  }
+    /* Check for valid name */
+    res = gtk_entry_get_text (GTK_ENTRY (jw->name_entry));
+    if (safe_strcmp (res, "") == 0)
+    {
+        const char *message = _("The Job must be given a name.");
+        gnc_error_dialog(jw->dialog, "%s", message);
+        return FALSE;
+    }
 
-  /* Check for owner */
-  gnc_owner_get_owner (jw->cust_edit, &(jw->owner));
-  res = gncOwnerGetName (&(jw->owner));
-  if (res == NULL || safe_strcmp (res, "") == 0) {
-    const char *message = _("You must choose an owner for this job.");
-    gnc_error_dialog(jw->dialog, "%s", message);
-    return FALSE;
-  }
+    /* Check for owner */
+    gnc_owner_get_owner (jw->cust_edit, &(jw->owner));
+    res = gncOwnerGetName (&(jw->owner));
+    if (res == NULL || safe_strcmp (res, "") == 0)
+    {
+        const char *message = _("You must choose an owner for this job.");
+        gnc_error_dialog(jw->dialog, "%s", message);
+        return FALSE;
+    }
 
-  /* Set a valid id if one was not created */
-  res = gtk_entry_get_text (GTK_ENTRY (jw->id_entry));
-  if (safe_strcmp (res, "") == 0) {
-    string = g_strdup_printf ("%.6" G_GINT64_FORMAT,
-			      gncJobNextID(jw->book));
-    gtk_entry_set_text (GTK_ENTRY (jw->id_entry), string);
-    g_free(string);
-  }
+    /* Set a valid id if one was not created */
+    res = gtk_entry_get_text (GTK_ENTRY (jw->id_entry));
+    if (safe_strcmp (res, "") == 0)
+    {
+        string = g_strdup_printf ("%.6" G_GINT64_FORMAT,
+                                  gncJobNextID(jw->book));
+        gtk_entry_set_text (GTK_ENTRY (jw->id_entry), string);
+        g_free(string);
+    }
 
-  /* Now save it off */
-  {
-    GncJob *job = jw_get_job (jw);
-    if (job) {
-      gnc_ui_to_job (jw, job);
+    /* Now save it off */
+    {
+        GncJob *job = jw_get_job (jw);
+        if (job)
+        {
+            gnc_ui_to_job (jw, job);
+        }
     }
-  }
 
-  /* Ok, it's been saved... Change to an editor.. */
-  jw->dialog_type = EDIT_JOB;
+    /* Ok, it's been saved... Change to an editor.. */
+    jw->dialog_type = EDIT_JOB;
 
-  return TRUE;
+    return TRUE;
 }
 
 void
 gnc_job_window_ok_cb (GtkWidget *widget, gpointer data)
 {
-  JobWindow *jw = data;
+    JobWindow *jw = data;
 
-  /* Make sure this is ok */
-  if (!gnc_job_verify_ok (jw))
-    return;
+    /* Make sure this is ok */
+    if (!gnc_job_verify_ok (jw))
+        return;
 
-  /* Now save off the job so we can return it */
-  jw->created_job = jw_get_job (jw);
-  jw->job_guid = *xaccGUIDNULL ();
+    /* Now save off the job so we can return it */
+    jw->created_job = jw_get_job (jw);
+    jw->job_guid = *xaccGUIDNULL ();
 
-  gnc_close_gui_component (jw->component_id);
+    gnc_close_gui_component (jw->component_id);
 }
 
 void
 gnc_job_window_cancel_cb (GtkWidget *widget, gpointer data)
 {
-  JobWindow *jw = data;
+    JobWindow *jw = data;
 
-  gnc_close_gui_component (jw->component_id);
+    gnc_close_gui_component (jw->component_id);
 }
 
 void
 gnc_job_window_help_cb (GtkWidget *widget, gpointer data)
 {
-  gnc_gnome_help(HF_HELP, HL_USAGE);
+    gnc_gnome_help(HF_HELP, HL_USAGE);
 }
 
 
 void
 gnc_job_window_destroy_cb (GtkWidget *widget, gpointer data)
 {
-  JobWindow *jw = data;
-  GncJob *job = jw_get_job (jw);
+    JobWindow *jw = data;
+    GncJob *job = jw_get_job (jw);
 
-  gnc_suspend_gui_refresh ();
+    gnc_suspend_gui_refresh ();
 
-  if (jw->dialog_type == NEW_JOB && job != NULL) {
-    gncJobBeginEdit (job);
-    gncJobDestroy (job);
-    jw->job_guid = *xaccGUIDNULL ();
-  }
+    if (jw->dialog_type == NEW_JOB && job != NULL)
+    {
+        gncJobBeginEdit (job);
+        gncJobDestroy (job);
+        jw->job_guid = *xaccGUIDNULL ();
+    }
 
-  gnc_unregister_gui_component (jw->component_id);
-  gnc_resume_gui_refresh ();
+    gnc_unregister_gui_component (jw->component_id);
+    gnc_resume_gui_refresh ();
 
-  g_free (jw);
+    g_free (jw);
 }
 
 void
 gnc_job_name_changed_cb (GtkWidget *widget, gpointer data)
 {
-  JobWindow *jw = data;
-  char *fullname, *title;
-  const char *name, *id;
+    JobWindow *jw = data;
+    char *fullname, *title;
+    const char *name, *id;
 
-  if (!jw)
-    return;
+    if (!jw)
+        return;
 
-  name = gtk_entry_get_text (GTK_ENTRY (jw->name_entry));
-  if (!name || *name == '\0')
-    name = _("<No name>");
+    name = gtk_entry_get_text (GTK_ENTRY (jw->name_entry));
+    if (!name || *name == '\0')
+        name = _("<No name>");
 
-  id = gtk_entry_get_text (GTK_ENTRY (jw->id_entry));
+    id = gtk_entry_get_text (GTK_ENTRY (jw->id_entry));
 
-  fullname = g_strconcat (name, " (", id, ")", (char *)NULL);
+    fullname = g_strconcat (name, " (", id, ")", (char *)NULL);
 
-  if (jw->dialog_type == EDIT_JOB)
-    title = g_strconcat (_("Edit Job"), " - ", fullname, (char *)NULL);
-  else
-    title = g_strconcat (_("New Job"), " - ", fullname, (char *)NULL);
+    if (jw->dialog_type == EDIT_JOB)
+        title = g_strconcat (_("Edit Job"), " - ", fullname, (char *)NULL);
+    else
+        title = g_strconcat (_("New Job"), " - ", fullname, (char *)NULL);
 
-  gtk_window_set_title (GTK_WINDOW (jw->dialog), title);
+    gtk_window_set_title (GTK_WINDOW (jw->dialog), title);
 
-  g_free (fullname);
-  g_free (title);
+    g_free (fullname);
+    g_free (title);
 }
 
 static void
 gnc_job_window_close_handler (gpointer user_data)
 {
-  JobWindow *jw = user_data;
+    JobWindow *jw = user_data;
 
-  gtk_widget_destroy (jw->dialog);
-  jw->dialog = NULL;
+    gtk_widget_destroy (jw->dialog);
+    jw->dialog = NULL;
 }
 
 static void
 gnc_job_window_refresh_handler (GHashTable *changes, gpointer user_data)
 {
-  JobWindow *jw = user_data;
-  const EventInfo *info;
-  GncJob *job = jw_get_job (jw);
+    JobWindow *jw = user_data;
+    const EventInfo *info;
+    GncJob *job = jw_get_job (jw);
 
-  /* If there isn't a job behind us, close down */
-  if (!job) {
-    gnc_close_gui_component (jw->component_id);
-    return;
-  }
+    /* If there isn't a job behind us, close down */
+    if (!job)
+    {
+        gnc_close_gui_component (jw->component_id);
+        return;
+    }
 
-  /* Next, close if this is a destroy event */
-  if (changes) {
-    info = gnc_gui_get_entity_events (changes, &jw->job_guid);
-    if (info && (info->event_mask & QOF_EVENT_DESTROY)) {
-      gnc_close_gui_component (jw->component_id);
-      return;
+    /* Next, close if this is a destroy event */
+    if (changes)
+    {
+        info = gnc_gui_get_entity_events (changes, &jw->job_guid);
+        if (info && (info->event_mask & QOF_EVENT_DESTROY))
+        {
+            gnc_close_gui_component (jw->component_id);
+            return;
+        }
     }
-  }
 }
 
 static gboolean
 find_handler (gpointer find_data, gpointer user_data)
 {
-  const GUID *job_guid = find_data;
-  JobWindow *jw = user_data;
+    const GUID *job_guid = find_data;
+    JobWindow *jw = user_data;
 
-  return(jw && guid_equal(&jw->job_guid, job_guid));
+    return(jw && guid_equal(&jw->job_guid, job_guid));
 }
 
 static JobWindow *
 gnc_job_new_window (QofBook *bookp, GncOwner *owner, GncJob *job)
 {
-  JobWindow *jw;
-  GladeXML *xml;
-  GtkWidget *owner_box, *owner_label;
+    JobWindow *jw;
+    GladeXML *xml;
+    GtkWidget *owner_box, *owner_label;
 
-  /*
-   * Find an existing window for this job.  If found, bring it to
-   * the front.
-   */
-  if (job) {
-    GUID job_guid;
+    /*
+     * Find an existing window for this job.  If found, bring it to
+     * the front.
+     */
+    if (job)
+    {
+        GUID job_guid;
 
-    job_guid = *gncJobGetGUID (job);
-    jw = gnc_find_first_gui_component (DIALOG_EDIT_JOB_CM_CLASS,
-				       find_handler, &job_guid);
-    if (jw) {
-      gtk_window_present (GTK_WINDOW(jw->dialog));
-      return(jw);
+        job_guid = *gncJobGetGUID (job);
+        jw = gnc_find_first_gui_component (DIALOG_EDIT_JOB_CM_CLASS,
+                                           find_handler, &job_guid);
+        if (jw)
+        {
+            gtk_window_present (GTK_WINDOW(jw->dialog));
+            return(jw);
+        }
     }
-  }
-  
-  /*
-   * No existing job window found.  Build a new one.
-   */
-  jw = g_new0 (JobWindow, 1);
-  jw->book = bookp;
-  gncOwnerCopy (owner, &(jw->owner)); /* save it off now, we know it's valid */
 
-  /* Load the XML */
-  xml = gnc_glade_xml_new ("job.glade", "Job Dialog");
+    /*
+     * No existing job window found.  Build a new one.
+     */
+    jw = g_new0 (JobWindow, 1);
+    jw->book = bookp;
+    gncOwnerCopy (owner, &(jw->owner)); /* save it off now, we know it's valid */
 
-  /* Find the dialog */
-  jw->dialog = glade_xml_get_widget (xml, "Job Dialog");
-  g_object_set_data (G_OBJECT (jw->dialog), "dialog_info", jw);
+    /* Load the XML */
+    xml = gnc_glade_xml_new ("job.glade", "Job Dialog");
 
-  /* Get entry points */
-  jw->id_entry  = glade_xml_get_widget (xml, "id_entry");
-  jw->name_entry = glade_xml_get_widget (xml, "name_entry");
-  jw->desc_entry = glade_xml_get_widget (xml, "desc_entry");
-  jw->active_check = glade_xml_get_widget (xml, "active_check");
+    /* Find the dialog */
+    jw->dialog = glade_xml_get_widget (xml, "Job Dialog");
+    g_object_set_data (G_OBJECT (jw->dialog), "dialog_info", jw);
 
-  owner_box = glade_xml_get_widget (xml, "customer_hbox");
-  owner_label = glade_xml_get_widget (xml, "owner_label");
+    /* Get entry points */
+    jw->id_entry  = glade_xml_get_widget (xml, "id_entry");
+    jw->name_entry = glade_xml_get_widget (xml, "name_entry");
+    jw->desc_entry = glade_xml_get_widget (xml, "desc_entry");
+    jw->active_check = glade_xml_get_widget (xml, "active_check");
 
-  /* Setup signals */
-  glade_xml_signal_autoconnect_full( xml,
-                                     gnc_glade_autoconnect_full_func,
-                                     jw);
-  /* Set initial entries */
-  if (job != NULL) {
-    jw->job_guid = *gncJobGetGUID (job);
+    owner_box = glade_xml_get_widget (xml, "customer_hbox");
+    owner_label = glade_xml_get_widget (xml, "owner_label");
 
-    jw->dialog_type = EDIT_JOB;
-    jw->cust_edit = gnc_owner_edit_create (owner_label, owner_box,
-					     bookp, owner);
+    /* Setup signals */
+    glade_xml_signal_autoconnect_full( xml,
+                                       gnc_glade_autoconnect_full_func,
+                                       jw);
+    /* Set initial entries */
+    if (job != NULL)
+    {
+        jw->job_guid = *gncJobGetGUID (job);
 
-    gtk_entry_set_text (GTK_ENTRY (jw->id_entry), gncJobGetID (job));
-    gtk_entry_set_text (GTK_ENTRY (jw->name_entry), gncJobGetName (job));
-    gtk_entry_set_text (GTK_ENTRY (jw->desc_entry), gncJobGetReference (job));
-    gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (jw->active_check),
-                                gncJobGetActive (job));
+        jw->dialog_type = EDIT_JOB;
+        jw->cust_edit = gnc_owner_edit_create (owner_label, owner_box,
+                                               bookp, owner);
 
-    jw->component_id = gnc_register_gui_component (DIALOG_EDIT_JOB_CM_CLASS,
-						   gnc_job_window_refresh_handler,
-						   gnc_job_window_close_handler,
-						   jw);
-  } else {
-    job = gncJobCreate (bookp);
-    gncJobSetOwner (job, owner);
-    jw->job_guid = *gncJobGetGUID (job);
-      
-    jw->dialog_type = NEW_JOB;
+        gtk_entry_set_text (GTK_ENTRY (jw->id_entry), gncJobGetID (job));
+        gtk_entry_set_text (GTK_ENTRY (jw->name_entry), gncJobGetName (job));
+        gtk_entry_set_text (GTK_ENTRY (jw->desc_entry), gncJobGetReference (job));
+        gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (jw->active_check),
+                                      gncJobGetActive (job));
 
-    /* If we are passed a real owner, don't allow the user to change it */
-    if (owner->owner.undefined) {
-      jw->cust_edit = gnc_owner_edit_create (owner_label, owner_box,
-					     bookp, owner);
-    } else {
-      jw->cust_edit = gnc_owner_select_create (owner_label, owner_box,
-					       bookp, owner);
+        jw->component_id = gnc_register_gui_component (DIALOG_EDIT_JOB_CM_CLASS,
+                           gnc_job_window_refresh_handler,
+                           gnc_job_window_close_handler,
+                           jw);
     }
+    else
+    {
+        job = gncJobCreate (bookp);
+        gncJobSetOwner (job, owner);
+        jw->job_guid = *gncJobGetGUID (job);
 
-    jw->component_id = gnc_register_gui_component (DIALOG_NEW_JOB_CM_CLASS,
-						   gnc_job_window_refresh_handler,
-						   gnc_job_window_close_handler,
-						   jw);
-  }
+        jw->dialog_type = NEW_JOB;
 
-  gnc_job_name_changed_cb (NULL, jw);
-  gnc_gui_component_watch_entity_type (jw->component_id,
-				       GNC_JOB_MODULE_NAME,
-				       QOF_EVENT_MODIFY | QOF_EVENT_DESTROY);
+        /* If we are passed a real owner, don't allow the user to change it */
+        if (owner->owner.undefined)
+        {
+            jw->cust_edit = gnc_owner_edit_create (owner_label, owner_box,
+                                                   bookp, owner);
+        }
+        else
+        {
+            jw->cust_edit = gnc_owner_select_create (owner_label, owner_box,
+                            bookp, owner);
+        }
 
-  gtk_widget_show_all (jw->dialog);
+        jw->component_id = gnc_register_gui_component (DIALOG_NEW_JOB_CM_CLASS,
+                           gnc_job_window_refresh_handler,
+                           gnc_job_window_close_handler,
+                           jw);
+    }
 
-  return jw;
+    gnc_job_name_changed_cb (NULL, jw);
+    gnc_gui_component_watch_entity_type (jw->component_id,
+                                         GNC_JOB_MODULE_NAME,
+                                         QOF_EVENT_MODIFY | QOF_EVENT_DESTROY);
+
+    gtk_widget_show_all (jw->dialog);
+
+    return jw;
 }
 
 GncJob *
 gnc_ui_job_new_return_handle (GncOwner *owner, QofBook *book)
 {
-  JobWindow *jw;
-  if (!book) return NULL;
-  jw = gnc_ui_job_new (owner, book);
-  return jw_get_job (jw);
+    JobWindow *jw;
+    if (!book) return NULL;
+    jw = gnc_ui_job_new (owner, book);
+    return jw_get_job (jw);
 }
 
 JobWindow *
 gnc_ui_job_new (GncOwner *ownerp, QofBook *bookp)
 {
-  JobWindow *jw;
-  GncOwner owner;
+    JobWindow *jw;
+    GncOwner owner;
 
-  /* Make sure required options exist */
-  if (!bookp) return NULL;
+    /* Make sure required options exist */
+    if (!bookp) return NULL;
 
-  if (ownerp) {
-    g_return_val_if_fail ((gncOwnerGetType (ownerp) == GNC_OWNER_CUSTOMER) ||
-			  (gncOwnerGetType (ownerp) == GNC_OWNER_VENDOR),
-			  NULL);
-    gncOwnerCopy (ownerp, &owner);
-  } else
-    gncOwnerInitCustomer (&owner, NULL); /* XXX */
+    if (ownerp)
+    {
+        g_return_val_if_fail ((gncOwnerGetType (ownerp) == GNC_OWNER_CUSTOMER) ||
+                              (gncOwnerGetType (ownerp) == GNC_OWNER_VENDOR),
+                              NULL);
+        gncOwnerCopy (ownerp, &owner);
+    }
+    else
+        gncOwnerInitCustomer (&owner, NULL); /* XXX */
 
-  jw = gnc_job_new_window (bookp, &owner, NULL);
-  return jw;
+    jw = gnc_job_new_window (bookp, &owner, NULL);
+    return jw;
 }
 
 JobWindow *
 gnc_ui_job_edit (GncJob *job)
 {
-  JobWindow *jw;
+    JobWindow *jw;
 
-  if (!job) return NULL;
+    if (!job) return NULL;
 
-  jw = gnc_job_new_window (gncJobGetBook(job), gncJobGetOwner(job), job);
-  return jw;
+    jw = gnc_job_new_window (gncJobGetBook(job), gncJobGetOwner(job), job);
+    return jw;
 }
 
 /* Search functionality */
@@ -431,166 +451,172 @@
 static void
 edit_job_cb (gpointer *job_p, gpointer user_data)
 {
-  GncJob *job;
+    GncJob *job;
 
-  g_return_if_fail (job_p && user_data);
+    g_return_if_fail (job_p && user_data);
 
-  job = *job_p;
+    job = *job_p;
 
-  if (!job)
-    return;
+    if (!job)
+        return;
 
-  gnc_ui_job_edit (job);
+    gnc_ui_job_edit (job);
 }
 
 static void
 invoice_job_cb (gpointer *job_p, gpointer user_data)
 {
-  struct _job_select_window * sw = user_data;
-  GncJob *job;
-  GncOwner owner;
+    struct _job_select_window * sw = user_data;
+    GncJob *job;
+    GncOwner owner;
 
-  g_return_if_fail (job_p && user_data);
+    g_return_if_fail (job_p && user_data);
 
-  job = *job_p;
-  if (!job)
-    return;
+    job = *job_p;
+    if (!job)
+        return;
 
-  gncOwnerInitJob (&owner, job);
-  gnc_invoice_search (NULL, &owner, sw->book);
+    gncOwnerInitJob (&owner, job);
+    gnc_invoice_search (NULL, &owner, sw->book);
 }
 
 static void
 payment_job_cb (gpointer *job_p, gpointer user_data)
 {
-  struct _job_select_window *sw = user_data;
-  GncOwner owner;
-  GncJob *job;
+    struct _job_select_window *sw = user_data;
+    GncOwner owner;
+    GncJob *job;
 
-  g_return_if_fail (job_p && user_data);
+    g_return_if_fail (job_p && user_data);
 
-  job = *job_p;
+    job = *job_p;
 
-  if (!job)
+    if (!job)
+        return;
+
+    gncOwnerInitJob (&owner, job);
+    gnc_ui_payment_new (&owner, sw->book);
     return;
-
-  gncOwnerInitJob (&owner, job);
-  gnc_ui_payment_new (&owner, sw->book);
-  return;
 }
 
 static gpointer
 new_job_cb (gpointer user_data)
 {
-  struct _job_select_window *sw = user_data;
-  JobWindow *jw;
-  
-  g_return_val_if_fail (user_data, NULL);
+    struct _job_select_window *sw = user_data;
+    JobWindow *jw;
 
-  jw = gnc_ui_job_new (sw->owner, sw->book);
-  return jw_get_job (jw);
+    g_return_val_if_fail (user_data, NULL);
+
+    jw = gnc_ui_job_new (sw->owner, sw->book);
+    return jw_get_job (jw);
 }
 
 static void
 free_userdata_cb (gpointer user_data)
 {
-  struct _job_select_window *sw = user_data;
+    struct _job_select_window *sw = user_data;
 
-  g_return_if_fail (sw);
+    g_return_if_fail (sw);
 
-  gncQueryDestroy (sw->q);
-  g_free (sw);
+    gncQueryDestroy (sw->q);
+    g_free (sw);
 }
 
 GNCSearchWindow *
 gnc_job_search (GncJob *start, GncOwner *owner, QofBook *book)
 {
-  QueryNew *q, *q2 = NULL;
-  GNCIdType type = GNC_JOB_MODULE_NAME;
-  struct _job_select_window *sw;
-  static GList *params = NULL;
-  static GList *columns = NULL;
-  static GNCSearchCallbackButton buttons[] = { 
-    { N_("View/Edit Job"), edit_job_cb},
-    { N_("View Invoices"), invoice_job_cb},
-    { N_("Process Payment"), payment_job_cb},
-    { NULL },
-  };
+    QueryNew *q, *q2 = NULL;
+    GNCIdType type = GNC_JOB_MODULE_NAME;
+    struct _job_select_window *sw;
+    static GList *params = NULL;
+    static GList *columns = NULL;
+    static GNCSearchCallbackButton buttons[] =
+    {
+        { N_("View/Edit Job"), edit_job_cb},
+        { N_("View Invoices"), invoice_job_cb},
+        { N_("Process Payment"), payment_job_cb},
+        { NULL },
+    };
 
-  g_return_val_if_fail (book, NULL);
+    g_return_val_if_fail (book, NULL);
 
-  /* Build parameter list in reverse order*/
-  if (params == NULL) {
-    params = gnc_search_param_prepend (params, _("Owner's Name"), NULL, type,
-				       JOB_OWNER, OWNER_NAME, NULL);
-    params = gnc_search_param_prepend (params, _("Only Active?"), NULL, type,
-				       JOB_ACTIVE, NULL);
-    params = gnc_search_param_prepend (params, _("Billing ID"), NULL, type,
-				       JOB_REFERENCE, NULL);
-    params = gnc_search_param_prepend (params, _("Job Number"), NULL, type,
-				       JOB_ID, NULL);
-    params = gnc_search_param_prepend (params, _("Job Name"), NULL, type,
-				       JOB_NAME, NULL);
-  }
+    /* Build parameter list in reverse order*/
+    if (params == NULL)
+    {
+        params = gnc_search_param_prepend (params, _("Owner's Name"), NULL, type,
+                                           JOB_OWNER, OWNER_NAME, NULL);
+        params = gnc_search_param_prepend (params, _("Only Active?"), NULL, type,
+                                           JOB_ACTIVE, NULL);
+        params = gnc_search_param_prepend (params, _("Billing ID"), NULL, type,
+                                           JOB_REFERENCE, NULL);
+        params = gnc_search_param_prepend (params, _("Job Number"), NULL, type,
+                                           JOB_ID, NULL);
+        params = gnc_search_param_prepend (params, _("Job Name"), NULL, type,
+                                           JOB_NAME, NULL);
+    }
 
-  /* Build the column list in reverse order */
-  if (columns == NULL) {
-    columns = gnc_search_param_prepend (columns, _("Billing ID"), NULL, type,
-					JOB_REFERENCE, NULL);
-    columns = gnc_search_param_prepend (columns, _("Company"), NULL, type,
-					JOB_OWNER, OWNER_NAME, NULL);
-    columns = gnc_search_param_prepend (columns, _("Job Name"), NULL, type,
-					JOB_NAME, NULL);
-    columns = gnc_search_param_prepend (columns, _("ID #"), NULL, type,
-					JOB_ID, NULL);
-  }
+    /* Build the column list in reverse order */
+    if (columns == NULL)
+    {
+        columns = gnc_search_param_prepend (columns, _("Billing ID"), NULL, type,
+                                            JOB_REFERENCE, NULL);
+        columns = gnc_search_param_prepend (columns, _("Company"), NULL, type,
+                                            JOB_OWNER, OWNER_NAME, NULL);
+        columns = gnc_search_param_prepend (columns, _("Job Name"), NULL, type,
+                                            JOB_NAME, NULL);
+        columns = gnc_search_param_prepend (columns, _("ID #"), NULL, type,
+                                            JOB_ID, NULL);
+    }
 
-  /* Build the queries */
-  q = gncQueryCreateFor (type);
-  gncQuerySetBook (q, book);
+    /* Build the queries */
+    q = gncQueryCreateFor (type);
+    gncQuerySetBook (q, book);
 
-  /* If we have a start job but, for some reason, not an owner -- grab
-   * the owner from the starting job.
-   */
-  if ((!owner || !gncOwnerGetGUID (owner)) && start)
-    owner = gncJobGetOwner (start);
+    /* If we have a start job but, for some reason, not an owner -- grab
+     * the owner from the starting job.
+     */
+    if ((!owner || !gncOwnerGetGUID (owner)) && start)
+        owner = gncJobGetOwner (start);
 
-  /* If owner is supplied, limit all searches to invoices who's owner
-   * is the supplied owner!  Show all invoices by this owner.
-   */
-  if (owner && gncOwnerGetGUID (owner)) {
-    gncQueryAddGUIDMatch (q, g_slist_prepend
-			  (g_slist_prepend (NULL, QUERY_PARAM_GUID),
-			   JOB_OWNER),
-			  gncOwnerGetGUID (owner), QUERY_AND);
+    /* If owner is supplied, limit all searches to invoices who's owner
+     * is the supplied owner!  Show all invoices by this owner.
+     */
+    if (owner && gncOwnerGetGUID (owner))
+    {
+        gncQueryAddGUIDMatch (q, g_slist_prepend
+                              (g_slist_prepend (NULL, QUERY_PARAM_GUID),
+                               JOB_OWNER),
+                              gncOwnerGetGUID (owner), QUERY_AND);
 
-    q2 = gncQueryCopy (q);
-  }
+        q2 = gncQueryCopy (q);
+    }
 
 #if 0
-  if (start) {
-    if (q2 == NULL)
-      q2 = gncQueryCopy (q);
+    if (start)
+    {
+        if (q2 == NULL)
+            q2 = gncQueryCopy (q);
 
-    gncQueryAddGUIDMatch (q2, g_slist_prepend (NULL, QUERY_PARAM_GUID),
-			  gncJobGetGUID (start), QUERY_AND);
-  }
+        gncQueryAddGUIDMatch (q2, g_slist_prepend (NULL, QUERY_PARAM_GUID),
+                              gncJobGetGUID (start), QUERY_AND);
+    }
 #endif
 
-  /* launch select dialog and return the result */
-  sw = g_new0 (struct _job_select_window, 1);
+    /* launch select dialog and return the result */
+    sw = g_new0 (struct _job_select_window, 1);
 
-  if (owner) {
-    gncOwnerCopy (owner, &(sw->owner_def));
-    sw->owner = &(sw->owner_def);
-  }
-  sw->book = book;
-  sw->q = q;
+    if (owner)
+    {
+        gncOwnerCopy (owner, &(sw->owner_def));
+        sw->owner = &(sw->owner_def);
+    }
+    sw->book = book;
+    sw->q = q;
 
-  return gnc_search_dialog_create (type, _("Find Job"),
-				   params, columns, q, q2, buttons, NULL,
-				   new_job_cb, sw, free_userdata_cb,
-				   GCONF_SECTION_SEARCH, NULL);
+    return gnc_search_dialog_create (type, _("Find Job"),
+                                     params, columns, q, q2, buttons, NULL,
+                                     new_job_cb, sw, free_userdata_cb,
+                                     GCONF_SECTION_SEARCH, NULL);
 }
 
 /* Functions for widgets for job selection */
@@ -598,25 +624,27 @@
 GNCSearchWindow *
 gnc_job_search_select (gpointer start, gpointer book)
 {
-  GncJob *j = start;
-  GncOwner owner, *ownerp;
+    GncJob *j = start;
+    GncOwner owner, *ownerp;
 
-  if (!book) return NULL;
+    if (!book) return NULL;
 
-  if (j) {
-    ownerp = gncJobGetOwner (j);
-    gncOwnerCopy (ownerp, &owner);
-  } else
-    gncOwnerInitCustomer (&owner, NULL); /* XXX */
+    if (j)
+    {
+        ownerp = gncJobGetOwner (j);
+        gncOwnerCopy (ownerp, &owner);
+    }
+    else
+        gncOwnerInitCustomer (&owner, NULL); /* XXX */
 
-  return gnc_job_search (start, &owner, book);
+    return gnc_job_search (start, &owner, book);
 }
 
 GNCSearchWindow *
 gnc_job_search_edit (gpointer start, gpointer book)
 {
-  if (start)
-    gnc_ui_job_edit (start);
+    if (start)
+        gnc_ui_job_edit (start);
 
-  return NULL;
+    return NULL;
 }

Modified: gnucash/trunk/src/business/business-gnome/dialog-job.h
===================================================================
--- gnucash/trunk/src/business/business-gnome/dialog-job.h	2010-03-02 21:40:28 UTC (rev 18788)
+++ gnucash/trunk/src/business/business-gnome/dialog-job.h	2010-03-02 21:41:05 UTC (rev 18789)
@@ -38,7 +38,7 @@
 
 /* Search for Jobs */
 GNCSearchWindow * gnc_job_search (GncJob *start, GncOwner *owner,
-				  QofBook *book);
+                                  QofBook *book);
 
 /*
  * These callbacks are for use with the gnc_general_search widget

Modified: gnucash/trunk/src/business/business-gnome/dialog-order.c
===================================================================
--- gnucash/trunk/src/business/business-gnome/dialog-order.c	2010-03-02 21:40:28 UTC (rev 18788)
+++ gnucash/trunk/src/business/business-gnome/dialog-order.c	2010-03-02 21:41:05 UTC (rev 18789)
@@ -61,43 +61,45 @@
 
 typedef enum
 {
-  NEW_ORDER,
-  EDIT_ORDER,
-  VIEW_ORDER
+    NEW_ORDER,
+    EDIT_ORDER,
+    VIEW_ORDER
 } OrderDialogType;
 
-struct _order_select_window {
-  QofBook *	book;
-  GncOwner *	owner;
-  QueryNew *	q;
-  GncOwner	owner_def;
+struct _order_select_window
+{
+    QofBook *	book;
+    GncOwner *	owner;
+    QueryNew *	q;
+    GncOwner	owner_def;
 };
 
-struct _order_window {
-  GladeXML *	xml;
+struct _order_window
+{
+    GladeXML *	xml;
 
-  GtkWidget *	dialog;
+    GtkWidget *	dialog;
 
-  GtkWidget *	id_entry;
-  GtkWidget *	ref_entry;
-  GtkWidget *	notes_text;
-  GtkWidget *	opened_date;
-  GtkWidget *	closed_date;
-  GtkWidget *	active_check;
+    GtkWidget *	id_entry;
+    GtkWidget *	ref_entry;
+    GtkWidget *	notes_text;
+    GtkWidget *	opened_date;
+    GtkWidget *	closed_date;
+    GtkWidget *	active_check;
 
-  GtkWidget *	owner_box;
-  GtkWidget *	owner_label;
-  GtkWidget *	owner_choice;
+    GtkWidget *	owner_box;
+    GtkWidget *	owner_label;
+    GtkWidget *	owner_choice;
 
-  GnucashRegister *	reg;
-  GncEntryLedger *	ledger;
+    GnucashRegister *	reg;
+    GncEntryLedger *	ledger;
 
-  OrderDialogType	dialog_type;
-  GUID		order_guid;
-  gint		component_id;
-  QofBook *	book;
-  GncOrder *	created_order;
-  GncOwner	owner;
+    OrderDialogType	dialog_type;
+    GUID		order_guid;
+    gint		component_id;
+    QofBook *	book;
+    GncOrder *	created_order;
+    GncOwner	owner;
 
 };
 
@@ -106,646 +108,675 @@
 static GncOrder *
 ow_get_order (OrderWindow *ow)
 {
-  if (!ow)
-    return NULL;
+    if (!ow)
+        return NULL;
 
-  return gncOrderLookup (ow->book, &ow->order_guid);
+    return gncOrderLookup (ow->book, &ow->order_guid);
 }
 
 static void gnc_ui_to_order (OrderWindow *ow, GncOrder *order)
 {
-  GtkTextBuffer* text_buffer;
-  GtkTextIter start, end;
-  gchar *text;
-  Timespec ts;
-  time_t tt;
+    GtkTextBuffer* text_buffer;
+    GtkTextIter start, end;
+    gchar *text;
+    Timespec ts;
+    time_t tt;
 
-  /* Do nothing if this is view only */
-  if (ow->dialog_type == VIEW_ORDER)
-    return;
+    /* Do nothing if this is view only */
+    if (ow->dialog_type == VIEW_ORDER)
+        return;
 
-  gnc_suspend_gui_refresh ();
-  gncOrderBeginEdit (order);
-  
-  gncOrderSetID (order, gtk_editable_get_chars
-		 (GTK_EDITABLE (ow->id_entry), 0, -1));
+    gnc_suspend_gui_refresh ();
+    gncOrderBeginEdit (order);
 
-  text_buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW(ow->notes_text));
-  gtk_text_buffer_get_bounds (text_buffer, &start, &end);
-  text = gtk_text_buffer_get_text (text_buffer, &start, &end, FALSE);
-  gncOrderSetNotes (order, text);
+    gncOrderSetID (order, gtk_editable_get_chars
+                   (GTK_EDITABLE (ow->id_entry), 0, -1));
 
-  gncOrderSetReference (order, gtk_editable_get_chars
-			(GTK_EDITABLE (ow->ref_entry), 0, -1));
+    text_buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW(ow->notes_text));
+    gtk_text_buffer_get_bounds (text_buffer, &start, &end);
+    text = gtk_text_buffer_get_text (text_buffer, &start, &end, FALSE);
+    gncOrderSetNotes (order, text);
 
-  tt = gnome_date_edit_get_time (GNOME_DATE_EDIT (ow->opened_date));
-  timespecFromTime_t (&ts, tt);
-  gncOrderSetDateOpened (order, ts);
+    gncOrderSetReference (order, gtk_editable_get_chars
+                          (GTK_EDITABLE (ow->ref_entry), 0, -1));
 
-  if (ow->active_check)
-    gncOrderSetActive (order, gtk_toggle_button_get_active
-		       (GTK_TOGGLE_BUTTON (ow->active_check)));
+    tt = gnome_date_edit_get_time (GNOME_DATE_EDIT (ow->opened_date));
+    timespecFromTime_t (&ts, tt);
+    gncOrderSetDateOpened (order, ts);
 
-  gnc_owner_get_owner (ow->owner_choice, &(ow->owner));
-  gncOrderSetOwner (order, &(ow->owner));
+    if (ow->active_check)
+        gncOrderSetActive (order, gtk_toggle_button_get_active
+                           (GTK_TOGGLE_BUTTON (ow->active_check)));
 
-  gncOrderCommitEdit (order);
-  gnc_resume_gui_refresh ();
+    gnc_owner_get_owner (ow->owner_choice, &(ow->owner));
+    gncOrderSetOwner (order, &(ow->owner));
+
+    gncOrderCommitEdit (order);
+    gnc_resume_gui_refresh ();
 }
 
 static gboolean
 gnc_order_window_verify_ok (OrderWindow *ow)
 {
-  const char *res;
+    const char *res;
 
-  /* Check the ID */
-  res = gtk_entry_get_text (GTK_ENTRY (ow->id_entry));
-  if (safe_strcmp (res, "") == 0) {
-    gnc_error_dialog (ow->dialog, "%s",
-		      _("The Order must be given an ID."));
-    return FALSE;
-  }
+    /* Check the ID */
+    res = gtk_entry_get_text (GTK_ENTRY (ow->id_entry));
+    if (safe_strcmp (res, "") == 0)
+    {
+        gnc_error_dialog (ow->dialog, "%s",
+                          _("The Order must be given an ID."));
+        return FALSE;
+    }
 
-  /* Check the Owner */
-  gnc_owner_get_owner (ow->owner_choice, &(ow->owner));
-  res = gncOwnerGetName (&(ow->owner));
-  if (res == NULL || safe_strcmp (res, "") == 0) {
-    gnc_error_dialog (ow->dialog, "%s",
-		      _("You need to supply Billing Information."));
-    return FALSE;
-  }
+    /* Check the Owner */
+    gnc_owner_get_owner (ow->owner_choice, &(ow->owner));
+    res = gncOwnerGetName (&(ow->owner));
+    if (res == NULL || safe_strcmp (res, "") == 0)
+    {
+        gnc_error_dialog (ow->dialog, "%s",
+                          _("You need to supply Billing Information."));
+        return FALSE;
+    }
 
-  return TRUE;
+    return TRUE;
 }
 
 static gboolean
 gnc_order_window_ok_save (OrderWindow *ow)
 {
-  if (!gnc_entry_ledger_check_close (ow->dialog, ow->ledger))
-    return FALSE;
+    if (!gnc_entry_ledger_check_close (ow->dialog, ow->ledger))
+        return FALSE;
 
-  if (!gnc_order_window_verify_ok (ow))
-    return FALSE;
-  
-  /* Now save it off */
-  {
-    GncOrder *order = ow_get_order (ow);
-    if (order) {
-      gnc_ui_to_order (ow, order);
+    if (!gnc_order_window_verify_ok (ow))
+        return FALSE;
 
+    /* Now save it off */
+    {
+        GncOrder *order = ow_get_order (ow);
+        if (order)
+        {
+            gnc_ui_to_order (ow, order);
+
+        }
+        ow->created_order = order;
     }
-    ow->created_order = order;
-  }
-  return TRUE;
+    return TRUE;
 }
 
 void
 gnc_order_window_ok_cb (GtkWidget *widget, gpointer data)
 {
-  OrderWindow *ow = data;
+    OrderWindow *ow = data;
 
-  if (!gnc_order_window_ok_save (ow))
-    return;
+    if (!gnc_order_window_ok_save (ow))
+        return;
 
-  /* Ok, we don't need this anymore */
-  ow->order_guid = *xaccGUIDNULL ();
+    /* Ok, we don't need this anymore */
+    ow->order_guid = *xaccGUIDNULL ();
 
-  gnc_close_gui_component (ow->component_id);
+    gnc_close_gui_component (ow->component_id);
 }
 
 void
 gnc_order_window_cancel_cb (GtkWidget *widget, gpointer data)
 {
-  OrderWindow *ow = data;
+    OrderWindow *ow = data;
 
-  gnc_close_gui_component (ow->component_id);
+    gnc_close_gui_component (ow->component_id);
 }
 
 void
 gnc_order_window_help_cb (GtkWidget *widget, gpointer data)
 {
-  gnc_gnome_help(HF_HELP, HL_USAGE);
+    gnc_gnome_help(HF_HELP, HL_USAGE);
 }
 
 void
 gnc_order_window_invoice_cb (GtkWidget *widget, gpointer data)
 {
-  OrderWindow *ow = data;
+    OrderWindow *ow = data;
 
-  /* make sure we're ok */
-  if (!gnc_order_window_verify_ok (ow))
-      return;
+    /* make sure we're ok */
+    if (!gnc_order_window_verify_ok (ow))
+        return;
 
-  /* Ok, go make an invoice */
-  gnc_invoice_search (NULL, &(ow->owner), ow->book); 
+    /* Ok, go make an invoice */
+    gnc_invoice_search (NULL, &(ow->owner), ow->book);
 
-  /* refresh the window */
-  gnc_order_update_window (ow);
+    /* refresh the window */
+    gnc_order_update_window (ow);
 }
 
 void
 gnc_order_window_close_order_cb (GtkWidget *widget, gpointer data)
 {
-  OrderWindow *ow = data;
-  GncOrder *order;
-  GList *entries;
-  char *message, *label;
-  gboolean non_inv = FALSE;
-  Timespec ts;
+    OrderWindow *ow = data;
+    GncOrder *order;
+    GList *entries;
+    char *message, *label;
+    gboolean non_inv = FALSE;
+    Timespec ts;
 
-  /* Make sure the order is ok */
-  if (!gnc_order_window_verify_ok (ow))
-    return;
+    /* Make sure the order is ok */
+    if (!gnc_order_window_verify_ok (ow))
+        return;
 
-  /* Make sure the order exists */
-  order = ow_get_order (ow);
-  if (!order)
-    return;
+    /* Make sure the order exists */
+    order = ow_get_order (ow);
+    if (!order)
+        return;
 
-  /* Check that there is at least one Entry */
-  if (gncOrderGetEntries (order) == NULL) {
-    gnc_error_dialog (ow->dialog, "%s",
-		      _("The Order must have at least one Entry."));
-    return;
-  }
+    /* Check that there is at least one Entry */
+    if (gncOrderGetEntries (order) == NULL)
+    {
+        gnc_error_dialog (ow->dialog, "%s",
+                          _("The Order must have at least one Entry."));
+        return;
+    }
 
-  /* Make sure we can close the order. Are there any uninvoiced entries? */
-  entries = gncOrderGetEntries (order);
-  for ( ; entries ; entries = entries->next) {
-    GncEntry *entry = entries->data;
-    if (gncEntryGetInvoice (entry) == NULL) {
-      non_inv = TRUE;
-      break;
+    /* Make sure we can close the order. Are there any uninvoiced entries? */
+    entries = gncOrderGetEntries (order);
+    for ( ; entries ; entries = entries->next)
+    {
+        GncEntry *entry = entries->data;
+        if (gncEntryGetInvoice (entry) == NULL)
+        {
+            non_inv = TRUE;
+            break;
+        }
     }
-  }
 
-  if (non_inv) {
-    /* Damn; yes.  Well, ask the user to make sure they REALLY want to
-     * close this order!
-     */
+    if (non_inv)
+    {
+        /* Damn; yes.  Well, ask the user to make sure they REALLY want to
+         * close this order!
+         */
 
-    message = _("This order contains entries that have not been invoiced. "
-		"Are you sure you want to close it out before "
-		"you invoice all the entries?");
+        message = _("This order contains entries that have not been invoiced. "
+                    "Are you sure you want to close it out before "
+                    "you invoice all the entries?");
 
-    if (gnc_verify_dialog (ow->dialog, FALSE, "%s", message) == FALSE)
-      return;
-  }
+        if (gnc_verify_dialog (ow->dialog, FALSE, "%s", message) == FALSE)
+            return;
+    }
 
-  /* Ok, we can close this.  Ask for verification and set the closed date */
-  message = _("Do you really want to close the order?");
-  label = _("Close Date");
+    /* Ok, we can close this.  Ask for verification and set the closed date */
+    message = _("Do you really want to close the order?");
+    label = _("Close Date");
 
-  timespecFromTime_t (&ts, time(NULL));
-  if (!gnc_dialog_date_close_parented (ow->dialog, message, label, TRUE, &ts))
-    return;
+    timespecFromTime_t (&ts, time(NULL));
+    if (!gnc_dialog_date_close_parented (ow->dialog, message, label, TRUE, &ts))
+        return;
 
-  gncOrderSetDateClosed (order, ts);
+    gncOrderSetDateClosed (order, ts);
 
-  /* save it off */
-  gnc_order_window_ok_save (ow);
+    /* save it off */
+    gnc_order_window_ok_save (ow);
 
-  /* Reset the type; change to read-only */
-  ow->dialog_type = VIEW_ORDER;
-  gnc_entry_ledger_set_readonly (ow->ledger, TRUE);
+    /* Reset the type; change to read-only */
+    ow->dialog_type = VIEW_ORDER;
+    gnc_entry_ledger_set_readonly (ow->ledger, TRUE);
 
-  /* And redisplay the window */
-  gnc_order_update_window (ow);
+    /* And redisplay the window */
+    gnc_order_update_window (ow);
 }
 
 void
 gnc_order_window_destroy_cb (GtkWidget *widget, gpointer data)
 {
-  OrderWindow *ow = data;
-  GncOrder *order = ow_get_order (ow);
+    OrderWindow *ow = data;
+    GncOrder *order = ow_get_order (ow);
 
-  gnc_suspend_gui_refresh ();
+    gnc_suspend_gui_refresh ();
 
-  if (ow->dialog_type == NEW_ORDER && order != NULL) {
-    gncOrderBeginEdit (order);
-    gncOrderDestroy (order);
-    ow->order_guid = *xaccGUIDNULL ();
-  }
+    if (ow->dialog_type == NEW_ORDER && order != NULL)
+    {
+        gncOrderBeginEdit (order);
+        gncOrderDestroy (order);
+        ow->order_guid = *xaccGUIDNULL ();
+    }
 
-  if (ow->ledger)
-    gnc_entry_ledger_destroy (ow->ledger);
-  gnc_unregister_gui_component (ow->component_id);
-  gnc_resume_gui_refresh ();
+    if (ow->ledger)
+        gnc_entry_ledger_destroy (ow->ledger);
+    gnc_unregister_gui_component (ow->component_id);
+    gnc_resume_gui_refresh ();
 
-  g_free (ow);
+    g_free (ow);
 }
 
 static int
 gnc_order_owner_changed_cb (GtkWidget *widget, gpointer data)
 {
-  OrderWindow *ow = data;
-  GncOrder *order;
+    OrderWindow *ow = data;
+    GncOrder *order;
 
-  if (!ow)
-    return FALSE;
+    if (!ow)
+        return FALSE;
 
-  if (ow->dialog_type == VIEW_ORDER)
-    return FALSE;
+    if (ow->dialog_type == VIEW_ORDER)
+        return FALSE;
 
-  gnc_owner_get_owner (ow->owner_choice, &(ow->owner));
+    gnc_owner_get_owner (ow->owner_choice, &(ow->owner));
 
-  /* Set the Order's owner now! */
-  order = ow_get_order (ow);
-  gncOrderSetOwner (order, &(ow->owner));
+    /* Set the Order's owner now! */
+    order = ow_get_order (ow);
+    gncOrderSetOwner (order, &(ow->owner));
 
-  if (ow->dialog_type == EDIT_ORDER)
-    return FALSE;
+    if (ow->dialog_type == EDIT_ORDER)
+        return FALSE;
 
-  /* Only set the reference during the New Job dialog */
-  switch (gncOwnerGetType (&(ow->owner))) {
-  case GNC_OWNER_JOB:
-  {
-    char const *msg = gncJobGetReference (gncOwnerGetJob (&(ow->owner)));
-    gtk_entry_set_text (GTK_ENTRY (ow->ref_entry), msg ? msg : "");
-    break;
-  }
-  default:
-    gtk_entry_set_text (GTK_ENTRY (ow->ref_entry), "");
-    break;    
-  }
+    /* Only set the reference during the New Job dialog */
+    switch (gncOwnerGetType (&(ow->owner)))
+    {
+    case GNC_OWNER_JOB:
+    {
+        char const *msg = gncJobGetReference (gncOwnerGetJob (&(ow->owner)));
+        gtk_entry_set_text (GTK_ENTRY (ow->ref_entry), msg ? msg : "");
+        break;
+    }
+    default:
+        gtk_entry_set_text (GTK_ENTRY (ow->ref_entry), "");
+        break;
+    }
 
-  return FALSE;
+    return FALSE;
 }
 
 static void
 gnc_order_window_close_handler (gpointer user_data)
 {
-  OrderWindow *ow = user_data;
+    OrderWindow *ow = user_data;
 
-  gtk_widget_destroy (ow->dialog);
+    gtk_widget_destroy (ow->dialog);
 }
 
 static void
 gnc_order_window_refresh_handler (GHashTable *changes, gpointer user_data)
 {
-  OrderWindow *ow = user_data;
-  const EventInfo *info;
-  GncOrder *order = ow_get_order (ow);
+    OrderWindow *ow = user_data;
+    const EventInfo *info;
+    GncOrder *order = ow_get_order (ow);
 
-  /* If there isn't a order behind us, close down */
-  if (!order) {
-    gnc_close_gui_component (ow->component_id);
-    return;
-  }
+    /* If there isn't a order behind us, close down */
+    if (!order)
+    {
+        gnc_close_gui_component (ow->component_id);
+        return;
+    }
 
-  /* Next, close if this is a destroy event */
-  if (changes) {
-    info = gnc_gui_get_entity_events (changes, &ow->order_guid);
-    if (info && (info->event_mask & QOF_EVENT_DESTROY)) {
-      gnc_close_gui_component (ow->component_id);
-      return;
+    /* Next, close if this is a destroy event */
+    if (changes)
+    {
+        info = gnc_gui_get_entity_events (changes, &ow->order_guid);
+        if (info && (info->event_mask & QOF_EVENT_DESTROY))
+        {
+            gnc_close_gui_component (ow->component_id);
+            return;
+        }
     }
-  }
 }
 
 static void
 gnc_order_update_window (OrderWindow *ow)
 {
-  GncOrder *order;
-  GncOwner *owner;
-  gboolean hide_cd = FALSE;
+    GncOrder *order;
+    GncOwner *owner;
+    gboolean hide_cd = FALSE;
 
-  order = ow_get_order (ow);
-  owner = gncOrderGetOwner (order);
+    order = ow_get_order (ow);
+    owner = gncOrderGetOwner (order);
 
-  if (ow->owner_choice) {
-    gtk_container_remove (GTK_CONTAINER (ow->owner_box), ow->owner_choice);
-    gtk_object_destroy (GTK_OBJECT (ow->owner_choice));
-  }
+    if (ow->owner_choice)
+    {
+        gtk_container_remove (GTK_CONTAINER (ow->owner_box), ow->owner_choice);
+        gtk_object_destroy (GTK_OBJECT (ow->owner_choice));
+    }
 
-  switch (ow->dialog_type) {
+    switch (ow->dialog_type)
+    {
     case VIEW_ORDER:
     case EDIT_ORDER:
-      ow->owner_choice =
-	gnc_owner_edit_create (ow->owner_label, ow->owner_box, ow->book,
-			       owner);
-      break;
+        ow->owner_choice =
+            gnc_owner_edit_create (ow->owner_label, ow->owner_box, ow->book,
+                                   owner);
+        break;
     case NEW_ORDER:
-      ow->owner_choice =
-	gnc_owner_select_create (ow->owner_label, ow->owner_box, ow->book,
-				 owner);
-      break;
+        ow->owner_choice =
+            gnc_owner_select_create (ow->owner_label, ow->owner_box, ow->book,
+                                     owner);
+        break;
     }
 
-  g_signal_connect (ow->owner_choice, "changed",
-		    G_CALLBACK (gnc_order_owner_changed_cb),
-		    ow);
+    g_signal_connect (ow->owner_choice, "changed",
+                      G_CALLBACK (gnc_order_owner_changed_cb),
+                      ow);
 
-  gtk_widget_show_all (ow->dialog);
+    gtk_widget_show_all (ow->dialog);
 
-  {
-    GtkTextBuffer* text_buffer;
-    const char *string;
-    Timespec ts, ts_zero = {0,0};
-    time_t tt;
+    {
+        GtkTextBuffer* text_buffer;
+        const char *string;
+        Timespec ts, ts_zero = {0, 0};
+        time_t tt;
 
-    gtk_entry_set_text (GTK_ENTRY (ow->ref_entry),
-			gncOrderGetReference (order));
+        gtk_entry_set_text (GTK_ENTRY (ow->ref_entry),
+                            gncOrderGetReference (order));
 
-    string = gncOrderGetNotes (order);
-    text_buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW(ow->notes_text));
-    gtk_text_buffer_set_text (text_buffer, string, -1);
+        string = gncOrderGetNotes (order);
+        text_buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW(ow->notes_text));
+        gtk_text_buffer_set_text (text_buffer, string, -1);
 
-    ts = gncOrderGetDateOpened (order);
-    if (timespec_equal (&ts, &ts_zero)) {
-      tt = time(NULL);
-    } else {
-      tt = ts.tv_sec;		/* XXX */
-    }
-    gnome_date_edit_set_time (GNOME_DATE_EDIT (ow->opened_date), tt);
+        ts = gncOrderGetDateOpened (order);
+        if (timespec_equal (&ts, &ts_zero))
+        {
+            tt = time(NULL);
+        }
+        else
+        {
+            tt = ts.tv_sec;		/* XXX */
+        }
+        gnome_date_edit_set_time (GNOME_DATE_EDIT (ow->opened_date), tt);
 
 
-    /* If this is a "New Order Window" we can stop here! */
-    if (ow->dialog_type == NEW_ORDER)
-      return;
+        /* If this is a "New Order Window" we can stop here! */
+        if (ow->dialog_type == NEW_ORDER)
+            return;
 
-    ts = gncOrderGetDateClosed (order);
-    if (timespec_equal (&ts, &ts_zero)) {
-      tt = time(NULL);
-      hide_cd = TRUE;
-    } else {
-      tt = ts.tv_sec;		/* XXX */
-    }
-    gnome_date_edit_set_time (GNOME_DATE_EDIT (ow->closed_date), tt);
+        ts = gncOrderGetDateClosed (order);
+        if (timespec_equal (&ts, &ts_zero))
+        {
+            tt = time(NULL);
+            hide_cd = TRUE;
+        }
+        else
+        {
+            tt = ts.tv_sec;		/* XXX */
+        }
+        gnome_date_edit_set_time (GNOME_DATE_EDIT (ow->closed_date), tt);
 
-    gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (ow->active_check),
-				  gncOrderGetActive (order));
+        gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (ow->active_check),
+                                      gncOrderGetActive (order));
 
-  }
+    }
 
-  gnc_gui_component_watch_entity_type (ow->component_id,
-				       GNC_ORDER_MODULE_NAME,
-				       QOF_EVENT_MODIFY | QOF_EVENT_DESTROY);
+    gnc_gui_component_watch_entity_type (ow->component_id,
+                                         GNC_ORDER_MODULE_NAME,
+                                         QOF_EVENT_MODIFY | QOF_EVENT_DESTROY);
 
-  gnc_table_refresh_gui (gnc_entry_ledger_get_table (ow->ledger), TRUE);
+    gnc_table_refresh_gui (gnc_entry_ledger_get_table (ow->ledger), TRUE);
 
-  if (hide_cd) {
-    GtkWidget *hide;
+    if (hide_cd)
+    {
+        GtkWidget *hide;
 
-    gtk_widget_hide_all (ow->closed_date);
-    hide = glade_xml_get_widget (ow->xml, "cd_label");
-    gtk_widget_hide_all (hide);
+        gtk_widget_hide_all (ow->closed_date);
+        hide = glade_xml_get_widget (ow->xml, "cd_label");
+        gtk_widget_hide_all (hide);
 
-    hide = glade_xml_get_widget (ow->xml, "hide1");
-    gtk_widget_hide_all (hide);
-    hide = glade_xml_get_widget (ow->xml, "hide2");
-    gtk_widget_hide_all (hide);
-  }
+        hide = glade_xml_get_widget (ow->xml, "hide1");
+        gtk_widget_hide_all (hide);
+        hide = glade_xml_get_widget (ow->xml, "hide2");
+        gtk_widget_hide_all (hide);
+    }
 
-  if (ow->dialog_type == VIEW_ORDER) {
-    GtkWidget *hide;
+    if (ow->dialog_type == VIEW_ORDER)
+    {
+        GtkWidget *hide;
 
-    /* Setup viewer for read-only access */
-    gtk_widget_set_sensitive (ow->id_entry, FALSE);
-    gtk_widget_set_sensitive (ow->opened_date, FALSE);
-    gtk_widget_set_sensitive (ow->closed_date, FALSE);
-    gtk_widget_set_sensitive (ow->notes_text, FALSE); /* XXX: Should notes remain writable? */
+        /* Setup viewer for read-only access */
+        gtk_widget_set_sensitive (ow->id_entry, FALSE);
+        gtk_widget_set_sensitive (ow->opened_date, FALSE);
+        gtk_widget_set_sensitive (ow->closed_date, FALSE);
+        gtk_widget_set_sensitive (ow->notes_text, FALSE); /* XXX: Should notes remain writable? */
 
-    /* Hide the 'close order' button */
-    hide = glade_xml_get_widget (ow->xml, "close_order_button");
-    gtk_widget_hide_all (hide);
-  }
+        /* Hide the 'close order' button */
+        hide = glade_xml_get_widget (ow->xml, "close_order_button");
+        gtk_widget_hide_all (hide);
+    }
 }
 
 static gboolean
 find_handler (gpointer find_data, gpointer user_data)
 {
-  const GUID *order_guid = find_data;
-  OrderWindow *ow = user_data;
+    const GUID *order_guid = find_data;
+    OrderWindow *ow = user_data;
 
-  return(ow && guid_equal(&ow->order_guid, order_guid));
+    return(ow && guid_equal(&ow->order_guid, order_guid));
 }
 
 static OrderWindow *
 gnc_order_new_window (QofBook *bookp, OrderDialogType type,
-		      GncOrder *order, GncOwner *owner)
+                      GncOrder *order, GncOwner *owner)
 {
-  OrderWindow *ow;
-  GladeXML *xml;
-  GtkWidget *vbox, *regWidget;
-  GncEntryLedger *entry_ledger = NULL;
-  const char * class_name;
+    OrderWindow *ow;
+    GladeXML *xml;
+    GtkWidget *vbox, *regWidget;
+    GncEntryLedger *entry_ledger = NULL;
+    const char * class_name;
 
-  switch (type) {
-   case EDIT_ORDER:
-    class_name = DIALOG_EDIT_ORDER_CM_CLASS;
-    break;
-   case VIEW_ORDER:
-   default:
-    class_name = DIALOG_VIEW_ORDER_CM_CLASS;
-    break;
-  }
+    switch (type)
+    {
+    case EDIT_ORDER:
+        class_name = DIALOG_EDIT_ORDER_CM_CLASS;
+        break;
+    case VIEW_ORDER:
+    default:
+        class_name = DIALOG_VIEW_ORDER_CM_CLASS;
+        break;
+    }
 
-  /*
-   * Find an existing window for this order.  If found, bring it to
-   * the front.
-   */
-  if (order) {
-    GUID order_guid;
+    /*
+     * Find an existing window for this order.  If found, bring it to
+     * the front.
+     */
+    if (order)
+    {
+        GUID order_guid;
 
-    order_guid = *gncOrderGetGUID(order);
-    ow = gnc_find_first_gui_component (class_name, find_handler,
-				       &order_guid);
-    if (ow) {
-      gtk_window_present (GTK_WINDOW(ow->dialog));
-      return(ow);
+        order_guid = *gncOrderGetGUID(order);
+        ow = gnc_find_first_gui_component (class_name, find_handler,
+                                           &order_guid);
+        if (ow)
+        {
+            gtk_window_present (GTK_WINDOW(ow->dialog));
+            return(ow);
+        }
     }
-  }
-  
-  /*
-   * No existing order window found.  Build a new one.
-   */
-  ow = g_new0 (OrderWindow, 1);
-  ow->book = bookp;
-  ow->dialog_type = type;
 
-  /* Save this for later */
-  gncOwnerCopy (owner, &(ow->owner));
+    /*
+     * No existing order window found.  Build a new one.
+     */
+    ow = g_new0 (OrderWindow, 1);
+    ow->book = bookp;
+    ow->dialog_type = type;
 
-  /* Find the dialog */
-  ow->xml = xml = gnc_glade_xml_new ("order.glade", "Order Entry Dialog");
-  ow->dialog = glade_xml_get_widget (xml, "Order Entry Dialog");
+    /* Save this for later */
+    gncOwnerCopy (owner, &(ow->owner));
 
-  /* Grab the widgets */
-  ow->id_entry = glade_xml_get_widget (xml, "id_entry");
-  ow->ref_entry = glade_xml_get_widget (xml, "ref_entry");
-  ow->notes_text = glade_xml_get_widget (xml, "notes_text");
-  ow->opened_date = glade_xml_get_widget (xml, "opened_date");
-  ow->closed_date = glade_xml_get_widget (xml, "closed_date");
-  ow->active_check = glade_xml_get_widget (xml, "active_check");
-  ow->owner_box = glade_xml_get_widget (xml, "owner_hbox");
-  ow->owner_label = glade_xml_get_widget (xml, "owner_label");
+    /* Find the dialog */
+    ow->xml = xml = gnc_glade_xml_new ("order.glade", "Order Entry Dialog");
+    ow->dialog = glade_xml_get_widget (xml, "Order Entry Dialog");
 
-  /* Build the ledger */
-  switch (type) {
-  case EDIT_ORDER:
-    entry_ledger = gnc_entry_ledger_new (ow->book, GNCENTRY_ORDER_ENTRY);
-    break;
-  case VIEW_ORDER:
-  default:
-    entry_ledger = gnc_entry_ledger_new (ow->book, GNCENTRY_ORDER_VIEWER);
-    break;
-  }
+    /* Grab the widgets */
+    ow->id_entry = glade_xml_get_widget (xml, "id_entry");
+    ow->ref_entry = glade_xml_get_widget (xml, "ref_entry");
+    ow->notes_text = glade_xml_get_widget (xml, "notes_text");
+    ow->opened_date = glade_xml_get_widget (xml, "opened_date");
+    ow->closed_date = glade_xml_get_widget (xml, "closed_date");
+    ow->active_check = glade_xml_get_widget (xml, "active_check");
+    ow->owner_box = glade_xml_get_widget (xml, "owner_hbox");
+    ow->owner_label = glade_xml_get_widget (xml, "owner_label");
 
-  /* Save the entry ledger for later */
-  ow->ledger = entry_ledger;
+    /* Build the ledger */
+    switch (type)
+    {
+    case EDIT_ORDER:
+        entry_ledger = gnc_entry_ledger_new (ow->book, GNCENTRY_ORDER_ENTRY);
+        break;
+    case VIEW_ORDER:
+    default:
+        entry_ledger = gnc_entry_ledger_new (ow->book, GNCENTRY_ORDER_VIEWER);
+        break;
+    }
 
-  /* Set the order for the entry_ledger */
-  gnc_entry_ledger_set_default_order (entry_ledger, order);
+    /* Save the entry ledger for later */
+    ow->ledger = entry_ledger;
 
-  /* Set watches on entries */
-  //  entries = gncOrderGetEntries (order);
-  //  gnc_entry_ledger_load (entry_ledger, entries);
+    /* Set the order for the entry_ledger */
+    gnc_entry_ledger_set_default_order (entry_ledger, order);
 
-  /* Watch the order of operations, here... */
-  gnucash_register_set_initial_rows( 10 );
-  regWidget = gnucash_register_new (gnc_entry_ledger_get_table (entry_ledger));
-  gnc_table_init_gui( regWidget, entry_ledger );
-  ow->reg = GNUCASH_REGISTER (regWidget);
-  GNUCASH_SHEET (ow->reg->sheet)->window = GTK_WIDGET(ow->dialog);
-  gnc_entry_ledger_set_parent (entry_ledger, ow->dialog);
+    /* Set watches on entries */
+    //  entries = gncOrderGetEntries (order);
+    //  gnc_entry_ledger_load (entry_ledger, entries);
 
-  vbox = glade_xml_get_widget (xml, "ledger_vbox");
-  // gtk_box_pack_start (GTK_BOX(vbox), toolbar, FALSE, FALSE, 2);
-  gtk_box_pack_start (GTK_BOX(vbox), regWidget, TRUE, TRUE, 2);
+    /* Watch the order of operations, here... */
+    gnucash_register_set_initial_rows( 10 );
+    regWidget = gnucash_register_new (gnc_entry_ledger_get_table (entry_ledger));
+    gnc_table_init_gui( regWidget, entry_ledger );
+    ow->reg = GNUCASH_REGISTER (regWidget);
+    GNUCASH_SHEET (ow->reg->sheet)->window = GTK_WIDGET(ow->dialog);
+    gnc_entry_ledger_set_parent (entry_ledger, ow->dialog);
 
-  /* Setup signals */
-  glade_xml_signal_autoconnect_full( xml,
-                                     gnc_glade_autoconnect_full_func,
-                                     ow);
-  /* Setup initial values */
-  ow->order_guid = *gncOrderGetGUID (order);
+    vbox = glade_xml_get_widget (xml, "ledger_vbox");
+    // gtk_box_pack_start (GTK_BOX(vbox), toolbar, FALSE, FALSE, 2);
+    gtk_box_pack_start (GTK_BOX(vbox), regWidget, TRUE, TRUE, 2);
 
-  gtk_entry_set_text (GTK_ENTRY (ow->id_entry), gncOrderGetID (order));
+    /* Setup signals */
+    glade_xml_signal_autoconnect_full( xml,
+                                       gnc_glade_autoconnect_full_func,
+                                       ow);
+    /* Setup initial values */
+    ow->order_guid = *gncOrderGetGUID (order);
 
-  ow->component_id =
-    gnc_register_gui_component (class_name,
-				gnc_order_window_refresh_handler,
-				gnc_order_window_close_handler,
-				ow);
+    gtk_entry_set_text (GTK_ENTRY (ow->id_entry), gncOrderGetID (order));
 
-  gnc_table_realize_gui (gnc_entry_ledger_get_table (entry_ledger));
+    ow->component_id =
+        gnc_register_gui_component (class_name,
+                                    gnc_order_window_refresh_handler,
+                                    gnc_order_window_close_handler,
+                                    ow);
 
-  /* Now fill in a lot of the pieces and display properly */
-  gnc_order_update_window (ow);
+    gnc_table_realize_gui (gnc_entry_ledger_get_table (entry_ledger));
 
-  /* Maybe set the reference */
-  gnc_order_owner_changed_cb (ow->owner_choice, ow);
+    /* Now fill in a lot of the pieces and display properly */
+    gnc_order_update_window (ow);
 
-  return ow;
+    /* Maybe set the reference */
+    gnc_order_owner_changed_cb (ow->owner_choice, ow);
+
+    return ow;
 }
 
 static OrderWindow *
 gnc_order_window_new_order (QofBook *bookp, GncOwner *owner)
 {
-  OrderWindow *ow;
-  GladeXML *xml;
-  GncOrder *order;
-  gchar *string;
+    OrderWindow *ow;
+    GladeXML *xml;
+    GncOrder *order;
+    gchar *string;
 
-  ow = g_new0 (OrderWindow, 1);
-  ow->book = bookp;
-  ow->dialog_type = NEW_ORDER;
+    ow = g_new0 (OrderWindow, 1);
+    ow->book = bookp;
+    ow->dialog_type = NEW_ORDER;
 
-  order = gncOrderCreate (bookp);
-  gncOrderSetOwner (order, owner);
+    order = gncOrderCreate (bookp);
+    gncOrderSetOwner (order, owner);
 
-  /* Save this for later */
-  gncOwnerCopy (owner, &(ow->owner));
+    /* Save this for later */
+    gncOwnerCopy (owner, &(ow->owner));
 
-  /* Find the dialog */
-  xml = gnc_glade_xml_new ("order.glade", "New Order Dialog");
-  ow->dialog = glade_xml_get_widget (xml, "New Order Dialog");
+    /* Find the dialog */
+    xml = gnc_glade_xml_new ("order.glade", "New Order Dialog");
+    ow->dialog = glade_xml_get_widget (xml, "New Order Dialog");
 
-  g_object_set_data (G_OBJECT (ow->dialog), "dialog_info", ow);
+    g_object_set_data (G_OBJECT (ow->dialog), "dialog_info", ow);
 
-  /* Grab the widgets */
-  ow->id_entry = glade_xml_get_widget (xml, "id_entry");
-  ow->ref_entry = glade_xml_get_widget (xml, "ref_entry");
-  ow->notes_text = glade_xml_get_widget (xml, "notes_text");
-  ow->opened_date = glade_xml_get_widget (xml, "opened_date");
-  ow->owner_box = glade_xml_get_widget (xml, "owner_hbox");
-  ow->owner_label = glade_xml_get_widget (xml, "owner_label");
+    /* Grab the widgets */
+    ow->id_entry = glade_xml_get_widget (xml, "id_entry");
+    ow->ref_entry = glade_xml_get_widget (xml, "ref_entry");
+    ow->notes_text = glade_xml_get_widget (xml, "notes_text");
+    ow->opened_date = glade_xml_get_widget (xml, "opened_date");
+    ow->owner_box = glade_xml_get_widget (xml, "owner_hbox");
+    ow->owner_label = glade_xml_get_widget (xml, "owner_label");
 
-  /* Setup signals */
-  glade_xml_signal_autoconnect_full( xml,
-                                     gnc_glade_autoconnect_full_func,
-                                     ow);
-  /* Setup initial values */
-  ow->order_guid = *gncOrderGetGUID (order);
-  string = g_strdup_printf ("%.6" G_GINT64_FORMAT,
-			    gncOrderNextID(bookp));
-  gtk_entry_set_text (GTK_ENTRY (ow->id_entry), string);
-  g_free(string);
-      
-  ow->component_id =
-    gnc_register_gui_component (DIALOG_NEW_ORDER_CM_CLASS,
-				gnc_order_window_refresh_handler,
-				gnc_order_window_close_handler,
-				ow);
+    /* Setup signals */
+    glade_xml_signal_autoconnect_full( xml,
+                                       gnc_glade_autoconnect_full_func,
+                                       ow);
+    /* Setup initial values */
+    ow->order_guid = *gncOrderGetGUID (order);
+    string = g_strdup_printf ("%.6" G_GINT64_FORMAT,
+                              gncOrderNextID(bookp));
+    gtk_entry_set_text (GTK_ENTRY (ow->id_entry), string);
+    g_free(string);
 
-  /* Now fill in a lot of the pieces and display properly */
-  gnc_order_update_window (ow);
+    ow->component_id =
+        gnc_register_gui_component (DIALOG_NEW_ORDER_CM_CLASS,
+                                    gnc_order_window_refresh_handler,
+                                    gnc_order_window_close_handler,
+                                    ow);
 
-  /* Maybe set the reference */
-  gnc_order_owner_changed_cb (ow->owner_choice, ow);
+    /* Now fill in a lot of the pieces and display properly */
+    gnc_order_update_window (ow);
 
-  return ow;
+    /* Maybe set the reference */
+    gnc_order_owner_changed_cb (ow->owner_choice, ow);
+
+    return ow;
 }
 
 OrderWindow *
 gnc_ui_order_edit (GncOrder *order)
 {
-  OrderWindow *ow;
-  OrderDialogType type;
+    OrderWindow *ow;
+    OrderDialogType type;
 
-  if (!order) return NULL;
+    if (!order) return NULL;
 
-  type = EDIT_ORDER;
-  {
-    Timespec ts = gncOrderGetDateClosed (order);
-    if (ts.tv_sec || ts.tv_nsec)
-      type = VIEW_ORDER;
-  }
+    type = EDIT_ORDER;
+    {
+        Timespec ts = gncOrderGetDateClosed (order);
+        if (ts.tv_sec || ts.tv_nsec)
+            type = VIEW_ORDER;
+    }
 
-  ow = gnc_order_new_window (gncOrderGetBook(order), type, order, 
-			     gncOrderGetOwner (order));
+    ow = gnc_order_new_window (gncOrderGetBook(order), type, order,
+                               gncOrderGetOwner (order));
 
-  return ow;
+    return ow;
 }
 
 OrderWindow *
 gnc_ui_order_new (GncOwner *ownerp, QofBook *bookp)
 {
-  OrderWindow *ow;
-  GncOwner owner;
+    OrderWindow *ow;
+    GncOwner owner;
 
-  if (ownerp) {
-    switch (gncOwnerGetType (ownerp)) {
-    case GNC_OWNER_CUSTOMER:
-    case GNC_OWNER_VENDOR:
-    case GNC_OWNER_JOB:
-      gncOwnerCopy (ownerp, &owner);
-      break;
-    default:
-      g_warning ("Cannot deal with unknown Owner types");
-      /* XXX: popup a warning? */
-      return NULL;
+    if (ownerp)
+    {
+        switch (gncOwnerGetType (ownerp))
+        {
+        case GNC_OWNER_CUSTOMER:
+        case GNC_OWNER_VENDOR:
+        case GNC_OWNER_JOB:
+            gncOwnerCopy (ownerp, &owner);
+            break;
+        default:
+            g_warning ("Cannot deal with unknown Owner types");
+            /* XXX: popup a warning? */
+            return NULL;
+        }
     }
-  } else
-    gncOwnerInitJob (&owner, NULL); /* XXX: pass in the owner type? */
+    else
+        gncOwnerInitJob (&owner, NULL); /* XXX: pass in the owner type? */
 
-  /* Make sure required options exist */
-  if (!bookp) return NULL;
+    /* Make sure required options exist */
+    if (!bookp) return NULL;
 
-  ow = gnc_order_window_new_order (bookp, &owner);
+    ow = gnc_order_window_new_order (bookp, &owner);
 
-  return ow;
+    return ow;
 }
 
 /* Functions for order selection widgets */
@@ -753,163 +784,171 @@
 static void
 edit_order_cb (gpointer *order_p, gpointer user_data)
 {
-  GncOrder *order;
+    GncOrder *order;
 
-  g_return_if_fail (order_p && user_data);
+    g_return_if_fail (order_p && user_data);
 
-  order = *order_p;
+    order = *order_p;
 
-  if (order)
-    gnc_ui_order_edit (order);
+    if (order)
+        gnc_ui_order_edit (order);
 
-  return;
+    return;
 }
 
 static gpointer
 new_order_cb (gpointer user_data)
 {
-  struct _order_select_window *sw = user_data;
-  OrderWindow *ow;
-  
-  g_return_val_if_fail (user_data, NULL);
+    struct _order_select_window *sw = user_data;
+    OrderWindow *ow;
 
-  ow = gnc_ui_order_new (sw->owner, sw->book);
-  return ow_get_order (ow);
+    g_return_val_if_fail (user_data, NULL);
+
+    ow = gnc_ui_order_new (sw->owner, sw->book);
+    return ow_get_order (ow);
 }
 
 static void
 free_order_cb (gpointer user_data)
 {
-  struct _order_select_window *sw = user_data;
+    struct _order_select_window *sw = user_data;
 
-  g_return_if_fail (sw);
+    g_return_if_fail (sw);
 
-  gncQueryDestroy (sw->q);
-  g_free (sw);
+    gncQueryDestroy (sw->q);
+    g_free (sw);
 }
 
 GNCSearchWindow *
 gnc_order_search (GncOrder *start, GncOwner *owner, QofBook *book)
 {
-  GNCIdType type = GNC_ORDER_MODULE_NAME;
-  struct _order_select_window *sw;
-  QueryNew *q, *q2 = NULL;
-  static GList *params = NULL;
-  static GList *columns = NULL;
-  static GNCSearchCallbackButton buttons[] = { 
-    { N_("View/Edit Order"), edit_order_cb},
-    { NULL },
-  };
+    GNCIdType type = GNC_ORDER_MODULE_NAME;
+    struct _order_select_window *sw;
+    QueryNew *q, *q2 = NULL;
+    static GList *params = NULL;
+    static GList *columns = NULL;
+    static GNCSearchCallbackButton buttons[] =
+    {
+        { N_("View/Edit Order"), edit_order_cb},
+        { NULL },
+    };
 
-  g_return_val_if_fail (book, NULL);
+    g_return_val_if_fail (book, NULL);
 
-  /* Build parameter list in reverse order*/
-  if (params == NULL) {
-    params = gnc_search_param_prepend (params, _("Order Notes"), NULL, type,
-				       ORDER_NOTES, NULL);
-    params = gnc_search_param_prepend (params, _("Date Closed"), NULL, type,
-				       ORDER_CLOSED, NULL);
-    params = gnc_search_param_prepend (params, _("Is Closed?"), NULL, type,
-				       ORDER_IS_CLOSED, NULL);
-    params = gnc_search_param_prepend (params, _("Date Opened"), NULL, type,
-				       ORDER_OPENED, NULL);
-    params = gnc_search_param_prepend (params, _("Owner Name "), NULL, type,
-				       ORDER_OWNER, OWNER_NAME, NULL);
-    params = gnc_search_param_prepend (params, _("Order ID"), NULL, type,
-				       ORDER_ID, NULL);
-  }
+    /* Build parameter list in reverse order*/
+    if (params == NULL)
+    {
+        params = gnc_search_param_prepend (params, _("Order Notes"), NULL, type,
+                                           ORDER_NOTES, NULL);
+        params = gnc_search_param_prepend (params, _("Date Closed"), NULL, type,
+                                           ORDER_CLOSED, NULL);
+        params = gnc_search_param_prepend (params, _("Is Closed?"), NULL, type,
+                                           ORDER_IS_CLOSED, NULL);
+        params = gnc_search_param_prepend (params, _("Date Opened"), NULL, type,
+                                           ORDER_OPENED, NULL);
+        params = gnc_search_param_prepend (params, _("Owner Name "), NULL, type,
+                                           ORDER_OWNER, OWNER_NAME, NULL);
+        params = gnc_search_param_prepend (params, _("Order ID"), NULL, type,
+                                           ORDER_ID, NULL);
+    }
 
-  /* Build the column list in reverse order */
-  if (columns == NULL) {
-    columns = gnc_search_param_prepend (columns, _("Billing ID"), NULL, type,
-					ORDER_REFERENCE, NULL);
-    columns = gnc_search_param_prepend (columns, _("Company"), NULL, type,
-					ORDER_OWNER, OWNER_PARENT,
-					OWNER_NAME, NULL);
-    columns = gnc_search_param_prepend (columns, _("Closed"), NULL, type,
-					ORDER_CLOSED, NULL);
-    columns = gnc_search_param_prepend (columns, _("Opened"), NULL, type,
-					ORDER_OPENED, NULL);
-    columns = gnc_search_param_prepend (columns, _("Num"), NULL, type,
-					ORDER_ID, NULL);
-  }
+    /* Build the column list in reverse order */
+    if (columns == NULL)
+    {
+        columns = gnc_search_param_prepend (columns, _("Billing ID"), NULL, type,
+                                            ORDER_REFERENCE, NULL);
+        columns = gnc_search_param_prepend (columns, _("Company"), NULL, type,
+                                            ORDER_OWNER, OWNER_PARENT,
+                                            OWNER_NAME, NULL);
+        columns = gnc_search_param_prepend (columns, _("Closed"), NULL, type,
+                                            ORDER_CLOSED, NULL);
+        columns = gnc_search_param_prepend (columns, _("Opened"), NULL, type,
+                                            ORDER_OPENED, NULL);
+        columns = gnc_search_param_prepend (columns, _("Num"), NULL, type,
+                                            ORDER_ID, NULL);
+    }
 
-  /* Build the queries */
-  q = gncQueryCreateFor (type);
-  gncQuerySetBook (q, book);
+    /* Build the queries */
+    q = gncQueryCreateFor (type);
+    gncQuerySetBook (q, book);
 
-  /* If owner is supplied, limit all searches to orders who's owner
-   * (or parent) is the supplied owner!
-   */
-  if (owner && gncOwnerGetGUID (owner)) {
-    QueryNew *tmp, *q3;
+    /* If owner is supplied, limit all searches to orders who's owner
+     * (or parent) is the supplied owner!
+     */
+    if (owner && gncOwnerGetGUID (owner))
+    {
+        QueryNew *tmp, *q3;
 
-    q3 = gncQueryCreateFor (type);
-    gncQueryAddGUIDMatch (q3, g_slist_prepend
-			  (g_slist_prepend (NULL, QUERY_PARAM_GUID),
-			   ORDER_OWNER),
-			  gncOwnerGetGUID (owner), QUERY_OR);
-    gncQueryAddGUIDMatch (q3, g_slist_prepend
-			  (g_slist_prepend (NULL, OWNER_PARENTG),
-			   ORDER_OWNER),
-			  gncOwnerGetGUID (owner), QUERY_OR);
+        q3 = gncQueryCreateFor (type);
+        gncQueryAddGUIDMatch (q3, g_slist_prepend
+                              (g_slist_prepend (NULL, QUERY_PARAM_GUID),
+                               ORDER_OWNER),
+                              gncOwnerGetGUID (owner), QUERY_OR);
+        gncQueryAddGUIDMatch (q3, g_slist_prepend
+                              (g_slist_prepend (NULL, OWNER_PARENTG),
+                               ORDER_OWNER),
+                              gncOwnerGetGUID (owner), QUERY_OR);
 
-    tmp = gncQueryMerge (q, q3, QUERY_AND);
-    gncQueryDestroy (q);
-    gncQueryDestroy (q3);
-    q = tmp;
-    q2 = gncQueryCopy (q);
-  }
+        tmp = gncQueryMerge (q, q3, QUERY_AND);
+        gncQueryDestroy (q);
+        gncQueryDestroy (q3);
+        q = tmp;
+        q2 = gncQueryCopy (q);
+    }
 
 #if 0
-  if (start) {
-    if (q2 == NULL)
-      q2 = gncQueryCopy (q);
+    if (start)
+    {
+        if (q2 == NULL)
+            q2 = gncQueryCopy (q);
 
-    gncQueryAddGUIDMatch (q2, g_slist_prepend (NULL, QUERY_PARAM_GUID),
-			  gncOrderGetGUID (start), QUERY_AND);
-  }
+        gncQueryAddGUIDMatch (q2, g_slist_prepend (NULL, QUERY_PARAM_GUID),
+                              gncOrderGetGUID (start), QUERY_AND);
+    }
 #endif
 
-  /* launch select dialog and return the result */
-  sw = g_new0 (struct _order_select_window, 1);
+    /* launch select dialog and return the result */
+    sw = g_new0 (struct _order_select_window, 1);
 
-  if (owner) {
-    gncOwnerCopy (owner, &(sw->owner_def));
-    sw->owner = &(sw->owner_def);
-  }
-  sw->book = book;
-  sw->q = q;
+    if (owner)
+    {
+        gncOwnerCopy (owner, &(sw->owner_def));
+        sw->owner = &(sw->owner_def);
+    }
+    sw->book = book;
+    sw->q = q;
 
-  return gnc_search_dialog_create (type, _("Find Order"),
-				   params, columns, q, q2,
-				   buttons, NULL, new_order_cb,
-				   sw, free_order_cb, GCONF_SECTION_SEARCH,
-				   NULL);
+    return gnc_search_dialog_create (type, _("Find Order"),
+                                     params, columns, q, q2,
+                                     buttons, NULL, new_order_cb,
+                                     sw, free_order_cb, GCONF_SECTION_SEARCH,
+                                     NULL);
 }
 
 GNCSearchWindow *
 gnc_order_search_select (gpointer start, gpointer book)
 {
-  GncOrder *o = start;
-  GncOwner owner, *ownerp;
+    GncOrder *o = start;
+    GncOwner owner, *ownerp;
 
-  if (!book) return NULL;
+    if (!book) return NULL;
 
-  if (o) {
-    ownerp = gncOrderGetOwner (o);
-    gncOwnerCopy (ownerp, &owner);
-  } else
-    gncOwnerInitCustomer (&owner, NULL); /* XXX */
+    if (o)
+    {
+        ownerp = gncOrderGetOwner (o);
+        gncOwnerCopy (ownerp, &owner);
+    }
+    else
+        gncOwnerInitCustomer (&owner, NULL); /* XXX */
 
-  return gnc_order_search (start, NULL, book);
+    return gnc_order_search (start, NULL, book);
 }
 
 GNCSearchWindow *
 gnc_order_search_edit (gpointer start, gpointer book)
 {
-  if (start)
-    gnc_ui_order_edit (start);
+    if (start)
+        gnc_ui_order_edit (start);
 
-  return NULL;
+    return NULL;
 }

Modified: gnucash/trunk/src/business/business-gnome/dialog-order.h
===================================================================
--- gnucash/trunk/src/business/business-gnome/dialog-order.h	2010-03-02 21:40:28 UTC (rev 18788)
+++ gnucash/trunk/src/business/business-gnome/dialog-order.h	2010-03-02 21:41:05 UTC (rev 18789)
@@ -37,7 +37,7 @@
 
 /* Search for orders */
 GNCSearchWindow * gnc_order_search (GncOrder *start, GncOwner *owner,
-				    QofBook *book);
+                                    QofBook *book);
 
 /*
  * These callbacks are for use with the gnc_general_search widget

Modified: gnucash/trunk/src/business/business-gnome/dialog-payment.c
===================================================================
--- gnucash/trunk/src/business/business-gnome/dialog-payment.c	2010-03-02 21:40:28 UTC (rev 18788)
+++ gnucash/trunk/src/business/business-gnome/dialog-payment.c	2010-03-02 21:41:05 UTC (rev 18789)
@@ -50,24 +50,25 @@
 #define DIALOG_PAYMENT_CUSTOMER_CM_CLASS "customer-payment-dialog"
 #define DIALOG_PAYMENT_VENDOR_CM_CLASS "vendor-payment-dialog"
 
-struct _payment_window {
-  GtkWidget *	dialog;
+struct _payment_window
+{
+    GtkWidget *	dialog;
 
-  GtkWidget *	num_entry;
-  GtkWidget *	memo_entry;
-  GtkWidget *	post_combo;
-  GtkWidget *	owner_choice;
-  GtkWidget *	invoice_choice;
-  GtkWidget *	amount_edit;
-  GtkWidget *	date_edit;
-  GtkWidget *	acct_tree;
+    GtkWidget *	num_entry;
+    GtkWidget *	memo_entry;
+    GtkWidget *	post_combo;
+    GtkWidget *	owner_choice;
+    GtkWidget *	invoice_choice;
+    GtkWidget *	amount_edit;
+    GtkWidget *	date_edit;
+    GtkWidget *	acct_tree;
 
-  gint		component_id;
-  QofBook *	book;
-  GncOwner	owner;
-  GncInvoice *	invoice;
-  GList *	acct_types;
-  GList *       acct_commodities;
+    gint		component_id;
+    QofBook *	book;
+    GncOwner	owner;
+    GncInvoice *	invoice;
+    GList *	acct_types;
+    GList *       acct_commodities;
 };
 
 
@@ -75,518 +76,535 @@
 void gnc_payment_cancel_cb (GtkWidget *widget, gpointer data);
 void gnc_payment_window_destroy_cb (GtkWidget *widget, gpointer data);
 void gnc_payment_acct_tree_row_activated_cb (GtkWidget *widget, GtkTreePath *path,
-                                             GtkTreeViewColumn *column, PaymentWindow *pw);
+        GtkTreeViewColumn *column, PaymentWindow *pw);
 
 
 static void
 gnc_payment_window_refresh_handler (GHashTable *changes, gpointer data)
 {
-  PaymentWindow *pw = data;
+    PaymentWindow *pw = data;
 
-  gnc_fill_account_select_combo (pw->post_combo, pw->book, pw->acct_types, pw->acct_commodities);
+    gnc_fill_account_select_combo (pw->post_combo, pw->book, pw->acct_types, pw->acct_commodities);
 }
 
 static void
 gnc_payment_window_close_handler (gpointer data)
 {
-  PaymentWindow *pw = data;
+    PaymentWindow *pw = data;
 
-  if (pw)
-    gtk_widget_destroy (pw->dialog);
+    if (pw)
+        gtk_widget_destroy (pw->dialog);
 }
 
 static void
 gnc_payment_dialog_invoice_changed(PaymentWindow *pw)
 {
-  GNCLot *lot;
-  gnc_numeric val;
+    GNCLot *lot;
+    gnc_numeric val;
 
-  /* Set the payment amount in the dialog */
-  if (pw->invoice) {
-    lot = gncInvoiceGetPostedLot (pw->invoice);
-    val = gnc_numeric_abs (gnc_lot_get_balance (lot));
-  } else {
-    val = gnc_numeric_zero();
-  }
+    /* Set the payment amount in the dialog */
+    if (pw->invoice)
+    {
+        lot = gncInvoiceGetPostedLot (pw->invoice);
+        val = gnc_numeric_abs (gnc_lot_get_balance (lot));
+    }
+    else
+    {
+        val = gnc_numeric_zero();
+    }
 
-  gnc_amount_edit_set_amount (GNC_AMOUNT_EDIT(pw->amount_edit), val);
+    gnc_amount_edit_set_amount (GNC_AMOUNT_EDIT(pw->amount_edit), val);
 }
 
 static void
 gnc_payment_dialog_owner_changed(PaymentWindow *pw)
 {
-  Account *last_acct=NULL;
-  GUID *guid=NULL;
-  KvpValue* value;
-  KvpFrame* slots;
+    Account *last_acct = NULL;
+    GUID *guid = NULL;
+    KvpValue* value;
+    KvpFrame* slots;
 
-  /* If the owner changed, the invoice selection is invalid */
-  pw->invoice = NULL;
-  gnc_invoice_set_owner(pw->invoice_choice, &pw->owner);
-  /* note that set_owner implies ...set_invoice(...,NULL); */
+    /* If the owner changed, the invoice selection is invalid */
+    pw->invoice = NULL;
+    gnc_invoice_set_owner(pw->invoice_choice, &pw->owner);
+    /* note that set_owner implies ...set_invoice(...,NULL); */
 
-  /* in case we don't get the callback */
-  gnc_payment_dialog_invoice_changed(pw);
+    /* in case we don't get the callback */
+    gnc_payment_dialog_invoice_changed(pw);
 
-  /* XXX: We should set the sensitive flag on the invoice_choice
-   * based on whether 'owner' is NULL or not...
-   */
+    /* XXX: We should set the sensitive flag on the invoice_choice
+     * based on whether 'owner' is NULL or not...
+     */
 
-  /* Now handle the account tree */
-  slots = gncOwnerGetSlots(&pw->owner);
-  if (slots)
-  {
-    value = kvp_frame_get_slot_path(slots, "payment", "last_acct", NULL);
-    if (value)
+    /* Now handle the account tree */
+    slots = gncOwnerGetSlots(&pw->owner);
+    if (slots)
     {
-      guid = kvp_value_get_guid(value);
+        value = kvp_frame_get_slot_path(slots, "payment", "last_acct", NULL);
+        if (value)
+        {
+            guid = kvp_value_get_guid(value);
+        }
     }
-  }
 
-  /* refresh the post and acc available accounts, but cleanup first */
-  if (pw->acct_types)
-  {
-    g_list_free(pw->acct_types);
-    pw->acct_types = NULL;
-  }
+    /* refresh the post and acc available accounts, but cleanup first */
+    if (pw->acct_types)
+    {
+        g_list_free(pw->acct_types);
+        pw->acct_types = NULL;
+    }
 
-  if (pw->acct_commodities)
-  {  
-    g_list_free(pw->acct_commodities);
-    pw->acct_commodities = NULL;
-  }
+    if (pw->acct_commodities)
+    {
+        g_list_free(pw->acct_commodities);
+        pw->acct_commodities = NULL;
+    }
 
-  pw->acct_types = gnc_business_account_types(&pw->owner);
-  pw->acct_commodities = gnc_business_commodities (&pw->owner);
-  gnc_fill_account_select_combo (pw->post_combo, pw->book, pw->acct_types, pw->acct_commodities);
+    pw->acct_types = gnc_business_account_types(&pw->owner);
+    pw->acct_commodities = gnc_business_commodities (&pw->owner);
+    gnc_fill_account_select_combo (pw->post_combo, pw->book, pw->acct_types, pw->acct_commodities);
 
-  if (guid)
-  {
-    last_acct = xaccAccountLookup(guid, pw->book);
-  }
+    if (guid)
+    {
+        last_acct = xaccAccountLookup(guid, pw->book);
+    }
 
-  /* Set the last-used transfer account */
-  if (last_acct) {
-    gnc_tree_view_account_set_selected_account(GNC_TREE_VIEW_ACCOUNT(pw->acct_tree),
-					       last_acct);
-  }
+    /* Set the last-used transfer account */
+    if (last_acct)
+    {
+        gnc_tree_view_account_set_selected_account(GNC_TREE_VIEW_ACCOUNT(pw->acct_tree),
+                last_acct);
+    }
 }
 
 static void
 gnc_payment_dialog_remember_account(PaymentWindow *pw, Account *acc)
 {
-  KvpValue* value;
-  KvpFrame* slots = gncOwnerGetSlots(&pw->owner);
+    KvpValue* value;
+    KvpFrame* slots = gncOwnerGetSlots(&pw->owner);
 
-  if (!acc) return;
-  if (!slots) return;
+    if (!acc) return;
+    if (!slots) return;
 
-  value = kvp_value_new_guid(xaccAccountGetGUID(acc));
-  if (!value) return;
-  
-  kvp_frame_set_slot_path(slots, value, "payment", "last_acct", NULL);
-  kvp_value_delete(value);
+    value = kvp_value_new_guid(xaccAccountGetGUID(acc));
+    if (!value) return;
 
-  /* XXX: FIXME:  Need a commit_edit here to save the data! */
+    kvp_frame_set_slot_path(slots, value, "payment", "last_acct", NULL);
+    kvp_value_delete(value);
+
+    /* XXX: FIXME:  Need a commit_edit here to save the data! */
 }
 
 
 static void
 gnc_payment_set_owner (PaymentWindow *pw, GncOwner *owner)
 {
-  gnc_owner_set_owner (pw->owner_choice, owner);
-  gnc_payment_dialog_owner_changed(pw);
+    gnc_owner_set_owner (pw->owner_choice, owner);
+    gnc_payment_dialog_owner_changed(pw);
 }
 
 static int
 gnc_payment_dialog_owner_changed_cb (GtkWidget *widget, gpointer data)
 {
-  PaymentWindow *pw = data;
-  GncOwner owner;
+    PaymentWindow *pw = data;
+    GncOwner owner;
 
-  if (!pw) return FALSE;
+    if (!pw) return FALSE;
 
-  gncOwnerCopy (&(pw->owner), &owner);
-  gnc_owner_get_owner (pw->owner_choice, &owner);
+    gncOwnerCopy (&(pw->owner), &owner);
+    gnc_owner_get_owner (pw->owner_choice, &owner);
 
-  /* If this owner really changed, then reset ourselves */
-  if (!gncOwnerEqual (&owner, &(pw->owner))) {
-    gncOwnerCopy (&owner, &(pw->owner));
-    gnc_payment_dialog_owner_changed(pw);
-  }
+    /* If this owner really changed, then reset ourselves */
+    if (!gncOwnerEqual (&owner, &(pw->owner)))
+    {
+        gncOwnerCopy (&owner, &(pw->owner));
+        gnc_payment_dialog_owner_changed(pw);
+    }
 
-  return FALSE;
+    return FALSE;
 }
 
 static int
 gnc_payment_dialog_invoice_changed_cb (GtkWidget *widget, gpointer data)
 {
-  PaymentWindow *pw = data;
-  GncInvoice *invoice;
+    PaymentWindow *pw = data;
+    GncInvoice *invoice;
 
-  if (!pw) return FALSE;
+    if (!pw) return FALSE;
 
-  invoice = gnc_invoice_get_invoice (pw->invoice_choice);
+    invoice = gnc_invoice_get_invoice (pw->invoice_choice);
 
-  /* If this invoice really changed, then reset ourselves */
-  if (invoice != pw->invoice) {
-    pw->invoice = invoice;
-    gnc_payment_dialog_invoice_changed(pw);
-  }
+    /* If this invoice really changed, then reset ourselves */
+    if (invoice != pw->invoice)
+    {
+        pw->invoice = invoice;
+        gnc_payment_dialog_invoice_changed(pw);
+    }
 
-  return FALSE;
+    return FALSE;
 }
 
 void
 gnc_payment_ok_cb (GtkWidget *widget, gpointer data)
 {
-  PaymentWindow *pw = data;
-  const char *text;
-  Account *post, *acc;
-  gnc_numeric amount;
+    PaymentWindow *pw = data;
+    const char *text;
+    Account *post, *acc;
+    gnc_numeric amount;
 
-  if (!pw)
-    return;
+    if (!pw)
+        return;
 
-  /* Verify the amount is non-zero */
-  amount = gnc_amount_edit_get_amount (GNC_AMOUNT_EDIT (pw->amount_edit));
-  if (gnc_numeric_check (amount) || !gnc_numeric_positive_p (amount)) {
-    text = _("You must enter the amount of the payment.  "
-	     "The payment amount must be greater than zero.");
-    gnc_error_dialog (pw->dialog, "%s", text);
-    return;
-  }
+    /* Verify the amount is non-zero */
+    amount = gnc_amount_edit_get_amount (GNC_AMOUNT_EDIT (pw->amount_edit));
+    if (gnc_numeric_check (amount) || !gnc_numeric_positive_p (amount))
+    {
+        text = _("You must enter the amount of the payment.  "
+                 "The payment amount must be greater than zero.");
+        gnc_error_dialog (pw->dialog, "%s", text);
+        return;
+    }
 
-  /* Verify the user has selected an owner */
-  gnc_owner_get_owner (pw->owner_choice, &(pw->owner));
-  if (pw->owner.owner.undefined == NULL) {
-    text = _("You must select a company for payment processing.");
-    gnc_error_dialog (pw->dialog, "%s", text);
-    return;
-  }
+    /* Verify the user has selected an owner */
+    gnc_owner_get_owner (pw->owner_choice, &(pw->owner));
+    if (pw->owner.owner.undefined == NULL)
+    {
+        text = _("You must select a company for payment processing.");
+        gnc_error_dialog (pw->dialog, "%s", text);
+        return;
+    }
 
-  /* Verify the user has selected a transfer account */
-  acc = gnc_tree_view_account_get_selected_account (GNC_TREE_VIEW_ACCOUNT(pw->acct_tree));
-  if (!acc) {
-    text = _("You must select a transfer account from the account tree.");
-    gnc_error_dialog (pw->dialog, "%s", text);
-    return;
-  }
+    /* Verify the user has selected a transfer account */
+    acc = gnc_tree_view_account_get_selected_account (GNC_TREE_VIEW_ACCOUNT(pw->acct_tree));
+    if (!acc)
+    {
+        text = _("You must select a transfer account from the account tree.");
+        gnc_error_dialog (pw->dialog, "%s", text);
+        return;
+    }
 
-  /* Verify the "post" account */
-  text = gtk_combo_box_get_active_text(GTK_COMBO_BOX(pw->post_combo));
-  if (!text || safe_strcmp (text, "") == 0) {
-    text = _("You must enter an account name for posting.");
-    gnc_error_dialog (pw->dialog, "%s", text);
-    return;
-  }
+    /* Verify the "post" account */
+    text = gtk_combo_box_get_active_text(GTK_COMBO_BOX(pw->post_combo));
+    if (!text || safe_strcmp (text, "") == 0)
+    {
+        text = _("You must enter an account name for posting.");
+        gnc_error_dialog (pw->dialog, "%s", text);
+        return;
+    }
 
-  post = gnc_account_lookup_by_full_name (gnc_book_get_root_account (pw->book), text);
+    post = gnc_account_lookup_by_full_name (gnc_book_get_root_account (pw->book), text);
 
-  if (!post) {
-    char *msg = g_strdup_printf (
-			 _("Your selected post account, %s, does not exist"),
-			 text);
-    gnc_error_dialog (pw->dialog, "%s", msg);
-    g_free (msg);
-    return;
-  }
+    if (!post)
+    {
+        char *msg = g_strdup_printf (
+                        _("Your selected post account, %s, does not exist"),
+                        text);
+        gnc_error_dialog (pw->dialog, "%s", msg);
+        g_free (msg);
+        return;
+    }
 
-  /* Ok, now post the damn thing */
-  gnc_suspend_gui_refresh ();
-  {
-    const char *memo, *num;
-    Timespec date;
-    gnc_numeric exch = gnc_numeric_create(1,1); //default to "one to one" rate
-    
-    /* Obtain all our ancillary information */
-    memo = gtk_entry_get_text (GTK_ENTRY (pw->memo_entry));
-    num = gtk_entry_get_text (GTK_ENTRY (pw->num_entry));
-    date = gnc_date_edit_get_date_ts (GNC_DATE_EDIT (pw->date_edit));
-
-    /* If the 'acc' account and the post account don't have the same
-       currency, we need to get the user to specify the exchange rate */
-    if (!gnc_commodity_equal(xaccAccountGetCommodity(acc), xaccAccountGetCommodity(post)))
+    /* Ok, now post the damn thing */
+    gnc_suspend_gui_refresh ();
     {
-        XferDialog* xfer;
+        const char *memo, *num;
+        Timespec date;
+        gnc_numeric exch = gnc_numeric_create(1, 1); //default to "one to one" rate
 
-        text = _("The transfer and post accounts are associated with different currencies.  Please specify the conversion rate.");
+        /* Obtain all our ancillary information */
+        memo = gtk_entry_get_text (GTK_ENTRY (pw->memo_entry));
+        num = gtk_entry_get_text (GTK_ENTRY (pw->num_entry));
+        date = gnc_date_edit_get_date_ts (GNC_DATE_EDIT (pw->date_edit));
 
-        xfer = gnc_xfer_dialog(pw->dialog, acc);
-        gnc_info_dialog(pw->dialog, "%s", text);
+        /* If the 'acc' account and the post account don't have the same
+           currency, we need to get the user to specify the exchange rate */
+        if (!gnc_commodity_equal(xaccAccountGetCommodity(acc), xaccAccountGetCommodity(post)))
+        {
+            XferDialog* xfer;
 
-        gnc_xfer_dialog_select_to_account(xfer,post);
-        gnc_xfer_dialog_set_amount(xfer, amount);
-        
-        /* All we want is the exchange rate so prevent the user from thinking 
-           it makes sense to mess with other stuff */
-        gnc_xfer_dialog_set_from_show_button_active(xfer, FALSE);
-        gnc_xfer_dialog_set_to_show_button_active(xfer, FALSE);
-        gnc_xfer_dialog_hide_from_account_tree(xfer);
-        gnc_xfer_dialog_hide_to_account_tree(xfer);
-        gnc_xfer_dialog_is_exchange_dialog(xfer, &exch);
-        gnc_xfer_dialog_run_until_done(xfer);
+            text = _("The transfer and post accounts are associated with different currencies.  Please specify the conversion rate.");
+
+            xfer = gnc_xfer_dialog(pw->dialog, acc);
+            gnc_info_dialog(pw->dialog, "%s", text);
+
+            gnc_xfer_dialog_select_to_account(xfer, post);
+            gnc_xfer_dialog_set_amount(xfer, amount);
+
+            /* All we want is the exchange rate so prevent the user from thinking
+               it makes sense to mess with other stuff */
+            gnc_xfer_dialog_set_from_show_button_active(xfer, FALSE);
+            gnc_xfer_dialog_set_to_show_button_active(xfer, FALSE);
+            gnc_xfer_dialog_hide_from_account_tree(xfer);
+            gnc_xfer_dialog_hide_to_account_tree(xfer);
+            gnc_xfer_dialog_is_exchange_dialog(xfer, &exch);
+            gnc_xfer_dialog_run_until_done(xfer);
+        }
+
+        /* Now apply the payment */
+        gncOwnerApplyPayment (&pw->owner, pw->invoice,
+                              post, acc, amount, exch, date, memo, num);
+
     }
-        
-    /* Now apply the payment */
-    gncOwnerApplyPayment (&pw->owner, pw->invoice,
-			  post, acc, amount, exch, date, memo, num);                    
-    
-  }
-  gnc_resume_gui_refresh ();
+    gnc_resume_gui_refresh ();
 
-  /* Save the transfer account, acc */
-  gnc_payment_dialog_remember_account(pw, acc);
+    /* Save the transfer account, acc */
+    gnc_payment_dialog_remember_account(pw, acc);
 
-  gnc_ui_payment_window_destroy (pw);
+    gnc_ui_payment_window_destroy (pw);
 }
 
 void
 gnc_payment_cancel_cb (GtkWidget *widget, gpointer data)
 {
-  PaymentWindow *pw = data;
-  gnc_ui_payment_window_destroy (pw);
+    PaymentWindow *pw = data;
+    gnc_ui_payment_window_destroy (pw);
 }
 
 void
 gnc_payment_window_destroy_cb (GtkWidget *widget, gpointer data)
 {
-  PaymentWindow *pw = data;
+    PaymentWindow *pw = data;
 
-  if (!pw) return;
+    if (!pw) return;
 
-  gnc_unregister_gui_component (pw->component_id);
+    gnc_unregister_gui_component (pw->component_id);
 
-  g_list_free (pw->acct_types);
-  g_list_free (pw->acct_commodities);
-  g_free (pw);
+    g_list_free (pw->acct_types);
+    g_list_free (pw->acct_commodities);
+    g_free (pw);
 }
 
 void
 gnc_payment_acct_tree_row_activated_cb (GtkWidget *widget, GtkTreePath *path,
                                         GtkTreeViewColumn *column, PaymentWindow *pw)
 {
-GtkTreeView *view;
-GtkTreeModel *model;
-GtkTreeIter iter;
+    GtkTreeView *view;
+    GtkTreeModel *model;
+    GtkTreeIter iter;
 
-g_return_if_fail(widget);
-view = GTK_TREE_VIEW(widget);
+    g_return_if_fail(widget);
+    view = GTK_TREE_VIEW(widget);
 
-model = gtk_tree_view_get_model(view);
-if (gtk_tree_model_get_iter(model, &iter, path))
-{
-  if (gtk_tree_model_iter_has_child(model, &iter))
-  {
-    /* There are children,
-     * just expand or collapse the row. */
-    if (gtk_tree_view_row_expanded(view, path))
-      gtk_tree_view_collapse_row(view, path);
-    else
-      gtk_tree_view_expand_row(view, path, FALSE);
-  }
-  else
-    /* It's an account without any children, so click the Ok button. */
-    gnc_payment_ok_cb(widget, pw);
+    model = gtk_tree_view_get_model(view);
+    if (gtk_tree_model_get_iter(model, &iter, path))
+    {
+        if (gtk_tree_model_iter_has_child(model, &iter))
+        {
+            /* There are children,
+             * just expand or collapse the row. */
+            if (gtk_tree_view_row_expanded(view, path))
+                gtk_tree_view_collapse_row(view, path);
+            else
+                gtk_tree_view_expand_row(view, path, FALSE);
+        }
+        else
+            /* It's an account without any children, so click the Ok button. */
+            gnc_payment_ok_cb(widget, pw);
+    }
 }
-}
 
 /* Select the list of accounts to show in the tree */
 static void
 gnc_payment_set_account_types (GncTreeViewAccount *tree)
 {
-  AccountViewInfo avi;
-  int i;
+    AccountViewInfo avi;
+    int i;
 
-  gnc_tree_view_account_get_view_info (tree, &avi);
+    gnc_tree_view_account_get_view_info (tree, &avi);
 
-  for (i = 0; i < NUM_ACCOUNT_TYPES; i++)
-    switch (i) {
-    case ACCT_TYPE_BANK:
-    case ACCT_TYPE_CASH:
-    case ACCT_TYPE_CREDIT:
-    case ACCT_TYPE_ASSET:
-    case ACCT_TYPE_LIABILITY:
-      avi.include_type[i] = TRUE;
-      break;
-    default:
-      avi.include_type[i] = FALSE;
-      break;
-    }
+    for (i = 0; i < NUM_ACCOUNT_TYPES; i++)
+        switch (i)
+        {
+        case ACCT_TYPE_BANK:
+        case ACCT_TYPE_CASH:
+        case ACCT_TYPE_CREDIT:
+        case ACCT_TYPE_ASSET:
+        case ACCT_TYPE_LIABILITY:
+            avi.include_type[i] = TRUE;
+            break;
+        default:
+            avi.include_type[i] = FALSE;
+            break;
+        }
 
-  gnc_tree_view_account_set_view_info (tree, &avi);
+    gnc_tree_view_account_set_view_info (tree, &avi);
 }
 
 static gboolean
 find_handler (gpointer find_data, gpointer user_data)
 {
-  PaymentWindow *pw = user_data;
+    PaymentWindow *pw = user_data;
 
-  return (pw != NULL);
+    return (pw != NULL);
 }
 
 static PaymentWindow *
 new_payment_window (GncOwner *owner, QofBook *book, GncInvoice *invoice)
 {
-  PaymentWindow *pw;
-  GladeXML *xml;
-  GtkWidget *box, *label;
-  char * cm_class = (gncOwnerGetType (owner) == GNC_OWNER_CUSTOMER ?
-		     DIALOG_PAYMENT_CUSTOMER_CM_CLASS :
-		     DIALOG_PAYMENT_VENDOR_CM_CLASS);
+    PaymentWindow *pw;
+    GladeXML *xml;
+    GtkWidget *box, *label;
+    char * cm_class = (gncOwnerGetType (owner) == GNC_OWNER_CUSTOMER ?
+                       DIALOG_PAYMENT_CUSTOMER_CM_CLASS :
+                       DIALOG_PAYMENT_VENDOR_CM_CLASS);
 
-  /*
-   * Find an existing payment window.  If found, bring it to
-   * the front.  If we have an actual owner, then set it in
-   * the window.
-   */
+    /*
+     * Find an existing payment window.  If found, bring it to
+     * the front.  If we have an actual owner, then set it in
+     * the window.
+     */
 
-  pw = gnc_find_first_gui_component (cm_class, find_handler, NULL);
-  if (pw) {
-    if (owner->owner.undefined)
-      gnc_payment_set_owner (pw, owner);
+    pw = gnc_find_first_gui_component (cm_class, find_handler, NULL);
+    if (pw)
+    {
+        if (owner->owner.undefined)
+            gnc_payment_set_owner (pw, owner);
 
-    gtk_window_present (GTK_WINDOW(pw->dialog));
-    return(pw);
-  }
+        gtk_window_present (GTK_WINDOW(pw->dialog));
+        return(pw);
+    }
 
-  /* Ok, we need a new window */
+    /* Ok, we need a new window */
 
-  pw = g_new0 (PaymentWindow, 1);
-  pw->book = book;
-  gncOwnerCopy (owner, &(pw->owner));
+    pw = g_new0 (PaymentWindow, 1);
+    pw->book = book;
+    gncOwnerCopy (owner, &(pw->owner));
 
-  /* Compute the post-to account types */
-  pw->acct_types = gnc_business_account_types (owner);
+    /* Compute the post-to account types */
+    pw->acct_types = gnc_business_account_types (owner);
 
-  pw->acct_commodities = gnc_business_commodities (owner);
+    pw->acct_commodities = gnc_business_commodities (owner);
 
-  /* Open and read the XML */
-  xml = gnc_glade_xml_new ("payment.glade", "Payment Dialog");
-  pw->dialog = glade_xml_get_widget (xml, "Payment Dialog");
-  
-  /* Grab the widgets and build the dialog */
-  pw->num_entry = glade_xml_get_widget (xml, "num_entry");
-  pw->memo_entry = glade_xml_get_widget (xml, "memo_entry");
-  pw->post_combo = glade_xml_get_widget (xml, "post_combo");
-  gnc_cbe_require_list_item(GTK_COMBO_BOX_ENTRY(pw->post_combo));
+    /* Open and read the XML */
+    xml = gnc_glade_xml_new ("payment.glade", "Payment Dialog");
+    pw->dialog = glade_xml_get_widget (xml, "Payment Dialog");
 
-  label = glade_xml_get_widget (xml, "owner_label");
-  box = glade_xml_get_widget (xml, "owner_box");
-  pw->owner_choice = gnc_owner_select_create (label, box, book, owner);
+    /* Grab the widgets and build the dialog */
+    pw->num_entry = glade_xml_get_widget (xml, "num_entry");
+    pw->memo_entry = glade_xml_get_widget (xml, "memo_entry");
+    pw->post_combo = glade_xml_get_widget (xml, "post_combo");
+    gnc_cbe_require_list_item(GTK_COMBO_BOX_ENTRY(pw->post_combo));
 
-  label = glade_xml_get_widget (xml, "invoice_label");
-  box = glade_xml_get_widget (xml, "invoice_box");
-  pw->invoice_choice = gnc_invoice_select_create (box, book, owner, invoice, label);
+    label = glade_xml_get_widget (xml, "owner_label");
+    box = glade_xml_get_widget (xml, "owner_box");
+    pw->owner_choice = gnc_owner_select_create (label, box, book, owner);
 
-  box = glade_xml_get_widget (xml, "amount_box");
-  pw->amount_edit = gnc_amount_edit_new ();
-  gtk_box_pack_start (GTK_BOX (box), pw->amount_edit, TRUE, TRUE, 0);
-  gnc_amount_edit_set_evaluate_on_enter (GNC_AMOUNT_EDIT (pw->amount_edit),
-					 TRUE);
-  gnc_amount_edit_set_amount (GNC_AMOUNT_EDIT (pw->amount_edit), gnc_numeric_zero());
+    label = glade_xml_get_widget (xml, "invoice_label");
+    box = glade_xml_get_widget (xml, "invoice_box");
+    pw->invoice_choice = gnc_invoice_select_create (box, book, owner, invoice, label);
 
-  box = glade_xml_get_widget (xml, "date_box");
-  pw->date_edit = gnc_date_edit_new (time(NULL), FALSE, FALSE);
-  gtk_box_pack_start (GTK_BOX (box), pw->date_edit, TRUE, TRUE, 0);
+    box = glade_xml_get_widget (xml, "amount_box");
+    pw->amount_edit = gnc_amount_edit_new ();
+    gtk_box_pack_start (GTK_BOX (box), pw->amount_edit, TRUE, TRUE, 0);
+    gnc_amount_edit_set_evaluate_on_enter (GNC_AMOUNT_EDIT (pw->amount_edit),
+                                           TRUE);
+    gnc_amount_edit_set_amount (GNC_AMOUNT_EDIT (pw->amount_edit), gnc_numeric_zero());
 
-  box = glade_xml_get_widget (xml, "acct_window");
-  pw->acct_tree = GTK_WIDGET(gnc_tree_view_account_new (FALSE));
-  gtk_container_add (GTK_CONTAINER (box), pw->acct_tree);
-  gtk_tree_view_set_headers_visible (GTK_TREE_VIEW(pw->acct_tree), FALSE);
-  gnc_payment_set_account_types (GNC_TREE_VIEW_ACCOUNT (pw->acct_tree));
+    box = glade_xml_get_widget (xml, "date_box");
+    pw->date_edit = gnc_date_edit_new (time(NULL), FALSE, FALSE);
+    gtk_box_pack_start (GTK_BOX (box), pw->date_edit, TRUE, TRUE, 0);
 
-  /* Set the dialog for the 'new' owner */
-  gnc_payment_dialog_owner_changed(pw);
+    box = glade_xml_get_widget (xml, "acct_window");
+    pw->acct_tree = GTK_WIDGET(gnc_tree_view_account_new (FALSE));
+    gtk_container_add (GTK_CONTAINER (box), pw->acct_tree);
+    gtk_tree_view_set_headers_visible (GTK_TREE_VIEW(pw->acct_tree), FALSE);
+    gnc_payment_set_account_types (GNC_TREE_VIEW_ACCOUNT (pw->acct_tree));
 
-  /* Set the dialog for the 'new' invoice */
-  pw->invoice = invoice;
-  gnc_payment_dialog_invoice_changed(pw);
+    /* Set the dialog for the 'new' owner */
+    gnc_payment_dialog_owner_changed(pw);
 
-  /* Setup signals */
-  glade_xml_signal_autoconnect_full( xml,
-                                     gnc_glade_autoconnect_full_func,
-                                     pw);
+    /* Set the dialog for the 'new' invoice */
+    pw->invoice = invoice;
+    gnc_payment_dialog_invoice_changed(pw);
 
-  g_signal_connect (G_OBJECT (pw->owner_choice), "changed",
-		    G_CALLBACK (gnc_payment_dialog_owner_changed_cb), pw);
+    /* Setup signals */
+    glade_xml_signal_autoconnect_full( xml,
+                                       gnc_glade_autoconnect_full_func,
+                                       pw);
 
-  g_signal_connect (G_OBJECT (pw->invoice_choice), "changed",
-		    G_CALLBACK (gnc_payment_dialog_invoice_changed_cb), pw);
+    g_signal_connect (G_OBJECT (pw->owner_choice), "changed",
+                      G_CALLBACK (gnc_payment_dialog_owner_changed_cb), pw);
 
-  g_signal_connect (G_OBJECT (pw->acct_tree), "row-activated",
-		    G_CALLBACK (gnc_payment_acct_tree_row_activated_cb), pw);
+    g_signal_connect (G_OBJECT (pw->invoice_choice), "changed",
+                      G_CALLBACK (gnc_payment_dialog_invoice_changed_cb), pw);
 
-  /* Register with the component manager */
-  pw->component_id =
-    gnc_register_gui_component (cm_class,
-				gnc_payment_window_refresh_handler,
-				gnc_payment_window_close_handler,
-				pw);
+    g_signal_connect (G_OBJECT (pw->acct_tree), "row-activated",
+                      G_CALLBACK (gnc_payment_acct_tree_row_activated_cb), pw);
 
-  /* Watch for any new or changed accounts */
-  gnc_gui_component_watch_entity_type (pw->component_id,
-				       GNC_ID_ACCOUNT,
-				       QOF_EVENT_CREATE | QOF_EVENT_MODIFY | 
-				       QOF_EVENT_DESTROY);
+    /* Register with the component manager */
+    pw->component_id =
+        gnc_register_gui_component (cm_class,
+                                    gnc_payment_window_refresh_handler,
+                                    gnc_payment_window_close_handler,
+                                    pw);
 
-  /* Fill in the post_combo and account_tree widgets */
-  gnc_fill_account_select_combo (pw->post_combo, pw->book, pw->acct_types, pw->acct_commodities);
-  /* Show it all */
-  gtk_widget_show_all (pw->dialog);
+    /* Watch for any new or changed accounts */
+    gnc_gui_component_watch_entity_type (pw->component_id,
+                                         GNC_ID_ACCOUNT,
+                                         QOF_EVENT_CREATE | QOF_EVENT_MODIFY |
+                                         QOF_EVENT_DESTROY);
 
-  /* Warn the user if they have no valid post-to accounts */
-  {
-    const gchar *text;
-    const char *acct_type;
+    /* Fill in the post_combo and account_tree widgets */
+    gnc_fill_account_select_combo (pw->post_combo, pw->book, pw->acct_types, pw->acct_commodities);
+    /* Show it all */
+    gtk_widget_show_all (pw->dialog);
 
-    text = gtk_combo_box_get_active_text(GTK_COMBO_BOX(pw->post_combo));
-    if (!text || safe_strcmp (text, "") == 0) {
-  
-      /* XXX: I know there's only one type here */
-      acct_type = xaccAccountGetTypeStr(GPOINTER_TO_INT(pw->acct_types->data));
-      gnc_warning_dialog(pw->dialog,
-			 _("You have no valid \"Post To\" accounts.  "
-			   "Please create an account of type \"%s\" "
-			   "before you continue to process this payment.  "
-			   "Perhaps you want to create an Invoice or "
-			   "Bill first?"),
-			 acct_type);
+    /* Warn the user if they have no valid post-to accounts */
+    {
+        const gchar *text;
+        const char *acct_type;
+
+        text = gtk_combo_box_get_active_text(GTK_COMBO_BOX(pw->post_combo));
+        if (!text || safe_strcmp (text, "") == 0)
+        {
+
+            /* XXX: I know there's only one type here */
+            acct_type = xaccAccountGetTypeStr(GPOINTER_TO_INT(pw->acct_types->data));
+            gnc_warning_dialog(pw->dialog,
+                               _("You have no valid \"Post To\" accounts.  "
+                                 "Please create an account of type \"%s\" "
+                                 "before you continue to process this payment.  "
+                                 "Perhaps you want to create an Invoice or "
+                                 "Bill first?"),
+                               acct_type);
+        }
     }
-  }
 
-  return pw;
+    return pw;
 }
 
 
 void
 gnc_ui_payment_window_destroy (PaymentWindow *pw)
 {
-  if (!pw) return;
-  gnc_close_gui_component (pw->component_id);
+    if (!pw) return;
+    gnc_close_gui_component (pw->component_id);
 }
 
 PaymentWindow *
 gnc_ui_payment_new_with_invoice (GncOwner *owner, QofBook *book,
-				 GncInvoice *invoice)
+                                 GncInvoice *invoice)
 {
-  GncOwner owner_def;
+    GncOwner owner_def;
 
-  if (!book) return NULL;
-  if (owner) {
-    /* Figure out the company */
-    owner = gncOwnerGetEndOwner (owner);
-  } else {
-    gncOwnerInitCustomer (&owner_def, NULL);
-    owner = &owner_def;
-  }
+    if (!book) return NULL;
+    if (owner)
+    {
+        /* Figure out the company */
+        owner = gncOwnerGetEndOwner (owner);
+    }
+    else
+    {
+        gncOwnerInitCustomer (&owner_def, NULL);
+        owner = &owner_def;
+    }
 
-  return new_payment_window (owner, book, invoice);
+    return new_payment_window (owner, book, invoice);
 }
 
 PaymentWindow *
 gnc_ui_payment_new (GncOwner *owner, QofBook *book)
 {
-  return gnc_ui_payment_new_with_invoice (owner, book, NULL);
+    return gnc_ui_payment_new_with_invoice (owner, book, NULL);
 }
 

Modified: gnucash/trunk/src/business/business-gnome/dialog-payment.h
===================================================================
--- gnucash/trunk/src/business/business-gnome/dialog-payment.h	2010-03-02 21:40:28 UTC (rev 18788)
+++ gnucash/trunk/src/business/business-gnome/dialog-payment.h	2010-03-02 21:41:05 UTC (rev 18789)
@@ -33,8 +33,8 @@
 /* Create a payment window */
 PaymentWindow * gnc_ui_payment_new (GncOwner *owner, QofBook *book);
 PaymentWindow * gnc_ui_payment_new_with_invoice (GncOwner *owner,
-						 QofBook *book,
-						 GncInvoice *invoice);
+        QofBook *book,
+        GncInvoice *invoice);
 
 /* Destroy a payment window */
 void gnc_ui_payment_window_destroy (PaymentWindow *pw);

Modified: gnucash/trunk/src/business/business-gnome/dialog-vendor.c
===================================================================
--- gnucash/trunk/src/business/business-gnome/dialog-vendor.c	2010-03-02 21:40:28 UTC (rev 18788)
+++ gnucash/trunk/src/business/business-gnome/dialog-vendor.c	2010-03-02 21:41:05 UTC (rev 18789)
@@ -61,461 +61,476 @@
 
 typedef enum
 {
-  NEW_VENDOR,
-  EDIT_VENDOR
+    NEW_VENDOR,
+    EDIT_VENDOR
 } VendorDialogType;
 
-struct _vendor_select_window {
-  QofBook *	book;
-  QueryNew *	q;
+struct _vendor_select_window
+{
+    QofBook *	book;
+    QueryNew *	q;
 };
 
-struct _vendor_window {
-  GtkWidget *	dialog;
+struct _vendor_window
+{
+    GtkWidget *	dialog;
 
-  GtkWidget *	id_entry;
-  GtkWidget *	company_entry;
+    GtkWidget *	id_entry;
+    GtkWidget *	company_entry;
 
-  GtkWidget *	name_entry;
-  GtkWidget *	addr1_entry;
-  GtkWidget *	addr2_entry;
-  GtkWidget *	addr3_entry;
-  GtkWidget *	addr4_entry;
-  GtkWidget *	phone_entry;
-  GtkWidget *	fax_entry;
-  GtkWidget *	email_entry;
-  GtkWidget *	terms_menu;
-  GtkWidget *	currency_edit;
+    GtkWidget *	name_entry;
+    GtkWidget *	addr1_entry;
+    GtkWidget *	addr2_entry;
+    GtkWidget *	addr3_entry;
+    GtkWidget *	addr4_entry;
+    GtkWidget *	phone_entry;
+    GtkWidget *	fax_entry;
+    GtkWidget *	email_entry;
+    GtkWidget *	terms_menu;
+    GtkWidget *	currency_edit;
 
-  GtkWidget *	active_check;
-  GtkWidget *	taxincluded_menu;
-  GtkWidget *	notes_text;
+    GtkWidget *	active_check;
+    GtkWidget *	taxincluded_menu;
+    GtkWidget *	notes_text;
 
-  GtkWidget *	taxtable_check;
-  GtkWidget *	taxtable_menu;
+    GtkWidget *	taxtable_check;
+    GtkWidget *	taxtable_menu;
 
-  GncTaxIncluded taxincluded;
-  GncBillTerm *	terms;
-  VendorDialogType	dialog_type;
-  GUID		vendor_guid;
-  gint		component_id;
-  QofBook *	book;
-  GncVendor *	created_vendor;
+    GncTaxIncluded taxincluded;
+    GncBillTerm *	terms;
+    VendorDialogType	dialog_type;
+    GUID		vendor_guid;
+    gint		component_id;
+    QofBook *	book;
+    GncVendor *	created_vendor;
 
-  GncTaxTable *	taxtable;
+    GncTaxTable *	taxtable;
 };
 
 void
 gnc_vendor_taxtable_check_cb (GtkToggleButton *togglebutton,
-				gpointer user_data)
+                              gpointer user_data)
 {
-  VendorWindow *vw = user_data;
+    VendorWindow *vw = user_data;
 
-  if (gtk_toggle_button_get_active (togglebutton))
-    gtk_widget_set_sensitive (vw->taxtable_menu, TRUE);
-  else
-    gtk_widget_set_sensitive (vw->taxtable_menu, FALSE);
+    if (gtk_toggle_button_get_active (togglebutton))
+        gtk_widget_set_sensitive (vw->taxtable_menu, TRUE);
+    else
+        gtk_widget_set_sensitive (vw->taxtable_menu, FALSE);
 }
 
 static GncVendor *
 vw_get_vendor (VendorWindow *vw)
 {
-  if (!vw)
-    return NULL;
+    if (!vw)
+        return NULL;
 
-  return gncVendorLookup (vw->book, &vw->vendor_guid);
+    return gncVendorLookup (vw->book, &vw->vendor_guid);
 }
 
 static void gnc_ui_to_vendor (VendorWindow *vw, GncVendor *vendor)
 {
-  GtkTextBuffer* text_buffer;
-  GtkTextIter start, end;
-  gchar *text;
-  GncAddress *addr;
+    GtkTextBuffer* text_buffer;
+    GtkTextIter start, end;
+    gchar *text;
+    GncAddress *addr;
 
-  addr = gncVendorGetAddr (vendor);
+    addr = gncVendorGetAddr (vendor);
 
-  gnc_suspend_gui_refresh ();
-  gncVendorBeginEdit (vendor);
+    gnc_suspend_gui_refresh ();
+    gncVendorBeginEdit (vendor);
 
-  gncVendorSetID (vendor, gtk_editable_get_chars
-		    (GTK_EDITABLE (vw->id_entry), 0, -1));
-  gncVendorSetName (vendor, gtk_editable_get_chars
-		      (GTK_EDITABLE (vw->company_entry), 0, -1));
+    gncVendorSetID (vendor, gtk_editable_get_chars
+                    (GTK_EDITABLE (vw->id_entry), 0, -1));
+    gncVendorSetName (vendor, gtk_editable_get_chars
+                      (GTK_EDITABLE (vw->company_entry), 0, -1));
 
-  gncAddressSetName (addr, gtk_editable_get_chars
-		     (GTK_EDITABLE (vw->name_entry), 0, -1));
-  gncAddressSetAddr1 (addr, gtk_editable_get_chars
-		      (GTK_EDITABLE (vw->addr1_entry), 0, -1));
-  gncAddressSetAddr2 (addr, gtk_editable_get_chars
-		      (GTK_EDITABLE (vw->addr2_entry), 0, -1));
-  gncAddressSetAddr3 (addr, gtk_editable_get_chars
-		      (GTK_EDITABLE (vw->addr3_entry), 0, -1));
-  gncAddressSetAddr4 (addr, gtk_editable_get_chars
-		      (GTK_EDITABLE (vw->addr4_entry), 0, -1));
-  gncAddressSetPhone (addr, gtk_editable_get_chars
-		      (GTK_EDITABLE (vw->phone_entry), 0, -1));
-  gncAddressSetFax (addr, gtk_editable_get_chars
-		    (GTK_EDITABLE (vw->fax_entry), 0, -1));
-  gncAddressSetEmail (addr, gtk_editable_get_chars
-		      (GTK_EDITABLE (vw->email_entry), 0, -1));
+    gncAddressSetName (addr, gtk_editable_get_chars
+                       (GTK_EDITABLE (vw->name_entry), 0, -1));
+    gncAddressSetAddr1 (addr, gtk_editable_get_chars
+                        (GTK_EDITABLE (vw->addr1_entry), 0, -1));
+    gncAddressSetAddr2 (addr, gtk_editable_get_chars
+                        (GTK_EDITABLE (vw->addr2_entry), 0, -1));
+    gncAddressSetAddr3 (addr, gtk_editable_get_chars
+                        (GTK_EDITABLE (vw->addr3_entry), 0, -1));
+    gncAddressSetAddr4 (addr, gtk_editable_get_chars
+                        (GTK_EDITABLE (vw->addr4_entry), 0, -1));
+    gncAddressSetPhone (addr, gtk_editable_get_chars
+                        (GTK_EDITABLE (vw->phone_entry), 0, -1));
+    gncAddressSetFax (addr, gtk_editable_get_chars
+                      (GTK_EDITABLE (vw->fax_entry), 0, -1));
+    gncAddressSetEmail (addr, gtk_editable_get_chars
+                        (GTK_EDITABLE (vw->email_entry), 0, -1));
 
-  gncVendorSetActive (vendor, gtk_toggle_button_get_active
-			(GTK_TOGGLE_BUTTON (vw->active_check)));
-  gncVendorSetTaxIncluded (vendor, vw->taxincluded);
+    gncVendorSetActive (vendor, gtk_toggle_button_get_active
+                        (GTK_TOGGLE_BUTTON (vw->active_check)));
+    gncVendorSetTaxIncluded (vendor, vw->taxincluded);
 
-  text_buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW(vw->notes_text));
-  gtk_text_buffer_get_bounds (text_buffer, &start, &end);
-  text = gtk_text_buffer_get_text (text_buffer, &start, &end, FALSE);
-  gncVendorSetNotes (vendor, text);
+    text_buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW(vw->notes_text));
+    gtk_text_buffer_get_bounds (text_buffer, &start, &end);
+    text = gtk_text_buffer_get_text (text_buffer, &start, &end, FALSE);
+    gncVendorSetNotes (vendor, text);
 
-  gncVendorSetTerms (vendor, vw->terms);
-  gncVendorSetCurrency (vendor,
-			gnc_currency_edit_get_currency (GNC_CURRENCY_EDIT
-							   (vw->currency_edit)));
+    gncVendorSetTerms (vendor, vw->terms);
+    gncVendorSetCurrency (vendor,
+                          gnc_currency_edit_get_currency (GNC_CURRENCY_EDIT
+                                  (vw->currency_edit)));
 
-  gncVendorSetTaxTableOverride
+    gncVendorSetTaxTableOverride
     (vendor, gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (vw->taxtable_check)));
-  gncVendorSetTaxTable (vendor, vw->taxtable);
+    gncVendorSetTaxTable (vendor, vw->taxtable);
 
-  gncVendorCommitEdit (vendor);
-  gnc_resume_gui_refresh ();
+    gncVendorCommitEdit (vendor);
+    gnc_resume_gui_refresh ();
 }
 
-static gboolean check_entry_nonempty (GtkWidget *dialog, GtkWidget *entry, 
-				      const char * error_message)
+static gboolean check_entry_nonempty (GtkWidget *dialog, GtkWidget *entry,
+                                      const char * error_message)
 {
-  const char *res = gtk_entry_get_text (GTK_ENTRY (entry));
-  if (safe_strcmp (res, "") == 0) {
-    if (error_message)
-      gnc_error_dialog (dialog, "%s", error_message);
-    return TRUE;
-  }
-  return FALSE;
+    const char *res = gtk_entry_get_text (GTK_ENTRY (entry));
+    if (safe_strcmp (res, "") == 0)
+    {
+        if (error_message)
+            gnc_error_dialog (dialog, "%s", error_message);
+        return TRUE;
+    }
+    return FALSE;
 }
 
 void
 gnc_vendor_window_ok_cb (GtkWidget *widget, gpointer data)
 {
-  VendorWindow *vw = data;
-  gchar *string;
+    VendorWindow *vw = data;
+    gchar *string;
 
-  /* Check for valid company name */
-  if (check_entry_nonempty (vw->dialog, vw->company_entry,
-		   _("You must enter a company name. "
-		     "If this vendor is an individual (and not a company) "
-		     "you should set the \"company name\" and \"contact name\" "
-		     "the same.")))
-    return;
+    /* Check for valid company name */
+    if (check_entry_nonempty (vw->dialog, vw->company_entry,
+                              _("You must enter a company name. "
+                                "If this vendor is an individual (and not a company) "
+                                "you should set the \"company name\" and \"contact name\" "
+                                "the same.")))
+        return;
 
-  /* Make sure we have an address */
-  if (check_entry_nonempty (vw->dialog, vw->addr1_entry, NULL) &&
-      check_entry_nonempty (vw->dialog, vw->addr2_entry, NULL) &&
-      check_entry_nonempty (vw->dialog, vw->addr3_entry, NULL) &&
-      check_entry_nonempty (vw->dialog, vw->addr4_entry, NULL)) {
-    const char *msg = _("You must enter a payment address.");
-    gnc_error_dialog (vw->dialog, "%s", msg);
-    return;
-  }
+    /* Make sure we have an address */
+    if (check_entry_nonempty (vw->dialog, vw->addr1_entry, NULL) &&
+            check_entry_nonempty (vw->dialog, vw->addr2_entry, NULL) &&
+            check_entry_nonempty (vw->dialog, vw->addr3_entry, NULL) &&
+            check_entry_nonempty (vw->dialog, vw->addr4_entry, NULL))
+    {
+        const char *msg = _("You must enter a payment address.");
+        gnc_error_dialog (vw->dialog, "%s", msg);
+        return;
+    }
 
-  /* Check for valid id and set one if necessary */
-  if (safe_strcmp (gtk_entry_get_text (GTK_ENTRY (vw->id_entry)), "") == 0) {
-    string = g_strdup_printf ("%.6" G_GINT64_FORMAT,
-			      gncVendorNextID(vw->book));
-    gtk_entry_set_text (GTK_ENTRY (vw->id_entry), string);
-    g_free(string);
-  }
+    /* Check for valid id and set one if necessary */
+    if (safe_strcmp (gtk_entry_get_text (GTK_ENTRY (vw->id_entry)), "") == 0)
+    {
+        string = g_strdup_printf ("%.6" G_GINT64_FORMAT,
+                                  gncVendorNextID(vw->book));
+        gtk_entry_set_text (GTK_ENTRY (vw->id_entry), string);
+        g_free(string);
+    }
 
-  /* Now save it off */
-  {
-    GncVendor *vendor = vw_get_vendor (vw);
-    if (vendor) {
-      gnc_ui_to_vendor (vw, vendor);
+    /* Now save it off */
+    {
+        GncVendor *vendor = vw_get_vendor (vw);
+        if (vendor)
+        {
+            gnc_ui_to_vendor (vw, vendor);
+        }
+        vw->created_vendor = vendor;
+        vw->vendor_guid = *xaccGUIDNULL ();
     }
-    vw->created_vendor = vendor;
-    vw->vendor_guid = *xaccGUIDNULL ();
-  }
 
-  gnc_close_gui_component (vw->component_id);
+    gnc_close_gui_component (vw->component_id);
 }
 
 void
 gnc_vendor_window_cancel_cb (GtkWidget *widget, gpointer data)
 {
-  VendorWindow *vw = data;
+    VendorWindow *vw = data;
 
-  gnc_close_gui_component (vw->component_id);
+    gnc_close_gui_component (vw->component_id);
 }
 
 void
 gnc_vendor_window_help_cb (GtkWidget *widget, gpointer data)
 {
-  gnc_gnome_help(HF_HELP, HL_USAGE);
+    gnc_gnome_help(HF_HELP, HL_USAGE);
 }
 
 void
 gnc_vendor_window_destroy_cb (GtkWidget *widget, gpointer data)
 {
-  VendorWindow *vw = data;
-  GncVendor *vendor = vw_get_vendor (vw);
+    VendorWindow *vw = data;
+    GncVendor *vendor = vw_get_vendor (vw);
 
-  gnc_suspend_gui_refresh ();
+    gnc_suspend_gui_refresh ();
 
-  if (vw->dialog_type == NEW_VENDOR && vendor != NULL) {
-    gncVendorBeginEdit (vendor);
-    gncVendorDestroy (vendor);
-    vw->vendor_guid = *xaccGUIDNULL ();
-  }
+    if (vw->dialog_type == NEW_VENDOR && vendor != NULL)
+    {
+        gncVendorBeginEdit (vendor);
+        gncVendorDestroy (vendor);
+        vw->vendor_guid = *xaccGUIDNULL ();
+    }
 
-  gnc_unregister_gui_component (vw->component_id);
-  gnc_resume_gui_refresh ();
+    gnc_unregister_gui_component (vw->component_id);
+    gnc_resume_gui_refresh ();
 
-  g_free (vw);
+    g_free (vw);
 }
 
 void
 gnc_vendor_name_changed_cb (GtkWidget *widget, gpointer data)
 {
-  VendorWindow *vw = data;
-  char *name, *id, *fullname, *title;
+    VendorWindow *vw = data;
+    char *name, *id, *fullname, *title;
 
-  if (!vw)
-    return;
+    if (!vw)
+        return;
 
-  name = gtk_editable_get_chars (GTK_EDITABLE (vw->company_entry), 0, -1);
-  if (!name || *name == '\0')
-    name = g_strdup (_("<No name>"));
+    name = gtk_editable_get_chars (GTK_EDITABLE (vw->company_entry), 0, -1);
+    if (!name || *name == '\0')
+        name = g_strdup (_("<No name>"));
 
-  id = gtk_editable_get_chars (GTK_EDITABLE (vw->id_entry), 0, -1);
+    id = gtk_editable_get_chars (GTK_EDITABLE (vw->id_entry), 0, -1);
 
-  fullname = g_strconcat (name, " (", id, ")", (char *)NULL);
+    fullname = g_strconcat (name, " (", id, ")", (char *)NULL);
 
-  if (vw->dialog_type == EDIT_VENDOR)
-    title = g_strconcat (_("Edit Vendor"), " - ", fullname, (char *)NULL);
-  else
-    title = g_strconcat (_("New Vendor"), " - ", fullname, (char *)NULL);
+    if (vw->dialog_type == EDIT_VENDOR)
+        title = g_strconcat (_("Edit Vendor"), " - ", fullname, (char *)NULL);
+    else
+        title = g_strconcat (_("New Vendor"), " - ", fullname, (char *)NULL);
 
-  gtk_window_set_title (GTK_WINDOW (vw->dialog), title);
+    gtk_window_set_title (GTK_WINDOW (vw->dialog), title);
 
-  g_free (name);
-  g_free (id);
-  g_free (fullname);
-  g_free (title);
+    g_free (name);
+    g_free (id);
+    g_free (fullname);
+    g_free (title);
 }
 
 static void
 gnc_vendor_window_close_handler (gpointer user_data)
 {
-  VendorWindow *vw = user_data;
+    VendorWindow *vw = user_data;
 
-  gtk_widget_destroy (vw->dialog);
+    gtk_widget_destroy (vw->dialog);
 }
 
 static void
 gnc_vendor_window_refresh_handler (GHashTable *changes, gpointer user_data)
 {
-  VendorWindow *vw = user_data;
-  const EventInfo *info;
-  GncVendor *vendor = vw_get_vendor (vw);
+    VendorWindow *vw = user_data;
+    const EventInfo *info;
+    GncVendor *vendor = vw_get_vendor (vw);
 
-  /* If there isn't a vendor behind us, close down */
-  if (!vendor) {
-    gnc_close_gui_component (vw->component_id);
-    return;
-  }
+    /* If there isn't a vendor behind us, close down */
+    if (!vendor)
+    {
+        gnc_close_gui_component (vw->component_id);
+        return;
+    }
 
-  /* Next, close if this is a destroy event */
-  if (changes) {
-    info = gnc_gui_get_entity_events (changes, &vw->vendor_guid);
-    if (info && (info->event_mask & QOF_EVENT_DESTROY)) {
-      gnc_close_gui_component (vw->component_id);
-      return;
+    /* Next, close if this is a destroy event */
+    if (changes)
+    {
+        info = gnc_gui_get_entity_events (changes, &vw->vendor_guid);
+        if (info && (info->event_mask & QOF_EVENT_DESTROY))
+        {
+            gnc_close_gui_component (vw->component_id);
+            return;
+        }
     }
-  }
 }
 
 static gboolean
 find_handler (gpointer find_data, gpointer user_data)
 {
-  const GUID *vendor_guid = find_data;
-  VendorWindow *vw = user_data;
+    const GUID *vendor_guid = find_data;
+    VendorWindow *vw = user_data;
 
-  return(vw && guid_equal(&vw->vendor_guid, vendor_guid));
+    return(vw && guid_equal(&vw->vendor_guid, vendor_guid));
 }
 
 static VendorWindow *
 gnc_vendor_new_window (QofBook *bookp, GncVendor *vendor)
 {
-  VendorWindow *vw;
-  GladeXML *xml;
-  GtkWidget *edit, *hbox;
-  gnc_commodity *currency;
+    VendorWindow *vw;
+    GladeXML *xml;
+    GtkWidget *edit, *hbox;
+    gnc_commodity *currency;
 
-  /*
-   * Find an existing window for this vendor.  If found, bring it to
-   * the front.
-   */
-  if (vendor) {
-    GUID vendor_guid;
-    
-    vendor_guid = *gncVendorGetGUID (vendor);
-    vw = gnc_find_first_gui_component (DIALOG_EDIT_VENDOR_CM_CLASS,
-				       find_handler, &vendor_guid);
-    if (vw) {
-      gtk_window_present (GTK_WINDOW(vw->dialog));
-      return(vw);
+    /*
+     * Find an existing window for this vendor.  If found, bring it to
+     * the front.
+     */
+    if (vendor)
+    {
+        GUID vendor_guid;
+
+        vendor_guid = *gncVendorGetGUID (vendor);
+        vw = gnc_find_first_gui_component (DIALOG_EDIT_VENDOR_CM_CLASS,
+                                           find_handler, &vendor_guid);
+        if (vw)
+        {
+            gtk_window_present (GTK_WINDOW(vw->dialog));
+            return(vw);
+        }
     }
-  }
-  
-  /* Find the default currency */
-  if (vendor)
-    currency = gncVendorGetCurrency (vendor);
-  else
-    currency = gnc_default_currency ();
 
-  /*
-   * No existing employee window found.  Build a new one.
-   */
-  vw = g_new0 (VendorWindow, 1);
+    /* Find the default currency */
+    if (vendor)
+        currency = gncVendorGetCurrency (vendor);
+    else
+        currency = gnc_default_currency ();
 
-  vw->book = bookp;
+    /*
+     * No existing employee window found.  Build a new one.
+     */
+    vw = g_new0 (VendorWindow, 1);
 
-  /* Find the dialog */
-  xml = gnc_glade_xml_new ("vendor.glade", "Vendor Dialog");
-  vw->dialog = glade_xml_get_widget (xml, "Vendor Dialog");
+    vw->book = bookp;
 
-  /* Get entry points */
-  vw->id_entry = glade_xml_get_widget (xml, "id_entry");
-  vw->company_entry = glade_xml_get_widget (xml, "company_entry");
+    /* Find the dialog */
+    xml = gnc_glade_xml_new ("vendor.glade", "Vendor Dialog");
+    vw->dialog = glade_xml_get_widget (xml, "Vendor Dialog");
 
-  vw->name_entry = glade_xml_get_widget (xml, "name_entry");
-  vw->addr1_entry = glade_xml_get_widget (xml, "addr1_entry");
-  vw->addr2_entry = glade_xml_get_widget (xml, "addr2_entry");
-  vw->addr3_entry = glade_xml_get_widget (xml, "addr3_entry");
-  vw->addr4_entry = glade_xml_get_widget (xml, "addr4_entry");
-  vw->phone_entry = glade_xml_get_widget (xml, "phone_entry");
-  vw->fax_entry = glade_xml_get_widget (xml, "fax_entry");
-  vw->email_entry = glade_xml_get_widget (xml, "email_entry");
+    /* Get entry points */
+    vw->id_entry = glade_xml_get_widget (xml, "id_entry");
+    vw->company_entry = glade_xml_get_widget (xml, "company_entry");
 
-  vw->active_check = glade_xml_get_widget (xml, "active_check");
-  vw->taxincluded_menu = glade_xml_get_widget (xml, "tax_included_menu");
-  vw->notes_text = glade_xml_get_widget (xml, "notes_text");
-  vw->terms_menu = glade_xml_get_widget (xml, "terms_menu");
+    vw->name_entry = glade_xml_get_widget (xml, "name_entry");
+    vw->addr1_entry = glade_xml_get_widget (xml, "addr1_entry");
+    vw->addr2_entry = glade_xml_get_widget (xml, "addr2_entry");
+    vw->addr3_entry = glade_xml_get_widget (xml, "addr3_entry");
+    vw->addr4_entry = glade_xml_get_widget (xml, "addr4_entry");
+    vw->phone_entry = glade_xml_get_widget (xml, "phone_entry");
+    vw->fax_entry = glade_xml_get_widget (xml, "fax_entry");
+    vw->email_entry = glade_xml_get_widget (xml, "email_entry");
 
-  vw->taxtable_check = glade_xml_get_widget (xml, "taxtable_button");
-  vw->taxtable_menu = glade_xml_get_widget (xml, "taxtable_menu");
+    vw->active_check = glade_xml_get_widget (xml, "active_check");
+    vw->taxincluded_menu = glade_xml_get_widget (xml, "tax_included_menu");
+    vw->notes_text = glade_xml_get_widget (xml, "notes_text");
+    vw->terms_menu = glade_xml_get_widget (xml, "terms_menu");
 
-  /* Currency */
-  edit = gnc_currency_edit_new();
-  gnc_currency_edit_set_currency (GNC_CURRENCY_EDIT(edit), currency);
-  vw->currency_edit = edit;
+    vw->taxtable_check = glade_xml_get_widget (xml, "taxtable_button");
+    vw->taxtable_menu = glade_xml_get_widget (xml, "taxtable_menu");
 
-  hbox = glade_xml_get_widget (xml, "currency_box");
-  gtk_box_pack_start (GTK_BOX (hbox), edit, TRUE, TRUE, 0);
+    /* Currency */
+    edit = gnc_currency_edit_new();
+    gnc_currency_edit_set_currency (GNC_CURRENCY_EDIT(edit), currency);
+    vw->currency_edit = edit;
 
-  /* Setup signals */
-  glade_xml_signal_autoconnect_full( xml,
-                                     gnc_glade_autoconnect_full_func,
-                                     vw);
+    hbox = glade_xml_get_widget (xml, "currency_box");
+    gtk_box_pack_start (GTK_BOX (hbox), edit, TRUE, TRUE, 0);
 
-  /* Setup initial values */
-  if (vendor != NULL) {
-    GtkTextBuffer* text_buffer;
-    GncAddress *addr;
-    const char *string;
+    /* Setup signals */
+    glade_xml_signal_autoconnect_full( xml,
+                                       gnc_glade_autoconnect_full_func,
+                                       vw);
 
-    vw->dialog_type = EDIT_VENDOR;
-    vw->vendor_guid = *gncVendorGetGUID (vendor);
+    /* Setup initial values */
+    if (vendor != NULL)
+    {
+        GtkTextBuffer* text_buffer;
+        GncAddress *addr;
+        const char *string;
 
-    addr = gncVendorGetAddr (vendor);
+        vw->dialog_type = EDIT_VENDOR;
+        vw->vendor_guid = *gncVendorGetGUID (vendor);
 
-    gtk_entry_set_text (GTK_ENTRY (vw->id_entry), gncVendorGetID (vendor));
-    gtk_entry_set_text (GTK_ENTRY (vw->company_entry), gncVendorGetName (vendor));
+        addr = gncVendorGetAddr (vendor);
 
-    /* Setup Address */
-    gtk_entry_set_text (GTK_ENTRY (vw->name_entry), gncAddressGetName (addr));
-    gtk_entry_set_text (GTK_ENTRY (vw->addr1_entry), gncAddressGetAddr1 (addr));
-    gtk_entry_set_text (GTK_ENTRY (vw->addr2_entry), gncAddressGetAddr2 (addr));
-    gtk_entry_set_text (GTK_ENTRY (vw->addr3_entry), gncAddressGetAddr3 (addr));
-    gtk_entry_set_text (GTK_ENTRY (vw->addr4_entry), gncAddressGetAddr4 (addr));
-    gtk_entry_set_text (GTK_ENTRY (vw->phone_entry), gncAddressGetPhone (addr));
-    gtk_entry_set_text (GTK_ENTRY (vw->fax_entry), gncAddressGetFax (addr));
-    gtk_entry_set_text (GTK_ENTRY (vw->email_entry), gncAddressGetEmail (addr));
+        gtk_entry_set_text (GTK_ENTRY (vw->id_entry), gncVendorGetID (vendor));
+        gtk_entry_set_text (GTK_ENTRY (vw->company_entry), gncVendorGetName (vendor));
 
-    /* Set toggle buttons */
-    gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (vw->active_check),
-                                gncVendorGetActive (vendor));
+        /* Setup Address */
+        gtk_entry_set_text (GTK_ENTRY (vw->name_entry), gncAddressGetName (addr));
+        gtk_entry_set_text (GTK_ENTRY (vw->addr1_entry), gncAddressGetAddr1 (addr));
+        gtk_entry_set_text (GTK_ENTRY (vw->addr2_entry), gncAddressGetAddr2 (addr));
+        gtk_entry_set_text (GTK_ENTRY (vw->addr3_entry), gncAddressGetAddr3 (addr));
+        gtk_entry_set_text (GTK_ENTRY (vw->addr4_entry), gncAddressGetAddr4 (addr));
+        gtk_entry_set_text (GTK_ENTRY (vw->phone_entry), gncAddressGetPhone (addr));
+        gtk_entry_set_text (GTK_ENTRY (vw->fax_entry), gncAddressGetFax (addr));
+        gtk_entry_set_text (GTK_ENTRY (vw->email_entry), gncAddressGetEmail (addr));
 
-    string = gncVendorGetNotes (vendor);
-    text_buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW(vw->notes_text));
-    gtk_text_buffer_set_text (text_buffer, string, -1);
+        /* Set toggle buttons */
+        gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (vw->active_check),
+                                      gncVendorGetActive (vendor));
 
-    vw->component_id =
-      gnc_register_gui_component (DIALOG_EDIT_VENDOR_CM_CLASS,
-				  gnc_vendor_window_refresh_handler,
-				  gnc_vendor_window_close_handler,
-				  vw);
+        string = gncVendorGetNotes (vendor);
+        text_buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW(vw->notes_text));
+        gtk_text_buffer_set_text (text_buffer, string, -1);
 
-    vw->terms = gncVendorGetTerms (vendor);
+        vw->component_id =
+            gnc_register_gui_component (DIALOG_EDIT_VENDOR_CM_CLASS,
+                                        gnc_vendor_window_refresh_handler,
+                                        gnc_vendor_window_close_handler,
+                                        vw);
 
-  } else {
-    vendor = gncVendorCreate (bookp);
-    vw->vendor_guid = *gncVendorGetGUID (vendor);
+        vw->terms = gncVendorGetTerms (vendor);
 
-    vw->dialog_type = NEW_VENDOR;
-    vw->component_id =
-      gnc_register_gui_component (DIALOG_NEW_VENDOR_CM_CLASS,
-				  gnc_vendor_window_refresh_handler,
-				  gnc_vendor_window_close_handler,
-				  vw);
+    }
+    else
+    {
+        vendor = gncVendorCreate (bookp);
+        vw->vendor_guid = *gncVendorGetGUID (vendor);
 
-    /* XXX: Get the default Billing Terms */
-    vw->terms = NULL;
-  }
+        vw->dialog_type = NEW_VENDOR;
+        vw->component_id =
+            gnc_register_gui_component (DIALOG_NEW_VENDOR_CM_CLASS,
+                                        gnc_vendor_window_refresh_handler,
+                                        gnc_vendor_window_close_handler,
+                                        vw);
 
-  /* I know that vendor exists here -- either passed in or just created */
+        /* XXX: Get the default Billing Terms */
+        vw->terms = NULL;
+    }
 
-  vw->taxincluded = gncVendorGetTaxIncluded (vendor);
-  gnc_ui_taxincluded_optionmenu (vw->taxincluded_menu, &vw->taxincluded);
-  gnc_ui_billterms_optionmenu (vw->terms_menu, bookp, TRUE, &vw->terms);
+    /* I know that vendor exists here -- either passed in or just created */
 
-  vw->taxtable = gncVendorGetTaxTable (vendor);
-  gnc_ui_taxtables_optionmenu (vw->taxtable_menu, bookp, TRUE, &vw->taxtable);
-  gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (vw->taxtable_check),
-                                gncVendorGetTaxTableOverride (vendor));
-  gnc_vendor_taxtable_check_cb (GTK_TOGGLE_BUTTON (vw->taxtable_check), vw);
+    vw->taxincluded = gncVendorGetTaxIncluded (vendor);
+    gnc_ui_taxincluded_optionmenu (vw->taxincluded_menu, &vw->taxincluded);
+    gnc_ui_billterms_optionmenu (vw->terms_menu, bookp, TRUE, &vw->terms);
 
-  gnc_gui_component_watch_entity_type (vw->component_id,
-				       GNC_VENDOR_MODULE_NAME,
-				       QOF_EVENT_MODIFY | QOF_EVENT_DESTROY);
+    vw->taxtable = gncVendorGetTaxTable (vendor);
+    gnc_ui_taxtables_optionmenu (vw->taxtable_menu, bookp, TRUE, &vw->taxtable);
+    gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (vw->taxtable_check),
+                                  gncVendorGetTaxTableOverride (vendor));
+    gnc_vendor_taxtable_check_cb (GTK_TOGGLE_BUTTON (vw->taxtable_check), vw);
 
-  gtk_widget_show_all (vw->dialog);
+    gnc_gui_component_watch_entity_type (vw->component_id,
+                                         GNC_VENDOR_MODULE_NAME,
+                                         QOF_EVENT_MODIFY | QOF_EVENT_DESTROY);
 
-  return vw;
+    gtk_widget_show_all (vw->dialog);
+
+    return vw;
 }
 
 VendorWindow *
 gnc_ui_vendor_new (QofBook *bookp)
 {
-  VendorWindow *vw;
+    VendorWindow *vw;
 
-  /* Make sure required options exist */
-  if (!bookp) return NULL;
+    /* Make sure required options exist */
+    if (!bookp) return NULL;
 
-  vw = gnc_vendor_new_window (bookp, NULL);
-  return vw;
+    vw = gnc_vendor_new_window (bookp, NULL);
+    return vw;
 }
 
 VendorWindow *
 gnc_ui_vendor_edit (GncVendor *vendor)
 {
-  VendorWindow *vw;
+    VendorWindow *vw;
 
-  if (!vendor) return NULL;
+    if (!vendor) return NULL;
 
-  vw = gnc_vendor_new_window (gncVendorGetBook(vendor), vendor);
+    vw = gnc_vendor_new_window (gncVendorGetBook(vendor), vendor);
 
-  return vw;
+    return vw;
 }
 
 /* Functions for vendor selection widgets */
@@ -523,193 +538,197 @@
 static void
 invoice_vendor_cb (gpointer *vendor_p, gpointer user_data)
 {
-  struct _vendor_select_window *sw = user_data;
-  GncOwner owner;
-  GncVendor *vendor;
+    struct _vendor_select_window *sw = user_data;
+    GncOwner owner;
+    GncVendor *vendor;
 
-  g_return_if_fail (vendor_p && user_data);
+    g_return_if_fail (vendor_p && user_data);
 
-  vendor = *vendor_p;
+    vendor = *vendor_p;
 
-  if (!vendor)
+    if (!vendor)
+        return;
+
+    gncOwnerInitVendor (&owner, vendor);
+    gnc_invoice_search (NULL, &owner, sw->book);
     return;
-
-  gncOwnerInitVendor (&owner, vendor);
-  gnc_invoice_search (NULL, &owner, sw->book);
-  return;
 }
 
 static void
 order_vendor_cb (gpointer *vendor_p, gpointer user_data)
 {
-  struct _vendor_select_window *sw = user_data;
-  GncOwner owner;
-  GncVendor *vendor;
+    struct _vendor_select_window *sw = user_data;
+    GncOwner owner;
+    GncVendor *vendor;
 
-  g_return_if_fail (vendor_p && user_data);
+    g_return_if_fail (vendor_p && user_data);
 
-  vendor = *vendor_p;
+    vendor = *vendor_p;
 
-  if (!vendor)
+    if (!vendor)
+        return;
+
+    gncOwnerInitVendor (&owner, vendor);
+    gnc_order_search (NULL, &owner, sw->book);
     return;
-
-  gncOwnerInitVendor (&owner, vendor);
-  gnc_order_search (NULL, &owner, sw->book);
-  return;
 }
 
 static void
 jobs_vendor_cb (gpointer *vendor_p, gpointer user_data)
 {
-  struct _vendor_select_window *sw = user_data;
-  GncOwner owner;
-  GncVendor *vendor;
+    struct _vendor_select_window *sw = user_data;
+    GncOwner owner;
+    GncVendor *vendor;
 
-  g_return_if_fail (vendor_p && user_data);
+    g_return_if_fail (vendor_p && user_data);
 
-  vendor = *vendor_p;
+    vendor = *vendor_p;
 
-  if (!vendor)
+    if (!vendor)
+        return;
+
+    gncOwnerInitVendor (&owner, vendor);
+    gnc_job_search (NULL, &owner, sw->book);
     return;
-
-  gncOwnerInitVendor (&owner, vendor);
-  gnc_job_search (NULL, &owner, sw->book);
-  return;
 }
 
 static void
 payment_vendor_cb (gpointer *vendor_p, gpointer user_data)
 {
-  struct _vendor_select_window *sw = user_data;
-  GncOwner owner;
-  GncVendor *vendor;
+    struct _vendor_select_window *sw = user_data;
+    GncOwner owner;
+    GncVendor *vendor;
 
-  g_return_if_fail (vendor_p && user_data);
+    g_return_if_fail (vendor_p && user_data);
 
-  vendor = *vendor_p;
+    vendor = *vendor_p;
 
-  if (!vendor)
+    if (!vendor)
+        return;
+
+    gncOwnerInitVendor (&owner, vendor);
+    gnc_ui_payment_new (&owner, sw->book);
     return;
-
-  gncOwnerInitVendor (&owner, vendor);
-  gnc_ui_payment_new (&owner, sw->book);
-  return;
 }
 
 static void
 edit_vendor_cb (gpointer *vendor_p, gpointer user_data)
 {
-  GncVendor *vendor;
+    GncVendor *vendor;
 
-  g_return_if_fail (vendor_p && user_data);
+    g_return_if_fail (vendor_p && user_data);
 
-  vendor = *vendor_p;
+    vendor = *vendor_p;
 
-  if (!vendor)
+    if (!vendor)
+        return;
+
+    gnc_ui_vendor_edit (vendor);
     return;
-
-  gnc_ui_vendor_edit (vendor);
-  return;
 }
 
 static gpointer
 new_vendor_cb (gpointer user_data)
 {
-  struct _vendor_select_window *sw = user_data;
-  VendorWindow *vw;
-  
-  g_return_val_if_fail (user_data, NULL);
+    struct _vendor_select_window *sw = user_data;
+    VendorWindow *vw;
 
-  vw = gnc_ui_vendor_new (sw->book);
-  return vw_get_vendor (vw);
+    g_return_val_if_fail (user_data, NULL);
+
+    vw = gnc_ui_vendor_new (sw->book);
+    return vw_get_vendor (vw);
 }
 
 static void
 free_vendor_cb (gpointer user_data)
 {
-  struct _vendor_select_window *sw = user_data;
-  g_return_if_fail (sw);
+    struct _vendor_select_window *sw = user_data;
+    g_return_if_fail (sw);
 
-  gncQueryDestroy (sw->q);
-  g_free (sw);
+    gncQueryDestroy (sw->q);
+    g_free (sw);
 }
 
 GNCSearchWindow *
 gnc_vendor_search (GncVendor *start, QofBook *book)
 {
-  GNCIdType type = GNC_VENDOR_MODULE_NAME;
-  struct _vendor_select_window *sw;
-  QueryNew *q, *q2 = NULL;
-  static GList *params = NULL;
-  static GList *columns = NULL;
-  static GNCSearchCallbackButton buttons[] = { 
-    { N_("View/Edit Vendor"), edit_vendor_cb},
-    { N_("Vendor's Jobs"), jobs_vendor_cb},
-    //    { N_("Vendor Orders"), order_vendor_cb},
-    { N_("Vendor's Bills"), invoice_vendor_cb},
-    { N_("Pay Bill"), payment_vendor_cb},
-    { NULL },
-  };
-  (void)order_vendor_cb;
+    GNCIdType type = GNC_VENDOR_MODULE_NAME;
+    struct _vendor_select_window *sw;
+    QueryNew *q, *q2 = NULL;
+    static GList *params = NULL;
+    static GList *columns = NULL;
+    static GNCSearchCallbackButton buttons[] =
+    {
+        { N_("View/Edit Vendor"), edit_vendor_cb},
+        { N_("Vendor's Jobs"), jobs_vendor_cb},
+        //    { N_("Vendor Orders"), order_vendor_cb},
+        { N_("Vendor's Bills"), invoice_vendor_cb},
+        { N_("Pay Bill"), payment_vendor_cb},
+        { NULL },
+    };
+    (void)order_vendor_cb;
 
-  g_return_val_if_fail (book, NULL);
+    g_return_val_if_fail (book, NULL);
 
-  /* Build parameter list in reverse order*/
-  if (params == NULL) {
-    params = gnc_search_param_prepend (params, _("Billing Contact"), NULL, type,
-				       VENDOR_ADDR, ADDRESS_NAME, NULL);
-    params = gnc_search_param_prepend (params, _("Vendor ID"), NULL, type,
-				       VENDOR_ID, NULL);
-    params = gnc_search_param_prepend (params, _("Company Name"), NULL, type,
-				       VENDOR_NAME, NULL);
-  }
+    /* Build parameter list in reverse order*/
+    if (params == NULL)
+    {
+        params = gnc_search_param_prepend (params, _("Billing Contact"), NULL, type,
+                                           VENDOR_ADDR, ADDRESS_NAME, NULL);
+        params = gnc_search_param_prepend (params, _("Vendor ID"), NULL, type,
+                                           VENDOR_ID, NULL);
+        params = gnc_search_param_prepend (params, _("Company Name"), NULL, type,
+                                           VENDOR_NAME, NULL);
+    }
 
-  /* Build the column list in reverse order */
-  if (columns == NULL) {
-    columns = gnc_search_param_prepend (columns, _("Contact"), NULL, type,
-					VENDOR_ADDR, ADDRESS_NAME, NULL);
-    columns = gnc_search_param_prepend (columns, _("Company"), NULL, type,
-					VENDOR_NAME, NULL);
-    columns = gnc_search_param_prepend (columns, _("ID #"), NULL, type,
-					VENDOR_ID, NULL);
-  }
+    /* Build the column list in reverse order */
+    if (columns == NULL)
+    {
+        columns = gnc_search_param_prepend (columns, _("Contact"), NULL, type,
+                                            VENDOR_ADDR, ADDRESS_NAME, NULL);
+        columns = gnc_search_param_prepend (columns, _("Company"), NULL, type,
+                                            VENDOR_NAME, NULL);
+        columns = gnc_search_param_prepend (columns, _("ID #"), NULL, type,
+                                            VENDOR_ID, NULL);
+    }
 
-  /* Build the queries */
-  q = gncQueryCreateFor (type);
-  gncQuerySetBook (q, book);
+    /* Build the queries */
+    q = gncQueryCreateFor (type);
+    gncQuerySetBook (q, book);
 
 #if 0
-  if (start) {
-    q2 = gncQueryCopy (q);
-    gncQueryAddGUIDMatch (q2, g_slist_prepend (NULL, QUERY_PARAM_GUID),
-			  gncVendorGetGUID (start), QUERY_AND);
-  }
+    if (start)
+    {
+        q2 = gncQueryCopy (q);
+        gncQueryAddGUIDMatch (q2, g_slist_prepend (NULL, QUERY_PARAM_GUID),
+                              gncVendorGetGUID (start), QUERY_AND);
+    }
 #endif
 
-  /* launch select dialog and return the result */
-  sw = g_new0 (struct _vendor_select_window, 1);
-  sw->book = book;
-  sw->q = q;
+    /* launch select dialog and return the result */
+    sw = g_new0 (struct _vendor_select_window, 1);
+    sw->book = book;
+    sw->q = q;
 
-  return gnc_search_dialog_create (type, _("Find Vendor"),
-				   params, columns, q, q2, buttons, NULL,
-				   new_vendor_cb, sw, free_vendor_cb,
-				   GCONF_SECTION_SEARCH, NULL);
+    return gnc_search_dialog_create (type, _("Find Vendor"),
+                                     params, columns, q, q2, buttons, NULL,
+                                     new_vendor_cb, sw, free_vendor_cb,
+                                     GCONF_SECTION_SEARCH, NULL);
 }
 
 GNCSearchWindow *
 gnc_vendor_search_select (gpointer start, gpointer book)
 {
-  if (!book) return NULL;
+    if (!book) return NULL;
 
-  return gnc_vendor_search (start, book);
+    return gnc_vendor_search (start, book);
 }
 
 GNCSearchWindow *
 gnc_vendor_search_edit (gpointer start, gpointer book)
 {
-  if (start)
-    gnc_ui_vendor_edit (start);
+    if (start)
+        gnc_ui_vendor_edit (start);
 
-  return NULL;
+    return NULL;
 }

Modified: gnucash/trunk/src/business/business-gnome/gnc-plugin-business.c
===================================================================
--- gnucash/trunk/src/business/business-gnome/gnc-plugin-business.c	2010-03-02 21:40:28 UTC (rev 18788)
+++ gnucash/trunk/src/business/business-gnome/gnc-plugin-business.c	2010-03-02 21:41:05 UTC (rev 18789)
@@ -1,5 +1,5 @@
-/* 
- * gnc-plugin-business.c -- 
+/*
+ * gnc-plugin-business.c --
  *
  * Author: Jan Arne Petersen <jpetersen at uni-bonn.de>
  * Copyright (C) 2003 Jan Arne Petersen
@@ -54,79 +54,79 @@
 
 /* Command callbacks */
 static void gnc_plugin_business_cmd_customer_new_customer    (GtkAction *action,
-							      GncMainWindowActionData *data);
+        GncMainWindowActionData *data);
 static void gnc_plugin_business_cmd_customer_find_customer   (GtkAction *action,
-							      GncMainWindowActionData *data);
+        GncMainWindowActionData *data);
 static void gnc_plugin_business_cmd_customer_new_invoice     (GtkAction *action,
-							      GncMainWindowActionData *data);
+        GncMainWindowActionData *data);
 static void gnc_plugin_business_cmd_customer_find_invoice    (GtkAction *action,
-							      GncMainWindowActionData *data);
+        GncMainWindowActionData *data);
 static void gnc_plugin_business_cmd_customer_new_job         (GtkAction *action,
-							      GncMainWindowActionData *data);
+        GncMainWindowActionData *data);
 static void gnc_plugin_business_cmd_customer_find_job        (GtkAction *action,
-							      GncMainWindowActionData *data);
+        GncMainWindowActionData *data);
 static void gnc_plugin_business_cmd_customer_process_payment (GtkAction *action,
-							      GncMainWindowActionData *data);
+        GncMainWindowActionData *data);
 
 static void gnc_plugin_business_cmd_vendor_new_vendor      (GtkAction *action,
-							    GncMainWindowActionData *data);
+        GncMainWindowActionData *data);
 static void gnc_plugin_business_cmd_vendor_find_vendor     (GtkAction *action,
-							    GncMainWindowActionData *data);
+        GncMainWindowActionData *data);
 static void gnc_plugin_business_cmd_vendor_new_bill        (GtkAction *action,
-							    GncMainWindowActionData *data);
+        GncMainWindowActionData *data);
 static void gnc_plugin_business_cmd_vendor_find_bill       (GtkAction *action,
-							    GncMainWindowActionData *data);
+        GncMainWindowActionData *data);
 static void gnc_plugin_business_cmd_vendor_new_job         (GtkAction *action,
-							    GncMainWindowActionData *data);
+        GncMainWindowActionData *data);
 static void gnc_plugin_business_cmd_vendor_find_job        (GtkAction *action,
-							    GncMainWindowActionData *data);
+        GncMainWindowActionData *data);
 static void gnc_plugin_business_cmd_vendor_process_payment (GtkAction *action,
-							    GncMainWindowActionData *data);
+        GncMainWindowActionData *data);
 
 static void gnc_plugin_business_cmd_employee_new_employee         (GtkAction *action,
-								   GncMainWindowActionData *data);
+        GncMainWindowActionData *data);
 static void gnc_plugin_business_cmd_employee_find_employee        (GtkAction *action,
-								   GncMainWindowActionData *data);
+        GncMainWindowActionData *data);
 static void gnc_plugin_business_cmd_employee_new_expense_voucher  (GtkAction *action,
-								   GncMainWindowActionData *data);
+        GncMainWindowActionData *data);
 static void gnc_plugin_business_cmd_employee_find_expense_voucher (GtkAction *action,
-								   GncMainWindowActionData *data);
+        GncMainWindowActionData *data);
 static void gnc_plugin_business_cmd_employee_process_payment      (GtkAction *action,
-								   GncMainWindowActionData *data);
+        GncMainWindowActionData *data);
 
 static void gnc_plugin_business_cmd_tax_tables         (GtkAction *action,
-							GncMainWindowActionData *data);
+        GncMainWindowActionData *data);
 static void gnc_plugin_business_cmd_billing_terms      (GtkAction *action,
-							GncMainWindowActionData *data);
+        GncMainWindowActionData *data);
 static void gnc_plugin_business_cmd_bills_due_reminder (GtkAction *action,
-							GncMainWindowActionData *data);
+        GncMainWindowActionData *data);
 
 static void gnc_plugin_business_cmd_export_invoice  (GtkAction *action,
-						     GncMainWindowActionData *data);
+        GncMainWindowActionData *data);
 
 static void gnc_plugin_business_cmd_export_customer (GtkAction *action,
-						     GncMainWindowActionData *data);
+        GncMainWindowActionData *data);
 
 static void gnc_plugin_business_cmd_export_vendor   (GtkAction *action,
-						     GncMainWindowActionData *data);
+        GncMainWindowActionData *data);
 
 static void gnc_plugin_business_cmd_export_employee (GtkAction *action,
-						     GncMainWindowActionData *data);
+        GncMainWindowActionData *data);
 
 static void gnc_plugin_business_cmd_test_search (GtkAction *action,
-						 GncMainWindowActionData *data);
+        GncMainWindowActionData *data);
 
 static void gnc_plugin_business_cmd_test_reload_invoice_report (GtkAction *action,
-								GncMainWindowActionData *data);
+        GncMainWindowActionData *data);
 
 static void gnc_plugin_business_cmd_test_reload_owner_report (GtkAction *action,
-							      GncMainWindowActionData *data);
+        GncMainWindowActionData *data);
 
 static void gnc_plugin_business_cmd_test_reload_receivable_report (GtkAction *action,
-								   GncMainWindowActionData *data);
+        GncMainWindowActionData *data);
 
 static void gnc_plugin_business_cmd_test_init_data (GtkAction *action,
-						    GncMainWindowActionData *data);
+        GncMainWindowActionData *data);
 
 /*static void gnc_plugin_business_cmd_export_report   (GtkAction *action,
 						      GncMainWindowActionData *data);*/
@@ -142,118 +142,180 @@
  */
 static GncMainWindow *last_window = NULL;
 
-static GtkActionEntry gnc_plugin_actions [] = 
+static GtkActionEntry gnc_plugin_actions [] =
 {
-	/* Toplevel */
-	{ "BusinessAction", NULL, N_("_Business"), NULL, NULL, NULL },
+    /* Toplevel */
+    { "BusinessAction", NULL, N_("_Business"), NULL, NULL, NULL },
 
-	/* Customer submenu */
-	{ "CustomerMenuAction", NULL, N_("_Customer"), NULL, NULL, NULL },
-	{ "CustomerNewCustomerOpenAction", NULL, N_("_New Customer..."), NULL,
-	  N_("Open the New Customer dialog"),
-	  G_CALLBACK (gnc_plugin_business_cmd_customer_new_customer) },
-	{ "CustomerFindCustomerOpenAction", NULL, N_("_Find Customer..."), NULL,
-	  N_("Open the Find Customer dialog"),
-	  G_CALLBACK (gnc_plugin_business_cmd_customer_find_customer) },
-	{ "CustomerNewInvoiceOpenAction", NULL, N_("New _Invoice..."), NULL,
-	  N_("Open the New Invoice dialog"),
-	  G_CALLBACK (gnc_plugin_business_cmd_customer_new_invoice) },
-	{ "CustomerFindInvoiceOpenAction", NULL, N_("Find In_voice..."), NULL,
-	  N_("Open the Find Invoice dialog"),
-	  G_CALLBACK (gnc_plugin_business_cmd_customer_find_invoice) },
-	{ "CustomerNewJobOpenAction", NULL, N_("New _Job..."), NULL,
-	  N_("Open the New Job dialog"),
-	  G_CALLBACK (gnc_plugin_business_cmd_customer_new_job) },
-	{ "CustomerFindJobOpenAction", NULL, N_("Find Jo_b..."), NULL,
-	  N_("Open the Find Job dialog"),
-	  G_CALLBACK (gnc_plugin_business_cmd_customer_find_job) },
-	{ "CustomerProcessPaymentAction", NULL, N_("_Process Payment..."), NULL,
-	  N_("Open the Process Payment dialog"),
-	  G_CALLBACK (gnc_plugin_business_cmd_customer_process_payment) },
+    /* Customer submenu */
+    { "CustomerMenuAction", NULL, N_("_Customer"), NULL, NULL, NULL },
+    {
+        "CustomerNewCustomerOpenAction", NULL, N_("_New Customer..."), NULL,
+        N_("Open the New Customer dialog"),
+        G_CALLBACK (gnc_plugin_business_cmd_customer_new_customer)
+    },
+    {
+        "CustomerFindCustomerOpenAction", NULL, N_("_Find Customer..."), NULL,
+        N_("Open the Find Customer dialog"),
+        G_CALLBACK (gnc_plugin_business_cmd_customer_find_customer)
+    },
+    {
+        "CustomerNewInvoiceOpenAction", NULL, N_("New _Invoice..."), NULL,
+        N_("Open the New Invoice dialog"),
+        G_CALLBACK (gnc_plugin_business_cmd_customer_new_invoice)
+    },
+    {
+        "CustomerFindInvoiceOpenAction", NULL, N_("Find In_voice..."), NULL,
+        N_("Open the Find Invoice dialog"),
+        G_CALLBACK (gnc_plugin_business_cmd_customer_find_invoice)
+    },
+    {
+        "CustomerNewJobOpenAction", NULL, N_("New _Job..."), NULL,
+        N_("Open the New Job dialog"),
+        G_CALLBACK (gnc_plugin_business_cmd_customer_new_job)
+    },
+    {
+        "CustomerFindJobOpenAction", NULL, N_("Find Jo_b..."), NULL,
+        N_("Open the Find Job dialog"),
+        G_CALLBACK (gnc_plugin_business_cmd_customer_find_job)
+    },
+    {
+        "CustomerProcessPaymentAction", NULL, N_("_Process Payment..."), NULL,
+        N_("Open the Process Payment dialog"),
+        G_CALLBACK (gnc_plugin_business_cmd_customer_process_payment)
+    },
 
-	/* Vendor submenu */
-	{ "VendorMenuAction", NULL, N_("_Vendor"), NULL, NULL, NULL },
-	{ "VendorNewVendorOpenAction", NULL, N_("_New Vendor..."), NULL,
-	  N_("Open the New Vendor dialog"),
-	  G_CALLBACK (gnc_plugin_business_cmd_vendor_new_vendor) },
-	{ "VendorFindVendorOpenAction", NULL, N_("_Find Vendor..."), NULL,
-	  N_("Open the Find Vendor dialog"),
-	  G_CALLBACK (gnc_plugin_business_cmd_vendor_find_vendor) },
-	{ "VendorNewBillOpenAction", NULL, N_("New _Bill..."), NULL,
-	  N_("Open the New Bill dialog"),
-	  G_CALLBACK (gnc_plugin_business_cmd_vendor_new_bill) },
-	{ "VendorFindBillOpenAction", NULL, N_("Find Bi_ll..."), NULL,
-	  N_("Open the Find Bill dialog"),
-	  G_CALLBACK (gnc_plugin_business_cmd_vendor_find_bill) },
-	{ "VendorNewJobOpenAction", NULL, N_("New _Job..."), NULL,
-	  N_("Open the New Job dialog"),
-	  G_CALLBACK (gnc_plugin_business_cmd_vendor_new_job) },
-	{ "VendorFindJobOpenAction", NULL, N_("Find Jo_b..."), NULL,
-	  N_("Open the Find Job dialog"),
-	  G_CALLBACK (gnc_plugin_business_cmd_vendor_find_job) },
-	{ "VendorProcessPaymentAction", NULL, N_("_Process Payment..."), NULL,
-	  N_("Open the Process Payment dialog"),
-	  G_CALLBACK (gnc_plugin_business_cmd_vendor_process_payment) },
+    /* Vendor submenu */
+    { "VendorMenuAction", NULL, N_("_Vendor"), NULL, NULL, NULL },
+    {
+        "VendorNewVendorOpenAction", NULL, N_("_New Vendor..."), NULL,
+        N_("Open the New Vendor dialog"),
+        G_CALLBACK (gnc_plugin_business_cmd_vendor_new_vendor)
+    },
+    {
+        "VendorFindVendorOpenAction", NULL, N_("_Find Vendor..."), NULL,
+        N_("Open the Find Vendor dialog"),
+        G_CALLBACK (gnc_plugin_business_cmd_vendor_find_vendor)
+    },
+    {
+        "VendorNewBillOpenAction", NULL, N_("New _Bill..."), NULL,
+        N_("Open the New Bill dialog"),
+        G_CALLBACK (gnc_plugin_business_cmd_vendor_new_bill)
+    },
+    {
+        "VendorFindBillOpenAction", NULL, N_("Find Bi_ll..."), NULL,
+        N_("Open the Find Bill dialog"),
+        G_CALLBACK (gnc_plugin_business_cmd_vendor_find_bill)
+    },
+    {
+        "VendorNewJobOpenAction", NULL, N_("New _Job..."), NULL,
+        N_("Open the New Job dialog"),
+        G_CALLBACK (gnc_plugin_business_cmd_vendor_new_job)
+    },
+    {
+        "VendorFindJobOpenAction", NULL, N_("Find Jo_b..."), NULL,
+        N_("Open the Find Job dialog"),
+        G_CALLBACK (gnc_plugin_business_cmd_vendor_find_job)
+    },
+    {
+        "VendorProcessPaymentAction", NULL, N_("_Process Payment..."), NULL,
+        N_("Open the Process Payment dialog"),
+        G_CALLBACK (gnc_plugin_business_cmd_vendor_process_payment)
+    },
 
-	/* Employee submenu */
-	{ "EmployeeMenuAction", NULL, N_("_Employee"), NULL, NULL, NULL },
-	{ "EmployeeNewEmployeeOpenAction", NULL, N_("_New Employee..."), NULL,
-	  N_("Open the New Employee dialog"),
-	  G_CALLBACK (gnc_plugin_business_cmd_employee_new_employee) },
-	{ "EmployeeFindEmployeeOpenAction", NULL, N_("_Find Employee..."), NULL,
-	  N_("Open the Find Employee dialog"),
-	  G_CALLBACK (gnc_plugin_business_cmd_employee_find_employee) },
-	{ "EmployeeNewExpenseVoucherOpenAction", NULL, N_("New _Expense Voucher..."), NULL,
-	  N_("Open the New Expense Voucher dialog"),
-	  G_CALLBACK (gnc_plugin_business_cmd_employee_new_expense_voucher) },
-	{ "EmployeeFindExpenseVoucherOpenAction", NULL, N_("Find Expense _Voucher..."), NULL,
-	  N_("Open the Find Expense Voucher dialog"),
-	  G_CALLBACK (gnc_plugin_business_cmd_employee_find_expense_voucher) },
-	{ "EmployeeProcessPaymentAction", NULL, N_("_Process Payment..."), NULL,
-	  N_("Open the Process Payment dialog"),
-	  G_CALLBACK (gnc_plugin_business_cmd_employee_process_payment) },
+    /* Employee submenu */
+    { "EmployeeMenuAction", NULL, N_("_Employee"), NULL, NULL, NULL },
+    {
+        "EmployeeNewEmployeeOpenAction", NULL, N_("_New Employee..."), NULL,
+        N_("Open the New Employee dialog"),
+        G_CALLBACK (gnc_plugin_business_cmd_employee_new_employee)
+    },
+    {
+        "EmployeeFindEmployeeOpenAction", NULL, N_("_Find Employee..."), NULL,
+        N_("Open the Find Employee dialog"),
+        G_CALLBACK (gnc_plugin_business_cmd_employee_find_employee)
+    },
+    {
+        "EmployeeNewExpenseVoucherOpenAction", NULL, N_("New _Expense Voucher..."), NULL,
+        N_("Open the New Expense Voucher dialog"),
+        G_CALLBACK (gnc_plugin_business_cmd_employee_new_expense_voucher)
+    },
+    {
+        "EmployeeFindExpenseVoucherOpenAction", NULL, N_("Find Expense _Voucher..."), NULL,
+        N_("Open the Find Expense Voucher dialog"),
+        G_CALLBACK (gnc_plugin_business_cmd_employee_find_expense_voucher)
+    },
+    {
+        "EmployeeProcessPaymentAction", NULL, N_("_Process Payment..."), NULL,
+        N_("Open the Process Payment dialog"),
+        G_CALLBACK (gnc_plugin_business_cmd_employee_process_payment)
+    },
 
-	/* Other menu items */
-	{ "TaxTablesOpenAction", NULL, N_("Sales _Tax Table"), NULL,
-	  N_("View and edit the list of Sales Tax Tables (GST/VAT)"),
-	  G_CALLBACK (gnc_plugin_business_cmd_tax_tables) },
-	{ "BillingTermsOpenAction", NULL, N_("_Billing Terms Editor"), NULL,
-	  N_("View and edit the list of Billing Terms"),
-	  G_CALLBACK (gnc_plugin_business_cmd_billing_terms) },
-	{ "BillsDueReminderOpenAction", NULL, N_("Bills _Due Reminder"), NULL,
-	  N_("Open the Bills Due Reminder dialog"),
-	  G_CALLBACK (gnc_plugin_business_cmd_bills_due_reminder) },
-	{ "ExportMenuAction", NULL, N_("E_xport"), NULL, NULL, NULL },
-	{ "QSFInvoiceAction", NULL, N_("QSF _Invoice..."), NULL,
-	  N_("Export one or more invoices to QSF"),
-	  G_CALLBACK (gnc_plugin_business_cmd_export_invoice) },
-	{ "QSFCustomerAction", NULL, N_("QSF _Customer..."), NULL,
-	  N_("Export one or more customers to QSF"),
-	  G_CALLBACK (gnc_plugin_business_cmd_export_customer) },
-	{ "QSFVendorAction", NULL, N_("QSF _Vendor..."), NULL,
-	  N_("Export one or more vendors to QSF"),
-	  G_CALLBACK (gnc_plugin_business_cmd_export_vendor) },
-	{ "QSFEmployeeAction", NULL, N_("QSF _Employee..."), NULL,
-	  N_("Export one or more employees to QSF"),
-	  G_CALLBACK (gnc_plugin_business_cmd_export_employee) },
+    /* Other menu items */
+    {
+        "TaxTablesOpenAction", NULL, N_("Sales _Tax Table"), NULL,
+        N_("View and edit the list of Sales Tax Tables (GST/VAT)"),
+        G_CALLBACK (gnc_plugin_business_cmd_tax_tables)
+    },
+    {
+        "BillingTermsOpenAction", NULL, N_("_Billing Terms Editor"), NULL,
+        N_("View and edit the list of Billing Terms"),
+        G_CALLBACK (gnc_plugin_business_cmd_billing_terms)
+    },
+    {
+        "BillsDueReminderOpenAction", NULL, N_("Bills _Due Reminder"), NULL,
+        N_("Open the Bills Due Reminder dialog"),
+        G_CALLBACK (gnc_plugin_business_cmd_bills_due_reminder)
+    },
+    { "ExportMenuAction", NULL, N_("E_xport"), NULL, NULL, NULL },
+    {
+        "QSFInvoiceAction", NULL, N_("QSF _Invoice..."), NULL,
+        N_("Export one or more invoices to QSF"),
+        G_CALLBACK (gnc_plugin_business_cmd_export_invoice)
+    },
+    {
+        "QSFCustomerAction", NULL, N_("QSF _Customer..."), NULL,
+        N_("Export one or more customers to QSF"),
+        G_CALLBACK (gnc_plugin_business_cmd_export_customer)
+    },
+    {
+        "QSFVendorAction", NULL, N_("QSF _Vendor..."), NULL,
+        N_("Export one or more vendors to QSF"),
+        G_CALLBACK (gnc_plugin_business_cmd_export_vendor)
+    },
+    {
+        "QSFEmployeeAction", NULL, N_("QSF _Employee..."), NULL,
+        N_("Export one or more employees to QSF"),
+        G_CALLBACK (gnc_plugin_business_cmd_export_employee)
+    },
 
-	/* Extensions Menu */
-	{ "BusinessTestAction", NULL, N_("_Business"), NULL, NULL, NULL },
-	{ "BusinessTestSearchAction", NULL, N_("Test Search Dialog"), NULL,
-	  N_("Test Search Dialog"),
-	  G_CALLBACK (gnc_plugin_business_cmd_test_search) },
-	{ "BusinessTestReloadInvoiceAction", NULL, N_("Reload invoice report"), NULL,
-	  N_("Reload invoice report scheme file"),
-	  G_CALLBACK (gnc_plugin_business_cmd_test_reload_invoice_report) },
-	{ "BusinessTestReloadOwnerAction", NULL, N_("Reload owner report"), NULL,
-	  N_("Reload owner report scheme file"),
-	  G_CALLBACK (gnc_plugin_business_cmd_test_reload_owner_report) },
-	{ "BusinessTestReloadReceivableAction", NULL, N_("Reload receivable report"), NULL,
-	  N_("Reload receivable report scheme file"),
-	  G_CALLBACK (gnc_plugin_business_cmd_test_reload_receivable_report) },
-	{ "BusinessTestInitDataAction", NULL, N_("Initialize Test Data"), NULL,
-	  N_("Initialize Test Data"),
-	  G_CALLBACK (gnc_plugin_business_cmd_test_init_data) },
+    /* Extensions Menu */
+    { "BusinessTestAction", NULL, N_("_Business"), NULL, NULL, NULL },
+    {
+        "BusinessTestSearchAction", NULL, N_("Test Search Dialog"), NULL,
+        N_("Test Search Dialog"),
+        G_CALLBACK (gnc_plugin_business_cmd_test_search)
+    },
+    {
+        "BusinessTestReloadInvoiceAction", NULL, N_("Reload invoice report"), NULL,
+        N_("Reload invoice report scheme file"),
+        G_CALLBACK (gnc_plugin_business_cmd_test_reload_invoice_report)
+    },
+    {
+        "BusinessTestReloadOwnerAction", NULL, N_("Reload owner report"), NULL,
+        N_("Reload owner report scheme file"),
+        G_CALLBACK (gnc_plugin_business_cmd_test_reload_owner_report)
+    },
+    {
+        "BusinessTestReloadReceivableAction", NULL, N_("Reload receivable report"), NULL,
+        N_("Reload receivable report scheme file"),
+        G_CALLBACK (gnc_plugin_business_cmd_test_reload_receivable_report)
+    },
+    {
+        "BusinessTestInitDataAction", NULL, N_("Initialize Test Data"), NULL,
+        N_("Initialize Test Data"),
+        G_CALLBACK (gnc_plugin_business_cmd_test_init_data)
+    },
 };
 static guint gnc_plugin_n_actions = G_N_ELEMENTS (gnc_plugin_actions);
 
@@ -264,9 +326,9 @@
 
 typedef struct GncPluginBusinessPrivate
 {
-	GncOwner *last_customer;
-	GncOwner *last_vendor;
-	GncOwner *last_employee;
+    GncOwner *last_customer;
+    GncOwner *last_vendor;
+    GncOwner *last_employee;
 } GncPluginBusinessPrivate;
 
 #define GNC_PLUGIN_BUSINESS_GET_PRIVATE(o)  \
@@ -277,94 +339,96 @@
 GType
 gnc_plugin_business_get_type (void)
 {
-	static GType gnc_plugin_business_type = 0;
+    static GType gnc_plugin_business_type = 0;
 
-	if (gnc_plugin_business_type == 0) {
-		static const GTypeInfo our_info = {
-			sizeof (GncPluginBusinessClass),
-			NULL,		/* base_init */
-			NULL,		/* base_finalize */
-			(GClassInitFunc) gnc_plugin_business_class_init,
-			NULL,		/* class_finalize */
-			NULL,		/* class_data */
-			sizeof (GncPluginBusiness),
-			0,		/* n_preallocs */
-			(GInstanceInitFunc) gnc_plugin_business_init
-		};
-		
-		gnc_plugin_business_type = g_type_register_static (GNC_TYPE_PLUGIN,
-								   "GncPluginBusiness",
-								   &our_info, 0);
-	}
+    if (gnc_plugin_business_type == 0)
+    {
+        static const GTypeInfo our_info =
+        {
+            sizeof (GncPluginBusinessClass),
+            NULL,		/* base_init */
+            NULL,		/* base_finalize */
+            (GClassInitFunc) gnc_plugin_business_class_init,
+            NULL,		/* class_finalize */
+            NULL,		/* class_data */
+            sizeof (GncPluginBusiness),
+            0,		/* n_preallocs */
+            (GInstanceInitFunc) gnc_plugin_business_init
+        };
 
-	return gnc_plugin_business_type;
+        gnc_plugin_business_type = g_type_register_static (GNC_TYPE_PLUGIN,
+                                   "GncPluginBusiness",
+                                   &our_info, 0);
+    }
+
+    return gnc_plugin_business_type;
 }
 
 GncPlugin *
 gnc_plugin_business_new (void)
 {
-	GncPluginBusiness *plugin;
+    GncPluginBusiness *plugin;
 
-	/* Reference the invoice page plugin to ensure it exists in
-	 * the gtk type system. */
-	GNC_TYPE_PLUGIN_PAGE_INVOICE;
+    /* Reference the invoice page plugin to ensure it exists in
+     * the gtk type system. */
+    GNC_TYPE_PLUGIN_PAGE_INVOICE;
 
-	plugin = g_object_new (GNC_TYPE_PLUGIN_BUSINESS,
-			      (char *)NULL);
+    plugin = g_object_new (GNC_TYPE_PLUGIN_BUSINESS,
+                           (char *)NULL);
 
-	return GNC_PLUGIN (plugin);
+    return GNC_PLUGIN (plugin);
 }
 
 static void
 gnc_plugin_business_class_init (GncPluginBusinessClass *klass)
 {
-	GObjectClass *object_class = G_OBJECT_CLASS (klass);
-	GncPluginClass *plugin_class = GNC_PLUGIN_CLASS (klass);
+    GObjectClass *object_class = G_OBJECT_CLASS (klass);
+    GncPluginClass *plugin_class = GNC_PLUGIN_CLASS (klass);
 
-	parent_class = g_type_class_peek_parent (klass);
+    parent_class = g_type_class_peek_parent (klass);
 
-	object_class->finalize = gnc_plugin_business_finalize;
+    object_class->finalize = gnc_plugin_business_finalize;
 
-	/* plugin info */
-	plugin_class->plugin_name  = GNC_PLUGIN_BUSINESS_NAME;
+    /* plugin info */
+    plugin_class->plugin_name  = GNC_PLUGIN_BUSINESS_NAME;
 
-	/* widget addition/removal */
-	plugin_class->actions_name = PLUGIN_ACTIONS_NAME;
-	plugin_class->actions      = gnc_plugin_actions;
-	plugin_class->n_actions    = gnc_plugin_n_actions;
-	plugin_class->ui_filename  = PLUGIN_UI_FILENAME;
+    /* widget addition/removal */
+    plugin_class->actions_name = PLUGIN_ACTIONS_NAME;
+    plugin_class->actions      = gnc_plugin_actions;
+    plugin_class->n_actions    = gnc_plugin_n_actions;
+    plugin_class->ui_filename  = PLUGIN_UI_FILENAME;
 
-	g_type_class_add_private(klass, sizeof(GncPluginBusinessPrivate));
+    g_type_class_add_private(klass, sizeof(GncPluginBusinessPrivate));
 }
 
 static void
 gnc_plugin_business_init (GncPluginBusiness *plugin)
 {
-	GncPluginBusinessPrivate *priv;
+    GncPluginBusinessPrivate *priv;
 
-	priv = GNC_PLUGIN_BUSINESS_GET_PRIVATE (plugin);
-	priv->last_customer = gncOwnerCreate ();
-	gncOwnerInitCustomer (priv->last_customer, NULL);
+    priv = GNC_PLUGIN_BUSINESS_GET_PRIVATE (plugin);
+    priv->last_customer = gncOwnerCreate ();
+    gncOwnerInitCustomer (priv->last_customer, NULL);
 
-	priv->last_vendor = gncOwnerCreate ();
-	gncOwnerInitVendor (priv->last_vendor, NULL);
+    priv->last_vendor = gncOwnerCreate ();
+    gncOwnerInitVendor (priv->last_vendor, NULL);
 
-	priv->last_employee = gncOwnerCreate ();
-	gncOwnerInitEmployee (priv->last_employee, NULL);
+    priv->last_employee = gncOwnerCreate ();
+    gncOwnerInitEmployee (priv->last_employee, NULL);
 }
 
 static void
 gnc_plugin_business_finalize (GObject *object)
 {
-	GncPluginBusiness *plugin;
-	GncPluginBusinessPrivate *priv;
+    GncPluginBusiness *plugin;
+    GncPluginBusinessPrivate *priv;
 
-	g_return_if_fail (GNC_IS_PLUGIN_BUSINESS (object));
+    g_return_if_fail (GNC_IS_PLUGIN_BUSINESS (object));
 
-	plugin = GNC_PLUGIN_BUSINESS (object);
-	priv = GNC_PLUGIN_BUSINESS_GET_PRIVATE (plugin);
+    plugin = GNC_PLUGIN_BUSINESS (object);
+    priv = GNC_PLUGIN_BUSINESS_GET_PRIVATE (plugin);
 
-	G_OBJECT_CLASS (parent_class)->finalize (object);
+    G_OBJECT_CLASS (parent_class)->finalize (object);
 }
 
 /************************************************************
@@ -374,7 +438,7 @@
 GncMainWindow*
 gnc_plugin_business_get_window()
 {
-  return last_window;
+    return last_window;
 }
 
 /************************************************************
@@ -383,325 +447,325 @@
 
 static void
 gnc_plugin_business_cmd_customer_new_customer (GtkAction *action,
-					       GncMainWindowActionData *mw)
+        GncMainWindowActionData *mw)
 {
-	g_return_if_fail (mw != NULL);
-	g_return_if_fail (GNC_IS_PLUGIN_BUSINESS (mw->data));
+    g_return_if_fail (mw != NULL);
+    g_return_if_fail (GNC_IS_PLUGIN_BUSINESS (mw->data));
 
-	gnc_ui_customer_new (gnc_get_current_book());
+    gnc_ui_customer_new (gnc_get_current_book());
 }
 
 static void
 gnc_plugin_business_cmd_customer_find_customer (GtkAction *action,
-						GncMainWindowActionData *mw)
+        GncMainWindowActionData *mw)
 {
-	GncPluginBusiness *plugin;
-	GncPluginBusinessPrivate *priv;
-	GncCustomer*customer;
+    GncPluginBusiness *plugin;
+    GncPluginBusinessPrivate *priv;
+    GncCustomer*customer;
 
-	g_return_if_fail (mw != NULL);
-	g_return_if_fail (GNC_IS_PLUGIN_BUSINESS (mw->data));
+    g_return_if_fail (mw != NULL);
+    g_return_if_fail (GNC_IS_PLUGIN_BUSINESS (mw->data));
 
-	plugin = GNC_PLUGIN_BUSINESS (mw->data);
-	priv = GNC_PLUGIN_BUSINESS_GET_PRIVATE (plugin);
-	customer = gncOwnerGetCustomer (priv->last_customer);
-	gnc_customer_search (customer, gnc_get_current_book());
+    plugin = GNC_PLUGIN_BUSINESS (mw->data);
+    priv = GNC_PLUGIN_BUSINESS_GET_PRIVATE (plugin);
+    customer = gncOwnerGetCustomer (priv->last_customer);
+    gnc_customer_search (customer, gnc_get_current_book());
 }
 
 static void
 gnc_plugin_business_cmd_customer_new_invoice (GtkAction *action,
-					      GncMainWindowActionData *mw)
+        GncMainWindowActionData *mw)
 {
-	GncPluginBusiness *plugin;
-	GncPluginBusinessPrivate *priv;
+    GncPluginBusiness *plugin;
+    GncPluginBusinessPrivate *priv;
 
-	g_return_if_fail (mw != NULL);
-	g_return_if_fail (GNC_IS_PLUGIN_BUSINESS (mw->data));
+    g_return_if_fail (mw != NULL);
+    g_return_if_fail (GNC_IS_PLUGIN_BUSINESS (mw->data));
 
-	plugin = GNC_PLUGIN_BUSINESS (mw->data);
-	priv = GNC_PLUGIN_BUSINESS_GET_PRIVATE (plugin);
-	last_window = mw->window;
-	gnc_ui_invoice_new (priv->last_customer, gnc_get_current_book());
+    plugin = GNC_PLUGIN_BUSINESS (mw->data);
+    priv = GNC_PLUGIN_BUSINESS_GET_PRIVATE (plugin);
+    last_window = mw->window;
+    gnc_ui_invoice_new (priv->last_customer, gnc_get_current_book());
 }
 
 static void
 gnc_plugin_business_cmd_customer_find_invoice (GtkAction *action,
-					       GncMainWindowActionData *mw)
+        GncMainWindowActionData *mw)
 {
-	GncPluginBusiness *plugin;
-	GncPluginBusinessPrivate *priv;
+    GncPluginBusiness *plugin;
+    GncPluginBusinessPrivate *priv;
 
-	g_return_if_fail (mw != NULL);
-	g_return_if_fail (GNC_IS_PLUGIN_BUSINESS (mw->data));
+    g_return_if_fail (mw != NULL);
+    g_return_if_fail (GNC_IS_PLUGIN_BUSINESS (mw->data));
 
-	plugin = GNC_PLUGIN_BUSINESS (mw->data);
-	priv = GNC_PLUGIN_BUSINESS_GET_PRIVATE (plugin);
-	last_window = mw->window;
-	gnc_invoice_search (NULL, priv->last_customer, gnc_get_current_book());
+    plugin = GNC_PLUGIN_BUSINESS (mw->data);
+    priv = GNC_PLUGIN_BUSINESS_GET_PRIVATE (plugin);
+    last_window = mw->window;
+    gnc_invoice_search (NULL, priv->last_customer, gnc_get_current_book());
 }
 
 static void
 gnc_plugin_business_cmd_customer_new_job (GtkAction *action,
-					  GncMainWindowActionData *mw)
+        GncMainWindowActionData *mw)
 {
-	GncPluginBusiness *plugin;
-	GncPluginBusinessPrivate *priv;
+    GncPluginBusiness *plugin;
+    GncPluginBusinessPrivate *priv;
 
-	g_return_if_fail (mw != NULL);
-	g_return_if_fail (GNC_IS_PLUGIN_BUSINESS (mw->data));
+    g_return_if_fail (mw != NULL);
+    g_return_if_fail (GNC_IS_PLUGIN_BUSINESS (mw->data));
 
-	plugin = GNC_PLUGIN_BUSINESS (mw->data);
-	priv = GNC_PLUGIN_BUSINESS_GET_PRIVATE (plugin);
-	gnc_ui_job_new (priv->last_customer, gnc_get_current_book());
+    plugin = GNC_PLUGIN_BUSINESS (mw->data);
+    priv = GNC_PLUGIN_BUSINESS_GET_PRIVATE (plugin);
+    gnc_ui_job_new (priv->last_customer, gnc_get_current_book());
 }
 
 static void
 gnc_plugin_business_cmd_customer_find_job (GtkAction *action,
-					   GncMainWindowActionData *mw)
+        GncMainWindowActionData *mw)
 {
-	GncPluginBusiness *plugin;
-	GncPluginBusinessPrivate *priv;
+    GncPluginBusiness *plugin;
+    GncPluginBusinessPrivate *priv;
 
-	g_return_if_fail (mw != NULL);
-	g_return_if_fail (GNC_IS_PLUGIN_BUSINESS (mw->data));
+    g_return_if_fail (mw != NULL);
+    g_return_if_fail (GNC_IS_PLUGIN_BUSINESS (mw->data));
 
-	plugin = GNC_PLUGIN_BUSINESS (mw->data);
-	priv = GNC_PLUGIN_BUSINESS_GET_PRIVATE (plugin);
-	gnc_job_search (NULL, priv->last_customer, gnc_get_current_book());
+    plugin = GNC_PLUGIN_BUSINESS (mw->data);
+    priv = GNC_PLUGIN_BUSINESS_GET_PRIVATE (plugin);
+    gnc_job_search (NULL, priv->last_customer, gnc_get_current_book());
 }
 
 static void
 gnc_plugin_business_cmd_customer_process_payment (GtkAction *action,
-						  GncMainWindowActionData *mw)
+        GncMainWindowActionData *mw)
 {
-	GncPluginBusiness *plugin;
-	GncPluginBusinessPrivate *priv;
+    GncPluginBusiness *plugin;
+    GncPluginBusinessPrivate *priv;
 
-	g_return_if_fail (mw != NULL);
-	g_return_if_fail (GNC_IS_PLUGIN_BUSINESS (mw->data));
+    g_return_if_fail (mw != NULL);
+    g_return_if_fail (GNC_IS_PLUGIN_BUSINESS (mw->data));
 
-	plugin = GNC_PLUGIN_BUSINESS (mw->data);
-	priv = GNC_PLUGIN_BUSINESS_GET_PRIVATE (plugin);
-	gnc_ui_payment_new (priv->last_customer, gnc_get_current_book());
+    plugin = GNC_PLUGIN_BUSINESS (mw->data);
+    priv = GNC_PLUGIN_BUSINESS_GET_PRIVATE (plugin);
+    gnc_ui_payment_new (priv->last_customer, gnc_get_current_book());
 }
 
 static void
 gnc_plugin_business_cmd_vendor_new_vendor (GtkAction *action,
-					   GncMainWindowActionData *mw)
+        GncMainWindowActionData *mw)
 {
-	g_return_if_fail (mw != NULL);
-	g_return_if_fail (GNC_IS_PLUGIN_BUSINESS (mw->data));
+    g_return_if_fail (mw != NULL);
+    g_return_if_fail (GNC_IS_PLUGIN_BUSINESS (mw->data));
 
-	gnc_ui_vendor_new (gnc_get_current_book());
+    gnc_ui_vendor_new (gnc_get_current_book());
 }
 
 static void
 gnc_plugin_business_cmd_vendor_find_vendor (GtkAction *action,
-					    GncMainWindowActionData *mw)
+        GncMainWindowActionData *mw)
 {
-	GncPluginBusiness *plugin;
-	GncPluginBusinessPrivate *priv;
-	GncVendor *vendor;
+    GncPluginBusiness *plugin;
+    GncPluginBusinessPrivate *priv;
+    GncVendor *vendor;
 
-	g_return_if_fail (mw != NULL);
-	g_return_if_fail (GNC_IS_PLUGIN_BUSINESS (mw->data));
+    g_return_if_fail (mw != NULL);
+    g_return_if_fail (GNC_IS_PLUGIN_BUSINESS (mw->data));
 
-	plugin = GNC_PLUGIN_BUSINESS (mw->data);
-	priv = GNC_PLUGIN_BUSINESS_GET_PRIVATE (plugin);
-	vendor = gncOwnerGetVendor (priv->last_vendor);
-	gnc_vendor_search (vendor, gnc_get_current_book());
+    plugin = GNC_PLUGIN_BUSINESS (mw->data);
+    priv = GNC_PLUGIN_BUSINESS_GET_PRIVATE (plugin);
+    vendor = gncOwnerGetVendor (priv->last_vendor);
+    gnc_vendor_search (vendor, gnc_get_current_book());
 }
 
 static void
 gnc_plugin_business_cmd_vendor_new_bill (GtkAction *action,
-					 GncMainWindowActionData *mw)
+        GncMainWindowActionData *mw)
 {
-	GncPluginBusiness *plugin;
-	GncPluginBusinessPrivate *priv;
+    GncPluginBusiness *plugin;
+    GncPluginBusinessPrivate *priv;
 
-	g_return_if_fail (mw != NULL);
-	g_return_if_fail (GNC_IS_PLUGIN_BUSINESS (mw->data));
+    g_return_if_fail (mw != NULL);
+    g_return_if_fail (GNC_IS_PLUGIN_BUSINESS (mw->data));
 
-	plugin = GNC_PLUGIN_BUSINESS (mw->data);
-	priv = GNC_PLUGIN_BUSINESS_GET_PRIVATE (plugin);
-	last_window = mw->window;
-	gnc_ui_invoice_new (priv->last_vendor, gnc_get_current_book());
+    plugin = GNC_PLUGIN_BUSINESS (mw->data);
+    priv = GNC_PLUGIN_BUSINESS_GET_PRIVATE (plugin);
+    last_window = mw->window;
+    gnc_ui_invoice_new (priv->last_vendor, gnc_get_current_book());
 }
 
 static void
 gnc_plugin_business_cmd_vendor_find_bill (GtkAction *action,
-					  GncMainWindowActionData *mw)
+        GncMainWindowActionData *mw)
 {
-	GncPluginBusiness *plugin;
-	GncPluginBusinessPrivate *priv;
+    GncPluginBusiness *plugin;
+    GncPluginBusinessPrivate *priv;
 
-	g_return_if_fail (mw != NULL);
-	g_return_if_fail (GNC_IS_PLUGIN_BUSINESS (mw->data));
+    g_return_if_fail (mw != NULL);
+    g_return_if_fail (GNC_IS_PLUGIN_BUSINESS (mw->data));
 
-	plugin = GNC_PLUGIN_BUSINESS (mw->data);
-	priv = GNC_PLUGIN_BUSINESS_GET_PRIVATE (plugin);
-	last_window = mw->window;
-	gnc_invoice_search (NULL, priv->last_vendor, gnc_get_current_book());
+    plugin = GNC_PLUGIN_BUSINESS (mw->data);
+    priv = GNC_PLUGIN_BUSINESS_GET_PRIVATE (plugin);
+    last_window = mw->window;
+    gnc_invoice_search (NULL, priv->last_vendor, gnc_get_current_book());
 }
 
 static void
 gnc_plugin_business_cmd_vendor_new_job (GtkAction *action,
-					GncMainWindowActionData *mw)
+                                        GncMainWindowActionData *mw)
 {
-	GncPluginBusiness *plugin;
-	GncPluginBusinessPrivate *priv;
+    GncPluginBusiness *plugin;
+    GncPluginBusinessPrivate *priv;
 
-	g_return_if_fail (mw != NULL);
-	g_return_if_fail (GNC_IS_PLUGIN_BUSINESS (mw->data));
+    g_return_if_fail (mw != NULL);
+    g_return_if_fail (GNC_IS_PLUGIN_BUSINESS (mw->data));
 
-	plugin = GNC_PLUGIN_BUSINESS (mw->data);
-	priv = GNC_PLUGIN_BUSINESS_GET_PRIVATE (plugin);
-	gnc_ui_job_new (priv->last_vendor, gnc_get_current_book());
+    plugin = GNC_PLUGIN_BUSINESS (mw->data);
+    priv = GNC_PLUGIN_BUSINESS_GET_PRIVATE (plugin);
+    gnc_ui_job_new (priv->last_vendor, gnc_get_current_book());
 }
 
 static void
 gnc_plugin_business_cmd_vendor_find_job (GtkAction *action,
-					 GncMainWindowActionData *mw)
+        GncMainWindowActionData *mw)
 {
-	GncPluginBusiness *plugin;
-	GncPluginBusinessPrivate *priv;
+    GncPluginBusiness *plugin;
+    GncPluginBusinessPrivate *priv;
 
-	g_return_if_fail (mw != NULL);
-	g_return_if_fail (GNC_IS_PLUGIN_BUSINESS (mw->data));
+    g_return_if_fail (mw != NULL);
+    g_return_if_fail (GNC_IS_PLUGIN_BUSINESS (mw->data));
 
-	plugin = GNC_PLUGIN_BUSINESS (mw->data);
-	priv = GNC_PLUGIN_BUSINESS_GET_PRIVATE (plugin);
-	gnc_job_search (NULL, priv->last_vendor, gnc_get_current_book());
+    plugin = GNC_PLUGIN_BUSINESS (mw->data);
+    priv = GNC_PLUGIN_BUSINESS_GET_PRIVATE (plugin);
+    gnc_job_search (NULL, priv->last_vendor, gnc_get_current_book());
 }
 
 static void
 gnc_plugin_business_cmd_vendor_process_payment (GtkAction *action,
-						GncMainWindowActionData *mw)
+        GncMainWindowActionData *mw)
 {
-	GncPluginBusiness *plugin;
-	GncPluginBusinessPrivate *priv;
+    GncPluginBusiness *plugin;
+    GncPluginBusinessPrivate *priv;
 
-	g_return_if_fail (mw != NULL);
-	g_return_if_fail (GNC_IS_PLUGIN_BUSINESS (mw->data));
+    g_return_if_fail (mw != NULL);
+    g_return_if_fail (GNC_IS_PLUGIN_BUSINESS (mw->data));
 
-	plugin = GNC_PLUGIN_BUSINESS (mw->data);
-	priv = GNC_PLUGIN_BUSINESS_GET_PRIVATE (plugin);
-	gnc_ui_payment_new (priv->last_vendor, gnc_get_current_book());
+    plugin = GNC_PLUGIN_BUSINESS (mw->data);
+    priv = GNC_PLUGIN_BUSINESS_GET_PRIVATE (plugin);
+    gnc_ui_payment_new (priv->last_vendor, gnc_get_current_book());
 }
 
 static void
 gnc_plugin_business_cmd_employee_new_employee (GtkAction *action,
-					       GncMainWindowActionData *mw)
+        GncMainWindowActionData *mw)
 {
-	g_return_if_fail (mw != NULL);
-	g_return_if_fail (GNC_IS_PLUGIN_BUSINESS (mw->data));
+    g_return_if_fail (mw != NULL);
+    g_return_if_fail (GNC_IS_PLUGIN_BUSINESS (mw->data));
 
-	gnc_ui_employee_new (gnc_get_current_book());
+    gnc_ui_employee_new (gnc_get_current_book());
 }
 
 static void
 gnc_plugin_business_cmd_employee_find_employee (GtkAction *action,
-						GncMainWindowActionData *mw)
+        GncMainWindowActionData *mw)
 {
-	GncPluginBusiness *plugin;
-	GncPluginBusinessPrivate *priv;
-	GncEmployee *employee;
+    GncPluginBusiness *plugin;
+    GncPluginBusinessPrivate *priv;
+    GncEmployee *employee;
 
-	g_return_if_fail (mw != NULL);
-	g_return_if_fail (GNC_IS_PLUGIN_BUSINESS (mw->data));
+    g_return_if_fail (mw != NULL);
+    g_return_if_fail (GNC_IS_PLUGIN_BUSINESS (mw->data));
 
-	plugin = GNC_PLUGIN_BUSINESS (mw->data);
-	priv = GNC_PLUGIN_BUSINESS_GET_PRIVATE (plugin);
-	employee = gncOwnerGetEmployee (priv->last_employee);
-	gnc_employee_search (employee, gnc_get_current_book());
+    plugin = GNC_PLUGIN_BUSINESS (mw->data);
+    priv = GNC_PLUGIN_BUSINESS_GET_PRIVATE (plugin);
+    employee = gncOwnerGetEmployee (priv->last_employee);
+    gnc_employee_search (employee, gnc_get_current_book());
 }
 
 static void
 gnc_plugin_business_cmd_employee_new_expense_voucher (GtkAction *action,
-						      GncMainWindowActionData *mw)
+        GncMainWindowActionData *mw)
 {
-	GncPluginBusiness *plugin;
-	GncPluginBusinessPrivate *priv;
+    GncPluginBusiness *plugin;
+    GncPluginBusinessPrivate *priv;
 
-	g_return_if_fail (mw != NULL);
-	g_return_if_fail (GNC_IS_PLUGIN_BUSINESS (mw->data));
+    g_return_if_fail (mw != NULL);
+    g_return_if_fail (GNC_IS_PLUGIN_BUSINESS (mw->data));
 
-	plugin = GNC_PLUGIN_BUSINESS (mw->data);
-	priv = GNC_PLUGIN_BUSINESS_GET_PRIVATE (plugin);
-	last_window = mw->window;
-	gnc_ui_invoice_new (priv->last_employee, gnc_get_current_book());
+    plugin = GNC_PLUGIN_BUSINESS (mw->data);
+    priv = GNC_PLUGIN_BUSINESS_GET_PRIVATE (plugin);
+    last_window = mw->window;
+    gnc_ui_invoice_new (priv->last_employee, gnc_get_current_book());
 }
 
 static void
 gnc_plugin_business_cmd_employee_find_expense_voucher (GtkAction *action,
-						       GncMainWindowActionData *mw)
+        GncMainWindowActionData *mw)
 {
-	GncPluginBusiness *plugin;
-	GncPluginBusinessPrivate *priv;
+    GncPluginBusiness *plugin;
+    GncPluginBusinessPrivate *priv;
 
-	g_return_if_fail (mw != NULL);
-	g_return_if_fail (GNC_IS_PLUGIN_BUSINESS (mw->data));
+    g_return_if_fail (mw != NULL);
+    g_return_if_fail (GNC_IS_PLUGIN_BUSINESS (mw->data));
 
-	plugin = GNC_PLUGIN_BUSINESS (mw->data);
-	priv = GNC_PLUGIN_BUSINESS_GET_PRIVATE (plugin);
-	last_window = mw->window;
-	gnc_invoice_search (NULL, priv->last_employee, gnc_get_current_book());
+    plugin = GNC_PLUGIN_BUSINESS (mw->data);
+    priv = GNC_PLUGIN_BUSINESS_GET_PRIVATE (plugin);
+    last_window = mw->window;
+    gnc_invoice_search (NULL, priv->last_employee, gnc_get_current_book());
 }
 
 static void
 gnc_plugin_business_cmd_employee_process_payment (GtkAction *action,
-						  GncMainWindowActionData *mw)
+        GncMainWindowActionData *mw)
 {
-	GncPluginBusiness *plugin;
-	GncPluginBusinessPrivate *priv;
+    GncPluginBusiness *plugin;
+    GncPluginBusinessPrivate *priv;
 
-	g_return_if_fail (mw != NULL);
-	g_return_if_fail (GNC_IS_PLUGIN_BUSINESS (mw->data));
+    g_return_if_fail (mw != NULL);
+    g_return_if_fail (GNC_IS_PLUGIN_BUSINESS (mw->data));
 
-	plugin = GNC_PLUGIN_BUSINESS (mw->data);
-	priv = GNC_PLUGIN_BUSINESS_GET_PRIVATE (plugin);
-	gnc_ui_payment_new (priv->last_employee, gnc_get_current_book());
+    plugin = GNC_PLUGIN_BUSINESS (mw->data);
+    priv = GNC_PLUGIN_BUSINESS_GET_PRIVATE (plugin);
+    gnc_ui_payment_new (priv->last_employee, gnc_get_current_book());
 }
 
 static void
 gnc_plugin_business_cmd_tax_tables (GtkAction *action,
-				    GncMainWindowActionData *mw)
+                                    GncMainWindowActionData *mw)
 {
-	GncPluginBusiness *plugin;
-	GncPluginBusinessPrivate *priv;
+    GncPluginBusiness *plugin;
+    GncPluginBusinessPrivate *priv;
 
-	g_return_if_fail (mw != NULL);
-	g_return_if_fail (GNC_IS_PLUGIN_BUSINESS (mw->data));
+    g_return_if_fail (mw != NULL);
+    g_return_if_fail (GNC_IS_PLUGIN_BUSINESS (mw->data));
 
-	plugin = GNC_PLUGIN_BUSINESS (mw->data);
-	priv = GNC_PLUGIN_BUSINESS_GET_PRIVATE (plugin);
-	gnc_ui_tax_table_window_new (gnc_get_current_book());
+    plugin = GNC_PLUGIN_BUSINESS (mw->data);
+    priv = GNC_PLUGIN_BUSINESS_GET_PRIVATE (plugin);
+    gnc_ui_tax_table_window_new (gnc_get_current_book());
 }
 
 static void
 gnc_plugin_business_cmd_billing_terms (GtkAction *action,
-				       GncMainWindowActionData *mw)
+                                       GncMainWindowActionData *mw)
 {
-	GncPluginBusiness *plugin;
-	GncPluginBusinessPrivate *priv;
+    GncPluginBusiness *plugin;
+    GncPluginBusinessPrivate *priv;
 
-	g_return_if_fail (mw != NULL);
-	g_return_if_fail (GNC_IS_PLUGIN_BUSINESS (mw->data));
+    g_return_if_fail (mw != NULL);
+    g_return_if_fail (GNC_IS_PLUGIN_BUSINESS (mw->data));
 
-	plugin = GNC_PLUGIN_BUSINESS (mw->data);
-	priv = GNC_PLUGIN_BUSINESS_GET_PRIVATE (plugin);
-	gnc_ui_billterms_window_new (gnc_get_current_book());
+    plugin = GNC_PLUGIN_BUSINESS (mw->data);
+    priv = GNC_PLUGIN_BUSINESS_GET_PRIVATE (plugin);
+    gnc_ui_billterms_window_new (gnc_get_current_book());
 }
 
 
 static void
 gnc_plugin_business_cmd_bills_due_reminder (GtkAction *action,
-					    GncMainWindowActionData *mw)
+        GncMainWindowActionData *mw)
 {
-	g_return_if_fail (mw != NULL);
-	g_return_if_fail (GNC_IS_PLUGIN_BUSINESS (mw->data));
+    g_return_if_fail (mw != NULL);
+    g_return_if_fail (GNC_IS_PLUGIN_BUSINESS (mw->data));
 
-	gnc_invoice_remind_bills_due();
+    gnc_invoice_remind_bills_due();
 }
 
 /**************************************************************
@@ -711,248 +775,248 @@
 static void
 gnc_plugin_business_cmd_export_invoice (GtkAction *action, GncMainWindowActionData *mw)
 {
-	QofSession *current_session, *chart_session;
-	QofBook *book;
-	QofCollection *coll;
-	gchar *filename;
-	gboolean success;
+    QofSession *current_session, *chart_session;
+    QofBook *book;
+    QofCollection *coll;
+    gchar *filename;
+    gboolean success;
 
-	current_session = gnc_get_current_session();
-	book = qof_session_get_book(current_session);
-	chart_session = qof_session_new();
-	success = FALSE;
-	filename = gnc_file_dialog(_("Export Invoices to XML"), NULL, 
-			NULL, GNC_FILE_DIALOG_EXPORT);
-	if (filename)
-	{
-	    gchar* url = g_strdup_printf( "qsf:%s", filename );
-		qof_session_begin(chart_session, url, TRUE, TRUE);
-		coll = qof_book_get_collection(book, GNC_ID_INVOICE);
-		success = qof_instance_copy_coll_r(chart_session, coll);
-		/* Need to get the GList of GncEntry's - KVP */
-		coll = qof_book_get_collection(book, GNC_ID_CUSTOMER);
-		success = qof_instance_copy_coll_r(chart_session, coll);
-		if(success) 
-		{ 
-			qof_session_save(chart_session, NULL);
-		}
-		g_free(url);
-	}
-	show_session_error(qof_session_get_error(chart_session), filename,
-			   GNC_FILE_DIALOG_EXPORT);
-	g_free(filename);
-	qof_session_end(chart_session);
-	gnc_set_current_session(current_session);
+    current_session = gnc_get_current_session();
+    book = qof_session_get_book(current_session);
+    chart_session = qof_session_new();
+    success = FALSE;
+    filename = gnc_file_dialog(_("Export Invoices to XML"), NULL,
+                               NULL, GNC_FILE_DIALOG_EXPORT);
+    if (filename)
+    {
+        gchar* url = g_strdup_printf( "qsf:%s", filename );
+        qof_session_begin(chart_session, url, TRUE, TRUE);
+        coll = qof_book_get_collection(book, GNC_ID_INVOICE);
+        success = qof_instance_copy_coll_r(chart_session, coll);
+        /* Need to get the GList of GncEntry's - KVP */
+        coll = qof_book_get_collection(book, GNC_ID_CUSTOMER);
+        success = qof_instance_copy_coll_r(chart_session, coll);
+        if (success)
+        {
+            qof_session_save(chart_session, NULL);
+        }
+        g_free(url);
+    }
+    show_session_error(qof_session_get_error(chart_session), filename,
+                       GNC_FILE_DIALOG_EXPORT);
+    g_free(filename);
+    qof_session_end(chart_session);
+    gnc_set_current_session(current_session);
 }
 
 static void
 gnc_plugin_business_cmd_export_customer (GtkAction *action, GncMainWindowActionData *mw)
 {
-	QofSession *current_session, *chart_session;
-	QofBook *book;
-	QofCollection *coll;
-	gchar *filename;
-	gboolean success;
+    QofSession *current_session, *chart_session;
+    QofBook *book;
+    QofCollection *coll;
+    gchar *filename;
+    gboolean success;
 
-	current_session = gnc_get_current_session();
-	book = qof_session_get_book(current_session);
-	chart_session = qof_session_new();
-	success = FALSE;
-	filename = gnc_file_dialog(_("Export Customers to XML"), NULL, 
-			NULL, GNC_FILE_DIALOG_EXPORT);
-	if (filename)
-	{
-	    gchar* url = g_strdup_printf( "qsf:%s", filename );
-		qof_session_begin(chart_session, url, TRUE, TRUE);
-		coll = qof_book_get_collection(book, GNC_ID_CUSTOMER);
-		success = qof_instance_copy_coll_r(chart_session, coll);
-		if(success) 
-		{ 
-			qof_session_save(chart_session, NULL);
-		}
-		g_free(url);
-	}
-	show_session_error(qof_session_get_error(chart_session), filename,
-			   GNC_FILE_DIALOG_EXPORT);
-	qof_session_end(chart_session);
-	g_free(filename);
-	gnc_set_current_session(current_session);
+    current_session = gnc_get_current_session();
+    book = qof_session_get_book(current_session);
+    chart_session = qof_session_new();
+    success = FALSE;
+    filename = gnc_file_dialog(_("Export Customers to XML"), NULL,
+                               NULL, GNC_FILE_DIALOG_EXPORT);
+    if (filename)
+    {
+        gchar* url = g_strdup_printf( "qsf:%s", filename );
+        qof_session_begin(chart_session, url, TRUE, TRUE);
+        coll = qof_book_get_collection(book, GNC_ID_CUSTOMER);
+        success = qof_instance_copy_coll_r(chart_session, coll);
+        if (success)
+        {
+            qof_session_save(chart_session, NULL);
+        }
+        g_free(url);
+    }
+    show_session_error(qof_session_get_error(chart_session), filename,
+                       GNC_FILE_DIALOG_EXPORT);
+    qof_session_end(chart_session);
+    g_free(filename);
+    gnc_set_current_session(current_session);
 }
 
 static void
 gnc_plugin_business_cmd_export_vendor (GtkAction *action, GncMainWindowActionData *mw)
 {
-	QofSession *current_session, *chart_session;
-	QofBook *book;
-	QofCollection *coll;
-	gchar *filename;
-	gboolean success;
+    QofSession *current_session, *chart_session;
+    QofBook *book;
+    QofCollection *coll;
+    gchar *filename;
+    gboolean success;
 
-	current_session = gnc_get_current_session();
-	book = qof_session_get_book(current_session);
-	chart_session = qof_session_new();
-	success = FALSE;
-	filename = gnc_file_dialog(_("Export Vendors to XML"), NULL, 
-			NULL, GNC_FILE_DIALOG_EXPORT);
-	if (filename)
-	{
-	    gchar* url = g_strdup_printf( "qsf:%s", filename );
-		qof_session_begin(chart_session, url, TRUE, TRUE);
-		coll = qof_book_get_collection(book, GNC_ID_VENDOR);
-		success = qof_instance_copy_coll_r(chart_session, coll);
-		if(success) 
-		{ 
-			qof_session_save(chart_session, NULL);
-		}
-		g_free(url);
-	}
-	show_session_error(qof_session_get_error(chart_session), filename,
-			   GNC_FILE_DIALOG_EXPORT);
-	qof_session_end(chart_session);
-	g_free(filename);
-	gnc_set_current_session(current_session);
+    current_session = gnc_get_current_session();
+    book = qof_session_get_book(current_session);
+    chart_session = qof_session_new();
+    success = FALSE;
+    filename = gnc_file_dialog(_("Export Vendors to XML"), NULL,
+                               NULL, GNC_FILE_DIALOG_EXPORT);
+    if (filename)
+    {
+        gchar* url = g_strdup_printf( "qsf:%s", filename );
+        qof_session_begin(chart_session, url, TRUE, TRUE);
+        coll = qof_book_get_collection(book, GNC_ID_VENDOR);
+        success = qof_instance_copy_coll_r(chart_session, coll);
+        if (success)
+        {
+            qof_session_save(chart_session, NULL);
+        }
+        g_free(url);
+    }
+    show_session_error(qof_session_get_error(chart_session), filename,
+                       GNC_FILE_DIALOG_EXPORT);
+    qof_session_end(chart_session);
+    g_free(filename);
+    gnc_set_current_session(current_session);
 }
 
 static void
 gnc_plugin_business_cmd_export_employee (GtkAction *action, GncMainWindowActionData *mw)
 {
-	QofSession *current_session, *chart_session;
-	QofBook *book;
-	QofCollection *coll;
-	gchar *filename;
-	gboolean success;
+    QofSession *current_session, *chart_session;
+    QofBook *book;
+    QofCollection *coll;
+    gchar *filename;
+    gboolean success;
 
-	current_session = gnc_get_current_session();
-	book = qof_session_get_book(current_session);
-	chart_session = qof_session_new();
-	success = FALSE;
-	filename = gnc_file_dialog(_("Export Employees to XML"), NULL, 
-			NULL, GNC_FILE_DIALOG_EXPORT);
-	if (filename)
-	{
-	    gchar* url = g_strdup_printf( "qsf:%s", filename );
-		qof_session_begin(chart_session, url, TRUE, TRUE);
-		coll = qof_book_get_collection(book, GNC_ID_EMPLOYEE);
-		success = qof_instance_copy_coll_r(chart_session, coll);
-		if(success) 
-		{ 
-			qof_session_save(chart_session, NULL);
-		}
-		g_free(url);
-	}
-	show_session_error(qof_session_get_error(chart_session), filename,
-			   GNC_FILE_DIALOG_EXPORT);
-	qof_session_end(chart_session);
-	g_free(filename);
-	gnc_set_current_session(current_session);
+    current_session = gnc_get_current_session();
+    book = qof_session_get_book(current_session);
+    chart_session = qof_session_new();
+    success = FALSE;
+    filename = gnc_file_dialog(_("Export Employees to XML"), NULL,
+                               NULL, GNC_FILE_DIALOG_EXPORT);
+    if (filename)
+    {
+        gchar* url = g_strdup_printf( "qsf:%s", filename );
+        qof_session_begin(chart_session, url, TRUE, TRUE);
+        coll = qof_book_get_collection(book, GNC_ID_EMPLOYEE);
+        success = qof_instance_copy_coll_r(chart_session, coll);
+        if (success)
+        {
+            qof_session_save(chart_session, NULL);
+        }
+        g_free(url);
+    }
+    show_session_error(qof_session_get_error(chart_session), filename,
+                       GNC_FILE_DIALOG_EXPORT);
+    qof_session_end(chart_session);
+    g_free(filename);
+    gnc_set_current_session(current_session);
 }
 
 static void
 gnc_plugin_business_cmd_test_search (GtkAction *action,
-				     GncMainWindowActionData *data)
+                                     GncMainWindowActionData *data)
 {
-	gnc_search_dialog_test();
+    gnc_search_dialog_test();
 }
 
 static void
 gnc_plugin_business_reload_module (const gchar *name)
 {
-	SCM file_scm;
+    SCM file_scm;
 
-	file_scm = scm_makfrom0str (name);
-	scm_call_1(scm_c_eval_string("gnc:reload-module"), file_scm);
+    file_scm = scm_makfrom0str (name);
+    scm_call_1(scm_c_eval_string("gnc:reload-module"), file_scm);
 }
 
 static void
 gnc_plugin_business_cmd_test_reload_invoice_report (GtkAction *action,
-						    GncMainWindowActionData *data)
+        GncMainWindowActionData *data)
 {
-	gnc_plugin_business_reload_module("gnucash/report/invoice.scm");
+    gnc_plugin_business_reload_module("gnucash/report/invoice.scm");
 }
 
 static void
 gnc_plugin_business_cmd_test_reload_owner_report (GtkAction *action,
-						  GncMainWindowActionData *data)
+        GncMainWindowActionData *data)
 {
-	gnc_plugin_business_reload_module("gnucash/report/owner-report.scm");
+    gnc_plugin_business_reload_module("gnucash/report/owner-report.scm");
 }
 
 static void
 gnc_plugin_business_cmd_test_reload_receivable_report (GtkAction *action,
-						       GncMainWindowActionData *data)
+        GncMainWindowActionData *data)
 {
-	gnc_plugin_business_reload_module("gnucash/report/receivable-report.scm");
+    gnc_plugin_business_reload_module("gnucash/report/receivable-report.scm");
 }
 
 static void
 gnc_plugin_business_cmd_test_init_data (GtkAction *action,
-					GncMainWindowActionData *data)
+                                        GncMainWindowActionData *data)
 {
-	QofBook *book		= gnc_get_current_book();
-	GncCustomer *customer	= gncCustomerCreate(book);
-	GncAddress *address	= gncCustomerGetAddr(customer);
-	GncInvoice *invoice	= gncInvoiceCreate(book);
-	GncOwner *owner		= gncOwnerCreate();
-	GncJob *job		= gncJobCreate(book);
-	Account *root		= gnc_book_get_root_account(book);
-	Account *inc_acct	= xaccMallocAccount(book);
-	Account *bank_acct	= xaccMallocAccount(book);
-	Account *tax_acct	= xaccMallocAccount(book);
-	Account *ar_acct	= xaccMallocAccount(book);
-	Timespec now;
+    QofBook *book		= gnc_get_current_book();
+    GncCustomer *customer	= gncCustomerCreate(book);
+    GncAddress *address	= gncCustomerGetAddr(customer);
+    GncInvoice *invoice	= gncInvoiceCreate(book);
+    GncOwner *owner		= gncOwnerCreate();
+    GncJob *job		= gncJobCreate(book);
+    Account *root		= gnc_book_get_root_account(book);
+    Account *inc_acct	= xaccMallocAccount(book);
+    Account *bank_acct	= xaccMallocAccount(book);
+    Account *tax_acct	= xaccMallocAccount(book);
+    Account *ar_acct	= xaccMallocAccount(book);
+    Timespec now;
 
-	// Create Customer
-	gncCustomerSetID(customer, "000001");
-	gncCustomerSetName(customer, "Test Customer");
-	gncCustomerSetCurrency(customer, gnc_default_currency());
-	gncAddressSetName(address, "Contact Person");
-	gncAddressSetAddr1(address, "20 Customer Lane");
-	gncAddressSetAddr2(address, "Customer M/S");
-	gncAddressSetAddr3(address, "Addr3, XXX  12345");
+    // Create Customer
+    gncCustomerSetID(customer, "000001");
+    gncCustomerSetName(customer, "Test Customer");
+    gncCustomerSetCurrency(customer, gnc_default_currency());
+    gncAddressSetName(address, "Contact Person");
+    gncAddressSetAddr1(address, "20 Customer Lane");
+    gncAddressSetAddr2(address, "Customer M/S");
+    gncAddressSetAddr3(address, "Addr3, XXX  12345");
 
-	// Create the Owner
-	gncOwnerInitCustomer(owner, customer);
+    // Create the Owner
+    gncOwnerInitCustomer(owner, customer);
 
-	// Create the Invoice
-	timespecFromTime_t(&now, time(NULL));
-	gncInvoiceSetID(invoice, "000012");
-	gncInvoiceSetOwner(invoice, owner);
-	gncInvoiceSetDateOpened(invoice, now);
-	gncInvoiceSetCurrency(invoice, gnc_default_currency());
+    // Create the Invoice
+    timespecFromTime_t(&now, time(NULL));
+    gncInvoiceSetID(invoice, "000012");
+    gncInvoiceSetOwner(invoice, owner);
+    gncInvoiceSetDateOpened(invoice, now);
+    gncInvoiceSetCurrency(invoice, gnc_default_currency());
 
-	// Create the Job
-	gncJobSetID(job, "000025");
-	gncJobSetName(job, "Test Job");
-	gncJobSetReference(job, "Customer's ref#");
-	gncJobSetOwner(job, owner);
+    // Create the Job
+    gncJobSetID(job, "000025");
+    gncJobSetName(job, "Test Job");
+    gncJobSetReference(job, "Customer's ref#");
+    gncJobSetOwner(job, owner);
 
-	// MODIFY THE OWNER
-	gncOwnerInitJob(owner, job);
+    // MODIFY THE OWNER
+    gncOwnerInitJob(owner, job);
 
-	// Create the A/R account
-	xaccAccountSetType(ar_acct, ACCT_TYPE_RECEIVABLE);
-	xaccAccountSetName(ar_acct, "A/R");
-	xaccAccountSetCommodity(ar_acct, gnc_default_currency());
-	gnc_account_append_child(root, ar_acct);
+    // Create the A/R account
+    xaccAccountSetType(ar_acct, ACCT_TYPE_RECEIVABLE);
+    xaccAccountSetName(ar_acct, "A/R");
+    xaccAccountSetCommodity(ar_acct, gnc_default_currency());
+    gnc_account_append_child(root, ar_acct);
 
-	// Create the Income account
-	xaccAccountSetType(inc_acct, ACCT_TYPE_INCOME);
-	xaccAccountSetName(inc_acct, "Income");
-	xaccAccountSetCommodity(inc_acct, gnc_default_currency());
-	gnc_account_append_child(root, inc_acct);
+    // Create the Income account
+    xaccAccountSetType(inc_acct, ACCT_TYPE_INCOME);
+    xaccAccountSetName(inc_acct, "Income");
+    xaccAccountSetCommodity(inc_acct, gnc_default_currency());
+    gnc_account_append_child(root, inc_acct);
 
-	// Create the Bank account
-	xaccAccountSetType(bank_acct, ACCT_TYPE_BANK);
-	xaccAccountSetName(bank_acct, "Bank");
-	xaccAccountSetCommodity(bank_acct, gnc_default_currency());
-	gnc_account_append_child(root, bank_acct);
+    // Create the Bank account
+    xaccAccountSetType(bank_acct, ACCT_TYPE_BANK);
+    xaccAccountSetName(bank_acct, "Bank");
+    xaccAccountSetCommodity(bank_acct, gnc_default_currency());
+    gnc_account_append_child(root, bank_acct);
 
-	// Create the Tax account
-	xaccAccountSetType(tax_acct, ACCT_TYPE_LIABILITY);
-	xaccAccountSetName(tax_acct, "Tax-Holding");
-	xaccAccountSetCommodity(tax_acct, gnc_default_currency());
-	gnc_account_append_child(root, tax_acct);
+    // Create the Tax account
+    xaccAccountSetType(tax_acct, ACCT_TYPE_LIABILITY);
+    xaccAccountSetName(tax_acct, "Tax-Holding");
+    xaccAccountSetCommodity(tax_acct, gnc_default_currency());
+    gnc_account_append_child(root, tax_acct);
 
-	// Launch the invoice editor
-	gnc_ui_invoice_edit(invoice);
+    // Launch the invoice editor
+    gnc_ui_invoice_edit(invoice);
 }

Modified: gnucash/trunk/src/business/business-gnome/gnc-plugin-business.h
===================================================================
--- gnucash/trunk/src/business/business-gnome/gnc-plugin-business.h	2010-03-02 21:40:28 UTC (rev 18788)
+++ gnucash/trunk/src/business/business-gnome/gnc-plugin-business.h	2010-03-02 21:41:05 UTC (rev 18789)
@@ -1,5 +1,5 @@
-/* 
- * gnc-plugin-business.h -- 
+/*
+ * gnc-plugin-business.h --
  *
  * Copyright (C) 2003 Jan Arne Petersen
  * Author: Jan Arne Petersen <jpetersen at uni-bonn.de>
@@ -42,12 +42,14 @@
 #define GNC_PLUGIN_BUSINESS_NAME "gnc-plugin-business"
 
 /* typedefs & structures */
-typedef struct {
-	GncPlugin gnc_plugin;
+typedef struct
+{
+    GncPlugin gnc_plugin;
 } GncPluginBusiness;
 
-typedef struct {
-	GncPluginClass gnc_plugin;
+typedef struct
+{
+    GncPluginClass gnc_plugin;
 } GncPluginBusinessClass;
 
 /* function prototypes */

Modified: gnucash/trunk/src/business/business-gnome/gnc-plugin-page-invoice.c
===================================================================
--- gnucash/trunk/src/business/business-gnome/gnc-plugin-page-invoice.c	2010-03-02 21:40:28 UTC (rev 18788)
+++ gnucash/trunk/src/business/business-gnome/gnc-plugin-page-invoice.c	2010-03-02 21:41:05 UTC (rev 18789)
@@ -1,5 +1,5 @@
-/* 
- * gnc-plugin-page-invoice.c -- 
+/*
+ * gnc-plugin-page-invoice.c --
  *
  * Copyright (C) 2005,2006 David Hampton <hampton at employees.org>
  *
@@ -71,8 +71,8 @@
 static void gnc_plugin_page_invoice_cmd_unpost (GtkAction *action, GncPluginPageInvoice *plugin_page);
 
 static void gnc_plugin_page_invoice_cmd_sort_changed (GtkAction *action,
-						      GtkRadioAction *current,
-						      GncPluginPageInvoice *plugin_page);
+        GtkRadioAction *current,
+        GncPluginPageInvoice *plugin_page);
 
 static void gnc_plugin_page_invoice_cmd_enter (GtkAction *action, GncPluginPageInvoice *plugin_page);
 static void gnc_plugin_page_invoice_cmd_cancel (GtkAction *action, GncPluginPageInvoice *plugin_page);
@@ -91,114 +91,150 @@
 
 static GtkActionEntry gnc_plugin_page_invoice_actions [] =
 {
-	/* Toplevel */
-	{ "FakeToplevel", NULL, "", NULL, NULL, NULL },
-	{ "SortOrderAction", NULL, N_("Sort _Order"), NULL, NULL, NULL },
+    /* Toplevel */
+    { "FakeToplevel", NULL, "", NULL, NULL, NULL },
+    { "SortOrderAction", NULL, N_("Sort _Order"), NULL, NULL, NULL },
 
-	/* File menu */
-	{ "FileNewInvoiceAction", GTK_STOCK_NEW, N_("New _Invoice"), "",
-	  N_("Create a new invoice"),
-	  G_CALLBACK (gnc_plugin_page_invoice_cmd_new_invoice) },
-	{ "FileNewAccountAction", GNC_STOCK_NEW_ACCOUNT, N_("New _Account..."), NULL,
-	  N_("Create a new account"),
-	  G_CALLBACK (gnc_plugin_page_invoice_cmd_new_account) },
-	{ "FilePrintAction", GTK_STOCK_PRINT, N_("Print Invoice"), "<control>p",
-	  N_("Make a printable invoice"),
-	  G_CALLBACK (gnc_plugin_page_invoice_cmd_print) },
+    /* File menu */
+    {
+        "FileNewInvoiceAction", GTK_STOCK_NEW, N_("New _Invoice"), "",
+        N_("Create a new invoice"),
+        G_CALLBACK (gnc_plugin_page_invoice_cmd_new_invoice)
+    },
+    {
+        "FileNewAccountAction", GNC_STOCK_NEW_ACCOUNT, N_("New _Account..."), NULL,
+        N_("Create a new account"),
+        G_CALLBACK (gnc_plugin_page_invoice_cmd_new_account)
+    },
+    {
+        "FilePrintAction", GTK_STOCK_PRINT, N_("Print Invoice"), "<control>p",
+        N_("Make a printable invoice"),
+        G_CALLBACK (gnc_plugin_page_invoice_cmd_print)
+    },
 
-	/* Edit menu */
-	{ "EditCutAction", GTK_STOCK_CUT, N_("_Cut"), NULL,
-	  NULL,
-	  G_CALLBACK (gnc_plugin_page_invoice_cmd_cut) },
-	{ "EditCopyAction", GTK_STOCK_COPY, N_("Copy"), NULL,
-	  NULL,
-	  G_CALLBACK (gnc_plugin_page_invoice_cmd_copy) },
-	{ "EditPasteAction", GTK_STOCK_PASTE, N_("_Paste"), NULL,
-	  NULL,
-	  G_CALLBACK (gnc_plugin_page_invoice_cmd_paste) },
-	{ "EditEditInvoiceAction", GNC_STOCK_INVOICE_EDIT, N_("_Edit Invoice"), NULL,
-	  N_("Edit this invoice"),
-	  G_CALLBACK (gnc_plugin_page_invoice_cmd_edit) },
-	{ "EditPostInvoiceAction", GNC_STOCK_INVOICE_POST, N_("_Post Invoice"), NULL,
-	  N_("Post this Invoice to your Chart of Accounts"),
-	  G_CALLBACK (gnc_plugin_page_invoice_cmd_post) },
-	{ "EditUnpostInvoiceAction", GNC_STOCK_INVOICE_UNPOST, N_("_Unpost Invoice"), NULL,
-	  N_("Unpost this Invoice and make it editable"),
-	  G_CALLBACK (gnc_plugin_page_invoice_cmd_unpost) },
+    /* Edit menu */
+    {
+        "EditCutAction", GTK_STOCK_CUT, N_("_Cut"), NULL,
+        NULL,
+        G_CALLBACK (gnc_plugin_page_invoice_cmd_cut)
+    },
+    {
+        "EditCopyAction", GTK_STOCK_COPY, N_("Copy"), NULL,
+        NULL,
+        G_CALLBACK (gnc_plugin_page_invoice_cmd_copy)
+    },
+    {
+        "EditPasteAction", GTK_STOCK_PASTE, N_("_Paste"), NULL,
+        NULL,
+        G_CALLBACK (gnc_plugin_page_invoice_cmd_paste)
+    },
+    {
+        "EditEditInvoiceAction", GNC_STOCK_INVOICE_EDIT, N_("_Edit Invoice"), NULL,
+        N_("Edit this invoice"),
+        G_CALLBACK (gnc_plugin_page_invoice_cmd_edit)
+    },
+    {
+        "EditPostInvoiceAction", GNC_STOCK_INVOICE_POST, N_("_Post Invoice"), NULL,
+        N_("Post this Invoice to your Chart of Accounts"),
+        G_CALLBACK (gnc_plugin_page_invoice_cmd_post)
+    },
+    {
+        "EditUnpostInvoiceAction", GNC_STOCK_INVOICE_UNPOST, N_("_Unpost Invoice"), NULL,
+        N_("Unpost this Invoice and make it editable"),
+        G_CALLBACK (gnc_plugin_page_invoice_cmd_unpost)
+    },
 
-	/* Actions menu */
-	{ "RecordEntryAction", GTK_STOCK_ADD, N_("_Enter"), NULL,
-	  N_("Record the current entry"),
-	  G_CALLBACK (gnc_plugin_page_invoice_cmd_enter) },
-	{ "CancelEntryAction", GTK_STOCK_CANCEL, N_("_Cancel"), NULL,
-	  N_("Cancel the current entry"),
-	  G_CALLBACK (gnc_plugin_page_invoice_cmd_cancel) },
-	{ "DeleteEntryAction", GTK_STOCK_DELETE, N_("_Delete"), NULL,
-	  N_("Delete the current entry"),
-	  G_CALLBACK (gnc_plugin_page_invoice_cmd_delete) },
-	{ "BlankEntryAction", GTK_STOCK_GOTO_BOTTOM, N_("_Blank"), NULL,
-	  N_("Move to the blank entry at the bottom of the Invoice"),
-	  G_CALLBACK (gnc_plugin_page_invoice_cmd_blank) },
-	{ "DuplicateEntryAction", GTK_STOCK_COPY, N_("Dup_licate Entry"), NULL,
-	  N_("Make a copy of the current entry"),
-	  G_CALLBACK (gnc_plugin_page_invoice_cmd_duplicate) },
+    /* Actions menu */
+    {
+        "RecordEntryAction", GTK_STOCK_ADD, N_("_Enter"), NULL,
+        N_("Record the current entry"),
+        G_CALLBACK (gnc_plugin_page_invoice_cmd_enter)
+    },
+    {
+        "CancelEntryAction", GTK_STOCK_CANCEL, N_("_Cancel"), NULL,
+        N_("Cancel the current entry"),
+        G_CALLBACK (gnc_plugin_page_invoice_cmd_cancel)
+    },
+    {
+        "DeleteEntryAction", GTK_STOCK_DELETE, N_("_Delete"), NULL,
+        N_("Delete the current entry"),
+        G_CALLBACK (gnc_plugin_page_invoice_cmd_delete)
+    },
+    {
+        "BlankEntryAction", GTK_STOCK_GOTO_BOTTOM, N_("_Blank"), NULL,
+        N_("Move to the blank entry at the bottom of the Invoice"),
+        G_CALLBACK (gnc_plugin_page_invoice_cmd_blank)
+    },
+    {
+        "DuplicateEntryAction", GTK_STOCK_COPY, N_("Dup_licate Entry"), NULL,
+        N_("Make a copy of the current entry"),
+        G_CALLBACK (gnc_plugin_page_invoice_cmd_duplicate)
+    },
 
-	/* Business menu */
-	{ "ToolsProcessPaymentAction", NULL, N_("_Pay Invoice"), NULL,
-	  N_("Enter a payment for the owner of this Invoice"),
-	  G_CALLBACK (gnc_plugin_page_invoice_cmd_pay_invoice) },
+    /* Business menu */
+    {
+        "ToolsProcessPaymentAction", NULL, N_("_Pay Invoice"), NULL,
+        N_("Enter a payment for the owner of this Invoice"),
+        G_CALLBACK (gnc_plugin_page_invoice_cmd_pay_invoice)
+    },
 
-	/* Reports menu */
-	{ "ReportsCompanyReportAction", NULL, N_("_Company Report"), NULL,
-	  N_("Open a company report window for the owner of this Invoice"),
-	  G_CALLBACK (gnc_plugin_page_invoice_cmd_company_report) },
+    /* Reports menu */
+    {
+        "ReportsCompanyReportAction", NULL, N_("_Company Report"), NULL,
+        N_("Open a company report window for the owner of this Invoice"),
+        G_CALLBACK (gnc_plugin_page_invoice_cmd_company_report)
+    },
 };
 static guint gnc_plugin_page_invoice_n_actions = G_N_ELEMENTS (gnc_plugin_page_invoice_actions);
 
 static GtkRadioActionEntry radio_entries [] =
 {
-	{ "SortStandardAction", NULL, N_("_Standard"), NULL, "Keep normal invoice order", BY_STANDARD },
-	{ "SortDateAction", NULL, N_("_Date"), NULL, "Sort by date", BY_DATE },
-	{ "SortDateEntryAction", NULL, N_("Date of _Entry"), NULL, "Sort by the date of entry", BY_DATE_ENTERED },
-	{ "SortQuantityAction", NULL, N_("_Quantity"), NULL, "Sort by quantity", BY_QTY },
-	{ "SortPriceAction", NULL, N_("_Price"), NULL, "Sort by price", BY_PRICE },
-	{ "SortDescriptionAction", NULL, N_("Descri_ption"), NULL, "Sort by description", BY_DESC },
+    { "SortStandardAction", NULL, N_("_Standard"), NULL, "Keep normal invoice order", BY_STANDARD },
+    { "SortDateAction", NULL, N_("_Date"), NULL, "Sort by date", BY_DATE },
+    { "SortDateEntryAction", NULL, N_("Date of _Entry"), NULL, "Sort by the date of entry", BY_DATE_ENTERED },
+    { "SortQuantityAction", NULL, N_("_Quantity"), NULL, "Sort by quantity", BY_QTY },
+    { "SortPriceAction", NULL, N_("_Price"), NULL, "Sort by price", BY_PRICE },
+    { "SortDescriptionAction", NULL, N_("Descri_ption"), NULL, "Sort by description", BY_DESC },
 };
 static guint n_radio_entries = G_N_ELEMENTS (radio_entries);
 
-static const gchar *posted_actions[] = {
-	"FilePrintAction",
-	NULL
+static const gchar *posted_actions[] =
+{
+    "FilePrintAction",
+    NULL
 };
 
-static const gchar *unposted_actions[] = {
-	"EditCutAction",
-	"EditPasteAction",
-	"EditEditInvoiceAction",
-	"EditPostInvoiceAction",
-	"RecordEntryAction",
-	"CancelEntryAction",
-	"DeleteEntryAction",
-	"DuplicateEntryAction",
-	"BlankEntryAction",
-	NULL
+static const gchar *unposted_actions[] =
+{
+    "EditCutAction",
+    "EditPasteAction",
+    "EditEditInvoiceAction",
+    "EditPostInvoiceAction",
+    "RecordEntryAction",
+    "CancelEntryAction",
+    "DeleteEntryAction",
+    "DuplicateEntryAction",
+    "BlankEntryAction",
+    NULL
 };
 
-static const gchar *can_unpost_actions[] = {
-	"EditUnpostInvoiceAction",
-	NULL
+static const gchar *can_unpost_actions[] =
+{
+    "EditUnpostInvoiceAction",
+    NULL
 };
 
 /** Short labels for use on the toolbar buttons. */
-static action_toolbar_labels toolbar_labels[] = {
-  { "RecordEntryAction", 	  N_("Enter") },
-  { "CancelEntryAction", 	  N_("Cancel") },
-  { "DeleteEntryAction", 	  N_("Delete") },
-  { "DuplicateEntryAction",       N_("Duplicate") },
-  { "BlankEntryAction",           N_("Blank") },
-  { "EditPostInvoiceAction",      N_("Post") },
-  { "EditUnpostInvoiceAction",    N_("Unpost") },
-  { NULL, NULL },
+static action_toolbar_labels toolbar_labels[] =
+{
+    { "RecordEntryAction", 	  N_("Enter") },
+    { "CancelEntryAction", 	  N_("Cancel") },
+    { "DeleteEntryAction", 	  N_("Delete") },
+    { "DuplicateEntryAction",       N_("Duplicate") },
+    { "BlankEntryAction",           N_("Blank") },
+    { "EditPostInvoiceAction",      N_("Post") },
+    { "EditUnpostInvoiceAction",    N_("Unpost") },
+    { NULL, NULL },
 };
 
 
@@ -208,11 +244,11 @@
 
 typedef struct GncPluginPageInvoicePrivate
 {
-	InvoiceWindow *iw;
+    InvoiceWindow *iw;
 
-	GtkWidget *widget;
+    GtkWidget *widget;
 
-	gint component_manager_id;
+    gint component_manager_id;
 } GncPluginPageInvoicePrivate;
 
 #define GNC_PLUGIN_PAGE_INVOICE_GET_PRIVATE(o)  \
@@ -227,148 +263,151 @@
 GType
 gnc_plugin_page_invoice_get_type (void)
 {
-	static GType gnc_plugin_page_invoice_type = 0;
+    static GType gnc_plugin_page_invoice_type = 0;
 
-	if (gnc_plugin_page_invoice_type == 0) {
-		static const GTypeInfo our_info = {
-			sizeof (GncPluginPageInvoiceClass),
-			NULL,
-			NULL,
-			(GClassInitFunc) gnc_plugin_page_invoice_class_init,
-			NULL,
-			NULL,
-			sizeof (GncPluginPageInvoice),
-			0,
-			(GInstanceInitFunc) gnc_plugin_page_invoice_init
-		};
-		
-		gnc_plugin_page_invoice_type = g_type_register_static (GNC_TYPE_PLUGIN_PAGE,
-									"GncPluginPageInvoice",
-									&our_info, 0);
-	}
+    if (gnc_plugin_page_invoice_type == 0)
+    {
+        static const GTypeInfo our_info =
+        {
+            sizeof (GncPluginPageInvoiceClass),
+            NULL,
+            NULL,
+            (GClassInitFunc) gnc_plugin_page_invoice_class_init,
+            NULL,
+            NULL,
+            sizeof (GncPluginPageInvoice),
+            0,
+            (GInstanceInitFunc) gnc_plugin_page_invoice_init
+        };
 
-	return gnc_plugin_page_invoice_type;
+        gnc_plugin_page_invoice_type = g_type_register_static (GNC_TYPE_PLUGIN_PAGE,
+                                       "GncPluginPageInvoice",
+                                       &our_info, 0);
+    }
+
+    return gnc_plugin_page_invoice_type;
 }
 
 GncPluginPage *
 gnc_plugin_page_invoice_new (InvoiceWindow *iw)
 {
-	GncPluginPageInvoicePrivate *priv;
-	GncPluginPageInvoice *invoice_page;
-	GncPluginPage *plugin_page;
-	const GList *item;
+    GncPluginPageInvoicePrivate *priv;
+    GncPluginPageInvoice *invoice_page;
+    GncPluginPage *plugin_page;
+    const GList *item;
 
-	/* Is there an existing page? */
-	item = gnc_gobject_tracking_get_list(GNC_PLUGIN_PAGE_INVOICE_NAME);
-	for ( ; item; item = g_list_next(item)) {
-	  invoice_page = (GncPluginPageInvoice *)item->data;
-	  priv = GNC_PLUGIN_PAGE_INVOICE_GET_PRIVATE(invoice_page);
-	  if (priv->iw == iw)
-	    return GNC_PLUGIN_PAGE(invoice_page);
-	}
+    /* Is there an existing page? */
+    item = gnc_gobject_tracking_get_list(GNC_PLUGIN_PAGE_INVOICE_NAME);
+    for ( ; item; item = g_list_next(item))
+    {
+        invoice_page = (GncPluginPageInvoice *)item->data;
+        priv = GNC_PLUGIN_PAGE_INVOICE_GET_PRIVATE(invoice_page);
+        if (priv->iw == iw)
+            return GNC_PLUGIN_PAGE(invoice_page);
+    }
 
-	invoice_page = g_object_new (GNC_TYPE_PLUGIN_PAGE_INVOICE, (char *)NULL);
-	priv = GNC_PLUGIN_PAGE_INVOICE_GET_PRIVATE(invoice_page);
-	priv->iw = iw;
+    invoice_page = g_object_new (GNC_TYPE_PLUGIN_PAGE_INVOICE, (char *)NULL);
+    priv = GNC_PLUGIN_PAGE_INVOICE_GET_PRIVATE(invoice_page);
+    priv->iw = iw;
 
-	plugin_page = GNC_PLUGIN_PAGE(invoice_page);
-	gnc_plugin_page_invoice_update_title(plugin_page);
-	gnc_plugin_page_set_uri(plugin_page, "default:");
+    plugin_page = GNC_PLUGIN_PAGE(invoice_page);
+    gnc_plugin_page_invoice_update_title(plugin_page);
+    gnc_plugin_page_set_uri(plugin_page, "default:");
 
-	priv->component_manager_id = 0;
-	return plugin_page;
+    priv->component_manager_id = 0;
+    return plugin_page;
 }
 
 static void
 gnc_plugin_page_invoice_class_init (GncPluginPageInvoiceClass *klass)
 {
-	GObjectClass *object_class = G_OBJECT_CLASS (klass);
-	GncPluginPageClass *gnc_plugin_class = GNC_PLUGIN_PAGE_CLASS(klass);
+    GObjectClass *object_class = G_OBJECT_CLASS (klass);
+    GncPluginPageClass *gnc_plugin_class = GNC_PLUGIN_PAGE_CLASS(klass);
 
-	parent_class = g_type_class_peek_parent (klass);
+    parent_class = g_type_class_peek_parent (klass);
 
-	object_class->finalize = gnc_plugin_page_invoice_finalize;
+    object_class->finalize = gnc_plugin_page_invoice_finalize;
 
-	gnc_plugin_class->tab_icon        = NULL;
-	gnc_plugin_class->plugin_name     = GNC_PLUGIN_PAGE_INVOICE_NAME;
-	gnc_plugin_class->create_widget   = gnc_plugin_page_invoice_create_widget;
-	gnc_plugin_class->destroy_widget  = gnc_plugin_page_invoice_destroy_widget;
-	gnc_plugin_class->save_page       = gnc_plugin_page_invoice_save_page;
-	gnc_plugin_class->recreate_page   = gnc_plugin_page_invoice_recreate_page;
-	gnc_plugin_class->window_changed  = gnc_plugin_page_invoice_window_changed;
+    gnc_plugin_class->tab_icon        = NULL;
+    gnc_plugin_class->plugin_name     = GNC_PLUGIN_PAGE_INVOICE_NAME;
+    gnc_plugin_class->create_widget   = gnc_plugin_page_invoice_create_widget;
+    gnc_plugin_class->destroy_widget  = gnc_plugin_page_invoice_destroy_widget;
+    gnc_plugin_class->save_page       = gnc_plugin_page_invoice_save_page;
+    gnc_plugin_class->recreate_page   = gnc_plugin_page_invoice_recreate_page;
+    gnc_plugin_class->window_changed  = gnc_plugin_page_invoice_window_changed;
 
-	g_type_class_add_private(klass, sizeof(GncPluginPageInvoicePrivate));
+    g_type_class_add_private(klass, sizeof(GncPluginPageInvoicePrivate));
 }
 
 static void
 gnc_plugin_page_invoice_init (GncPluginPageInvoice *plugin_page)
 {
-	GncPluginPageInvoicePrivate *priv;
-	GncPluginPage *parent;
-	GtkActionGroup *action_group;
-	gboolean use_new;
+    GncPluginPageInvoicePrivate *priv;
+    GncPluginPage *parent;
+    GtkActionGroup *action_group;
+    gboolean use_new;
 
-	priv = GNC_PLUGIN_PAGE_INVOICE_GET_PRIVATE(plugin_page);
+    priv = GNC_PLUGIN_PAGE_INVOICE_GET_PRIVATE(plugin_page);
 
-	/* Init parent declared variables */
-	parent = GNC_PLUGIN_PAGE(plugin_page);
-	use_new = gnc_gconf_get_bool(GCONF_SECTION_INVOICE, KEY_USE_NEW, NULL);
-	g_object_set(G_OBJECT(plugin_page),
-		     "page-name",      _("Invoice"),
-		     "page-uri",       "default:",
-		     "ui-description", "gnc-plugin-page-invoice-ui.xml",
-		     "use-new-window", use_new,
-		     (char *)NULL);
+    /* Init parent declared variables */
+    parent = GNC_PLUGIN_PAGE(plugin_page);
+    use_new = gnc_gconf_get_bool(GCONF_SECTION_INVOICE, KEY_USE_NEW, NULL);
+    g_object_set(G_OBJECT(plugin_page),
+                 "page-name",      _("Invoice"),
+                 "page-uri",       "default:",
+                 "ui-description", "gnc-plugin-page-invoice-ui.xml",
+                 "use-new-window", use_new,
+                 (char *)NULL);
 
-	/* change me when the system supports multiple books */
-	gnc_plugin_page_add_book(parent, gnc_get_current_book());
+    /* change me when the system supports multiple books */
+    gnc_plugin_page_add_book(parent, gnc_get_current_book());
 
-	/* Create menu and toolbar information */
-	action_group =
-	  gnc_plugin_page_create_action_group(parent,
-					      "GncPluginPageInvoiceActions");
-	gtk_action_group_add_actions (action_group, gnc_plugin_page_invoice_actions,
-				      gnc_plugin_page_invoice_n_actions, plugin_page);
-	gtk_action_group_add_radio_actions (action_group,
-					    radio_entries, n_radio_entries,
-					    REG_STYLE_LEDGER,
-					    G_CALLBACK(gnc_plugin_page_invoice_cmd_sort_changed),
-					    plugin_page);
+    /* Create menu and toolbar information */
+    action_group =
+        gnc_plugin_page_create_action_group(parent,
+                                            "GncPluginPageInvoiceActions");
+    gtk_action_group_add_actions (action_group, gnc_plugin_page_invoice_actions,
+                                  gnc_plugin_page_invoice_n_actions, plugin_page);
+    gtk_action_group_add_radio_actions (action_group,
+                                        radio_entries, n_radio_entries,
+                                        REG_STYLE_LEDGER,
+                                        G_CALLBACK(gnc_plugin_page_invoice_cmd_sort_changed),
+                                        plugin_page);
 
-	gnc_plugin_init_short_names (action_group, toolbar_labels);
+    gnc_plugin_init_short_names (action_group, toolbar_labels);
 }
 
 static void
 gnc_plugin_page_invoice_finalize (GObject *object)
 {
-	GncPluginPageInvoice *page;
-	GncPluginPageInvoicePrivate *priv;
+    GncPluginPageInvoice *page;
+    GncPluginPageInvoicePrivate *priv;
 
-	g_return_if_fail (GNC_IS_PLUGIN_PAGE_INVOICE (object));
+    g_return_if_fail (GNC_IS_PLUGIN_PAGE_INVOICE (object));
 
-	ENTER("object %p", object);
-	page = GNC_PLUGIN_PAGE_INVOICE (object);
-	priv = GNC_PLUGIN_PAGE_INVOICE_GET_PRIVATE(page);
+    ENTER("object %p", object);
+    page = GNC_PLUGIN_PAGE_INVOICE (object);
+    priv = GNC_PLUGIN_PAGE_INVOICE_GET_PRIVATE(page);
 
-	G_OBJECT_CLASS (parent_class)->finalize (object);
-	LEAVE(" ");
+    G_OBJECT_CLASS (parent_class)->finalize (object);
+    LEAVE(" ");
 }
 
 
 void
 gnc_plugin_page_invoice_update_menus (GncPluginPage *page, gboolean is_posted, gboolean can_unpost)
-{ 
-  GtkActionGroup *action_group;
+{
+    GtkActionGroup *action_group;
 
-  g_return_if_fail(GNC_IS_PLUGIN_PAGE_INVOICE(page));
+    g_return_if_fail(GNC_IS_PLUGIN_PAGE_INVOICE(page));
 
-  action_group = gnc_plugin_page_get_action_group(page);
-  gnc_plugin_update_actions (action_group, posted_actions,
-			     "sensitive", is_posted);
-  gnc_plugin_update_actions (action_group, unposted_actions,
-			     "sensitive", !is_posted);
-  gnc_plugin_update_actions (action_group, can_unpost_actions,
-			     "sensitive", can_unpost);
+    action_group = gnc_plugin_page_get_action_group(page);
+    gnc_plugin_update_actions (action_group, posted_actions,
+                               "sensitive", is_posted);
+    gnc_plugin_update_actions (action_group, unposted_actions,
+                               "sensitive", !is_posted);
+    gnc_plugin_update_actions (action_group, can_unpost_actions,
+                               "sensitive", can_unpost);
 }
 
 
@@ -377,74 +416,76 @@
 static GtkWidget *
 gnc_plugin_page_invoice_create_widget (GncPluginPage *plugin_page)
 {
-	GncPluginPageInvoice *page;
-	GncPluginPageInvoicePrivate *priv;
-	GtkWidget *regWidget, *widget;
+    GncPluginPageInvoice *page;
+    GncPluginPageInvoicePrivate *priv;
+    GtkWidget *regWidget, *widget;
 
-	ENTER("page %p", plugin_page);
-	page = GNC_PLUGIN_PAGE_INVOICE (plugin_page);
-	priv = GNC_PLUGIN_PAGE_INVOICE_GET_PRIVATE(page);
-	if (priv->widget != NULL)
+    ENTER("page %p", plugin_page);
+    page = GNC_PLUGIN_PAGE_INVOICE (plugin_page);
+    priv = GNC_PLUGIN_PAGE_INVOICE_GET_PRIVATE(page);
+    if (priv->widget != NULL)
     {
         LEAVE("");
-		return priv->widget;
+        return priv->widget;
     }
 
-	priv->widget = gtk_vbox_new (FALSE, 0);
-	gtk_widget_show (priv->widget);
-	
-	widget = gnc_invoice_create_page(priv->iw, page);
-	gtk_widget_show (widget);
-	gtk_box_pack_start(GTK_BOX (priv->widget), widget, TRUE, TRUE, 0);
+    priv->widget = gtk_vbox_new (FALSE, 0);
+    gtk_widget_show (priv->widget);
 
-	plugin_page->summarybar = gnc_invoice_window_create_summary_bar(priv->iw);
-	gtk_box_pack_start(GTK_BOX (priv->widget), plugin_page->summarybar, FALSE, FALSE, 0);
-	gnc_plugin_page_invoice_summarybar_position_changed(NULL, page);
-	gnc_gconf_general_register_cb(KEY_SUMMARYBAR_POSITION,
-        	gnc_plugin_page_invoice_summarybar_position_changed, page);
+    widget = gnc_invoice_create_page(priv->iw, page);
+    gtk_widget_show (widget);
+    gtk_box_pack_start(GTK_BOX (priv->widget), widget, TRUE, TRUE, 0);
 
-	regWidget = gnc_invoice_get_register(priv->iw);
-	if (regWidget) {
-	  g_signal_connect (G_OBJECT (regWidget), "redraw-help",
-			    G_CALLBACK (gnc_plugin_page_redraw_help_cb), page);
-	}
+    plugin_page->summarybar = gnc_invoice_window_create_summary_bar(priv->iw);
+    gtk_box_pack_start(GTK_BOX (priv->widget), plugin_page->summarybar, FALSE, FALSE, 0);
+    gnc_plugin_page_invoice_summarybar_position_changed(NULL, page);
+    gnc_gconf_general_register_cb(KEY_SUMMARYBAR_POSITION,
+                                  gnc_plugin_page_invoice_summarybar_position_changed, page);
 
-	priv->component_manager_id =
-	  gnc_register_gui_component(GNC_PLUGIN_PAGE_INVOICE_NAME,
-				     gnc_plugin_page_invoice_refresh_cb,
-				     NULL, page);
+    regWidget = gnc_invoice_get_register(priv->iw);
+    if (regWidget)
+    {
+        g_signal_connect (G_OBJECT (regWidget), "redraw-help",
+                          G_CALLBACK (gnc_plugin_page_redraw_help_cb), page);
+    }
 
+    priv->component_manager_id =
+        gnc_register_gui_component(GNC_PLUGIN_PAGE_INVOICE_NAME,
+                                   gnc_plugin_page_invoice_refresh_cb,
+                                   NULL, page);
+
     LEAVE("");
-	return priv->widget;
+    return priv->widget;
 }
 
 static void
 gnc_plugin_page_invoice_destroy_widget (GncPluginPage *plugin_page)
 {
-	GncPluginPageInvoice *page;
-	GncPluginPageInvoicePrivate *priv;
+    GncPluginPageInvoice *page;
+    GncPluginPageInvoicePrivate *priv;
 
-	ENTER("page %p", plugin_page);
-	page = GNC_PLUGIN_PAGE_INVOICE (plugin_page);
-	priv = GNC_PLUGIN_PAGE_INVOICE_GET_PRIVATE(page);
+    ENTER("page %p", plugin_page);
+    page = GNC_PLUGIN_PAGE_INVOICE (plugin_page);
+    priv = GNC_PLUGIN_PAGE_INVOICE_GET_PRIVATE(page);
 
-	gnc_gconf_general_remove_cb(KEY_SUMMARYBAR_POSITION,
-		gnc_plugin_page_invoice_summarybar_position_changed, page);
+    gnc_gconf_general_remove_cb(KEY_SUMMARYBAR_POSITION,
+                                gnc_plugin_page_invoice_summarybar_position_changed, page);
 
-	if (priv->widget == NULL)
+    if (priv->widget == NULL)
     {
         LEAVE("");
-		return;
+        return;
     }
 
-	if (priv->component_manager_id) {
-	  gnc_unregister_gui_component(priv->component_manager_id);
-	  priv->component_manager_id = 0;
-	}
+    if (priv->component_manager_id)
+    {
+        gnc_unregister_gui_component(priv->component_manager_id);
+        priv->component_manager_id = 0;
+    }
 
-	gtk_widget_hide(priv->widget);
-	gnc_invoice_window_destroy_cb(priv->widget, priv->iw);
-	priv->widget = NULL;
+    gtk_widget_hide(priv->widget);
+    gnc_invoice_window_destroy_cb(priv->widget, priv->iw);
+    priv->widget = NULL;
     LEAVE("");
 }
 
@@ -459,24 +500,24 @@
  *  @param group_name The group name to use when saving data. */
 static void
 gnc_plugin_page_invoice_save_page (GncPluginPage *plugin_page,
-				   GKeyFile *key_file,
-				   const gchar *group_name)
+                                   GKeyFile *key_file,
+                                   const gchar *group_name)
 {
-	GncPluginPageInvoice *invoice;
-	GncPluginPageInvoicePrivate *priv;
-	
-	g_return_if_fail (GNC_IS_PLUGIN_PAGE_INVOICE(plugin_page));
-	g_return_if_fail (key_file != NULL);
-	g_return_if_fail (group_name != NULL);
+    GncPluginPageInvoice *invoice;
+    GncPluginPageInvoicePrivate *priv;
 
-	ENTER("page %p, key_file %p, group_name %s", plugin_page, key_file,
-	      group_name);
+    g_return_if_fail (GNC_IS_PLUGIN_PAGE_INVOICE(plugin_page));
+    g_return_if_fail (key_file != NULL);
+    g_return_if_fail (group_name != NULL);
 
-	invoice = GNC_PLUGIN_PAGE_INVOICE(plugin_page);
-	priv = GNC_PLUGIN_PAGE_INVOICE_GET_PRIVATE(invoice);
+    ENTER("page %p, key_file %p, group_name %s", plugin_page, key_file,
+          group_name);
 
+    invoice = GNC_PLUGIN_PAGE_INVOICE(plugin_page);
+    priv = GNC_PLUGIN_PAGE_INVOICE_GET_PRIVATE(invoice);
+
     gnc_invoice_save_page(priv->iw, key_file, group_name);
-	LEAVE(" ");
+    LEAVE(" ");
 }
 
 
@@ -492,67 +533,68 @@
  *  @param group_name The group name to use when restoring data. */
 static GncPluginPage *
 gnc_plugin_page_invoice_recreate_page (GtkWidget *window,
-				       GKeyFile *key_file,
-				       const gchar *group_name)
+                                       GKeyFile *key_file,
+                                       const gchar *group_name)
 {
-	GncPluginPage *page;
+    GncPluginPage *page;
 
-	g_return_val_if_fail(GNC_IS_MAIN_WINDOW(window), NULL);
-	g_return_val_if_fail(key_file, NULL);
-	g_return_val_if_fail(group_name, NULL);
-	ENTER("key_file %p, group_name %s", key_file, group_name);
+    g_return_val_if_fail(GNC_IS_MAIN_WINDOW(window), NULL);
+    g_return_val_if_fail(key_file, NULL);
+    g_return_val_if_fail(group_name, NULL);
+    ENTER("key_file %p, group_name %s", key_file, group_name);
 
-	/* Create the new page. */
-	page = gnc_invoice_recreate_page(GNC_MAIN_WINDOW(window),
-					 key_file, group_name);
+    /* Create the new page. */
+    page = gnc_invoice_recreate_page(GNC_MAIN_WINDOW(window),
+                                     key_file, group_name);
 
-	LEAVE(" ");
-	return page;
+    LEAVE(" ");
+    return page;
 }
 
 
 static void
 gnc_plugin_page_invoice_window_changed (GncPluginPage *plugin_page,
-					GtkWidget *window)
+                                        GtkWidget *window)
 {
-	GncPluginPageInvoice *page;
-	GncPluginPageInvoicePrivate *priv;
-	
-	g_return_if_fail (GNC_IS_PLUGIN_PAGE_INVOICE (plugin_page));
+    GncPluginPageInvoice *page;
+    GncPluginPageInvoicePrivate *priv;
 
-	page = GNC_PLUGIN_PAGE_INVOICE(plugin_page);
-	priv = GNC_PLUGIN_PAGE_INVOICE_GET_PRIVATE(page);
-	gnc_invoice_window_changed (priv->iw, window);
+    g_return_if_fail (GNC_IS_PLUGIN_PAGE_INVOICE (plugin_page));
+
+    page = GNC_PLUGIN_PAGE_INVOICE(plugin_page);
+    priv = GNC_PLUGIN_PAGE_INVOICE_GET_PRIVATE(page);
+    gnc_invoice_window_changed (priv->iw, window);
 }
 
 
 static void
 gnc_plugin_page_invoice_summarybar_position_changed(GConfEntry *entry,
-						    gpointer user_data)
+        gpointer user_data)
 {
-	GncPluginPage *plugin_page;
-	GncPluginPageInvoice *page;
-	GncPluginPageInvoicePrivate *priv;
-	GtkPositionType position = GTK_POS_BOTTOM;
-	gchar *conf_string;
-	
-	g_return_if_fail(user_data != NULL);
-	
-	plugin_page = GNC_PLUGIN_PAGE(user_data);
-	page = GNC_PLUGIN_PAGE_INVOICE (user_data);
-	priv = GNC_PLUGIN_PAGE_INVOICE_GET_PRIVATE(page);
-	
-	conf_string = gnc_gconf_get_string (GCONF_GENERAL,
-					    KEY_SUMMARYBAR_POSITION, NULL);
-	if (conf_string) {
-		position = gnc_enum_from_nick (GTK_TYPE_POSITION_TYPE,
-					       conf_string, GTK_POS_BOTTOM);
-		g_free (conf_string);
-	}
+    GncPluginPage *plugin_page;
+    GncPluginPageInvoice *page;
+    GncPluginPageInvoicePrivate *priv;
+    GtkPositionType position = GTK_POS_BOTTOM;
+    gchar *conf_string;
 
-	gtk_box_reorder_child(GTK_BOX(priv->widget),
-			      plugin_page->summarybar,
-			      (position == GTK_POS_TOP ? 0 : -1) );
+    g_return_if_fail(user_data != NULL);
+
+    plugin_page = GNC_PLUGIN_PAGE(user_data);
+    page = GNC_PLUGIN_PAGE_INVOICE (user_data);
+    priv = GNC_PLUGIN_PAGE_INVOICE_GET_PRIVATE(page);
+
+    conf_string = gnc_gconf_get_string (GCONF_GENERAL,
+                                        KEY_SUMMARYBAR_POSITION, NULL);
+    if (conf_string)
+    {
+        position = gnc_enum_from_nick (GTK_TYPE_POSITION_TYPE,
+                                       conf_string, GTK_POS_BOTTOM);
+        g_free (conf_string);
+    }
+
+    gtk_box_reorder_child(GTK_BOX(priv->widget),
+                          plugin_page->summarybar,
+                          (position == GTK_POS_TOP ? 0 : -1) );
 }
 
 
@@ -562,248 +604,248 @@
 
 static void
 gnc_plugin_page_invoice_cmd_new_invoice (GtkAction *action,
-					 GncPluginPageInvoice *plugin_page)
+        GncPluginPageInvoice *plugin_page)
 {
-  GncPluginPageInvoicePrivate *priv;
+    GncPluginPageInvoicePrivate *priv;
 
-  g_return_if_fail(GNC_IS_PLUGIN_PAGE_INVOICE(plugin_page));
+    g_return_if_fail(GNC_IS_PLUGIN_PAGE_INVOICE(plugin_page));
 
-  ENTER("(action %p, plugin_page %p)", action, plugin_page);
-  priv = GNC_PLUGIN_PAGE_INVOICE_GET_PRIVATE(plugin_page);
-  gnc_invoice_window_new_invoice_cb(NULL, priv->iw);
-  LEAVE(" ");
+    ENTER("(action %p, plugin_page %p)", action, plugin_page);
+    priv = GNC_PLUGIN_PAGE_INVOICE_GET_PRIVATE(plugin_page);
+    gnc_invoice_window_new_invoice_cb(NULL, priv->iw);
+    LEAVE(" ");
 }
 
 static void
 gnc_plugin_page_invoice_cmd_new_account (GtkAction *action,
-					 GncPluginPageInvoice *plugin_page)
+        GncPluginPageInvoice *plugin_page)
 {
-  g_return_if_fail(GNC_IS_PLUGIN_PAGE_INVOICE(plugin_page));
+    g_return_if_fail(GNC_IS_PLUGIN_PAGE_INVOICE(plugin_page));
 
-  ENTER("(action %p, plugin_page %p)", action, plugin_page);
-  gnc_ui_new_account_window (gnc_get_current_book(), NULL);
-  LEAVE(" ");
+    ENTER("(action %p, plugin_page %p)", action, plugin_page);
+    gnc_ui_new_account_window (gnc_get_current_book(), NULL);
+    LEAVE(" ");
 }
 
 static void
 gnc_plugin_page_invoice_cmd_print (GtkAction *action,
-				   GncPluginPageInvoice *plugin_page)
+                                   GncPluginPageInvoice *plugin_page)
 {
-  GncPluginPageInvoicePrivate *priv;
+    GncPluginPageInvoicePrivate *priv;
 
-  g_return_if_fail(GNC_IS_PLUGIN_PAGE_INVOICE(plugin_page));
+    g_return_if_fail(GNC_IS_PLUGIN_PAGE_INVOICE(plugin_page));
 
-  ENTER("(action %p, plugin_page %p)", action, plugin_page);
-  priv = GNC_PLUGIN_PAGE_INVOICE_GET_PRIVATE(plugin_page);
-  gnc_invoice_window_printCB(NULL, priv->iw);
-  LEAVE(" ");
+    ENTER("(action %p, plugin_page %p)", action, plugin_page);
+    priv = GNC_PLUGIN_PAGE_INVOICE_GET_PRIVATE(plugin_page);
+    gnc_invoice_window_printCB(NULL, priv->iw);
+    LEAVE(" ");
 }
 
 static void
 gnc_plugin_page_invoice_cmd_cut (GtkAction *action,
-				 GncPluginPageInvoice *plugin_page)
+                                 GncPluginPageInvoice *plugin_page)
 {
-  GncPluginPageInvoicePrivate *priv;
+    GncPluginPageInvoicePrivate *priv;
 
-  g_return_if_fail(GNC_IS_PLUGIN_PAGE_INVOICE(plugin_page));
+    g_return_if_fail(GNC_IS_PLUGIN_PAGE_INVOICE(plugin_page));
 
-  ENTER("(action %p, plugin_page %p)", action, plugin_page);
-  priv = GNC_PLUGIN_PAGE_INVOICE_GET_PRIVATE(plugin_page);
-  gnc_invoice_window_cut_cb(NULL, priv->iw);
-  LEAVE(" ");
+    ENTER("(action %p, plugin_page %p)", action, plugin_page);
+    priv = GNC_PLUGIN_PAGE_INVOICE_GET_PRIVATE(plugin_page);
+    gnc_invoice_window_cut_cb(NULL, priv->iw);
+    LEAVE(" ");
 }
 
 static void
 gnc_plugin_page_invoice_cmd_copy (GtkAction *action,
-				  GncPluginPageInvoice *plugin_page)
+                                  GncPluginPageInvoice *plugin_page)
 {
-  GncPluginPageInvoicePrivate *priv;
+    GncPluginPageInvoicePrivate *priv;
 
-  g_return_if_fail(GNC_IS_PLUGIN_PAGE_INVOICE(plugin_page));
+    g_return_if_fail(GNC_IS_PLUGIN_PAGE_INVOICE(plugin_page));
 
-  ENTER("(action %p, plugin_page %p)", action, plugin_page);
-  priv = GNC_PLUGIN_PAGE_INVOICE_GET_PRIVATE(plugin_page);
-  gnc_invoice_window_copy_cb(NULL, priv->iw);
-  LEAVE(" ");
+    ENTER("(action %p, plugin_page %p)", action, plugin_page);
+    priv = GNC_PLUGIN_PAGE_INVOICE_GET_PRIVATE(plugin_page);
+    gnc_invoice_window_copy_cb(NULL, priv->iw);
+    LEAVE(" ");
 }
 
 static void
 gnc_plugin_page_invoice_cmd_paste (GtkAction *action,
-				   GncPluginPageInvoice *plugin_page)
+                                   GncPluginPageInvoice *plugin_page)
 {
-  GncPluginPageInvoicePrivate *priv;
+    GncPluginPageInvoicePrivate *priv;
 
-  g_return_if_fail(GNC_IS_PLUGIN_PAGE_INVOICE(plugin_page));
+    g_return_if_fail(GNC_IS_PLUGIN_PAGE_INVOICE(plugin_page));
 
-  ENTER("(action %p, plugin_page %p)", action, plugin_page);
-  priv = GNC_PLUGIN_PAGE_INVOICE_GET_PRIVATE(plugin_page);
-  gnc_invoice_window_paste_cb(NULL, priv->iw);
-  LEAVE(" ");
+    ENTER("(action %p, plugin_page %p)", action, plugin_page);
+    priv = GNC_PLUGIN_PAGE_INVOICE_GET_PRIVATE(plugin_page);
+    gnc_invoice_window_paste_cb(NULL, priv->iw);
+    LEAVE(" ");
 }
 
 static void
 gnc_plugin_page_invoice_cmd_edit (GtkAction *action,
-				  GncPluginPageInvoice *plugin_page)
+                                  GncPluginPageInvoice *plugin_page)
 {
-  GncPluginPageInvoicePrivate *priv;
+    GncPluginPageInvoicePrivate *priv;
 
-  g_return_if_fail(GNC_IS_PLUGIN_PAGE_INVOICE(plugin_page));
+    g_return_if_fail(GNC_IS_PLUGIN_PAGE_INVOICE(plugin_page));
 
-  ENTER("(action %p, plugin_page %p)", action, plugin_page);
-  priv = GNC_PLUGIN_PAGE_INVOICE_GET_PRIVATE(plugin_page);
-  gnc_invoice_window_editCB(NULL, priv->iw);
-  LEAVE(" ");
+    ENTER("(action %p, plugin_page %p)", action, plugin_page);
+    priv = GNC_PLUGIN_PAGE_INVOICE_GET_PRIVATE(plugin_page);
+    gnc_invoice_window_editCB(NULL, priv->iw);
+    LEAVE(" ");
 }
 
 static void
 gnc_plugin_page_invoice_cmd_post (GtkAction *action,
-				  GncPluginPageInvoice *plugin_page)
+                                  GncPluginPageInvoice *plugin_page)
 {
-  GncPluginPageInvoicePrivate *priv;
+    GncPluginPageInvoicePrivate *priv;
 
-  g_return_if_fail(GNC_IS_PLUGIN_PAGE_INVOICE(plugin_page));
+    g_return_if_fail(GNC_IS_PLUGIN_PAGE_INVOICE(plugin_page));
 
-  ENTER("(action %p, plugin_page %p)", action, plugin_page);
-  priv = GNC_PLUGIN_PAGE_INVOICE_GET_PRIVATE(plugin_page);
-  gnc_invoice_window_postCB(NULL, priv->iw);
-  LEAVE(" ");
+    ENTER("(action %p, plugin_page %p)", action, plugin_page);
+    priv = GNC_PLUGIN_PAGE_INVOICE_GET_PRIVATE(plugin_page);
+    gnc_invoice_window_postCB(NULL, priv->iw);
+    LEAVE(" ");
 }
 
 static void
 gnc_plugin_page_invoice_cmd_unpost (GtkAction *action,
-				    GncPluginPageInvoice *plugin_page)
+                                    GncPluginPageInvoice *plugin_page)
 {
-  GncPluginPageInvoicePrivate *priv;
+    GncPluginPageInvoicePrivate *priv;
 
-  g_return_if_fail(GNC_IS_PLUGIN_PAGE_INVOICE(plugin_page));
+    g_return_if_fail(GNC_IS_PLUGIN_PAGE_INVOICE(plugin_page));
 
-  ENTER("(action %p, plugin_page %p)", action, plugin_page);
-  priv = GNC_PLUGIN_PAGE_INVOICE_GET_PRIVATE(plugin_page);
-  gnc_invoice_window_unpostCB(NULL, priv->iw);
-  LEAVE(" ");
+    ENTER("(action %p, plugin_page %p)", action, plugin_page);
+    priv = GNC_PLUGIN_PAGE_INVOICE_GET_PRIVATE(plugin_page);
+    gnc_invoice_window_unpostCB(NULL, priv->iw);
+    LEAVE(" ");
 }
 
 static void
 gnc_plugin_page_invoice_cmd_sort_changed (GtkAction *action,
-					  GtkRadioAction *current,
-					  GncPluginPageInvoice *plugin_page)
+        GtkRadioAction *current,
+        GncPluginPageInvoice *plugin_page)
 {
-  GncPluginPageInvoicePrivate *priv;
-  invoice_sort_type_t value;
+    GncPluginPageInvoicePrivate *priv;
+    invoice_sort_type_t value;
 
-  ENTER("(action %p, radio action %p, plugin_page %p)",
-        action, current, plugin_page);
-  LEAVE("g_return testing...");
+    ENTER("(action %p, radio action %p, plugin_page %p)",
+          action, current, plugin_page);
+    LEAVE("g_return testing...");
 
-  g_return_if_fail(GTK_IS_ACTION(action));
-  g_return_if_fail(GTK_IS_RADIO_ACTION(current));
-  g_return_if_fail(GNC_IS_PLUGIN_PAGE_INVOICE(plugin_page));
+    g_return_if_fail(GTK_IS_ACTION(action));
+    g_return_if_fail(GTK_IS_RADIO_ACTION(current));
+    g_return_if_fail(GNC_IS_PLUGIN_PAGE_INVOICE(plugin_page));
 
-  ENTER("...passed (action %p, radio action %p, plugin_page %p)",
-        action, current, plugin_page);
-  priv = GNC_PLUGIN_PAGE_INVOICE_GET_PRIVATE(plugin_page);
-  value = gtk_radio_action_get_current_value(current);
-  gnc_invoice_window_sort (priv->iw, value);
-  LEAVE(" ");
+    ENTER("...passed (action %p, radio action %p, plugin_page %p)",
+          action, current, plugin_page);
+    priv = GNC_PLUGIN_PAGE_INVOICE_GET_PRIVATE(plugin_page);
+    value = gtk_radio_action_get_current_value(current);
+    gnc_invoice_window_sort (priv->iw, value);
+    LEAVE(" ");
 }
 
 
 static void
 gnc_plugin_page_invoice_cmd_enter (GtkAction *action,
-				   GncPluginPageInvoice *plugin_page)
+                                   GncPluginPageInvoice *plugin_page)
 {
-  GncPluginPageInvoicePrivate *priv;
+    GncPluginPageInvoicePrivate *priv;
 
-  g_return_if_fail(GNC_IS_PLUGIN_PAGE_INVOICE(plugin_page));
+    g_return_if_fail(GNC_IS_PLUGIN_PAGE_INVOICE(plugin_page));
 
-  ENTER("(action %p, plugin_page %p)", action, plugin_page);
-  priv = GNC_PLUGIN_PAGE_INVOICE_GET_PRIVATE(plugin_page);
-  gnc_invoice_window_recordCB(NULL, priv->iw);
-  LEAVE(" ");
+    ENTER("(action %p, plugin_page %p)", action, plugin_page);
+    priv = GNC_PLUGIN_PAGE_INVOICE_GET_PRIVATE(plugin_page);
+    gnc_invoice_window_recordCB(NULL, priv->iw);
+    LEAVE(" ");
 }
 
 static void
 gnc_plugin_page_invoice_cmd_cancel (GtkAction *action,
-				    GncPluginPageInvoice *plugin_page)
+                                    GncPluginPageInvoice *plugin_page)
 {
-  GncPluginPageInvoicePrivate *priv;
+    GncPluginPageInvoicePrivate *priv;
 
-  g_return_if_fail(GNC_IS_PLUGIN_PAGE_INVOICE(plugin_page));
+    g_return_if_fail(GNC_IS_PLUGIN_PAGE_INVOICE(plugin_page));
 
-  ENTER("(action %p, plugin_page %p)", action, plugin_page);
-  priv = GNC_PLUGIN_PAGE_INVOICE_GET_PRIVATE(plugin_page);
-  gnc_invoice_window_cancelCB(NULL, priv->iw);
-  LEAVE(" ");
+    ENTER("(action %p, plugin_page %p)", action, plugin_page);
+    priv = GNC_PLUGIN_PAGE_INVOICE_GET_PRIVATE(plugin_page);
+    gnc_invoice_window_cancelCB(NULL, priv->iw);
+    LEAVE(" ");
 }
 
 static void
 gnc_plugin_page_invoice_cmd_delete (GtkAction *action,
-				    GncPluginPageInvoice *plugin_page)
+                                    GncPluginPageInvoice *plugin_page)
 {
-  GncPluginPageInvoicePrivate *priv;
+    GncPluginPageInvoicePrivate *priv;
 
-  g_return_if_fail(GNC_IS_PLUGIN_PAGE_INVOICE(plugin_page));
+    g_return_if_fail(GNC_IS_PLUGIN_PAGE_INVOICE(plugin_page));
 
-  ENTER("(action %p, plugin_page %p)", action, plugin_page);
-  priv = GNC_PLUGIN_PAGE_INVOICE_GET_PRIVATE(plugin_page);
-  gnc_invoice_window_deleteCB(NULL, priv->iw);
-  LEAVE(" ");
+    ENTER("(action %p, plugin_page %p)", action, plugin_page);
+    priv = GNC_PLUGIN_PAGE_INVOICE_GET_PRIVATE(plugin_page);
+    gnc_invoice_window_deleteCB(NULL, priv->iw);
+    LEAVE(" ");
 }
 
 static void
 gnc_plugin_page_invoice_cmd_blank (GtkAction *action,
-				   GncPluginPageInvoice *plugin_page)
+                                   GncPluginPageInvoice *plugin_page)
 {
-  GncPluginPageInvoicePrivate *priv;
+    GncPluginPageInvoicePrivate *priv;
 
-  g_return_if_fail(GNC_IS_PLUGIN_PAGE_INVOICE(plugin_page));
+    g_return_if_fail(GNC_IS_PLUGIN_PAGE_INVOICE(plugin_page));
 
-  ENTER("(action %p, plugin_page %p)", action, plugin_page);
-  priv = GNC_PLUGIN_PAGE_INVOICE_GET_PRIVATE(plugin_page);
-  gnc_invoice_window_blankCB(NULL, priv->iw);
-  LEAVE(" ");
+    ENTER("(action %p, plugin_page %p)", action, plugin_page);
+    priv = GNC_PLUGIN_PAGE_INVOICE_GET_PRIVATE(plugin_page);
+    gnc_invoice_window_blankCB(NULL, priv->iw);
+    LEAVE(" ");
 }
 
 static void
 gnc_plugin_page_invoice_cmd_duplicate (GtkAction *action,
-				       GncPluginPageInvoice *plugin_page)
+                                       GncPluginPageInvoice *plugin_page)
 {
-  GncPluginPageInvoicePrivate *priv;
+    GncPluginPageInvoicePrivate *priv;
 
-  g_return_if_fail(GNC_IS_PLUGIN_PAGE_INVOICE(plugin_page));
+    g_return_if_fail(GNC_IS_PLUGIN_PAGE_INVOICE(plugin_page));
 
-  ENTER("(action %p, plugin_page %p)", action, plugin_page);
-  priv = GNC_PLUGIN_PAGE_INVOICE_GET_PRIVATE(plugin_page);
-  gnc_invoice_window_duplicateCB(NULL, priv->iw);
-  LEAVE(" ");
+    ENTER("(action %p, plugin_page %p)", action, plugin_page);
+    priv = GNC_PLUGIN_PAGE_INVOICE_GET_PRIVATE(plugin_page);
+    gnc_invoice_window_duplicateCB(NULL, priv->iw);
+    LEAVE(" ");
 }
 
 static void
 gnc_plugin_page_invoice_cmd_pay_invoice (GtkAction *action,
-					 GncPluginPageInvoice *plugin_page)
+        GncPluginPageInvoice *plugin_page)
 {
-  GncPluginPageInvoicePrivate *priv;
+    GncPluginPageInvoicePrivate *priv;
 
-  g_return_if_fail(GNC_IS_PLUGIN_PAGE_INVOICE(plugin_page));
+    g_return_if_fail(GNC_IS_PLUGIN_PAGE_INVOICE(plugin_page));
 
-  ENTER("(action %p, plugin_page %p)", action, plugin_page);
-  priv = GNC_PLUGIN_PAGE_INVOICE_GET_PRIVATE(plugin_page);
-  gnc_invoice_window_payment_cb(NULL, priv->iw);
-  LEAVE(" ");
+    ENTER("(action %p, plugin_page %p)", action, plugin_page);
+    priv = GNC_PLUGIN_PAGE_INVOICE_GET_PRIVATE(plugin_page);
+    gnc_invoice_window_payment_cb(NULL, priv->iw);
+    LEAVE(" ");
 }
 
 static void
 gnc_plugin_page_invoice_cmd_company_report (GtkAction *action,
-					    GncPluginPageInvoice *plugin_page)
+        GncPluginPageInvoice *plugin_page)
 {
-  GncPluginPageInvoicePrivate *priv;
+    GncPluginPageInvoicePrivate *priv;
 
-  g_return_if_fail(GNC_IS_PLUGIN_PAGE_INVOICE(plugin_page));
+    g_return_if_fail(GNC_IS_PLUGIN_PAGE_INVOICE(plugin_page));
 
-  ENTER("(action %p, plugin_page %p)", action, plugin_page);
-  priv = GNC_PLUGIN_PAGE_INVOICE_GET_PRIVATE(plugin_page);
-  gnc_invoice_window_report_owner_cb(NULL, priv->iw);
-  LEAVE(" ");
+    ENTER("(action %p, plugin_page %p)", action, plugin_page);
+    priv = GNC_PLUGIN_PAGE_INVOICE_GET_PRIVATE(plugin_page);
+    gnc_invoice_window_report_owner_cb(NULL, priv->iw);
+    LEAVE(" ");
 }
 
 /************************************************************/
@@ -812,57 +854,57 @@
 
 static void
 gnc_plugin_page_redraw_help_cb (GnucashRegister *g_reg,
-				GncPluginPageInvoice *invoice_page)
+                                GncPluginPageInvoice *invoice_page)
 {
-  GncPluginPageInvoicePrivate *priv;
-  GncWindow *window;
-  const char *status;
-  char *help;
+    GncPluginPageInvoicePrivate *priv;
+    GncWindow *window;
+    const char *status;
+    char *help;
 
-  g_return_if_fail(GNC_IS_PLUGIN_PAGE_INVOICE(invoice_page));
+    g_return_if_fail(GNC_IS_PLUGIN_PAGE_INVOICE(invoice_page));
 
-  window = GNC_WINDOW(GNC_PLUGIN_PAGE(invoice_page)->window);
+    window = GNC_WINDOW(GNC_PLUGIN_PAGE(invoice_page)->window);
 
-  /* Get the text from the ledger */
-  priv = GNC_PLUGIN_PAGE_INVOICE_GET_PRIVATE(invoice_page);
-  help = gnc_invoice_get_help(priv->iw);
-  status = help ? help : g_strdup("");
-  gnc_window_set_status(window, GNC_PLUGIN_PAGE(invoice_page), status);
-  g_free(help);
+    /* Get the text from the ledger */
+    priv = GNC_PLUGIN_PAGE_INVOICE_GET_PRIVATE(invoice_page);
+    help = gnc_invoice_get_help(priv->iw);
+    status = help ? help : g_strdup("");
+    gnc_window_set_status(window, GNC_PLUGIN_PAGE(invoice_page), status);
+    g_free(help);
 }
 
 
 void
 gnc_plugin_page_invoice_update_title (GncPluginPage *plugin_page)
 {
-  GncPluginPageInvoice *page;
-  GncPluginPageInvoicePrivate *priv;
-  gchar *title;
+    GncPluginPageInvoice *page;
+    GncPluginPageInvoicePrivate *priv;
+    gchar *title;
 
-  g_return_if_fail(GNC_IS_PLUGIN_PAGE_INVOICE(plugin_page));
+    g_return_if_fail(GNC_IS_PLUGIN_PAGE_INVOICE(plugin_page));
 
-  page = GNC_PLUGIN_PAGE_INVOICE(plugin_page);
-  priv = GNC_PLUGIN_PAGE_INVOICE_GET_PRIVATE(page);
-  title = gnc_invoice_get_title(priv->iw);
-  gnc_plugin_page_set_page_name(plugin_page, title);
-  g_free(title);
+    page = GNC_PLUGIN_PAGE_INVOICE(plugin_page);
+    priv = GNC_PLUGIN_PAGE_INVOICE_GET_PRIVATE(page);
+    title = gnc_invoice_get_title(priv->iw);
+    gnc_plugin_page_set_page_name(plugin_page, title);
+    g_free(title);
 }
 
 static void
 gnc_plugin_page_invoice_refresh_cb (GHashTable *changes, gpointer user_data)
 {
-  GncPluginPageInvoice *page = user_data;
-  GncPluginPageInvoicePrivate *priv;
-  GtkWidget *reg;
+    GncPluginPageInvoice *page = user_data;
+    GncPluginPageInvoicePrivate *priv;
+    GtkWidget *reg;
 
-  g_return_if_fail(GNC_IS_PLUGIN_PAGE_INVOICE(page));
+    g_return_if_fail(GNC_IS_PLUGIN_PAGE_INVOICE(page));
 
-  /* We're only looking for forced updates here. */
-  if (changes)
-    return;
+    /* We're only looking for forced updates here. */
+    if (changes)
+        return;
 
-  priv = GNC_PLUGIN_PAGE_INVOICE_GET_PRIVATE(page);
-  reg = gnc_invoice_get_register(priv->iw);
-  gnucash_register_refresh_from_gconf(GNUCASH_REGISTER(reg));
-  gtk_widget_queue_draw(priv->widget);
+    priv = GNC_PLUGIN_PAGE_INVOICE_GET_PRIVATE(page);
+    reg = gnc_invoice_get_register(priv->iw);
+    gnucash_register_refresh_from_gconf(GNUCASH_REGISTER(reg));
+    gtk_widget_queue_draw(priv->widget);
 }

Modified: gnucash/trunk/src/business/business-gnome/gnc-plugin-page-invoice.h
===================================================================
--- gnucash/trunk/src/business/business-gnome/gnc-plugin-page-invoice.h	2010-03-02 21:40:28 UTC (rev 18788)
+++ gnucash/trunk/src/business/business-gnome/gnc-plugin-page-invoice.h	2010-03-02 21:41:05 UTC (rev 18789)
@@ -1,5 +1,5 @@
-/* 
- * gnc-plugin-page-invoice.h -- 
+/*
+ * gnc-plugin-page-invoice.h --
  *
  * Copyright (C) 2005,2006 David Hampton <hampton at employees.org>
  *
@@ -25,7 +25,7 @@
     @{ */
 /** @addtogroup InvoicePlugin Business Invoice Page
     @{ */
-/** @file gnc-plugin-page-invoice.h 
+/** @file gnc-plugin-page-invoice.h
     @brief  utility functions for the GnuCash UI
     @author Copyright (C) 2005,2006 David Hampton <hampton at employees.org>
 */
@@ -52,12 +52,14 @@
 #define GNC_PLUGIN_PAGE_INVOICE_NAME "GncPluginPageInvoice"
 
 /* typedefs & structures */
-typedef struct {
-	GncPluginPage gnc_plugin_page;
+typedef struct
+{
+    GncPluginPage gnc_plugin_page;
 } GncPluginPageInvoice;
 
-typedef struct {
-	GncPluginPageClass gnc_plugin_page;
+typedef struct
+{
+    GncPluginPageClass gnc_plugin_page;
 } GncPluginPageInvoiceClass;
 
 /* function prototypes */

Modified: gnucash/trunk/src/business/business-gnome/search-owner.c
===================================================================
--- gnucash/trunk/src/business/business-gnome/search-owner.c	2010-03-02 21:40:28 UTC (rev 18788)
+++ gnucash/trunk/src/business/business-gnome/search-owner.c	2010-03-02 21:41:05 UTC (rev 18789)
@@ -49,10 +49,11 @@
 
 #define _PRIVATE(x) (((GNCSearchOwner *)(x))->priv)
 
-typedef struct _GNCSearchOwnerPrivate {
-  GncOwner	owner;
-  GtkWidget *	owner_box;
-  GtkWidget *	owner_choice;
+typedef struct _GNCSearchOwnerPrivate
+{
+    GncOwner	owner;
+    GtkWidget *	owner_box;
+    GtkWidget *	owner_choice;
 } GNCSearchOwnerPrivate;
 
 #define GNC_SEARCH_OWNER_GET_PRIVATE(o)  \
@@ -60,8 +61,9 @@
 
 static GNCSearchCoreTypeClass *parent_class;
 
-enum {
-  LAST_SIGNAL
+enum
+{
+    LAST_SIGNAL
 };
 
 #if LAST_SIGNAL > 0
@@ -71,47 +73,49 @@
 GType
 gnc_search_owner_get_type (void)
 {
-  static GType type = 0;
-	
-  if (!type) {
-    GTypeInfo type_info = {
-      sizeof(GNCSearchOwnerClass),    /* class_size */
-      NULL,   				/* base_init */
-      NULL,				/* base_finalize */
-      (GClassInitFunc)gnc_search_owner_class_init,
-      NULL,				/* class_finalize */
-      NULL,				/* class_data */
-      sizeof(GNCSearchOwner),		/* */
-      0,				/* n_preallocs */
-      (GInstanceInitFunc)gnc_search_owner_init,
-    };
-		
-    type = g_type_register_static (GNC_TYPE_SEARCH_CORE_TYPE,
-				   "GNCSearchOwner",
-				   &type_info, 0);
-  }
-	
-  return type;
+    static GType type = 0;
+
+    if (!type)
+    {
+        GTypeInfo type_info =
+        {
+            sizeof(GNCSearchOwnerClass),    /* class_size */
+            NULL,   				/* base_init */
+            NULL,				/* base_finalize */
+            (GClassInitFunc)gnc_search_owner_class_init,
+            NULL,				/* class_finalize */
+            NULL,				/* class_data */
+            sizeof(GNCSearchOwner),		/* */
+            0,				/* n_preallocs */
+            (GInstanceInitFunc)gnc_search_owner_init,
+        };
+
+        type = g_type_register_static (GNC_TYPE_SEARCH_CORE_TYPE,
+                                       "GNCSearchOwner",
+                                       &type_info, 0);
+    }
+
+    return type;
 }
 
 static void
 gnc_search_owner_class_init (GNCSearchOwnerClass *class)
 {
-  GObjectClass *object_class;
-  GNCSearchCoreTypeClass *gnc_search_core_type = (GNCSearchCoreTypeClass *)class;
+    GObjectClass *object_class;
+    GNCSearchCoreTypeClass *gnc_search_core_type = (GNCSearchCoreTypeClass *)class;
 
-  object_class = G_OBJECT_CLASS (class);
-  parent_class = gtk_type_class(gnc_search_core_type_get_type ());
+    object_class = G_OBJECT_CLASS (class);
+    parent_class = gtk_type_class(gnc_search_core_type_get_type ());
 
-  object_class->finalize = gnc_search_owner_finalize;
+    object_class->finalize = gnc_search_owner_finalize;
 
-  /* override methods */
-  gnc_search_core_type->validate = gncs_validate;
-  gnc_search_core_type->get_widget = gncs_get_widget;
-  gnc_search_core_type->get_predicate = gncs_get_predicate;
-  gnc_search_core_type->clone = gncs_clone;
+    /* override methods */
+    gnc_search_core_type->validate = gncs_validate;
+    gnc_search_core_type->get_widget = gncs_get_widget;
+    gnc_search_core_type->get_predicate = gncs_get_predicate;
+    gnc_search_core_type->clone = gncs_clone;
 
-  g_type_class_add_private(class, sizeof(GNCSearchOwnerPrivate));
+    g_type_class_add_private(class, sizeof(GNCSearchOwnerPrivate));
 }
 
 static void
@@ -122,126 +126,129 @@
 static void
 gnc_search_owner_finalize (GObject *obj)
 {
-  GNCSearchOwner *o;
-  GNCSearchOwnerPrivate *priv;
+    GNCSearchOwner *o;
+    GNCSearchOwnerPrivate *priv;
 
-  g_assert (IS_GNCSEARCH_OWNER (obj));
+    g_assert (IS_GNCSEARCH_OWNER (obj));
 
-  o = GNCSEARCH_OWNER(obj);
-  priv = GNC_SEARCH_OWNER_GET_PRIVATE(o);
+    o = GNCSEARCH_OWNER(obj);
+    priv = GNC_SEARCH_OWNER_GET_PRIVATE(o);
 
-  G_OBJECT_CLASS (parent_class)->finalize(obj);
+    G_OBJECT_CLASS (parent_class)->finalize(obj);
 }
 
 /**
  * gnc_search_owner_new:
  *
  * Create a new GNCSearchOwner object.
- * 
+ *
  * Return value: A new #GNCSearchOwner object.
  **/
 GNCSearchOwner *
 gnc_search_owner_new (void)
 {
-  GNCSearchOwner *o = g_object_new(gnc_search_owner_get_type (), NULL);
-  return o;
+    GNCSearchOwner *o = g_object_new(gnc_search_owner_get_type (), NULL);
+    return o;
 }
 
 static gboolean
 gncs_validate (GNCSearchCoreType *fe)
 {
-  GNCSearchOwner *fi = (GNCSearchOwner *)fe;
-  GNCSearchOwnerPrivate *priv;
-  gboolean valid = TRUE;
+    GNCSearchOwner *fi = (GNCSearchOwner *)fe;
+    GNCSearchOwnerPrivate *priv;
+    gboolean valid = TRUE;
 
-  g_return_val_if_fail (fi, FALSE);
-  g_return_val_if_fail (IS_GNCSEARCH_OWNER (fi), FALSE);
-  
-  priv = GNC_SEARCH_OWNER_GET_PRIVATE(fi);
-  if (priv->owner.owner.undefined == NULL) {
-    valid = FALSE;
-    gnc_error_dialog (NULL, "%s", _("You have not selected an owner"));
-  }
+    g_return_val_if_fail (fi, FALSE);
+    g_return_val_if_fail (IS_GNCSEARCH_OWNER (fi), FALSE);
 
-  /* XXX */
+    priv = GNC_SEARCH_OWNER_GET_PRIVATE(fi);
+    if (priv->owner.owner.undefined == NULL)
+    {
+        valid = FALSE;
+        gnc_error_dialog (NULL, "%s", _("You have not selected an owner"));
+    }
 
-  return valid;
+    /* XXX */
+
+    return valid;
 }
 
 static int
 owner_changed_cb (GtkWidget *widget, gpointer data)
 {
-  GNCSearchOwner *fe = data;
-  GNCSearchOwnerPrivate *priv;
+    GNCSearchOwner *fe = data;
+    GNCSearchOwnerPrivate *priv;
 
-  priv = GNC_SEARCH_OWNER_GET_PRIVATE(fe);
-  gnc_owner_get_owner (priv->owner_choice, &(priv->owner));
-  return FALSE;
+    priv = GNC_SEARCH_OWNER_GET_PRIVATE(fe);
+    gnc_owner_get_owner (priv->owner_choice, &(priv->owner));
+    return FALSE;
 }
 
 static void
 set_owner_widget (GNCSearchOwner *fe)
 {
-  GNCSearchOwnerPrivate *priv;
+    GNCSearchOwnerPrivate *priv;
 
-  /* Remove the old choice widget */
-  priv = GNC_SEARCH_OWNER_GET_PRIVATE(fe);
-  if (priv->owner_choice)
-    gtk_container_remove (GTK_CONTAINER (priv->owner_box), priv->owner_choice);
+    /* Remove the old choice widget */
+    priv = GNC_SEARCH_OWNER_GET_PRIVATE(fe);
+    if (priv->owner_choice)
+        gtk_container_remove (GTK_CONTAINER (priv->owner_box), priv->owner_choice);
 
-  /* Create a new choice widget */
-  priv->owner_choice =
-    gnc_owner_select_create (NULL, priv->owner_box,
-			     gnc_get_current_book(), &(priv->owner));
+    /* Create a new choice widget */
+    priv->owner_choice =
+        gnc_owner_select_create (NULL, priv->owner_box,
+                                 gnc_get_current_book(), &(priv->owner));
 
-  /* Setup the "changed" callback */
-  g_signal_connect (G_OBJECT (priv->owner_choice), "changed",
-		    G_CALLBACK (owner_changed_cb), fe);
+    /* Setup the "changed" callback */
+    g_signal_connect (G_OBJECT (priv->owner_choice), "changed",
+                      G_CALLBACK (owner_changed_cb), fe);
 
-  gtk_widget_show_all (priv->owner_choice);
+    gtk_widget_show_all (priv->owner_choice);
 }
 
 static void
 type_combo_changed (GtkWidget *widget, GNCSearchOwner *fe)
 {
-  GNCSearchOwnerPrivate *priv;
-  GncOwnerType type;
+    GNCSearchOwnerPrivate *priv;
+    GncOwnerType type;
 
-  g_return_if_fail(GTK_IS_COMBO_BOX(widget));
+    g_return_if_fail(GTK_IS_COMBO_BOX(widget));
 
-  type = gnc_combo_box_search_get_active(GTK_COMBO_BOX(widget));
+    type = gnc_combo_box_search_get_active(GTK_COMBO_BOX(widget));
 
-  /* If the type changed or if we don't have a type create the owner_choice */
-  priv = GNC_SEARCH_OWNER_GET_PRIVATE(fe);
-  if (type != gncOwnerGetType (&(priv->owner))) {
-    priv->owner.type = type;
-    priv->owner.owner.undefined = NULL;
-    set_owner_widget (fe);
-  } else if (priv->owner_choice == NULL)
-    set_owner_widget (fe);
+    /* If the type changed or if we don't have a type create the owner_choice */
+    priv = GNC_SEARCH_OWNER_GET_PRIVATE(fe);
+    if (type != gncOwnerGetType (&(priv->owner)))
+    {
+        priv->owner.type = type;
+        priv->owner.owner.undefined = NULL;
+        set_owner_widget (fe);
+    }
+    else if (priv->owner_choice == NULL)
+        set_owner_widget (fe);
 }
 
 static GtkWidget *
 make_type_menu (GNCSearchCoreType *fe)
 {
-  GNCSearchOwner *fi = (GNCSearchOwner *)fe;
-  GNCSearchOwnerPrivate *priv;
-  GtkComboBox *combo;
-  GncOwnerType type;
+    GNCSearchOwner *fi = (GNCSearchOwner *)fe;
+    GNCSearchOwnerPrivate *priv;
+    GtkComboBox *combo;
+    GncOwnerType type;
 
-  priv = GNC_SEARCH_OWNER_GET_PRIVATE(fi);
-  type = gncOwnerGetType (&(priv->owner));
+    priv = GNC_SEARCH_OWNER_GET_PRIVATE(fi);
+    type = gncOwnerGetType (&(priv->owner));
 
-  combo = GTK_COMBO_BOX(gnc_combo_box_new_search());
-  gnc_combo_box_search_add(combo, _("Customer"), GNC_OWNER_CUSTOMER);
-  gnc_combo_box_search_add(combo, _("Vendor"), GNC_OWNER_VENDOR);
-  gnc_combo_box_search_add(combo, _("Employee"), GNC_OWNER_EMPLOYEE);
-  gnc_combo_box_search_add(combo, _("Job"), GNC_OWNER_JOB);
+    combo = GTK_COMBO_BOX(gnc_combo_box_new_search());
+    gnc_combo_box_search_add(combo, _("Customer"), GNC_OWNER_CUSTOMER);
+    gnc_combo_box_search_add(combo, _("Vendor"), GNC_OWNER_VENDOR);
+    gnc_combo_box_search_add(combo, _("Employee"), GNC_OWNER_EMPLOYEE);
+    gnc_combo_box_search_add(combo, _("Job"), GNC_OWNER_JOB);
 
-  g_signal_connect (combo, "changed", G_CALLBACK (type_combo_changed), fe);
-  gnc_combo_box_search_set_active(combo, type);
+    g_signal_connect (combo, "changed", G_CALLBACK (type_combo_changed), fe);
+    gnc_combo_box_search_set_active(combo, type);
 
-  return GTK_WIDGET(combo);
+    return GTK_WIDGET(combo);
 
 
 }
@@ -249,82 +256,82 @@
 static GtkWidget *
 make_how_menu (GNCSearchCoreType *fe)
 {
-  GNCSearchOwner *fi = (GNCSearchOwner *)fe;
-  GtkComboBox *combo;
+    GNCSearchOwner *fi = (GNCSearchOwner *)fe;
+    GtkComboBox *combo;
 
-  combo = GTK_COMBO_BOX(gnc_combo_box_new_search());
-  gnc_combo_box_search_add(combo, _("is"), GUID_MATCH_ANY);
-  gnc_combo_box_search_add(combo, _("is not"), GUID_MATCH_NONE);
-  gnc_combo_box_search_changed(combo, &fi->how);
-  gnc_combo_box_search_set_active(combo, fi->how ? fi->how : GUID_MATCH_ANY);
+    combo = GTK_COMBO_BOX(gnc_combo_box_new_search());
+    gnc_combo_box_search_add(combo, _("is"), GUID_MATCH_ANY);
+    gnc_combo_box_search_add(combo, _("is not"), GUID_MATCH_NONE);
+    gnc_combo_box_search_changed(combo, &fi->how);
+    gnc_combo_box_search_set_active(combo, fi->how ? fi->how : GUID_MATCH_ANY);
 
-  return GTK_WIDGET(combo);
+    return GTK_WIDGET(combo);
 }
 
 static GtkWidget *
 gncs_get_widget (GNCSearchCoreType *fe)
 {
-  GtkWidget *how_menu, *type_menu, *box;
-  GNCSearchOwner *fi = (GNCSearchOwner *)fe;
-  GNCSearchOwnerPrivate *priv;
-	
-  g_return_val_if_fail (fi, NULL);
-  g_return_val_if_fail (IS_GNCSEARCH_OWNER (fi), NULL);
+    GtkWidget *how_menu, *type_menu, *box;
+    GNCSearchOwner *fi = (GNCSearchOwner *)fe;
+    GNCSearchOwnerPrivate *priv;
 
-  priv = GNC_SEARCH_OWNER_GET_PRIVATE(fi);
-  box = gtk_hbox_new (FALSE, 3);
+    g_return_val_if_fail (fi, NULL);
+    g_return_val_if_fail (IS_GNCSEARCH_OWNER (fi), NULL);
 
-  /* Build and connect the "how" option menu. */
-  how_menu = make_how_menu (fe);
-  gtk_box_pack_start (GTK_BOX (box), how_menu, FALSE, FALSE, 3);
+    priv = GNC_SEARCH_OWNER_GET_PRIVATE(fi);
+    box = gtk_hbox_new (FALSE, 3);
 
-  /* Create the owner box */
-  priv->owner_box = gtk_hbox_new (FALSE, 0);
+    /* Build and connect the "how" option menu. */
+    how_menu = make_how_menu (fe);
+    gtk_box_pack_start (GTK_BOX (box), how_menu, FALSE, FALSE, 3);
 
-  /* Build and connect the "type" option menu.
-   * Note that this will build the owner_choice and
-   * put it in the owner_box we just created.
-   */
-  type_menu = make_type_menu (fe);
-  gtk_box_pack_start (GTK_BOX (box), type_menu, FALSE, FALSE, 3);
+    /* Create the owner box */
+    priv->owner_box = gtk_hbox_new (FALSE, 0);
 
-  /* connect the owner box */
-  gtk_box_pack_start (GTK_BOX (box), priv->owner_box, FALSE, FALSE, 3);
+    /* Build and connect the "type" option menu.
+     * Note that this will build the owner_choice and
+     * put it in the owner_box we just created.
+     */
+    type_menu = make_type_menu (fe);
+    gtk_box_pack_start (GTK_BOX (box), type_menu, FALSE, FALSE, 3);
 
-  /* And return the box */
-  return box;
+    /* connect the owner box */
+    gtk_box_pack_start (GTK_BOX (box), priv->owner_box, FALSE, FALSE, 3);
+
+    /* And return the box */
+    return box;
 }
 
 static QueryPredData_t gncs_get_predicate (GNCSearchCoreType *fe)
 {
-  GNCSearchOwner *fi = (GNCSearchOwner *)fe;
-  GNCSearchOwnerPrivate *priv;
-  const GUID *guid;
-  GList *l = NULL;
+    GNCSearchOwner *fi = (GNCSearchOwner *)fe;
+    GNCSearchOwnerPrivate *priv;
+    const GUID *guid;
+    GList *l = NULL;
 
-  g_return_val_if_fail (fi, NULL);
-  g_return_val_if_fail (IS_GNCSEARCH_OWNER (fi), NULL);
+    g_return_val_if_fail (fi, NULL);
+    g_return_val_if_fail (IS_GNCSEARCH_OWNER (fi), NULL);
 
-  priv = GNC_SEARCH_OWNER_GET_PRIVATE(fi);
-  guid = gncOwnerGetGUID (&(priv->owner));
-  l = g_list_prepend (l, (gpointer)guid);
+    priv = GNC_SEARCH_OWNER_GET_PRIVATE(fi);
+    guid = gncOwnerGetGUID (&(priv->owner));
+    l = g_list_prepend (l, (gpointer)guid);
 
-  return gncQueryGUIDPredicate (fi->how, l);
+    return gncQueryGUIDPredicate (fi->how, l);
 }
 
 static GNCSearchCoreType *gncs_clone(GNCSearchCoreType *fe)
 {
-  GNCSearchOwner *se, *fse = (GNCSearchOwner *)fe;
-  GNCSearchOwnerPrivate *se_priv, *fse_priv;
+    GNCSearchOwner *se, *fse = (GNCSearchOwner *)fe;
+    GNCSearchOwnerPrivate *se_priv, *fse_priv;
 
-  g_return_val_if_fail (fse, NULL);
-  g_return_val_if_fail (IS_GNCSEARCH_OWNER (fse), NULL);
+    g_return_val_if_fail (fse, NULL);
+    g_return_val_if_fail (IS_GNCSEARCH_OWNER (fse), NULL);
 
-  se = gnc_search_owner_new ();
-  se->how = fse->how;
-  se_priv = GNC_SEARCH_OWNER_GET_PRIVATE(se);
-  fse_priv = GNC_SEARCH_OWNER_GET_PRIVATE(fse);
-  gncOwnerCopy (&(fse_priv->owner), &(se_priv->owner));
+    se = gnc_search_owner_new ();
+    se->how = fse->how;
+    se_priv = GNC_SEARCH_OWNER_GET_PRIVATE(se);
+    fse_priv = GNC_SEARCH_OWNER_GET_PRIVATE(fse);
+    gncOwnerCopy (&(fse_priv->owner), &(se_priv->owner));
 
-  return (GNCSearchCoreType *)se;
+    return (GNCSearchCoreType *)se;
 }

Modified: gnucash/trunk/src/business/business-gnome/search-owner.h
===================================================================
--- gnucash/trunk/src/business/business-gnome/search-owner.h	2010-03-02 21:40:28 UTC (rev 18788)
+++ gnucash/trunk/src/business/business-gnome/search-owner.h	2010-03-02 21:41:05 UTC (rev 18789)
@@ -32,18 +32,20 @@
 typedef struct _GNCSearchOwner	GNCSearchOwner;
 typedef struct _GNCSearchOwnerClass	GNCSearchOwnerClass;
 
-struct _GNCSearchOwner {
-  GNCSearchCoreType parent;
+struct _GNCSearchOwner
+{
+    GNCSearchCoreType parent;
 
-  guid_match_t	how;
+    guid_match_t	how;
 };
 
-struct _GNCSearchOwnerClass {
-  GNCSearchCoreTypeClass parent_class;
+struct _GNCSearchOwnerClass
+{
+    GNCSearchCoreTypeClass parent_class;
 
-  /* virtual methods */
+    /* virtual methods */
 
-  /* signals */
+    /* signals */
 };
 
 GType		gnc_search_owner_get_type	(void);

Modified: gnucash/trunk/src/business/business-ledger/gncEntryLedger.c
===================================================================
--- gnucash/trunk/src/business/business-ledger/gncEntryLedger.c	2010-03-02 21:40:28 UTC (rev 18788)
+++ gnucash/trunk/src/business/business-ledger/gncEntryLedger.c	2010-03-02 21:41:05 UTC (rev 18789)
@@ -50,19 +50,20 @@
 static void
 gnc_entry_ledger_clear_blank_entry (GncEntryLedger *ledger)
 {
-  GncEntry *entry;
+    GncEntry *entry;
 
-  if (!ledger) return;
+    if (!ledger) return;
 
-  entry = gnc_entry_ledger_get_blank_entry (ledger);
-  if (entry) {
-    if (!gncEntryIsOpen (entry))
-      gncEntryBeginEdit (entry);
-    gncEntryDestroy (entry);
-  }
+    entry = gnc_entry_ledger_get_blank_entry (ledger);
+    if (entry)
+    {
+        if (!gncEntryIsOpen (entry))
+            gncEntryBeginEdit (entry);
+        gncEntryDestroy (entry);
+    }
 
-  ledger->blank_entry_guid = *xaccGUIDNULL ();
-  ledger->blank_entry_edited = FALSE;
+    ledger->blank_entry_guid = *xaccGUIDNULL ();
+    ledger->blank_entry_edited = FALSE;
 }
 
 /** Exported Functions ***************************************************/
@@ -70,801 +71,819 @@
 GncEntry *
 gnc_entry_ledger_get_blank_entry (GncEntryLedger *ledger)
 {
-  if (!ledger) return NULL;
-  return gncEntryLookup (ledger->book, &(ledger->blank_entry_guid));
+    if (!ledger) return NULL;
+    return gncEntryLookup (ledger->book, &(ledger->blank_entry_guid));
 }
-		 
+
 Account *
 gnc_entry_ledger_get_account_by_name (GncEntryLedger *ledger, BasicCell * bcell,
-				      const char *name, gboolean *new)
+                                      const char *name, gboolean *new)
 {
-  const char *placeholder = _("The account %s does not allow transactions.");
-  const char *missing = _("The account %s does not exist. "
-			  "Would you like to create it?");
-  char *account_name;
-  ComboCell *cell = (ComboCell *) bcell;
-  Account *account;
+    const char *placeholder = _("The account %s does not allow transactions.");
+    const char *missing = _("The account %s does not exist. "
+                            "Would you like to create it?");
+    char *account_name;
+    ComboCell *cell = (ComboCell *) bcell;
+    Account *account;
 
-  /* Find the account */
-  account = gnc_account_lookup_for_register (gnc_get_current_root_account (), name);
+    /* Find the account */
+    account = gnc_account_lookup_for_register (gnc_get_current_root_account (), name);
 
-  if (!account) {
-    /* Ask if they want to create a new one. */
-    if (!gnc_verify_dialog (ledger->parent, TRUE, missing, name))
-      return NULL;
-    
-    /* No changes, as yet. */
-    *new = FALSE;
-
-    /* User said yes, they want to create a new account. */
-    account = gnc_ui_new_accounts_from_name_window (name);
     if (!account)
-      return NULL;
-    *new = TRUE;
+    {
+        /* Ask if they want to create a new one. */
+        if (!gnc_verify_dialog (ledger->parent, TRUE, missing, name))
+            return NULL;
 
-    /* Now have a new account. Update the cell with the name as created. */
-    account_name = gnc_get_account_name_for_register (account);
-    gnc_combo_cell_set_value (cell, account_name);
-    gnc_basic_cell_set_changed (&cell->cell, TRUE);
-    g_free (account_name);
-  }
+        /* No changes, as yet. */
+        *new = FALSE;
 
-  /* See if the account (either old or new) is a placeholder. */
-  if (xaccAccountGetPlaceholder (account)) {
-    gnc_error_dialog (ledger->parent, placeholder, name);
-  }
+        /* User said yes, they want to create a new account. */
+        account = gnc_ui_new_accounts_from_name_window (name);
+        if (!account)
+            return NULL;
+        *new = TRUE;
 
-  /* Be seeing you. */
-  return account;
+        /* Now have a new account. Update the cell with the name as created. */
+        account_name = gnc_get_account_name_for_register (account);
+        gnc_combo_cell_set_value (cell, account_name);
+        gnc_basic_cell_set_changed (&cell->cell, TRUE);
+        g_free (account_name);
+    }
+
+    /* See if the account (either old or new) is a placeholder. */
+    if (xaccAccountGetPlaceholder (account))
+    {
+        gnc_error_dialog (ledger->parent, placeholder, name);
+    }
+
+    /* Be seeing you. */
+    return account;
 }
 
 Account * gnc_entry_ledger_get_account (GncEntryLedger *ledger,
-					const char * cell_name)
+                                        const char * cell_name)
 {
-  BasicCell *cell;
-  const char * name;
-  gboolean dummy;
+    BasicCell *cell;
+    const char * name;
+    gboolean dummy;
 
-  cell = gnc_table_layout_get_cell (ledger->table->layout, cell_name);
-  if (!cell)
-    return NULL;
-  name = gnc_basic_cell_get_value (cell);
-  return gnc_entry_ledger_get_account_by_name (ledger, cell, name, &dummy);
+    cell = gnc_table_layout_get_cell (ledger->table->layout, cell_name);
+    if (!cell)
+        return NULL;
+    name = gnc_basic_cell_get_value (cell);
+    return gnc_entry_ledger_get_account_by_name (ledger, cell, name, &dummy);
 }
 
 GncTaxTable * gnc_entry_ledger_get_taxtable (GncEntryLedger *ledger,
-					     const char *cell_name)
+        const char *cell_name)
 {
-  GncEntry *entry;
-  const char * name;
+    GncEntry *entry;
+    const char * name;
 
-  /* If the cursor has changed, then pull in the current table */
-  if (gnc_table_layout_get_cell_changed (ledger->table->layout,
-					 cell_name, TRUE)) {
-    name = gnc_table_layout_get_cell_value (ledger->table->layout, cell_name);
-    return gncTaxTableLookupByName (ledger->book, name);
-  }
+    /* If the cursor has changed, then pull in the current table */
+    if (gnc_table_layout_get_cell_changed (ledger->table->layout,
+                                           cell_name, TRUE))
+    {
+        name = gnc_table_layout_get_cell_value (ledger->table->layout, cell_name);
+        return gncTaxTableLookupByName (ledger->book, name);
+    }
 
-  /* If it has not changed, pull in the table from the entry */
-  entry = gnc_entry_ledger_get_current_entry (ledger);
-  if (ledger->is_invoice)
-    return gncEntryGetInvTaxTable (entry);
-  else
-    return gncEntryGetBillTaxTable (entry);
+    /* If it has not changed, pull in the table from the entry */
+    entry = gnc_entry_ledger_get_current_entry (ledger);
+    if (ledger->is_invoice)
+        return gncEntryGetInvTaxTable (entry);
+    else
+        return gncEntryGetBillTaxTable (entry);
 }
 
 gboolean gnc_entry_ledger_get_checkmark (GncEntryLedger *ledger,
-					 const char * cell_name)
+        const char * cell_name)
 {
-  CheckboxCell *cell = 
-    (CheckboxCell *) gnc_table_layout_get_cell (ledger->table->layout, cell_name);
+    CheckboxCell *cell =
+        (CheckboxCell *) gnc_table_layout_get_cell (ledger->table->layout, cell_name);
 
-  if (!cell)
-    return FALSE;
+    if (!cell)
+        return FALSE;
 
-  return cell->flag;
+    return cell->flag;
 }
 
 gint gnc_entry_ledger_get_type (GncEntryLedger *ledger, const char * cell_name)
 {
-  RecnCell *cell =
-    (RecnCell *) gnc_table_layout_get_cell (ledger->table->layout, cell_name);
+    RecnCell *cell =
+        (RecnCell *) gnc_table_layout_get_cell (ledger->table->layout, cell_name);
 
-  if (!cell)
-    return -1;
+    if (!cell)
+        return -1;
 
-  return (gnc_recn_cell_get_flag (cell) - '0');
+    return (gnc_recn_cell_get_flag (cell) - '0');
 }
 
 /* Return TRUE if value is valid, return FALSE if invalid */
 gboolean gnc_entry_ledger_get_numeric (GncEntryLedger *ledger,
-				       const char *cell_name,
-				       gnc_numeric *value)
+                                       const char *cell_name,
+                                       gnc_numeric *value)
 {
-  PriceCell *cell =
-    (PriceCell *) gnc_table_layout_get_cell (ledger->table->layout, cell_name);
+    PriceCell *cell =
+        (PriceCell *) gnc_table_layout_get_cell (ledger->table->layout, cell_name);
 
-  if (!value || !cell)
-    return FALSE;
+    if (!value || !cell)
+        return FALSE;
 
-  *value = gnc_price_cell_get_value (cell);
-  return TRUE;
+    *value = gnc_price_cell_get_value (cell);
+    return TRUE;
 }
-			      
 
+
 GncEntry * gnc_entry_ledger_get_entry (GncEntryLedger *ledger,
-				       VirtualCellLocation vcell_loc)
+                                       VirtualCellLocation vcell_loc)
 {
-  GUID *guid;
+    GUID *guid;
 
-  if (!ledger) return NULL;
+    if (!ledger) return NULL;
 
-  guid = gnc_table_get_vcell_data (ledger->table, vcell_loc);
-  if (!guid) return NULL;
+    guid = gnc_table_get_vcell_data (ledger->table, vcell_loc);
+    if (!guid) return NULL;
 
-  return gncEntryLookup (ledger->book, guid);
+    return gncEntryLookup (ledger->book, guid);
 }
 
 /* Returns the Entry where the cursor is currently located. */
 GncEntry * gnc_entry_ledger_get_current_entry (GncEntryLedger *ledger)
 {
-  if (!ledger) return NULL;
+    if (!ledger) return NULL;
 
-  return
-    gnc_entry_ledger_get_entry (ledger,
-				ledger->table->current_cursor_loc.vcell_loc);
+    return
+        gnc_entry_ledger_get_entry (ledger,
+                                    ledger->table->current_cursor_loc.vcell_loc);
 }
 
 static void gnc_entry_ledger_config_action (GncEntryLedger *ledger)
 {
-  ComboCell *cell;
+    ComboCell *cell;
 
-  cell = (ComboCell *) gnc_table_layout_get_cell (ledger->table->layout,
-						  ENTRY_ACTN_CELL);
-  if (!cell) return;
+    cell = (ComboCell *) gnc_table_layout_get_cell (ledger->table->layout,
+            ENTRY_ACTN_CELL);
+    if (!cell) return;
 
-  /* XXX: change this based on the ledger type */
+    /* XXX: change this based on the ledger type */
 
-  gnc_combo_cell_add_menu_item (cell, _("Hours"));
-  gnc_combo_cell_add_menu_item (cell, _("Project"));
-  gnc_combo_cell_add_menu_item (cell, _("Material"));
+    gnc_combo_cell_add_menu_item (cell, _("Hours"));
+    gnc_combo_cell_add_menu_item (cell, _("Project"));
+    gnc_combo_cell_add_menu_item (cell, _("Material"));
 }
 
 static void
 gnc_entry_ledger_config_cells (GncEntryLedger *ledger)
 {
-  /* the action cell */
-  gnc_combo_cell_set_autosize
+    /* the action cell */
+    gnc_combo_cell_set_autosize
     ((ComboCell *)
      gnc_table_layout_get_cell (ledger->table->layout, ENTRY_ACTN_CELL), TRUE);
 
-  /* The action cell should also accept strings not in the list */
-  gnc_combo_cell_set_strict
+    /* The action cell should also accept strings not in the list */
+    gnc_combo_cell_set_strict
     ((ComboCell *)
      gnc_table_layout_get_cell (ledger->table->layout, ENTRY_ACTN_CELL), FALSE);
 
-  /* Use 6 decimal places for all prices and quantities */
-  gnc_price_cell_set_fraction
+    /* Use 6 decimal places for all prices and quantities */
+    gnc_price_cell_set_fraction
     ((PriceCell *)
      gnc_table_layout_get_cell (ledger->table->layout, ENTRY_PRIC_CELL),
      1000000);
 
-  gnc_price_cell_set_fraction
+    gnc_price_cell_set_fraction
     ((PriceCell *)
      gnc_table_layout_get_cell (ledger->table->layout, ENTRY_DISC_CELL),
      1000000);
 
-  gnc_price_cell_set_fraction
+    gnc_price_cell_set_fraction
     ((PriceCell *) gnc_table_layout_get_cell (ledger->table->layout,
-					      ENTRY_QTY_CELL),
+            ENTRY_QTY_CELL),
      1000000);
 
-  /* add menu items for the action and payment cells */
-  gnc_entry_ledger_config_action (ledger);
+    /* add menu items for the action and payment cells */
+    gnc_entry_ledger_config_action (ledger);
 }
 
 /* Create and return a new GncEntry Ledger */
 GncEntryLedger * gnc_entry_ledger_new (QofBook *book, GncEntryLedgerType type)
 {
-  GncEntryLedger *ledger;
+    GncEntryLedger *ledger;
 
-  if (!book) return NULL;
-  if (type < 0 || type >= GNCENTRY_NUM_REGISTER_TYPES) return NULL;
+    if (!book) return NULL;
+    if (type < 0 || type >= GNCENTRY_NUM_REGISTER_TYPES) return NULL;
 
-  ledger = g_new0 (GncEntryLedger, 1);
-  ledger->type = type;
-  ledger->book = book;
-  ledger->traverse_to_new = TRUE;
-  ledger->gconf_section = NULL;
+    ledger = g_new0 (GncEntryLedger, 1);
+    ledger->type = type;
+    ledger->book = book;
+    ledger->traverse_to_new = TRUE;
+    ledger->gconf_section = NULL;
 
-  /* Orders and Invoices are "invoices" for lookups */
-  switch (type) {
-  case GNCENTRY_ORDER_ENTRY:
-  case GNCENTRY_ORDER_VIEWER:
-  case GNCENTRY_INVOICE_ENTRY:
-  case GNCENTRY_INVOICE_VIEWER:
-    ledger->is_invoice = TRUE;
-    break;
-  case GNCENTRY_BILL_ENTRY:
-  case GNCENTRY_BILL_VIEWER:
-  case GNCENTRY_EXPVOUCHER_ENTRY:
-  case GNCENTRY_EXPVOUCHER_VIEWER:
-  case GNCENTRY_NUM_REGISTER_TYPES:
-    ledger->is_invoice = FALSE;
-    break;
-  }
+    /* Orders and Invoices are "invoices" for lookups */
+    switch (type)
+    {
+    case GNCENTRY_ORDER_ENTRY:
+    case GNCENTRY_ORDER_VIEWER:
+    case GNCENTRY_INVOICE_ENTRY:
+    case GNCENTRY_INVOICE_VIEWER:
+        ledger->is_invoice = TRUE;
+        break;
+    case GNCENTRY_BILL_ENTRY:
+    case GNCENTRY_BILL_VIEWER:
+    case GNCENTRY_EXPVOUCHER_ENTRY:
+    case GNCENTRY_EXPVOUCHER_VIEWER:
+    case GNCENTRY_NUM_REGISTER_TYPES:
+        ledger->is_invoice = FALSE;
+        break;
+    }
 
-  ledger->blank_entry_guid = *xaccGUIDNULL();
-  ledger->blank_entry_edited = FALSE;
+    ledger->blank_entry_guid = *xaccGUIDNULL();
+    ledger->blank_entry_edited = FALSE;
 
-  {
-    Timespec ts = { 0, 0 };
-    ts.tv_sec = time (NULL);
-    ledger->last_date_entered = timespecCanonicalDayTime (ts);
-  }
+    {
+        Timespec ts = { 0, 0 };
+        ts.tv_sec = time (NULL);
+        ledger->last_date_entered = timespecCanonicalDayTime (ts);
+    }
 
-  {
-    TableLayout *layout = gnc_entry_ledger_layout_new (ledger);
-    TableModel *model = gnc_entry_ledger_model_new (type);
-    TableControl *control = gnc_entry_ledger_control_new ();
-    model->handler_user_data = ledger;
-    control->user_data = ledger;
+    {
+        TableLayout *layout = gnc_entry_ledger_layout_new (ledger);
+        TableModel *model = gnc_entry_ledger_model_new (type);
+        TableControl *control = gnc_entry_ledger_control_new ();
+        model->handler_user_data = ledger;
+        control->user_data = ledger;
 
-    ledger->table = gnc_table_new (layout, model, control);
-  }
+        ledger->table = gnc_table_new (layout, model, control);
+    }
 
-  gnc_entry_ledger_config_cells (ledger);
+    gnc_entry_ledger_config_cells (ledger);
 
-  /* set up header */
-  {
-    VirtualCellLocation vcell_loc = { 0, 0 };
-    CellBlock *header;
+    /* set up header */
+    {
+        VirtualCellLocation vcell_loc = { 0, 0 };
+        CellBlock *header;
 
-    header = gnc_table_layout_get_cursor (ledger->table->layout, CURSOR_HEADER);
+        header = gnc_table_layout_get_cursor (ledger->table->layout, CURSOR_HEADER);
 
-    gnc_table_set_vcell (ledger->table, header, NULL, TRUE, TRUE, vcell_loc);
-  }
+        gnc_table_set_vcell (ledger->table, header, NULL, TRUE, TRUE, vcell_loc);
+    }
 
-  /* set up first initial row */
-  {
-    VirtualLocation vloc;
-    CellBlock *cursor;
+    /* set up first initial row */
+    {
+        VirtualLocation vloc;
+        CellBlock *cursor;
 
-    vloc.vcell_loc.virt_row = 1;
-    vloc.vcell_loc.virt_col = 0;
-    vloc.phys_row_offset = 0;
-    vloc.phys_col_offset = 0;
+        vloc.vcell_loc.virt_row = 1;
+        vloc.vcell_loc.virt_col = 0;
+        vloc.phys_row_offset = 0;
+        vloc.phys_col_offset = 0;
 
-    cursor = gnc_table_layout_get_cursor (ledger->table->layout, "cursor");
-      
-    gnc_table_set_vcell (ledger->table, cursor, NULL, TRUE, TRUE, vloc.vcell_loc);
+        cursor = gnc_table_layout_get_cursor (ledger->table->layout, "cursor");
 
-    if (gnc_table_find_close_valid_cell (ledger->table, &vloc, FALSE))
-      gnc_table_move_cursor (ledger->table, vloc);
-    else
-    {
-      g_warning ("Can't find valid initial location");
+        gnc_table_set_vcell (ledger->table, cursor, NULL, TRUE, TRUE, vloc.vcell_loc);
+
+        if (gnc_table_find_close_valid_cell (ledger->table, &vloc, FALSE))
+            gnc_table_move_cursor (ledger->table, vloc);
+        else
+        {
+            g_warning ("Can't find valid initial location");
+        }
     }
-  }
 
-  /* Initialize Display */
-  gnc_entry_ledger_display_init (ledger);
-  return ledger;
+    /* Initialize Display */
+    gnc_entry_ledger_display_init (ledger);
+    return ledger;
 }
 
 /* Destroy the GncEntry Ledger */
 void gnc_entry_ledger_destroy (GncEntryLedger *ledger)
 {
-  if (!ledger) return;
+    if (!ledger) return;
 
-  /* Destroy blank entry, etc. */
-  gnc_entry_ledger_clear_blank_entry (ledger);
-  gnc_entry_ledger_display_fini (ledger);
-  gnc_table_destroy (ledger->table);
-  gncQueryDestroy (ledger->query);
-  g_free (ledger);
+    /* Destroy blank entry, etc. */
+    gnc_entry_ledger_clear_blank_entry (ledger);
+    gnc_entry_ledger_display_fini (ledger);
+    gnc_table_destroy (ledger->table);
+    gncQueryDestroy (ledger->query);
+    g_free (ledger);
 }
 
 Table * gnc_entry_ledger_get_table (GncEntryLedger *ledger)
 {
-  if (!ledger) return NULL;
-  return ledger->table;
+    if (!ledger) return NULL;
+    return ledger->table;
 }
 
 void gnc_entry_ledger_set_default_order (GncEntryLedger *ledger,
-					 GncOrder *order)
+        GncOrder *order)
 {
-  if (!ledger) return;
-  ledger->order = order;
+    if (!ledger) return;
+    ledger->order = order;
 
-  if (!ledger->query && order) {
-    ledger->query = gncQueryCreateFor (GNC_ENTRY_MODULE_NAME);
-    gncQuerySetBook (ledger->query, gncOrderGetBook (order));
-    gncQueryAddGUIDMatch (ledger->query,
-			  g_slist_prepend (g_slist_prepend (NULL,
-							    QUERY_PARAM_GUID),
-					   ENTRY_ORDER),
-			  gncOrderGetGUID (order), QUERY_AND);
-  }
-  gnc_entry_ledger_display_refresh (ledger);
+    if (!ledger->query && order)
+    {
+        ledger->query = gncQueryCreateFor (GNC_ENTRY_MODULE_NAME);
+        gncQuerySetBook (ledger->query, gncOrderGetBook (order));
+        gncQueryAddGUIDMatch (ledger->query,
+                              g_slist_prepend (g_slist_prepend (NULL,
+                                               QUERY_PARAM_GUID),
+                                               ENTRY_ORDER),
+                              gncOrderGetGUID (order), QUERY_AND);
+    }
+    gnc_entry_ledger_display_refresh (ledger);
 }
 
 static void create_invoice_query (GncEntryLedger *ledger)
 {
-  QueryNew *q, *q1;
-  char * type = NULL;
+    QueryNew *q, *q1;
+    char * type = NULL;
 
-  if (!ledger->invoice)
-    return;
+    if (!ledger->invoice)
+        return;
 
-  if (ledger->query)
-    gncQueryDestroy (ledger->query);
+    if (ledger->query)
+        gncQueryDestroy (ledger->query);
 
-  /* Match:   (where I-TYPE == Invoice or Bill)
-   *
-   * 1. book AND
-   * 2.   ( Entry->I-TYPE == ledger->invoice
-   * #if I-TYPE == Invoice (entry only)
-   *        OR
-   * 3.     ( Entry->Invoice == NULL AND
-   *          ( Entry->Billable == TRUE AND
-   *            Entry->Bill->Is-Posted? == TRUE AND
-   *            ( Entry->BillTo == Invoice->parent OR
-   *              Entry->Bill->BillTo == Invoice->parent ) )
-   *           OR
-   *           ( Entry->Order->real-parent == Invoice->parent ) )
-   * #endif
-   *      )
-   *
-   * Note that term 3 is only for Editable invoices.
-   */
-  
-  /* Term 1 */
-  ledger->query = gncQueryCreateFor (GNC_ENTRY_MODULE_NAME);
-  gncQuerySetBook (ledger->query, gncInvoiceGetBook (ledger->invoice));
-  
-  /* Term 2 */
-  switch (ledger->type) {
-  case GNCENTRY_INVOICE_ENTRY:
-  case GNCENTRY_INVOICE_VIEWER:
-    type = ENTRY_INVOICE;
-    break;
-  case GNCENTRY_BILL_ENTRY:
-  case GNCENTRY_BILL_VIEWER:
-  case GNCENTRY_EXPVOUCHER_ENTRY:
-  case GNCENTRY_EXPVOUCHER_VIEWER:
-    type = ENTRY_BILL;
-    break;
-  default:
-    g_warning ("Invalid Ledger type");
-    type = ENTRY_INVOICE;
-    break;
-  }
+    /* Match:   (where I-TYPE == Invoice or Bill)
+     *
+     * 1. book AND
+     * 2.   ( Entry->I-TYPE == ledger->invoice
+     * #if I-TYPE == Invoice (entry only)
+     *        OR
+     * 3.     ( Entry->Invoice == NULL AND
+     *          ( Entry->Billable == TRUE AND
+     *            Entry->Bill->Is-Posted? == TRUE AND
+     *            ( Entry->BillTo == Invoice->parent OR
+     *              Entry->Bill->BillTo == Invoice->parent ) )
+     *           OR
+     *           ( Entry->Order->real-parent == Invoice->parent ) )
+     * #endif
+     *      )
+     *
+     * Note that term 3 is only for Editable invoices.
+     */
 
-  q = gncQueryCreateFor (GNC_ENTRY_MODULE_NAME);
-  gncQueryAddGUIDMatch (q, gncQueryBuildParamList (type, QUERY_PARAM_GUID, NULL),
-			gncInvoiceGetGUID (ledger->invoice), QUERY_OR);
+    /* Term 1 */
+    ledger->query = gncQueryCreateFor (GNC_ENTRY_MODULE_NAME);
+    gncQuerySetBook (ledger->query, gncInvoiceGetBook (ledger->invoice));
 
-  /* Term 3 */
-  if (ledger->type == GNCENTRY_INVOICE_ENTRY &&
-      gncOwnerGetEndGUID (gncInvoiceGetOwner (ledger->invoice)) != NULL) {
+    /* Term 2 */
+    switch (ledger->type)
+    {
+    case GNCENTRY_INVOICE_ENTRY:
+    case GNCENTRY_INVOICE_VIEWER:
+        type = ENTRY_INVOICE;
+        break;
+    case GNCENTRY_BILL_ENTRY:
+    case GNCENTRY_BILL_VIEWER:
+    case GNCENTRY_EXPVOUCHER_ENTRY:
+    case GNCENTRY_EXPVOUCHER_VIEWER:
+        type = ENTRY_BILL;
+        break;
+    default:
+        g_warning ("Invalid Ledger type");
+        type = ENTRY_INVOICE;
+        break;
+    }
 
-    const GUID *invoice_parent =
-      gncOwnerGetGUID (gncInvoiceGetOwner (ledger->invoice));
-    QueryNew *q2 = gncQueryCreateFor (GNC_ENTRY_MODULE_NAME);
+    q = gncQueryCreateFor (GNC_ENTRY_MODULE_NAME);
+    gncQueryAddGUIDMatch (q, gncQueryBuildParamList (type, QUERY_PARAM_GUID, NULL),
+                          gncInvoiceGetGUID (ledger->invoice), QUERY_OR);
 
-    /*
-     * Entry->BillTo == Invoice->parent OR
-     * ( Entry->BillTo == NULL AND Entry->Bill->BillTo == Invoice->parent )
-     */
+    /* Term 3 */
+    if (ledger->type == GNCENTRY_INVOICE_ENTRY &&
+            gncOwnerGetEndGUID (gncInvoiceGetOwner (ledger->invoice)) != NULL)
+    {
 
-    gncQueryAddGUIDMatch (q2, gncQueryBuildParamList (ENTRY_BILLTO,
-						      QUERY_PARAM_GUID, NULL),
-			  NULL, QUERY_AND);
-    gncQueryAddGUIDMatch (q2, gncQueryBuildParamList (ENTRY_BILL, INVOICE_BILLTO,
-						      QUERY_PARAM_GUID, NULL),
-			  invoice_parent, QUERY_AND);
-    gncQueryAddGUIDMatch (q2, gncQueryBuildParamList (ENTRY_BILLTO,
-						      QUERY_PARAM_GUID, NULL),
-			  invoice_parent, QUERY_OR);
+        const GUID *invoice_parent =
+            gncOwnerGetGUID (gncInvoiceGetOwner (ledger->invoice));
+        QueryNew *q2 = gncQueryCreateFor (GNC_ENTRY_MODULE_NAME);
 
-    /* Entry->Billable == TRUE AND Entry->Bill->Is-Posted? == TRUE */
-    gncQueryAddBooleanMatch (q2, gncQueryBuildParamList (ENTRY_BILLABLE, NULL),
-			     TRUE, QUERY_AND);
-    gncQueryAddBooleanMatch (q2, gncQueryBuildParamList (ENTRY_BILL,
-							 INVOICE_IS_POSTED, NULL),
-			     TRUE, QUERY_AND);
+        /*
+         * Entry->BillTo == Invoice->parent OR
+         * ( Entry->BillTo == NULL AND Entry->Bill->BillTo == Invoice->parent )
+         */
 
-    /* Entry->Order->real-parent == Invoice->parent */
-    gncQueryAddGUIDMatch (q2, gncQueryBuildParamList (ENTRY_ORDER, ORDER_OWNER,
-						      OWNER_PARENTG, NULL),
-			  invoice_parent, QUERY_OR);
-    
-    /* Entry->Invoice == NULL */
-    gncQueryAddGUIDMatch (q2, gncQueryBuildParamList (ENTRY_INVOICE,
-						      QUERY_PARAM_GUID, NULL),
-			  NULL, QUERY_AND);
+        gncQueryAddGUIDMatch (q2, gncQueryBuildParamList (ENTRY_BILLTO,
+                              QUERY_PARAM_GUID, NULL),
+                              NULL, QUERY_AND);
+        gncQueryAddGUIDMatch (q2, gncQueryBuildParamList (ENTRY_BILL, INVOICE_BILLTO,
+                              QUERY_PARAM_GUID, NULL),
+                              invoice_parent, QUERY_AND);
+        gncQueryAddGUIDMatch (q2, gncQueryBuildParamList (ENTRY_BILLTO,
+                              QUERY_PARAM_GUID, NULL),
+                              invoice_parent, QUERY_OR);
 
+        /* Entry->Billable == TRUE AND Entry->Bill->Is-Posted? == TRUE */
+        gncQueryAddBooleanMatch (q2, gncQueryBuildParamList (ENTRY_BILLABLE, NULL),
+                                 TRUE, QUERY_AND);
+        gncQueryAddBooleanMatch (q2, gncQueryBuildParamList (ENTRY_BILL,
+                                 INVOICE_IS_POSTED, NULL),
+                                 TRUE, QUERY_AND);
 
-    /* Combine terms 2 and 3 */
-    q1 = gncQueryMerge (q, q2, QUERY_OR);
+        /* Entry->Order->real-parent == Invoice->parent */
+        gncQueryAddGUIDMatch (q2, gncQueryBuildParamList (ENTRY_ORDER, ORDER_OWNER,
+                              OWNER_PARENTG, NULL),
+                              invoice_parent, QUERY_OR);
+
+        /* Entry->Invoice == NULL */
+        gncQueryAddGUIDMatch (q2, gncQueryBuildParamList (ENTRY_INVOICE,
+                              QUERY_PARAM_GUID, NULL),
+                              NULL, QUERY_AND);
+
+
+        /* Combine terms 2 and 3 */
+        q1 = gncQueryMerge (q, q2, QUERY_OR);
+        gncQueryDestroy (q);
+        gncQueryDestroy (q2);
+        q = q1;
+    }
+
+    /* Combine terms 1 and 2 */
+    q1 = gncQueryMerge (ledger->query, q, QUERY_AND);
     gncQueryDestroy (q);
-    gncQueryDestroy (q2);
-    q = q1;
-  }
-
-  /* Combine terms 1 and 2 */
-  q1 = gncQueryMerge (ledger->query, q, QUERY_AND);
-  gncQueryDestroy (q);
-  gncQueryDestroy (ledger->query);
-  ledger->query = q1;
+    gncQueryDestroy (ledger->query);
+    ledger->query = q1;
 }
 
 void gnc_entry_ledger_set_default_invoice (GncEntryLedger *ledger,
-					   GncInvoice *invoice)
+        GncInvoice *invoice)
 {
-  if (!ledger) return;
-  ledger->invoice = invoice;
+    if (!ledger) return;
+    ledger->invoice = invoice;
 
-  if (!ledger->query && invoice)
-    create_invoice_query (ledger);
+    if (!ledger->query && invoice)
+        create_invoice_query (ledger);
 
-  gnc_entry_ledger_display_refresh (ledger);
+    gnc_entry_ledger_display_refresh (ledger);
 }
 
 void gnc_entry_ledger_reset_query (GncEntryLedger *ledger)
 {
-  if (!ledger) return;
-  if (!ledger->invoice) return;
+    if (!ledger) return;
+    if (!ledger->invoice) return;
 
-  create_invoice_query (ledger);
-  gnc_entry_ledger_display_refresh (ledger);
+    create_invoice_query (ledger);
+    gnc_entry_ledger_display_refresh (ledger);
 }
 
 void gnc_entry_ledger_set_parent (GncEntryLedger *ledger, gncUIWidget parent)
 {
-  if (!ledger) return;
-  ledger->parent = parent;
+    if (!ledger) return;
+    ledger->parent = parent;
 }
 
 gboolean gnc_entry_ledger_find_entry (GncEntryLedger *ledger, GncEntry *entry,
-				      VirtualCellLocation *vcell_loc)
+                                      VirtualCellLocation *vcell_loc)
 {
-  Table *table = ledger->table;
-  int v_row;
-  GncEntry *e;
+    Table *table = ledger->table;
+    int v_row;
+    GncEntry *e;
 
-  for (v_row = 1; v_row < table->num_virt_rows; v_row++) {
-    VirtualCellLocation vc_loc = { v_row, 0 };
+    for (v_row = 1; v_row < table->num_virt_rows; v_row++)
+    {
+        VirtualCellLocation vc_loc = { v_row, 0 };
 
-    e = gnc_entry_ledger_get_entry (ledger, vc_loc);
+        e = gnc_entry_ledger_get_entry (ledger, vc_loc);
 
-    if (e == entry) {
-      if (vcell_loc != NULL)
-	*vcell_loc = vc_loc;
-      return TRUE;
+        if (e == entry)
+        {
+            if (vcell_loc != NULL)
+                *vcell_loc = vc_loc;
+            return TRUE;
+        }
     }
-  }
-  return FALSE;
+    return FALSE;
 }
 
 void gnc_entry_ledger_set_readonly (GncEntryLedger *ledger, gboolean readonly)
 {
-  if (!ledger) return;
+    if (!ledger) return;
 
-  /* reset the ledger type appropriately */
-  if (readonly) {
-    switch (ledger->type) {
-    case GNCENTRY_ORDER_ENTRY:
-      ledger->type = GNCENTRY_ORDER_VIEWER;
-      break;
-    case GNCENTRY_INVOICE_ENTRY:
-      ledger->type = GNCENTRY_INVOICE_VIEWER;
-      create_invoice_query (ledger);
-      break;
-    case GNCENTRY_BILL_ENTRY:
-      ledger->type = GNCENTRY_BILL_VIEWER;
-      create_invoice_query (ledger);
-      break;
-    case GNCENTRY_EXPVOUCHER_ENTRY:
-      ledger->type = GNCENTRY_EXPVOUCHER_VIEWER;
-      create_invoice_query (ledger);
-      break;
-    default:
-      return;			/* Nothing to do */
+    /* reset the ledger type appropriately */
+    if (readonly)
+    {
+        switch (ledger->type)
+        {
+        case GNCENTRY_ORDER_ENTRY:
+            ledger->type = GNCENTRY_ORDER_VIEWER;
+            break;
+        case GNCENTRY_INVOICE_ENTRY:
+            ledger->type = GNCENTRY_INVOICE_VIEWER;
+            create_invoice_query (ledger);
+            break;
+        case GNCENTRY_BILL_ENTRY:
+            ledger->type = GNCENTRY_BILL_VIEWER;
+            create_invoice_query (ledger);
+            break;
+        case GNCENTRY_EXPVOUCHER_ENTRY:
+            ledger->type = GNCENTRY_EXPVOUCHER_VIEWER;
+            create_invoice_query (ledger);
+            break;
+        default:
+            return;			/* Nothing to do */
+        }
     }
-  } else {
-    switch (ledger->type) {
-    case GNCENTRY_ORDER_VIEWER:
-      ledger->type = GNCENTRY_ORDER_ENTRY;
-      break;
-    case GNCENTRY_INVOICE_VIEWER:
-      ledger->type = GNCENTRY_INVOICE_ENTRY;
-      create_invoice_query (ledger);
-      break;
-    case GNCENTRY_BILL_VIEWER:
-      ledger->type = GNCENTRY_BILL_ENTRY;
-      create_invoice_query (ledger);
-      break;
-    case GNCENTRY_EXPVOUCHER_VIEWER:
-      ledger->type = GNCENTRY_EXPVOUCHER_ENTRY;
-      create_invoice_query (ledger);
-      break;
-    default:
-      return;			/* Nothing to do */
+    else
+    {
+        switch (ledger->type)
+        {
+        case GNCENTRY_ORDER_VIEWER:
+            ledger->type = GNCENTRY_ORDER_ENTRY;
+            break;
+        case GNCENTRY_INVOICE_VIEWER:
+            ledger->type = GNCENTRY_INVOICE_ENTRY;
+            create_invoice_query (ledger);
+            break;
+        case GNCENTRY_BILL_VIEWER:
+            ledger->type = GNCENTRY_BILL_ENTRY;
+            create_invoice_query (ledger);
+            break;
+        case GNCENTRY_EXPVOUCHER_VIEWER:
+            ledger->type = GNCENTRY_EXPVOUCHER_ENTRY;
+            create_invoice_query (ledger);
+            break;
+        default:
+            return;			/* Nothing to do */
+        }
     }
-  }
 
-  /* reset the model */
-  gnc_table_model_set_read_only (ledger->table->model, readonly);
+    /* reset the model */
+    gnc_table_model_set_read_only (ledger->table->model, readonly);
 
-  /* if readonly is TRUE, get rid of the blank entry. */
-  if (readonly)
-    gnc_entry_ledger_clear_blank_entry (ledger);
+    /* if readonly is TRUE, get rid of the blank entry. */
+    if (readonly)
+        gnc_entry_ledger_clear_blank_entry (ledger);
 
-  /* and refresh the display */
-  gnc_entry_ledger_display_refresh (ledger);
+    /* and refresh the display */
+    gnc_entry_ledger_display_refresh (ledger);
 }
 
 gboolean
 gnc_entry_ledger_changed (GncEntryLedger *ledger)
 {
-  if (!ledger)
-    return FALSE;
+    if (!ledger)
+        return FALSE;
 
-  if (gnc_table_current_cursor_changed (ledger->table, FALSE))
-    return TRUE;
+    if (gnc_table_current_cursor_changed (ledger->table, FALSE))
+        return TRUE;
 
-  return FALSE;
+    return FALSE;
 }
 
 void
 gnc_entry_ledger_compute_value (GncEntryLedger *ledger,
-				gnc_numeric *value, gnc_numeric *tax_value)
+                                gnc_numeric *value, gnc_numeric *tax_value)
 {
-  gnc_numeric qty, price, discount;
-  gint disc_type, disc_how;
-  gboolean taxable, taxincluded;
-  GncTaxTable *table;
-  GList *taxes = NULL;
-  int denom = 100;
+    gnc_numeric qty, price, discount;
+    gint disc_type, disc_how;
+    gboolean taxable, taxincluded;
+    GncTaxTable *table;
+    GList *taxes = NULL;
+    int denom = 100;
 
-  gnc_entry_ledger_get_numeric (ledger, ENTRY_QTY_CELL, &qty);
-  gnc_entry_ledger_get_numeric (ledger, ENTRY_PRIC_CELL, &price);
-  gnc_entry_ledger_get_numeric (ledger, ENTRY_DISC_CELL, &discount);
+    gnc_entry_ledger_get_numeric (ledger, ENTRY_QTY_CELL, &qty);
+    gnc_entry_ledger_get_numeric (ledger, ENTRY_PRIC_CELL, &price);
+    gnc_entry_ledger_get_numeric (ledger, ENTRY_DISC_CELL, &discount);
 
-  disc_type = gnc_entry_ledger_get_type (ledger, ENTRY_DISTYPE_CELL);
-  disc_how = gnc_entry_ledger_get_type (ledger, ENTRY_DISHOW_CELL);
+    disc_type = gnc_entry_ledger_get_type (ledger, ENTRY_DISTYPE_CELL);
+    disc_how = gnc_entry_ledger_get_type (ledger, ENTRY_DISHOW_CELL);
 
-  /* Bills and exp-vouchers dont have discounts */
-  if (ledger->type == GNCENTRY_BILL_ENTRY ||
-      ledger->type == GNCENTRY_BILL_VIEWER ||
-      ledger->type == GNCENTRY_EXPVOUCHER_ENTRY ||
-      ledger->type == GNCENTRY_EXPVOUCHER_VIEWER)
-  {
-    g_assert (gnc_numeric_zero_p (discount));
-    disc_type = GNC_AMT_TYPE_VALUE;
-    disc_how = GNC_DISC_PRETAX;
-  }
+    /* Bills and exp-vouchers dont have discounts */
+    if (ledger->type == GNCENTRY_BILL_ENTRY ||
+            ledger->type == GNCENTRY_BILL_VIEWER ||
+            ledger->type == GNCENTRY_EXPVOUCHER_ENTRY ||
+            ledger->type == GNCENTRY_EXPVOUCHER_VIEWER)
+    {
+        g_assert (gnc_numeric_zero_p (discount));
+        disc_type = GNC_AMT_TYPE_VALUE;
+        disc_how = GNC_DISC_PRETAX;
+    }
 
 
-  /* If we're so early in the process that we don't have info, stop now */
-  if (disc_type < 0 || disc_how < 0)
-  {
-    if (value)
-      *value = gnc_numeric_zero ();
-    if (tax_value)
-      *tax_value = gnc_numeric_zero ();
-    return;
-  }
+    /* If we're so early in the process that we don't have info, stop now */
+    if (disc_type < 0 || disc_how < 0)
+    {
+        if (value)
+            *value = gnc_numeric_zero ();
+        if (tax_value)
+            *tax_value = gnc_numeric_zero ();
+        return;
+    }
 
-  taxable = gnc_entry_ledger_get_checkmark (ledger, ENTRY_TAXABLE_CELL);
-  taxincluded = gnc_entry_ledger_get_checkmark (ledger, ENTRY_TAXINCLUDED_CELL);
-  table = gnc_entry_ledger_get_taxtable (ledger, ENTRY_TAXTABLE_CELL);
-  
-  /* Expense vouchers don't have taxable, taxincluded, or taxtable cells, either */
-  if (ledger->type == GNCENTRY_EXPVOUCHER_ENTRY ||
-      ledger->type == GNCENTRY_EXPVOUCHER_VIEWER)
-  {
-    taxable = FALSE;
-    taxincluded = FALSE;
-    table = NULL;
-  }
+    taxable = gnc_entry_ledger_get_checkmark (ledger, ENTRY_TAXABLE_CELL);
+    taxincluded = gnc_entry_ledger_get_checkmark (ledger, ENTRY_TAXINCLUDED_CELL);
+    table = gnc_entry_ledger_get_taxtable (ledger, ENTRY_TAXTABLE_CELL);
 
-  if (ledger->invoice)
-  {
-    gnc_commodity *currency = gncInvoiceGetCurrency(ledger->invoice);
-    if (currency)
-      denom = gnc_commodity_get_fraction(currency);
-  }
+    /* Expense vouchers don't have taxable, taxincluded, or taxtable cells, either */
+    if (ledger->type == GNCENTRY_EXPVOUCHER_ENTRY ||
+            ledger->type == GNCENTRY_EXPVOUCHER_VIEWER)
+    {
+        taxable = FALSE;
+        taxincluded = FALSE;
+        table = NULL;
+    }
 
-  gncEntryComputeValue (qty, price, (taxable ? table : NULL), taxincluded,
-			discount, disc_type, disc_how, denom,
-			value, NULL, &taxes);
+    if (ledger->invoice)
+    {
+        gnc_commodity *currency = gncInvoiceGetCurrency(ledger->invoice);
+        if (currency)
+            denom = gnc_commodity_get_fraction(currency);
+    }
 
-  /* return the tax value */
-  if (tax_value)
-    *tax_value = gncAccountValueTotal (taxes);
+    gncEntryComputeValue (qty, price, (taxable ? table : NULL), taxincluded,
+                          discount, disc_type, disc_how, denom,
+                          value, NULL, &taxes);
+
+    /* return the tax value */
+    if (tax_value)
+        *tax_value = gncAccountValueTotal (taxes);
 }
 
 gboolean
 gnc_entry_ledger_get_entry_virt_loc (GncEntryLedger *ledger, GncEntry *entry,
-				     VirtualCellLocation *vcell_loc)
+                                     VirtualCellLocation *vcell_loc)
 {
-  Table *table;
-  int v_row;
-  int v_col;
+    Table *table;
+    int v_row;
+    int v_col;
 
-  if ((ledger == NULL) || (entry == NULL))
-    return FALSE;
+    if ((ledger == NULL) || (entry == NULL))
+        return FALSE;
 
-  table = ledger->table;
+    table = ledger->table;
 
-  /* go backwards because typically you search for entries at the end */
+    /* go backwards because typically you search for entries at the end */
 
-  for (v_row = table->num_virt_rows - 1; v_row > 0; v_row--)
-    for (v_col = 0; v_col < table->num_virt_cols; v_col++)
-    {
-      VirtualCellLocation vc_loc = { v_row, v_col };
-      VirtualCell *vcell;
-      GncEntry *e;
+    for (v_row = table->num_virt_rows - 1; v_row > 0; v_row--)
+        for (v_col = 0; v_col < table->num_virt_cols; v_col++)
+        {
+            VirtualCellLocation vc_loc = { v_row, v_col };
+            VirtualCell *vcell;
+            GncEntry *e;
 
-      vcell = gnc_table_get_virtual_cell (table, vc_loc);
-      if (vcell == NULL)
-        continue;
+            vcell = gnc_table_get_virtual_cell (table, vc_loc);
+            if (vcell == NULL)
+                continue;
 
-      if (!vcell->visible)
-        continue;
+            if (!vcell->visible)
+                continue;
 
-      e = gncEntryLookup (ledger->book, vcell->vcell_data);
+            e = gncEntryLookup (ledger->book, vcell->vcell_data);
 
-      if (e == entry)
-      {
-        if (vcell_loc)
-          *vcell_loc = vc_loc;
+            if (e == entry)
+            {
+                if (vcell_loc)
+                    *vcell_loc = vc_loc;
 
-        return TRUE;
-      }
-    }
+                return TRUE;
+            }
+        }
 
-  return FALSE;
+    return FALSE;
 }
 
 void
 gnc_entry_ledger_delete_current_entry (GncEntryLedger *ledger)
 {
-  GncEntry *entry;
+    GncEntry *entry;
 
-  if (!ledger)
-    return;
+    if (!ledger)
+        return;
 
-  /* If there is no entry, just return */
-  entry = gnc_entry_ledger_get_current_entry (ledger);
-  if (!entry)
-    return;
+    /* If there is no entry, just return */
+    entry = gnc_entry_ledger_get_current_entry (ledger);
+    if (!entry)
+        return;
 
-  /* If this is the blank entry, just cancel the changes */
-  if (entry == gnc_entry_ledger_get_blank_entry (ledger)) {
-    gnc_entry_ledger_cancel_cursor_changes (ledger);
-    return;
-  }
+    /* If this is the blank entry, just cancel the changes */
+    if (entry == gnc_entry_ledger_get_blank_entry (ledger))
+    {
+        gnc_entry_ledger_cancel_cursor_changes (ledger);
+        return;
+    }
 
-  /* Ok, let's delete this entry */
-  gnc_suspend_gui_refresh ();
-  if (!gncEntryIsOpen (entry))
-    gncEntryBeginEdit (entry);
+    /* Ok, let's delete this entry */
+    gnc_suspend_gui_refresh ();
+    if (!gncEntryIsOpen (entry))
+        gncEntryBeginEdit (entry);
 
-  {
-    GncOrder *order;
-    GncInvoice *invoice;
+    {
+        GncOrder *order;
+        GncInvoice *invoice;
 
-    order = gncEntryGetOrder (entry);
-    if (order)
-      gncOrderRemoveEntry (order, entry);
+        order = gncEntryGetOrder (entry);
+        if (order)
+            gncOrderRemoveEntry (order, entry);
 
-    invoice = gncEntryGetInvoice (entry);
-    if (invoice)
-      gncInvoiceRemoveEntry (invoice, entry);
+        invoice = gncEntryGetInvoice (entry);
+        if (invoice)
+            gncInvoiceRemoveEntry (invoice, entry);
 
-    invoice = gncEntryGetBill (entry);
-    if (invoice)
-      gncBillRemoveEntry (invoice, entry);
+        invoice = gncEntryGetBill (entry);
+        if (invoice)
+            gncBillRemoveEntry (invoice, entry);
 
-    gncEntryDestroy (entry);
-  }
-  gnc_resume_gui_refresh ();
+        gncEntryDestroy (entry);
+    }
+    gnc_resume_gui_refresh ();
 }
 
 void
 gnc_entry_ledger_duplicate_current_entry (GncEntryLedger *ledger)
 {
-  GncEntry *entry;
-  gboolean changed;
+    GncEntry *entry;
+    gboolean changed;
 
-  if (!ledger)
-    return;
+    if (!ledger)
+        return;
 
-  /* Be paranoid */
-  entry = gnc_entry_ledger_get_current_entry (ledger);
-  if (!entry)
-    return;
+    /* Be paranoid */
+    entry = gnc_entry_ledger_get_current_entry (ledger);
+    if (!entry)
+        return;
 
-  changed = gnc_table_current_cursor_changed (ledger->table, FALSE);
+    changed = gnc_table_current_cursor_changed (ledger->table, FALSE);
 
-  /* See if we're asked to duplicate an unchanged blank entry --
-   * there is no point in doing that.
-   */
-  if (!changed && entry == gnc_entry_ledger_get_blank_entry (ledger))
-    return;
+    /* See if we're asked to duplicate an unchanged blank entry --
+     * there is no point in doing that.
+     */
+    if (!changed && entry == gnc_entry_ledger_get_blank_entry (ledger))
+        return;
 
-  gnc_suspend_gui_refresh ();
+    gnc_suspend_gui_refresh ();
 
-  /* If the cursor has been edited, we are going to have to commit
-   * it before we can duplicate. Make sure the user wants to do that. */
-  if (changed) {
-    const char *title = _("Save the current entry?");
-    const char *message =
-      _("The current transaction has been changed. Would you like to "
-	"record the changes before duplicating this entry, or "
-	"cancel the duplication?");
-    GtkWidget *dialog;
-    gint response;
+    /* If the cursor has been edited, we are going to have to commit
+     * it before we can duplicate. Make sure the user wants to do that. */
+    if (changed)
+    {
+        const char *title = _("Save the current entry?");
+        const char *message =
+            _("The current transaction has been changed. Would you like to "
+              "record the changes before duplicating this entry, or "
+              "cancel the duplication?");
+        GtkWidget *dialog;
+        gint response;
 
-    dialog = gtk_message_dialog_new(GTK_WINDOW(ledger->parent),
-				    GTK_DIALOG_DESTROY_WITH_PARENT,
-				    GTK_MESSAGE_QUESTION,
-				    GTK_BUTTONS_NONE,
-				    "%s", title);
-    gtk_message_dialog_format_secondary_text(GTK_MESSAGE_DIALOG(dialog),
-					     "%s", message);
-    gtk_dialog_add_buttons(GTK_DIALOG(dialog),
-			   GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
-			   _("_Record"), GTK_RESPONSE_ACCEPT,
-			   NULL);
-    response = gnc_dialog_run(GTK_DIALOG(dialog), "invoice_entry_duplicated");
-    gtk_widget_destroy(dialog);
+        dialog = gtk_message_dialog_new(GTK_WINDOW(ledger->parent),
+                                        GTK_DIALOG_DESTROY_WITH_PARENT,
+                                        GTK_MESSAGE_QUESTION,
+                                        GTK_BUTTONS_NONE,
+                                        "%s", title);
+        gtk_message_dialog_format_secondary_text(GTK_MESSAGE_DIALOG(dialog),
+                "%s", message);
+        gtk_dialog_add_buttons(GTK_DIALOG(dialog),
+                               GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
+                               _("_Record"), GTK_RESPONSE_ACCEPT,
+                               NULL);
+        response = gnc_dialog_run(GTK_DIALOG(dialog), "invoice_entry_duplicated");
+        gtk_widget_destroy(dialog);
 
-    if (response != GTK_RESPONSE_ACCEPT) {
-      gnc_resume_gui_refresh ();
-      return;
-    }
+        if (response != GTK_RESPONSE_ACCEPT)
+        {
+            gnc_resume_gui_refresh ();
+            return;
+        }
 
-    if (!gnc_entry_ledger_commit_entry (ledger)) {
-      gnc_resume_gui_refresh ();
-      return;
+        if (!gnc_entry_ledger_commit_entry (ledger))
+        {
+            gnc_resume_gui_refresh ();
+            return;
+        }
     }
-  }
 
-  /* Ok, we're ready to make the copy */
-  {
-    GncEntry * new_entry;
+    /* Ok, we're ready to make the copy */
+    {
+        GncEntry * new_entry;
 
-    new_entry = gncEntryCreate (ledger->book);
-    gncEntryCopy (entry, new_entry);
-    gncEntrySetDate (new_entry, ledger->last_date_entered);
+        new_entry = gncEntryCreate (ledger->book);
+        gncEntryCopy (entry, new_entry);
+        gncEntrySetDate (new_entry, ledger->last_date_entered);
 
-    /* Set the hint for where to display on the refresh */
-    ledger->hint_entry = new_entry;
-  }
+        /* Set the hint for where to display on the refresh */
+        ledger->hint_entry = new_entry;
+    }
 
-  gnc_resume_gui_refresh ();
-  return;
+    gnc_resume_gui_refresh ();
+    return;
 }
 
 QueryNew *
 gnc_entry_ledger_get_query (GncEntryLedger *ledger)
 {
-  if (!ledger)
-    return NULL;
+    if (!ledger)
+        return NULL;
 
-  return ledger->query;
+    return ledger->query;
 }
 
 void
 gnc_entry_ledger_set_gconf_section (GncEntryLedger *ledger, const gchar *string)
 {
-  if (!ledger)
-    return;
+    if (!ledger)
+        return;
 
-  ledger->gconf_section = string;
+    ledger->gconf_section = string;
 }

Modified: gnucash/trunk/src/business/business-ledger/gncEntryLedger.h
===================================================================
--- gnucash/trunk/src/business/business-ledger/gncEntryLedger.h	2010-03-02 21:40:28 UTC (rev 18788)
+++ gnucash/trunk/src/business/business-ledger/gncEntryLedger.h	2010-03-02 21:41:05 UTC (rev 18789)
@@ -30,27 +30,28 @@
 #include "gnc-book.h"
 #include "table-allgui.h"
 
-typedef enum {
-  GNCENTRY_ORDER_ENTRY,
-  GNCENTRY_ORDER_VIEWER,
-  GNCENTRY_INVOICE_ENTRY,
-  GNCENTRY_INVOICE_VIEWER,
-  GNCENTRY_BILL_ENTRY,
-  GNCENTRY_BILL_VIEWER,
-  GNCENTRY_EXPVOUCHER_ENTRY,
-  GNCENTRY_EXPVOUCHER_VIEWER,
-  GNCENTRY_NUM_REGISTER_TYPES
+typedef enum
+{
+    GNCENTRY_ORDER_ENTRY,
+    GNCENTRY_ORDER_VIEWER,
+    GNCENTRY_INVOICE_ENTRY,
+    GNCENTRY_INVOICE_VIEWER,
+    GNCENTRY_BILL_ENTRY,
+    GNCENTRY_BILL_VIEWER,
+    GNCENTRY_EXPVOUCHER_ENTRY,
+    GNCENTRY_EXPVOUCHER_VIEWER,
+    GNCENTRY_NUM_REGISTER_TYPES
 } GncEntryLedgerType;
 
 typedef struct entry_ledger_colors
 {
-  guint32 header_bg_color;
+    guint32 header_bg_color;
 
-  guint32 primary_bg_color;
-  guint32 secondary_bg_color;
+    guint32 primary_bg_color;
+    guint32 secondary_bg_color;
 
-  guint32 primary_active_bg_color;
-  guint32 secondary_active_bg_color;
+    guint32 primary_active_bg_color;
+    guint32 secondary_active_bg_color;
 } GncEntryLedgerColors;
 
 #define ENTRY_IACCT_CELL	"inv-account"
@@ -83,11 +84,11 @@
 
 /* Set the default order for this ledger */
 void gnc_entry_ledger_set_default_order (GncEntryLedger *ledger,
-					 GncOrder *order);
+        GncOrder *order);
 
 /* Set the default invoice for this ledger */
 void gnc_entry_ledger_set_default_invoice (GncEntryLedger *ledger,
-					   GncInvoice *invoice);
+        GncInvoice *invoice);
 
 /* Destroy the GncEntry Ledger */
 void gnc_entry_ledger_destroy (GncEntryLedger *ledger);
@@ -122,8 +123,8 @@
 GncEntry * gnc_entry_ledger_get_blank_entry (GncEntryLedger *ledger);
 
 gboolean gnc_entry_ledger_get_entry_virt_loc (GncEntryLedger *ledger,
-					      GncEntry *entry,
-					      VirtualCellLocation *vcell_loc);
+        GncEntry *entry,
+        VirtualCellLocation *vcell_loc);
 
 void gnc_entry_ledger_delete_current_entry (GncEntryLedger *ledger);
 void gnc_entry_ledger_duplicate_current_entry (GncEntryLedger *ledger);

Modified: gnucash/trunk/src/business/business-ledger/gncEntryLedgerControl.c
===================================================================
--- gnucash/trunk/src/business/business-ledger/gncEntryLedgerControl.c	2010-03-02 21:40:28 UTC (rev 18788)
+++ gnucash/trunk/src/business/business-ledger/gncEntryLedgerControl.c	2010-03-02 21:41:05 UTC (rev 18789)
@@ -44,105 +44,115 @@
 static gboolean
 gnc_entry_ledger_save (GncEntryLedger *ledger, gboolean do_commit)
 {
-  GncEntry *blank_entry;
-  GncEntry *entry;
+    GncEntry *blank_entry;
+    GncEntry *entry;
 
-  if (!ledger) return FALSE;
+    if (!ledger) return FALSE;
 
-  blank_entry = gnc_entry_ledger_get_blank_entry (ledger);
+    blank_entry = gnc_entry_ledger_get_blank_entry (ledger);
 
-  entry = gnc_entry_ledger_get_current_entry (ledger);
-  if (entry == NULL) return FALSE;
+    entry = gnc_entry_ledger_get_current_entry (ledger);
+    if (entry == NULL) return FALSE;
 
-  /* Try to avoid heavy-weight updates if nothing has changed */
-  if (!gnc_table_current_cursor_changed (ledger->table, FALSE)) {
-    if (!do_commit) return FALSE;
+    /* Try to avoid heavy-weight updates if nothing has changed */
+    if (!gnc_table_current_cursor_changed (ledger->table, FALSE))
+    {
+        if (!do_commit) return FALSE;
 
-    if (entry == blank_entry) {
-      if (ledger->blank_entry_edited) {
-	ledger->last_date_entered = gncEntryGetDate (entry);
-	ledger->blank_entry_guid = *xaccGUIDNULL ();
-	ledger->blank_entry_edited = FALSE;
-	blank_entry = NULL;
-      } else
-	return FALSE;
+        if (entry == blank_entry)
+        {
+            if (ledger->blank_entry_edited)
+            {
+                ledger->last_date_entered = gncEntryGetDate (entry);
+                ledger->blank_entry_guid = *xaccGUIDNULL ();
+                ledger->blank_entry_edited = FALSE;
+                blank_entry = NULL;
+            }
+            else
+                return FALSE;
+        }
+
+        return TRUE;
     }
 
-    return TRUE;
-  }
+    gnc_suspend_gui_refresh ();
 
-  gnc_suspend_gui_refresh ();
+    if (!gncEntryIsOpen (entry))
+        gncEntryBeginEdit (entry);
 
-  if (!gncEntryIsOpen (entry))
-    gncEntryBeginEdit (entry);
+    gnc_table_save_cells (ledger->table, entry);
 
-  gnc_table_save_cells (ledger->table, entry);
+    if (entry == blank_entry)
+    {
+        Timespec ts;
+        ts.tv_sec = time(NULL);
+        ts.tv_nsec = 0;
+        gncEntrySetDateEntered (blank_entry, ts);
 
-  if (entry == blank_entry) {
-    Timespec ts;
-    ts.tv_sec = time(NULL);
-    ts.tv_nsec = 0;
-    gncEntrySetDateEntered (blank_entry, ts);
-    
-    switch (ledger->type) {
-    case GNCENTRY_ORDER_ENTRY:
-      gncOrderAddEntry (ledger->order, blank_entry);
-      break;
-    case GNCENTRY_INVOICE_ENTRY:
-      /* Anything entered on an invoice entry must be part of the invoice! */
-      gncInvoiceAddEntry (ledger->invoice, blank_entry);
-      break;
-    case GNCENTRY_BILL_ENTRY:
-    case GNCENTRY_EXPVOUCHER_ENTRY:
-      /* Anything entered on an invoice entry must be part of the invoice! */
-      gncBillAddEntry (ledger->invoice, blank_entry);
-      break;
-    default:
-      /* Nothing to do for viewers */
-      g_warning ("blank entry traversed in a viewer");
-      break;
+        switch (ledger->type)
+        {
+        case GNCENTRY_ORDER_ENTRY:
+            gncOrderAddEntry (ledger->order, blank_entry);
+            break;
+        case GNCENTRY_INVOICE_ENTRY:
+            /* Anything entered on an invoice entry must be part of the invoice! */
+            gncInvoiceAddEntry (ledger->invoice, blank_entry);
+            break;
+        case GNCENTRY_BILL_ENTRY:
+        case GNCENTRY_EXPVOUCHER_ENTRY:
+            /* Anything entered on an invoice entry must be part of the invoice! */
+            gncBillAddEntry (ledger->invoice, blank_entry);
+            break;
+        default:
+            /* Nothing to do for viewers */
+            g_warning ("blank entry traversed in a viewer");
+            break;
+        }
     }
-  }
 
-  if (entry == blank_entry) {
-    if (do_commit) {
-      ledger->blank_entry_guid = *xaccGUIDNULL ();
-      blank_entry = NULL;
-      ledger->last_date_entered = gncEntryGetDate (entry);
-    } else
-      ledger->blank_entry_edited = TRUE;
-  }
+    if (entry == blank_entry)
+    {
+        if (do_commit)
+        {
+            ledger->blank_entry_guid = *xaccGUIDNULL ();
+            blank_entry = NULL;
+            ledger->last_date_entered = gncEntryGetDate (entry);
+        }
+        else
+            ledger->blank_entry_edited = TRUE;
+    }
 
-  if (do_commit)
-    gncEntryCommitEdit (entry);
+    if (do_commit)
+        gncEntryCommitEdit (entry);
 
-  gnc_table_clear_current_cursor_changes (ledger->table);
+    gnc_table_clear_current_cursor_changes (ledger->table);
 
-  gnc_resume_gui_refresh ();
+    gnc_resume_gui_refresh ();
 
-  return TRUE;
+    return TRUE;
 }
 
 static gboolean
 gnc_entry_ledger_verify_acc_cell_ok (GncEntryLedger *ledger,
-				     const char *cell_name,
-				     const char *cell_msg)
+                                     const char *cell_name,
+                                     const char *cell_msg)
 {
-  ComboCell *cell;
-  const char *name;
+    ComboCell *cell;
+    const char *name;
 
-  cell = (ComboCell *) gnc_table_layout_get_cell (ledger->table->layout,
-						  cell_name);
-  g_return_val_if_fail (cell, TRUE);
-  name = cell->cell.value;
-  if (!name || *name == '\0') {
-    /* Translators: %s is the string "an Account" i.e. its translation. */
-    const char *format = _("Invalid Entry:  You need to supply %s.");
+    cell = (ComboCell *) gnc_table_layout_get_cell (ledger->table->layout,
+            cell_name);
+    g_return_val_if_fail (cell, TRUE);
+    name = cell->cell.value;
+    if (!name || *name == '\0')
+    {
+        /* Translators: %s is the string "an Account" i.e. its translation. */
+        const char *format = _("Invalid Entry:  You need to supply %s.");
 
-    gnc_error_dialog (ledger->parent, format, cell_msg);
-    return FALSE;
-  }
-  return TRUE;
+        gnc_error_dialog (ledger->parent, format, cell_msg);
+        return FALSE;
+    }
+    return TRUE;
 }
 
 /* Verify whether we can save the entry, or warn the user when we can't
@@ -151,501 +161,518 @@
 static gboolean
 gnc_entry_ledger_verify_can_save (GncEntryLedger *ledger)
 {
-  gnc_numeric value;
+    gnc_numeric value;
 
-  /* Compute the value and tax value of the current cursor */
-  gnc_entry_ledger_compute_value (ledger, &value, NULL);
+    /* Compute the value and tax value of the current cursor */
+    gnc_entry_ledger_compute_value (ledger, &value, NULL);
 
-  /* If there is a value, make sure there is an account */
-  if (! gnc_numeric_zero_p (value)) {
-    switch (ledger->type) {
-    case GNCENTRY_INVOICE_ENTRY:
-      if (!gnc_entry_ledger_verify_acc_cell_ok (ledger, ENTRY_IACCT_CELL,
-						_("an Account")))
-	return FALSE;
-      break;
-    case GNCENTRY_BILL_ENTRY:
-    case GNCENTRY_EXPVOUCHER_ENTRY:
-      if (!gnc_entry_ledger_verify_acc_cell_ok (ledger, ENTRY_BACCT_CELL,
-						_("an Account")))
-	return FALSE;
-      break;
-    default:
-      g_warning ("Unhandled ledger type");
-      break;
+    /* If there is a value, make sure there is an account */
+    if (! gnc_numeric_zero_p (value))
+    {
+        switch (ledger->type)
+        {
+        case GNCENTRY_INVOICE_ENTRY:
+            if (!gnc_entry_ledger_verify_acc_cell_ok (ledger, ENTRY_IACCT_CELL,
+                    _("an Account")))
+                return FALSE;
+            break;
+        case GNCENTRY_BILL_ENTRY:
+        case GNCENTRY_EXPVOUCHER_ENTRY:
+            if (!gnc_entry_ledger_verify_acc_cell_ok (ledger, ENTRY_BACCT_CELL,
+                    _("an Account")))
+                return FALSE;
+            break;
+        default:
+            g_warning ("Unhandled ledger type");
+            break;
+        }
     }
-  }
 
-  return TRUE;
+    return TRUE;
 }
 
 static void gnc_entry_ledger_move_cursor (VirtualLocation *p_new_virt_loc,
-					  gpointer user_data)
+        gpointer user_data)
 {
-  GncEntryLedger *ledger = user_data;
-  VirtualLocation new_virt_loc = *p_new_virt_loc;
-  GncEntry *new_entry;
-  GncEntry *old_entry;
-  gboolean saved;
+    GncEntryLedger *ledger = user_data;
+    VirtualLocation new_virt_loc = *p_new_virt_loc;
+    GncEntry *new_entry;
+    GncEntry *old_entry;
+    gboolean saved;
 
-  if (!ledger) return;
+    if (!ledger) return;
 
-  old_entry = gnc_entry_ledger_get_current_entry (ledger);
-  new_entry = gnc_entry_ledger_get_entry (ledger, new_virt_loc.vcell_loc);
+    old_entry = gnc_entry_ledger_get_current_entry (ledger);
+    new_entry = gnc_entry_ledger_get_entry (ledger, new_virt_loc.vcell_loc);
 
-  gnc_suspend_gui_refresh ();
-  saved = gnc_entry_ledger_save (ledger, old_entry != new_entry);
-  gnc_resume_gui_refresh ();
+    gnc_suspend_gui_refresh ();
+    saved = gnc_entry_ledger_save (ledger, old_entry != new_entry);
+    gnc_resume_gui_refresh ();
 
-  /* redrawing can muck everything up */
-  if (saved) {
-    VirtualCellLocation vcell_loc;
+    /* redrawing can muck everything up */
+    if (saved)
+    {
+        VirtualCellLocation vcell_loc;
 
-    /* redraw */
-    gnc_entry_ledger_display_refresh (ledger);
+        /* redraw */
+        gnc_entry_ledger_display_refresh (ledger);
 
-    if (ledger->traverse_to_new)
-      new_entry = gnc_entry_ledger_get_blank_entry (ledger);
+        if (ledger->traverse_to_new)
+            new_entry = gnc_entry_ledger_get_blank_entry (ledger);
 
-    /* if the entry we were going to is still in the register,
-     * then it may have moved. Find out where it is now. */
-    if (gnc_entry_ledger_find_entry (ledger, new_entry, &vcell_loc)) {
-      VirtualCell *vcell;
+        /* if the entry we were going to is still in the register,
+         * then it may have moved. Find out where it is now. */
+        if (gnc_entry_ledger_find_entry (ledger, new_entry, &vcell_loc))
+        {
+            VirtualCell *vcell;
 
-      vcell = gnc_table_get_virtual_cell (ledger->table, vcell_loc);
-      new_virt_loc.vcell_loc = vcell_loc;
-    } else
-      new_virt_loc.vcell_loc = ledger->table->current_cursor_loc.vcell_loc;
-  }
+            vcell = gnc_table_get_virtual_cell (ledger->table, vcell_loc);
+            new_virt_loc.vcell_loc = vcell_loc;
+        }
+        else
+            new_virt_loc.vcell_loc = ledger->table->current_cursor_loc.vcell_loc;
+    }
 
-  gnc_table_find_close_valid_cell (ledger->table, &new_virt_loc, FALSE);
+    gnc_table_find_close_valid_cell (ledger->table, &new_virt_loc, FALSE);
 
-  *p_new_virt_loc = new_virt_loc;
+    *p_new_virt_loc = new_virt_loc;
 }
 
 static gboolean
 gnc_entry_ledger_auto_completion (GncEntryLedger *ledger,
-				  gncTableTraversalDir dir,
-				  VirtualLocation *p_new_virt_loc)
+                                  gncTableTraversalDir dir,
+                                  VirtualLocation *p_new_virt_loc)
 {
-  GncEntry *entry;
-  GncEntry *blank_entry;
+    GncEntry *entry;
+    GncEntry *blank_entry;
 
-  blank_entry = gnc_entry_ledger_get_blank_entry (ledger);
+    blank_entry = gnc_entry_ledger_get_blank_entry (ledger);
 
-  /* auto-completion is only triggered by a tab out */
-  if (dir != GNC_TABLE_TRAVERSE_RIGHT)
-    return FALSE;
+    /* auto-completion is only triggered by a tab out */
+    if (dir != GNC_TABLE_TRAVERSE_RIGHT)
+        return FALSE;
 
-  entry = gnc_entry_ledger_get_current_entry (ledger);
-  if (entry == NULL)
-    return FALSE;
+    entry = gnc_entry_ledger_get_current_entry (ledger);
+    if (entry == NULL)
+        return FALSE;
 
-  switch (ledger->type) {
-  case GNCENTRY_ORDER_ENTRY:
-  case GNCENTRY_INVOICE_ENTRY:
-  case GNCENTRY_BILL_ENTRY:
-  case GNCENTRY_EXPVOUCHER_ENTRY:
+    switch (ledger->type)
+    {
+    case GNCENTRY_ORDER_ENTRY:
+    case GNCENTRY_INVOICE_ENTRY:
+    case GNCENTRY_BILL_ENTRY:
+    case GNCENTRY_EXPVOUCHER_ENTRY:
 
-    /* There must be a blank entry */
-    if (blank_entry == NULL)
-      return FALSE;
+        /* There must be a blank entry */
+        if (blank_entry == NULL)
+            return FALSE;
 
-    /* we must be on the blank entry */
-    if (entry != blank_entry)
-      return FALSE;
+        /* we must be on the blank entry */
+        if (entry != blank_entry)
+            return FALSE;
 
-    /* XXX: No other autocompletion, yet */
-    break;
+        /* XXX: No other autocompletion, yet */
+        break;
 
-  default:
-    break;
-  }
+    default:
+        break;
+    }
 
-  return TRUE;
+    return TRUE;
 }
 
 static gboolean gnc_entry_ledger_traverse (VirtualLocation *p_new_virt_loc,
-					   gncTableTraversalDir dir,
-					   gpointer user_data)
+        gncTableTraversalDir dir,
+        gpointer user_data)
 {
-  GncEntryLedger *ledger = user_data;
-  GncEntry *entry, *new_entry;
-  gint response;
-  VirtualLocation virt_loc;
-  int changed;
-  char const *cell_name;
-  gboolean exact_traversal;
+    GncEntryLedger *ledger = user_data;
+    GncEntry *entry, *new_entry;
+    gint response;
+    VirtualLocation virt_loc;
+    int changed;
+    char const *cell_name;
+    gboolean exact_traversal;
 
-  if (!ledger) return FALSE;
+    if (!ledger) return FALSE;
 
-  exact_traversal = (dir == GNC_TABLE_TRAVERSE_POINTER);
+    exact_traversal = (dir == GNC_TABLE_TRAVERSE_POINTER);
 
-  entry = gnc_entry_ledger_get_current_entry (ledger);
-  if (!entry)
-    return FALSE;
+    entry = gnc_entry_ledger_get_current_entry (ledger);
+    if (!entry)
+        return FALSE;
 
-  /* no changes, make sure we aren't going off the end */
-  changed = gnc_table_current_cursor_changed (ledger->table, FALSE);
-  if (!changed)
-    return FALSE;
+    /* no changes, make sure we aren't going off the end */
+    changed = gnc_table_current_cursor_changed (ledger->table, FALSE);
+    if (!changed)
+        return FALSE;
 
-  virt_loc = *p_new_virt_loc;
+    virt_loc = *p_new_virt_loc;
 
-  cell_name = gnc_table_get_current_cell_name (ledger->table);
+    cell_name = gnc_table_get_current_cell_name (ledger->table);
 
-  /* See if we are leaving the account field */
-  do
-  {
-    ComboCell *cell;
-    char *name;
-    char *cell_name = NULL;
+    /* See if we are leaving the account field */
+    do
+    {
+        ComboCell *cell;
+        char *name;
+        char *cell_name = NULL;
 
-    switch (ledger->type) {
-    case GNCENTRY_INVOICE_ENTRY:
-    case GNCENTRY_INVOICE_VIEWER:
-      cell_name = ENTRY_IACCT_CELL;
-      break;
-    case GNCENTRY_BILL_ENTRY:
-    case GNCENTRY_BILL_VIEWER:
-    case GNCENTRY_EXPVOUCHER_ENTRY:
-    case GNCENTRY_EXPVOUCHER_VIEWER:
-      cell_name = ENTRY_BACCT_CELL;
-      break;
-    default:
-      g_warning ("Unhandled ledger type");
-      break;
-    }
+        switch (ledger->type)
+        {
+        case GNCENTRY_INVOICE_ENTRY:
+        case GNCENTRY_INVOICE_VIEWER:
+            cell_name = ENTRY_IACCT_CELL;
+            break;
+        case GNCENTRY_BILL_ENTRY:
+        case GNCENTRY_BILL_VIEWER:
+        case GNCENTRY_EXPVOUCHER_ENTRY:
+        case GNCENTRY_EXPVOUCHER_VIEWER:
+            cell_name = ENTRY_BACCT_CELL;
+            break;
+        default:
+            g_warning ("Unhandled ledger type");
+            break;
+        }
 
-    if (!cell_name)
-      break;
+        if (!cell_name)
+            break;
 
-    if (!gnc_cell_name_equal (cell_name, cell_name))
-      break;
+        if (!gnc_cell_name_equal (cell_name, cell_name))
+            break;
 
-    if (!gnc_table_layout_get_cell_changed (ledger->table->layout,
-					    cell_name, FALSE))
-      break;
+        if (!gnc_table_layout_get_cell_changed (ledger->table->layout,
+                                                cell_name, FALSE))
+            break;
 
-    cell = (ComboCell *) gnc_table_layout_get_cell (ledger->table->layout,
-						    cell_name);
-    if (!cell)
-      break;
+        cell = (ComboCell *) gnc_table_layout_get_cell (ledger->table->layout,
+                cell_name);
+        if (!cell)
+            break;
 
-    name = cell->cell.value;
-    if (!name || *name == '\0')
-      break;
+        name = cell->cell.value;
+        if (!name || *name == '\0')
+            break;
 
-    /* Create the account if necessary. Also checks for a placeholder */
-    if (!gnc_entry_ledger_get_account_by_name (ledger, (BasicCell *) cell,
-                                               cell->cell.value,
-                                               &ledger->full_refresh))
-      return TRUE;
+        /* Create the account if necessary. Also checks for a placeholder */
+        if (!gnc_entry_ledger_get_account_by_name (ledger, (BasicCell *) cell,
+                cell->cell.value,
+                &ledger->full_refresh))
+            return TRUE;
 
-  } while (FALSE);
+    }
+    while (FALSE);
 
 
-  /* See if we are leaving the TaxTable field */
-  do
-  {
-    ComboCell *cell;
-    GncTaxTable *table;
-    char *name;
+    /* See if we are leaving the TaxTable field */
+    do
+    {
+        ComboCell *cell;
+        GncTaxTable *table;
+        char *name;
 
-    if (!gnc_cell_name_equal (cell_name, ENTRY_TAXTABLE_CELL))
-      break;
+        if (!gnc_cell_name_equal (cell_name, ENTRY_TAXTABLE_CELL))
+            break;
 
-    if (!gnc_table_layout_get_cell_changed (ledger->table->layout,
-					    ENTRY_TAXTABLE_CELL, FALSE))
-      break;
+        if (!gnc_table_layout_get_cell_changed (ledger->table->layout,
+                                                ENTRY_TAXTABLE_CELL, FALSE))
+            break;
 
-    cell = (ComboCell *) gnc_table_layout_get_cell (ledger->table->layout,
-						    ENTRY_TAXTABLE_CELL);
-    if (!cell)
-      break;
+        cell = (ComboCell *) gnc_table_layout_get_cell (ledger->table->layout,
+                ENTRY_TAXTABLE_CELL);
+        if (!cell)
+            break;
 
-    name = cell->cell.value;
-    if (!name || *name == '\0')
-      break;
+        name = cell->cell.value;
+        if (!name || *name == '\0')
+            break;
 
-    table = gncTaxTableLookupByName (ledger->book, cell->cell.value);
-    if (table)
-      break;
+        table = gncTaxTableLookupByName (ledger->book, cell->cell.value);
+        if (table)
+            break;
 
-    {
-      const char *format = _("The tax table %s does not exist. "
-                             "Would you like to create it?");
-      if (!gnc_verify_dialog (ledger->parent, TRUE, format, name))
-        break;
-    }
+        {
+            const char *format = _("The tax table %s does not exist. "
+                                   "Would you like to create it?");
+            if (!gnc_verify_dialog (ledger->parent, TRUE, format, name))
+                break;
+        }
 
-    ledger->full_refresh = FALSE;
+        ledger->full_refresh = FALSE;
 
-    table = gnc_ui_tax_table_new_from_name (ledger->book, name);
-    if (!table)
-      break;
+        table = gnc_ui_tax_table_new_from_name (ledger->book, name);
+        if (!table)
+            break;
 
-    ledger->full_refresh = TRUE;
+        ledger->full_refresh = TRUE;
 
-    name = (char *)gncTaxTableGetName (table);
-    gnc_combo_cell_set_value (cell, name);
-    gnc_basic_cell_set_changed (&cell->cell, TRUE);
+        name = (char *)gncTaxTableGetName (table);
+        gnc_combo_cell_set_value (cell, name);
+        gnc_basic_cell_set_changed (&cell->cell, TRUE);
 
-  } while (FALSE);
+    }
+    while (FALSE);
 
 
-  /* See if we are tabbing off the end of the very last line
-   * (i.e. the blank entry)
-   */
-  do
-  {
-    VirtualLocation virt_loc;
+    /* See if we are tabbing off the end of the very last line
+     * (i.e. the blank entry)
+     */
+    do
+    {
+        VirtualLocation virt_loc;
 
-    if (!changed && !ledger->blank_entry_edited)
-      break;
+        if (!changed && !ledger->blank_entry_edited)
+            break;
 
-    if (dir != GNC_TABLE_TRAVERSE_RIGHT)
-      break;
+        if (dir != GNC_TABLE_TRAVERSE_RIGHT)
+            break;
 
-    virt_loc = ledger->table->current_cursor_loc;
-    if (gnc_table_move_vertical_position (ledger->table, &virt_loc, 1))
-      break;
+        virt_loc = ledger->table->current_cursor_loc;
+        if (gnc_table_move_vertical_position (ledger->table, &virt_loc, 1))
+            break;
 
-    virt_loc = ledger->table->current_cursor_loc;
-    if (gnc_table_move_tab (ledger->table, &virt_loc, TRUE))
-      break;
+        virt_loc = ledger->table->current_cursor_loc;
+        if (gnc_table_move_tab (ledger->table, &virt_loc, TRUE))
+            break;
 
-    *p_new_virt_loc = ledger->table->current_cursor_loc;
+        *p_new_virt_loc = ledger->table->current_cursor_loc;
 
-    /* Yep, we're trying to leave the blank entry -- make sure
-     * we are allowed to do so by verifying the current cursor.
-     * If the current cursor is ok, then move on!
-     */
+        /* Yep, we're trying to leave the blank entry -- make sure
+         * we are allowed to do so by verifying the current cursor.
+         * If the current cursor is ok, then move on!
+         */
 
-    /* Verify that the cursor is ok.  If we can't save the cell, don't move! */
-    if (!gnc_entry_ledger_verify_can_save (ledger)) {
-      return TRUE;
-    }
+        /* Verify that the cursor is ok.  If we can't save the cell, don't move! */
+        if (!gnc_entry_ledger_verify_can_save (ledger))
+        {
+            return TRUE;
+        }
 
-    (p_new_virt_loc->vcell_loc.virt_row)++;
-    p_new_virt_loc->phys_row_offset = 0;
-    p_new_virt_loc->phys_col_offset = 0;
+        (p_new_virt_loc->vcell_loc.virt_row)++;
+        p_new_virt_loc->phys_row_offset = 0;
+        p_new_virt_loc->phys_col_offset = 0;
 
-    ledger->traverse_to_new = TRUE;
+        ledger->traverse_to_new = TRUE;
 
-    /* If we're here, we're tabbing off the end of the 'blank entry' */
-    return FALSE;
+        /* If we're here, we're tabbing off the end of the 'blank entry' */
+        return FALSE;
 
-  } while (FALSE);
+    }
+    while (FALSE);
 
-  /* Now see if we are changing cursors. If not, we may be able to
-   * auto-complete. */
-  if (!gnc_table_virtual_cell_out_of_bounds (ledger->table,
-					     virt_loc.vcell_loc))
-  {
-    if (gnc_entry_ledger_auto_completion (ledger, dir, p_new_virt_loc))
-      return FALSE;
-  }
+    /* Now see if we are changing cursors. If not, we may be able to
+     * auto-complete. */
+    if (!gnc_table_virtual_cell_out_of_bounds (ledger->table,
+            virt_loc.vcell_loc))
+    {
+        if (gnc_entry_ledger_auto_completion (ledger, dir, p_new_virt_loc))
+            return FALSE;
+    }
 
-  /* Check for going off the end */
-  gnc_table_find_close_valid_cell (ledger->table, &virt_loc, exact_traversal);
+    /* Check for going off the end */
+    gnc_table_find_close_valid_cell (ledger->table, &virt_loc, exact_traversal);
 
-  /* Same entry, no problem -- we're just moving backwards in the cursor */
-  new_entry = gnc_entry_ledger_get_entry (ledger, virt_loc.vcell_loc);
-  if (entry == new_entry)
-  {
-    *p_new_virt_loc = virt_loc;
+    /* Same entry, no problem -- we're just moving backwards in the cursor */
+    new_entry = gnc_entry_ledger_get_entry (ledger, virt_loc.vcell_loc);
+    if (entry == new_entry)
+    {
+        *p_new_virt_loc = virt_loc;
 
-    return FALSE;
-  }
+        return FALSE;
+    }
 
-  /* If we are here, then we are trying to leave the cursor.  Make sure
-   * the cursor we are leaving is valid.  If so, ask the user if the
-   * changes should be recorded.  If not, don't go anywhere.
-   */
+    /* If we are here, then we are trying to leave the cursor.  Make sure
+     * the cursor we are leaving is valid.  If so, ask the user if the
+     * changes should be recorded.  If not, don't go anywhere.
+     */
 
-  /* Verify this cursor -- if it's not valid, don't let them move on */
-  if (!gnc_entry_ledger_verify_can_save (ledger)) {
-    *p_new_virt_loc = ledger->table->current_cursor_loc;
-    return TRUE;
-  }
+    /* Verify this cursor -- if it's not valid, don't let them move on */
+    if (!gnc_entry_ledger_verify_can_save (ledger))
+    {
+        *p_new_virt_loc = ledger->table->current_cursor_loc;
+        return TRUE;
+    }
 
-  /*
-   * XXX  GNCENTRY_INVOICE_EDIT processing to be added:
-   * 1) check if the qty field changed.
-   * 2) if so, check if this entry is part of an order.
-   * 3) if so, ask if they want to change the entry or
-   *    split the entry into two parts.
-   */
+    /*
+     * XXX  GNCENTRY_INVOICE_EDIT processing to be added:
+     * 1) check if the qty field changed.
+     * 2) if so, check if this entry is part of an order.
+     * 3) if so, ask if they want to change the entry or
+     *    split the entry into two parts.
+     */
 
-  /* Ok, we are changing lines and the current entry has
-   * changed. We only ask them what they want to do in
-   * limited cases -- usually just let the change go through.
-   */
-  {
-    GtkWidget *dialog;
-    const char *title = _("Save the current entry?");
-    const char *message =
-      _("The current entry has been changed.  However, this entry is "
-	"part of an existing order. Would you like to record the change "
-	"and effectively change your order?");
+    /* Ok, we are changing lines and the current entry has
+     * changed. We only ask them what they want to do in
+     * limited cases -- usually just let the change go through.
+     */
+    {
+        GtkWidget *dialog;
+        const char *title = _("Save the current entry?");
+        const char *message =
+            _("The current entry has been changed.  However, this entry is "
+              "part of an existing order. Would you like to record the change "
+              "and effectively change your order?");
 
-    switch (ledger->type) {
-    case GNCENTRY_INVOICE_ENTRY:
-      if (gncEntryGetOrder (entry) != NULL) {
-	dialog = gtk_message_dialog_new(GTK_WINDOW(ledger->parent),
-					GTK_DIALOG_DESTROY_WITH_PARENT,
-					GTK_MESSAGE_QUESTION,
-					GTK_BUTTONS_NONE,
-					"%s", title);
-	gtk_message_dialog_format_secondary_text(GTK_MESSAGE_DIALOG(dialog),
-						 "%s", message);
-	gtk_dialog_add_buttons(GTK_DIALOG(dialog),
-			       _("_Don't Record"), GTK_RESPONSE_REJECT,
-			       GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
-			       _("_Record"), GTK_RESPONSE_ACCEPT,
-			       NULL);
-	response = gnc_dialog_run(GTK_DIALOG(dialog), "invoice_entry_changed");
-	gtk_widget_destroy(dialog);
-	break;
-      }
+        switch (ledger->type)
+        {
+        case GNCENTRY_INVOICE_ENTRY:
+            if (gncEntryGetOrder (entry) != NULL)
+            {
+                dialog = gtk_message_dialog_new(GTK_WINDOW(ledger->parent),
+                                                GTK_DIALOG_DESTROY_WITH_PARENT,
+                                                GTK_MESSAGE_QUESTION,
+                                                GTK_BUTTONS_NONE,
+                                                "%s", title);
+                gtk_message_dialog_format_secondary_text(GTK_MESSAGE_DIALOG(dialog),
+                        "%s", message);
+                gtk_dialog_add_buttons(GTK_DIALOG(dialog),
+                                       _("_Don't Record"), GTK_RESPONSE_REJECT,
+                                       GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
+                                       _("_Record"), GTK_RESPONSE_ACCEPT,
+                                       NULL);
+                response = gnc_dialog_run(GTK_DIALOG(dialog), "invoice_entry_changed");
+                gtk_widget_destroy(dialog);
+                break;
+            }
 
-      /* FALLTHROUGH */
-    default:
-      response = GTK_RESPONSE_ACCEPT;
-      break;
+            /* FALLTHROUGH */
+        default:
+            response = GTK_RESPONSE_ACCEPT;
+            break;
+        }
     }
-  }
 
-  switch (response)
-  {
+    switch (response)
+    {
     case GTK_RESPONSE_ACCEPT:
-      break;
+        break;
 
     case GTK_RESPONSE_REJECT:
-      {
+    {
         VirtualCellLocation vcell_loc;
-	GncEntry *new_entry;
+        GncEntry *new_entry;
 
-	new_entry = gnc_entry_ledger_get_entry (ledger, virt_loc.vcell_loc);
+        new_entry = gnc_entry_ledger_get_entry (ledger, virt_loc.vcell_loc);
 
-	gnc_entry_ledger_cancel_cursor_changes (ledger);
+        gnc_entry_ledger_cancel_cursor_changes (ledger);
 
-	if (gnc_entry_ledger_find_entry (ledger, new_entry, &vcell_loc))
-	  virt_loc.vcell_loc = vcell_loc;
+        if (gnc_entry_ledger_find_entry (ledger, new_entry, &vcell_loc))
+            virt_loc.vcell_loc = vcell_loc;
 
         gnc_table_find_close_valid_cell (ledger->table, &virt_loc,
                                          exact_traversal);
 
         *p_new_virt_loc = virt_loc;
-      }
+    }
 
-      break;
+    break;
 
     case GTK_RESPONSE_CANCEL:
     default:
-      return TRUE;
-  }
+        return TRUE;
+    }
 
-  return FALSE;
+    return FALSE;
 }
 
 TableControl * gnc_entry_ledger_control_new (void)
 {
-  TableControl * control;
+    TableControl * control;
 
-  control = gnc_table_control_new ();
-  control->move_cursor = gnc_entry_ledger_move_cursor;
-  control->traverse = gnc_entry_ledger_traverse;
+    control = gnc_table_control_new ();
+    control->move_cursor = gnc_entry_ledger_move_cursor;
+    control->traverse = gnc_entry_ledger_traverse;
 
-  return control;
+    return control;
 }
 
 
 void gnc_entry_ledger_cancel_cursor_changes (GncEntryLedger *ledger)
 {
-  VirtualLocation virt_loc;
+    VirtualLocation virt_loc;
 
-  if (ledger == NULL)
-    return;
+    if (ledger == NULL)
+        return;
 
-  virt_loc = ledger->table->current_cursor_loc;
+    virt_loc = ledger->table->current_cursor_loc;
 
-  if (!gnc_table_current_cursor_changed (ledger->table, FALSE))
-    return;
+    if (!gnc_table_current_cursor_changed (ledger->table, FALSE))
+        return;
 
-  /* When cancelling edits, reload the cursor from the entry. */
-  gnc_table_clear_current_cursor_changes (ledger->table);
+    /* When cancelling edits, reload the cursor from the entry. */
+    gnc_table_clear_current_cursor_changes (ledger->table);
 
-  if (gnc_table_find_close_valid_cell (ledger->table, &virt_loc, FALSE))
-    gnc_table_move_cursor_gui (ledger->table, virt_loc);
+    if (gnc_table_find_close_valid_cell (ledger->table, &virt_loc, FALSE))
+        gnc_table_move_cursor_gui (ledger->table, virt_loc);
 
-  gnc_table_refresh_gui (ledger->table, TRUE);
+    gnc_table_refresh_gui (ledger->table, TRUE);
 }
 
 static gboolean
 gnc_entry_ledger_check_close_internal (GtkWidget *parent,
-				       GncEntryLedger *ledger,
-				       gboolean dontask)
+                                       GncEntryLedger *ledger,
+                                       gboolean dontask)
 {
-  const char *message = _("The current entry has been changed. "
-			  "Would you like to save it?");
-  VirtualLocation virt_loc;
-  
-  virt_loc = ledger->table->current_cursor_loc;
-    
-  if (gnc_entry_ledger_traverse (&virt_loc, GNC_TABLE_TRAVERSE_POINTER,
-				 ledger))
-    return FALSE;
+    const char *message = _("The current entry has been changed. "
+                            "Would you like to save it?");
+    VirtualLocation virt_loc;
 
-  if (!gnc_entry_ledger_verify_can_save (ledger))
-    return FALSE;
+    virt_loc = ledger->table->current_cursor_loc;
 
-  if (dontask || gnc_verify_dialog (parent, TRUE, "%s", message))
-    gnc_entry_ledger_save (ledger, TRUE);
-  else
-    gnc_entry_ledger_cancel_cursor_changes (ledger);
+    if (gnc_entry_ledger_traverse (&virt_loc, GNC_TABLE_TRAVERSE_POINTER,
+                                   ledger))
+        return FALSE;
 
-  return TRUE;
+    if (!gnc_entry_ledger_verify_can_save (ledger))
+        return FALSE;
+
+    if (dontask || gnc_verify_dialog (parent, TRUE, "%s", message))
+        gnc_entry_ledger_save (ledger, TRUE);
+    else
+        gnc_entry_ledger_cancel_cursor_changes (ledger);
+
+    return TRUE;
 }
 
 gboolean
 gnc_entry_ledger_commit_entry (GncEntryLedger *ledger)
 {
-  if (!ledger) return TRUE;
+    if (!ledger) return TRUE;
 
-  return gnc_entry_ledger_check_close_internal (NULL, ledger, TRUE);
+    return gnc_entry_ledger_check_close_internal (NULL, ledger, TRUE);
 }
 
 gboolean
 gnc_entry_ledger_check_close (GtkWidget *parent, GncEntryLedger *ledger)
 {
-  if (!ledger) return TRUE;
+    if (!ledger) return TRUE;
 
-  if (gnc_entry_ledger_changed (ledger)) {
-    gboolean dontask = FALSE;
+    if (gnc_entry_ledger_changed (ledger))
+    {
+        gboolean dontask = FALSE;
 
-    if (ledger->type ==  GNCENTRY_INVOICE_ENTRY) {
-      gboolean inv_value;
-      gboolean only_inv_changed = FALSE;
+        if (ledger->type ==  GNCENTRY_INVOICE_ENTRY)
+        {
+            gboolean inv_value;
+            gboolean only_inv_changed = FALSE;
 
-      if (gnc_table_current_cursor_changed (ledger->table, FALSE) == 1 &&
-	  gnc_table_layout_get_cell_changed (ledger->table->layout,
-					     ENTRY_INV_CELL, TRUE))
-	only_inv_changed = TRUE;
+            if (gnc_table_current_cursor_changed (ledger->table, FALSE) == 1 &&
+                    gnc_table_layout_get_cell_changed (ledger->table->layout,
+                            ENTRY_INV_CELL, TRUE))
+                only_inv_changed = TRUE;
 
-      inv_value = gnc_entry_ledger_get_checkmark (ledger, ENTRY_INV_CELL);
-      
-      if (inv_value && only_inv_changed) {
-	/* If the only change is that the 'inv' entry was clicked
-	 * "on", then just accept the change it without question.
-	 */
-	dontask = TRUE;
-      }
-    }
+            inv_value = gnc_entry_ledger_get_checkmark (ledger, ENTRY_INV_CELL);
 
-    return gnc_entry_ledger_check_close_internal (parent, ledger, dontask);
+            if (inv_value && only_inv_changed)
+            {
+                /* If the only change is that the 'inv' entry was clicked
+                 * "on", then just accept the change it without question.
+                 */
+                dontask = TRUE;
+            }
+        }
 
-  }
-  return TRUE;
+        return gnc_entry_ledger_check_close_internal (parent, ledger, dontask);
+
+    }
+    return TRUE;
 }

Modified: gnucash/trunk/src/business/business-ledger/gncEntryLedgerDisplay.c
===================================================================
--- gnucash/trunk/src/business/business-ledger/gncEntryLedgerDisplay.c	2010-03-02 21:40:28 UTC (rev 18788)
+++ gnucash/trunk/src/business/business-ledger/gncEntryLedgerDisplay.c	2010-03-02 21:41:05 UTC (rev 18789)
@@ -40,162 +40,168 @@
 static GList *
 gnc_entry_ledger_get_entries (GncEntryLedger *ledger)
 {
-  if (ledger->query)
-    return gncQueryRun (ledger->query);
+    if (ledger->query)
+        return gncQueryRun (ledger->query);
 
-  //  g_warning ("No query to run?");
-  return NULL;
+    //  g_warning ("No query to run?");
+    return NULL;
 }
 
 static void
 gnc_entry_ledger_refresh_internal (GncEntryLedger *ledger, GList *entries)
 {
-  if (!ledger || ledger->loading)
-    return;
+    if (!ledger || ledger->loading)
+        return;
 
-  /* If not full refresh ok, just load the xfer cells */
-  if (!ledger->full_refresh) {
-    gnc_entry_ledger_load_xfer_cells (ledger);
-    return;
-  }
+    /* If not full refresh ok, just load the xfer cells */
+    if (!ledger->full_refresh)
+    {
+        gnc_entry_ledger_load_xfer_cells (ledger);
+        return;
+    }
 
-  /* Viewers must always have at least one entry! */
-  if ((ledger->type == GNCENTRY_ORDER_VIEWER ||
-       ledger->type == GNCENTRY_INVOICE_VIEWER ||
-       ledger->type == GNCENTRY_BILL_VIEWER ||
-       ledger->type == GNCENTRY_EXPVOUCHER_VIEWER) && !entries)
-    return;
+    /* Viewers must always have at least one entry! */
+    if ((ledger->type == GNCENTRY_ORDER_VIEWER ||
+            ledger->type == GNCENTRY_INVOICE_VIEWER ||
+            ledger->type == GNCENTRY_BILL_VIEWER ||
+            ledger->type == GNCENTRY_EXPVOUCHER_VIEWER) && !entries)
+        return;
 
-  ledger->loading = TRUE;
-  gnc_entry_ledger_load (ledger, entries);
-  ledger->loading = FALSE;
+    ledger->loading = TRUE;
+    gnc_entry_ledger_load (ledger, entries);
+    ledger->loading = FALSE;
 }
 
 static void
 gnc_entry_ledger_gconf_changed (GConfEntry *entry, gpointer user_data)
 {
-  GncEntryLedger *ledger = user_data;
+    GncEntryLedger *ledger = user_data;
 
-  g_return_if_fail (ledger && entry && entry->key);
+    g_return_if_fail (ledger && entry && entry->key);
 
-  if (g_str_has_suffix (entry->key, KEY_ACCOUNT_SEPARATOR)) {
-    gnc_entry_ledger_display_refresh (ledger);
-  } else {
-    g_warning ("gnc_entry_gconf_changed: Unknown gconf key %s", entry->key);
-  }
+    if (g_str_has_suffix (entry->key, KEY_ACCOUNT_SEPARATOR))
+    {
+        gnc_entry_ledger_display_refresh (ledger);
+    }
+    else
+    {
+        g_warning ("gnc_entry_gconf_changed: Unknown gconf key %s", entry->key);
+    }
 }
 
 static void
 gnc_entry_ledger_set_watches (GncEntryLedger *ledger, GList *entries)
 {
-  GList *node;
-  GNCIdType type = NULL;
+    GList *node;
+    GNCIdType type = NULL;
 
-  gnc_gui_component_clear_watches (ledger->component_id);
+    gnc_gui_component_clear_watches (ledger->component_id);
 
-  switch (ledger->type) {
-  case GNCENTRY_ORDER_ENTRY:
-  case GNCENTRY_ORDER_VIEWER:
-    type = GNC_ORDER_MODULE_NAME;
-    break;
+    switch (ledger->type)
+    {
+    case GNCENTRY_ORDER_ENTRY:
+    case GNCENTRY_ORDER_VIEWER:
+        type = GNC_ORDER_MODULE_NAME;
+        break;
 
-  case GNCENTRY_INVOICE_ENTRY:
-    /* Watch the invoice owner to see when items get added via orders */
-    gnc_gui_component_watch_entity (ledger->component_id,
-				    gncOwnerGetGUID
-				    (gncInvoiceGetOwner (ledger->invoice)),
-				    QOF_EVENT_MODIFY);
-  case GNCENTRY_INVOICE_VIEWER:
-  case GNCENTRY_BILL_ENTRY:
-  case GNCENTRY_BILL_VIEWER:
-  case GNCENTRY_EXPVOUCHER_ENTRY:
-  case GNCENTRY_EXPVOUCHER_VIEWER:
-    type = GNC_INVOICE_MODULE_NAME;
-    break;
+    case GNCENTRY_INVOICE_ENTRY:
+        /* Watch the invoice owner to see when items get added via orders */
+        gnc_gui_component_watch_entity (ledger->component_id,
+                                        gncOwnerGetGUID
+                                        (gncInvoiceGetOwner (ledger->invoice)),
+                                        QOF_EVENT_MODIFY);
+    case GNCENTRY_INVOICE_VIEWER:
+    case GNCENTRY_BILL_ENTRY:
+    case GNCENTRY_BILL_VIEWER:
+    case GNCENTRY_EXPVOUCHER_ENTRY:
+    case GNCENTRY_EXPVOUCHER_VIEWER:
+        type = GNC_INVOICE_MODULE_NAME;
+        break;
 
-  default:
-    g_warning ("Invalid ledger type");
-    break;
-  }
+    default:
+        g_warning ("Invalid ledger type");
+        break;
+    }
 
-  gnc_gui_component_watch_entity_type (ledger->component_id,
-                                       type,
-                                       QOF_EVENT_MODIFY | QOF_EVENT_DESTROY);
+    gnc_gui_component_watch_entity_type (ledger->component_id,
+                                         type,
+                                         QOF_EVENT_MODIFY | QOF_EVENT_DESTROY);
 
-  /* To make sure the xfer cell is up to date */
-  gnc_gui_component_watch_entity_type (ledger->component_id,
-                                       GNC_ID_ACCOUNT,
-                                       QOF_EVENT_MODIFY | QOF_EVENT_DESTROY
-				       | GNC_EVENT_ITEM_CHANGED);
+    /* To make sure the xfer cell is up to date */
+    gnc_gui_component_watch_entity_type (ledger->component_id,
+                                         GNC_ID_ACCOUNT,
+                                         QOF_EVENT_MODIFY | QOF_EVENT_DESTROY
+                                         | GNC_EVENT_ITEM_CHANGED);
 
-  /* To make sure the taxtable cell is up to date */
-  gnc_gui_component_watch_entity_type (ledger->component_id,
-                                       GNC_TAXTABLE_MODULE_NAME,
-                                       QOF_EVENT_MODIFY | QOF_EVENT_DESTROY);
+    /* To make sure the taxtable cell is up to date */
+    gnc_gui_component_watch_entity_type (ledger->component_id,
+                                         GNC_TAXTABLE_MODULE_NAME,
+                                         QOF_EVENT_MODIFY | QOF_EVENT_DESTROY);
 
-  /* For expense vouchers, watch the employee and refresh if it's changed */
-  if (ledger->type == GNCENTRY_EXPVOUCHER_ENTRY) {
-    GncOwner *owner = gncOwnerGetEndOwner (gncInvoiceGetOwner (ledger->invoice));
-    GncEmployee *employee = gncOwnerGetEmployee (owner);
+    /* For expense vouchers, watch the employee and refresh if it's changed */
+    if (ledger->type == GNCENTRY_EXPVOUCHER_ENTRY)
+    {
+        GncOwner *owner = gncOwnerGetEndOwner (gncInvoiceGetOwner (ledger->invoice));
+        GncEmployee *employee = gncOwnerGetEmployee (owner);
 
-    if (employee)
-      gnc_gui_component_watch_entity (ledger->component_id,
-				      gncEmployeeGetGUID (employee),
-				      QOF_EVENT_MODIFY);
-  }
+        if (employee)
+            gnc_gui_component_watch_entity (ledger->component_id,
+                                            gncEmployeeGetGUID (employee),
+                                            QOF_EVENT_MODIFY);
+    }
 
-  for (node = entries; node; node = node->next)
-  {
-    GncEntry *entry = node->data;
-    gnc_gui_component_watch_entity (ledger->component_id,
-                                    gncEntryGetGUID (entry),
-                                    QOF_EVENT_MODIFY);
-  }
+    for (node = entries; node; node = node->next)
+    {
+        GncEntry *entry = node->data;
+        gnc_gui_component_watch_entity (ledger->component_id,
+                                        gncEntryGetGUID (entry),
+                                        QOF_EVENT_MODIFY);
+    }
 }
 
 static void
 refresh_handler (GHashTable *changes, gpointer user_data)
 {
-  GncEntryLedger *ledger = user_data;
+    GncEntryLedger *ledger = user_data;
 
-  gnc_entry_ledger_display_refresh (ledger);
+    gnc_entry_ledger_display_refresh (ledger);
 }
 
 void
 gnc_entry_ledger_display_init (GncEntryLedger *ledger)
 {
-  if (!ledger) return;
+    if (!ledger) return;
 
-  ledger->full_refresh = TRUE;
-  ledger->component_id = gnc_register_gui_component (ENTRYLEDGER_CLASS,
-						     refresh_handler,
-						     NULL, ledger);
-  gnc_gconf_general_register_cb(KEY_ACCOUNT_SEPARATOR,
-				gnc_entry_ledger_gconf_changed, ledger);
+    ledger->full_refresh = TRUE;
+    ledger->component_id = gnc_register_gui_component (ENTRYLEDGER_CLASS,
+                           refresh_handler,
+                           NULL, ledger);
+    gnc_gconf_general_register_cb(KEY_ACCOUNT_SEPARATOR,
+                                  gnc_entry_ledger_gconf_changed, ledger);
 
-  gnc_entry_ledger_display_refresh (ledger);
+    gnc_entry_ledger_display_refresh (ledger);
 }
 
 void
 gnc_entry_ledger_display_fini (GncEntryLedger *ledger)
 {
-  if (!ledger) return;
+    if (!ledger) return;
 
-  gnc_unregister_gui_component (ledger->component_id);
-  gnc_gconf_general_remove_cb(KEY_ACCOUNT_SEPARATOR,
-			      gnc_entry_ledger_gconf_changed, ledger);
+    gnc_unregister_gui_component (ledger->component_id);
+    gnc_gconf_general_remove_cb(KEY_ACCOUNT_SEPARATOR,
+                                gnc_entry_ledger_gconf_changed, ledger);
 }
 
 void
 gnc_entry_ledger_display_refresh (GncEntryLedger *ledger)
 {
-  GList *entries;
+    GList *entries;
 
-  if (!ledger || ledger->loading) return;
+    if (!ledger || ledger->loading) return;
 
-  entries = gnc_entry_ledger_get_entries (ledger);
+    entries = gnc_entry_ledger_get_entries (ledger);
 
-  gnc_entry_ledger_set_watches (ledger, entries);
+    gnc_entry_ledger_set_watches (ledger, entries);
 
-  gnc_entry_ledger_refresh_internal (ledger, entries);
+    gnc_entry_ledger_refresh_internal (ledger, entries);
 }

Modified: gnucash/trunk/src/business/business-ledger/gncEntryLedgerLayout.c
===================================================================
--- gnucash/trunk/src/business/business-ledger/gncEntryLedgerLayout.c	2010-03-02 21:40:28 UTC (rev 18788)
+++ gnucash/trunk/src/business/business-ledger/gncEntryLedgerLayout.c	2010-03-02 21:41:05 UTC (rev 18789)
@@ -38,203 +38,243 @@
                        gboolean expandable,
                        gboolean span)
 {
-  BasicCell *cell;
+    BasicCell *cell;
 
-  g_return_if_fail (layout != NULL);
-  g_return_if_fail (cell_type_name != NULL);
+    g_return_if_fail (layout != NULL);
+    g_return_if_fail (cell_type_name != NULL);
 
-  cell = gnc_register_make_cell (cell_type_name);
+    cell = gnc_register_make_cell (cell_type_name);
 
-  gnc_basic_cell_set_name (cell, cell_name);
-  gnc_basic_cell_set_sample_text (cell, sample_text);
-  gnc_basic_cell_set_alignment (cell, alignment);
-  gnc_basic_cell_set_expandable (cell, expandable);
-  gnc_basic_cell_set_span (cell, span);
+    gnc_basic_cell_set_name (cell, cell_name);
+    gnc_basic_cell_set_sample_text (cell, sample_text);
+    gnc_basic_cell_set_alignment (cell, alignment);
+    gnc_basic_cell_set_expandable (cell, expandable);
+    gnc_basic_cell_set_span (cell, span);
 
-  gnc_table_layout_add_cell (layout, cell);
+    gnc_table_layout_add_cell (layout, cell);
 }
 
 static void gnc_entry_ledger_layout_add_cells (GncEntryLedger *ledger,
-					       TableLayout *layout)
+        TableLayout *layout)
 {
-  struct cell_list {
-    const char *cell_name;
-    const char *cell_type_name;
-    const char *sample_text;
-    CellAlignment alignment;
-    gboolean expandable;
-    gboolean span;
-  } cells[] = {
-    /* Translators: The 'sample:' items are strings which are not
-       displayed, but only used to estimate widths. Please only
-       translate the portion after the ':' and leave the rest
-       ("sample:") as is. */
-    { ENTRY_INV_CELL, CHECKBOX_CELL_TYPE_NAME, N_("sample:X")+7,
-      CELL_ALIGN_LEFT, FALSE, FALSE },
-    { ENTRY_DATE_CELL, DATE_CELL_TYPE_NAME, N_("sample:12/12/2000")+7,
-      CELL_ALIGN_RIGHT, FALSE, FALSE },
-    { ENTRY_DESC_CELL, QUICKFILL_CELL_TYPE_NAME,
-      N_("sample:Description of an Entry")+7, CELL_ALIGN_LEFT, TRUE, FALSE },
-    { ENTRY_ACTN_CELL, COMBO_CELL_TYPE_NAME,
-      N_("sample:Action")+7, CELL_ALIGN_RIGHT,
-      FALSE, FALSE },
-    { ENTRY_QTY_CELL, PRICE_CELL_TYPE_NAME, N_("sample:9,999.00") + 7,
-      CELL_ALIGN_RIGHT, FALSE, FALSE },
-    { ENTRY_PRIC_CELL, PRICE_CELL_TYPE_NAME, N_("sample:999,999.00") + 7,
-      CELL_ALIGN_RIGHT, FALSE, FALSE },
-    { ENTRY_DISC_CELL, PRICE_CELL_TYPE_NAME, N_("sample:9,999.00") + 7,
-      CELL_ALIGN_RIGHT, FALSE, FALSE },
-    /* xgettext:no-c-format */
-    { ENTRY_DISTYPE_CELL, RECN_CELL_TYPE_NAME, N_("sample(DT):+%")+11,
-      CELL_ALIGN_LEFT, FALSE, FALSE },
-    /* xgettext:no-c-format */
-    { ENTRY_DISHOW_CELL, RECN_CELL_TYPE_NAME, N_("sample(DH):+%")+11,
-      CELL_ALIGN_LEFT, FALSE, FALSE },
-    { ENTRY_IACCT_CELL, COMBO_CELL_TYPE_NAME,
-      N_("sample:Expenses:Automobile:Gasoline") + 7,
-      CELL_ALIGN_RIGHT, FALSE, FALSE },
-    { ENTRY_BACCT_CELL, COMBO_CELL_TYPE_NAME,
-      N_("sample:Expenses:Automobile:Gasoline") + 7,
-      CELL_ALIGN_RIGHT, FALSE, FALSE },
-    { ENTRY_TAXABLE_CELL, CHECKBOX_CELL_TYPE_NAME, N_("sample:T?")+7,
-      CELL_ALIGN_LEFT, FALSE, FALSE },
-    { ENTRY_TAXINCLUDED_CELL, CHECKBOX_CELL_TYPE_NAME, N_("sample:TI")+7,
-      CELL_ALIGN_LEFT, FALSE, FALSE },
-    { ENTRY_TAXTABLE_CELL, COMBO_CELL_TYPE_NAME, N_("sample:Tax Table 1")+7,
-      CELL_ALIGN_RIGHT, FALSE, FALSE },
-    { ENTRY_VALUE_CELL, PRICE_CELL_TYPE_NAME, N_("sample:999,999.00")+7,
-      CELL_ALIGN_RIGHT, FALSE, FALSE },
-    { ENTRY_TAXVAL_CELL, PRICE_CELL_TYPE_NAME, N_("sample:999.00")+7,
-      CELL_ALIGN_RIGHT, FALSE, FALSE },
-    { ENTRY_BILLABLE_CELL, CHECKBOX_CELL_TYPE_NAME, N_("sample:BI")+7,
-      CELL_ALIGN_LEFT, FALSE, FALSE },
-    { ENTRY_PAYMENT_CELL, COMBO_CELL_TYPE_NAME, N_("sample:Payment")+7,
-      CELL_ALIGN_LEFT, FALSE, FALSE }
-  };
-  unsigned int i;
+    struct cell_list
+    {
+        const char *cell_name;
+        const char *cell_type_name;
+        const char *sample_text;
+        CellAlignment alignment;
+        gboolean expandable;
+        gboolean span;
+    } cells[] =
+    {
+        /* Translators: The 'sample:' items are strings which are not
+           displayed, but only used to estimate widths. Please only
+           translate the portion after the ':' and leave the rest
+           ("sample:") as is. */
+        {
+            ENTRY_INV_CELL, CHECKBOX_CELL_TYPE_NAME, N_("sample:X") + 7,
+            CELL_ALIGN_LEFT, FALSE, FALSE
+        },
+        {
+            ENTRY_DATE_CELL, DATE_CELL_TYPE_NAME, N_("sample:12/12/2000") + 7,
+            CELL_ALIGN_RIGHT, FALSE, FALSE
+        },
+        {
+            ENTRY_DESC_CELL, QUICKFILL_CELL_TYPE_NAME,
+            N_("sample:Description of an Entry") + 7, CELL_ALIGN_LEFT, TRUE, FALSE
+        },
+        {
+            ENTRY_ACTN_CELL, COMBO_CELL_TYPE_NAME,
+            N_("sample:Action") + 7, CELL_ALIGN_RIGHT,
+            FALSE, FALSE
+        },
+        {
+            ENTRY_QTY_CELL, PRICE_CELL_TYPE_NAME, N_("sample:9,999.00") + 7,
+            CELL_ALIGN_RIGHT, FALSE, FALSE
+        },
+        {
+            ENTRY_PRIC_CELL, PRICE_CELL_TYPE_NAME, N_("sample:999,999.00") + 7,
+            CELL_ALIGN_RIGHT, FALSE, FALSE
+        },
+        {
+            ENTRY_DISC_CELL, PRICE_CELL_TYPE_NAME, N_("sample:9,999.00") + 7,
+            CELL_ALIGN_RIGHT, FALSE, FALSE
+        },
+        /* xgettext:no-c-format */
+        {
+            ENTRY_DISTYPE_CELL, RECN_CELL_TYPE_NAME, N_("sample(DT):+%") + 11,
+            CELL_ALIGN_LEFT, FALSE, FALSE
+        },
+        /* xgettext:no-c-format */
+        {
+            ENTRY_DISHOW_CELL, RECN_CELL_TYPE_NAME, N_("sample(DH):+%") + 11,
+            CELL_ALIGN_LEFT, FALSE, FALSE
+        },
+        {
+            ENTRY_IACCT_CELL, COMBO_CELL_TYPE_NAME,
+            N_("sample:Expenses:Automobile:Gasoline") + 7,
+            CELL_ALIGN_RIGHT, FALSE, FALSE
+        },
+        {
+            ENTRY_BACCT_CELL, COMBO_CELL_TYPE_NAME,
+            N_("sample:Expenses:Automobile:Gasoline") + 7,
+            CELL_ALIGN_RIGHT, FALSE, FALSE
+        },
+        {
+            ENTRY_TAXABLE_CELL, CHECKBOX_CELL_TYPE_NAME, N_("sample:T?") + 7,
+            CELL_ALIGN_LEFT, FALSE, FALSE
+        },
+        {
+            ENTRY_TAXINCLUDED_CELL, CHECKBOX_CELL_TYPE_NAME, N_("sample:TI") + 7,
+            CELL_ALIGN_LEFT, FALSE, FALSE
+        },
+        {
+            ENTRY_TAXTABLE_CELL, COMBO_CELL_TYPE_NAME, N_("sample:Tax Table 1") + 7,
+            CELL_ALIGN_RIGHT, FALSE, FALSE
+        },
+        {
+            ENTRY_VALUE_CELL, PRICE_CELL_TYPE_NAME, N_("sample:999,999.00") + 7,
+            CELL_ALIGN_RIGHT, FALSE, FALSE
+        },
+        {
+            ENTRY_TAXVAL_CELL, PRICE_CELL_TYPE_NAME, N_("sample:999.00") + 7,
+            CELL_ALIGN_RIGHT, FALSE, FALSE
+        },
+        {
+            ENTRY_BILLABLE_CELL, CHECKBOX_CELL_TYPE_NAME, N_("sample:BI") + 7,
+            CELL_ALIGN_LEFT, FALSE, FALSE
+        },
+        {
+            ENTRY_PAYMENT_CELL, COMBO_CELL_TYPE_NAME, N_("sample:Payment") + 7,
+            CELL_ALIGN_LEFT, FALSE, FALSE
+        }
+    };
+    unsigned int i;
 
-  for (i = 0; i < (sizeof(cells)/sizeof(*cells)); i++)
-    gnc_register_add_cell (layout, cells[i].cell_name, cells[i].cell_type_name,
-			   cells[i].sample_text, cells[i].alignment,
-			   cells[i].expandable, cells[i].span);
+    for (i = 0; i < (sizeof(cells) / sizeof(*cells)); i++)
+        gnc_register_add_cell (layout, cells[i].cell_name, cells[i].cell_type_name,
+                               cells[i].sample_text, cells[i].alignment,
+                               cells[i].expandable, cells[i].span);
 }
 
 static void gnc_entry_ledger_layout_add_cursors (GncEntryLedger *ledger,
-						 TableLayout *layout)
+        TableLayout *layout)
 {
-  CellBlock *cursor;
-  int num_cols;
+    CellBlock *cursor;
+    int num_cols;
 
-  switch (ledger->type) {
-  case GNCENTRY_ORDER_ENTRY:
-  case GNCENTRY_ORDER_VIEWER:
-  case GNCENTRY_INVOICE_ENTRY:
-  case GNCENTRY_INVOICE_VIEWER:
-    num_cols = 15;
-    break;
-  case GNCENTRY_BILL_ENTRY:
-  case GNCENTRY_BILL_VIEWER:
-    num_cols = 12;
-    break;
-  case GNCENTRY_EXPVOUCHER_ENTRY:
-  case GNCENTRY_EXPVOUCHER_VIEWER:
-    num_cols = 10;
-    break;
-  default:
-    g_assert (FALSE);
-    return;    
-  }
+    switch (ledger->type)
+    {
+    case GNCENTRY_ORDER_ENTRY:
+    case GNCENTRY_ORDER_VIEWER:
+    case GNCENTRY_INVOICE_ENTRY:
+    case GNCENTRY_INVOICE_VIEWER:
+        num_cols = 15;
+        break;
+    case GNCENTRY_BILL_ENTRY:
+    case GNCENTRY_BILL_VIEWER:
+        num_cols = 12;
+        break;
+    case GNCENTRY_EXPVOUCHER_ENTRY:
+    case GNCENTRY_EXPVOUCHER_VIEWER:
+        num_cols = 10;
+        break;
+    default:
+        g_assert (FALSE);
+        return;
+    }
 
-  cursor = gnc_cellblock_new (1, num_cols, CURSOR_HEADER);
-  gnc_table_layout_add_cursor (layout, cursor);
+    cursor = gnc_cellblock_new (1, num_cols, CURSOR_HEADER);
+    gnc_table_layout_add_cursor (layout, cursor);
 
-  cursor = gnc_cellblock_new (1, num_cols, "cursor");
-  gnc_table_layout_add_cursor (layout, cursor);
-  gnc_table_layout_set_primary_cursor (layout, cursor);
+    cursor = gnc_cellblock_new (1, num_cols, "cursor");
+    gnc_table_layout_add_cursor (layout, cursor);
+    gnc_table_layout_set_primary_cursor (layout, cursor);
 }
 
 static void gnc_entry_ledger_set_cells (GncEntryLedger *ledger,
-					TableLayout *layout)
+                                        TableLayout *layout)
 {
-  CellBlock *curs;
+    CellBlock *curs;
 
-  switch (ledger->type) {
-  case GNCENTRY_ORDER_ENTRY:
-  case GNCENTRY_ORDER_VIEWER:
-  case GNCENTRY_INVOICE_ENTRY:
-  case GNCENTRY_INVOICE_VIEWER:
+    switch (ledger->type)
+    {
+    case GNCENTRY_ORDER_ENTRY:
+    case GNCENTRY_ORDER_VIEWER:
+    case GNCENTRY_INVOICE_ENTRY:
+    case GNCENTRY_INVOICE_VIEWER:
 
-    curs = gnc_table_layout_get_cursor (layout, "cursor");
-    gnc_table_layout_set_cell (layout, curs, ENTRY_DATE_CELL, 0, 0);
-    gnc_table_layout_set_cell (layout, curs, ENTRY_INV_CELL, 0, 1);
-    gnc_table_layout_set_cell (layout, curs, ENTRY_DESC_CELL, 0, 2);
-    gnc_table_layout_set_cell (layout, curs, ENTRY_ACTN_CELL, 0, 3);
-    gnc_table_layout_set_cell (layout, curs, ENTRY_IACCT_CELL, 0, 4);
-    gnc_table_layout_set_cell (layout, curs, ENTRY_QTY_CELL, 0, 5);
-    gnc_table_layout_set_cell (layout, curs, ENTRY_PRIC_CELL, 0, 6);
-    gnc_table_layout_set_cell (layout, curs, ENTRY_DISTYPE_CELL, 0, 7);
-    gnc_table_layout_set_cell (layout, curs, ENTRY_DISHOW_CELL, 0, 8);
-    gnc_table_layout_set_cell (layout, curs, ENTRY_DISC_CELL, 0, 9);
-    gnc_table_layout_set_cell (layout, curs, ENTRY_TAXABLE_CELL, 0, 10);
-    gnc_table_layout_set_cell (layout, curs, ENTRY_TAXINCLUDED_CELL, 0, 11);
-    gnc_table_layout_set_cell (layout, curs, ENTRY_TAXTABLE_CELL, 0, 12);
-    gnc_table_layout_set_cell (layout, curs, ENTRY_VALUE_CELL, 0, 13);
-    gnc_table_layout_set_cell (layout, curs, ENTRY_TAXVAL_CELL, 0, 14);
+        curs = gnc_table_layout_get_cursor (layout, "cursor");
+        gnc_table_layout_set_cell (layout, curs, ENTRY_DATE_CELL, 0, 0);
+        gnc_table_layout_set_cell (layout, curs, ENTRY_INV_CELL, 0, 1);
+        gnc_table_layout_set_cell (layout, curs, ENTRY_DESC_CELL, 0, 2);
+        gnc_table_layout_set_cell (layout, curs, ENTRY_ACTN_CELL, 0, 3);
+        gnc_table_layout_set_cell (layout, curs, ENTRY_IACCT_CELL, 0, 4);
+        gnc_table_layout_set_cell (layout, curs, ENTRY_QTY_CELL, 0, 5);
+        gnc_table_layout_set_cell (layout, curs, ENTRY_PRIC_CELL, 0, 6);
+        gnc_table_layout_set_cell (layout, curs, ENTRY_DISTYPE_CELL, 0, 7);
+        gnc_table_layout_set_cell (layout, curs, ENTRY_DISHOW_CELL, 0, 8);
+        gnc_table_layout_set_cell (layout, curs, ENTRY_DISC_CELL, 0, 9);
+        gnc_table_layout_set_cell (layout, curs, ENTRY_TAXABLE_CELL, 0, 10);
+        gnc_table_layout_set_cell (layout, curs, ENTRY_TAXINCLUDED_CELL, 0, 11);
+        gnc_table_layout_set_cell (layout, curs, ENTRY_TAXTABLE_CELL, 0, 12);
+        gnc_table_layout_set_cell (layout, curs, ENTRY_VALUE_CELL, 0, 13);
+        gnc_table_layout_set_cell (layout, curs, ENTRY_TAXVAL_CELL, 0, 14);
 
-    break;
+        break;
 
-  case GNCENTRY_BILL_ENTRY:
-  case GNCENTRY_BILL_VIEWER:
+    case GNCENTRY_BILL_ENTRY:
+    case GNCENTRY_BILL_VIEWER:
 
-    curs = gnc_table_layout_get_cursor (layout, "cursor");
-    gnc_table_layout_set_cell (layout, curs, ENTRY_DATE_CELL, 0, 0);
-    gnc_table_layout_set_cell (layout, curs, ENTRY_INV_CELL, 0, 1);
-    gnc_table_layout_set_cell (layout, curs, ENTRY_DESC_CELL, 0, 2);
-    gnc_table_layout_set_cell (layout, curs, ENTRY_ACTN_CELL, 0, 3);
-    gnc_table_layout_set_cell (layout, curs, ENTRY_BACCT_CELL, 0, 4);
-    gnc_table_layout_set_cell (layout, curs, ENTRY_QTY_CELL, 0, 5);
-    gnc_table_layout_set_cell (layout, curs, ENTRY_PRIC_CELL, 0, 6);
-    gnc_table_layout_set_cell (layout, curs, ENTRY_TAXABLE_CELL, 0, 7);
-    gnc_table_layout_set_cell (layout, curs, ENTRY_TAXINCLUDED_CELL, 0, 8);
-    gnc_table_layout_set_cell (layout, curs, ENTRY_TAXTABLE_CELL, 0, 9);
-    gnc_table_layout_set_cell (layout, curs, ENTRY_VALUE_CELL, 0, 10);
-    gnc_table_layout_set_cell (layout, curs, ENTRY_BILLABLE_CELL, 0, 11);
+        curs = gnc_table_layout_get_cursor (layout, "cursor");
+        gnc_table_layout_set_cell (layout, curs, ENTRY_DATE_CELL, 0, 0);
+        gnc_table_layout_set_cell (layout, curs, ENTRY_INV_CELL, 0, 1);
+        gnc_table_layout_set_cell (layout, curs, ENTRY_DESC_CELL, 0, 2);
+        gnc_table_layout_set_cell (layout, curs, ENTRY_ACTN_CELL, 0, 3);
+        gnc_table_layout_set_cell (layout, curs, ENTRY_BACCT_CELL, 0, 4);
+        gnc_table_layout_set_cell (layout, curs, ENTRY_QTY_CELL, 0, 5);
+        gnc_table_layout_set_cell (layout, curs, ENTRY_PRIC_CELL, 0, 6);
+        gnc_table_layout_set_cell (layout, curs, ENTRY_TAXABLE_CELL, 0, 7);
+        gnc_table_layout_set_cell (layout, curs, ENTRY_TAXINCLUDED_CELL, 0, 8);
+        gnc_table_layout_set_cell (layout, curs, ENTRY_TAXTABLE_CELL, 0, 9);
+        gnc_table_layout_set_cell (layout, curs, ENTRY_VALUE_CELL, 0, 10);
+        gnc_table_layout_set_cell (layout, curs, ENTRY_BILLABLE_CELL, 0, 11);
 
-    break;
+        break;
 
-  case GNCENTRY_EXPVOUCHER_ENTRY:
-  case GNCENTRY_EXPVOUCHER_VIEWER:
+    case GNCENTRY_EXPVOUCHER_ENTRY:
+    case GNCENTRY_EXPVOUCHER_VIEWER:
 
-    curs = gnc_table_layout_get_cursor (layout, "cursor");
-    gnc_table_layout_set_cell (layout, curs, ENTRY_DATE_CELL, 0, 0);
-    gnc_table_layout_set_cell (layout, curs, ENTRY_INV_CELL, 0, 1);
-    gnc_table_layout_set_cell (layout, curs, ENTRY_DESC_CELL, 0, 2);
-    gnc_table_layout_set_cell (layout, curs, ENTRY_ACTN_CELL, 0, 3);
-    gnc_table_layout_set_cell (layout, curs, ENTRY_BACCT_CELL, 0, 4);
-    gnc_table_layout_set_cell (layout, curs, ENTRY_QTY_CELL, 0, 5);
-    gnc_table_layout_set_cell (layout, curs, ENTRY_PRIC_CELL, 0, 6);
-    gnc_table_layout_set_cell (layout, curs, ENTRY_VALUE_CELL, 0, 7);
-    gnc_table_layout_set_cell (layout, curs, ENTRY_BILLABLE_CELL, 0, 8);
-    gnc_table_layout_set_cell (layout, curs, ENTRY_PAYMENT_CELL, 0, 9);
+        curs = gnc_table_layout_get_cursor (layout, "cursor");
+        gnc_table_layout_set_cell (layout, curs, ENTRY_DATE_CELL, 0, 0);
+        gnc_table_layout_set_cell (layout, curs, ENTRY_INV_CELL, 0, 1);
+        gnc_table_layout_set_cell (layout, curs, ENTRY_DESC_CELL, 0, 2);
+        gnc_table_layout_set_cell (layout, curs, ENTRY_ACTN_CELL, 0, 3);
+        gnc_table_layout_set_cell (layout, curs, ENTRY_BACCT_CELL, 0, 4);
+        gnc_table_layout_set_cell (layout, curs, ENTRY_QTY_CELL, 0, 5);
+        gnc_table_layout_set_cell (layout, curs, ENTRY_PRIC_CELL, 0, 6);
+        gnc_table_layout_set_cell (layout, curs, ENTRY_VALUE_CELL, 0, 7);
+        gnc_table_layout_set_cell (layout, curs, ENTRY_BILLABLE_CELL, 0, 8);
+        gnc_table_layout_set_cell (layout, curs, ENTRY_PAYMENT_CELL, 0, 9);
 
-    break;
+        break;
 
-  default:
-    g_assert (FALSE);
-    return;
-  }
+    default:
+        g_assert (FALSE);
+        return;
+    }
 }
 
 TableLayout * gnc_entry_ledger_layout_new (GncEntryLedger *ledger)
 {
-  TableLayout *layout;
+    TableLayout *layout;
 
-  layout = gnc_table_layout_new ();
-  gnc_entry_ledger_layout_add_cells (ledger, layout);
-  gnc_entry_ledger_layout_add_cursors (ledger, layout);
-  gnc_entry_ledger_set_cells (ledger, layout);
+    layout = gnc_table_layout_new ();
+    gnc_entry_ledger_layout_add_cells (ledger, layout);
+    gnc_entry_ledger_layout_add_cursors (ledger, layout);
+    gnc_entry_ledger_set_cells (ledger, layout);
 
-  return layout;
+    return layout;
 }
 
 

Modified: gnucash/trunk/src/business/business-ledger/gncEntryLedgerLoad.c
===================================================================
--- gnucash/trunk/src/business/business-ledger/gncEntryLedgerLoad.c	2010-03-02 21:40:28 UTC (rev 18788)
+++ gnucash/trunk/src/business/business-ledger/gncEntryLedgerLoad.c	2010-03-02 21:41:05 UTC (rev 18789)
@@ -45,81 +45,88 @@
 /* XXX: This should go elsewhere */
 const char * gnc_entry_ledger_type_string_getter (char flag)
 {
-  switch (flag) {
-  case '1': return _("$");
-  case '2': return _("%");
-  default:
-    return "?";
-  };
+    switch (flag)
+    {
+    case '1':
+        return _("$");
+    case '2':
+        return _("%");
+    default:
+        return "?";
+    };
 }
 
 const char * gnc_entry_ledger_how_string_getter (char flag)
 {
-  switch (flag) {
-  case '1': return _("<");
-  case '2': return _("=");
-  case '3': return _(">");
-  default:
-    return "?";
-  };
+    switch (flag)
+    {
+    case '1':
+        return _("<");
+    case '2':
+        return _("=");
+    case '3':
+        return _(">");
+    default:
+        return "?";
+    };
 }
 
 static void load_discount_type_cells (GncEntryLedger *ledger)
 {
-  RecnCell *cell;
+    RecnCell *cell;
 
-  if (!ledger) return;
+    if (!ledger) return;
 
-  cell = (RecnCell *)
-    gnc_table_layout_get_cell (ledger->table->layout, ENTRY_DISTYPE_CELL);
+    cell = (RecnCell *)
+           gnc_table_layout_get_cell (ledger->table->layout, ENTRY_DISTYPE_CELL);
 
-  if (!cell) return;
+    if (!cell) return;
 
-  gnc_recn_cell_set_valid_flags (cell, "12", '2');
-  gnc_recn_cell_set_flag_order (cell, "21");
-  gnc_recn_cell_set_string_getter (cell, gnc_entry_ledger_type_string_getter);
+    gnc_recn_cell_set_valid_flags (cell, "12", '2');
+    gnc_recn_cell_set_flag_order (cell, "21");
+    gnc_recn_cell_set_string_getter (cell, gnc_entry_ledger_type_string_getter);
 }
 
 static void load_discount_how_cells (GncEntryLedger *ledger)
 {
-  RecnCell *cell;
+    RecnCell *cell;
 
-  if (!ledger) return;
+    if (!ledger) return;
 
-  cell = (RecnCell *)
-    gnc_table_layout_get_cell (ledger->table->layout, ENTRY_DISHOW_CELL);
+    cell = (RecnCell *)
+           gnc_table_layout_get_cell (ledger->table->layout, ENTRY_DISHOW_CELL);
 
-  if (!cell) return;
+    if (!cell) return;
 
-  gnc_recn_cell_set_valid_flags (cell, "123", '1');
-  gnc_recn_cell_set_flag_order (cell, "123");
-  gnc_recn_cell_set_string_getter (cell, gnc_entry_ledger_how_string_getter);
+    gnc_recn_cell_set_valid_flags (cell, "123", '1');
+    gnc_recn_cell_set_flag_order (cell, "123");
+    gnc_recn_cell_set_string_getter (cell, gnc_entry_ledger_how_string_getter);
 }
 
 static void load_payment_type_cells (GncEntryLedger *ledger)
 {
-  ComboCell *cell;
-  GncOwner *owner;
-  GncEmployee *employee;
+    ComboCell *cell;
+    GncOwner *owner;
+    GncEmployee *employee;
 
-  cell = (ComboCell *) gnc_table_layout_get_cell (ledger->table->layout,
-						  ENTRY_PAYMENT_CELL);
-  if (!cell) return;
+    cell = (ComboCell *) gnc_table_layout_get_cell (ledger->table->layout,
+            ENTRY_PAYMENT_CELL);
+    if (!cell) return;
 
-  if (!ledger->invoice) return;
+    if (!ledger->invoice) return;
 
-  owner = gncOwnerGetEndOwner (gncInvoiceGetOwner (ledger->invoice));
-  if (gncOwnerGetType (owner) != GNC_OWNER_EMPLOYEE)
-    return;
+    owner = gncOwnerGetEndOwner (gncInvoiceGetOwner (ledger->invoice));
+    if (gncOwnerGetType (owner) != GNC_OWNER_EMPLOYEE)
+        return;
 
-  employee = gncOwnerGetEmployee (owner);
-  g_return_if_fail (employee);
+    employee = gncOwnerGetEmployee (owner);
+    g_return_if_fail (employee);
 
-  gnc_combo_cell_clear_menu (cell);
-  gnc_combo_cell_add_menu_item (cell, _("Cash"));
+    gnc_combo_cell_clear_menu (cell);
+    gnc_combo_cell_add_menu_item (cell, _("Cash"));
 
-  if (gncEmployeeGetCCard (employee))
-    gnc_combo_cell_add_menu_item (cell, _("Charge"));
+    if (gncEmployeeGetCCard (employee))
+        gnc_combo_cell_add_menu_item (cell, _("Charge"));
 }
 
 /* ==================================================================== */
@@ -128,47 +135,47 @@
 static gboolean
 skip_expense_acct_cb (Account *account, gpointer user_data)
 {
-  GNCAccountType type;
+    GNCAccountType type;
 
-  /* Don't add A/R, A/P, Bank, Cash, or Equity accounts */
-  type = xaccAccountGetType (account);
-  if (type == ACCT_TYPE_PAYABLE || type == ACCT_TYPE_RECEIVABLE ||
-      type == ACCT_TYPE_CASH || type == ACCT_TYPE_BANK ||
-      type == ACCT_TYPE_EQUITY || type == ACCT_TYPE_TRADING)
-  {
-    return TRUE;
-  }
+    /* Don't add A/R, A/P, Bank, Cash, or Equity accounts */
+    type = xaccAccountGetType (account);
+    if (type == ACCT_TYPE_PAYABLE || type == ACCT_TYPE_RECEIVABLE ||
+            type == ACCT_TYPE_CASH || type == ACCT_TYPE_BANK ||
+            type == ACCT_TYPE_EQUITY || type == ACCT_TYPE_TRADING)
+    {
+        return TRUE;
+    }
 
-  /* If this is an ORDER or INVOICE, then leave out the expenses.  */
-  if (type == ACCT_TYPE_EXPENSE) return TRUE;
+    /* If this is an ORDER or INVOICE, then leave out the expenses.  */
+    if (type == ACCT_TYPE_EXPENSE) return TRUE;
 
-  /* Don't add placeholder accounts */
-  if (xaccAccountGetPlaceholder (account)) return TRUE;
+    /* Don't add placeholder accounts */
+    if (xaccAccountGetPlaceholder (account)) return TRUE;
 
-  return FALSE;
+    return FALSE;
 }
 
 static gboolean
 skip_income_acct_cb (Account *account, gpointer user_data)
 {
-  GNCAccountType type;
+    GNCAccountType type;
 
-  /* Don't add A/R, A/P, Bank, Cash, or Equity accounts */
-  type = xaccAccountGetType (account);
-  if (type == ACCT_TYPE_PAYABLE || type == ACCT_TYPE_RECEIVABLE ||
-      type == ACCT_TYPE_CASH || type == ACCT_TYPE_BANK ||
-      type == ACCT_TYPE_EQUITY || type == ACCT_TYPE_TRADING)
-  {
-    return TRUE;
-  }
+    /* Don't add A/R, A/P, Bank, Cash, or Equity accounts */
+    type = xaccAccountGetType (account);
+    if (type == ACCT_TYPE_PAYABLE || type == ACCT_TYPE_RECEIVABLE ||
+            type == ACCT_TYPE_CASH || type == ACCT_TYPE_BANK ||
+            type == ACCT_TYPE_EQUITY || type == ACCT_TYPE_TRADING)
+    {
+        return TRUE;
+    }
 
-  /* If this is a BILL, then leave out the incomes */
-  if (type == ACCT_TYPE_INCOME) return TRUE;
+    /* If this is a BILL, then leave out the incomes */
+    if (type == ACCT_TYPE_INCOME) return TRUE;
 
-  /* Don't add placeholder accounts */
-  if (xaccAccountGetPlaceholder (account)) return TRUE;
+    /* Don't add placeholder accounts */
+    if (xaccAccountGetPlaceholder (account)) return TRUE;
 
-  return FALSE;
+    return FALSE;
 }
 
 /* ===================================================================== */
@@ -177,95 +184,96 @@
 #define EKEY "Expense Business entry quickfill"
 #define IKEY "Income Business entry quickfill"
 
-static void 
+static void
 load_xfer_type_cells (GncEntryLedger *ledger)
 {
-  Account *root;
-  ComboCell *cell;
-  QuickFill *qf=NULL;
-  GtkListStore *store = NULL;
+    Account *root;
+    ComboCell *cell;
+    QuickFill *qf = NULL;
+    GtkListStore *store = NULL;
 
-  root = gnc_book_get_root_account (ledger->book);
-  if (root == NULL) return;
+    root = gnc_book_get_root_account (ledger->book);
+    if (root == NULL) return;
 
-  /* Use a common, shared quickfill.  For the ORDER or INVOICE, 
-   * ledgers, we don't want expense-type accounts in the menu.
-   * For BILL, etc. then leave out the income types.
-   */
-  switch (ledger->type) 
-  {
+    /* Use a common, shared quickfill.  For the ORDER or INVOICE,
+     * ledgers, we don't want expense-type accounts in the menu.
+     * For BILL, etc. then leave out the income types.
+     */
+    switch (ledger->type)
+    {
     case GNCENTRY_ORDER_ENTRY:
     case GNCENTRY_ORDER_VIEWER:
     case GNCENTRY_INVOICE_ENTRY:
     case GNCENTRY_INVOICE_VIEWER:
-      qf = gnc_get_shared_account_name_quickfill (root, IKEY, 
-                                      skip_expense_acct_cb, NULL);
-      store = gnc_get_shared_account_name_list_store (root, IKEY,
-						      skip_expense_acct_cb, NULL);
-      break;
+        qf = gnc_get_shared_account_name_quickfill (root, IKEY,
+                skip_expense_acct_cb, NULL);
+        store = gnc_get_shared_account_name_list_store (root, IKEY,
+                skip_expense_acct_cb, NULL);
+        break;
 
     case GNCENTRY_BILL_ENTRY:
     case GNCENTRY_BILL_VIEWER:
     case GNCENTRY_EXPVOUCHER_ENTRY:
     case GNCENTRY_EXPVOUCHER_VIEWER:
     case GNCENTRY_NUM_REGISTER_TYPES:
-      qf = gnc_get_shared_account_name_quickfill (root, EKEY, 
-                                      skip_income_acct_cb, NULL);
-      store = gnc_get_shared_account_name_list_store (root, EKEY,
-						      skip_income_acct_cb, NULL);
-      break;
-  }
+        qf = gnc_get_shared_account_name_quickfill (root, EKEY,
+                skip_income_acct_cb, NULL);
+        store = gnc_get_shared_account_name_list_store (root, EKEY,
+                skip_income_acct_cb, NULL);
+        break;
+    }
 
-  cell = (ComboCell *)
-    gnc_table_layout_get_cell (ledger->table->layout, ENTRY_IACCT_CELL);
-  gnc_combo_cell_use_quickfill_cache (cell, qf);
-  gnc_combo_cell_use_list_store_cache (cell, store);
+    cell = (ComboCell *)
+           gnc_table_layout_get_cell (ledger->table->layout, ENTRY_IACCT_CELL);
+    gnc_combo_cell_use_quickfill_cache (cell, qf);
+    gnc_combo_cell_use_list_store_cache (cell, store);
 
-  cell = (ComboCell *)
-    gnc_table_layout_get_cell (ledger->table->layout, ENTRY_BACCT_CELL);
-  gnc_combo_cell_use_quickfill_cache (cell, qf);
-  gnc_combo_cell_use_list_store_cache (cell, store);
+    cell = (ComboCell *)
+           gnc_table_layout_get_cell (ledger->table->layout, ENTRY_BACCT_CELL);
+    gnc_combo_cell_use_quickfill_cache (cell, qf);
+    gnc_combo_cell_use_list_store_cache (cell, store);
 }
 
 /* ===================================================================== */
 
 static void load_taxtable_type_cells (GncEntryLedger *ledger)
 {
-  GList *list;
-  ComboCell *cell;
+    GList *list;
+    ComboCell *cell;
 
-  cell = (ComboCell *)
-    gnc_table_layout_get_cell (ledger->table->layout, ENTRY_TAXTABLE_CELL);
-  gnc_combo_cell_clear_menu (cell);
-  
-  list = gncTaxTableGetTables (ledger->book);
-  for ( ; list ; list = list->next ) {
-    GncTaxTable *table = list->data;
-    const char *name = gncTaxTableGetName (table);
-    if (name != NULL)
-      gnc_combo_cell_add_menu_item (cell, (char*)name);
-  }
+    cell = (ComboCell *)
+           gnc_table_layout_get_cell (ledger->table->layout, ENTRY_TAXTABLE_CELL);
+    gnc_combo_cell_clear_menu (cell);
+
+    list = gncTaxTableGetTables (ledger->book);
+    for ( ; list ; list = list->next )
+    {
+        GncTaxTable *table = list->data;
+        const char *name = gncTaxTableGetName (table);
+        if (name != NULL)
+            gnc_combo_cell_add_menu_item (cell, (char*)name);
+    }
 }
 
 static void
 gnc_entry_ledger_show_entry (GncEntryLedger *ledger,
-			     VirtualCellLocation start_loc)
+                             VirtualCellLocation start_loc)
 {
-  VirtualCellLocation end_loc;
-  int v_row;
+    VirtualCellLocation end_loc;
+    int v_row;
 
-  end_loc = start_loc;
-  v_row = end_loc.virt_row + 1;
-  end_loc.virt_row = MIN (v_row, ledger->table->num_virt_rows - 1);
+    end_loc = start_loc;
+    v_row = end_loc.virt_row + 1;
+    end_loc.virt_row = MIN (v_row, ledger->table->num_virt_rows - 1);
 
-  gnc_table_show_range (ledger->table, start_loc, end_loc);
+    gnc_table_show_range (ledger->table, start_loc, end_loc);
 }
 
 void gnc_entry_ledger_load_xfer_cells (GncEntryLedger *ledger)
 {
-  load_xfer_type_cells (ledger);
-  load_taxtable_type_cells (ledger);
-  load_payment_type_cells (ledger);
+    load_xfer_type_cells (ledger);
+    load_taxtable_type_cells (ledger);
+    load_payment_type_cells (ledger);
 }
 
 /* XXX (FIXME): This should be in a config file! */
@@ -276,265 +284,284 @@
  */
 void gnc_entry_ledger_load (GncEntryLedger *ledger, GList *entry_list)
 {
-  GncEntry *blank_entry, *find_entry;
-  CursorBuffer *cursor_buffer;
-  Table *table;
+    GncEntry *blank_entry, *find_entry;
+    CursorBuffer *cursor_buffer;
+    Table *table;
 
-  GList *node;
-  CellBlock *cursor_header, *cursor;
-  VirtualCellLocation vcell_loc;
-  VirtualLocation save_loc;
-  time_t present;
-  gboolean start_primary_color = TRUE;
+    GList *node;
+    CellBlock *cursor_header, *cursor;
+    VirtualCellLocation vcell_loc;
+    VirtualLocation save_loc;
+    time_t present;
+    gboolean start_primary_color = TRUE;
 
-  int new_entry_row = -1;
+    int new_entry_row = -1;
 
-  if (!ledger) return;
+    if (!ledger) return;
 
-  /* Load up cells */
-  load_discount_type_cells (ledger);
-  load_discount_how_cells (ledger);
-  gnc_entry_ledger_load_xfer_cells (ledger);
+    /* Load up cells */
+    load_discount_type_cells (ledger);
+    load_discount_how_cells (ledger);
+    gnc_entry_ledger_load_xfer_cells (ledger);
 
-  blank_entry = gnc_entry_ledger_get_blank_entry (ledger);
+    blank_entry = gnc_entry_ledger_get_blank_entry (ledger);
 
-  if (blank_entry == NULL && ledger->invoice == NULL && entry_list == NULL)
-    return;
+    if (blank_entry == NULL && ledger->invoice == NULL && entry_list == NULL)
+        return;
 
-  if (blank_entry == NULL && ledger->invoice) {
-    switch (ledger->type) {
-    case GNCENTRY_ORDER_ENTRY:
-    case GNCENTRY_INVOICE_ENTRY:
-    case GNCENTRY_BILL_ENTRY:
-    case GNCENTRY_EXPVOUCHER_ENTRY:
+    if (blank_entry == NULL && ledger->invoice)
+    {
+        switch (ledger->type)
+        {
+        case GNCENTRY_ORDER_ENTRY:
+        case GNCENTRY_INVOICE_ENTRY:
+        case GNCENTRY_BILL_ENTRY:
+        case GNCENTRY_EXPVOUCHER_ENTRY:
 
-      gnc_suspend_gui_refresh ();
+            gnc_suspend_gui_refresh ();
 
-      blank_entry = gncEntryCreate (ledger->book);
-      gncEntrySetDate (blank_entry, ledger->last_date_entered);
-      ledger->blank_entry_guid = *gncEntryGetGUID (blank_entry);
+            blank_entry = gncEntryCreate (ledger->book);
+            gncEntrySetDate (blank_entry, ledger->last_date_entered);
+            ledger->blank_entry_guid = *gncEntryGetGUID (blank_entry);
 
-      gnc_resume_gui_refresh ();
+            gnc_resume_gui_refresh ();
 
-      /* The rest of this does not apply to expense vouchers */
-      if (ledger->type != GNCENTRY_EXPVOUCHER_ENTRY)
-      {
-	GncOwner *owner = gncInvoiceGetOwner (ledger->invoice);
-	GncTaxTable *table = NULL;
-	GncTaxIncluded taxincluded_p = GNC_TAXINCLUDED_USEGLOBAL;
-	gboolean taxincluded = FALSE;
-	gnc_numeric discount = gnc_numeric_zero ();
-	GNCOptionDB *odb;
+            /* The rest of this does not apply to expense vouchers */
+            if (ledger->type != GNCENTRY_EXPVOUCHER_ENTRY)
+            {
+                GncOwner *owner = gncInvoiceGetOwner (ledger->invoice);
+                GncTaxTable *table = NULL;
+                GncTaxIncluded taxincluded_p = GNC_TAXINCLUDED_USEGLOBAL;
+                gboolean taxincluded = FALSE;
+                gnc_numeric discount = gnc_numeric_zero ();
+                GNCOptionDB *odb;
 
-	/* Determine the TaxIncluded and Discount values */
-	owner = gncOwnerGetEndOwner (owner);
-	switch (gncOwnerGetType (owner)) {
-	case GNC_OWNER_CUSTOMER:
-	  taxincluded_p = gncCustomerGetTaxIncluded (owner->owner.customer);
-	  discount = gncCustomerGetDiscount (owner->owner.customer);
-	  break;
-	case GNC_OWNER_VENDOR:
-	  taxincluded_p = gncVendorGetTaxIncluded (owner->owner.vendor);
-	  break;
-	default:
-	  break;
-	}
+                /* Determine the TaxIncluded and Discount values */
+                owner = gncOwnerGetEndOwner (owner);
+                switch (gncOwnerGetType (owner))
+                {
+                case GNC_OWNER_CUSTOMER:
+                    taxincluded_p = gncCustomerGetTaxIncluded (owner->owner.customer);
+                    discount = gncCustomerGetDiscount (owner->owner.customer);
+                    break;
+                case GNC_OWNER_VENDOR:
+                    taxincluded_p = gncVendorGetTaxIncluded (owner->owner.vendor);
+                    break;
+                default:
+                    break;
+                }
 
-	/* Compute the default taxincluded */
-	switch (taxincluded_p) {
-	case GNC_TAXINCLUDED_YES:
-	  taxincluded = TRUE;
-	  break;
-	case GNC_TAXINCLUDED_NO:
-	  taxincluded = FALSE;
-	  break;
-	case GNC_TAXINCLUDED_USEGLOBAL:
-	  if (ledger->gconf_section) {
-	    taxincluded = gnc_gconf_get_bool(ledger->gconf_section, "tax_included", NULL);
-	  } else {
-	    taxincluded = FALSE;
-	  }
-	  break;
-	}
+                /* Compute the default taxincluded */
+                switch (taxincluded_p)
+                {
+                case GNC_TAXINCLUDED_YES:
+                    taxincluded = TRUE;
+                    break;
+                case GNC_TAXINCLUDED_NO:
+                    taxincluded = FALSE;
+                    break;
+                case GNC_TAXINCLUDED_USEGLOBAL:
+                    if (ledger->gconf_section)
+                    {
+                        taxincluded = gnc_gconf_get_bool(ledger->gconf_section, "tax_included", NULL);
+                    }
+                    else
+                    {
+                        taxincluded = FALSE;
+                    }
+                    break;
+                }
 
-	/* Compute the proper taxtable */
-	odb = gnc_option_db_new_for_type (GNC_ID_BOOK);
-	gnc_option_db_load_from_kvp (odb, gnc_book_get_slots (ledger->book));
+                /* Compute the proper taxtable */
+                odb = gnc_option_db_new_for_type (GNC_ID_BOOK);
+                gnc_option_db_load_from_kvp (odb, gnc_book_get_slots (ledger->book));
 
-	switch (gncOwnerGetType (owner)) {
-	case GNC_OWNER_CUSTOMER:
-	  table = gnc_option_db_lookup_taxtable_option (odb,
-							"Business",
-							"Default Customer TaxTable",
-							NULL);
+                switch (gncOwnerGetType (owner))
+                {
+                case GNC_OWNER_CUSTOMER:
+                    table = gnc_option_db_lookup_taxtable_option (odb,
+                            "Business",
+                            "Default Customer TaxTable",
+                            NULL);
 
-	  if (gncCustomerGetTaxTableOverride (owner->owner.customer))
-	    table = gncCustomerGetTaxTable (owner->owner.customer);
-	  break;
+                    if (gncCustomerGetTaxTableOverride (owner->owner.customer))
+                        table = gncCustomerGetTaxTable (owner->owner.customer);
+                    break;
 
-	case GNC_OWNER_VENDOR:
-	  table = gnc_option_db_lookup_taxtable_option (odb,
-							"Business",
-							"Default Vendor TaxTable",
-							NULL);
+                case GNC_OWNER_VENDOR:
+                    table = gnc_option_db_lookup_taxtable_option (odb,
+                            "Business",
+                            "Default Vendor TaxTable",
+                            NULL);
 
-	  if (gncVendorGetTaxTableOverride (owner->owner.vendor))
-	    table = gncVendorGetTaxTable (owner->owner.vendor);
-	  break;
+                    if (gncVendorGetTaxTableOverride (owner->owner.vendor))
+                        table = gncVendorGetTaxTable (owner->owner.vendor);
+                    break;
 
-	default:
-	  break;
-	}
+                default:
+                    break;
+                }
 
-	gnc_option_db_destroy (odb);
+                gnc_option_db_destroy (odb);
 
-	if (ledger->is_invoice) {
-	  gncEntrySetInvTaxTable (blank_entry, table);
-	  gncEntrySetInvTaxIncluded (blank_entry, taxincluded);
-	  gncEntrySetInvDiscount (blank_entry, discount);
-	} else {
-	  gncEntrySetBillTaxTable (blank_entry, table);
-	  gncEntrySetBillTaxIncluded (blank_entry, taxincluded);
-	}
-      }
+                if (ledger->is_invoice)
+                {
+                    gncEntrySetInvTaxTable (blank_entry, table);
+                    gncEntrySetInvTaxIncluded (blank_entry, taxincluded);
+                    gncEntrySetInvDiscount (blank_entry, discount);
+                }
+                else
+                {
+                    gncEntrySetBillTaxTable (blank_entry, table);
+                    gncEntrySetBillTaxIncluded (blank_entry, taxincluded);
+                }
+            }
 
-      break;
-    default:
-      ledger->blank_entry_guid = *xaccGUIDNULL ();
-      break;
+            break;
+        default:
+            ledger->blank_entry_guid = *xaccGUIDNULL ();
+            break;
+        }
+        ledger->blank_entry_edited = FALSE;
     }
-    ledger->blank_entry_edited = FALSE;
-  }
 
-  table = ledger->table;
+    table = ledger->table;
 
-  gnc_table_leave_update (table, table->current_cursor_loc);
-  save_loc = table->current_cursor_loc;
+    gnc_table_leave_update (table, table->current_cursor_loc);
+    save_loc = table->current_cursor_loc;
 
-  /* Figure out where we are going to */
-  if (ledger->traverse_to_new) {
-    find_entry = blank_entry;
-  } else if (ledger->hint_entry) {
-    find_entry = ledger->hint_entry;
-  } else {
-    find_entry = gnc_entry_ledger_get_current_entry(ledger);
-		/* XXX: get current entry (cursor_hint_xxx) */
-  }
+    /* Figure out where we are going to */
+    if (ledger->traverse_to_new)
+    {
+        find_entry = blank_entry;
+    }
+    else if (ledger->hint_entry)
+    {
+        find_entry = ledger->hint_entry;
+    }
+    else
+    {
+        find_entry = gnc_entry_ledger_get_current_entry(ledger);
+        /* XXX: get current entry (cursor_hint_xxx) */
+    }
 
-  /* If the current cursor has changed we save the values for later
-   * possible restoration. */
-  if (gnc_table_current_cursor_changed (table, TRUE) &&
-      (find_entry == gnc_entry_ledger_get_current_entry (ledger)))
-  {
-    cursor_buffer = gnc_cursor_buffer_new ();
-    gnc_table_save_current_cursor (table, cursor_buffer);
-  }
-  else
-    cursor_buffer = NULL;
+    /* If the current cursor has changed we save the values for later
+     * possible restoration. */
+    if (gnc_table_current_cursor_changed (table, TRUE) &&
+            (find_entry == gnc_entry_ledger_get_current_entry (ledger)))
+    {
+        cursor_buffer = gnc_cursor_buffer_new ();
+        gnc_table_save_current_cursor (table, cursor_buffer);
+    }
+    else
+        cursor_buffer = NULL;
 
-  /* disable move callback -- we don't want the cascade of 
-   * callbacks while we are fiddling with loading the register */
-  gnc_table_control_allow_move (table->control, FALSE);
+    /* disable move callback -- we don't want the cascade of
+     * callbacks while we are fiddling with loading the register */
+    gnc_table_control_allow_move (table->control, FALSE);
 
-  /* invalidate the cursor */
-  {
-    VirtualLocation virt_loc;
+    /* invalidate the cursor */
+    {
+        VirtualLocation virt_loc;
 
-    virt_loc.vcell_loc.virt_row = -1;
-    virt_loc.vcell_loc.virt_col = -1;
-    virt_loc.phys_row_offset = -1;
-    virt_loc.phys_col_offset = -1;
+        virt_loc.vcell_loc.virt_row = -1;
+        virt_loc.vcell_loc.virt_col = -1;
+        virt_loc.phys_row_offset = -1;
+        virt_loc.phys_col_offset = -1;
 
-    gnc_table_move_cursor_gui (table, virt_loc);
-  }
+        gnc_table_move_cursor_gui (table, virt_loc);
+    }
 
-  /* make sure that the header is loaded */
-  vcell_loc.virt_row = 0;
-  vcell_loc.virt_col = 0;
-  cursor_header = gnc_table_layout_get_cursor (table->layout, CURSOR_HEADER);
-  gnc_table_set_vcell (table, cursor_header, NULL, TRUE, TRUE, vcell_loc);
-  vcell_loc.virt_row++;
+    /* make sure that the header is loaded */
+    vcell_loc.virt_row = 0;
+    vcell_loc.virt_col = 0;
+    cursor_header = gnc_table_layout_get_cursor (table->layout, CURSOR_HEADER);
+    gnc_table_set_vcell (table, cursor_header, NULL, TRUE, TRUE, vcell_loc);
+    vcell_loc.virt_row++;
 
-  /* get the current time and reset the dividing row */
-  present = gnc_timet_get_today_end ();
-  table->model->dividing_row = -1;
-  cursor = gnc_table_layout_get_cursor (table->layout, "cursor");
+    /* get the current time and reset the dividing row */
+    present = gnc_timet_get_today_end ();
+    table->model->dividing_row = -1;
+    cursor = gnc_table_layout_get_cursor (table->layout, "cursor");
 
-  /* Populate the table */
-  for (node = entry_list; node; node = node->next) {
-    GncEntry *entry = node->data;
+    /* Populate the table */
+    for (node = entry_list; node; node = node->next)
+    {
+        GncEntry *entry = node->data;
 
-    /* Don't load the blank entry */
-    if (entry == blank_entry)
-      continue;
+        /* Don't load the blank entry */
+        if (entry == blank_entry)
+            continue;
 
-    /* If this is the first load of the ledger, fill the quickfill cells */
-    {
-      /* XXX */
-    }
+        /* If this is the first load of the ledger, fill the quickfill cells */
+        {
+            /* XXX */
+        }
 
-    if (entry == find_entry)
-      new_entry_row = vcell_loc.virt_row;
+        if (entry == find_entry)
+            new_entry_row = vcell_loc.virt_row;
 
-    gnc_table_set_vcell (table, cursor, gncEntryGetGUID (entry),
-			 TRUE, start_primary_color, vcell_loc);
-    vcell_loc.virt_row++;
+        gnc_table_set_vcell (table, cursor, gncEntryGetGUID (entry),
+                             TRUE, start_primary_color, vcell_loc);
+        vcell_loc.virt_row++;
 
-    /* Flip color for the next guy */
-    start_primary_color = !start_primary_color;
-  }
+        /* Flip color for the next guy */
+        start_primary_color = !start_primary_color;
+    }
 
-  /* Add the blank entry at the end. */
-  if (blank_entry) {
-    gnc_table_set_vcell (table, cursor, gncEntryGetGUID (blank_entry),
-			 TRUE, start_primary_color, vcell_loc);
+    /* Add the blank entry at the end. */
+    if (blank_entry)
+    {
+        gnc_table_set_vcell (table, cursor, gncEntryGetGUID (blank_entry),
+                             TRUE, start_primary_color, vcell_loc);
 
-    if (find_entry == blank_entry)
-      new_entry_row = vcell_loc.virt_row;
+        if (find_entry == blank_entry)
+            new_entry_row = vcell_loc.virt_row;
 
-    vcell_loc.virt_row++;
-  }
+        vcell_loc.virt_row++;
+    }
 
-  /* Resize the table */
-  gnc_table_set_size (table, vcell_loc.virt_row, 1);
+    /* Resize the table */
+    gnc_table_set_size (table, vcell_loc.virt_row, 1);
 
-  /* Restore the cursor to its rightful position */
-  if (new_entry_row > 0)
-    save_loc.vcell_loc.virt_row = new_entry_row;
+    /* Restore the cursor to its rightful position */
+    if (new_entry_row > 0)
+        save_loc.vcell_loc.virt_row = new_entry_row;
 
-  if (gnc_table_find_close_valid_cell (table, &save_loc, FALSE)) {
-    gnc_table_move_cursor_gui (table, save_loc);
+    if (gnc_table_find_close_valid_cell (table, &save_loc, FALSE))
+    {
+        gnc_table_move_cursor_gui (table, save_loc);
 
-    if (find_entry == gnc_entry_ledger_get_current_entry (ledger))
-      gnc_table_restore_current_cursor (table, cursor_buffer);
-  }
+        if (find_entry == gnc_entry_ledger_get_current_entry (ledger))
+            gnc_table_restore_current_cursor (table, cursor_buffer);
+    }
 
-  gnc_cursor_buffer_destroy (cursor_buffer);
-  cursor_buffer = NULL;
+    gnc_cursor_buffer_destroy (cursor_buffer);
+    cursor_buffer = NULL;
 
-  /* Reset the ledger */
-  ledger->traverse_to_new = FALSE;
-  ledger->hint_entry = NULL;
+    /* Reset the ledger */
+    ledger->traverse_to_new = FALSE;
+    ledger->hint_entry = NULL;
 
-  /* Set the cell fractions */
+    /* Set the cell fractions */
 
 
-  gnc_table_refresh_gui (table, TRUE);
-  gnc_entry_ledger_show_entry (ledger, table->current_cursor_loc.vcell_loc);
+    gnc_table_refresh_gui (table, TRUE);
+    gnc_entry_ledger_show_entry (ledger, table->current_cursor_loc.vcell_loc);
 
-  /* Set completion character */
-  gnc_combo_cell_set_complete_char
+    /* Set completion character */
+    gnc_combo_cell_set_complete_char
     ((ComboCell *)
      gnc_table_layout_get_cell (table->layout, ENTRY_IACCT_CELL),
      gnc_get_account_separator ());
 
-  gnc_combo_cell_set_complete_char
+    gnc_combo_cell_set_complete_char
     ((ComboCell *)
      gnc_table_layout_get_cell (table->layout, ENTRY_BACCT_CELL),
      gnc_get_account_separator ());
 
-  /* enable callback for cursor user-driven moves */
-  gnc_table_control_allow_move (table->control, TRUE);
+    /* enable callback for cursor user-driven moves */
+    gnc_table_control_allow_move (table->control, TRUE);
 }
 
 /* =========================== END OF FILE ========================== */

Modified: gnucash/trunk/src/business/business-ledger/gncEntryLedgerModel.c
===================================================================
--- gnucash/trunk/src/business/business-ledger/gncEntryLedgerModel.c	2010-03-02 21:40:28 UTC (rev 18788)
+++ gnucash/trunk/src/business/business-ledger/gncEntryLedgerModel.c	2010-03-02 21:41:05 UTC (rev 18789)
@@ -38,12 +38,12 @@
 
 static GncEntryLedgerColors reg_colors =
 {
-  0x96B183,
-  0xBFDEB9,
-  0xF6FFDA,
+    0x96B183,
+    0xBFDEB9,
+    0xF6FFDA,
 
-  0xFFEF98,
-  0xFFEF98,
+    0xFFEF98,
+    0xFFEF98,
 };
 
 /** Private Interfaces ***********************************************/
@@ -52,405 +52,417 @@
 
 static const char * get_iacct_label (VirtualLocation virt_loc, gpointer data)
 {
-  return _("Income Account");
+    return _("Income Account");
 }
 
 static const char * get_bacct_label (VirtualLocation virt_loc, gpointer data)
 {
-  return _("Expense Account");
+    return _("Expense Account");
 }
 
 static const char * get_actn_label (VirtualLocation virt_loc, gpointer data)
 {
-  return _("Action");
+    return _("Action");
 }
 
 static const char * get_date_label (VirtualLocation virt_loc, gpointer data)
 {
-  return _("Date");
+    return _("Date");
 }
 
 static const char * get_desc_label (VirtualLocation virt_loc, gpointer data)
 {
-  return _("Description");
+    return _("Description");
 }
 
 static const char * get_disc_label (VirtualLocation virt_loc, gpointer data)
 {
-  return _("Discount");
+    return _("Discount");
 }
 
 static const char * get_distype_label (VirtualLocation virt_loc, gpointer data)
 {
-  return _("Discount Type");
+    return _("Discount Type");
 }
 
 static const char * get_dishow_label (VirtualLocation virt_loc, gpointer data)
 {
-  return _("Discount How");
+    return _("Discount How");
 }
 
 static const char * get_pric_label (VirtualLocation virt_loc, gpointer data)
 {
-  return _("Unit Price");
+    return _("Unit Price");
 }
 
 static const char * get_qty_label (VirtualLocation virt_loc, gpointer data)
 {
-  return _("Quantity");
+    return _("Quantity");
 }
 
 static const char * get_taxtable_label (VirtualLocation virt_loc, gpointer data)
 {
-  return _("Tax Table");
+    return _("Tax Table");
 }
 
 static const char * get_taxable_label (VirtualLocation virt_loc, gpointer data)
 {
-  return _("Taxable?");
+    return _("Taxable?");
 }
 
 static const char * get_taxincluded_label (VirtualLocation virt_loc, gpointer data)
 {
-  return _("Tax Included?");
+    return _("Tax Included?");
 }
 
 static const char * get_inv_label (VirtualLocation virt_loc, gpointer data)
 {
-  return _("Invoiced?");
+    return _("Invoiced?");
 }
 
 static const char * get_value_label (VirtualLocation virt_loc, gpointer data)
 {
-  return _("Subtotal");
+    return _("Subtotal");
 }
 
 static const char * get_taxval_label (VirtualLocation virt_loc, gpointer data)
 {
-  return _("Tax");
+    return _("Tax");
 }
 
 static const char * get_billable_label (VirtualLocation virt_loc, gpointer data)
 {
-  return _("Billable?");
+    return _("Billable?");
 }
 
 static const char * get_payment_label (VirtualLocation virt_loc, gpointer data)
 {
-  return _("Payment");
+    return _("Payment");
 }
 
 /* GET_ENTRY */
 
 static const char * get_iacct_entry (VirtualLocation virt_loc,
-				    gboolean translate,
-				    gboolean *conditionally_changed,
-				    gpointer user_data)
+                                     gboolean translate,
+                                     gboolean *conditionally_changed,
+                                     gpointer user_data)
 {
-  static char *name = NULL;
+    static char *name = NULL;
 
-  GncEntryLedger *ledger = user_data;
-  GncEntry *entry;
+    GncEntryLedger *ledger = user_data;
+    GncEntry *entry;
 
-  entry = gnc_entry_ledger_get_entry (ledger, virt_loc.vcell_loc);
+    entry = gnc_entry_ledger_get_entry (ledger, virt_loc.vcell_loc);
 
-  g_free (name);
-  name = gnc_get_account_name_for_register (gncEntryGetInvAccount (entry));
-  return name;
+    g_free (name);
+    name = gnc_get_account_name_for_register (gncEntryGetInvAccount (entry));
+    return name;
 }
 
 static const char * get_bacct_entry (VirtualLocation virt_loc,
-				    gboolean translate,
-				    gboolean *conditionally_changed,
-				    gpointer user_data)
+                                     gboolean translate,
+                                     gboolean *conditionally_changed,
+                                     gpointer user_data)
 {
-  static char *name = NULL;
+    static char *name = NULL;
 
-  GncEntryLedger *ledger = user_data;
-  GncEntry *entry;
+    GncEntryLedger *ledger = user_data;
+    GncEntry *entry;
 
-  entry = gnc_entry_ledger_get_entry (ledger, virt_loc.vcell_loc);
+    entry = gnc_entry_ledger_get_entry (ledger, virt_loc.vcell_loc);
 
-  g_free (name);
-  name = gnc_get_account_name_for_register (gncEntryGetBillAccount (entry));
-  return name;
+    g_free (name);
+    name = gnc_get_account_name_for_register (gncEntryGetBillAccount (entry));
+    return name;
 }
 
 static const char * get_actn_entry (VirtualLocation virt_loc,
-				    gboolean translate,
-				    gboolean *conditionally_changed,
-				    gpointer user_data)
+                                    gboolean translate,
+                                    gboolean *conditionally_changed,
+                                    gpointer user_data)
 {
-  GncEntryLedger *ledger = user_data;
-  GncEntry *entry;
+    GncEntryLedger *ledger = user_data;
+    GncEntry *entry;
 
-  entry = gnc_entry_ledger_get_entry (ledger, virt_loc.vcell_loc);
-  return gncEntryGetAction  (entry);
+    entry = gnc_entry_ledger_get_entry (ledger, virt_loc.vcell_loc);
+    return gncEntryGetAction  (entry);
 }
 
 static const char * get_date_entry (VirtualLocation virt_loc,
-				    gboolean translate,
-				    gboolean *conditionally_changed,
-				    gpointer user_data)
+                                    gboolean translate,
+                                    gboolean *conditionally_changed,
+                                    gpointer user_data)
 {
-  GncEntryLedger *ledger = user_data;
-  GncEntry *entry;
-  Timespec ts;
+    GncEntryLedger *ledger = user_data;
+    GncEntry *entry;
+    Timespec ts;
 
-  entry = gnc_entry_ledger_get_entry (ledger, virt_loc.vcell_loc);
+    entry = gnc_entry_ledger_get_entry (ledger, virt_loc.vcell_loc);
 
-  ts = gncEntryGetDate (entry);
-  return gnc_print_date (ts);
+    ts = gncEntryGetDate (entry);
+    return gnc_print_date (ts);
 }
 
 static const char * get_desc_entry (VirtualLocation virt_loc,
-				    gboolean translate,
-				    gboolean *conditionally_changed,
-				    gpointer user_data)
+                                    gboolean translate,
+                                    gboolean *conditionally_changed,
+                                    gpointer user_data)
 {
-  GncEntryLedger *ledger = user_data;
-  GncEntry *entry;
+    GncEntryLedger *ledger = user_data;
+    GncEntry *entry;
 
-  entry = gnc_entry_ledger_get_entry (ledger, virt_loc.vcell_loc);
-  return gncEntryGetDescription (entry);
+    entry = gnc_entry_ledger_get_entry (ledger, virt_loc.vcell_loc);
+    return gncEntryGetDescription (entry);
 }
 
 static const char * get_disc_entry (VirtualLocation virt_loc,
-				    gboolean translate,
-				    gboolean *conditionally_changed,
-				    gpointer user_data)
+                                    gboolean translate,
+                                    gboolean *conditionally_changed,
+                                    gpointer user_data)
 {
-  GncEntryLedger *ledger = user_data;
-  GncEntry *entry;
-  gnc_numeric discount;
+    GncEntryLedger *ledger = user_data;
+    GncEntry *entry;
+    gnc_numeric discount;
 
-  entry = gnc_entry_ledger_get_entry (ledger, virt_loc.vcell_loc);
-  discount = gncEntryGetInvDiscount (entry);
-  if (gnc_numeric_zero_p (discount))
-    return NULL;
+    entry = gnc_entry_ledger_get_entry (ledger, virt_loc.vcell_loc);
+    discount = gncEntryGetInvDiscount (entry);
+    if (gnc_numeric_zero_p (discount))
+        return NULL;
 
-  return xaccPrintAmount (discount, gnc_default_print_info (FALSE));
+    return xaccPrintAmount (discount, gnc_default_print_info (FALSE));
 }
 
 static const char * get_distype_entry (VirtualLocation virt_loc,
-				    gboolean translate,
-				    gboolean *conditionally_changed,
-				    gpointer user_data)
+                                       gboolean translate,
+                                       gboolean *conditionally_changed,
+                                       gpointer user_data)
 {
-  GncEntryLedger *ledger = user_data;
-  GncEntry *entry;
-  char type;
+    GncEntryLedger *ledger = user_data;
+    GncEntry *entry;
+    char type;
 
-  entry = gnc_entry_ledger_get_entry (ledger, virt_loc.vcell_loc);
-  type = gncEntryGetInvDiscountType (entry);
+    entry = gnc_entry_ledger_get_entry (ledger, virt_loc.vcell_loc);
+    type = gncEntryGetInvDiscountType (entry);
 
-  if (translate) {
-    return gnc_entry_ledger_type_string_getter (type + '0');
-  } else {
-    static char s[2];
-    s[0] = '0' + type;
-    s[1] = '\0';
-    return s;
-  }
+    if (translate)
+    {
+        return gnc_entry_ledger_type_string_getter (type + '0');
+    }
+    else
+    {
+        static char s[2];
+        s[0] = '0' + type;
+        s[1] = '\0';
+        return s;
+    }
 }
 
 static const char * get_dishow_entry (VirtualLocation virt_loc,
-				    gboolean translate,
-				    gboolean *conditionally_changed,
-				    gpointer user_data)
+                                      gboolean translate,
+                                      gboolean *conditionally_changed,
+                                      gpointer user_data)
 {
-  GncEntryLedger *ledger = user_data;
-  GncEntry *entry;
-  char type;
+    GncEntryLedger *ledger = user_data;
+    GncEntry *entry;
+    char type;
 
-  entry = gnc_entry_ledger_get_entry (ledger, virt_loc.vcell_loc);
-  type = gncEntryGetInvDiscountHow (entry);
+    entry = gnc_entry_ledger_get_entry (ledger, virt_loc.vcell_loc);
+    type = gncEntryGetInvDiscountHow (entry);
 
-  if (translate) {
-    return gnc_entry_ledger_how_string_getter (type + '0');
-  } else {
-    static char s[2];
-    s[0] = '0' + type;
-    s[1] = '\0';
-    return s;
-  }
+    if (translate)
+    {
+        return gnc_entry_ledger_how_string_getter (type + '0');
+    }
+    else
+    {
+        static char s[2];
+        s[0] = '0' + type;
+        s[1] = '\0';
+        return s;
+    }
 }
 
 static const char * get_pric_entry (VirtualLocation virt_loc,
-				    gboolean translate,
-				    gboolean *conditionally_changed,
-				    gpointer user_data)
+                                    gboolean translate,
+                                    gboolean *conditionally_changed,
+                                    gpointer user_data)
 {
-  GncEntryLedger *ledger = user_data;
-  GncEntry *entry;
-  gnc_numeric price;
+    GncEntryLedger *ledger = user_data;
+    GncEntry *entry;
+    gnc_numeric price;
 
-  entry = gnc_entry_ledger_get_entry (ledger, virt_loc.vcell_loc);
-  if (ledger->is_invoice)
-    price = gncEntryGetInvPrice (entry);
-  else
-    price = gncEntryGetBillPrice (entry);
+    entry = gnc_entry_ledger_get_entry (ledger, virt_loc.vcell_loc);
+    if (ledger->is_invoice)
+        price = gncEntryGetInvPrice (entry);
+    else
+        price = gncEntryGetBillPrice (entry);
 
-  if (gnc_numeric_zero_p (price))
-    return NULL;
+    if (gnc_numeric_zero_p (price))
+        return NULL;
 
-  return xaccPrintAmount (price, gnc_default_print_info (FALSE));
+    return xaccPrintAmount (price, gnc_default_print_info (FALSE));
 }
 
 static const char * get_qty_entry (VirtualLocation virt_loc,
-				    gboolean translate,
-				    gboolean *conditionally_changed,
-				    gpointer user_data)
+                                   gboolean translate,
+                                   gboolean *conditionally_changed,
+                                   gpointer user_data)
 {
-  GncEntryLedger *ledger = user_data;
-  GncEntry *entry;
-  gnc_numeric qty;
+    GncEntryLedger *ledger = user_data;
+    GncEntry *entry;
+    gnc_numeric qty;
 
-  entry = gnc_entry_ledger_get_entry (ledger, virt_loc.vcell_loc);
-  qty = gncEntryGetQuantity (entry);
+    entry = gnc_entry_ledger_get_entry (ledger, virt_loc.vcell_loc);
+    qty = gncEntryGetQuantity (entry);
 
-  if (gnc_numeric_zero_p (qty))
-    return NULL;
+    if (gnc_numeric_zero_p (qty))
+        return NULL;
 
-  return xaccPrintAmount (qty, gnc_default_print_info (FALSE));
+    return xaccPrintAmount (qty, gnc_default_print_info (FALSE));
 }
 
 static const char * get_taxable_entry (VirtualLocation virt_loc,
-				    gboolean translate,
-				    gboolean *conditionally_changed,
-				    gpointer user_data)
+                                       gboolean translate,
+                                       gboolean *conditionally_changed,
+                                       gpointer user_data)
 {
-  GncEntryLedger *ledger = user_data;
-  GncEntry *entry;
-  gboolean taxable;
+    GncEntryLedger *ledger = user_data;
+    GncEntry *entry;
+    gboolean taxable;
 
-  entry = gnc_entry_ledger_get_entry (ledger, virt_loc.vcell_loc);
-  if (ledger->is_invoice)
-    taxable = gncEntryGetInvTaxable (entry);
-  else
-    taxable = gncEntryGetBillTaxable (entry);
+    entry = gnc_entry_ledger_get_entry (ledger, virt_loc.vcell_loc);
+    if (ledger->is_invoice)
+        taxable = gncEntryGetInvTaxable (entry);
+    else
+        taxable = gncEntryGetBillTaxable (entry);
 
-  return gnc_checkbox_cell_get_string (taxable);
+    return gnc_checkbox_cell_get_string (taxable);
 }
 
 static gboolean
 gnc_entry_ledger_get_taxable_value (VirtualLocation virt_loc,
-				    gboolean translate,
-				    gboolean *conditionally_changed,
-				    gpointer user_data)
+                                    gboolean translate,
+                                    gboolean *conditionally_changed,
+                                    gpointer user_data)
 {
-  GncEntryLedger *ledger = user_data;
-  gboolean is_current;
+    GncEntryLedger *ledger = user_data;
+    gboolean is_current;
 
-  is_current = virt_cell_loc_equal(ledger->table->current_cursor_loc.vcell_loc,
-				   virt_loc.vcell_loc);
-  if (is_current)
-    return gnc_entry_ledger_get_checkmark (ledger, ENTRY_TAXABLE_CELL);
-  else {
-    const char *valstr =
-      get_taxable_entry (virt_loc, translate, conditionally_changed,
-			 user_data);
-    if (valstr && *valstr == 'X')
-      return TRUE;
-  }
-  return FALSE;
+    is_current = virt_cell_loc_equal(ledger->table->current_cursor_loc.vcell_loc,
+                                     virt_loc.vcell_loc);
+    if (is_current)
+        return gnc_entry_ledger_get_checkmark (ledger, ENTRY_TAXABLE_CELL);
+    else
+    {
+        const char *valstr =
+            get_taxable_entry (virt_loc, translate, conditionally_changed,
+                               user_data);
+        if (valstr && *valstr == 'X')
+            return TRUE;
+    }
+    return FALSE;
 }
 
 static const char * get_taxtable_entry (VirtualLocation virt_loc,
-				    gboolean translate,
-				    gboolean *conditionally_changed,
-				    gpointer user_data)
+                                        gboolean translate,
+                                        gboolean *conditionally_changed,
+                                        gpointer user_data)
 {
-  GncEntryLedger *ledger = user_data;
-  GncEntry *entry;
-  GncTaxTable *table;
-  gboolean taxable;
+    GncEntryLedger *ledger = user_data;
+    GncEntry *entry;
+    GncTaxTable *table;
+    gboolean taxable;
 
-  /* load the cell properly; just shadow the value */
-  if (!conditionally_changed) {
-    taxable = gnc_entry_ledger_get_taxable_value (virt_loc, translate,
-						  conditionally_changed,
-						  user_data);
-    if (!taxable)
-      return NULL;
-  }
+    /* load the cell properly; just shadow the value */
+    if (!conditionally_changed)
+    {
+        taxable = gnc_entry_ledger_get_taxable_value (virt_loc, translate,
+                  conditionally_changed,
+                  user_data);
+        if (!taxable)
+            return NULL;
+    }
 
-  entry = gnc_entry_ledger_get_entry (ledger, virt_loc.vcell_loc);
-  if (ledger->is_invoice)
-    table = gncEntryGetInvTaxTable (entry);
-  else
-    table = gncEntryGetBillTaxTable (entry);
-  
-  return gncTaxTableGetName (table);
+    entry = gnc_entry_ledger_get_entry (ledger, virt_loc.vcell_loc);
+    if (ledger->is_invoice)
+        table = gncEntryGetInvTaxTable (entry);
+    else
+        table = gncEntryGetBillTaxTable (entry);
+
+    return gncTaxTableGetName (table);
 }
 
 static const char * get_taxincluded_entry (VirtualLocation virt_loc,
-				    gboolean translate,
-				    gboolean *conditionally_changed,
-				    gpointer user_data)
+        gboolean translate,
+        gboolean *conditionally_changed,
+        gpointer user_data)
 {
-  GncEntryLedger *ledger = user_data;
-  GncEntry *entry;
-  gboolean taxable, taxincluded;
+    GncEntryLedger *ledger = user_data;
+    GncEntry *entry;
+    gboolean taxable, taxincluded;
 
-  /* load the cell properly; just shadow the value */
-  if (!conditionally_changed) {
-    taxable = gnc_entry_ledger_get_taxable_value (virt_loc, translate,
-						  conditionally_changed,
-						  user_data);
-    if (!taxable)
-      return NULL;
-  }
+    /* load the cell properly; just shadow the value */
+    if (!conditionally_changed)
+    {
+        taxable = gnc_entry_ledger_get_taxable_value (virt_loc, translate,
+                  conditionally_changed,
+                  user_data);
+        if (!taxable)
+            return NULL;
+    }
 
-  entry = gnc_entry_ledger_get_entry (ledger, virt_loc.vcell_loc);
-  if (ledger->is_invoice)
-    taxincluded = gncEntryGetInvTaxIncluded (entry);
-  else
-    taxincluded = gncEntryGetBillTaxIncluded (entry);
+    entry = gnc_entry_ledger_get_entry (ledger, virt_loc.vcell_loc);
+    if (ledger->is_invoice)
+        taxincluded = gncEntryGetInvTaxIncluded (entry);
+    else
+        taxincluded = gncEntryGetBillTaxIncluded (entry);
 
-  return gnc_checkbox_cell_get_string (taxincluded);
+    return gnc_checkbox_cell_get_string (taxincluded);
 }
 
 static const char * get_inv_entry (VirtualLocation virt_loc,
-				    gboolean translate,
-				    gboolean *conditionally_changed,
-				    gpointer user_data)
+                                   gboolean translate,
+                                   gboolean *conditionally_changed,
+                                   gpointer user_data)
 {
-  GncEntryLedger *ledger = user_data;
-  GncEntry *entry;
+    GncEntryLedger *ledger = user_data;
+    GncEntry *entry;
 
-  entry = gnc_entry_ledger_get_entry (ledger, virt_loc.vcell_loc);
+    entry = gnc_entry_ledger_get_entry (ledger, virt_loc.vcell_loc);
 
-  return gnc_checkbox_cell_get_string (gncEntryGetInvoice (entry) != NULL);
+    return gnc_checkbox_cell_get_string (gncEntryGetInvoice (entry) != NULL);
 
-  /* XXX: what if this entry doesn't belong to this invoice?
-   * Or, better question, what if this is the blank_entry on
-   * an invoice page?  For the latter, don't worry about it;
-   * it will be added automatically during the Save operation
-   */
+    /* XXX: what if this entry doesn't belong to this invoice?
+     * Or, better question, what if this is the blank_entry on
+     * an invoice page?  For the latter, don't worry about it;
+     * it will be added automatically during the Save operation
+     */
 }
 
 static const char * get_value_entry (VirtualLocation virt_loc,
-                                      gboolean translate,
-                                      gboolean *conditionally_changed,
-                                      gpointer user_data)
+                                     gboolean translate,
+                                     gboolean *conditionally_changed,
+                                     gpointer user_data)
 {
-  GncEntryLedger *ledger = user_data;
-  gnc_numeric value;
+    GncEntryLedger *ledger = user_data;
+    gnc_numeric value;
 
-  /* Check if this is the current cursor */
-  if (virt_cell_loc_equal (ledger->table->current_cursor_loc.vcell_loc,
-			   virt_loc.vcell_loc)) {
-    gnc_entry_ledger_compute_value (ledger, &value, NULL);
-  } else {
-    GncEntry *entry = gnc_entry_ledger_get_entry (ledger, virt_loc.vcell_loc);
+    /* Check if this is the current cursor */
+    if (virt_cell_loc_equal (ledger->table->current_cursor_loc.vcell_loc,
+                             virt_loc.vcell_loc))
+    {
+        gnc_entry_ledger_compute_value (ledger, &value, NULL);
+    }
+    else
+    {
+        GncEntry *entry = gnc_entry_ledger_get_entry (ledger, virt_loc.vcell_loc);
 
-    if (entry == gnc_entry_ledger_get_blank_entry (ledger))
-      return NULL;
+        if (entry == gnc_entry_ledger_get_blank_entry (ledger))
+            return NULL;
 
-    value = gncEntryReturnValue (entry, ledger->is_invoice);
-  }
-  return xaccPrintAmount (value, gnc_default_print_info (FALSE));
+        value = gncEntryReturnValue (entry, ledger->is_invoice);
+    }
+    return xaccPrintAmount (value, gnc_default_print_info (FALSE));
 }
 
 static const char * get_taxval_entry (VirtualLocation virt_loc,
@@ -458,738 +470,773 @@
                                       gboolean *conditionally_changed,
                                       gpointer user_data)
 {
-  GncEntryLedger *ledger = user_data;
-  gnc_numeric value;
+    GncEntryLedger *ledger = user_data;
+    gnc_numeric value;
 
-  /* Check if this is the current cursor */
-  if (virt_cell_loc_equal (ledger->table->current_cursor_loc.vcell_loc,
-			   virt_loc.vcell_loc)) {
-    gnc_entry_ledger_compute_value (ledger, NULL, &value);
-  } else {
-    GncEntry *entry = gnc_entry_ledger_get_entry (ledger, virt_loc.vcell_loc);
+    /* Check if this is the current cursor */
+    if (virt_cell_loc_equal (ledger->table->current_cursor_loc.vcell_loc,
+                             virt_loc.vcell_loc))
+    {
+        gnc_entry_ledger_compute_value (ledger, NULL, &value);
+    }
+    else
+    {
+        GncEntry *entry = gnc_entry_ledger_get_entry (ledger, virt_loc.vcell_loc);
 
-    if (entry == gnc_entry_ledger_get_blank_entry (ledger))
-      return NULL;
+        if (entry == gnc_entry_ledger_get_blank_entry (ledger))
+            return NULL;
 
-    value = gncEntryReturnTaxValue (entry, ledger->is_invoice);
-  }
+        value = gncEntryReturnTaxValue (entry, ledger->is_invoice);
+    }
 
-  return xaccPrintAmount (value, gnc_default_print_info (FALSE));
+    return xaccPrintAmount (value, gnc_default_print_info (FALSE));
 }
 
 static const char * get_billable_entry (VirtualLocation virt_loc,
-					gboolean translate,
-					gboolean *conditionally_changed,
-					gpointer user_data)
+                                        gboolean translate,
+                                        gboolean *conditionally_changed,
+                                        gpointer user_data)
 {
-  GncEntryLedger *ledger = user_data;
-  GncEntry *entry;
+    GncEntryLedger *ledger = user_data;
+    GncEntry *entry;
 
-  entry = gnc_entry_ledger_get_entry (ledger, virt_loc.vcell_loc);
-  return gnc_checkbox_cell_get_string (gncEntryGetBillable (entry));
+    entry = gnc_entry_ledger_get_entry (ledger, virt_loc.vcell_loc);
+    return gnc_checkbox_cell_get_string (gncEntryGetBillable (entry));
 }
 
 static const char * get_payment_entry (VirtualLocation virt_loc,
-				       gboolean translate,
-				       gboolean *conditionally_changed,
-				       gpointer user_data)
+                                       gboolean translate,
+                                       gboolean *conditionally_changed,
+                                       gpointer user_data)
 {
-  GncEntryLedger *ledger = user_data;
-  GncEntry *entry;
-  GncEntryPaymentType type;
+    GncEntryLedger *ledger = user_data;
+    GncEntry *entry;
+    GncEntryPaymentType type;
 
-  entry = gnc_entry_ledger_get_entry (ledger, virt_loc.vcell_loc);
+    entry = gnc_entry_ledger_get_entry (ledger, virt_loc.vcell_loc);
 
-  if (!entry)
-    return "";
+    if (!entry)
+        return "";
 
-  type = gncEntryGetBillPayment (entry);
+    type = gncEntryGetBillPayment (entry);
 
-  switch (type) {
-  case GNC_PAYMENT_CASH:
-    return _("Cash");
-  case GNC_PAYMENT_CARD:
-    return _("Charge");
-  default:
-    g_warning ("Invalid payment type: %d", type);
-    return "";
-  }
+    switch (type)
+    {
+    case GNC_PAYMENT_CASH:
+        return _("Cash");
+    case GNC_PAYMENT_CARD:
+        return _("Charge");
+    default:
+        g_warning ("Invalid payment type: %d", type);
+        return "";
+    }
 }
 
 /* GET_HELP */
 
 static char * get_acct_help (VirtualLocation virt_loc, gpointer user_data)
 {
-  const char *help;
-  GncEntryLedger *ledger = user_data;
+    const char *help;
+    GncEntryLedger *ledger = user_data;
 
-  help = gnc_table_get_entry (ledger->table, virt_loc);
-  if (!help || *help == '\0')
-    help = _("Enter the income/expense account for the Entry, "
-	     "or choose one from the list");
+    help = gnc_table_get_entry (ledger->table, virt_loc);
+    if (!help || *help == '\0')
+        help = _("Enter the income/expense account for the Entry, "
+                 "or choose one from the list");
 
-  return g_strdup (help);
+    return g_strdup (help);
 }
 
 static char * get_actn_help (VirtualLocation virt_loc, gpointer user_data)
 {
-  GncEntryLedger *ledger = user_data;
-  const char *help;
+    GncEntryLedger *ledger = user_data;
+    const char *help;
 
-  help = gnc_table_get_entry (ledger->table, virt_loc);
-  if (!help || *help == '\0')
-    help = _("Enter the type of Entry");
+    help = gnc_table_get_entry (ledger->table, virt_loc);
+    if (!help || *help == '\0')
+        help = _("Enter the type of Entry");
 
-  return g_strdup (help);
+    return g_strdup (help);
 }
 
 static char * get_date_help (VirtualLocation virt_loc, gpointer user_data)
 {
-  GncEntryLedger *ledger = user_data;
-  BasicCell *cell;
-  char string[1024];
-  struct tm *tm;
-  Timespec ts;
-  time_t tt;
+    GncEntryLedger *ledger = user_data;
+    BasicCell *cell;
+    char string[1024];
+    struct tm *tm;
+    Timespec ts;
+    time_t tt;
 
-  cell = gnc_table_get_cell (ledger->table, virt_loc);
-  if (!cell)
-    return NULL;
+    cell = gnc_table_get_cell (ledger->table, virt_loc);
+    if (!cell)
+        return NULL;
 
-  if (!cell->value || *cell->value == '\0')
-    return NULL;
+    if (!cell->value || *cell->value == '\0')
+        return NULL;
 
-  gnc_date_cell_get_date ((DateCell *) cell, &ts);
-  tt = ts.tv_sec;
-  tm = localtime (&tt);
-  qof_strftime (string, sizeof(string), "%A %d %B %Y", tm);
+    gnc_date_cell_get_date ((DateCell *) cell, &ts);
+    tt = ts.tv_sec;
+    tm = localtime (&tt);
+    qof_strftime (string, sizeof(string), "%A %d %B %Y", tm);
 
-  return g_strdup (string);
+    return g_strdup (string);
 }
 
 static char * get_desc_help (VirtualLocation virt_loc, gpointer user_data)
 {
-  GncEntryLedger *ledger = user_data;
-  const char *help;
+    GncEntryLedger *ledger = user_data;
+    const char *help;
 
-  help = gnc_table_get_entry (ledger->table, virt_loc);
-  if (!help || *help == '\0')
-    help = _("Enter the Entry Description");
+    help = gnc_table_get_entry (ledger->table, virt_loc);
+    if (!help || *help == '\0')
+        help = _("Enter the Entry Description");
 
-  return g_strdup (help);
+    return g_strdup (help);
 }
 
 static char * get_disc_help (VirtualLocation virt_loc, gpointer user_data)
 {
-  GncEntryLedger *ledger = user_data;
-  const char *help;
-  gint type;
+    GncEntryLedger *ledger = user_data;
+    const char *help;
+    gint type;
 
-  type = gnc_entry_ledger_get_type (ledger, ENTRY_DISTYPE_CELL);
+    type = gnc_entry_ledger_get_type (ledger, ENTRY_DISTYPE_CELL);
 
-  switch (type) {
-  case GNC_AMT_TYPE_VALUE:
-    help = _("Enter the Discount Amount");
-    break;
-  case GNC_AMT_TYPE_PERCENT:
-    help = _("Enter the Discount Percent");
-    break;
-  default:
-    help = _("Enter the Discount ... unknown type");
-    break;
-  }
+    switch (type)
+    {
+    case GNC_AMT_TYPE_VALUE:
+        help = _("Enter the Discount Amount");
+        break;
+    case GNC_AMT_TYPE_PERCENT:
+        help = _("Enter the Discount Percent");
+        break;
+    default:
+        help = _("Enter the Discount ... unknown type");
+        break;
+    }
 
-  return g_strdup (help);
+    return g_strdup (help);
 }
 
 static char * get_distype_help (VirtualLocation virt_loc, gpointer user_data)
 {
-  GncEntryLedger *ledger = user_data;
-  const char *help;
-  gint type;
+    GncEntryLedger *ledger = user_data;
+    const char *help;
+    gint type;
 
-  type = gnc_entry_ledger_get_type (ledger, ENTRY_DISTYPE_CELL);
+    type = gnc_entry_ledger_get_type (ledger, ENTRY_DISTYPE_CELL);
 
-  switch (type) {
-  case GNC_AMT_TYPE_VALUE:
-    help = _("Discount Type: Monetary Value");
-    break;
-  case GNC_AMT_TYPE_PERCENT:
-    help = _("Discount Type: Percent");
-    break;
-  default:
-    help = _("Select the Discount Type");
-    break;
-  }
-  return g_strdup (help);
+    switch (type)
+    {
+    case GNC_AMT_TYPE_VALUE:
+        help = _("Discount Type: Monetary Value");
+        break;
+    case GNC_AMT_TYPE_PERCENT:
+        help = _("Discount Type: Percent");
+        break;
+    default:
+        help = _("Select the Discount Type");
+        break;
+    }
+    return g_strdup (help);
 }
 
 static char * get_dishow_help (VirtualLocation virt_loc, gpointer user_data)
 {
-  GncEntryLedger *ledger = user_data;
-  const char *help;
-  gint type;
+    GncEntryLedger *ledger = user_data;
+    const char *help;
+    gint type;
 
-  type = gnc_entry_ledger_get_type (ledger, ENTRY_DISHOW_CELL);
+    type = gnc_entry_ledger_get_type (ledger, ENTRY_DISHOW_CELL);
 
-  switch (type) {
-  case GNC_DISC_PRETAX:
-    help = _("Tax computed after discount is applied");
-    break;
-  case GNC_DISC_SAMETIME:
-    help = _("Discount and tax both applied on pretax value");
-    break;
-  case GNC_DISC_POSTTAX:
-    help = _("Discount computed after tax is applied");
-    break;
-  default:
-    help = _("Select how to compute the Discount and Taxes");
-    break;
-  }
-  return g_strdup (help);
+    switch (type)
+    {
+    case GNC_DISC_PRETAX:
+        help = _("Tax computed after discount is applied");
+        break;
+    case GNC_DISC_SAMETIME:
+        help = _("Discount and tax both applied on pretax value");
+        break;
+    case GNC_DISC_POSTTAX:
+        help = _("Discount computed after tax is applied");
+        break;
+    default:
+        help = _("Select how to compute the Discount and Taxes");
+        break;
+    }
+    return g_strdup (help);
 }
 
 static char * get_pric_help (VirtualLocation virt_loc, gpointer user_data)
 {
-  GncEntryLedger *ledger = user_data;
-  const char *help;
+    GncEntryLedger *ledger = user_data;
+    const char *help;
 
-  help = gnc_table_get_entry (ledger->table, virt_loc);
-  if (!help || *help == '\0')
-    help = _("Enter the unit-Price for this Entry");
+    help = gnc_table_get_entry (ledger->table, virt_loc);
+    if (!help || *help == '\0')
+        help = _("Enter the unit-Price for this Entry");
 
-  return g_strdup (help);
+    return g_strdup (help);
 }
 
 static char * get_qty_help (VirtualLocation virt_loc, gpointer user_data)
 {
-  GncEntryLedger *ledger = user_data;
-  const char *help;
+    GncEntryLedger *ledger = user_data;
+    const char *help;
 
-  help = gnc_table_get_entry (ledger->table, virt_loc);
-  if (!help || *help == '\0')
-    help = _("Enter the Quantity of units for this Entry");
+    help = gnc_table_get_entry (ledger->table, virt_loc);
+    if (!help || *help == '\0')
+        help = _("Enter the Quantity of units for this Entry");
 
-  return g_strdup (help);
+    return g_strdup (help);
 }
 
 static char * get_taxtable_help (VirtualLocation virt_loc, gpointer user_data)
 {
-  GncEntryLedger *ledger = user_data;
-  const char *help;
+    GncEntryLedger *ledger = user_data;
+    const char *help;
 
-  help = gnc_table_get_entry (ledger->table, virt_loc);
-  if (!help || *help == '\0')
-    help = _("Enter the Tax Table to apply to this entry");
+    help = gnc_table_get_entry (ledger->table, virt_loc);
+    if (!help || *help == '\0')
+        help = _("Enter the Tax Table to apply to this entry");
 
-  return g_strdup (help);
+    return g_strdup (help);
 }
 
 static char * get_taxable_help (VirtualLocation virt_loc, gpointer user_data)
 {
-  const char *help;
+    const char *help;
 
-  help = _("Is this entry taxable?");
+    help = _("Is this entry taxable?");
 
-  return g_strdup (help);
+    return g_strdup (help);
 }
 
 static char * get_taxincluded_help (VirtualLocation virt_loc, gpointer user_data)
 {
-  const char *help;
+    const char *help;
 
-  help = _("Is the tax already included in the price of this entry?");
+    help = _("Is the tax already included in the price of this entry?");
 
-  return g_strdup (help);
+    return g_strdup (help);
 }
 
 static char * get_inv_help (VirtualLocation virt_loc, gpointer user_data)
 {
-  GncEntryLedger *ledger = user_data;
-  const char *help;
+    GncEntryLedger *ledger = user_data;
+    const char *help;
 
-  switch (ledger->type) {
-  case GNCENTRY_ORDER_ENTRY:
-  case GNCENTRY_ORDER_VIEWER:
-  case GNCENTRY_BILL_ENTRY:
-  case GNCENTRY_BILL_VIEWER:
-  case GNCENTRY_EXPVOUCHER_ENTRY:
-  case GNCENTRY_EXPVOUCHER_VIEWER:
-    help = _("Is this entry Invoiced?");
-    break;
-  case GNCENTRY_INVOICE_ENTRY:
-  case GNCENTRY_INVOICE_VIEWER:
-    help = _("Include this entry on this invoice?");
-    break;
-  default:
-    help = _("Unknown EntryLedger Type");
-  }
+    switch (ledger->type)
+    {
+    case GNCENTRY_ORDER_ENTRY:
+    case GNCENTRY_ORDER_VIEWER:
+    case GNCENTRY_BILL_ENTRY:
+    case GNCENTRY_BILL_VIEWER:
+    case GNCENTRY_EXPVOUCHER_ENTRY:
+    case GNCENTRY_EXPVOUCHER_VIEWER:
+        help = _("Is this entry Invoiced?");
+        break;
+    case GNCENTRY_INVOICE_ENTRY:
+    case GNCENTRY_INVOICE_VIEWER:
+        help = _("Include this entry on this invoice?");
+        break;
+    default:
+        help = _("Unknown EntryLedger Type");
+    }
 
-  return g_strdup (help);
+    return g_strdup (help);
 }
 
 static char * get_value_help (VirtualLocation virt_loc, gpointer user_data)
 {
-  GncEntryLedger *ledger = user_data;
-  const char *help;
+    GncEntryLedger *ledger = user_data;
+    const char *help;
 
-  help = gnc_table_get_entry (ledger->table, virt_loc);
-  if (!help || *help == '\0')
-    help = _("The subtotal value of this entry ");
+    help = gnc_table_get_entry (ledger->table, virt_loc);
+    if (!help || *help == '\0')
+        help = _("The subtotal value of this entry ");
 
-  return g_strdup (help);
+    return g_strdup (help);
 }
 
 static char * get_taxval_help (VirtualLocation virt_loc, gpointer user_data)
 {
-  GncEntryLedger *ledger = user_data;
-  const char *help;
+    GncEntryLedger *ledger = user_data;
+    const char *help;
 
-  help = gnc_table_get_entry (ledger->table, virt_loc);
-  if (!help || *help == '\0')
-    help = _("The total tax of this entry ");
+    help = gnc_table_get_entry (ledger->table, virt_loc);
+    if (!help || *help == '\0')
+        help = _("The total tax of this entry ");
 
-  return g_strdup (help);
+    return g_strdup (help);
 }
 
 static char * get_billable_help (VirtualLocation virt_loc, gpointer user_data)
 {
-  const char *help;
+    const char *help;
 
-  help = _("Is this entry billable to a customer or job?");
+    help = _("Is this entry billable to a customer or job?");
 
-  return g_strdup (help);
+    return g_strdup (help);
 }
 
 static char * get_payment_help (VirtualLocation virt_loc, gpointer user_data)
 {
-  const char *help;
+    const char *help;
 
-  help = _("How did you pay for this item?");
+    help = _("How did you pay for this item?");
 
-  return g_strdup (help);
+    return g_strdup (help);
 }
 
 /* GET_IO_FLAGS */
 
 static CellIOFlags get_standard_io_flags (VirtualLocation virt_loc,
-					  gpointer user_data)
+        gpointer user_data)
 {
-  GncEntryLedger *ledger = user_data;
-  switch (ledger->type) {
-  case GNCENTRY_ORDER_ENTRY:
-  case GNCENTRY_BILL_ENTRY:
-  case GNCENTRY_EXPVOUCHER_ENTRY:
+    GncEntryLedger *ledger = user_data;
+    switch (ledger->type)
     {
-      GncEntry *entry =
-	gnc_entry_ledger_get_entry (ledger, virt_loc.vcell_loc);
+    case GNCENTRY_ORDER_ENTRY:
+    case GNCENTRY_BILL_ENTRY:
+    case GNCENTRY_EXPVOUCHER_ENTRY:
+    {
+        GncEntry *entry =
+            gnc_entry_ledger_get_entry (ledger, virt_loc.vcell_loc);
 
-      /*
-       * If the type is an order_entry and the entry was invoiced,
-       * make the entry immutable
-       */
-      if (gncEntryGetInvoice (entry) != NULL)
-	return XACC_CELL_ALLOW_SHADOW;
+        /*
+         * If the type is an order_entry and the entry was invoiced,
+         * make the entry immutable
+         */
+        if (gncEntryGetInvoice (entry) != NULL)
+            return XACC_CELL_ALLOW_SHADOW;
     }
     /* FALLTHROUGH */
-  default:
-    return XACC_CELL_ALLOW_ALL;
-  }
+    default:
+        return XACC_CELL_ALLOW_ALL;
+    }
 }
 
 static CellIOFlags get_typecell_io_flags (VirtualLocation virt_loc,
-					  gpointer user_data)
+        gpointer user_data)
 {
-  return (get_standard_io_flags (virt_loc, user_data) |
-	  XACC_CELL_ALLOW_EXACT_ONLY);
+    return (get_standard_io_flags (virt_loc, user_data) |
+            XACC_CELL_ALLOW_EXACT_ONLY);
 }
 
 static CellIOFlags get_inv_io_flags (VirtualLocation virt_loc,
-				     gpointer user_data)
+                                     gpointer user_data)
 {
-  GncEntryLedger *ledger = user_data;
+    GncEntryLedger *ledger = user_data;
 
-  switch (ledger->type) {
-  case GNCENTRY_INVOICE_ENTRY:
-  {
-    /* This cell should be mutably IFF this entry is attached to
-     * a bill, order, or something else.
-     */
-    GncEntry * entry = gnc_entry_ledger_get_entry (ledger, virt_loc.vcell_loc);
+    switch (ledger->type)
+    {
+    case GNCENTRY_INVOICE_ENTRY:
+    {
+        /* This cell should be mutably IFF this entry is attached to
+         * a bill, order, or something else.
+         */
+        GncEntry * entry = gnc_entry_ledger_get_entry (ledger, virt_loc.vcell_loc);
 
-    if ((gncEntryGetOrder (entry) != NULL) || (gncEntryGetBill (entry) != NULL))
-      return XACC_CELL_ALLOW_ALL | XACC_CELL_ALLOW_EXACT_ONLY;
+        if ((gncEntryGetOrder (entry) != NULL) || (gncEntryGetBill (entry) != NULL))
+            return XACC_CELL_ALLOW_ALL | XACC_CELL_ALLOW_EXACT_ONLY;
 
-  }
-  /* FALLTHROUGH */
-  default:
-    return XACC_CELL_ALLOW_SHADOW;
-  }
+    }
+    /* FALLTHROUGH */
+    default:
+        return XACC_CELL_ALLOW_SHADOW;
+    }
 }
 
 static CellIOFlags get_value_io_flags (VirtualLocation virt_loc,
-				       gpointer user_data)
+                                       gpointer user_data)
 {
-  return XACC_CELL_ALLOW_SHADOW;
+    return XACC_CELL_ALLOW_SHADOW;
 }
 
 static CellIOFlags get_tax_io_flags (VirtualLocation virt_loc,
-				     gpointer user_data)
+                                     gpointer user_data)
 {
-  GncEntryLedger *ledger = user_data;
-  gboolean taxable;
+    GncEntryLedger *ledger = user_data;
+    gboolean taxable;
 
-  taxable = gnc_entry_ledger_get_checkmark (ledger, ENTRY_TAXABLE_CELL);
+    taxable = gnc_entry_ledger_get_checkmark (ledger, ENTRY_TAXABLE_CELL);
 
-  /* Only print the taxtable and taxincluded cells if taxable is true */
-  if (taxable)
-    return get_standard_io_flags (virt_loc, user_data);
+    /* Only print the taxtable and taxincluded cells if taxable is true */
+    if (taxable)
+        return get_standard_io_flags (virt_loc, user_data);
 
-  /* Shadow the value, so the cell is loaded properly */
-  return XACC_CELL_ALLOW_SHADOW;
+    /* Shadow the value, so the cell is loaded properly */
+    return XACC_CELL_ALLOW_SHADOW;
 }
 
 static CellIOFlags get_taxincluded_io_flags (VirtualLocation virt_loc,
-					     gpointer user_data)
+        gpointer user_data)
 {
-  CellIOFlags flags = get_tax_io_flags (virt_loc, user_data);
-  if (flags == XACC_CELL_ALLOW_SHADOW)
-    return flags;
-  return flags | XACC_CELL_ALLOW_EXACT_ONLY;
+    CellIOFlags flags = get_tax_io_flags (virt_loc, user_data);
+    if (flags == XACC_CELL_ALLOW_SHADOW)
+        return flags;
+    return flags | XACC_CELL_ALLOW_EXACT_ONLY;
 }
 
 static CellIOFlags get_qty_io_flags (VirtualLocation virt_loc, gpointer user_data)
 {
-  GncEntryLedger *ledger = user_data;
-  GncEntry *entry;
-  CellIOFlags flags = get_standard_io_flags (virt_loc, user_data);
+    GncEntryLedger *ledger = user_data;
+    GncEntry *entry;
+    CellIOFlags flags = get_standard_io_flags (virt_loc, user_data);
 
-  /* If this isn't an invoice, or the flags are already read-only ... */
-  if (!ledger->is_invoice || flags == XACC_CELL_ALLOW_SHADOW)
-    return flags;
+    /* If this isn't an invoice, or the flags are already read-only ... */
+    if (!ledger->is_invoice || flags == XACC_CELL_ALLOW_SHADOW)
+        return flags;
 
-  /* ok, if this is an invoice ledger AND this entry is attached to a
-   * bill (i.e. it's billable), freeze the quantity
-   */
-  entry = gnc_entry_ledger_get_entry (ledger, virt_loc.vcell_loc);
-  if (gncEntryGetBillable (entry))
-    return XACC_CELL_ALLOW_SHADOW;
+    /* ok, if this is an invoice ledger AND this entry is attached to a
+     * bill (i.e. it's billable), freeze the quantity
+     */
+    entry = gnc_entry_ledger_get_entry (ledger, virt_loc.vcell_loc);
+    if (gncEntryGetBillable (entry))
+        return XACC_CELL_ALLOW_SHADOW;
 
-  return flags;
+    return flags;
 }
 
 /* GET BG_COLORS */
 
 static guint32
 gnc_entry_ledger_get_bg_color (VirtualLocation virt_loc,
-			       gboolean *hatching, gpointer user_data)
+                               gboolean *hatching, gpointer user_data)
 {
-  GncEntryLedger *ledger = user_data;
-  VirtualCell *vcell;
-  guint32 bg_color;
-  gboolean is_current;
+    GncEntryLedger *ledger = user_data;
+    VirtualCell *vcell;
+    guint32 bg_color;
+    gboolean is_current;
 
-  if (hatching)
-    *hatching = FALSE;
+    if (hatching)
+        *hatching = FALSE;
 
-  bg_color = 0xffffff; /* white */
+    bg_color = 0xffffff; /* white */
 
-  if (!ledger) return bg_color;
+    if (!ledger) return bg_color;
 
-  if (gnc_table_virtual_location_in_header (ledger->table, virt_loc))
-    return reg_colors.header_bg_color;
+    if (gnc_table_virtual_location_in_header (ledger->table, virt_loc))
+        return reg_colors.header_bg_color;
 
-  vcell = gnc_table_get_virtual_cell (ledger->table, virt_loc.vcell_loc);
-  if (!vcell || !vcell->cellblock)
-    return bg_color;
+    vcell = gnc_table_get_virtual_cell (ledger->table, virt_loc.vcell_loc);
+    if (!vcell || !vcell->cellblock)
+        return bg_color;
 
-  if ((virt_loc.phys_col_offset < vcell->cellblock->start_col) ||
-      (virt_loc.phys_col_offset > vcell->cellblock->stop_col))
-    return bg_color;
+    if ((virt_loc.phys_col_offset < vcell->cellblock->start_col) ||
+            (virt_loc.phys_col_offset > vcell->cellblock->stop_col))
+        return bg_color;
 
-  is_current = virt_cell_loc_equal
-    (ledger->table->current_cursor_loc.vcell_loc, virt_loc.vcell_loc);
+    is_current = virt_cell_loc_equal
+                 (ledger->table->current_cursor_loc.vcell_loc, virt_loc.vcell_loc);
 
-  if (is_current)
+    if (is_current)
+        return vcell->start_primary_color ?
+               reg_colors.primary_active_bg_color :
+               reg_colors.secondary_active_bg_color;
+
     return vcell->start_primary_color ?
-      reg_colors.primary_active_bg_color :
-    reg_colors.secondary_active_bg_color;
-
-  return vcell->start_primary_color ?
-    reg_colors.primary_bg_color : reg_colors.secondary_bg_color;
+           reg_colors.primary_bg_color : reg_colors.secondary_bg_color;
 }
 
 /* SAVE CELLS */
 
 static void gnc_entry_ledger_save_cells (gpointer save_data,
-					 gpointer user_data)
+        gpointer user_data)
 {
-  GncEntryLedger *ledger = user_data;
-  GncEntry *entry = save_data;
+    GncEntryLedger *ledger = user_data;
+    GncEntry *entry = save_data;
 
-  g_return_if_fail (entry != NULL);
+    g_return_if_fail (entry != NULL);
 
-  /* copy the contents from the cursor to the split */
+    /* copy the contents from the cursor to the split */
 
-  if (gnc_table_layout_get_cell_changed (ledger->table->layout,
-					 ENTRY_IACCT_CELL, TRUE)) {
-    Account *acc;
+    if (gnc_table_layout_get_cell_changed (ledger->table->layout,
+                                           ENTRY_IACCT_CELL, TRUE))
+    {
+        Account *acc;
 
-    acc = gnc_entry_ledger_get_account (ledger, ENTRY_IACCT_CELL);
+        acc = gnc_entry_ledger_get_account (ledger, ENTRY_IACCT_CELL);
 
-    if (acc != NULL)
-      gncEntrySetInvAccount (entry, acc);
-  }
+        if (acc != NULL)
+            gncEntrySetInvAccount (entry, acc);
+    }
 
-  if (gnc_table_layout_get_cell_changed (ledger->table->layout,
-					 ENTRY_BACCT_CELL, TRUE)) {
-    Account *acc;
+    if (gnc_table_layout_get_cell_changed (ledger->table->layout,
+                                           ENTRY_BACCT_CELL, TRUE))
+    {
+        Account *acc;
 
-    acc = gnc_entry_ledger_get_account (ledger, ENTRY_BACCT_CELL);
+        acc = gnc_entry_ledger_get_account (ledger, ENTRY_BACCT_CELL);
 
-    if (acc != NULL)
-      gncEntrySetBillAccount (entry, acc);
-  }
+        if (acc != NULL)
+            gncEntrySetBillAccount (entry, acc);
+    }
 
-  if (gnc_table_layout_get_cell_changed (ledger->table->layout,
-					 ENTRY_ACTN_CELL, TRUE)) {
-    const char *value;
+    if (gnc_table_layout_get_cell_changed (ledger->table->layout,
+                                           ENTRY_ACTN_CELL, TRUE))
+    {
+        const char *value;
 
-    value = gnc_table_layout_get_cell_value (ledger->table->layout,
-					     ENTRY_ACTN_CELL);
-    gncEntrySetAction (entry, value);
-  }
+        value = gnc_table_layout_get_cell_value (ledger->table->layout,
+                ENTRY_ACTN_CELL);
+        gncEntrySetAction (entry, value);
+    }
 
-  if (gnc_table_layout_get_cell_changed (ledger->table->layout,
-					 ENTRY_DATE_CELL, TRUE)) {
-    BasicCell *cell;
-    Timespec ts;
+    if (gnc_table_layout_get_cell_changed (ledger->table->layout,
+                                           ENTRY_DATE_CELL, TRUE))
+    {
+        BasicCell *cell;
+        Timespec ts;
 
-    cell = gnc_table_layout_get_cell (ledger->table->layout, ENTRY_DATE_CELL);
+        cell = gnc_table_layout_get_cell (ledger->table->layout, ENTRY_DATE_CELL);
 
-    /* commit any pending changes */
-    gnc_date_cell_commit ((DateCell *) cell);
+        /* commit any pending changes */
+        gnc_date_cell_commit ((DateCell *) cell);
 
-    gnc_date_cell_get_date ((DateCell *) cell, &ts);
-    gncEntrySetDate (entry, ts);
-  }
+        gnc_date_cell_get_date ((DateCell *) cell, &ts);
+        gncEntrySetDate (entry, ts);
+    }
 
-  if (gnc_table_layout_get_cell_changed (ledger->table->layout,
-					 ENTRY_DESC_CELL, TRUE)) {
-    const char *value;
+    if (gnc_table_layout_get_cell_changed (ledger->table->layout,
+                                           ENTRY_DESC_CELL, TRUE))
+    {
+        const char *value;
 
-    value = gnc_table_layout_get_cell_value (ledger->table->layout,
-					     ENTRY_DESC_CELL);
-    gncEntrySetDescription (entry, value);
-  }
+        value = gnc_table_layout_get_cell_value (ledger->table->layout,
+                ENTRY_DESC_CELL);
+        gncEntrySetDescription (entry, value);
+    }
 
-  if (gnc_table_layout_get_cell_changed (ledger->table->layout,
-					 ENTRY_DISC_CELL, TRUE)) {
-    gnc_numeric amount;
+    if (gnc_table_layout_get_cell_changed (ledger->table->layout,
+                                           ENTRY_DISC_CELL, TRUE))
+    {
+        gnc_numeric amount;
 
-    if (gnc_entry_ledger_get_numeric (ledger, ENTRY_DISC_CELL, &amount))
-	gncEntrySetInvDiscount (entry, amount);
-  }
+        if (gnc_entry_ledger_get_numeric (ledger, ENTRY_DISC_CELL, &amount))
+            gncEntrySetInvDiscount (entry, amount);
+    }
 
-  if (gnc_table_layout_get_cell_changed (ledger->table->layout,
-					 ENTRY_DISTYPE_CELL, TRUE)) {
-    gint type;
+    if (gnc_table_layout_get_cell_changed (ledger->table->layout,
+                                           ENTRY_DISTYPE_CELL, TRUE))
+    {
+        gint type;
 
-    type = gnc_entry_ledger_get_type (ledger, ENTRY_DISTYPE_CELL);
+        type = gnc_entry_ledger_get_type (ledger, ENTRY_DISTYPE_CELL);
 
-    if (type != -1)
-      gncEntrySetInvDiscountType (entry, type);
-  }
+        if (type != -1)
+            gncEntrySetInvDiscountType (entry, type);
+    }
 
-  if (gnc_table_layout_get_cell_changed (ledger->table->layout,
-					 ENTRY_DISHOW_CELL, TRUE)) {
-    gint type;
+    if (gnc_table_layout_get_cell_changed (ledger->table->layout,
+                                           ENTRY_DISHOW_CELL, TRUE))
+    {
+        gint type;
 
-    type = gnc_entry_ledger_get_type (ledger, ENTRY_DISHOW_CELL);
+        type = gnc_entry_ledger_get_type (ledger, ENTRY_DISHOW_CELL);
 
-    if (type != -1)
-      gncEntrySetInvDiscountHow (entry, type);
-  }
+        if (type != -1)
+            gncEntrySetInvDiscountHow (entry, type);
+    }
 
-  if (gnc_table_layout_get_cell_changed (ledger->table->layout,
-					 ENTRY_QTY_CELL, TRUE)) {
-    gnc_numeric amount;
+    if (gnc_table_layout_get_cell_changed (ledger->table->layout,
+                                           ENTRY_QTY_CELL, TRUE))
+    {
+        gnc_numeric amount;
 
-    if (gnc_entry_ledger_get_numeric (ledger, ENTRY_QTY_CELL, &amount))
-	gncEntrySetQuantity (entry, amount);
-  }
+        if (gnc_entry_ledger_get_numeric (ledger, ENTRY_QTY_CELL, &amount))
+            gncEntrySetQuantity (entry, amount);
+    }
 
-  if (gnc_table_layout_get_cell_changed (ledger->table->layout,
-					 ENTRY_BILLABLE_CELL, TRUE)) {
-    gboolean billable;
+    if (gnc_table_layout_get_cell_changed (ledger->table->layout,
+                                           ENTRY_BILLABLE_CELL, TRUE))
+    {
+        gboolean billable;
 
-    billable = gnc_entry_ledger_get_checkmark (ledger, ENTRY_BILLABLE_CELL);
-    gncEntrySetBillable (entry, billable);
-  }
+        billable = gnc_entry_ledger_get_checkmark (ledger, ENTRY_BILLABLE_CELL);
+        gncEntrySetBillable (entry, billable);
+    }
 
-  if (gnc_table_layout_get_cell_changed (ledger->table->layout,
-					 ENTRY_PAYMENT_CELL, TRUE)) {
-    const char *value;
+    if (gnc_table_layout_get_cell_changed (ledger->table->layout,
+                                           ENTRY_PAYMENT_CELL, TRUE))
+    {
+        const char *value;
 
-    value = gnc_table_layout_get_cell_value (ledger->table->layout,
-					     ENTRY_PAYMENT_CELL);
-    if (!safe_strcmp (value, _("Cash")))
-      gncEntrySetBillPayment (entry, GNC_PAYMENT_CASH);
-    else if (!safe_strcmp (value, _("Charge")))
-      gncEntrySetBillPayment (entry, GNC_PAYMENT_CARD);
-    else
-      g_warning ("Invalid Payment cell: %s", value ? value : "(null)");
-  }
+        value = gnc_table_layout_get_cell_value (ledger->table->layout,
+                ENTRY_PAYMENT_CELL);
+        if (!safe_strcmp (value, _("Cash")))
+            gncEntrySetBillPayment (entry, GNC_PAYMENT_CASH);
+        else if (!safe_strcmp (value, _("Charge")))
+            gncEntrySetBillPayment (entry, GNC_PAYMENT_CARD);
+        else
+            g_warning ("Invalid Payment cell: %s", value ? value : "(null)");
+    }
 
-  if (gnc_table_layout_get_cell_changed (ledger->table->layout,
-					  ENTRY_PRIC_CELL, TRUE)) {
-    gnc_numeric amount;
+    if (gnc_table_layout_get_cell_changed (ledger->table->layout,
+                                           ENTRY_PRIC_CELL, TRUE))
+    {
+        gnc_numeric amount;
 
-    if (gnc_entry_ledger_get_numeric (ledger, ENTRY_PRIC_CELL, &amount)) {
-      if (ledger->is_invoice)
-	gncEntrySetInvPrice (entry, amount);
-      else
-	gncEntrySetBillPrice (entry, amount);
+        if (gnc_entry_ledger_get_numeric (ledger, ENTRY_PRIC_CELL, &amount))
+        {
+            if (ledger->is_invoice)
+                gncEntrySetInvPrice (entry, amount);
+            else
+                gncEntrySetBillPrice (entry, amount);
+        }
     }
-  }
 
-  if (gnc_table_layout_get_cell_changed (ledger->table->layout,
-					 ENTRY_TAXABLE_CELL, TRUE)) {
-    gboolean taxable;
+    if (gnc_table_layout_get_cell_changed (ledger->table->layout,
+                                           ENTRY_TAXABLE_CELL, TRUE))
+    {
+        gboolean taxable;
 
-    taxable = gnc_entry_ledger_get_checkmark (ledger, ENTRY_TAXABLE_CELL);
-    if (ledger->is_invoice)
-      gncEntrySetInvTaxable (entry, taxable);
-    else
-      gncEntrySetBillTaxable (entry, taxable);
-  }
+        taxable = gnc_entry_ledger_get_checkmark (ledger, ENTRY_TAXABLE_CELL);
+        if (ledger->is_invoice)
+            gncEntrySetInvTaxable (entry, taxable);
+        else
+            gncEntrySetBillTaxable (entry, taxable);
+    }
 
-  /* XXX: Only (re-set) these if taxable is TRUE? */
-  if (gnc_table_layout_get_cell_changed (ledger->table->layout,
-					 ENTRY_TAXTABLE_CELL, TRUE)) {
-    GncTaxTable *table;
+    /* XXX: Only (re-set) these if taxable is TRUE? */
+    if (gnc_table_layout_get_cell_changed (ledger->table->layout,
+                                           ENTRY_TAXTABLE_CELL, TRUE))
+    {
+        GncTaxTable *table;
 
-    table = gnc_entry_ledger_get_taxtable (ledger, ENTRY_TAXTABLE_CELL);
-    if (table) {
-      if (ledger->is_invoice)
-	gncEntrySetInvTaxTable (entry, table);
-      else
-	gncEntrySetBillTaxTable (entry, table);
+        table = gnc_entry_ledger_get_taxtable (ledger, ENTRY_TAXTABLE_CELL);
+        if (table)
+        {
+            if (ledger->is_invoice)
+                gncEntrySetInvTaxTable (entry, table);
+            else
+                gncEntrySetBillTaxTable (entry, table);
+        }
     }
-  }
 
-  if (gnc_table_layout_get_cell_changed (ledger->table->layout,
-					 ENTRY_TAXINCLUDED_CELL, TRUE)) {
-    gboolean taxincluded;
+    if (gnc_table_layout_get_cell_changed (ledger->table->layout,
+                                           ENTRY_TAXINCLUDED_CELL, TRUE))
+    {
+        gboolean taxincluded;
 
-    taxincluded = gnc_entry_ledger_get_checkmark (ledger,
-						  ENTRY_TAXINCLUDED_CELL);
-    if (ledger->is_invoice)
-      gncEntrySetInvTaxIncluded (entry, taxincluded);
-    else
-      gncEntrySetBillTaxIncluded (entry, taxincluded);
-  }
+        taxincluded = gnc_entry_ledger_get_checkmark (ledger,
+                      ENTRY_TAXINCLUDED_CELL);
+        if (ledger->is_invoice)
+            gncEntrySetInvTaxIncluded (entry, taxincluded);
+        else
+            gncEntrySetBillTaxIncluded (entry, taxincluded);
+    }
 
-  if (ledger->type == GNCENTRY_INVOICE_ENTRY) {
-    gboolean inv_value;
+    if (ledger->type == GNCENTRY_INVOICE_ENTRY)
+    {
+        gboolean inv_value;
 
-    inv_value = gnc_entry_ledger_get_checkmark (ledger, ENTRY_INV_CELL);
+        inv_value = gnc_entry_ledger_get_checkmark (ledger, ENTRY_INV_CELL);
 
-    if (inv_value) {
-      /* Add this to the invoice (if it's not already attached) */
-      if (gncEntryGetInvoice (entry) == NULL)
-	gncInvoiceAddEntry (ledger->invoice, entry);
+        if (inv_value)
+        {
+            /* Add this to the invoice (if it's not already attached) */
+            if (gncEntryGetInvoice (entry) == NULL)
+                gncInvoiceAddEntry (ledger->invoice, entry);
 
-    } else {
-      /* Remove from the invoice iff we're attached to an order or bill */
-      if ((gncEntryGetOrder (entry) != NULL) ||
-	  (gncEntryGetBill (entry) != NULL))
-	gncInvoiceRemoveEntry (ledger->invoice, entry);
+        }
+        else
+        {
+            /* Remove from the invoice iff we're attached to an order or bill */
+            if ((gncEntryGetOrder (entry) != NULL) ||
+                    (gncEntryGetBill (entry) != NULL))
+                gncInvoiceRemoveEntry (ledger->invoice, entry);
+        }
     }
-  }
 }
 
 /* Set Cell Handlers */
 
 static void gnc_entry_ledger_model_new_handlers (TableModel *model,
-						 GncEntryLedgerType type)
+        GncEntryLedgerType type)
 {
-  struct model_desc {
-    const char * cell;
-    gpointer entry_handler;
-    gpointer label_handler;
-    gpointer help_handler;
-    gpointer io_flags_handler;
-  } models[] = {
-    { ENTRY_IACCT_CELL, get_iacct_entry, get_iacct_label, get_acct_help, get_standard_io_flags },
-    { ENTRY_BACCT_CELL, get_bacct_entry, get_bacct_label, get_acct_help, get_standard_io_flags },
-    { ENTRY_ACTN_CELL, get_actn_entry, get_actn_label, get_actn_help, get_standard_io_flags },
-    { ENTRY_DATE_CELL, get_date_entry, get_date_label, get_date_help, get_standard_io_flags },
-    { ENTRY_DESC_CELL, get_desc_entry, get_desc_label, get_desc_help, get_standard_io_flags },
-    { ENTRY_DISC_CELL, get_disc_entry, get_disc_label, get_disc_help, get_standard_io_flags },
-    { ENTRY_DISTYPE_CELL, get_distype_entry, get_distype_label, get_distype_help,  get_typecell_io_flags },
-    { ENTRY_DISHOW_CELL, get_dishow_entry, get_dishow_label, get_dishow_help, get_typecell_io_flags },
-    { ENTRY_PRIC_CELL, get_pric_entry, get_pric_label, get_pric_help, get_standard_io_flags },
-    { ENTRY_QTY_CELL, get_qty_entry, get_qty_label, get_qty_help, get_qty_io_flags },
-    { ENTRY_TAXABLE_CELL, get_taxable_entry, get_taxable_label, get_taxable_help,  get_typecell_io_flags },
-    { ENTRY_TAXTABLE_CELL, get_taxtable_entry, get_taxtable_label, get_taxtable_help, get_tax_io_flags },
-    { ENTRY_TAXINCLUDED_CELL, get_taxincluded_entry, get_taxincluded_label, get_taxincluded_help, get_taxincluded_io_flags },
-    { ENTRY_INV_CELL, get_inv_entry, get_inv_label, get_inv_help, get_inv_io_flags },
-    { ENTRY_VALUE_CELL, get_value_entry, get_value_label, get_value_help, get_value_io_flags },
-    { ENTRY_TAXVAL_CELL, get_taxval_entry, get_taxval_label, get_taxval_help, get_value_io_flags },
-    { ENTRY_BILLABLE_CELL, get_billable_entry, get_billable_label, get_billable_help, get_typecell_io_flags },
-    { ENTRY_PAYMENT_CELL, get_payment_entry, get_payment_label, get_payment_help, get_standard_io_flags },
-  };
-  unsigned int i;
+    struct model_desc
+    {
+        const char * cell;
+        gpointer entry_handler;
+        gpointer label_handler;
+        gpointer help_handler;
+        gpointer io_flags_handler;
+    } models[] =
+    {
+        { ENTRY_IACCT_CELL, get_iacct_entry, get_iacct_label, get_acct_help, get_standard_io_flags },
+        { ENTRY_BACCT_CELL, get_bacct_entry, get_bacct_label, get_acct_help, get_standard_io_flags },
+        { ENTRY_ACTN_CELL, get_actn_entry, get_actn_label, get_actn_help, get_standard_io_flags },
+        { ENTRY_DATE_CELL, get_date_entry, get_date_label, get_date_help, get_standard_io_flags },
+        { ENTRY_DESC_CELL, get_desc_entry, get_desc_label, get_desc_help, get_standard_io_flags },
+        { ENTRY_DISC_CELL, get_disc_entry, get_disc_label, get_disc_help, get_standard_io_flags },
+        { ENTRY_DISTYPE_CELL, get_distype_entry, get_distype_label, get_distype_help,  get_typecell_io_flags },
+        { ENTRY_DISHOW_CELL, get_dishow_entry, get_dishow_label, get_dishow_help, get_typecell_io_flags },
+        { ENTRY_PRIC_CELL, get_pric_entry, get_pric_label, get_pric_help, get_standard_io_flags },
+        { ENTRY_QTY_CELL, get_qty_entry, get_qty_label, get_qty_help, get_qty_io_flags },
+        { ENTRY_TAXABLE_CELL, get_taxable_entry, get_taxable_label, get_taxable_help,  get_typecell_io_flags },
+        { ENTRY_TAXTABLE_CELL, get_taxtable_entry, get_taxtable_label, get_taxtable_help, get_tax_io_flags },
+        { ENTRY_TAXINCLUDED_CELL, get_taxincluded_entry, get_taxincluded_label, get_taxincluded_help, get_taxincluded_io_flags },
+        { ENTRY_INV_CELL, get_inv_entry, get_inv_label, get_inv_help, get_inv_io_flags },
+        { ENTRY_VALUE_CELL, get_value_entry, get_value_label, get_value_help, get_value_io_flags },
+        { ENTRY_TAXVAL_CELL, get_taxval_entry, get_taxval_label, get_taxval_help, get_value_io_flags },
+        { ENTRY_BILLABLE_CELL, get_billable_entry, get_billable_label, get_billable_help, get_typecell_io_flags },
+        { ENTRY_PAYMENT_CELL, get_payment_entry, get_payment_label, get_payment_help, get_standard_io_flags },
+    };
+    unsigned int i;
 
-  gnc_table_model_set_default_bg_color_handler
+    gnc_table_model_set_default_bg_color_handler
     (model, gnc_entry_ledger_get_bg_color);
 
 
-  for (i = 0; i < (sizeof(models)/sizeof(*models)); i++) {
-    if (models[i].entry_handler)
-      gnc_table_model_set_entry_handler (model, models[i].entry_handler,
-					 models[i].cell);
-    if (models[i].label_handler)
-      gnc_table_model_set_label_handler (model, models[i].label_handler,
-					 models[i].cell);
-    if (models[i].help_handler)
-      gnc_table_model_set_help_handler (model, models[i].help_handler,
-					models[i].cell);
-    if (models[i].io_flags_handler)
-      gnc_table_model_set_io_flags_handler (model, models[i].io_flags_handler,
-					    models[i].cell);
-  } /* for */
+    for (i = 0; i < (sizeof(models) / sizeof(*models)); i++)
+    {
+        if (models[i].entry_handler)
+            gnc_table_model_set_entry_handler (model, models[i].entry_handler,
+                                               models[i].cell);
+        if (models[i].label_handler)
+            gnc_table_model_set_label_handler (model, models[i].label_handler,
+                                               models[i].cell);
+        if (models[i].help_handler)
+            gnc_table_model_set_help_handler (model, models[i].help_handler,
+                                              models[i].cell);
+        if (models[i].io_flags_handler)
+            gnc_table_model_set_io_flags_handler (model, models[i].io_flags_handler,
+                                                  models[i].cell);
+    } /* for */
 
-  /*
-  model->cell_data_allocator = ;
-  model->cell_data_deallocator = ;
-  model->cell_data_copy = ;
-  */
+    /*
+    model->cell_data_allocator = ;
+    model->cell_data_deallocator = ;
+    model->cell_data_copy = ;
+    */
 
-  gnc_table_model_set_post_save_handler (model, gnc_entry_ledger_save_cells);
+    gnc_table_model_set_post_save_handler (model, gnc_entry_ledger_save_cells);
 
-  switch (type) {
-  case GNCENTRY_ORDER_VIEWER:
-  case GNCENTRY_INVOICE_VIEWER:
-  case GNCENTRY_BILL_VIEWER:
-  case GNCENTRY_EXPVOUCHER_VIEWER:
-    /* make this table read-only */
-    gnc_table_model_set_read_only (model, TRUE);
-    break;
-  default:
-    break;
-  }
+    switch (type)
+    {
+    case GNCENTRY_ORDER_VIEWER:
+    case GNCENTRY_INVOICE_VIEWER:
+    case GNCENTRY_BILL_VIEWER:
+    case GNCENTRY_EXPVOUCHER_VIEWER:
+        /* make this table read-only */
+        gnc_table_model_set_read_only (model, TRUE);
+        break;
+    default:
+        break;
+    }
 }
 
 /** Public Interface ***********************************************/
 
 TableModel * gnc_entry_ledger_model_new (GncEntryLedgerType type)
 {
-  TableModel * model;
+    TableModel * model;
 
-  model = gnc_table_model_new ();
-  gnc_entry_ledger_model_new_handlers (model, type);
+    model = gnc_table_model_new ();
+    gnc_entry_ledger_model_new_handlers (model, type);
 
-  return model;
+    return model;
 }

Modified: gnucash/trunk/src/business/business-ledger/gncEntryLedgerP.h
===================================================================
--- gnucash/trunk/src/business/business-ledger/gncEntryLedgerP.h	2010-03-02 21:40:28 UTC (rev 18788)
+++ gnucash/trunk/src/business/business-ledger/gncEntryLedgerP.h	2010-03-02 21:41:05 UTC (rev 18789)
@@ -29,55 +29,56 @@
 #include "table-allgui.h"
 #include "gncEntryLedger.h"
 
-struct GncEntryLedger_s {
-  GUID		blank_entry_guid;
-  gboolean	blank_entry_edited;
-  gboolean      traverse_to_new;
+struct GncEntryLedger_s
+{
+    GUID		blank_entry_guid;
+    gboolean	blank_entry_edited;
+    gboolean      traverse_to_new;
 
-  gboolean	loading;	/* To keep from recursing from events */
-  gboolean	full_refresh;	/* Is a full refresh ok? */
-  gint		component_id;	/* To register for events */
+    gboolean	loading;	/* To keep from recursing from events */
+    gboolean	full_refresh;	/* Is a full refresh ok? */
+    gint		component_id;	/* To register for events */
 
-  Timespec	last_date_entered;
+    Timespec	last_date_entered;
 
-  GncEntry *	hint_entry;	/* A Hint for where to display */
+    GncEntry *	hint_entry;	/* A Hint for where to display */
 
-  gncUIWidget	parent;
-  QofBook *	book;
-  Table *	table;
-  GncOrder *	order;
-  GncInvoice *	invoice;
-  QueryNew *	query;
-  
-  GncEntryLedgerType type;
+    gncUIWidget	parent;
+    QofBook *	book;
+    Table *	table;
+    GncOrder *	order;
+    GncInvoice *	invoice;
+    QueryNew *	query;
 
-  gboolean	is_invoice;	/* is this an invoice (or a bill)? */
+    GncEntryLedgerType type;
 
-  const gchar * gconf_section;
+    gboolean	is_invoice;	/* is this an invoice (or a bill)? */
+
+    const gchar * gconf_section;
 };
 
 GncEntry * gnc_entry_ledger_get_entry (GncEntryLedger *ledger,
-				       VirtualCellLocation vcell_loc);
+                                       VirtualCellLocation vcell_loc);
 Account * gnc_entry_ledger_get_account_by_name (GncEntryLedger *ledger, BasicCell * bcell,
-						const char *name, gboolean *new);
+        const char *name, gboolean *new);
 Account * gnc_entry_ledger_get_account (GncEntryLedger *ledger,
-					const char * cell_name);
+                                        const char * cell_name);
 GncTaxTable * gnc_entry_ledger_get_taxtable (GncEntryLedger *ledger,
-					     const char *cell_name);
+        const char *cell_name);
 
 gint gnc_entry_ledger_get_type (GncEntryLedger *ledger,
-				const char * cell_name);
+                                const char * cell_name);
 gboolean gnc_entry_ledger_get_checkmark (GncEntryLedger *ledger,
-					 const char * cell_name);
+        const char * cell_name);
 gboolean gnc_entry_ledger_get_numeric (GncEntryLedger *ledger,
-				       const char *cell_name,
-				       gnc_numeric *value);
+                                       const char *cell_name,
+                                       gnc_numeric *value);
 
 const char * gnc_entry_ledger_type_string_getter (char flag);
 const char * gnc_entry_ledger_how_string_getter (char flag);
 
 gboolean gnc_entry_ledger_find_entry (GncEntryLedger *ledger, GncEntry *entry,
-				      VirtualCellLocation *vcell_loc);
+                                      VirtualCellLocation *vcell_loc);
 
 void gnc_entry_ledger_load_xfer_cells (GncEntryLedger *ledger);
 
@@ -85,7 +86,7 @@
 void gnc_entry_ledger_display_fini (GncEntryLedger *ledger);
 
 void gnc_entry_ledger_compute_value (GncEntryLedger *ledger,
-				     gnc_numeric *value,
-				     gnc_numeric *tax_value);
+                                     gnc_numeric *value,
+                                     gnc_numeric *tax_value);
 
 #endif /* GNC_ENTRY_LEDGERP_H */

Modified: gnucash/trunk/src/business/business-utils/business-options.c
===================================================================
--- gnucash/trunk/src/business/business-utils/business-options.c	2010-03-02 21:40:28 UTC (rev 18788)
+++ gnucash/trunk/src/business/business-utils/business-options.c	2010-03-02 21:41:05 UTC (rev 18789)
@@ -52,40 +52,40 @@
 
 GncTaxTable*
 gnc_option_db_lookup_taxtable_option(GNCOptionDB *odb,
-				     const char *section,
-				     const char *name,
-				     GncTaxTable * default_value)
+                                     const char *section,
+                                     const char *name,
+                                     GncTaxTable * default_value)
 {
-  LOOKUP_OPTION("gnc_option_db_lookup_taxtable_option");
-  return SWIG_MustGetPtr(value, SWIG_TypeQuery("_p__gncTaxTable"), 1, 0);
+    LOOKUP_OPTION("gnc_option_db_lookup_taxtable_option");
+    return SWIG_MustGetPtr(value, SWIG_TypeQuery("_p__gncTaxTable"), 1, 0);
 }
 
 GncInvoice*
 gnc_option_db_lookup_invoice_option(GNCOptionDB *odb,
-				    const char *section,
-				    const char *name,
-				    GncInvoice * default_value)
+                                    const char *section,
+                                    const char *name,
+                                    GncInvoice * default_value)
 {
-  LOOKUP_OPTION("gnc_option_db_lookup_invoice_option");
-  return SWIG_MustGetPtr(value, SWIG_TypeQuery("_p__gncInvoice"), 1, 0);
+    LOOKUP_OPTION("gnc_option_db_lookup_invoice_option");
+    return SWIG_MustGetPtr(value, SWIG_TypeQuery("_p__gncInvoice"), 1, 0);
 }
 
 GncCustomer*
 gnc_option_db_lookup_customer_option(GNCOptionDB *odb,
-				     const char *section,
-				     const char *name,
-				     GncCustomer * default_value)
+                                     const char *section,
+                                     const char *name,
+                                     GncCustomer * default_value)
 {
-  LOOKUP_OPTION("gnc_option_db_lookup_customer_option");
-  return SWIG_MustGetPtr(value, SWIG_TypeQuery("_p__gncCustomer"), 1, 0);
+    LOOKUP_OPTION("gnc_option_db_lookup_customer_option");
+    return SWIG_MustGetPtr(value, SWIG_TypeQuery("_p__gncCustomer"), 1, 0);
 }
 
 GncVendor*
 gnc_option_db_lookup_vendor_option(GNCOptionDB *odb,
-				   const char *section,
-				   const char *name,
-				   GncVendor * default_value)
+                                   const char *section,
+                                   const char *name,
+                                   GncVendor * default_value)
 {
-  LOOKUP_OPTION("gnc_option_db_lookup_vendor_option");
-  return SWIG_MustGetPtr(value, SWIG_TypeQuery("_p__gncVendor"), 1, 0);
+    LOOKUP_OPTION("gnc_option_db_lookup_vendor_option");
+    return SWIG_MustGetPtr(value, SWIG_TypeQuery("_p__gncVendor"), 1, 0);
 }

Modified: gnucash/trunk/src/business/business-utils/business-options.h
===================================================================
--- gnucash/trunk/src/business/business-utils/business-options.h	2010-03-02 21:40:28 UTC (rev 18788)
+++ gnucash/trunk/src/business/business-utils/business-options.h	2010-03-02 21:41:05 UTC (rev 18789)
@@ -33,24 +33,24 @@
 
 
 GncTaxTable* gnc_option_db_lookup_taxtable_option(GNCOptionDB *odb,
-						  const char *section,
-						  const char *name,
-						  GncTaxTable * default_value);
+        const char *section,
+        const char *name,
+        GncTaxTable * default_value);
 
 GncInvoice* gnc_option_db_lookup_invoice_option(GNCOptionDB *odb,
-						const char *section,
-						const char *name,
-						GncInvoice * default_value);
+        const char *section,
+        const char *name,
+        GncInvoice * default_value);
 
 GncCustomer* gnc_option_db_lookup_customer_option(GNCOptionDB *odb,
-						  const char *section,
-						  const char *name,
-						  GncCustomer * default_value);
+        const char *section,
+        const char *name,
+        GncCustomer * default_value);
 
 GncVendor* gnc_option_db_lookup_vendor_option(GNCOptionDB *odb,
-					      const char *section,
-					      const char *name,
-					      GncVendor * default_value);
+        const char *section,
+        const char *name,
+        GncVendor * default_value);
 
 
 #endif /* GNC_BUSINESS_OPTIONS_UTILS_H_ */

Modified: gnucash/trunk/src/business/dialog-tax-table/dialog-tax-table.c
===================================================================
--- gnucash/trunk/src/business/dialog-tax-table/dialog-tax-table.c	2010-03-02 21:40:28 UTC (rev 18788)
+++ gnucash/trunk/src/business/dialog-tax-table/dialog-tax-table.c	2010-03-02 21:41:05 UTC (rev 18789)
@@ -44,17 +44,19 @@
 #define DIALOG_TAX_TABLE_CM_CLASS "tax-table-dialog"
 #define GCONF_SECTION "dialogs/business/tax_tables"
 
-enum tax_table_cols {
-  TAX_TABLE_COL_NAME = 0,
-  TAX_TABLE_COL_POINTER,
-  NUM_TAX_TABLE_COLS
+enum tax_table_cols
+{
+    TAX_TABLE_COL_NAME = 0,
+    TAX_TABLE_COL_POINTER,
+    NUM_TAX_TABLE_COLS
 };
 
-enum tax_entry_cols {
-  TAX_ENTRY_COL_NAME = 0,
-  TAX_ENTRY_COL_POINTER,
-  TAX_ENTRY_COL_AMOUNT,
-  NUM_TAX_ENTRY_COLS
+enum tax_entry_cols
+{
+    TAX_ENTRY_COL_NAME = 0,
+    TAX_ENTRY_COL_POINTER,
+    TAX_ENTRY_COL_AMOUNT,
+    NUM_TAX_ENTRY_COLS
 };
 
 void tax_table_new_table_cb (GtkButton *button, TaxTableWindow *ttw);
@@ -66,252 +68,271 @@
 void tax_table_window_destroy_cb (GtkWidget *widget, gpointer data);
 
 
-struct _taxtable_window {
-  GtkWidget *	dialog;
-  GtkWidget *	names_view;
-  GtkWidget *	entries_view;
+struct _taxtable_window
+{
+    GtkWidget *	dialog;
+    GtkWidget *	names_view;
+    GtkWidget *	entries_view;
 
-  GncTaxTable *	current_table;
-  GncTaxTableEntry *	current_entry;
-  QofBook *	book;
-  gint		component_id;
+    GncTaxTable *	current_table;
+    GncTaxTableEntry *	current_entry;
+    QofBook *	book;
+    gint		component_id;
 };
 
-typedef struct _new_taxtable {
-  GtkWidget *	dialog;
-  GtkWidget *	name_entry;
-  GtkWidget *	amount_entry;
-  GtkWidget *	acct_tree;
+typedef struct _new_taxtable
+{
+    GtkWidget *	dialog;
+    GtkWidget *	name_entry;
+    GtkWidget *	amount_entry;
+    GtkWidget *	acct_tree;
 
-  GncTaxTable *		created_table;
-  TaxTableWindow *	ttw;
-  GncTaxTableEntry *	entry;
-  gint			type;
-  gboolean		new_table;
+    GncTaxTable *		created_table;
+    TaxTableWindow *	ttw;
+    GncTaxTableEntry *	entry;
+    gint			type;
+    gboolean		new_table;
 } NewTaxTable;
 
 
 static gboolean
 new_tax_table_ok_cb (NewTaxTable *ntt)
 {
-  TaxTableWindow *ttw;
-  const char *name = NULL;
-  char *message;
-  Account *acc;
-  gnc_numeric amount;
+    TaxTableWindow *ttw;
+    const char *name = NULL;
+    char *message;
+    Account *acc;
+    gnc_numeric amount;
 
-  g_return_val_if_fail (ntt, FALSE);
-  ttw = ntt->ttw;
+    g_return_val_if_fail (ntt, FALSE);
+    ttw = ntt->ttw;
 
-  /* Verify that we've got real, valid data */
+    /* Verify that we've got real, valid data */
 
-  /* verify the name, maybe */
-  if (ntt->new_table) {
-    name = gtk_entry_get_text (GTK_ENTRY (ntt->name_entry));
-    if (name == NULL || *name == '\0') {
-      message = _("You must provide a name for this Tax Table.");
-      gnc_error_dialog (ntt->dialog, "%s", message);
-      return FALSE;
+    /* verify the name, maybe */
+    if (ntt->new_table)
+    {
+        name = gtk_entry_get_text (GTK_ENTRY (ntt->name_entry));
+        if (name == NULL || *name == '\0')
+        {
+            message = _("You must provide a name for this Tax Table.");
+            gnc_error_dialog (ntt->dialog, "%s", message);
+            return FALSE;
+        }
+        if (gncTaxTableLookupByName (ttw->book, name))
+        {
+            message = g_strdup_printf(_(
+                                          "You must provide a unique name for this Tax Table. "
+                                          "Your choice \"%s\" is already in use."), name);
+            gnc_error_dialog (ntt->dialog, "%s", message);
+            g_free (message);
+            return FALSE;
+        }
     }
-    if (gncTaxTableLookupByName (ttw->book, name)) {
-      message = g_strdup_printf(_(
-			 "You must provide a unique name for this Tax Table. "
-			 "Your choice \"%s\" is already in use."), name);
-      gnc_error_dialog (ntt->dialog, "%s", message);
-      g_free (message);
-      return FALSE;
+
+    /* verify the amount */
+    amount = gnc_amount_edit_get_amount (GNC_AMOUNT_EDIT (ntt->amount_entry));
+    if (gnc_numeric_negative_p (amount))
+    {
+        message = _("Negative amounts are not allowed.");
+        gnc_error_dialog (ntt->dialog, "%s", message);
+        return FALSE;
     }
-  }
+    if (ntt->type == GNC_AMT_TYPE_PERCENT &&
+            gnc_numeric_compare (amount,
+                                 gnc_numeric_create (100, 1)) > 0)
+    {
+        message = _("Percentage amount must be between 0 and 100.");
+        gnc_error_dialog (ntt->dialog, "%s", message);
+        return FALSE;
+    }
 
-  /* verify the amount */
-  amount = gnc_amount_edit_get_amount (GNC_AMOUNT_EDIT (ntt->amount_entry));
-  if (gnc_numeric_negative_p (amount)) {
-    message = _("Negative amounts are not allowed.");
-    gnc_error_dialog (ntt->dialog, "%s", message);
-    return FALSE;
-  }
-  if (ntt->type == GNC_AMT_TYPE_PERCENT &&
-      gnc_numeric_compare (amount,
-			   gnc_numeric_create (100, 1)) > 0) {
-    message = _("Percentage amount must be between 0 and 100.");
-    gnc_error_dialog (ntt->dialog, "%s", message);
-    return FALSE;
-  }							   
+    /* verify the account */
+    acc = gnc_tree_view_account_get_selected_account (GNC_TREE_VIEW_ACCOUNT(ntt->acct_tree));
+    if (acc == NULL)
+    {
+        message = _("You must choose a Tax Account.");
+        gnc_error_dialog (ntt->dialog, "%s", message);
+        return FALSE;
+    }
 
-  /* verify the account */
-  acc = gnc_tree_view_account_get_selected_account (GNC_TREE_VIEW_ACCOUNT(ntt->acct_tree));
-  if (acc == NULL) {
-    message = _("You must choose a Tax Account.");
-    gnc_error_dialog (ntt->dialog, "%s", message);
-    return FALSE;
-  }
+    gnc_suspend_gui_refresh ();
 
-  gnc_suspend_gui_refresh ();
+    /* Ok, it's all valid, now either change to add this thing */
+    if (ntt->new_table)
+    {
+        GncTaxTable *table = gncTaxTableCreate (ttw->book);
+        gncTaxTableBeginEdit (table);
+        gncTaxTableSetName (table, name);
+        /* Reset the current table */
+        ttw->current_table = table;
+        ntt->created_table = table;
+    }
+    else
+        gncTaxTableBeginEdit (ttw->current_table);
 
-  /* Ok, it's all valid, now either change to add this thing */
-  if (ntt->new_table) {
-    GncTaxTable *table = gncTaxTableCreate (ttw->book);
-    gncTaxTableBeginEdit (table);
-    gncTaxTableSetName (table, name);
-    /* Reset the current table */
-    ttw->current_table = table;
-    ntt->created_table = table;
-  } else
-    gncTaxTableBeginEdit (ttw->current_table);
+    /* Create/edit the entry */
+    {
+        GncTaxTableEntry *entry;
 
-  /* Create/edit the entry */
-  {
-    GncTaxTableEntry *entry;
+        if (ntt->entry)
+        {
+            entry = ntt->entry;
+        }
+        else
+        {
+            entry = gncTaxTableEntryCreate ();
+            gncTaxTableAddEntry (ttw->current_table, entry);
+            ttw->current_entry = entry;
+        }
 
-    if (ntt->entry) {
-      entry = ntt->entry;
-    } else {
-      entry = gncTaxTableEntryCreate ();
-      gncTaxTableAddEntry (ttw->current_table, entry);
-      ttw->current_entry = entry;
+        gncTaxTableEntrySetAccount (entry, acc);
+        gncTaxTableEntrySetType (entry, ntt->type);
+        gncTaxTableEntrySetAmount (entry, amount);
     }
 
-    gncTaxTableEntrySetAccount (entry, acc);
-    gncTaxTableEntrySetType (entry, ntt->type);
-    gncTaxTableEntrySetAmount (entry, amount);
-  }
+    /* Mark the table as changed and commit it */
+    gncTaxTableChanged (ttw->current_table);
+    gncTaxTableCommitEdit (ttw->current_table);
 
-  /* Mark the table as changed and commit it */
-  gncTaxTableChanged (ttw->current_table);
-  gncTaxTableCommitEdit (ttw->current_table);
-
-  gnc_resume_gui_refresh();
-  return TRUE;
+    gnc_resume_gui_refresh();
+    return TRUE;
 }
 
 static void
 combo_changed (GtkWidget *widget, NewTaxTable *ntt)
 {
-  gint index;
+    gint index;
 
-  g_return_if_fail(GTK_IS_COMBO_BOX(widget));
-  g_return_if_fail(ntt);
+    g_return_if_fail(GTK_IS_COMBO_BOX(widget));
+    g_return_if_fail(ntt);
 
-  index = gtk_combo_box_get_active(GTK_COMBO_BOX(widget));
-  ntt->type = index + 1;
+    index = gtk_combo_box_get_active(GTK_COMBO_BOX(widget));
+    ntt->type = index + 1;
 }
 
 static GncTaxTable *
 new_tax_table_dialog (TaxTableWindow *ttw, gboolean new_table,
-		      GncTaxTableEntry *entry, const char *name)
+                      GncTaxTableEntry *entry, const char *name)
 {
-  GncTaxTable *created_table = NULL;
-  NewTaxTable *ntt;
-  GladeXML *xml;
-  GtkWidget *box, *widget, *combo;
-  gboolean done;
-  gint response, index;
+    GncTaxTable *created_table = NULL;
+    NewTaxTable *ntt;
+    GladeXML *xml;
+    GtkWidget *box, *widget, *combo;
+    gboolean done;
+    gint response, index;
 
-  if (!ttw) return NULL;
-  if (new_table && entry) return NULL;
+    if (!ttw) return NULL;
+    if (new_table && entry) return NULL;
 
-  ntt = g_new0 (NewTaxTable, 1);
-  ntt->ttw = ttw;
-  ntt->entry = entry;
-  ntt->new_table = new_table;
+    ntt = g_new0 (NewTaxTable, 1);
+    ntt->ttw = ttw;
+    ntt->entry = entry;
+    ntt->new_table = new_table;
 
-  if (entry)
-    ntt->type = gncTaxTableEntryGetType (entry);
-  else
-    ntt->type = GNC_AMT_TYPE_PERCENT;
+    if (entry)
+        ntt->type = gncTaxTableEntryGetType (entry);
+    else
+        ntt->type = GNC_AMT_TYPE_PERCENT;
 
-  /* Open and read the XML */
-  xml = gnc_glade_xml_new ("tax-tables.glade", "New Tax Table Dialog");
-  ntt->dialog = glade_xml_get_widget (xml, "New Tax Table Dialog");
-  ntt->name_entry = glade_xml_get_widget (xml, "name_entry");
-  if (name)
-    gtk_entry_set_text (GTK_ENTRY (ntt->name_entry), name);
+    /* Open and read the XML */
+    xml = gnc_glade_xml_new ("tax-tables.glade", "New Tax Table Dialog");
+    ntt->dialog = glade_xml_get_widget (xml, "New Tax Table Dialog");
+    ntt->name_entry = glade_xml_get_widget (xml, "name_entry");
+    if (name)
+        gtk_entry_set_text (GTK_ENTRY (ntt->name_entry), name);
 
-  /* Create the menu */
-  combo = glade_xml_get_widget (xml, "type_combobox");
-  index = ntt->type ? ntt->type : GNC_AMT_TYPE_VALUE;
-  gtk_combo_box_set_active(GTK_COMBO_BOX(combo), index - 1);
-  g_signal_connect (combo, "changed", G_CALLBACK (combo_changed), ntt);
+    /* Create the menu */
+    combo = glade_xml_get_widget (xml, "type_combobox");
+    index = ntt->type ? ntt->type : GNC_AMT_TYPE_VALUE;
+    gtk_combo_box_set_active(GTK_COMBO_BOX(combo), index - 1);
+    g_signal_connect (combo, "changed", G_CALLBACK (combo_changed), ntt);
 
-  /* Attach our own widgets */
-  box = glade_xml_get_widget (xml, "amount_box");
-  ntt->amount_entry = widget = gnc_amount_edit_new ();
-  gnc_amount_edit_set_evaluate_on_enter (GNC_AMOUNT_EDIT (widget), TRUE);
-  gnc_amount_edit_set_fraction (GNC_AMOUNT_EDIT (widget), 100000);
-  gtk_box_pack_start (GTK_BOX (box), widget, TRUE, TRUE, 0);
+    /* Attach our own widgets */
+    box = glade_xml_get_widget (xml, "amount_box");
+    ntt->amount_entry = widget = gnc_amount_edit_new ();
+    gnc_amount_edit_set_evaluate_on_enter (GNC_AMOUNT_EDIT (widget), TRUE);
+    gnc_amount_edit_set_fraction (GNC_AMOUNT_EDIT (widget), 100000);
+    gtk_box_pack_start (GTK_BOX (box), widget, TRUE, TRUE, 0);
 
-  box = glade_xml_get_widget (xml, "acct_window");
-  ntt->acct_tree = GTK_WIDGET(gnc_tree_view_account_new (FALSE));
-  gtk_container_add (GTK_CONTAINER (box), ntt->acct_tree);
-  gtk_tree_view_set_headers_visible (GTK_TREE_VIEW(ntt->acct_tree), FALSE);
+    box = glade_xml_get_widget (xml, "acct_window");
+    ntt->acct_tree = GTK_WIDGET(gnc_tree_view_account_new (FALSE));
+    gtk_container_add (GTK_CONTAINER (box), ntt->acct_tree);
+    gtk_tree_view_set_headers_visible (GTK_TREE_VIEW(ntt->acct_tree), FALSE);
 
-  /* Make 'enter' do the right thing */
-  gtk_entry_set_activates_default(GTK_ENTRY (gnc_amount_edit_gtk_entry
-					     (GNC_AMOUNT_EDIT (ntt->amount_entry))),
-				  TRUE);
+    /* Make 'enter' do the right thing */
+    gtk_entry_set_activates_default(GTK_ENTRY (gnc_amount_edit_gtk_entry
+                                    (GNC_AMOUNT_EDIT (ntt->amount_entry))),
+                                    TRUE);
 
-  /* Fix mnemonics for generated target widgets */
-  widget = glade_xml_get_widget (xml, "value_label");
-  gtk_label_set_mnemonic_widget (GTK_LABEL (widget), ntt->amount_entry);
-  widget = glade_xml_get_widget (xml, "account_label");
-  gtk_label_set_mnemonic_widget (GTK_LABEL (widget), ntt->acct_tree);
+    /* Fix mnemonics for generated target widgets */
+    widget = glade_xml_get_widget (xml, "value_label");
+    gtk_label_set_mnemonic_widget (GTK_LABEL (widget), ntt->amount_entry);
+    widget = glade_xml_get_widget (xml, "account_label");
+    gtk_label_set_mnemonic_widget (GTK_LABEL (widget), ntt->acct_tree);
 
-  /* Fill in the widgets appropriately */
-  if (entry) {
-    gnc_amount_edit_set_amount (GNC_AMOUNT_EDIT (ntt->amount_entry),
-				gncTaxTableEntryGetAmount (entry));
-    gnc_tree_view_account_set_selected_account (GNC_TREE_VIEW_ACCOUNT (ntt->acct_tree),
-						gncTaxTableEntryGetAccount (entry));
-  }
+    /* Fill in the widgets appropriately */
+    if (entry)
+    {
+        gnc_amount_edit_set_amount (GNC_AMOUNT_EDIT (ntt->amount_entry),
+                                    gncTaxTableEntryGetAmount (entry));
+        gnc_tree_view_account_set_selected_account (GNC_TREE_VIEW_ACCOUNT (ntt->acct_tree),
+                gncTaxTableEntryGetAccount (entry));
+    }
 
-  /* Set our parent */
-  gtk_window_set_transient_for (GTK_WINDOW(ntt->dialog), GTK_WINDOW(ttw->dialog));
+    /* Set our parent */
+    gtk_window_set_transient_for (GTK_WINDOW(ntt->dialog), GTK_WINDOW(ttw->dialog));
 
-  /* Setup signals */
-  glade_xml_signal_autoconnect_full( xml,
-                                     gnc_glade_autoconnect_full_func,
-                                     ntt);
+    /* Setup signals */
+    glade_xml_signal_autoconnect_full( xml,
+                                       gnc_glade_autoconnect_full_func,
+                                       ntt);
 
-  /* Show what we should */
-  gtk_widget_show_all (ntt->dialog);
-  if (new_table == FALSE) {
-    gtk_widget_hide (glade_xml_get_widget (xml, "table_title"));
-    gtk_widget_hide (glade_xml_get_widget (xml, "table_name"));
-    gtk_widget_hide (glade_xml_get_widget (xml, "spacer"));
-    gtk_widget_hide (ntt->name_entry);
-    /* Tables are great for layout, but a pain when you hide widgets */
-    widget = glade_xml_get_widget (xml, "ttd_table");
-    gtk_table_set_row_spacing (GTK_TABLE(widget), 0, 0);
-    gtk_table_set_row_spacing (GTK_TABLE(widget), 1, 0);
-    gtk_table_set_row_spacing (GTK_TABLE(widget), 2, 0);
-    gtk_widget_grab_focus (gnc_amount_edit_gtk_entry
-			   (GNC_AMOUNT_EDIT (ntt->amount_entry)));
-  } else
-    gtk_widget_grab_focus (ntt->name_entry);
+    /* Show what we should */
+    gtk_widget_show_all (ntt->dialog);
+    if (new_table == FALSE)
+    {
+        gtk_widget_hide (glade_xml_get_widget (xml, "table_title"));
+        gtk_widget_hide (glade_xml_get_widget (xml, "table_name"));
+        gtk_widget_hide (glade_xml_get_widget (xml, "spacer"));
+        gtk_widget_hide (ntt->name_entry);
+        /* Tables are great for layout, but a pain when you hide widgets */
+        widget = glade_xml_get_widget (xml, "ttd_table");
+        gtk_table_set_row_spacing (GTK_TABLE(widget), 0, 0);
+        gtk_table_set_row_spacing (GTK_TABLE(widget), 1, 0);
+        gtk_table_set_row_spacing (GTK_TABLE(widget), 2, 0);
+        gtk_widget_grab_focus (gnc_amount_edit_gtk_entry
+                               (GNC_AMOUNT_EDIT (ntt->amount_entry)));
+    }
+    else
+        gtk_widget_grab_focus (ntt->name_entry);
 
-  /* Display the dialog now that we're done manipulating it */
-  gtk_widget_show (ntt->dialog);
+    /* Display the dialog now that we're done manipulating it */
+    gtk_widget_show (ntt->dialog);
 
-  done = FALSE;
-  while (!done) {
-    response = gtk_dialog_run (GTK_DIALOG (ntt->dialog));
-    switch (response) {
-     case GTK_RESPONSE_OK:
-      if (new_tax_table_ok_cb (ntt)) {
-	created_table = ntt->created_table;
-	done = TRUE;
-      }
-      break;
-     default:
-      done = TRUE;
-      break;
+    done = FALSE;
+    while (!done)
+    {
+        response = gtk_dialog_run (GTK_DIALOG (ntt->dialog));
+        switch (response)
+        {
+        case GTK_RESPONSE_OK:
+            if (new_tax_table_ok_cb (ntt))
+            {
+                created_table = ntt->created_table;
+                done = TRUE;
+            }
+            break;
+        default:
+            done = TRUE;
+            break;
+        }
     }
-  }
 
-  gtk_widget_destroy(ntt->dialog);
-  g_free(ntt);
+    gtk_widget_destroy(ntt->dialog);
+    g_free(ntt);
 
-  return created_table;
+    return created_table;
 }
 
 /***********************************************************************/
@@ -319,444 +340,461 @@
 static void
 tax_table_entries_refresh (TaxTableWindow *ttw)
 {
-  GList *list, *node;
-  GtkTreeView *view;
-  GtkListStore *store;
-  GtkTreeIter iter;
-  GtkTreePath *path;
-  GtkTreeSelection *selection;
-  GtkTreeRowReference *reference = NULL;
-  GncTaxTableEntry *selected_entry;
+    GList *list, *node;
+    GtkTreeView *view;
+    GtkListStore *store;
+    GtkTreeIter iter;
+    GtkTreePath *path;
+    GtkTreeSelection *selection;
+    GtkTreeRowReference *reference = NULL;
+    GncTaxTableEntry *selected_entry;
 
-  g_return_if_fail (ttw);
+    g_return_if_fail (ttw);
 
-  view = GTK_TREE_VIEW (ttw->entries_view);
-  store = GTK_LIST_STORE(gtk_tree_view_get_model(view));
+    view = GTK_TREE_VIEW (ttw->entries_view);
+    store = GTK_LIST_STORE(gtk_tree_view_get_model(view));
 
-  /* Clear the list */
-  selected_entry = ttw->current_entry;
-  gtk_list_store_clear (store);
-  if (ttw->current_table == NULL)
-    return;
+    /* Clear the list */
+    selected_entry = ttw->current_entry;
+    gtk_list_store_clear (store);
+    if (ttw->current_table == NULL)
+        return;
 
-  /* Add the items to the list */
-  list = gncTaxTableGetEntries (ttw->current_table);
-  if (list)
-    list = g_list_reverse (g_list_copy (list));
+    /* Add the items to the list */
+    list = gncTaxTableGetEntries (ttw->current_table);
+    if (list)
+        list = g_list_reverse (g_list_copy (list));
 
-  for (node = list ; node; node = node->next) {
-    char *row_text[3];
-    GncTaxTableEntry *entry = node->data;
-    Account *acc = gncTaxTableEntryGetAccount (entry);
-    gnc_numeric amount = gncTaxTableEntryGetAmount (entry);
+    for (node = list ; node; node = node->next)
+    {
+        char *row_text[3];
+        GncTaxTableEntry *entry = node->data;
+        Account *acc = gncTaxTableEntryGetAccount (entry);
+        gnc_numeric amount = gncTaxTableEntryGetAmount (entry);
 
-    row_text[0] = gnc_account_get_full_name (acc);
-    switch (gncTaxTableEntryGetType (entry)) {
-    case GNC_AMT_TYPE_PERCENT:
-     row_text[1] =
-       g_strdup_printf ("%s%%",
-			xaccPrintAmount (amount,
-					 gnc_default_print_info (FALSE)));
-     break;
-    default:
-      row_text[1] =
-	g_strdup_printf ("%s",
-			 xaccPrintAmount (amount,
-					  gnc_default_print_info (TRUE)));
-      break;
-    }
+        row_text[0] = gnc_account_get_full_name (acc);
+        switch (gncTaxTableEntryGetType (entry))
+        {
+        case GNC_AMT_TYPE_PERCENT:
+            row_text[1] =
+                g_strdup_printf ("%s%%",
+                                 xaccPrintAmount (amount,
+                                                  gnc_default_print_info (FALSE)));
+            break;
+        default:
+            row_text[1] =
+                g_strdup_printf ("%s",
+                                 xaccPrintAmount (amount,
+                                                  gnc_default_print_info (TRUE)));
+            break;
+        }
 
-    gtk_list_store_prepend(store, &iter);
-    gtk_list_store_set(store, &iter,
-		       TAX_ENTRY_COL_NAME, row_text[0],
-		       TAX_ENTRY_COL_POINTER, entry,
-		       TAX_ENTRY_COL_AMOUNT, row_text[1],
-		       -1);
-    if (entry == selected_entry) {
-      path = gtk_tree_model_get_path(GTK_TREE_MODEL(store), &iter);
-      reference = gtk_tree_row_reference_new(GTK_TREE_MODEL(store), path);
-      gtk_tree_path_free(path);
+        gtk_list_store_prepend(store, &iter);
+        gtk_list_store_set(store, &iter,
+                           TAX_ENTRY_COL_NAME, row_text[0],
+                           TAX_ENTRY_COL_POINTER, entry,
+                           TAX_ENTRY_COL_AMOUNT, row_text[1],
+                           -1);
+        if (entry == selected_entry)
+        {
+            path = gtk_tree_model_get_path(GTK_TREE_MODEL(store), &iter);
+            reference = gtk_tree_row_reference_new(GTK_TREE_MODEL(store), path);
+            gtk_tree_path_free(path);
+        }
+
+        g_free (row_text[0]);
+        g_free (row_text[1]);
     }
 
-    g_free (row_text[0]);
-    g_free (row_text[1]);
-  }
-
-  if (reference) {
-    path = gtk_tree_row_reference_get_path(reference);
-    gtk_tree_row_reference_free(reference);
-    if (path) {
-      selection = gtk_tree_view_get_selection(view);
-      gtk_tree_selection_select_path(selection, path);
-      gtk_tree_view_scroll_to_cell(view, path, NULL, TRUE, 0.5, 0.0);
-      gtk_tree_path_free(path);
+    if (reference)
+    {
+        path = gtk_tree_row_reference_get_path(reference);
+        gtk_tree_row_reference_free(reference);
+        if (path)
+        {
+            selection = gtk_tree_view_get_selection(view);
+            gtk_tree_selection_select_path(selection, path);
+            gtk_tree_view_scroll_to_cell(view, path, NULL, TRUE, 0.5, 0.0);
+            gtk_tree_path_free(path);
+        }
     }
-  }
 }
 
 static void
 tax_table_window_refresh (TaxTableWindow *ttw)
 {
-  GList *list, *node;
-  GtkTreeView *view;
-  GtkListStore *store;
-  GtkTreeIter iter;
-  GtkTreePath *path;
-  GtkTreeSelection *selection;
-  GtkTreeRowReference *reference = NULL;
+    GList *list, *node;
+    GtkTreeView *view;
+    GtkListStore *store;
+    GtkTreeIter iter;
+    GtkTreePath *path;
+    GtkTreeSelection *selection;
+    GtkTreeRowReference *reference = NULL;
 
-  g_return_if_fail (ttw);
-  view = GTK_TREE_VIEW (ttw->names_view);
-  store = GTK_LIST_STORE(gtk_tree_view_get_model(view));
+    g_return_if_fail (ttw);
+    view = GTK_TREE_VIEW (ttw->names_view);
+    store = GTK_LIST_STORE(gtk_tree_view_get_model(view));
 
-  /* Clear the list */
-  gtk_list_store_clear(store);
+    /* Clear the list */
+    gtk_list_store_clear(store);
 
-  gnc_gui_component_clear_watches (ttw->component_id);
+    gnc_gui_component_clear_watches (ttw->component_id);
 
-  /* Add the items to the list */
-  list = gncTaxTableGetTables (ttw->book);
-  if (list)    
-    list = g_list_reverse (g_list_copy (list));
+    /* Add the items to the list */
+    list = gncTaxTableGetTables (ttw->book);
+    if (list)
+        list = g_list_reverse (g_list_copy (list));
 
-  for (node = list; node; node = node->next) {
-    GncTaxTable *table = node->data;
+    for (node = list; node; node = node->next)
+    {
+        GncTaxTable *table = node->data;
 
-    gnc_gui_component_watch_entity (ttw->component_id,
-				    gncTaxTableGetGUID (table),
-				    QOF_EVENT_MODIFY);
+        gnc_gui_component_watch_entity (ttw->component_id,
+                                        gncTaxTableGetGUID (table),
+                                        QOF_EVENT_MODIFY);
 
-    gtk_list_store_prepend(store, &iter);
-    gtk_list_store_set(store, &iter,
-		       TAX_TABLE_COL_NAME, gncTaxTableGetName (table),
-		       TAX_TABLE_COL_POINTER, table,
-		       -1);
-    if (table == ttw->current_table) {
-      path = gtk_tree_model_get_path(GTK_TREE_MODEL(store), &iter);
-      reference = gtk_tree_row_reference_new(GTK_TREE_MODEL(store), path);
-      gtk_tree_path_free(path);
+        gtk_list_store_prepend(store, &iter);
+        gtk_list_store_set(store, &iter,
+                           TAX_TABLE_COL_NAME, gncTaxTableGetName (table),
+                           TAX_TABLE_COL_POINTER, table,
+                           -1);
+        if (table == ttw->current_table)
+        {
+            path = gtk_tree_model_get_path(GTK_TREE_MODEL(store), &iter);
+            reference = gtk_tree_row_reference_new(GTK_TREE_MODEL(store), path);
+            gtk_tree_path_free(path);
+        }
     }
-  }
 
-  if (list)
-    g_list_free (list);
+    if (list)
+        g_list_free (list);
 
-  gnc_gui_component_watch_entity_type (ttw->component_id,
-				       GNC_TAXTABLE_MODULE_NAME,
-				       QOF_EVENT_CREATE | QOF_EVENT_DESTROY);
+    gnc_gui_component_watch_entity_type (ttw->component_id,
+                                         GNC_TAXTABLE_MODULE_NAME,
+                                         QOF_EVENT_CREATE | QOF_EVENT_DESTROY);
 
-  if (reference) {
-    path = gtk_tree_row_reference_get_path(reference);
-    gtk_tree_row_reference_free(reference);
-    if (path) {
-      selection = gtk_tree_view_get_selection(view);
-      gtk_tree_selection_select_path(selection, path);
-      gtk_tree_view_scroll_to_cell(view, path, NULL, TRUE, 0.5, 0.0);
-      gtk_tree_path_free(path);
+    if (reference)
+    {
+        path = gtk_tree_row_reference_get_path(reference);
+        gtk_tree_row_reference_free(reference);
+        if (path)
+        {
+            selection = gtk_tree_view_get_selection(view);
+            gtk_tree_selection_select_path(selection, path);
+            gtk_tree_view_scroll_to_cell(view, path, NULL, TRUE, 0.5, 0.0);
+            gtk_tree_path_free(path);
+        }
     }
-  }
-  ;;  tax_table_entries_refresh (ttw);
-  /* select_row() above will refresh the entries window */
+    ;;
+    tax_table_entries_refresh (ttw);
+    /* select_row() above will refresh the entries window */
 }
 
 static void
 tax_table_selection_changed (GtkTreeSelection *selection,
-			     gpointer          user_data)
+                             gpointer          user_data)
 {
-  TaxTableWindow *ttw = user_data;
-  GncTaxTable *table;
-  GtkTreeModel *model;
-  GtkTreeIter iter;
+    TaxTableWindow *ttw = user_data;
+    GncTaxTable *table;
+    GtkTreeModel *model;
+    GtkTreeIter iter;
 
-  g_return_if_fail (ttw);
+    g_return_if_fail (ttw);
 
-  if (!gtk_tree_selection_get_selected(selection, &model, &iter))
-    return;
+    if (!gtk_tree_selection_get_selected(selection, &model, &iter))
+        return;
 
-  gtk_tree_model_get(model, &iter, TAX_TABLE_COL_POINTER, &table, -1);
-  g_return_if_fail (table);
+    gtk_tree_model_get(model, &iter, TAX_TABLE_COL_POINTER, &table, -1);
+    g_return_if_fail (table);
 
-  /* If we've changed, then reset the entry list */
-  if (table != ttw->current_table) {
-    ttw->current_table = table;
-    ttw->current_entry = NULL;
-  }
-  /* And force a refresh of the entries */
-  tax_table_entries_refresh (ttw);
+    /* If we've changed, then reset the entry list */
+    if (table != ttw->current_table)
+    {
+        ttw->current_table = table;
+        ttw->current_entry = NULL;
+    }
+    /* And force a refresh of the entries */
+    tax_table_entries_refresh (ttw);
 }
 
 static void
 tax_table_entry_selection_changed (GtkTreeSelection *selection,
-				   gpointer          user_data)
+                                   gpointer          user_data)
 {
-  TaxTableWindow *ttw = user_data;
-  GtkTreeModel *model;
-  GtkTreeIter iter;
+    TaxTableWindow *ttw = user_data;
+    GtkTreeModel *model;
+    GtkTreeIter iter;
 
-  g_return_if_fail (ttw);
+    g_return_if_fail (ttw);
 
-  if (!gtk_tree_selection_get_selected(selection, &model, &iter)) {
-    ttw->current_entry = NULL;
-    return;
-  }
+    if (!gtk_tree_selection_get_selected(selection, &model, &iter))
+    {
+        ttw->current_entry = NULL;
+        return;
+    }
 
-  gtk_tree_model_get(model, &iter, TAX_ENTRY_COL_POINTER, &ttw->current_entry, -1);
+    gtk_tree_model_get(model, &iter, TAX_ENTRY_COL_POINTER, &ttw->current_entry, -1);
 }
 
 static void
 tax_table_entry_row_activated (GtkTreeView       *tree_view,
-			       GtkTreePath       *path,
-			       GtkTreeViewColumn *column,
-			       gpointer           user_data)
+                               GtkTreePath       *path,
+                               GtkTreeViewColumn *column,
+                               gpointer           user_data)
 {
-  TaxTableWindow *ttw = user_data;
+    TaxTableWindow *ttw = user_data;
 
-  new_tax_table_dialog (ttw, FALSE, ttw->current_entry, NULL);
+    new_tax_table_dialog (ttw, FALSE, ttw->current_entry, NULL);
 }
 
 void
 tax_table_new_table_cb (GtkButton *button, TaxTableWindow *ttw)
 {
-  g_return_if_fail (ttw);
-  new_tax_table_dialog (ttw, TRUE, NULL, NULL);
+    g_return_if_fail (ttw);
+    new_tax_table_dialog (ttw, TRUE, NULL, NULL);
 }
 
 void
 tax_table_delete_table_cb (GtkButton *button, TaxTableWindow *ttw)
 {
-  g_return_if_fail (ttw);
+    g_return_if_fail (ttw);
 
-  if (!ttw->current_table)
-    return;
+    if (!ttw->current_table)
+        return;
 
-  if (gncTaxTableGetRefcount (ttw->current_table) > 0) {
-    char *message =
-      g_strdup_printf (_("Tax table \"%s\" is in use.  You cannot delete it."),
-		       gncTaxTableGetName (ttw->current_table));
-    gnc_error_dialog (ttw->dialog, "%s", message);
-    g_free (message);
-    return;
-  }
+    if (gncTaxTableGetRefcount (ttw->current_table) > 0)
+    {
+        char *message =
+            g_strdup_printf (_("Tax table \"%s\" is in use.  You cannot delete it."),
+                             gncTaxTableGetName (ttw->current_table));
+        gnc_error_dialog (ttw->dialog, "%s", message);
+        g_free (message);
+        return;
+    }
 
-  if (gnc_verify_dialog (ttw->dialog, FALSE,
-			 _("Are you sure you want to delete \"%s\"?"),
-			 gncTaxTableGetName (ttw->current_table))) {
-    /* Ok, let's remove it */
-    gnc_suspend_gui_refresh ();
-    gncTaxTableBeginEdit (ttw->current_table);
-    gncTaxTableDestroy (ttw->current_table);
-    ttw->current_table = NULL;
-    ttw->current_entry = NULL;
-    gnc_resume_gui_refresh ();
-  }
+    if (gnc_verify_dialog (ttw->dialog, FALSE,
+                           _("Are you sure you want to delete \"%s\"?"),
+                           gncTaxTableGetName (ttw->current_table)))
+    {
+        /* Ok, let's remove it */
+        gnc_suspend_gui_refresh ();
+        gncTaxTableBeginEdit (ttw->current_table);
+        gncTaxTableDestroy (ttw->current_table);
+        ttw->current_table = NULL;
+        ttw->current_entry = NULL;
+        gnc_resume_gui_refresh ();
+    }
 }
 
 void
 tax_table_new_entry_cb (GtkButton *button, TaxTableWindow *ttw)
 {
-  g_return_if_fail (ttw);
-  if (!ttw->current_table)
-    return;
-  new_tax_table_dialog (ttw, FALSE, NULL, NULL);
+    g_return_if_fail (ttw);
+    if (!ttw->current_table)
+        return;
+    new_tax_table_dialog (ttw, FALSE, NULL, NULL);
 }
 
 void
 tax_table_edit_entry_cb (GtkButton *button, TaxTableWindow *ttw)
 {
-  g_return_if_fail (ttw);
-  if (!ttw->current_entry)
-    return;
-  new_tax_table_dialog (ttw, FALSE, ttw->current_entry, NULL);
+    g_return_if_fail (ttw);
+    if (!ttw->current_entry)
+        return;
+    new_tax_table_dialog (ttw, FALSE, ttw->current_entry, NULL);
 }
 
 void
 tax_table_delete_entry_cb (GtkButton *button, TaxTableWindow *ttw)
 {
-  g_return_if_fail (ttw);
-  if (!ttw->current_table || !ttw->current_entry)
-    return;
+    g_return_if_fail (ttw);
+    if (!ttw->current_table || !ttw->current_entry)
+        return;
 
-  if (g_list_length (gncTaxTableGetEntries (ttw->current_table)) <= 1) {
-    char *message = _("You cannot remove the last entry from the tax table. "
-		      "Try deleting the tax table if you want to do that.");
-    gnc_error_dialog (ttw->dialog, "%s", message);
-    return;
-  }
+    if (g_list_length (gncTaxTableGetEntries (ttw->current_table)) <= 1)
+    {
+        char *message = _("You cannot remove the last entry from the tax table. "
+                          "Try deleting the tax table if you want to do that.");
+        gnc_error_dialog (ttw->dialog, "%s", message);
+        return;
+    }
 
-  if (gnc_verify_dialog (ttw->dialog, FALSE, "%s",
-			 _("Are you sure you want to delete this entry?"))) {
-    /* Ok, let's remove it */
-    gnc_suspend_gui_refresh ();
-    gncTaxTableBeginEdit (ttw->current_table);
-    gncTaxTableRemoveEntry (ttw->current_table, ttw->current_entry);
-    gncTaxTableEntryDestroy (ttw->current_entry);
-    gncTaxTableChanged (ttw->current_table);
-    gncTaxTableCommitEdit (ttw->current_table);
-    ttw->current_entry = NULL;
-    gnc_resume_gui_refresh ();
-  }
+    if (gnc_verify_dialog (ttw->dialog, FALSE, "%s",
+                           _("Are you sure you want to delete this entry?")))
+    {
+        /* Ok, let's remove it */
+        gnc_suspend_gui_refresh ();
+        gncTaxTableBeginEdit (ttw->current_table);
+        gncTaxTableRemoveEntry (ttw->current_table, ttw->current_entry);
+        gncTaxTableEntryDestroy (ttw->current_entry);
+        gncTaxTableChanged (ttw->current_table);
+        gncTaxTableCommitEdit (ttw->current_table);
+        ttw->current_entry = NULL;
+        gnc_resume_gui_refresh ();
+    }
 }
 
 static void
 tax_table_window_refresh_handler (GHashTable *changes, gpointer data)
 {
-  TaxTableWindow *ttw = data;
+    TaxTableWindow *ttw = data;
 
-  g_return_if_fail (data);
-  tax_table_window_refresh (ttw);
+    g_return_if_fail (data);
+    tax_table_window_refresh (ttw);
 }
 
 static void
 tax_table_window_close_handler (gpointer data)
 {
-  TaxTableWindow *ttw = data;
-  g_return_if_fail (ttw);
+    TaxTableWindow *ttw = data;
+    g_return_if_fail (ttw);
 
-  gtk_widget_destroy (ttw->dialog);
+    gtk_widget_destroy (ttw->dialog);
 }
 
 void
 tax_table_window_close (GtkWidget *widget, gpointer data)
 {
-  TaxTableWindow *ttw = data;
+    TaxTableWindow *ttw = data;
 
-  gnc_save_window_size (GCONF_SECTION, GTK_WINDOW (ttw->dialog));
-  gnc_ui_tax_table_window_destroy (ttw);
+    gnc_save_window_size (GCONF_SECTION, GTK_WINDOW (ttw->dialog));
+    gnc_ui_tax_table_window_destroy (ttw);
 }
 
 void
 tax_table_window_destroy_cb (GtkWidget *widget, gpointer data)
 {
-  TaxTableWindow *ttw = data;
+    TaxTableWindow *ttw = data;
 
-  if (!ttw) return;
+    if (!ttw) return;
 
-  gnc_unregister_gui_component (ttw->component_id);
+    gnc_unregister_gui_component (ttw->component_id);
 
-  g_free (ttw);
+    g_free (ttw);
 }
 
 static gboolean
 find_handler (gpointer find_data, gpointer user_data)
 {
-  TaxTableWindow *ttw = user_data;
-  QofBook *book = find_data;
+    TaxTableWindow *ttw = user_data;
+    QofBook *book = find_data;
 
-  return (ttw != NULL && ttw->book == book);
+    return (ttw != NULL && ttw->book == book);
 }
 
 /* Create a tax-table window */
 TaxTableWindow *
 gnc_ui_tax_table_window_new (QofBook *book)
 {
-  TaxTableWindow *ttw;
-  GladeXML *xml;
-  GtkTreeView *view;
-  GtkTreeViewColumn *column;
-  GtkCellRenderer *renderer;
-  GtkListStore *store;
-  GtkTreeSelection *selection;
+    TaxTableWindow *ttw;
+    GladeXML *xml;
+    GtkTreeView *view;
+    GtkTreeViewColumn *column;
+    GtkCellRenderer *renderer;
+    GtkListStore *store;
+    GtkTreeSelection *selection;
 
-  if (!book) return NULL;
+    if (!book) return NULL;
 
-  /*
-   * Find an existing tax-table window.  If found, bring it to
-   * the front.  If we have an actual owner, then set it in
-   * the window.
-   */
-  ttw = gnc_find_first_gui_component (DIALOG_TAX_TABLE_CM_CLASS, find_handler,
-				      book);
-  if (ttw) {
-    gtk_window_present (GTK_WINDOW(ttw->dialog));
-    return ttw;
-  }
+    /*
+     * Find an existing tax-table window.  If found, bring it to
+     * the front.  If we have an actual owner, then set it in
+     * the window.
+     */
+    ttw = gnc_find_first_gui_component (DIALOG_TAX_TABLE_CM_CLASS, find_handler,
+                                        book);
+    if (ttw)
+    {
+        gtk_window_present (GTK_WINDOW(ttw->dialog));
+        return ttw;
+    }
 
-  /* Didn't find one -- create a new window */
-  ttw = g_new0 (TaxTableWindow, 1);
-  ttw->book = book;
+    /* Didn't find one -- create a new window */
+    ttw = g_new0 (TaxTableWindow, 1);
+    ttw->book = book;
 
-  /* Open and read the XML */
-  xml = gnc_glade_xml_new ("tax-tables.glade", "Tax Table Window");
-  ttw->dialog = glade_xml_get_widget (xml, "Tax Table Window");
-  ttw->names_view = glade_xml_get_widget (xml, "tax_tables_view");
-  ttw->entries_view = glade_xml_get_widget (xml, "tax_table_entries");
+    /* Open and read the XML */
+    xml = gnc_glade_xml_new ("tax-tables.glade", "Tax Table Window");
+    ttw->dialog = glade_xml_get_widget (xml, "Tax Table Window");
+    ttw->names_view = glade_xml_get_widget (xml, "tax_tables_view");
+    ttw->entries_view = glade_xml_get_widget (xml, "tax_table_entries");
 
-  /* Create the tax tables view */
-  view = GTK_TREE_VIEW(ttw->names_view);
-  store = gtk_list_store_new (NUM_TAX_TABLE_COLS, G_TYPE_STRING,
-			      G_TYPE_POINTER);
-  gtk_tree_view_set_model(view, GTK_TREE_MODEL(store));
-  g_object_unref(store);
+    /* Create the tax tables view */
+    view = GTK_TREE_VIEW(ttw->names_view);
+    store = gtk_list_store_new (NUM_TAX_TABLE_COLS, G_TYPE_STRING,
+                                G_TYPE_POINTER);
+    gtk_tree_view_set_model(view, GTK_TREE_MODEL(store));
+    g_object_unref(store);
 
-  renderer = gtk_cell_renderer_text_new();
-  column = gtk_tree_view_column_new_with_attributes("", renderer,
-						    "text", TAX_TABLE_COL_NAME,
-						    NULL);
-  gtk_tree_view_append_column(view, column);
+    renderer = gtk_cell_renderer_text_new();
+    column = gtk_tree_view_column_new_with_attributes("", renderer,
+             "text", TAX_TABLE_COL_NAME,
+             NULL);
+    gtk_tree_view_append_column(view, column);
 
-  selection = gtk_tree_view_get_selection(view);
-  g_signal_connect(selection, "changed",
-		   G_CALLBACK(tax_table_selection_changed), ttw);
+    selection = gtk_tree_view_get_selection(view);
+    g_signal_connect(selection, "changed",
+                     G_CALLBACK(tax_table_selection_changed), ttw);
 
 
-  /* Create the tax table entries view */
-  view = GTK_TREE_VIEW(ttw->entries_view);
-  store = gtk_list_store_new (NUM_TAX_ENTRY_COLS, G_TYPE_STRING,
-			      G_TYPE_POINTER, G_TYPE_STRING);
-  gtk_tree_view_set_model(view, GTK_TREE_MODEL(store));
-  g_object_unref(store);
+    /* Create the tax table entries view */
+    view = GTK_TREE_VIEW(ttw->entries_view);
+    store = gtk_list_store_new (NUM_TAX_ENTRY_COLS, G_TYPE_STRING,
+                                G_TYPE_POINTER, G_TYPE_STRING);
+    gtk_tree_view_set_model(view, GTK_TREE_MODEL(store));
+    g_object_unref(store);
 
-  renderer = gtk_cell_renderer_text_new();
-  column = gtk_tree_view_column_new_with_attributes("", renderer,
-						    "text", TAX_ENTRY_COL_NAME,
-						    NULL);
-  gtk_tree_view_append_column(view, column);
+    renderer = gtk_cell_renderer_text_new();
+    column = gtk_tree_view_column_new_with_attributes("", renderer,
+             "text", TAX_ENTRY_COL_NAME,
+             NULL);
+    gtk_tree_view_append_column(view, column);
 
-  selection = gtk_tree_view_get_selection(view);
-  g_signal_connect(selection, "changed",
-		   G_CALLBACK(tax_table_entry_selection_changed), ttw);
-  g_signal_connect(view, "row-activated",
-		   G_CALLBACK(tax_table_entry_row_activated), ttw);
+    selection = gtk_tree_view_get_selection(view);
+    g_signal_connect(selection, "changed",
+                     G_CALLBACK(tax_table_entry_selection_changed), ttw);
+    g_signal_connect(view, "row-activated",
+                     G_CALLBACK(tax_table_entry_row_activated), ttw);
 
 
-  /* Setup signals */
-  glade_xml_signal_autoconnect_full( xml,
-                                     gnc_glade_autoconnect_full_func,
-                                     ttw);
+    /* Setup signals */
+    glade_xml_signal_autoconnect_full( xml,
+                                       gnc_glade_autoconnect_full_func,
+                                       ttw);
 
-  /* register with component manager */
-  ttw->component_id =
-    gnc_register_gui_component (DIALOG_TAX_TABLE_CM_CLASS,
-				tax_table_window_refresh_handler,
-				tax_table_window_close_handler,
-				ttw);
+    /* register with component manager */
+    ttw->component_id =
+        gnc_register_gui_component (DIALOG_TAX_TABLE_CM_CLASS,
+                                    tax_table_window_refresh_handler,
+                                    tax_table_window_close_handler,
+                                    ttw);
 
-  tax_table_window_refresh (ttw);
-  gnc_restore_window_size (GCONF_SECTION, GTK_WINDOW (ttw->dialog));
-  gtk_widget_show_all (ttw->dialog);
-  return ttw;
+    tax_table_window_refresh (ttw);
+    gnc_restore_window_size (GCONF_SECTION, GTK_WINDOW (ttw->dialog));
+    gtk_widget_show_all (ttw->dialog);
+    return ttw;
 }
 
 /* Destroy a tax-table window */
 void
 gnc_ui_tax_table_window_destroy (TaxTableWindow *ttw)
 {
-  if (!ttw)
-    return;
+    if (!ttw)
+        return;
 
-  gnc_close_gui_component (ttw->component_id);
+    gnc_close_gui_component (ttw->component_id);
 }
 
 /* Create a new tax-table by name */
 GncTaxTable *
 gnc_ui_tax_table_new_from_name (QofBook *book, const char *name)
 {
-  TaxTableWindow *ttw;
+    TaxTableWindow *ttw;
 
-  if (!book) return NULL;
+    if (!book) return NULL;
 
-  ttw = gnc_ui_tax_table_window_new (book);
-  if (!ttw) return NULL;
+    ttw = gnc_ui_tax_table_window_new (book);
+    if (!ttw) return NULL;
 
-  return new_tax_table_dialog (ttw, TRUE, NULL, name);
+    return new_tax_table_dialog (ttw, TRUE, NULL, name);
 }



More information about the gnucash-changes mailing list