start configing some of the othe ledger types

git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@550 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
Linas Vepstas 1998-02-17 07:31:13 +00:00
parent f6f4f25fdd
commit 731797fb01
2 changed files with 95 additions and 17 deletions

View File

@ -92,28 +92,88 @@
static void
configLayout (BasicRegister *reg, int type)
{
/* perform a bsic layout that's valid for most
* of the ledgers; then customize with case
* statements. */
reg->num_cols = 8;
reg->num_header_rows = 1;
SET (DATE_CELL, 0, 0, 11, DATE_STR);
SET (NUM_CELL, 1, 0, 7, NUM_STR);
SET (ACTN_CELL, 1, 1, 7, NUM_STR);
SET (XFRM_CELL, 2, 0, 14, XFRM_STR);
SET (XTO_CELL, 2, 1, 14, XFTO_STR);
SET (DESC_CELL, 3, 0, 29, DESC_STR);
SET (MEMO_CELL, 3, 1, 29, DESC_STR);
SET (RECN_CELL, 4, 0, 1, "R");
SET (CRED_CELL, 5, 0, 12, CREDIT_STR);
SET (DEBT_CELL, 6, 0, 12, DEBIT_STR);
SET (BALN_CELL, 7, 0, 12, BALN_STR);
SET (SHRS_CELL, -1, -1, 12, "");
SET (PRIC_CELL, -1, -1, 12, "");
switch (type) {
case BANK_REGISTER:
case BANK_LEDGER:
case CASH_LEDGER:
case ASSET_LEDGER:
case CREDIT_LEDGER:
case LIABILITY_LEDGER:
case INCOME_LEDGER:
case EXPENSE_LEDGER:
case EQUITY_LEDGER:
reg->num_cols = 8;
reg->num_header_rows = 1;
SET (XTO_CELL, -1, -1, 14, "");
SET (SHRS_CELL, -1, -1, 12, "");
SET (PRIC_CELL, -1, -1, 12, "");
break;
SET (DATE_CELL, 0, 0, 11, DATE_STR);
SET (NUM_CELL, 1, 0, 7, NUM_STR);
SET (ACTN_CELL, 1, 1, 7, NUM_STR);
SET (XFRM_CELL, 2, 0, 11, XFRM_STR);
SET (XTO_CELL, -1, -1, 11, "");
SET (DESC_CELL, 3, 0, 29, DESC_STR);
SET (MEMO_CELL, 3, 1, 29, DESC_STR);
SET (RECN_CELL, 4, 0, 1, "R");
SET (CRED_CELL, 5, 0, 9, CREDIT_STR);
SET (DEBT_CELL, 6, 0, 9, DEBIT_STR);
SET (BALN_CELL, 7, 0, 9, BALN_STR);
SET (SHRS_CELL, -1, -1, 9, "");
SET (PRIC_CELL, -1, -1, 9, "");
case STOCK_LEDGER:
reg->num_cols = 10;
SET (XTO_CELL, -1, -1, 14, "");
SET (SHRS_CELL, 7, 0, 12, "");
SET (PRIC_CELL, 8, 0, 12, "");
SET (BALN_CELL, 9, 0, 12, BALN_STR);
default:
}
/* setup custom labels for the debit/credit columns */
switch (type) {
case BANK_LEDGER:
reg->labels [CRED_CELL] = PAYMENT_STR;
reg->labels [DEBT_CELL] = DEPOSIT_STR;
break;
case CASH_LEDGER:
reg->labels [CRED_CELL] = SPEND_STR;
reg->labels [DEBT_CELL] = RECEIVE_STR;
break;
case ASSET_LEDGER:
reg->labels [CRED_CELL] = DEPR_STR;
reg->labels [DEBT_CELL] = APPR_STR;
break;
case CREDIT_LEDGER:
reg->labels [CRED_CELL] = CHARGE_STR;
reg->labels [DEBT_CELL] = PAYMENT_STR;
break;
case LIABILITY_LEDGER:
reg->labels [CRED_CELL] = INCREASE_STR;
reg->labels [DEBT_CELL] = DECREASE_STR;
break;
case INCOME_LEDGER:
reg->labels [CRED_CELL] = INCOME_STR;
reg->labels [DEBT_CELL] = CHARGE_STR;
break;
case EXPENSE_LEDGER:
reg->labels [CRED_CELL] = REBATE_STR;
reg->labels [DEBT_CELL] = EXPENSE_STR;
break;
case EQUITY_LEDGER:
reg->labels [CRED_CELL] = SURPLUS_STR;
reg->labels [DEBT_CELL] = DEFICIT_STR;
break;
default:
}
}
/* ============================================== */
@ -126,7 +186,14 @@ configTraverse (BasicRegister *reg, int type)
CellBlock *curs = reg->cursor;
switch (type) {
case BANK_REGISTER:
case BANK_LEDGER:
case CASH_LEDGER:
case ASSET_LEDGER:
case CREDIT_LEDGER:
case LIABILITY_LEDGER:
case INCOME_LEDGER:
case EXPENSE_LEDGER:
case EQUITY_LEDGER:
xaccNextRight (curs, DATE_CELL_R, DATE_CELL_C, NUM_CELL_R, NUM_CELL_C);
xaccNextRight (curs, NUM_CELL_R, NUM_CELL_C, XFRM_CELL_R, XFRM_CELL_C);
xaccNextRight (curs, XFRM_CELL_R, XFRM_CELL_C, DESC_CELL_R, DESC_CELL_C);

View File

@ -16,7 +16,18 @@
#include "textcell.h"
/* defined register types */
#define BANK_REGISTER 0
#define BANK_LEDGER 0
#define CASH_LEDGER 1
#define ASSET_LEDGER 2
#define CREDIT_LEDGER 3
#define LIABILITY_LEDGER 4
#define INCOME_LEDGER 5
#define EXPENSE_LEDGER 6
#define EQUITY_LEDGER 7
#define STOCK_LEDGER 8
#define GEN_LEDGER 9
#define INC_LEDGER 10
#define PORTFOLIO 11
/* modified flags -- indicate how values have been modified */
#define MOD_NONE 0x000