示例#1
0
    def draw_info(self, invoice, canvas):
        """Draw legal info between contacts table and actual items."""
        from django.conf import settings

        canvas.setStrokeColorRGB(0.9, 0.9, 0.9)
        canvas.setLineWidth(0.5)
        canvas.line(1.5 * cm, self.baseline, (21 - 1.5) * cm, self.baseline)

        self.baseline -= 0.7 * cm
        textobject = canvas.beginText(1.5 * cm, self.baseline)
        textobject.textLine(u"{0}: {1}".format(_("Date issued"), format_date(invoice.date_issued)))
        textobject.textLine(u"{0}: {1}".format(_("Date due"), format_date(invoice.date_due)))
        canvas.drawText(textobject)

        try:
            textobject = canvas.beginText(11.5 * cm, self.baseline)
            textobject.textLine(_("Bank account: ") + str(invoice.contractor_bank))
            if getattr(settings, "LANGUAGE_CODE", "en_US") in ("cs", "cz", "cs_CZ", "cs_SK", "sk"):
                textobject.textLine(u"{0}: {1}".format(_("Variable symbol"), invoice.uid))
            canvas.drawText(textobject)
        except:
            logger.warn("Contractor {} has no bank account".format(invoice.contractor))

        self.baseline -= 1.5 * cm
        if invoice.get_info():
            lines = 0
            canvas.setFontSize(9)
            textobject = canvas.beginText(1.5 * cm, self.baseline)
            for line in invoice.get_info().split("\n"):
                lines += 1
                textobject.textLine(line.strip())
            canvas.drawText(textobject)
            self.baseline -= lines * 0.5 * cm
示例#2
0
 def draw_header(self, invoice, canvas):
     """Draw the invoice header with date and ID."""
     canvas.setFillColorRGB(0.2, 0.2, 0.2)
     canvas.setFont(self.FONT_NAME, 16)
     canvas.drawString(2 * cm, self.baseline, smart_text(invoice))
     canvas.drawString((21 - 6) * cm, self.baseline, format_date(invoice.date_issued))
     canvas.setLineWidth(3)
     self.baseline -= 0.3 * cm
     colors = (0.9, 0.5, 0.2)
     canvas.setStrokeColorRGB(*colors)
     canvas.line(1.5 * cm, self.baseline, (21 - 1.5) * cm, self.baseline)
     self.baseline -= 1 * cm
示例#3
0
    def draw_info(self, invoice, canvas):
        # Informations between Contact and Items
        canvas.setStrokeColorRGB(0.9, 0.9, 0.9)
        canvas.setLineWidth(0.5)
        canvas.line(1.5*cm, self.baseline, (21 - 1.5)*cm, self.baseline)

        self.baseline -= .7*cm
        textobject = canvas.beginText(1.5*cm, self.baseline)
        textobject.textLine(u"{0}: {1}".format(
            _('Date issuance'),
            format_date(invoice.date_issuance))
        )
        textobject.textLine(u"{0}: {1}".format(
            _('Due date'),
            format_date(invoice.date_due))
        )
        canvas.drawText(textobject)

        if invoice.contractor_bank:
            textobject = canvas.beginText(11.5*cm, self.baseline)
            textobject.textLine(
                _("Bank account: ") + invoice.contractor_bank.as_text()
            )
            textobject.textLine(u"{0}: {1}".format(
                _('Variable symbol'),
                invoice.id
            ))
            canvas.drawText(textobject)

        self.baseline -= 1.5*cm
        if invoice.get_info():
            lines = 0
            canvas.setFontSize(9)
            textobject = canvas.beginText(1.5*cm, self.baseline)
            for line in invoice.get_info().split("\n"):
                lines += 1
                textobject.textLine(line.strip())
            canvas.drawText(textobject)
            self.baseline -= lines * .5 * cm
示例#4
0
 def draw_header(self, invoice, canvas):
     """Draw the invoice header with date and ID."""
     canvas.setFillColorRGB(0.2, 0.2, 0.2)
     canvas.setFont(self.FONT_NAME, 16)
     canvas.drawString(2 * cm, self.baseline, smart_text(invoice))
     canvas.drawString((21 - 6) * cm, self.baseline,
                       format_date(invoice.date_issued))
     canvas.setLineWidth(3)
     self.baseline -= 0.3 * cm
     colors = (0.9, 0.5, 0.2)
     canvas.setStrokeColorRGB(*colors)
     canvas.line(1.5 * cm, self.baseline, (21 - 1.5) * cm, self.baseline)
     self.baseline -= 1 * cm
示例#5
0
    def draw_info(self, invoice, canvas):
        """Draw legal info between contacts table and actual items."""
        from django.conf import settings
        canvas.setStrokeColorRGB(0.9, 0.9, 0.9)
        canvas.setLineWidth(0.5)
        canvas.line(1.5 * cm, self.baseline, (21 - 1.5) * cm, self.baseline)

        self.baseline -= .7 * cm
        textobject = canvas.beginText(1.5 * cm, self.baseline)
        textobject.textLine(u"{0}: {1}".format(
            _('Date issued'), format_date(invoice.date_issued)))
        textobject.textLine(u"{0}: {1}".format(_('Date due'),
                                               format_date(invoice.date_due)))
        canvas.drawText(textobject)

        try:
            textobject = canvas.beginText(11.5 * cm, self.baseline)
            textobject.textLine(
                _("Bank account: ") + str(invoice.contractor_bank))
            if getattr(settings, "LANGUAGE_CODE",
                       "en_US") in ("cs", "cz", "cs_CZ", "cs_SK", "sk"):
                textobject.textLine(u"{0}: {1}".format(_('Variable symbol'),
                                                       invoice.uid))
            canvas.drawText(textobject)
        except:
            logger.warn("Contractor {} has no bank account".format(
                invoice.contractor))

        self.baseline -= 1.5 * cm
        if invoice.get_info():
            lines = 0
            canvas.setFontSize(9)
            textobject = canvas.beginText(1.5 * cm, self.baseline)
            for line in invoice.get_info().split("\n"):
                lines += 1
                textobject.textLine(line.strip())
            canvas.drawText(textobject)
            self.baseline -= lines * .5 * cm