mirror of
https://github.com/Gnucash/gnucash.git
synced 2025-02-25 18:55:30 -06:00
Add "Tax Value" cell
git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@6632 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
@@ -23,7 +23,7 @@
|
||||
<type>GTK_WINDOW_TOPLEVEL</type>
|
||||
<position>GTK_WIN_POS_NONE</position>
|
||||
<modal>False</modal>
|
||||
<default_width>890</default_width>
|
||||
<default_width>950</default_width>
|
||||
<allow_shrink>True</allow_shrink>
|
||||
<allow_grow>True</allow_grow>
|
||||
<auto_shrink>False</auto_shrink>
|
||||
|
||||
@@ -45,6 +45,7 @@ typedef struct entry_ledger_colors
|
||||
|
||||
#define ENTRY_INV_CELL "invoiced-p"
|
||||
#define ENTRY_VALUE_CELL "line-value"
|
||||
#define ENTRY_TAXVAL_CELL "line-tax-val"
|
||||
|
||||
typedef struct GncEntryLedger_s GncEntryLedger;
|
||||
|
||||
|
||||
@@ -77,7 +77,9 @@ static void gnc_entry_ledger_layout_add_cells (GncEntryLedger *ledger,
|
||||
{ ENTRY_INV_CELL, RECN_CELL_TYPE_NAME, N_("sample:X")+7,
|
||||
CELL_ALIGN_RIGHT, FALSE, FALSE },
|
||||
{ ENTRY_VALUE_CELL, PRICE_CELL_TYPE_NAME, N_("sample:999,999.00")+7,
|
||||
CELL_ALIGN_RIGHT, FALSE, FALSE }
|
||||
CELL_ALIGN_RIGHT, FALSE, FALSE },
|
||||
{ ENTRY_TAXVAL_CELL, PRICE_CELL_TYPE_NAME, N_("sample:999.00")+7,
|
||||
CELL_ALIGN_RIGHT, FALSE, FALSE },
|
||||
};
|
||||
int i;
|
||||
|
||||
@@ -98,7 +100,7 @@ static void gnc_entry_ledger_layout_add_cursors (GncEntryLedger *ledger,
|
||||
case GNCENTRY_ORDER_VIEWER:
|
||||
case GNCENTRY_INVOICE_ENTRY:
|
||||
case GNCENTRY_INVOICE_VIEWER:
|
||||
num_cols = 13;
|
||||
num_cols = 14;
|
||||
break;
|
||||
default:
|
||||
g_assert (FALSE);
|
||||
@@ -139,6 +141,7 @@ static void gnc_entry_ledger_set_cells (GncEntryLedger *ledger,
|
||||
gnc_table_layout_set_cell (layout, curs, ENTRY_TAX_CELL, 0, x++);
|
||||
gnc_table_layout_set_cell (layout, curs, ENTRY_TAXACC_CELL, 0, x++);
|
||||
gnc_table_layout_set_cell (layout, curs, ENTRY_VALUE_CELL, 0, x++);
|
||||
gnc_table_layout_set_cell (layout, curs, ENTRY_TAXVAL_CELL, 0, x++);
|
||||
|
||||
break;
|
||||
|
||||
|
||||
@@ -95,7 +95,12 @@ static const char * get_inv_label (VirtualLocation virt_loc, gpointer data)
|
||||
|
||||
static const char * get_value_label (VirtualLocation virt_loc, gpointer data)
|
||||
{
|
||||
return _("Value");
|
||||
return _("Subtotal");
|
||||
}
|
||||
|
||||
static const char * get_taxval_label (VirtualLocation virt_loc, gpointer data)
|
||||
{
|
||||
return _("Tax");
|
||||
}
|
||||
|
||||
/* GET_ENTRY */
|
||||
@@ -350,6 +355,44 @@ static const char * get_value_entry (VirtualLocation virt_loc,
|
||||
return xaccPrintAmount (value, gnc_default_print_info (TRUE));
|
||||
}
|
||||
|
||||
static const char * get_taxval_entry (VirtualLocation virt_loc,
|
||||
gboolean translate,
|
||||
gboolean *conditionally_changed,
|
||||
gpointer user_data)
|
||||
{
|
||||
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_numeric qty, price, discount, tax;
|
||||
gint disc_type, tax_type;
|
||||
|
||||
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_TAX_CELL, &tax);
|
||||
|
||||
disc_type = gnc_entry_ledger_get_type (ledger, ENTRY_DISTYPE_CELL);
|
||||
tax_type = gnc_entry_ledger_get_type (ledger, ENTRY_TAXTYPE_CELL);
|
||||
|
||||
gncEntryComputeValue (qty, price, tax, tax_type, discount, disc_type,
|
||||
NULL, &value);
|
||||
} else {
|
||||
GncEntry *entry = gnc_entry_ledger_get_entry (ledger, virt_loc.vcell_loc);
|
||||
|
||||
if (entry == gncEntryLookup (ledger->book, &(ledger->blank_entry_guid)))
|
||||
return NULL;
|
||||
|
||||
gncEntryGetValue (entry, NULL, &value);
|
||||
}
|
||||
if (gnc_numeric_zero_p (value))
|
||||
return NULL;
|
||||
|
||||
return xaccPrintAmount (value, gnc_default_print_info (TRUE));
|
||||
}
|
||||
|
||||
/* GET_HELP */
|
||||
|
||||
static char * get_acct_help (VirtualLocation virt_loc, gpointer user_data)
|
||||
@@ -535,7 +578,19 @@ static char * get_value_help (VirtualLocation virt_loc, gpointer user_data)
|
||||
|
||||
help = gnc_table_get_entry (ledger->table, virt_loc);
|
||||
if (!help || *help == '\0')
|
||||
help = _("The value of this entry ");
|
||||
help = _("The subtotal value of this entry ");
|
||||
|
||||
return g_strdup (help);
|
||||
}
|
||||
|
||||
static char * get_taxval_help (VirtualLocation virt_loc, gpointer user_data)
|
||||
{
|
||||
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 ");
|
||||
|
||||
return g_strdup (help);
|
||||
}
|
||||
@@ -799,6 +854,7 @@ static void gnc_entry_ledger_model_new_handlers (TableModel *model,
|
||||
{ ENTRY_TAX_CELL, get_tax_entry, get_tax_label, get_tax_help, get_standard_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 },
|
||||
};
|
||||
int i;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user