* gncInvoice.[ch]: create gncInvoiceGetTotal(), which currently does

nothing but will eventually return the actual invoice total.
	* dialog-invoice.c: add a summary bar with the invoice total
	* invoice.glade: add a summary bar dock at the bottom of the page.
	Partial fix for bug #96833


git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@7410 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
Derek Atkins 2002-10-28 01:44:18 +00:00
parent 3ac7f92900
commit d245d4607b
5 changed files with 116 additions and 1 deletions

View File

@ -1,3 +1,10 @@
2002-10-27 Derek Atkins <derek@ihtfp.com>
* gncInvoice.[ch]: create gncInvoiceGetTotal(), which currently does
nothing but will eventually return the actual invoice total.
* dialog-invoice.c: add a summary bar with the invoice total
* invoice.glade: add a summary bar dock at the bottom of the page.
Partial fix for bug #96833
2002-10-27 Christian Stimming <stimming@tuhh.de> 2002-10-27 Christian Stimming <stimming@tuhh.de>
* src/import-export/hbci/*.c: add #include config.h for correct * src/import-export/hbci/*.c: add #include config.h for correct

View File

@ -373,6 +373,13 @@ const char * gncInvoiceGetNotes (GncInvoice *invoice)
return invoice->notes; return invoice->notes;
} }
gnc_numeric gncInvoiceGetTotal (GncInvoice *invoice)
{
gnc_numeric total = { 200, 100 };
if (!invoice) return gnc_numeric_zero();
return total;
}
static GncOwnerType gncInvoiceGetOwnerType (GncInvoice *invoice) static GncOwnerType gncInvoiceGetOwnerType (GncInvoice *invoice)
{ {
GncOwner *owner; GncOwner *owner;

View File

@ -63,6 +63,9 @@ GNCLot * gncInvoiceGetPostedLot (GncInvoice *invoice);
Transaction * gncInvoiceGetPostedTxn (GncInvoice *invoice); Transaction * gncInvoiceGetPostedTxn (GncInvoice *invoice);
Account * gncInvoiceGetPostedAcc (GncInvoice *invoice); Account * gncInvoiceGetPostedAcc (GncInvoice *invoice);
/* return the "total" amount of the invoice */
gnc_numeric gncInvoiceGetTotal (GncInvoice *invoice);
GList * gncInvoiceGetEntries (GncInvoice *invoice); GList * gncInvoiceGetEntries (GncInvoice *invoice);
/* Post this invoice to an account. Returns the new Transaction /* Post this invoice to an account. Returns the new Transaction

View File

@ -90,6 +90,10 @@ struct _invoice_window {
GtkWidget * print_button; GtkWidget * print_button;
GtkWidget * post_button; GtkWidget * post_button;
/* Summary Bar Widgets */
GtkWidget * summarybar_dock;
GtkWidget * total_label;
/* Menu Widgets */ /* Menu Widgets */
GtkWidget * menu_print; GtkWidget * menu_print;
GtkWidget * menu_cut; GtkWidget * menu_cut;
@ -171,6 +175,7 @@ void gnc_invoice_window_sort_price_cb (GtkWidget *widget, gpointer data);
void gnc_invoice_window_toolbar_cb (GtkWidget *widget, gpointer data); void gnc_invoice_window_toolbar_cb (GtkWidget *widget, gpointer data);
void gnc_invoice_window_statusbar_cb (GtkWidget *widget, gpointer data); void gnc_invoice_window_statusbar_cb (GtkWidget *widget, gpointer data);
void gnc_invoice_window_summarybar_cb (GtkWidget *widget, gpointer data);
#define INV_WIDTH_PREFIX "invoice_reg" #define INV_WIDTH_PREFIX "invoice_reg"
#define BILL_WIDTH_PREFIX "bill_reg" #define BILL_WIDTH_PREFIX "bill_reg"
@ -787,6 +792,54 @@ void gnc_invoice_window_statusbar_cb (GtkWidget *widget, gpointer data)
} }
} }
void
gnc_invoice_window_summarybar_cb (GtkWidget *widget, gpointer data)
{
InvoiceWindow *iw = data;
GtkCheckMenuItem *checkmenu = GTK_CHECK_MENU_ITEM(widget);
if (checkmenu->active) {
gtk_widget_show(iw->summarybar_dock);
} else {
gtk_widget_hide(iw->summarybar_dock);
gtk_widget_queue_resize(iw->summarybar_dock);
}
}
static GtkWidget *
add_summary_label (GtkWidget *summarybar, const char *label_str)
{
GtkWidget *hbox;
GtkWidget *label;
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 ("");
gtk_misc_set_alignment (GTK_MISC(label), 1.0, 0.5);
gtk_box_pack_start (GTK_BOX(hbox), label, FALSE, FALSE, 0);
return label;
}
static GtkWidget *
gnc_invoice_window_create_summary_bar (InvoiceWindow *iw)
{
GtkWidget *summarybar;
iw->total_label = NULL;
summarybar = gtk_hbox_new (FALSE, 4);
iw->total_label = add_summary_label (summarybar, _("Total:"));
return summarybar;
}
static GtkWidget * static GtkWidget *
gnc_invoice_window_create_popup_menu (InvoiceWindow *iw) gnc_invoice_window_create_popup_menu (InvoiceWindow *iw)
{ {
@ -1148,10 +1201,26 @@ gnc_invoice_window_close_handler (gpointer user_data)
static void static void
gnc_invoice_redraw_all_cb (GnucashRegister *g_reg, gpointer data) gnc_invoice_redraw_all_cb (GnucashRegister *g_reg, gpointer data)
{ {
// InvoiceWindow *iw = data; InvoiceWindow *iw = data;
GncInvoice * invoice;
gnc_numeric amount;
char string[256];
if (!iw)
return;
// if (iw) // if (iw)
// gnc_invoice_update_window (iw); // gnc_invoice_update_window (iw);
invoice = iw_get_invoice (iw);
if (!invoice)
return;
if (iw->total_label) {
amount = gncInvoiceGetTotal(invoice);
xaccSPrintAmount (string, amount, gnc_default_print_info (TRUE));
gtk_label_set_text (GTK_LABEL (iw->total_label), string);
}
} }
static void static void
@ -1577,6 +1646,16 @@ gnc_invoice_new_window (GNCBook *bookp, InvoiceDialogType type,
/* grab the statusbar */ /* grab the statusbar */
iw->statusbar = glade_xml_get_widget (xml, "status_bar"); iw->statusbar = glade_xml_get_widget (xml, "status_bar");
/* grab/build the summarybar */
{
GtkWidget * summarybar = gnc_invoice_window_create_summary_bar (iw);
iw->summarybar_dock = glade_xml_get_widget (xml, "summarybar_dock");
if (summarybar) {
gtk_widget_show_all (summarybar);
gtk_container_add (GTK_CONTAINER (iw->summarybar_dock), summarybar);
}
}
hbox = glade_xml_get_widget (xml, "date_opened_hbox"); hbox = glade_xml_get_widget (xml, "date_opened_hbox");
iw->opened_date = gnc_date_edit_new (time(NULL), FALSE, FALSE); iw->opened_date = gnc_date_edit_new (time(NULL), FALSE, FALSE);
gtk_box_pack_start (GTK_BOX(hbox), iw->opened_date, TRUE, TRUE, 0); gtk_box_pack_start (GTK_BOX(hbox), iw->opened_date, TRUE, TRUE, 0);

View File

@ -1360,6 +1360,25 @@
</widget> </widget>
</widget> </widget>
<widget>
<class>GnomeDockItem</class>
<name>summarybar_dock</name>
<placement>GNOME_DOCK_BOTTOM</placement>
<band>0</band>
<position>0</position>
<offset>0</offset>
<locked>False</locked>
<exclusive>False</exclusive>
<never_floating>False</never_floating>
<never_vertical>False</never_vertical>
<never_horizontal>False</never_horizontal>
<shadow_type>GTK_SHADOW_OUT</shadow_type>
<widget>
<class>Placeholder</class>
</widget>
</widget>
<widget> <widget>
<class>GtkVBox</class> <class>GtkVBox</class>
<child_name>GnomeDock:contents</child_name> <child_name>GnomeDock:contents</child_name>