Ejemplo n.º 1
0
    def drawHeaders(self):
        self.headerLeft = self.width / 2
        padding = 1.5 * mm
        value_padding = 85 * mm
        invoice_number_string = _("Faktura VAT nr: {}").format(
            self.invoice.invoice_number)
        self.pdf.setFont('DejaVu-Bold', self.largeFontSize)
        bottom = self.top
        self.pdf.drawString(self.left, bottom, invoice_number_string)

        self.pdf.setFont('DejaVu', self.bigFontSize)
        bottom -= self.bigFontSize + padding * 3
        self.pdf.drawString(self.left, bottom, _("Wystawiono dnia:"))

        date_string = self.invoice.invoice_date
        self.pdf.drawString(self.left + value_padding, bottom, date_string)

        invoice_date_string = _("Data wykonania usługi:")
        self.pdf.setFont('DejaVu', self.bigFontSize)
        bottom -= self.bigFontSize + padding
        self.pdf.drawString(self.left, bottom, invoice_date_string)

        invoice_date_value_string = self.invoice.invoice_date
        self.pdf.drawString(self.left + value_padding, bottom,
                            invoice_date_value_string)

        self.pdf.setFont('DejaVu', self.bigFontSize)
        bottom -= self.bigFontSize + padding
        self.pdf.drawString(self.left, bottom, _("Miejsce wystawienia:"))

        place_string = self.invoice.invoice_place
        self.pdf.drawString(self.left + value_padding, bottom, place_string)
Ejemplo n.º 2
0
    def drawSeller(self, top):
        self.pdf.setFont("DejaVu-Bold", self.largeFontSize)
        padding_left = 1 * mm
        bottom = top
        self.pdf.drawString(self.left, bottom, _("Sprzedawca:"))

        self.drawLeftSideRect(bottom)

        seller_name_string = self.invoice.provider.name
        self.pdf.setFont("DejaVu", self.normalFontSize)
        bottom -= self.normalFontSize + 4 * mm
        self.pdf.drawString(self.left + padding_left, bottom,
                            seller_name_string)

        seller_address_string = self.invoice.provider.address1
        bottom -= self.normalFontSize + mm
        self.pdf.drawString(self.left + padding_left, bottom,
                            seller_address_string)

        seller_code_string = self.invoice.provider.address2
        bottom -= self.normalFontSize + mm
        self.pdf.drawString(self.left + padding_left, bottom,
                            seller_code_string)

        provider_country_string = self.invoice.provider.country
        bottom -= self.normalFontSize + mm
        self.pdf.drawString(self.left + padding_left, bottom,
                            provider_country_string)

        if self.invoice.provider.nip and self.invoice.provider.nip.strip():
            seller_nip_string = _("NIP: %(nip)s") % {
                "nip": self.invoice.provider.nip
            }
            bottom -= self.normalFontSize + mm
            self.pdf.drawString(self.left + padding_left, bottom,
                                seller_nip_string)

        if self.invoice.provider.bank_account:
            bottom -= self.normalFontSize + mm
            iban_string = _(
                "Konto bankowe:") + " " + self.invoice.provider.bank_account
            if self.iban_color:
                iban_size = mm * 11
                self.pdf.setFillColorRGB(1, 1, self.iban_color / 255)
                self.pdf.rect(
                    self.left + padding_left + iban_size,
                    bottom,
                    mm * 12 / 5 * len(self.invoice.provider.bank_account),
                    self.normalFontSize,
                    0,
                    1,
                )
                self.pdf.setFillColor(self.textColor)
            self.pdf.drawString(
                self.left + padding_left,
                bottom,
                iban_string,
                charSpace=self.iban_char_space / 1000,
            )
        return bottom
Ejemplo n.º 3
0
 def drawCorretion(self, TOP, LEFT):
     self.pdf.setFont('DejaVu', 8)
     self.pdf.drawString(
         LEFT * mm, TOP * mm,
         _(u'Correction document for invoice: %s') %
         self.invoice.variable_symbol)
     self.pdf.drawString(
         LEFT * mm, (TOP - 4) * mm,
         _(u'Reason to correction: %s') % self.invoice.reason)
Ejemplo n.º 4
0
    def get_address_lines(self):
        address_line = [
            self.summary, self.address,
            u'%s %s' % (self.zip, self.city)
        ]
        if self.vat_id:
            address_line.append(_(u'Vat in: %s') % self.vat_id)

        if self.ir:
            address_line.append(_(u'IR: %s') % self.ir)

        return address_line
Ejemplo n.º 5
0
    def get_address_lines(self):
        address_line = [
            self.summary,
            self.address,
            u'%s %s' % (self.zip, self.city)
            ]
        if self.vat_id:
            address_line.append(_(u'Vat in: %s') % self.vat_id)

        if self.ir:
            address_line.append(_(u'IR: %s') % self.ir)

        return address_line
Ejemplo n.º 6
0
    def drawPayment(self, TOP, LEFT):
        self.pdf.setFont("DejaVu-Bold", 9)
        self.pdf.drawString(LEFT * mm, TOP * mm, _(u"Payment information"))

        text = self.pdf.beginText((LEFT + 2) * mm, (TOP - 6) * mm)
        lines = [
            self.invoice.provider.bank_name,
            "%s: %s" % (_(u"Bank account"), self.invoice.provider.bank_account),
            "%s: %s" % (_(u"Variable symbol"), self.invoice.variable_symbol),
        ]
        if self.invoice.specific_symbol:
            lines.append("%s: %s" % (_(u"Specific symbol"), self.invoice.specific_symbol))
        text.textLines("\n".join(lines))
        self.pdf.drawText(text)
Ejemplo n.º 7
0
    def drawPayment(self,TOP,LEFT):
        self.pdf.setFont('DejaVu-Bold', 9)
        self.pdf.drawString(LEFT * mm, TOP * mm, _(u'Payment information'))

        text = self.pdf.beginText((LEFT + 2) * mm, (TOP - 6) * mm)
        lines = [
            self.invoice.provider.bank_name,
            '%s: %s' % (_(u'Bank account'), self.invoice.provider.bank_account),
            '%s: %s' % (_(u'Variable symbol'), self.invoice.variable_symbol)
        ]
        if self.invoice.specific_symbol:
            lines.append(
                '%s: %s' % (_(u'Specific symbol'), self.invoice.specific_symbol))
        text.textLines('\n'.join(lines))
        self.pdf.drawText(text)
Ejemplo n.º 8
0
    def drawDates(self, TOP, LEFT):
        self.pdf.setFont("DejaVu", 10)
        top = TOP + 1
        items = [
            (LEFT * mm, "%s: %s" % (_(u"Date"), self.invoice.date)),
            (LEFT * mm, "%s: %s" % (_(u"Payback"), self.invoice.payback)),
        ]
        if self.invoice.taxable_date:
            items.append((LEFT * mm, "%s: %s" % (_(u"Taxable date"), self.invoice.taxable_date)))

        items.append((LEFT * mm, "%s: %s" % (_(u"Paytype"), self.invoice.paytype)))

        for item in items:
            self.pdf.drawString(item[0], top * mm, item[1])
            top += -5
Ejemplo n.º 9
0
 def drawTitle(self):
     # Up line
     self.pdf.drawString(self.LEFT*mm, self.TOP*mm, self.invoice.title)
     self.pdf.drawString((self.LEFT + 90) * mm,
         self.TOP*mm,
         _(u'Variable symbol: %s') %
         self.invoice.variable_symbol)
Ejemplo n.º 10
0
    def drawHeaders(self):
        self.headerLeft = self.width / 2
        padding = 1.5 * mm
        value_padding = 85 * mm
        invoice_number_string = _("Faktura VAT nr: {}").format(
            self.invoice.invoice_number)
        self.pdf.setFont("DejaVu-Bold", self.largeFontSize)
        bottom = self.top
        self.pdf.drawString(self.left, bottom, invoice_number_string)

        self.pdf.setFont("DejaVu", self.bigFontSize)
        bottom -= self.bigFontSize + padding * 3
        self.pdf.drawString(self.left, bottom, _("Wystawiono dnia:"))

        date_string = self.invoice.invoice_issue_date
        self.pdf.drawString(self.left + value_padding, bottom, date_string)
Ejemplo n.º 11
0
    def drawMain(self):
        # Up line
        self.pdf.drawString(self.LEFT*mm, self.TOP*mm, self.invoice.title)
        self.pdf.drawString((self.LEFT + 90) * mm,
                            self.TOP*mm,
                            _(u'Variable symbol: %s') %
                            self.invoice.variable_symbol)

        # Borders
        self.pdf.rect(self.LEFT * mm, (self.TOP - 68) * mm,
                      (self.LEFT + 156) * mm, 65 * mm, stroke=True, fill=False)

        path = self.pdf.beginPath()
        path.moveTo((self.LEFT + 88) * mm, (self.TOP - 3) * mm)
        path.lineTo((self.LEFT + 88) * mm, (self.TOP - 68) * mm)
        self.pdf.drawPath(path, True, True)

        path = self.pdf.beginPath()
        path.moveTo(self.LEFT * mm, (self.TOP - 39) * mm)
        path.lineTo((self.LEFT + 88) * mm, (self.TOP - 39) * mm)
        self.pdf.drawPath(path, True, True)

        path = self.pdf.beginPath()
        path.moveTo((self.LEFT + 88) * mm, (self.TOP - 27) * mm)
        path.lineTo((self.LEFT + 176) * mm, (self.TOP - 27) * mm)
        self.pdf.drawPath(path, True, True)
Ejemplo n.º 12
0
    def drawDates(self, TOP, LEFT):
        self.pdf.setFont('DejaVu', 10)
        top = TOP + 1
        items = [(LEFT * mm, '%s: %s' % (_(u'Date'), self.invoice.date)),
                 (LEFT * mm, '%s: %s' % (_(u'Payback'), self.invoice.payback))]
        if self.invoice.taxable_date:
            items.append(
                (LEFT * mm,
                 '%s: %s' % (_(u'Taxable date'), self.invoice.taxable_date)))

        items.append(
            (LEFT * mm, '%s: %s' % (_(u'Paytype'), self.invoice.paytype)))

        for item in items:
            self.pdf.drawString(item[0], top * mm, item[1])
            top += -5
Ejemplo n.º 13
0
    def drawPayment(self, TOP, LEFT):
        self.pdf.setFont('DejaVu-Bold', 9)
        self.pdf.drawString(LEFT * mm, TOP * mm, _(u'Payment information'))

        text = self.pdf.beginText((LEFT + 2) * mm, (TOP - 6) * mm)
        lines = [
            self.invoice.provider.bank_name,
            '%s: %s' %
            (_(u'Bank account'), self.invoice.provider.bank_account),
            '%s: %s' % (_(u'Variable symbol'), self.invoice.variable_symbol)
        ]
        if self.invoice.specific_symbol:
            lines.append('%s: %s' %
                         (_(u'Specific symbol'), self.invoice.specific_symbol))
        text.textLines('\n'.join(lines))
        self.pdf.drawText(text)
Ejemplo n.º 14
0
 def drawTitle(self):
     # Up line
     self.pdf.drawString(self.LEFT*mm, self.TOP*mm, self.invoice.title)
     self.pdf.drawString((self.LEFT + 90) * mm,
         self.TOP*mm,
         _(u'Correcting document: %s') %
         self.invoice.number)
Ejemplo n.º 15
0
 def draw_page_number(self, page_count):
     self.setFont("DejaVu", 9)
     self.drawRightString(
         self._pagesize[0] - 15 * mm, 6 * mm,
         _("strona %(page_number)d z %(page_count)d") % {
             "page_number": self._pageNumber,
             "page_count": page_count
         })
Ejemplo n.º 16
0
    def drawDates(self,TOP,LEFT):
        self.pdf.setFont('DejaVu', 10)
        top = TOP + 1
        items = [
            (LEFT * mm, '%s: %s' % (_(u'Date'), self.invoice.date)),
            (LEFT * mm, '%s: %s' % (_(u'Payback'),
                                              self.invoice.payback))

        ]
        if self.invoice.taxable_date:
            items.append((LEFT * mm, '%s: %s' % (_(u'Taxable date'),
                        self.invoice.taxable_date)))

        items.append((LEFT * mm, '%s: %s' % (_(u'Paytype'),
                                                       self.invoice.paytype)))

        for item in items:
            self.pdf.drawString(item[0], top * mm, item[1])
            top += -5
Ejemplo n.º 17
0
 def __init__(
     self, name, count, unit_price, tax, use_vat=True, use_vat_txt="", unit=_("szt.")
 ):
     self._count = float(count)
     self._unit_price = float(unit_price)
     self._name = str(name)
     self._unit = str(unit)
     self._tax = float(tax)
     self._use_vat = bool(use_vat)
     self._use_vat_txt = str(use_vat_txt)
Ejemplo n.º 18
0
    def drawSeller(self, top):
        self.pdf.setFont('DejaVu-Bold', self.largeFontSize)
        padding_left = 1 * mm
        bottom = top
        self.pdf.drawString(self.left, bottom, _("Sprzedawca:"))

        self.drawLeftSideRect(bottom)

        seller_name_string = self.invoice.provider.name
        self.pdf.setFont('DejaVu', self.normalFontSize)
        bottom -= self.normalFontSize + 4 * mm
        self.pdf.drawString(self.left + padding_left, bottom,
                            seller_name_string)

        seller_address_string = self.invoice.provider.address1
        bottom -= self.normalFontSize + mm
        self.pdf.drawString(self.left + padding_left, bottom,
                            seller_address_string)

        seller_code_string = self.invoice.provider.address2
        bottom -= self.normalFontSize + mm
        self.pdf.drawString(self.left + padding_left, bottom,
                            seller_code_string)

        provider_country_string = self.invoice.provider.country
        bottom -= self.normalFontSize + mm
        self.pdf.drawString(self.left + padding_left, bottom,
                            provider_country_string)

        if self.invoice.provider.nip and self.invoice.provider.nip.strip():
            seller_nip_string = _('NIP: %(nip)s') % {
                "nip": self.invoice.provider.nip
            }
            bottom -= self.normalFontSize + mm
            self.pdf.drawString(self.left + padding_left, bottom,
                                seller_nip_string)

        return bottom
Ejemplo n.º 19
0
    def drawPurchaser(self, top):
        self.pdf.setFont('DejaVu-Bold', self.largeFontSize)
        padding_left = 1 * mm
        bottom = top
        self.pdf.drawString(self.headerLeft, bottom, _("Nabywca:"))

        purchaser_name_string = self.invoice.client.name
        self.pdf.setFont('DejaVu', self.normalFontSize)
        bottom -= self.normalFontSize + 4 * mm
        self.pdf.drawString(self.headerLeft + padding_left, bottom,
                            purchaser_name_string)

        purchaser_address_string = self.invoice.client.address1
        bottom -= self.normalFontSize + mm
        self.pdf.drawString(self.headerLeft + padding_left, bottom,
                            purchaser_address_string)

        purchaser_code_string = self.invoice.client.address2
        bottom -= self.normalFontSize + mm
        self.pdf.drawString(self.headerLeft + padding_left, bottom,
                            purchaser_code_string)

        purchaser_country_string = self.invoice.client.country
        bottom -= self.normalFontSize + mm
        self.pdf.drawString(self.headerLeft + padding_left, bottom,
                            purchaser_country_string)

        if self.invoice.client.nip and self.invoice.client.nip.strip():
            purchaser_nip_string = _('NIP: %(nip)s') % {
                "nip": self.invoice.client.nip
            }
            bottom -= self.normalFontSize + mm
            self.pdf.drawString(self.headerLeft + padding_left, bottom,
                                purchaser_nip_string)

        return bottom
Ejemplo n.º 20
0
    def drawClient(self, TOP, LEFT):
        self.pdf.setFont('DejaVu', 12)
        self.pdf.drawString(LEFT * mm, TOP * mm, _(u'Customer'))
        self.pdf.setFont('DejaVu', 8)

        text = self.pdf.beginText((LEFT + 2) * mm, (TOP - 4) * mm)
        text.textLines('\n'.join(self.invoice.client.get_address_lines()))
        self.pdf.drawText(text)

        text = self.pdf.beginText((LEFT + 2) * mm, (TOP - 23) * mm)
        text.textLines('\n'.join(self.invoice.client.get_contact_lines()))
        self.pdf.drawText(text)

        if self.invoice.client.note:
            self.pdf.setFont('DejaVu', 6)
            text = self.pdf.beginText((LEFT + 2) * mm, (TOP - 28) * mm)
            text.textLines(self.invoice.client.note)
            self.pdf.drawText(text)
Ejemplo n.º 21
0
    def drawProvider(self,TOP,LEFT):
        self.pdf.setFont('DejaVu', 12)
        self.pdf.drawString(LEFT * mm, TOP * mm, _(u'Provider'))
        self.pdf.setFont('DejaVu', 8)

        text = self.pdf.beginText((LEFT + 2) * mm, (TOP - 6) * mm)
        text.textLines('\n'.join(self.invoice.provider.get_address_lines()))
        self.pdf.drawText(text)

        text = self.pdf.beginText((LEFT + 40) * mm, (TOP - 6) * mm)
        text.textLines('\n'.join(self.invoice.provider.get_contact_lines()))

        self.pdf.drawText(text)
        if self.invoice.provider.note:
            self.pdf.setFont('DejaVu', 6)
            text = self.pdf.beginText((LEFT + 2) * mm, (TOP - 23) * mm)
            text.textLines(self.invoice.provider.note)
            self.pdf.drawText(text)
Ejemplo n.º 22
0
    def drawClient(self,TOP,LEFT):
        self.pdf.setFont('DejaVu', 12)
        self.pdf.drawString(LEFT * mm, TOP * mm, _(u'Customer'))
        self.pdf.setFont('DejaVu', 8)

        text = self.pdf.beginText((LEFT + 2) * mm, (TOP - 4) * mm)
        text.textLines('\n'.join(self.invoice.client.get_address_lines()))
        self.pdf.drawText(text)

        text = self.pdf.beginText((LEFT + 2) * mm, (TOP - 23) * mm)
        text.textLines('\n'.join(self.invoice.client.get_contact_lines()))
        self.pdf.drawText(text)

        if self.invoice.client.note:
            self.pdf.setFont('DejaVu', 6)
            text = self.pdf.beginText((LEFT + 2) * mm, (TOP - 28) * mm)
            text.textLines(self.invoice.client.note)
            self.pdf.drawText(text)
Ejemplo n.º 23
0
    def drawProvider(self, TOP, LEFT):
        self.pdf.setFont('DejaVu', 12)
        self.pdf.drawString(LEFT * mm, TOP * mm, _(u'Provider'))
        self.pdf.setFont('DejaVu', 8)

        text = self.pdf.beginText((LEFT + 2) * mm, (TOP - 6) * mm)
        text.textLines('\n'.join(self.invoice.provider.get_address_lines()))
        self.pdf.drawText(text)

        text = self.pdf.beginText((LEFT + 40) * mm, (TOP - 6) * mm)
        text.textLines('\n'.join(self.invoice.provider.get_contact_lines()))

        self.pdf.drawText(text)
        if self.invoice.provider.note:
            self.pdf.setFont('DejaVu', 6)
            text = self.pdf.beginText((LEFT + 2) * mm, (TOP - 23) * mm)
            text.textLines(self.invoice.provider.note)
            self.pdf.drawText(text)
Ejemplo n.º 24
0
    def drawItems(self, TOP, LEFT):
        # Items
        path = self.pdf.beginPath()
        path.moveTo(LEFT * mm, (TOP - 4) * mm)
        path.lineTo((LEFT + 176) * mm, (TOP - 4) * mm)
        self.pdf.drawPath(path, True, True)

        self.pdf.setFont('DejaVu-Bold', 7)
        self.pdf.drawString((LEFT + 1) * mm, (TOP - 2) * mm,
                            _(u'List of items'))

        self.pdf.drawString((LEFT + 1) * mm, (TOP - 9) * mm, _(u'Description'))
        items_are_with_tax = self.invoice.use_tax
        if items_are_with_tax:
            i = 9
            self.pdf.drawString((LEFT + 68) * mm, (TOP - i) * mm, _(u'Units'))
            self.pdf.drawString((LEFT + 88) * mm, (TOP - i) * mm,
                                _(u'Price per one'))
            self.pdf.drawString((LEFT + 115) * mm, (TOP - i) * mm,
                                _(u'Total price'))
            self.pdf.drawString((LEFT + 137) * mm, (TOP - i) * mm, _(u'Tax'))
            self.pdf.drawString((LEFT + 146) * mm, (TOP - i) * mm,
                                _(u'Total price with tax'))
            i += 5
        else:
            i = 9
            self.pdf.drawString((LEFT + 104) * mm, (TOP - i) * mm, _(u'Units'))
            self.pdf.drawString((LEFT + 123) * mm, (TOP - i) * mm,
                                _(u'Price per one'))
            self.pdf.drawString((LEFT + 150) * mm, (TOP - i) * mm,
                                _(u'Total price'))
            i += 5

        self.pdf.setFont('DejaVu', 7)

        # List
        for item in self.invoice.items:
            self.pdf.drawString((LEFT + 1) * mm, (TOP - i) * mm,
                                item.description)
            if item.tax or items_are_with_tax:
                items_are_with_tax = True
                if len(item.description) > 52: i += 5
                if float(int(item.count)) == item.count:
                    self.pdf.drawString((LEFT + 68) * mm, (TOP - i) * mm,
                                        '%.2f %s' % (item.count, item.unit))
                else:
                    self.pdf.drawString((LEFT + 68) * mm, (TOP - i) * mm,
                                        '%.2f %s' % (item.count, item.unit))
                self.pdf.drawString(
                    (LEFT + 88) * mm, (TOP - i) * mm,
                    '%.2f,- %s' % (item.price, self.invoice.currency))
                self.pdf.drawString(
                    (LEFT + 115) * mm, (TOP - i) * mm,
                    '%.2f,- %s' % (item.total, self.invoice.currency))
                self.pdf.drawString((LEFT + 137) * mm, (TOP - i) * mm,
                                    '%.0f %%' % item.tax)
                self.pdf.drawString(
                    (LEFT + 146) * mm, (TOP - i) * mm,
                    '%.2f,- %s' % (item.total_tax, self.invoice.currency))
                i += 5
            else:
                if len(item.description) > 75: i += 5
                if float(int(item.count)) == item.count:
                    self.pdf.drawString((LEFT + 104) * mm, (TOP - i) * mm,
                                        '%.2f %s' % (item.count, item.unit))
                else:
                    self.pdf.drawString((LEFT + 104) * mm, (TOP - i) * mm,
                                        '%.2f %s' % (item.count, item.unit))
                self.pdf.drawString(
                    (LEFT + 123) * mm, (TOP - i) * mm,
                    '%.2f,- %s' % (item.price, self.invoice.currency))
                self.pdf.drawString(
                    (LEFT + 150) * mm, (TOP - i) * mm,
                    '%.2f,- %s' % (item.total, self.invoice.currency))
                i += 5

        if self.invoice.rounding_result:
            path = self.pdf.beginPath()
            path.moveTo(LEFT * mm, (TOP - i) * mm)
            path.lineTo((LEFT + 176) * mm, (TOP - i) * mm)
            i += 5
            self.pdf.drawPath(path, True, True)
            self.pdf.drawString((LEFT + 1) * mm, (TOP - i) * mm,
                                _(u'Rounding'))
            self.pdf.drawString(
                (LEFT + 68) * mm, (TOP - i) * mm, '%.2f,- %s' %
                (self.invoice.difference_in_rounding, self.invoice.currency))
            i += 3

        path = self.pdf.beginPath()
        path.moveTo(LEFT * mm, (TOP - i) * mm)
        path.lineTo((LEFT + 176) * mm, (TOP - i) * mm)
        self.pdf.drawPath(path, True, True)

        if not items_are_with_tax:
            self.pdf.setFont('DejaVu-Bold', 11)
            self.pdf.drawString((LEFT + 100) * mm, (TOP - i - 7) * mm,
                                _(u'Total') + ': %.2f %s' %
                                (self.invoice.price, self.invoice.currency))
        else:
            self.pdf.setFont('DejaVu-Bold', 6)
            self.pdf.drawString((LEFT + 1) * mm, (TOP - i - 2) * mm,
                                _(u'Breakdown VAT'))
            vat_list, tax_list, total_list, total_tax_list = [
                _(u'VAT rate')
            ], [_(u'Tax')], [_(u'Without VAT')], [_(u'With VAT')]
            for vat, items in self.invoice.generate_breakdown_vat().iteritems(
            ):
                vat_list.append('%.2f%%' % vat)
                tax_list.append('%.2f %s' %
                                (items['tax'], self.invoice.currency))
                total_list.append('%.2f %s' %
                                  (items['total'], self.invoice.currency))
                total_tax_list.append(
                    '%.2f %s' % (items['total_tax'], self.invoice.currency))

            self.pdf.setFont('DejaVu', 6)
            text = self.pdf.beginText((LEFT + 1) * mm, (TOP - i - 5) * mm)
            text.textLines('\n'.join(vat_list))
            self.pdf.drawText(text)

            text = self.pdf.beginText((LEFT + 11) * mm, (TOP - i - 5) * mm)
            text.textLines('\n'.join(tax_list))
            self.pdf.drawText(text)

            text = self.pdf.beginText((LEFT + 27) * mm, (TOP - i - 5) * mm)
            text.textLines('\n'.join(total_list))
            self.pdf.drawText(text)

            text = self.pdf.beginText((LEFT + 45) * mm, (TOP - i - 5) * mm)
            text.textLines('\n'.join(total_tax_list))
            self.pdf.drawText(text)

            self.pdf.setFont('DejaVu-Bold', 11)
            self.pdf.drawString(
                (LEFT + 100) * mm, (TOP - i - 14) * mm,
                _(u'Total with tax') + ': %.2f %s' %
                (self.invoice.price_tax, self.invoice.currency))

        if items_are_with_tax:
            self.pdf.rect(LEFT * mm, (TOP - i - 17) * mm, (LEFT + 156) * mm,
                          (i + 19) * mm,
                          stroke=True,
                          fill=False)  #140,142
        else:
            self.pdf.rect(LEFT * mm, (TOP - i - 11) * mm, (LEFT + 156) * mm,
                          (i + 13) * mm,
                          stroke=True,
                          fill=False)  #140,142

        if self.invoice.creator.stamp_filename:
            im = Image.open(self.invoice.creator.stamp_filename)
            height = float(im.size[1]) / (float(im.size[0]) / 200.0)
            self.pdf.drawImage(self.invoice.creator.stamp_filename,
                               (LEFT + 98) * mm, (TOP - i - 72) * mm, 200,
                               height)

        if self.qr_builder:
            qr_filename = self.qr_builder.filename
            im = Image.open(qr_filename)
            height = float(im.size[1]) / (float(im.size[0]) / 200.0)
            self.pdf.drawImage(qr_filename, LEFT * mm, (TOP - i - 100) * mm,
                               200, height)

        path = self.pdf.beginPath()
        path.moveTo((LEFT + 110) * mm, (TOP - i - 70) * mm)
        path.lineTo((LEFT + 164) * mm, (TOP - i - 70) * mm)
        self.pdf.drawPath(path, True, True)

        self.pdf.drawString(
            (LEFT + 112) * mm, (TOP - i - 75) * mm,
            '%s: %s' % (_(u'Creator'), self.invoice.creator.name))
Ejemplo n.º 25
0
    def drawSummary(self, y):
        self.pdf.setFillColor(self.textColor)
        self.pdf.setFont('DejaVu-Bold', self.largeFontSize)
        self.pdf.drawString(self.left, y, _("PODSUMOWANIE"))

        self.drawLeftSideRect(y)

        table_top = y - 5 * mm
        table_width = self.right - self.left
        cell_padding = 2 * mm
        column_padding = 3.5 * mm
        self.pdf.setFont('DejaVu-Bold', self.normalFontSize)

        title_max_width = 53 * mm
        title_left = self.left + cell_padding

        vat_max_width = 25 * mm
        vat_left = title_left + title_max_width + column_padding

        net_max_width = 30 * mm
        net_left = vat_left + vat_max_width + column_padding

        tax_max_width = 20 * mm
        tax_left = net_left + net_max_width + column_padding

        gross_max_width = 30 * mm
        gross_left = tax_left + tax_max_width + column_padding

        center_style = ParagraphStyle('normal',
                                      fontName='DejaVu-Bold',
                                      fontSize=self.tinyFontSize,
                                      alignment=TA_CENTER,
                                      leading=10)
        center_normal_style = ParagraphStyle('normal',
                                             fontName='DejaVu',
                                             fontSize=self.tinyFontSize,
                                             alignment=TA_CENTER,
                                             leading=10)
        right_style = ParagraphStyle('normal',
                                     fontName='DejaVu-Bold',
                                     fontSize=self.tinyFontSize,
                                     alignment=TA_RIGHT,
                                     leading=10)
        right_normal_style = ParagraphStyle('normal',
                                            fontName='DejaVu',
                                            fontSize=self.tinyFontSize,
                                            alignment=TA_RIGHT,
                                            leading=10)

        row_top = table_top
        row_idx = 0

        par = Paragraph(_("Stawka VAT"), center_style)
        par_width, par_height = par.wrapOn(self.pdf, vat_max_width, 0)
        par.drawOn(self.pdf, vat_left, row_top - (cell_padding + par_height))

        par = Paragraph(_("Wartość netto"), right_style)
        par_width, par_height = par.wrapOn(self.pdf, net_max_width, 0)
        par.drawOn(self.pdf, net_left, row_top - (cell_padding + par_height))

        par = Paragraph(_("VAT"), right_style)
        par_width, par_height = par.wrapOn(self.pdf, tax_max_width, 0)
        par.drawOn(self.pdf, tax_left, row_top - (cell_padding + par_height))

        par = Paragraph(_("Wartość brutto"), right_style)
        par_width, par_height = par.wrapOn(self.pdf, gross_max_width, 0)
        par.drawOn(self.pdf, gross_left, row_top - (cell_padding + par_height))

        row_height = par_height + 2 * cell_padding
        row_top -= row_height
        row_idx += 1

        for key, item in self.invoice.generate_breakdown_vat().iteritems():
            if row_idx % 2 == 1:
                self.pdf.setFillColor(self.fillLightColor)
                self.pdf.rect(self.left,
                              row_top - row_height,
                              table_width,
                              row_height,
                              fill=1,
                              stroke=0)

            if key == -1:
                par = Paragraph(item.vat_txt, center_normal_style)
            else:
                par = Paragraph("%d%%" % item.vat, center_normal_style)
            par_width, par_height = par.wrapOn(self.pdf, vat_max_width, 0)
            par.drawOn(self.pdf, vat_left,
                       row_top - (cell_padding + par_height))

            par = Paragraph(format_amount(item.net), right_normal_style)
            par_width, par_height = par.wrapOn(self.pdf, net_max_width, 0)
            par.drawOn(self.pdf, net_left,
                       row_top - (cell_padding + par_height))

            par = Paragraph(format_amount(item.tax), right_normal_style)
            par_width, par_height = par.wrapOn(self.pdf, tax_max_width, 0)
            par.drawOn(self.pdf, tax_left,
                       row_top - (cell_padding + par_height))

            par = Paragraph(format_amount(item.gross), right_normal_style)
            par_width, par_height = par.wrapOn(self.pdf, gross_max_width, 0)
            par.drawOn(self.pdf, gross_left,
                       row_top - (cell_padding + par_height))

            row_top -= row_height

            row_idx += 1

        if row_idx % 2 == 1:
            self.pdf.setFillColor(self.fillLightColor)
            self.pdf.rect(self.left,
                          row_top - row_height,
                          table_width,
                          row_height,
                          fill=1,
                          stroke=0)

        summary_data = self.invoice.items_summary()

        par = Paragraph(_("Razem:"), right_style)
        par_width, par_height = par.wrapOn(self.pdf, title_max_width, 0)
        par.drawOn(self.pdf, title_left, row_top - (cell_padding + par_height))

        par = Paragraph(
            self.invoice.currency_string + format_amount(summary_data["net"]),
            right_style)
        par_width, par_height = par.wrapOn(self.pdf, net_max_width, 0)
        par.drawOn(self.pdf, net_left, row_top - (cell_padding + par_height))

        par = Paragraph(
            self.invoice.currency_string + format_amount(summary_data["tax"]),
            right_style)
        par_width, par_height = par.wrapOn(self.pdf, tax_max_width, 0)
        par.drawOn(self.pdf, tax_left, row_top - (cell_padding + par_height))

        par = Paragraph(
            self.invoice.currency_string +
            format_amount(summary_data["gross"]), right_style)
        par_width, par_height = par.wrapOn(self.pdf, gross_max_width, 0)
        par.drawOn(self.pdf, gross_left, row_top - (cell_padding + par_height))

        row_top -= row_height
        self.pdf.setStrokeColor(self.fillDarkColor)
        self.pdf.rect(self.left, row_top, table_width, table_top - row_top)

        row_top -= row_height

        value_padding = 85 * mm
        self.pdf.setStrokeColor(self.textColor)
        self.pdf.setFillColor(self.textColor)
        self.pdf.setFont('DejaVu', self.bigFontSize)

        row_top -= 1.5 * self.bigFontSize
        self.pdf.drawString(self.left, row_top, _("Konto bankowe:"))
        self.pdf.drawString(self.left + value_padding, row_top,
                            self.invoice.provider.bank_account)

        if self.invoice.provider.bank_data.strip():
            row_top -= 1.5 * self.bigFontSize
            self.pdf.drawString(self.left, row_top, _("Bank:"))
            self.pdf.drawString(self.left + value_padding, row_top,
                                self.invoice.provider.bank_data)

        row_top -= 1.5 * self.bigFontSize
        self.pdf.drawString(self.left, row_top, _("Termin płatności:"))
        self.pdf.drawString(self.left + value_padding, row_top,
                            self.invoice.provider.payment_terms)

        if self.invoice.provider.exchange_rate.strip():
            row_top -= 1.5 * self.bigFontSize
            self.pdf.drawString(self.left, row_top, _("Kurs NBP:"))
            self.pdf.drawString(self.left + value_padding, row_top,
                                self.invoice.provider.exchange_rate)

        if self.invoice.notes and self.invoice.notes.strip():
            row_top -= 1.5 * self.bigFontSize
            self.pdf.drawString(self.left, row_top, _("Uwagi:"))
            lines = self.invoice.notes.split("\n")

            for line in lines:
                self.pdf.drawString(self.left + value_padding, row_top, line)
                row_top -= 1.5 * self.bigFontSize
Ejemplo n.º 26
0
    def drawInvoiceItems(self, y):
        self.pdf.setFont('DejaVu-Bold', self.largeFontSize)
        self.pdf.drawString(self.left, y, _("POZYCJE FAKTURY"))

        self.drawLeftSideRect(y)

        table_top = y - 5 * mm
        table_width = self.right - self.left
        cell_padding = 2 * mm
        column_padding = 3.5 * mm
        self.pdf.setFont('DejaVu-Bold', self.normalFontSize)

        lp_max_width = 8 * mm
        lp_left = self.left + cell_padding

        name_max_width = 46 * mm
        name_left = lp_left + lp_max_width + column_padding

        quantity_max_width = 12 * mm
        quantity_left = name_left + name_max_width + column_padding

        unit_max_width = 12 * mm
        unit_left = quantity_left + quantity_max_width + column_padding

        unit_price_net_max_width = 18 * mm
        unit_price_net_left = unit_left + unit_max_width + column_padding

        price_net_max_width = 18 * mm
        price_net_left = unit_price_net_left + unit_price_net_max_width + column_padding

        vat_max_width = 15 * mm
        vat_left = price_net_left + price_net_max_width + column_padding

        price_gross_max_width = 18 * mm
        price_gross_left = vat_left + vat_max_width + column_padding

        center_style = ParagraphStyle('normal',
                                      fontName='DejaVu-Bold',
                                      fontSize=self.tinyFontSize,
                                      alignment=TA_CENTER,
                                      leading=10)
        left_style = ParagraphStyle('normal',
                                    fontName='DejaVu-Bold',
                                    fontSize=self.tinyFontSize,
                                    alignment=TA_LEFT,
                                    leading=10)
        right_style = ParagraphStyle('normal',
                                     fontName='DejaVu-Bold',
                                     fontSize=self.tinyFontSize,
                                     alignment=TA_RIGHT,
                                     leading=10)
        header_max_height = 0

        par = Paragraph(_("Lp."), center_style)
        par_width, par_height = par.wrapOn(self.pdf, lp_max_width, 0)
        header_max_height = max(header_max_height, par_height)
        par.drawOn(self.pdf, lp_left, table_top - (cell_padding + par_height))

        par = Paragraph(_("Nazwa towaru lub usługi"), left_style)
        par_width, par_height = par.wrapOn(self.pdf, name_max_width, 0)
        header_max_height = max(header_max_height, par_height)
        par.drawOn(self.pdf, name_left,
                   table_top - (cell_padding + par_height))

        par = Paragraph(_("Ilość"), right_style)
        par_width, par_height = par.wrapOn(self.pdf, quantity_max_width, 0)
        header_max_height = max(header_max_height, par_height)
        par.drawOn(self.pdf, quantity_left,
                   table_top - (cell_padding + par_height))

        par = Paragraph(_("Jedn."), center_style)
        par_width, par_height = par.wrapOn(self.pdf, unit_max_width, 0)
        header_max_height = max(header_max_height, par_height)
        par.drawOn(self.pdf, unit_left,
                   table_top - (cell_padding + par_height))

        par = Paragraph(_("Cena jedn. netto"), right_style)
        par_width, par_height = par.wrapOn(self.pdf, unit_price_net_max_width,
                                           0)
        header_max_height = max(header_max_height, par_height)
        par.drawOn(self.pdf, unit_price_net_left,
                   table_top - (cell_padding + par_height))

        par = Paragraph(_("Wartość netto"), right_style)
        par_width, par_height = par.wrapOn(self.pdf, price_net_max_width, 0)
        header_max_height = max(header_max_height, par_height)
        par.drawOn(self.pdf, price_net_left,
                   table_top - (cell_padding + par_height))

        par = Paragraph(_("Stawka VAT"), right_style)
        par_width, par_height = par.wrapOn(self.pdf, vat_max_width, 0)
        header_max_height = max(header_max_height, par_height)
        par.drawOn(self.pdf, vat_left, table_top - (cell_padding + par_height))

        par = Paragraph(_("Wartość brutto"), right_style)
        par_width, par_height = par.wrapOn(self.pdf, price_gross_max_width, 0)
        header_max_height = max(header_max_height, par_height)
        par.drawOn(self.pdf, price_gross_left,
                   table_top - (cell_padding + par_height))

        self.pdf.setStrokeColor(self.fillDarkColor)
        row_height = header_max_height + 2 * cell_padding
        self.pdf.rect(self.left, table_top - row_height, table_width,
                      row_height)

        center_style = ParagraphStyle('normal',
                                      fontName='DejaVu',
                                      fontSize=self.tinyFontSize,
                                      alignment=TA_CENTER,
                                      leading=10)
        left_style = ParagraphStyle('normal',
                                    fontName='DejaVu',
                                    fontSize=self.tinyFontSize,
                                    alignment=TA_LEFT,
                                    leading=10)
        right_style = ParagraphStyle('normal',
                                     fontName='DejaVu',
                                     fontSize=self.tinyFontSize,
                                     alignment=TA_RIGHT,
                                     leading=10)

        row_top = table_top - row_height

        idx = 1
        for item in self.invoice.items:

            name_height = 0
            lines = item.name.split("\n")

            for line in lines:
                par = Paragraph(line, left_style)
                par_width, par_height = par.wrapOn(self.pdf, name_max_width, 0)
                name_height += par_height

            if idx % 2 == 1:
                self.pdf.setFillColor(self.fillLightColor)
            else:
                self.pdf.setFillColorRGB(1, 1, 1)

            row_height = name_height + 2 * cell_padding
            self.pdf.rect(self.left,
                          row_top - row_height,
                          table_width,
                          row_height,
                          fill=1)

            name_height = 0
            for line in lines:
                par = Paragraph(line, left_style)
                par_width, par_height = par.wrapOn(self.pdf, name_max_width, 0)
                name_height += par_height
                par.drawOn(self.pdf, name_left,
                           row_top - (cell_padding + name_height))

            par = Paragraph("%d." % idx, center_style)
            par_width, par_height = par.wrapOn(self.pdf, lp_max_width, 0)
            par.drawOn(self.pdf, lp_left,
                       row_top - (cell_padding + par_height))

            par = Paragraph(format_amount(item.count), right_style)
            par_width, par_height = par.wrapOn(self.pdf, quantity_max_width, 0)
            name_height += par_height
            par.drawOn(self.pdf, quantity_left,
                       row_top - (cell_padding + par_height))

            par = Paragraph(item.unit, center_style)
            par_width, par_height = par.wrapOn(self.pdf, unit_max_width, 0)
            par.drawOn(self.pdf, unit_left,
                       row_top - (cell_padding + par_height))

            par = Paragraph(format_amount(item.unit_price), right_style)
            par_width, par_height = par.wrapOn(self.pdf,
                                               unit_price_net_max_width, 0)
            par.drawOn(self.pdf, unit_price_net_left,
                       row_top - (cell_padding + par_height))

            par = Paragraph(format_amount(item.total_net_price), right_style)
            par_width, par_height = par.wrapOn(self.pdf, price_net_max_width,
                                               0)
            par.drawOn(self.pdf, price_net_left,
                       row_top - (cell_padding + par_height))

            if item.use_vat == False:
                par = Paragraph(item.use_vat_txt, right_style)
            else:
                par = Paragraph("%d%%" % item.tax, right_style)
            par_width, par_height = par.wrapOn(self.pdf, vat_max_width, 0)
            par.drawOn(self.pdf, vat_left,
                       row_top - (cell_padding + par_height))

            par = Paragraph(format_amount(item.total_tax), right_style)
            par_width, par_height = par.wrapOn(self.pdf, price_gross_max_width,
                                               0)
            par.drawOn(self.pdf, price_gross_left,
                       row_top - (cell_padding + par_height))

            row_top -= row_height
            idx += 1

        return row_top
Ejemplo n.º 27
0
 def drawTitle(self):
     # Up line
     self.pdf.drawString(self.LEFT * mm, self.TOP * mm, self.invoice.title)
     self.pdf.drawString(
         (self.LEFT + 90) * mm, self.TOP * mm,
         _(u'Correcting document: %s') % self.invoice.number)
Ejemplo n.º 28
0
 def drawTitle(self):
     # Up line
     self.pdf.drawString(self.LEFT * mm, self.TOP * mm, self.invoice.title)
     self.pdf.drawString(
         (self.LEFT + 90) * mm, self.TOP * mm,
         _(u'Variable symbol: %s') % self.invoice.variable_symbol)
Ejemplo n.º 29
0
 def __init__(self, name, count, unit_price, tax, unit=_("szt.")):
     self._count = float(count)
     self._unit_price = float(unit_price)
     self._name = unicode(name)
     self._unit = unicode(unit)
     self._tax = float(tax)
Ejemplo n.º 30
0
    def drawItems(self,TOP,LEFT):
        # Items
        path = self.pdf.beginPath()
        path.moveTo(LEFT * mm, (TOP - 4) * mm)
        path.lineTo((LEFT + 176) * mm, (TOP - 4) * mm)
        self.pdf.drawPath(path, True, True)

        self.pdf.setFont('DejaVu-Bold', 7)
        self.pdf.drawString((LEFT + 1) * mm, (TOP - 2) * mm, _(u'List of items'))

        self.pdf.drawString((LEFT + 1) * mm, (TOP - 9) * mm, _(u'Description'))
        items_are_with_tax = self.invoice.use_tax
        if items_are_with_tax:
            i=9
            self.pdf.drawString((LEFT + 68) * mm, (TOP - i) * mm, _(u'Units'))
            self.pdf.drawString((LEFT + 88) * mm, (TOP - i) * mm,
                                _(u'Price per one'))
            self.pdf.drawString((LEFT + 115) * mm, (TOP - i) * mm,
                                _(u'Total price'))
            self.pdf.drawString((LEFT + 137) * mm, (TOP - i) * mm,
                                _(u'Tax'))
            self.pdf.drawString((LEFT + 146) * mm, (TOP - i) * mm,
                                _(u'Total price with tax'))
            i+=5
        else:
            i=9
            self.pdf.drawString((LEFT + 104) * mm, (TOP - i) * mm,
                                _(u'Units'))
            self.pdf.drawString((LEFT + 123) * mm, (TOP - i) * mm,
                                _(u'Price per one'))
            self.pdf.drawString((LEFT + 150) * mm, (TOP - i) * mm,
                                _(u'Total price'))
            i+=5

        self.pdf.setFont('DejaVu', 7)

        # List
        for item in self.invoice.items:
            self.pdf.drawString((LEFT + 1) * mm, (TOP - i) * mm, item.description)
            if item.tax or items_are_with_tax:
                items_are_with_tax = True
                if len(item.description) > 52: i+=5
                if float(int(item.count)) == item.count:
                    self.pdf.drawString((LEFT + 68) * mm, (TOP - i) * mm, '%d %s' % (item.count, item.unit))
                else:
                    self.pdf.drawString((LEFT + 68) * mm, (TOP - i) * mm, '%.1f %s' % (item.count, item.unit))
                self.pdf.drawString((LEFT + 88) * mm, (TOP - i) * mm, '%.2f,- %s' % (item.price, self.invoice.currency))
                self.pdf.drawString((LEFT + 115) * mm, (TOP - i) * mm, '%.2f,- %s' % (item.total, self.invoice.currency))
                self.pdf.drawString((LEFT + 137) * mm, (TOP - i) * mm, '%.0f %%' % item.tax)
                self.pdf.drawString((LEFT + 146) * mm, (TOP - i) * mm, '%.2f,- %s' % (item.total_tax, self.invoice.currency))
                i+=5
            else:
                if len(item.description) > 75: i+=5
                if float(int(item.count)) == item.count:
                    self.pdf.drawString((LEFT + 104) * mm, (TOP - i) * mm, '%d %s' % (item.count, item.unit))
                else:
                    self.pdf.drawString((LEFT + 104) * mm, (TOP - i) * mm, '%.1f %s' % (item.count, item.unit))
                self.pdf.drawString((LEFT + 123) * mm, (TOP - i) * mm, '%.2f,- %s' % (item.price, self.invoice.currency))
                self.pdf.drawString((LEFT + 150) * mm, (TOP - i) * mm, '%.2f,- %s' % (item.total, self.invoice.currency))
                i+=5

        if self.invoice.rounding_result:
            path = self.pdf.beginPath()
            path.moveTo(LEFT * mm, (TOP - i) * mm)
            path.lineTo((LEFT + 176) * mm, (TOP - i) * mm)
            i += 5
            self.pdf.drawPath(path, True, True)
            self.pdf.drawString((LEFT + 1) * mm, (TOP - i) * mm, _(u'Rounding'))
            self.pdf.drawString((LEFT + 68) * mm, (TOP - i) * mm, '%.2f,- %s' % (self.invoice.difference_in_rounding, self.invoice.currency))
            i += 3

        path = self.pdf.beginPath()
        path.moveTo(LEFT * mm, (TOP - i) * mm)
        path.lineTo((LEFT + 176) * mm, (TOP - i) * mm)
        self.pdf.drawPath(path, True, True)

        if not items_are_with_tax:
            self.pdf.setFont('DejaVu-Bold', 11)
            self.pdf.drawString((LEFT + 100) * mm, (TOP - i - 7) * mm, _(u'Total')+': %.2f %s' % (self.invoice.price, self.invoice.currency))
        else:
            self.pdf.setFont('DejaVu-Bold', 6)
            self.pdf.drawString((LEFT + 1) * mm, (TOP - i - 2) * mm, _(u'Breakdown VAT'))
            vat_list, tax_list, total_list, total_tax_list = [_(u'VAT rate')], [_(u'Tax')], [_(u'Without VAT')], [_(u'With VAT')]
            for vat, items in self.invoice.generate_breakdown_vat().iteritems():
                vat_list.append('%.2f%%' % vat)
                tax_list.append('%.2f %s' % (items['tax'], self.invoice.currency))
                total_list.append('%.2f %s' % (items['total'], self.invoice.currency))
                total_tax_list.append('%.2f %s' % (items['total_tax'], self.invoice.currency))


            self.pdf.setFont('DejaVu', 6)
            text = self.pdf.beginText((LEFT + 1) * mm, (TOP - i - 5) * mm)
            text.textLines('\n'.join(vat_list))
            self.pdf.drawText(text)

            text = self.pdf.beginText((LEFT + 11) * mm, (TOP - i - 5) * mm)
            text.textLines('\n'.join(tax_list))
            self.pdf.drawText(text)

            text = self.pdf.beginText((LEFT + 27) * mm, (TOP - i - 5) * mm)
            text.textLines('\n'.join(total_list))
            self.pdf.drawText(text)

            text = self.pdf.beginText((LEFT + 45) * mm, (TOP - i - 5) * mm)
            text.textLines('\n'.join(total_tax_list))
            self.pdf.drawText(text)



            self.pdf.setFont('DejaVu-Bold', 11)
            self.pdf.drawString((LEFT + 100) * mm, (TOP - i - 14) * mm, _(u'Total with tax')+': %.2f %s' % (self.invoice.price_tax, self.invoice.currency))

        if items_are_with_tax:
            self.pdf.rect(LEFT * mm, (TOP - i - 17) * mm, (LEFT + 156) * mm, (i + 19) * mm, stroke=True, fill=False) #140,142
        else:
            self.pdf.rect(LEFT * mm, (TOP - i - 11) * mm, (LEFT + 156) * mm, (i + 13) * mm, stroke=True, fill=False) #140,142

        if self.invoice.creator.stamp_filename:
            im = Image.open(self.invoice.creator.stamp_filename)
            height = float(im.size[1]) / (float(im.size[0])/200.0)
            self.pdf.drawImage(self.invoice.creator.stamp_filename, (LEFT + 98) * mm, (TOP - i - 72) * mm, 200, height)

        path = self.pdf.beginPath()
        path.moveTo((LEFT + 110) * mm, (TOP - i - 70) * mm)
        path.lineTo((LEFT + 164) * mm, (TOP - i - 70) * mm)
        self.pdf.drawPath(path, True, True)

        self.pdf.drawString((LEFT + 112) * mm, (TOP - i - 75) * mm, '%s: %s' % (_(u'Creator'), self.invoice.creator.name))
Ejemplo n.º 31
0
 def drawCorretion(self,TOP,LEFT):
     self.pdf.setFont('DejaVu', 8)
     self.pdf.drawString(LEFT * mm, TOP * mm, _(u'Correction document for invoice: %s') % self.invoice.variable_symbol)
     self.pdf.drawString(LEFT * mm, (TOP - 4) * mm, _(u'Reason to correction: %s') % self.invoice.reason)