當前位置: 首頁>>代碼示例>>Python>>正文


Python api.Invoice類代碼示例

本文整理匯總了Python中InvoiceGenerator.api.Invoice的典型用法代碼示例。如果您正苦於以下問題:Python Invoice類的具體用法?Python Invoice怎麽用?Python Invoice使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


在下文中一共展示了Invoice類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: test_price

    def test_price(self):
        invoice = Invoice(Client('Foo'), Provider('Bar'), Creator('Blah'))
        items = [Item(1, 500), Item(2, 500), Item(3, 500)]
        for item in items:
            invoice.add_item(item)

        self.assertEqual(sum([item.total for item in items]), invoice.price)
開發者ID:Wilo,項目名稱:InvoiceGenerator,代碼行數:7,代碼來源:test_api.py

示例2: test_add_item

    def test_add_item(self):
        invoice = Invoice(Client('Foo'), Provider('Bar'), Creator('Blah'))

        self.assertRaises(AssertionError, invoice.add_item, '')

        for item in [Item(1, 500), Item(2, 500), Item(3, 500)]:
            invoice.add_item(item)

        self.assertEquals(3, len(invoice.items))
開發者ID:Wilo,項目名稱:InvoiceGenerator,代碼行數:9,代碼來源:test_api.py

示例3: test_price_tax

    def test_price_tax(self):
        invoice = Invoice(Client('Foo'), Provider('Bar'), Creator('Blah'))
        items = [
            Item(1, 500, tax='99.9'),
            Item(2, 500, tax='99.9'),
            Item(3, 500, tax='99.9'),
        ]
        for item in items:
            invoice.add_item(item)

        self.assertEqual(5997, invoice.price_tax)
開發者ID:PetrDlouhy,項目名稱:InvoiceGenerator,代碼行數:11,代碼來源:test_api.py

示例4: test_generate_with_vat

    def test_generate_with_vat(self):
        invoice = Invoice(Client('Kkkk'), Provider('Pupik'), Creator('blah'))
        invoice.add_item(Item(32, 600))
        invoice.add_item(Item(60, 50, tax=10))
        invoice.add_item(Item(50, 60, tax=5))
        invoice.add_item(Item(5, 600, tax=50))
        invoice.currency_locale = 'en_US.UTF-8'

        tmp_file = NamedTemporaryFile(delete=False)

        pdf = SimpleInvoice(invoice)
        pdf.gen(tmp_file.name)
開發者ID:tvieira,項目名稱:InvoiceGenerator,代碼行數:12,代碼來源:test_pdf.py

示例5: test_generate_with_vat

    def test_generate_with_vat(self):
        invoice = Invoice(Client('Kkkk'), Provider('Pupik'), Creator('blah'))
        invoice.add_item(Item(32, 600))
        invoice.add_item(Item(60, 50, tax=10))
        invoice.add_item(Item(50, 60, tax=5))
        invoice.add_item(Item(5, 600, tax=50))

        tmp_file = NamedTemporaryFile()

        pdf = SimpleInvoice(invoice)
        pdf.gen(tmp_file.name)
開發者ID:Fizzmint,項目名稱:InvoiceGenerator,代碼行數:11,代碼來源:test_pdf.py

示例6: test_generate_breakdown_vat_table

    def test_generate_breakdown_vat_table(self):
        invoice = Invoice(Client('Foo'), Provider('Bar'), Creator('Blah'))
        invoice.add_item(Item(1, 500, tax=50))
        invoice.add_item(Item(3, 500, tax=50))
        invoice.add_item(Item(500, 5, tax=0))
        invoice.add_item(Item(5, 500, tax=0))

        expected = [(0.00, 5000.0, 5000.0, 0),(50.0, 2000.0, 3000.0, 1000.0)]

        self.assertEquals(expected, invoice.generate_breakdown_vat_table())
開發者ID:Wilo,項目名稱:InvoiceGenerator,代碼行數:10,代碼來源:test_api.py

示例7: test_price_tax_rounding

 def test_price_tax_rounding(self):
     """
     Test, that the price that sums up to 1756.5 gets rounded according to rounding strategy.
     """
     invoice = Invoice(Client('Foo'), Provider('Bar'), Creator('Blah'))
     invoice.add_item(Item(5, 290, tax=21))
     invoice.rounding_result = True
     invoice.use_tax = True
     self.assertEqual(1754, invoice.price_tax)
     invoice.rounding_strategy = decimal.ROUND_HALF_UP
     self.assertEqual(1755, invoice.price_tax)
開發者ID:PetrDlouhy,項目名稱:InvoiceGenerator,代碼行數:11,代碼來源:test_api.py

示例8: test_generate_breakdown_vat

    def test_generate_breakdown_vat(self):
        invoice = Invoice(Client('Foo'), Provider('Bar'), Creator('Blah'))
        invoice.add_item(Item(1, 500, tax=50))
        invoice.add_item(Item(3, 500, tax=50))
        invoice.add_item(Item(500, 5, tax=0))
        invoice.add_item(Item(5, 500, tax=0))

        expected = {
            0.0: {'total': 5000.0, 'total_tax': 5000.0, 'tax': 0.0},
            50.0: {'total': 2000.0, 'total_tax': 3000.0, 'tax': 1000}}

        self.assertEquals(expected, invoice.generate_breakdown_vat())
開發者ID:Wilo,項目名稱:InvoiceGenerator,代碼行數:12,代碼來源:test_api.py

示例9: test_generate

    def test_generate(self):
        provider = Provider('Pupik')
        provider.address = 'Kubelikova blah blah blah'
        provider.zip = '12655465'
        provider.city = 'Frantisek'
        provider.vat_id = 'CZ8590875682'
        provider.ir = '785684523'
        provider.email = '[email protected]'
        provider.bank_account = '56484984968/68'
        provider.bank_name = 'RB'
        provider.note = u'zapsaná v obchodním rejstříku vedeném městským soudem v Praze,\noddíl C, vložka 176551'

        client = Client('Kkkk')
        client.summary = 'Bla blah blah'
        client.address = 'Kubelikova blah blah blah'
        client.zip = '12655465'
        client.city = 'Frantisek'
        client.vat_id = 'CZ8590875682'
        client.ir = '785684523'
        client.phone = '785684523'
        client.email = '[email protected]'
        client.note = u'zapsaná v obchodním rejstříku vedeném městským soudem v Praze,\noddíl C, vložka 176551'

        invoice = Invoice(client, provider, Creator('blah'))
        invoice.add_item(Item(32, 600, tax=50))
        invoice.add_item(Item(32, 600, tax=0))
        invoice.specific_symbol = 666
        invoice.taxable_date = '1.1.1979'
        invoice.variable_symbol = '000000001'
        invoice.currency = u'Kč'


        tmp_file = NamedTemporaryFile()

        pdf = SimpleInvoice(invoice)
        pdf.gen(tmp_file.name)
開發者ID:tomoconnor,項目名稱:InvoiceGenerator,代碼行數:36,代碼來源:test_pdf.py

示例10: test_use_tax

    def test_use_tax(self):
        invoice = Invoice(Client('Foo'), Provider('Bar'), Creator('Blah'))
        invoice.add_item(Item(1, 500, tax=99.9))
        invoice.add_item(Item(500, 5))

        self.assertTrue(invoice.use_tax)
開發者ID:Wilo,項目名稱:InvoiceGenerator,代碼行數:6,代碼來源:test_api.py

示例11: test_generate

    def test_generate(self):
        provider = Provider('Pupik')
        provider.address = 'Kubelikova blah blah blah'
        provider.zip_code = '12655465'
        provider.city = 'Frantisek'
        provider.vat_id = 'CZ8590875682'
        provider.ir = '785684523'
        provider.email = '[email protected]'
        provider.bank_account = '2600420569'
        provider.bank_code = '2010'
        provider.bank_name = 'RB'
        provider.note = u'zapsaná v obchodním rejstříku vedeném městským soudem v Praze,\noddíl C, vložka 176551'

        client = Client('Kkkk')
        client.summary = 'Bla blah blah'
        client.address = 'Kubelikova blah blah blah'
        client.zip_code = '12655465'
        client.city = 'Frantisek'
        client.vat_id = 'CZ8590875682'
        client.ir = '785684523'
        client.phone = '785684523'
        client.email = '[email protected]'
        client.note = u'zapsaná v obchodním rejstříku vedeném městským soudem v Praze,\noddíl C, vložka 176551'

        invoice = Invoice(client, provider, Creator('blah'))
        invoice.use_tax = True
        invoice.title = u"Testovací faktura"
        invoice.add_item(Item(32, 600.6, description=u"Krátký popis", tax=50))
        invoice.add_item(Item(32, 2.5, tax=20))
        invoice.add_item(
            Item(
                5,
                25.42,
                description=u"Dlouhý popis blah blah blah blah blah blah blah blah blah blah blah "
                            u"blah blah blah blah blah blah blah blah blah blah blah blah blah blah "
                            u"blah blah blah blah blah blah blah blah blah blah blah",
                tax=20,
            ),
        )
        for i in range(1, 26):
            invoice.add_item(Item(5, 25.42, description=u"Popis", tax=0))
        invoice.specific_symbol = 666
        invoice.taxable_date = datetime.date.today()
        invoice.variable_symbol = '000000001'
        invoice.number = 'F20140001'
        invoice.payback = datetime.date.today()
        invoice.currency = u'Kč'
        invoice.currency_locale = 'cs_CZ.UTF-8'
        invoice.rounding_result = True

        tmp_file = NamedTemporaryFile(delete=False)
        pdf = SimpleInvoice(invoice)
        pdf.gen(tmp_file.name, True)

        invoice.number = 1
        invoice.reason = u"Položka navíc"
        tmp_file1 = NamedTemporaryFile(delete=False)
        pdf = CorrectingInvoice(invoice)
        pdf.gen(tmp_file1.name)

        pdf = PdfFileReader(tmp_file1)
        pdf_string = pdf.pages[1].extractText()
        self.assertTrue(u"Celkem s DPH: 32⁄255,-⁄K…" in pdf_string)
        self.assertTrue(u"Vytvo‹il: blah" in pdf_string)
開發者ID:creckx,項目名稱:InvoiceGenerator,代碼行數:64,代碼來源:test_pdf.py

示例12: Item

    client.address = "Houští 474"
    client.city = "Lanškroun"
    client.zip = "563 01"
    client.phone = "+420777636388"
    client.email = "[email protected]"
    client.bank_name = "GE Money Bank"
    client.bank_account = "181553009/0600"
    client.note = "Blablabla"

    item1 = Item()
    item1.name = "Položka 1"
    item1.count = 5
    item1.price = 100
    item2 = Item()
    item2.name = "Položka 2"
    item2.count = 10
    item2.price = 750

    invoice = Invoice()
    invoice.setClient(client)
    invoice.setProvider(provider)
    invoice.setTitle("Faktura")
    invoice.setVS("00001")
    invoice.setCreator("Adam Štrauch")
    invoice.addItem(item1)
    invoice.addItem(item2)

    f = open("test.pdf", "w")
    f.write(invoice.getContent())
    f.close()
開發者ID:zvolsky,項目名稱:mz-invoicing,代碼行數:30,代碼來源:mz_invoicing.py

示例13: test_generate

    def test_generate(self):
        provider = Provider('Pupik')
        provider.address = 'Kubelikova blah blah blah'
        provider.zip_code = '12655465'
        provider.city = 'Frantisek'
        provider.vat_id = 'CZ8590875682'
        provider.ir = '785684523'
        provider.email = '[email protected]'
        provider.bank_account = '2600420569'
        provider.bank_code = '2010'
        provider.bank_name = 'RB'
        provider.note = u'zapsaná v obchodním rejstříku vedeném městským soudem v Praze,\noddíl C, vložka 176551'

        client = Client('Kkkk')
        client.summary = 'Bla blah blah'
        client.address = 'Kubelikova blah blah blah'
        client.zip_code = '12655465'
        client.city = 'Frantisek'
        client.vat_id = 'CZ8590875682'
        client.ir = '785684523'
        client.phone = '785684523'
        client.email = '[email protected]'
        client.note = u'zapsaná v obchodním rejstříku vedeném městským soudem v Praze,\noddíl C, vložka 176551'

        invoice = Invoice(client, provider, Creator('blah'))
        invoice.use_tax = True
        invoice.title = u"Testovací faktura"
        invoice.add_item(Item(32, '600.6', description=u"Krátký popis", tax=15))
        invoice.add_item(Item(32, '2.5', tax=21))
        invoice.add_item(
            Item(
                5, '25.42',
                description=u"Dlouhý popis blah blah blah blah blah blah blah blah blah blah blah "
                            u"blah blah blah blah blah blah blah blah blah blah blah blah blah blah "
                            u"blah blah blah blah blah blah blah blah blah blah blah",
                tax=21,),)
        for i in range(1, 26):
            invoice.add_item(Item(5, '25.42', description=u"Popis", tax=0))
        invoice.specific_symbol = 666
        invoice.taxable_date = datetime.date.today()
        invoice.variable_symbol = '000000001'
        invoice.number = 'F20140001'
        invoice.payback = datetime.date.today()
        invoice.currency = u'Kč'
        invoice.currency_locale = 'cs_CZ.UTF-8'
        invoice.rounding_result = True

        tmp_file = NamedTemporaryFile(delete=False)
        SimpleInvoice(invoice).gen(tmp_file.name)
        xml_string = tmp_file.read()

        root = self.assertXmlDocument(xml_string)
        self.assertXpathValues(
            root,
            './dataPack/dataPackItem/invoice/partnerIdentity/address/street/text()',
            'Kubelikova blah blah blah',
        )
        self.assertXpathValues(
            root,
            './dataPack/dataPackItem/invoice/invoiceHeader/number/numberRequested/text()',
            'F20140001',
        )
        self.assertXpathValues(
            root,
            './dataPack/dataPackItem/invoice/invoiceDetail/invoiceItem/text/text()',
            'Popis',
        )
        self.assertXpathValues(
            root,
            './dataPack/dataPackItem/invoice/invoiceSummary/priceLow/text/text()',
            '22102.080',
        )
        self.assertXpathValues(
            root,
            './dataPack/dataPackItem/invoice/invoiceSummary/priceHighVAT/text/text()',
            '43.4910',
        )
開發者ID:creckx,項目名稱:InvoiceGenerator,代碼行數:77,代碼來源:test_pohoda.py

示例14: _build_invoice

 def _build_invoice(self):
     invoice = Invoice(Client("John"), Provider("Doe"), Creator("John Doe"))
     invoice.add_item(Item(42, 666))
     return invoice
開發者ID:szn,項目名稱:InvoiceGenerator,代碼行數:4,代碼來源:test_generator.py

示例15: test_difference_rounding

    def test_difference_rounding(self):
        invoice = Invoice(Client('Foo'), Provider('Bar'), Creator('Blah'))
        invoice.add_item(Item(1, 2.5, tax=50))

        self.assertEquals(0.25, invoice.difference_in_rounding)
開發者ID:Wilo,項目名稱:InvoiceGenerator,代碼行數:5,代碼來源:test_api.py


注:本文中的InvoiceGenerator.api.Invoice類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。