* src/scm/report/transaction-report.scm: fix i18n bug

* src/scm/report/register.scm: more work

	* src/SplitLedger.c: update for api change

	* src/gnome/window-register.c: update for api change

	* src/engine/Transaction.c (xaccSplitGetCorrAccountName): update
	name used for split transactions
	(xaccSplitGetOtherSplit): rename to be more consistent

	* src/gnome/gnc-dialogs.glade: use 'contains' instead of
	'matches' in search dialog

	* src/guile/gnc.gwp: update for api changes below

	* src/engine/Account.c: use US in api names and tags of
	US-specific tax info.


git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@3833 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
Dave Peticolas
2001-03-26 11:05:57 +00:00
parent fab325e309
commit 6ecf215be2
12 changed files with 139 additions and 108 deletions

View File

@@ -1,3 +1,25 @@
2001-03-26 Dave Peticolas <dave@krondo.com>
* src/scm/report/transaction-report.scm: fix i18n bug
* src/scm/report/register.scm: more work
* src/SplitLedger.c: update for api change
* src/gnome/window-register.c: update for api change
* src/engine/Transaction.c (xaccSplitGetCorrAccountName): update
name used for split transactions
(xaccSplitGetOtherSplit): rename to be more consistent
* src/gnome/gnc-dialogs.glade: use 'contains' instead of
'matches' in search dialog
* src/guile/gnc.gwp: update for api changes below
* src/engine/Account.c: use US in api names and tags of
US-specific tax info.
2001-03-25 Dave Peticolas <dave@krondo.com>
* src/test/test-exp-parser.c (test_parser): add / 0 test

View File

@@ -817,7 +817,7 @@ sr_balance_trans (SplitRegister *reg, Transaction *trans)
gboolean two_accounts;
split = xaccTransGetSplit (trans, 0);
other_split = xaccGetOtherSplit (split);
other_split = xaccSplitGetOtherSplit (split);
if (other_split == NULL)
{
@@ -3284,13 +3284,13 @@ xaccSRSaveChangedCells (SplitRegister *reg, Transaction *trans, Split *split)
}
if (reg->style == REG_STYLE_LEDGER && !info->trans_expanded)
other_split = xaccGetOtherSplit (split);
other_split = xaccSplitGetOtherSplit (split);
if (MOD_MXFRM & changed)
{
DEBUG ("MOD_MXFRM: %s", reg->mxfrmCell->cell.value);
other_split = xaccGetOtherSplit (split);
other_split = xaccSplitGetOtherSplit (split);
/* other_split may be null for two very different reasons:
* (1) the parent transaction has three or more splits in it,
@@ -3811,7 +3811,7 @@ xaccSRGetEntryHandler (VirtualLocation virt_loc,
case MXFRM_CELL:
{
Split *s = xaccGetOtherSplit (split);
Split *s = xaccSplitGetOtherSplit (split);
static char *name = NULL;
g_free (name);

View File

@@ -1557,14 +1557,14 @@ xaccAccountSetTaxRelated (Account *account, gboolean tax_related)
}
const char *
xaccAccountGetTaxCode (Account *account)
xaccAccountGetTaxUSCode (Account *account)
{
kvp_value *value;
if (!account)
return FALSE;
value = kvp_frame_get_slot_path (account->kvp_data, "tax", "code", NULL);
value = kvp_frame_get_slot_path (account->kvp_data, "tax-US", "code", NULL);
if (!value)
return NULL;
@@ -1572,7 +1572,7 @@ xaccAccountGetTaxCode (Account *account)
}
void
xaccAccountSetTaxCode (Account *account, const char *code)
xaccAccountSetTaxUSCode (Account *account, const char *code)
{
kvp_frame *frame;
@@ -1581,7 +1581,7 @@ xaccAccountSetTaxCode (Account *account, const char *code)
xaccAccountBeginEdit (account);
frame = kvp_frame_get_frame (account->kvp_data, "tax", NULL);
frame = kvp_frame_get_frame (account->kvp_data, "tax-US", NULL);
kvp_frame_set_slot_nc (frame, "code",
code ? kvp_value_new_string (code) : NULL);
@@ -1592,7 +1592,7 @@ xaccAccountSetTaxCode (Account *account, const char *code)
}
const char *
xaccAccountGetTaxPayerNameSource (Account *account)
xaccAccountGetTaxUSPayerNameSource (Account *account)
{
kvp_value *value;
@@ -1600,7 +1600,7 @@ xaccAccountGetTaxPayerNameSource (Account *account)
return FALSE;
value = kvp_frame_get_slot_path (account->kvp_data,
"tax", "payer-name-source", NULL);
"tax-US", "payer-name-source", NULL);
if (!value)
return NULL;
@@ -1608,7 +1608,7 @@ xaccAccountGetTaxPayerNameSource (Account *account)
}
void
xaccAccountSetTaxPayerNameSource (Account *account, const char *source)
xaccAccountSetTaxUSPayerNameSource (Account *account, const char *source)
{
kvp_frame *frame;
@@ -1617,7 +1617,7 @@ xaccAccountSetTaxPayerNameSource (Account *account, const char *source)
xaccAccountBeginEdit (account);
frame = kvp_frame_get_frame (account->kvp_data, "tax", NULL);
frame = kvp_frame_get_frame (account->kvp_data, "tax-US", NULL);
kvp_frame_set_slot_nc (frame, "payer-name-source",
source ? kvp_value_new_string (source) : NULL);

View File

@@ -261,11 +261,11 @@ gboolean xaccAccountGetTaxRelated (Account *account);
void xaccAccountSetTaxRelated (Account *account,
gboolean tax_related);
const char * xaccAccountGetTaxCode (Account *account);
void xaccAccountSetTaxCode (Account *account, const char *code);
const char * xaccAccountGetTaxPayerNameSource (Account *account);
void xaccAccountSetTaxPayerNameSource (Account *account,
const char *source);
const char * xaccAccountGetTaxUSCode (Account *account);
void xaccAccountSetTaxUSCode (Account *account, const char *code);
const char * xaccAccountGetTaxUSPayerNameSource (Account *account);
void xaccAccountSetTaxUSPayerNameSource (Account *account,
const char *source);
/* The xaccAccountGetFullName routine returns the fully qualified name
* of the account using the given separator char. The name must be freed

View File

@@ -1975,7 +1975,7 @@ xaccSplitGetCorrAccountName(Split *sa)
if(get_corr_account_split(sa, &other_split))
{
if (!split_const)
split_const = _("Split");
split_const = _("-- Split Transaction --");
return split_const;
}
@@ -2528,7 +2528,7 @@ xaccGetAccountByFullName (Transaction *trans, const char * name,
\********************************************************************/
Split *
xaccGetOtherSplit (Split *split)
xaccSplitGetOtherSplit (Split *split)
{
Split *s1, *s2;
Transaction *trans;

View File

@@ -555,11 +555,11 @@ Account * xaccGetAccountByFullName (Transaction *trans,
const char separator);
/*
* The xaccGetOtherSplit() is a convenience routine that returns
* The xaccSplitGetOtherSplit() is a convenience routine that returns
* the other of a pair of splits. If there are more than two
* splits, it returns NULL.
*/
Split * xaccGetOtherSplit (Split *split);
Split * xaccSplitGetOtherSplit (Split *split);
/* The xaccIsPeerSplit() is a convenience routine that returns
* a non-zero value if the two splits share a common

View File

@@ -98,12 +98,12 @@ Entities: Split
Use: xaccSplitGetType, xaccSplitMakeStockSplit
Store a string representing the type of split, if not normal.
Name: tax/code
Name: tax-US/code
Type: string
Entities: Account
Use: see src/scm/report/[tax,txf]*.scm
Name: tax/payer-name-source
Name: tax-US/payer-name-source
Type: string
Entities: Account
Use: see src/scm/report/[tax,txf]*.scm

View File

@@ -979,7 +979,7 @@ create_Find_Transactions (void)
gtk_container_add (GTK_CONTAINER (frame8), vbox16);
gtk_container_set_border_width (GTK_CONTAINER (vbox16), 5);
label752 = gtk_label_new (_("Find transactions whose Description matches:"));
label752 = gtk_label_new (_("Find transactions whose Description contains:"));
gtk_widget_ref (label752);
gtk_object_set_data_full (GTK_OBJECT (Find_Transactions), "label752", label752,
(GtkDestroyNotify) gtk_widget_unref);
@@ -1037,7 +1037,7 @@ create_Find_Transactions (void)
gtk_container_add (GTK_CONTAINER (frame15), vbox42);
gtk_container_set_border_width (GTK_CONTAINER (vbox42), 5);
label761 = gtk_label_new (_("Find transactions whose Number matches:"));
label761 = gtk_label_new (_("Find transactions whose Number contains:"));
gtk_widget_ref (label761);
gtk_object_set_data_full (GTK_OBJECT (Find_Transactions), "label761", label761,
(GtkDestroyNotify) gtk_widget_unref);
@@ -1195,7 +1195,7 @@ create_Find_Transactions (void)
gtk_container_add (GTK_CONTAINER (frame10), vbox22);
gtk_container_set_border_width (GTK_CONTAINER (vbox22), 5);
label759 = gtk_label_new (_("Find splits whose Memo matches:"));
label759 = gtk_label_new (_("Find splits whose Memo contains:"));
gtk_widget_ref (label759);
gtk_object_set_data_full (GTK_OBJECT (Find_Transactions), "label759", label759,
(GtkDestroyNotify) gtk_widget_unref);
@@ -1393,7 +1393,7 @@ create_Find_Transactions (void)
gtk_container_add (GTK_CONTAINER (frame20), vbox50);
gtk_container_set_border_width (GTK_CONTAINER (vbox50), 5);
label772 = gtk_label_new (_("Find transactions whose Action matches:"));
label772 = gtk_label_new (_("Find transactions whose Action contains:"));
gtk_widget_ref (label772);
gtk_object_set_data_full (GTK_OBJECT (Find_Transactions), "label772", label772,
(GtkDestroyNotify) gtk_widget_unref);

View File

@@ -1432,7 +1432,7 @@ None
<widget>
<class>GtkLabel</class>
<name>label752</name>
<label>Find transactions whose Description matches:</label>
<label>Find transactions whose Description contains:</label>
<justify>GTK_JUSTIFY_CENTER</justify>
<wrap>False</wrap>
<xalign>7.45058e-09</xalign>
@@ -1533,7 +1533,7 @@ None
<widget>
<class>GtkLabel</class>
<name>label761</name>
<label>Find transactions whose Number matches:</label>
<label>Find transactions whose Number contains:</label>
<justify>GTK_JUSTIFY_CENTER</justify>
<wrap>False</wrap>
<xalign>7.45058e-09</xalign>
@@ -1786,7 +1786,7 @@ Exactly
<widget>
<class>GtkLabel</class>
<name>label759</name>
<label>Find splits whose Memo matches:</label>
<label>Find splits whose Memo contains:</label>
<justify>GTK_JUSTIFY_CENTER</justify>
<wrap>False</wrap>
<xalign>7.45058e-09</xalign>
@@ -2101,7 +2101,7 @@ Exactly
<widget>
<class>GtkLabel</class>
<name>label772</name>
<label>Find transactions whose Action matches:</label>
<label>Find transactions whose Action contains:</label>
<justify>GTK_JUSTIFY_CENTER</justify>
<wrap>False</wrap>
<xalign>7.45058e-09</xalign>

View File

@@ -1138,7 +1138,7 @@ jump_cb(GtkWidget *widget, gpointer data)
if (account == leader)
{
split = xaccGetOtherSplit(split);
split = xaccSplitGetOtherSplit(split);
if (split == NULL)
return;

View File

@@ -19,25 +19,25 @@
(cons tag rest)))))
(apply gnc:html-table-set-row-style! arg-list)))
(define (used-date columns-used)
(define (date-col columns-used)
(vector-ref columns-used 0))
(define (used-num columns-used)
(define (num-col columns-used)
(vector-ref columns-used 1))
(define (used-description columns-used)
(define (description-col columns-used)
(vector-ref columns-used 2))
(define (used-account columns-used)
(define (account-col columns-used)
(vector-ref columns-used 3))
(define (used-shares columns-used)
(define (shares-col columns-used)
(vector-ref columns-used 4))
(define (used-price columns-used)
(define (price-col columns-used)
(vector-ref columns-used 5))
(define (used-amount-single columns-used)
(define (amount-single-col columns-used)
(vector-ref columns-used 6))
(define (used-amount-double-positive columns-used)
(define (debit-col columns-used)
(vector-ref columns-used 7))
(define (used-amount-double-negative columns-used)
(define (debit-col columns-used)
(vector-ref columns-used 8))
(define (used-running-balance columns-used)
(define (balance-col columns-used)
(vector-ref columns-used 9))
(define columns-used-size 10)
@@ -52,55 +52,60 @@
(define (opt-val section name)
(gnc:option-value
(gnc:lookup-option options section name)))
(define (make-set-col col-vector)
(let ((col 0))
(lambda (used? index)
(if used?
(begin
(vector-set! col-vector index col)
(set! col (+ col 1)))
(vector-set! col-vector index #f)))))
(let ((column-list (make-vector columns-used-size #f)))
(if (opt-val (N_ "Display") (N_ "Date"))
(vector-set! column-list 0 #t))
(if (opt-val (N_ "Display") (N_ "Num"))
(vector-set! column-list 1 #t))
(if (opt-val (N_ "Display") (N_ "Description"))
(vector-set! column-list 2 #t))
(if (opt-val (N_ "Display") (N_ "Account"))
(vector-set! column-list 3 #t))
(if (opt-val (N_ "Display") (N_ "Shares"))
(vector-set! column-list 4 #t))
(if (opt-val (N_ "Display") (N_ "Price"))
(vector-set! column-list 5 #t))
(let ((amount-setting (opt-val (N_ "Display") (N_ "Amount"))))
(let* ((col-vector (make-vector columns-used-size #f))
(set-col (make-set-col col-vector)))
(set-col (opt-val "Display" "Date") 0)
(set-col (opt-val "Display" "Num") 1)
(set-col (opt-val "Display" "Description") 2)
(set-col (opt-val "Display" "Account") 3)
(set-col (opt-val "Display" "Shares") 4)
(set-col (opt-val "Display" "Price") 5)
(let ((amount-setting (opt-val "Display" "Amount")))
(if (eq? amount-setting 'single)
(vector-set! column-list 6 #t))
(set-col #t 6))
(if (eq? amount-setting 'double)
(begin
(vector-set! column-list 7 #t)
(vector-set! column-list 8 #t))))
(if (opt-val (N_ "Display") (N_ "Running Balance"))
(vector-set! column-list 9 #t))
(begin
(set-col #t 7)
(set-col #t 8))))
(set-col (opt-val "Display" "Running Balance") 9)
column-list))
col-vector))
(define (make-heading-list column-vector debit-string credit-string)
(define (make-heading-list column-vector debit-string credit-string
multi-rows?)
(let ((heading-list '()))
(gnc:debug "Column-vector" column-vector)
(if (used-date column-vector)
(addto! heading-list (N_ "Date")))
(if (used-num column-vector)
(addto! heading-list (N_ "Num")))
(if (used-description column-vector)
(addto! heading-list (N_ "Description")))
(if (used-account column-vector)
(addto! heading-list (N_ "Account")))
(if (used-shares column-vector)
(addto! heading-list (N_ "Shares")))
(if (used-price column-vector)
(addto! heading-list (N_ "Price")))
(if (used-amount-single column-vector)
(addto! heading-list (N_ "Amount")))
(if (used-amount-double-positive column-vector)
(if (date-col column-vector)
(addto! heading-list (_ "Date")))
(if (num-col column-vector)
(addto! heading-list (_ "Num")))
(if (description-col column-vector)
(addto! heading-list (_ "Description")))
(if (account-col column-vector)
(addto! heading-list (if multi-rows?
(_ "Account")
(_ "Transfer"))))
(if (shares-col column-vector)
(addto! heading-list (_ "Shares")))
(if (price-col column-vector)
(addto! heading-list (_ "Price")))
(if (amount-single-col column-vector)
(addto! heading-list (_ "Amount")))
(if (debit-col column-vector)
(addto! heading-list debit-string))
(if (used-amount-double-negative column-vector)
(if (debit-col column-vector)
(addto! heading-list credit-string))
(if (used-running-balance column-vector)
(addto! heading-list (N_ "Balance")))
(if (balance-col column-vector)
(addto! heading-list (_ "Balance")))
(reverse heading-list)))
(define (add-split-row table split column-vector row-style
@@ -112,39 +117,46 @@
(damount (gnc:split-get-share-amount split))
(split-value (gnc:make-gnc-monetary currency damount)))
(if (used-date column-vector)
(if (date-col column-vector)
(addto! row-contents
(if transaction-info?
(gnc:timepair-to-datestring
(gnc:transaction-get-date-posted parent))
" ")))
(if (used-num column-vector)
(if (num-col column-vector)
(addto! row-contents
(if transaction-info?
(gnc:transaction-get-num parent)
" ")))
(if (used-description column-vector)
(if (description-col column-vector)
(addto! row-contents
(if transaction-info?
(gnc:transaction-get-description parent)
" ")))
(if (used-account column-vector)
(if (account-col column-vector)
(addto! row-contents
(if split-info?
(gnc:account-get-name account)
(if transaction-info?
(let ((other-split
(gnc:split-get-other-split split)))
(if other-split
(gnc:account-get-full-name
(gnc:split-get-account other-split))
(_ "-- Split Transaction --")))
(gnc:account-get-full-name account))
" ")))
(if (used-shares column-vector)
(if (shares-col column-vector)
(addto! row-contents
(if split-info?
(gnc:split-get-share-amount split)
" ")))
(if (used-price column-vector)
(if (price-col column-vector)
(addto! row-contents
(if split-info?
(gnc:make-gnc-monetary
currency (gnc:split-get-share-price split))
" ")))
(if (used-amount-single column-vector)
(if (amount-single-col column-vector)
(addto! row-contents
(if split-info?
(gnc:html-split-anchor
@@ -152,7 +164,7 @@
(gnc:make-html-table-header-cell/markup "number-cell"
split-value))
" ")))
(if (used-amount-double-positive column-vector)
(if (debit-col column-vector)
(if (gnc:numeric-positive-p (gnc:gnc-monetary-amount split-value))
(addto! row-contents
(if split-info?
@@ -161,7 +173,7 @@
(gnc:html-split-anchor split split-value))
" "))
(addto! row-contents " ")))
(if (used-amount-double-negative column-vector)
(if (debit-col column-vector)
(if (gnc:numeric-negative-p (gnc:gnc-monetary-amount split-value))
(addto! row-contents
(if split-info?
@@ -171,7 +183,7 @@
split (gnc:monetary-neg split-value)))
" "))
(addto! row-contents " ")))
(if (used-running-balance column-vector)
(if (balance-col column-vector)
(addto! row-contents
(if transaction-info?
(gnc:make-html-table-header-cell/markup
@@ -420,7 +432,7 @@
(gnc:html-table-set-col-headers!
table
(make-heading-list used-columns debit-string credit-string))
(make-heading-list used-columns debit-string credit-string multi-rows?))
(do-rows-with-subtotals splits
table

View File

@@ -180,11 +180,8 @@
(vector-set! column-list 4 #t))
(if (opt-val (N_ "Display") (N_ "Shares"))
(vector-set! column-list 5 #t))
(if (opt-val (N_ "Display") (N_ "Price"))
(vector-set! column-list 6 #t))
; (gnc:warn "Amount Display" (opt-val (N_ "Display") (N_ "Amount")))
(let ((amount-setting (opt-val (N_ "Display") (N_ "Amount"))))
(if (eq? amount-setting 'single)
(vector-set! column-list 7 #t))
@@ -202,28 +199,28 @@
(let ((heading-list '()))
(gnc:debug "Column-vector" column-vector)
(if (used-date column-vector)
(addto! heading-list (N_ "Date")))
(addto! heading-list (_ "Date")))
(if (used-num column-vector)
(addto! heading-list (N_ "Num")))
(addto! heading-list (_ "Num")))
(if (used-description column-vector)
(addto! heading-list (N_ "Description")))
(addto! heading-list (_ "Description")))
(if (used-account column-vector)
(addto! heading-list (N_ "Account")))
(addto! heading-list (_ "Account")))
(if (used-other-account column-vector)
(addto! heading-list (N_ "Transfer from/to")))
(addto! heading-list (_ "Transfer from/to")))
(if (used-shares column-vector)
(addto! heading-list (N_ "Shares")))
(addto! heading-list (_ "Shares")))
(if (used-price column-vector)
(addto! heading-list (N_ "Price")))
(addto! heading-list (_ "Price")))
(if (used-amount-single column-vector)
(addto! heading-list (N_ "Amount")))
(addto! heading-list (_ "Amount")))
;; FIXME: Proper labels: what?
(if (used-amount-double-positive column-vector)
(addto! heading-list (N_ "Debit")))
(addto! heading-list (_ "Debit")))
(if (used-amount-double-negative column-vector)
(addto! heading-list (N_ "Credit")))
(addto! heading-list (_ "Credit")))
(if (used-running-balance column-vector)
(addto! heading-list (N_ "Balance")))
(addto! heading-list (_ "Balance")))
(reverse heading-list)))
(define (add-split-row table split column-vector row-style transaction-row?)