* business-gnome/dialog-payment.[ch] --add API to create the payment
	  dialog with an initial value
	* business-gnome/dialog-invoice.c -- call the new payment API when
	  you try to pay an invoice from the invoice window or the invoice
	  search results.

	* business-ledger/gncEntryLedger.c -- fix vendor bills to print
	  subtotals properly on the current-line.


git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@7217 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
Derek Atkins 2002-09-16 02:08:57 +00:00
parent 52f9e80a0c
commit d082473846
5 changed files with 46 additions and 7 deletions

View File

@ -4,6 +4,16 @@
* src/business/dialog-tax-table/tax-tables.glade
make resizable; increase default account-tree size
* fix bug #93333
* business-gnome/dialog-payment.[ch] --add API to create the payment
dialog with an initial value
* business-gnome/dialog-invoice.c -- call the new payment API when
you try to pay an invoice from the invoice window or the invoice
search results.
* business-ledger/gncEntryLedger.c -- fix vendor bills to print
subtotals properly on the current-line.
2002-09-15 Joshua Sled <jsled@asynchronous.org>
* src/gnome-utils/gnc-dense-cal.c (gnc_dense_cal_mark): Fix

View File

@ -658,10 +658,14 @@ void gnc_invoice_window_billterm_cb (GtkWidget *widget, gpointer data)
void gnc_invoice_window_payment_cb (GtkWidget *widget, gpointer data)
{
InvoiceWindow *iw = data;
GncInvoice *invoice = iw_get_invoice(iw);
GNCLot *lot = gncInvoiceGetPostedLot (invoice);
gnc_numeric val = gnc_numeric_abs (gnc_lot_get_balance (lot));
if (gncOwnerGetJob (&iw->job))
gnc_ui_payment_new (&iw->job, iw->book);
gnc_ui_payment_new_with_value (&iw->job, iw->book, val);
else
gnc_ui_payment_new (&iw->owner, iw->book);
gnc_ui_payment_new_with_value (&iw->owner, iw->book, val);
}
/* Sorting callbacks */
@ -1872,6 +1876,8 @@ pay_invoice_cb (gpointer *invoice_p, gpointer user_data)
{
struct _invoice_select_window *sw = user_data;
GncInvoice *invoice;
GNCLot *lot;
gnc_numeric val;
g_return_if_fail (invoice_p && user_data);
@ -1880,7 +1886,9 @@ pay_invoice_cb (gpointer *invoice_p, gpointer user_data)
if (!invoice)
return;
gnc_ui_payment_new (gncInvoiceGetOwner (invoice), sw->book);
lot = gncInvoiceGetPostedLot (invoice);
val = gnc_numeric_abs (gnc_lot_get_balance (lot));
gnc_ui_payment_new_with_value (gncInvoiceGetOwner (invoice), sw->book, val);
}
static gpointer

View File

@ -355,7 +355,7 @@ find_handler (gpointer find_data, gpointer user_data)
}
static PaymentWindow *
new_payment_window (GncOwner *owner, GNCBook *book)
new_payment_window (GncOwner *owner, GNCBook *book, gnc_numeric initial_payment)
{
PaymentWindow *pw;
GladeXML *xml;
@ -406,6 +406,7 @@ new_payment_window (GncOwner *owner, GNCBook *book)
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), initial_payment);
box = glade_xml_get_widget (xml, "date_box");
pw->date_edit = gnc_date_edit_new (time(NULL), FALSE, FALSE);
@ -461,7 +462,8 @@ gnc_ui_payment_window_destroy (PaymentWindow *pw)
}
PaymentWindow *
gnc_ui_payment_new (GncOwner *owner, GNCBook *book)
gnc_ui_payment_new_with_value (GncOwner *owner, GNCBook *book,
gnc_numeric initial_payment)
{
GncOwner owner_def;
@ -474,6 +476,12 @@ gnc_ui_payment_new (GncOwner *owner, GNCBook *book)
owner = &owner_def;
}
return new_payment_window (owner, book);
return new_payment_window (owner, book, initial_payment);
}
PaymentWindow *
gnc_ui_payment_new (GncOwner *owner, GNCBook *book)
{
return gnc_ui_payment_new_with_value (owner, book, gnc_numeric_zero());
}

View File

@ -14,6 +14,8 @@ typedef struct _payment_window PaymentWindow;
/* Create a payment window */
PaymentWindow * gnc_ui_payment_new (GncOwner *owner, GNCBook *book);
PaymentWindow * gnc_ui_payment_new_with_value (GncOwner *owner, GNCBook *book,
gnc_numeric initial_payment);
/* Destroy a payment window */
void gnc_ui_payment_window_destroy (PaymentWindow *pw);

View File

@ -556,8 +556,19 @@ gnc_entry_ledger_compute_value (GncEntryLedger *ledger,
disc_type = gnc_entry_ledger_get_type (ledger, ENTRY_DISTYPE_CELL);
disc_how = gnc_entry_ledger_get_type (ledger, ENTRY_DISHOW_CELL);
/* Bills dont have discounts */
if (ledger->type == GNCENTRY_BILL_ENTRY ||
ledger->type == GNCENTRY_BILL_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 (disc_type < 0 || disc_how < 0)
{
if (value)
*value = gnc_numeric_zero ();
if (tax_value)