示例#1
0
trans2 = Transaction(book)
split1 = Split(book)
split3 = Split(book)
comm_table = book.get_table()
cad = comm_table.lookup("CURRENCY", "CAD")

num1 = GncNumeric(4, 1)
num2 = GncNumeric(100, 1)

#Set new root account
book.set_root_account(root_acct)

#Set up root account and add sub-accounts
root_acct.SetName("Root")
root_acct.SetType(13) #ACCT_TYPE_ROOT = 13
root_acct.append_child(expenses_acct)
root_acct.append_child(savings_acct)
root_acct.append_child(opening_acct)

#Set up Expenses account
expenses_acct.SetCommodity(cad)
expenses_acct.SetName("Expenses")
expenses_acct.SetType(9) #ACCT_TYPE_EXPENSE = 9

#Set up Savings account
savings_acct.SetCommodity(cad)
savings_acct.SetName("Savings")
savings_acct.SetType(0) #ACCT_TYPE_BANK = 0

#Set up Opening Balance account
opening_acct.SetCommodity(cad)
示例#2
0
split1 = Split(book)
split3 = Split(book)
comm_table = book.get_table()
cad = comm_table.lookup("CURRENCY", "CAD")

num1 = GncNumeric(4, 1)
num2 = GncNumeric(100, 1)

#Set new root account
book.set_root_account(root_acct)

#Set up root account and add sub-accounts
root_acct.SetName("Root")
root_acct.SetType(13) #ACCT_TYPE_ROOT = 13
root_acct.append_child(expenses_acct)
root_acct.append_child(savings_acct)
root_acct.append_child(opening_acct)

#Set up Expenses account
expenses_acct.SetCommodity(cad)
expenses_acct.SetName("Expenses")
expenses_acct.SetType(9) #ACCT_TYPE_EXPENSE = 9

#Set up Savings account
savings_acct.SetCommodity(cad)
savings_acct.SetName("Savings")
savings_acct.SetType(0) #ACCT_TYPE_BANK = 0

#Set up Opening Balance account
opening_acct.SetCommodity(cad)
try:
    s = Session(argv[1], SessionOpenMode.SESSION_NEW_STORE)

    book = s.book
    root = book.get_root_account()
    commod_table = book.get_table()
    CAD = commod_table.lookup('CURRENCY', 'CAD')

    a = Account(book)
    root.append_child(a)
    a.SetName('Assets')
    a.SetType(ACCT_TYPE_ASSET)
    a.SetCommodity(CAD)

    a2 = Account(book)
    a.append_child(a2)
    a2.SetName('Receivables')
    a2.SetType(ACCT_TYPE_RECEIVABLE)
    a2.SetCommodity(CAD)

    a3 = Account(book)
    root.append_child(a3)
    a3.SetName('Income')
    a3.SetType(ACCT_TYPE_INCOME)
    a3.SetCommodity(CAD)

    a4 = Account(book)
    root.append_child(a4)
    a4.SetName('Liabilities')
    a4.SetType(ACCT_TYPE_LIABILITY)
    a4.SetCommodity(CAD)
try:
    s = Session(argv[1], is_new=True)

    book = s.book
    root = book.get_root_account()
    commod_table = book.get_table()
    CAD = commod_table.lookup("CURRENCY", "CAD")

    a = Account(book)
    root.append_child(a)
    a.SetName("Assets")
    a.SetType(ACCT_TYPE_ASSET)
    a.SetCommodity(CAD)

    a2 = Account(book)
    a.append_child(a2)
    a2.SetName("Receivables")
    a2.SetType(ACCT_TYPE_RECEIVABLE)
    a2.SetCommodity(CAD)

    a3 = Account(book)
    root.append_child(a3)
    a3.SetName("Income")
    a3.SetType(ACCT_TYPE_INCOME)
    a3.SetCommodity(CAD)

    a4 = Account(book)
    root.append_child(a4)
    a4.SetName("Liabilities")
    a4.SetType(ACCT_TYPE_LIABILITY)
    a4.SetCommodity(CAD)