コード例 #1
0
ファイル: tax.py プロジェクト: jfishe/qb2gnc
def new_tax(root, book, USD, row):
    if row['type'] == 'Sales Tax Item':
        tablename = row['item']
        parent = root.lookup_by_name(row['account'])
        account = Account(book)
        parent.append_child(account)
        account.SetName(tablename)
        account.SetType(ACCT_TYPE_LIABILITY)
        account.SetCommodity(USD)
        rate = gnc_numeric_from(row['rate'])
        # Skip existing tax table and create new ones
        try:
            assert (
                not isinstance(book.TaxTableLookupByName(tablename), TaxTable)
            )
            TaxTable(book, tablename, TaxTableEntry(account, True, rate))
        except AssertionError:
            print '"%s" tax table already exists, skipping' \
                  % tablename
            # Add method to update rate
            return 0
    return 1
コード例 #2
0
ファイル: gnucash_core.py プロジェクト: wdowner/gnucash
 def TaxTableGetTables(self):
     from gnucash.gnucash_business import TaxTable
     return [ TaxTable(instance=item) for item in gncTaxTableGetTables(self.instance) ]
コード例 #3
0
    # name isn't required, ID and currency are
    new_customer = Customer(book, "1", CAD, "Bill & Bob Industries")

    # not required, but a good idea because the GUI insists on basic address info
    address = new_customer.GetAddr()
    address.SetName("Bill & Bob")
    address.SetAddr1("201 Nowhere street")

    new_employee = Employee(book, "2", CAD, "Reliable employee")

    new_vendor = Vendor(book, "3", CAD, "Dependable vendor")

    new_job = Job(book, "4", new_vendor, "Good clean, fun")

    # 7% tax
    tax_table = TaxTable(book, "good tax",
                         TaxTableEntry(a5, True, GncNumeric(700000, 100000)))

    invoice_customer = Invoice(book, "5", CAD, new_customer)
    customer_extract = invoice_customer.GetOwner()
    assert (isinstance(customer_extract, Customer))
    assert (customer_extract.GetName() == new_customer.GetName())

    invoice_employee = Invoice(book, "6", CAD, new_employee)
    employee_extract = invoice_employee.GetOwner()
    assert (isinstance(employee_extract, Employee))
    assert (employee_extract.GetName() == new_employee.GetName())

    invoice_vendor = Invoice(book, "7", CAD, new_vendor)
    vendor_extract = invoice_vendor.GetOwner()
    assert (isinstance(vendor_extract, Vendor))
    assert (vendor_extract.GetName() == new_vendor.GetName())