示例#1
0
文件: routes.py 项目: tariqumd/hms
def invoice():
    pat = request.form.get('patient')
    idn = request.form.get('id')
    name = pat + "_" + idn
    client = Client(name)
    addr = Address(add)
    provider = Provider('ABC HOSPITAL',
                        bank_account='2600420569',
                        bank_code='2010')
    creator = Creator('DESK EXECUTIVE')
    bed = request.form.get('bedcost')
    med = request.form.get('medcost')
    dia = request.form.get('diacost')
    tot = request.form.get('total')
    d = request.form.get('Days')

    invoice = Invoice(client, provider, creator)
    invoice.currency = 'Rs'
    invoice.add_item(Item(d, bed, description="Bed cost"))
    invoice.add_item(Item(1, med, description="Medicine"))
    invoice.add_item(Item(1, dia, description="Diagnosis"))

    pdf = SimpleInvoice(invoice)
    url = "application/invoice/" + pat + "_" + idn + ".pdf"
    pdf.gen(url, generate_qr_code=True)

    patient_up = db.session.query(Patient).get(idn)
    patient_up.status = "discharged"
    db.session.commit()
    flash("Patient Discharged , Invoice generated in Invoice folder",
          "success")
    return redirect('/billing')
示例#2
0
    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)
示例#3
0
def gen_pdf(request):
    # pdf = render_to_pdf('shop/pdf_template.html', {"data" :"Subham"})
    # response = HttpResponse(pdf, content_type='application/pdf')
    # filename = "output.pdf"
    # content = "attachment; filename=output.pdf"
    # response['Content-Disposition'] = content
    # return response

    # choose english as language
    os.environ["INVOICE_LANG"] = "en"

    client = Client('Client company')
    provider = Provider('My company',
                        bank_account='2600420569',
                        bank_code='2010')
    creator = Creator('John Doe')

    invoice = Invoice(client, provider, creator)
    invoice.currency_locale = 'en_US.UTF-8'
    invoice.add_item(Item(32, 600, description="Item 1"))
    invoice.add_item(Item(60, 50, description="Item 2", tax=21))
    invoice.add_item(Item(50, 60, description="Item 3", tax=0))
    invoice.add_item(Item(5, 600, description="Item 4", tax=15))
    pdf = SimpleInvoice(invoice)
    pdf.gen("invoice.pdf", generate_qr_code=True)
    return JsonResponse({'message': 'This is search page'})
示例#4
0
    def test_generate_proforma(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 = '*****@*****.**'
        provider.bank_account = '2600420569/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 = '*****@*****.**'
        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.number = 'F20140007'
        invoice.use_tax = True
        invoice.title = u"Proforma 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.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 = ProformaInvoice(invoice)
        pdf.gen(tmp_file.name, True)

        pdf = PdfFileReader(tmp_file)
        pdf_string = pdf.pages[1].extractText()
        self.assertTrue(u"Celkem s DPH: 32⁄255,-⁄K…" in pdf_string)
示例#5
0
    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))
示例#6
0
    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 = '*****@*****.**'
        provider.bank_account = '2600420569/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 = '12655465'
        client.city = 'Frantisek'
        client.vat_id = 'CZ8590875682'
        client.ir = '785684523'
        client.phone = '785684523'
        client.email = '*****@*****.**'
        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.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)
示例#7
0
    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())
示例#8
0
    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)
示例#9
0
    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)
示例#10
0
    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())
def booking_invoice(request, booking_id):
    if request.method == 'POST':
        form = CreateInvoiceForm(request.POST or None)
        if form.is_valid():
            booking = Booking.objects.get(id=booking_id)
            gs = GuestBooking.objects.filter(booking=booking).first()
            items = RoomServiceBooking.objects.filter(booking=booking).all()
            os.environ["INVOICE_LANG"] = "en"
            client = Client(xstr(gs.guest.name) + " " + xstr(gs.guest.surname),
                            phone=xstr(gs.guest.phone),
                            email=xstr(gs.guest.email),
                            vat_id=xstr(gs.guest.id_number),
                            address=xstr(gs.guest.address),
                            zip_code=xstr(gs.guest.zip_code))
            provider = Provider(
                'Yahomas',
                bank_account='22946662932',
                bank_code='210',
                city="Istanbul",
                zip_code="34700",
                phone="+9002122443262",
                # logo_filename="/home/tugcan/Dropbox/SWE/Yahomas/yahomas_stamp_small.png"
            )
            creator = Creator(
                'Yahomas',
                # stamp_filename="/home/tugcan/Dropbox/SWE/Yahomas/YahomasStamp.png"
            )
            invoice = Invoice(client, provider, creator)
            invoice.currency = "$"
            invoice.number = str(booking_id)[:13]
            days = abs((booking.start_date - booking.end_date).days)
            if days <= 0:
                days = 1
            invoice.add_item(
                Item(days,
                     booking.room.price *
                     (100 - float(form.cleaned_data['discount'])) / 100,
                     description="Room 1"))
            for item in items:
                invoice.add_item(
                    Item(1, item.item.price, description=item.item.name))

            pdf = SimpleInvoice(invoice)
            file_path = f"{djangoSettings.STATIC_ROOT}/{str(booking_id)}.pdf"
            pdf.gen(file_path, generate_qr_code=True)

            with open(file_path, 'rb') as file:
                response = HttpResponse(file.read(),
                                        content_type='application/pdf')
                response[
                    'Content-Disposition'] = 'attachment; filename=invoice.pdf'
                return response
示例#12
0
    def test_generate_with_vat(self):
        invoice = Invoice(Client('Kkkk'), Provider('Pupik'), Creator('blah'))
        invoice.number = 'F20140001'
        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)
示例#13
0
    def run(self, dispatcher: CollectingDispatcher, tracker: Tracker,
            domain: Dict) -> List[EventType]:
        items = tracker.get_slot("dish")
        quant = tracker.get_slot("quant")
        id = tracker.get_slot("email")
        import os

        from tempfile import NamedTemporaryFile

        from InvoiceGenerator.api import Invoice, Item, Client, Provider, Creator

        os.environ["INVOICE_LANG"] = "en"

        client = Client('Valuable Customer')
        provider = Provider('XYZEE', bank_account='00000', bank_code='0000')
        creator = Creator('Amanul Haque')

        invoice = Invoice(client, provider, creator)
        invoice.currency_locale = 'en_US.UTF-8'
        for item, quantity in zip(items, quant):
            invoice.add_item(Item(quantity, 00, description=item))

        from InvoiceGenerator.pdf import SimpleInvoice

        pdf = SimpleInvoice(invoice)
        pdf.gen("D:\GoBaskt-Intern\Food CB\invoices\invoice.pdf",
                generate_qr_code=True)

        dispatcher.utter_message(text='Invoice Created')
        return []
示例#14
0
 def test_count_total_with_tax(self):
     count = 24
     price = 42
     tax = 99.9
     item = Item(count, price, tax=tax)
     expected = price * count * (1.0 + tax / 100.0)
     self.assertEquals(expected, item.total_tax)
示例#15
0
def gen_receipt(car_no='HR 02 AK 9064',mins = 50):
    os.environ["INVOICE_LANG"] = "en"
    client = Client("R/C Number: "+car_no)
    provider = Provider('Tez Parking', bank_account='2600420569', bank_code='2010',address='Tez Parking\n NIT Jalandhar', city='Jalandhar\n Punjab', zip_code='144001', phone='9138121216', email='*****@*****.**',  logo_filename='think.png')
    creator = Creator('Parking Operator')
    now = time()
    now = int(now)
    now = str(now)
    invoice = Invoice(client, provider, creator)
    invoice.currency_locale = 'en_US.UTF-8'
    rate =0.5
    if mins <= 60:
        rate = 20/60
    elif mins >60 and mins <= 180:
        rate = 40/60
    elif mins > 180 and mins <=300:
        rate = 50/60
    elif mins > 300 and mins <= 480:
        rate = 60/60
    elif mins > 480 and mins <= 720:
        rate = 80/60
    elif mins > 720 and mins <= 1440:
        rate = 100/60

    invoice_no = now+car_no[-4:]
    invoice.add_item(Item(mins, rate, description="Parking slot booking"))
    invoice.number = invoice_no

    pdf = SimpleInvoice(invoice)
    pdf.gen(invoice_no+".pdf", generate_qr_code=True)
    return invoice_no
示例#16
0
 def test_count_total_with_none_tax(self):
     count = 24
     price = 42
     tax = None
     item = Item(count, price, tax=tax)
     self.assertIsInstance(item.tax, Decimal)
     self.assertEquals(1008, item.total_tax)
示例#17
0
def invoice(order):
    os.environ["INVOICE_LANG"] = "en"

    info = UserAddress.objects.get(user=order.client)
    info_seller = UserAddress.objects.get(user=User.objects.get(
        username='******'))
    client = Client('{}'.format(info.company_name),
                    '{} {}'.format(info.home_number, info.local_number),
                    '{} {}'.format(info.post, info.city))
    provider = Provider('{}'.format(info_seller.company_name),
                        '{} {}'.format(info_seller.home_number,
                                       info_seller.local_number),
                        '{} {}'.format(info_seller.post, info_seller.city),
                        bank_account='00000',
                        bank_code='0000')
    creator = Creator('Shop')

    invoice = Invoice(client, provider, creator)
    invoice.currency_locale = 'en_US.UTF-8'
    for item in order.product_list.product_list.all():
        invoice.add_item(
            Item('{}'.format(item.amount),
                 '{}'.format(item.product.price),
                 description="{}".format(item.product.name)))

    pdf = SimpleInvoice(invoice)
    pdf.gen("pro-forma.pdf")
示例#18
0
 def test_count_total_with_none_tax(self):
     count = 24
     price = 42
     tax = None
     item = Item(count, price, tax=tax)
     expected = price * count
     self.assertIsInstance(item.tax, float)
     self.assertEquals(expected, item.total_tax)
示例#19
0
    def test_check_data_types_set_in_constructor(self):
        item = Item('42', '666', 'Item description', 'hour', '1.1')

        self.assertIsInstance(item.count, float)
        self.assertIsInstance(item.price, float)
        self.assertIsInstance(item.description, unicode)
        self.assertIsInstance(item.unit, unicode)
        self.assertIsInstance(item.tax, float)
示例#20
0
 def pdf_data(self):
     invoice = Invoice(client, provider, creator)
     invoice.currency_locale = 'en_IN.UTF-8'
     fire_data = self.firebase.get('/' + self.email + '/' + self.date, None)
     for x, y in fire_data.items():
         invoice.add_item(
             Item(y['quantity'], y['price'], description=y['name']))
     pdf = SimpleInvoice(invoice)
     pdf.gen("invoice.pdf", generate_qr_code=True)
示例#21
0
    def test_check_data_types_set_in_constructor(self):
        item = Item('42', '666', 'Item description', 'hour', '1.1')

        self.assertIsInstance(item.count, Decimal)
        self.assertEqual(item.count, 42)
        self.assertIsInstance(item.price, Decimal)
        self.assertEqual(item.price, 666)
        self.assertIsInstance(item.description, string_types)
        self.assertIsInstance(item.unit, string_types)
        self.assertIsInstance(item.tax, Decimal)
        self.assertEqual(item.tax, Decimal('1.1'))
示例#22
0
 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)
示例#23
0
    def _get_invoice(self, order, clientName):
        client = Client(clientName)
        provider = Provider(os.getenv("company"), bank_account=os.getenv("bank_account"),
                            bank_code=os.getenv("bank_code"))
        creator = Creator(os.getenv("creator"))

        invoice = Invoice(client, provider, creator)
        for snapshot in order.snapshots:
            invoice.add_item(Item(count=snapshot.quantity, price=snapshot.price, description=snapshot.name,
                                  tax=int(os.getenv("Vat")), unit='$'))
        invoice.currency = '$'
        return invoice
示例#24
0
    def test_count_tax(self):

        item = Item(2, 50, tax=50)
        self.assertEqual(50, item.count_tax())

        item = Item(2, 50)
        self.assertEqual(0, item.count_tax())
示例#25
0
    def test_generate_with_vat(self):
        os.environ["INVOICE_LANG"] = "en"
        invoice = Invoice(Client('Kkkk'), Provider('Pupik'), Creator('blah'))
        invoice.number = 'F20140001'
        invoice.use_tax = True
        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'
        invoice.currency = 'USD'

        tmp_file = NamedTemporaryFile(delete=False)

        pdf = SimpleInvoice(invoice)
        pdf.gen(tmp_file.name)

        pdf = PdfFileReader(tmp_file)
        pdf_string = pdf.pages[0].extractText()
        self.assertTrue("$3,000.00" in pdf_string)
        self.assertTrue("Total with tax: $30,150.00" in pdf_string)
        self.assertTrue("Creator: blah" in pdf_string)
示例#26
0
def bill_generator(request):
    try:
        global bill_no
        fs = FileSystemStorage()
        os.environ["INVOICE_LANG"] = "en"
        table_no = request.data["no"]
        client = Client('Table ' + str(table_no))
        clerk = request.data["email"]
        provider = Provider('Restaurant',
                            bank_account='2600420569',
                            bank_code='2010')
        creator = Creator(clerk)
        invoice = Invoice(client, provider, creator)

        data = request.data["order"]  # quantity,price, name

        invoice.currency_locale = 'en_IN'
        invoice.currency = "INR"
        invoice.number = bill_no
        balance = list(Variable.objects.all().values())[0]["balance"]
        bill_no += 1

        for item in data:
            invoice.add_item(
                Item(item[1], item[2] / item[1], description=item[0], tax=14))
            my_custom_sql(
                "insert into sales(item_code,quantity) values({},{})".format(
                    int(item[3]), item[1]))
            balance += item[2]
            #print("select count(*) from sales where (item_code = {} && date >= {});".format(item[3], str((datetime.today() - timedelta(days=3)).strftime("%Y-%d,%Y"))))
            # count = my_custom_sql("select count(*) from sales where (item_code = {} && date >= {});".format(item[3], str((datetime.today() - timedelta(days=3)).strftime("%Y-%m-%d"))))[0][0]

        Variable.objects.all().delete()
        Variable(balance=balance).save()
        filename = "invoice" + str(bill_no) + ".pdf"
        pdf = SimpleInvoice(invoice)
        pdf.gen(filename, generate_qr_code=True)
        t = Thread(target=calculateThreshold, args=(data, ))
        t.start()

        if fs.exists(filename):
            with fs.open(filename) as pdf:
                response = HttpResponse(pdf, content_type='application/pdf')
                #response['Content-Disposition'] = 'attachment; filename="mypdf.pdf"' #user will be prompted with the browser’s open/save file
                response['Content-Disposition'] = 'inline; filename={}'.format(
                    filename
                )  #user will be prompted display the PDF in the browser
                return response

    except FileNotFoundError:
        raise Http404()
示例#27
0
    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 = '*****@*****.**'
        provider.bank_account = '2600420569/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 = '12655465'
        client.city = 'Frantisek'
        client.vat_id = 'CZ8590875682'
        client.ir = '785684523'
        client.phone = '785684523'
        client.email = '*****@*****.**'
        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.6, tax=50))
        invoice.add_item(Item(32, 2.5, tax=20))
        invoice.add_item(Item(5, 25.42, tax=20))
        invoice.add_item(Item(5, 25.42, tax=0))
        invoice.specific_symbol = 666
        invoice.taxable_date = '1.1.1979'
        invoice.variable_symbol = '000000001'
        invoice.currency = u'Kč'
        invoice.rounding_result = True

        tmp_file = NamedTemporaryFile(delete=False)

        pdf = SimpleInvoice(invoice)
        pdf.gen(tmp_file.name, True)
def GenerateInvoice():
    i, x = 0, 1
    itemQuantity = input("How many items would you like to add? ")

    while i < itemQuantity:
        print('Please enter the details for Item ' + str(x))
        Quantity = raw_input("Please enter a quantity of good provided: ")
        Price = raw_input("Please enter the total price: ")
        Description = raw_input("Please enter a description: ")
        invoice.add_item(Item(Quantity, Price, Description))
        x += 1
        i += 1
    pdf = SimpleInvoice(invoice)
    invoiceName = "Invoice001.pdf"
    pdf.gen(invoiceName, generate_qr_code=True)
def create_invoice(provider_name, provider_address, provider_postcode, client_name, client_address, client_postcode, items_list):
    provider = Provider(provider_name, provider_address, provider_postcode, bank_account='2600420569', bank_code='2010')
    creator = Creator('')
    client = Client(client_name, client_address, client_postcode)

    invoice = Invoice(client, provider, creator, number=datetime.datetime.now().strftime("%d-%m-%y"))
    invoice.currency_locale = 'pl_PL.UTF-8'
    invoice.use_tax = False
    for i in range(0,len(items_list),3):
        item_count = items_list[i]
        item_price = items_list[i+1]
        item_name = items_list[i+2]
        invoice.add_item(Item(item_count, item_price, description=item_name))
    pdf = ProformaInvoice(invoice)
    pdf.gen("Proforma.pdf", generate_qr_code=False)
示例#30
0
    def test_getters_and_setters(self):
        item = Item(24, 666)

        item.count = '44'
        item.price = '666'
        item.description = 'Foo bar'
        item.unit = 'hour'
        item.tax = '99.9'

        self.assertIsInstance(item.count, float)
        self.assertIsInstance(item.price, float)
        self.assertIsInstance(item.description, unicode)
        self.assertIsInstance(item.unit, unicode)
        self.assertIsInstance(item.tax, float)
示例#31
0
    def test_getters_and_setters(self):
        item = Item(24, 666)

        item.count = '44'
        item.price = '667'
        item.description = 'Foo bar'
        item.unit = 'hour'
        item.tax = '99.9'

        self.assertIsInstance(item.count, Decimal)
        self.assertEqual(item.count, 44)
        self.assertIsInstance(item.price, Decimal)
        self.assertEqual(item.price, 667)
        self.assertIsInstance(item.description, string_types)
        self.assertIsInstance(item.unit, string_types)
        self.assertIsInstance(item.tax, Decimal)
        self.assertEqual(item.tax, Decimal('99.9'))
示例#32
0
    provider.bank_account = "2600307929/2010"
    provider.note = "IČO: 71883797"

    client = Address()
    client.firstname = "Adam"
    client.lastname = "Štrauch"
    client.address = "Houští 474"
    client.city = "Lanškroun"
    client.zip = "563 01"
    client.phone = "+420777636388"
    client.email = "*****@*****.**"
    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)