コード例 #1
0
    def gen_footer_col1_last_page(self):
        w = self.usable_width / 2
        h = self.usable_height

        if self.cbte.cae:
            # Chequeo de existencia de archivo
            filename = os.path.join(settings.MEDIA_ROOT,
                                    self.cbte.codigo_barras.name)
            if not os.path.isfile(filename):
                genera_codigo_barra(self.cbte)

            return [
                VSpace(),
                RestrictParagraph(
                    self.f("""
                    <b>CAE Nº:</b> {cae}<br/>
                    <b>Vto. CAE:</b> {fecha_vto_cae}<br/>
                    """), w, h, styles["header_normal"]),
                VSpace(),
                CenterRestrictImage(self.cbte.codigo_barras.path, w, 30, 8),
                RestrictParagraph(self.cbte.codigo_barras_nro, w, h,
                                  styles['header_small_center']),
                VSpace(),
            ]
        else:
            return [
                VSpace(),
                RestrictParagraph("""No válido como factura""", w, h,
                                  styles["header_big"]),
                VSpace(),
            ]
コード例 #2
0
    def gen_header_row2(self):
        w = self.usable_width
        h = self.usable_height
        if self.cbte_data["tipo_cbte"]["letra"] == "E":
            return [
                VSpace(),
                RestrictParagraph(
                    self.f("""
 <b>Sres:</b> {cliente[nombre]}
 <b>Domicilio:</b> {cliente[domicilio]}
 <b>Localidad:</b> {cliente[localidad]}
 <b>Cuit Pais:</b> {pais_destino[cuit]}""").replace(" ", "&nbsp;"), w, h,
                    styles["header_small"]),
                VSpace(),
            ]
        if self.cbte_data["cliente"]['nro_doc'] == '0':
            return [
                VSpace(),
                RestrictParagraph("<b>Consumidor Final</b>", w, h,
                                  styles["header_small"]),
                VSpace(),
            ]

        return [
            VSpace(),
            RestrictParagraph(
                self.f("""
 <b>Sres:</b> {cliente[nombre]}
 <b>Domicilio:</b> {cliente[domicilio]}
 <b>Localidad:</b> {cliente[localidad]}
 <b>Telefono:</b> {cliente[telefono]}""").replace(" ", "&nbsp;"), w, h,
                styles["header_small"]),
            VSpace(),
        ]
コード例 #3
0
    def gen_header_row3(self):
        w = self.usable_width
        h = self.usable_height
        if self.cbte_data["tipo_cbte"]["letra"] == "E":
            data = """
 <b>Divisa:</b> {moneda[nombre]}
 <b>Destino:</b> {pais_destino[nombre]}
"""
            if self.cbte_data.get("forma_pago", False):
                data = data + "<b>Forma de pago:</b>: {forma_pago}"

            if self.cbte_data.get("incoterms", False):
                data = data + "<b>Incoterms:</b>: {incoterms}"

            if self.cbte_data.get("cbte_asoc", False):
                data = data + "<b>Asociado a</b>: {cbte_asoc[tipo_cbte][nombre]} {cbte_asoc[tipo_cbte][letra]} {cbte_asoc[pp_numero]}"

            if self.cbte_data.get("fecha_pago", False):
                data = data + "<b>Fecha Pago</b>: {fecha_pago}"

            return [
                VSpace(),
                RestrictParagraph(
                    self.f(data).replace(" ", "&nbsp;"), w, h,
                    styles["header_small"]),
                VSpace(),
            ]
        if self.cbte_data["cliente"]['nro_doc'] == '0':
            data = ""
        else:
            data = "<b>{cliente[tipo_doc]}: </b> {cliente[nro_doc_formatted]} "

        data += """ <b>IVA: </b> {cliente[condicion_iva]}
 <b>Remito: </b> {remito_nro}
 <b>Vto. Pago: </b> {fecha_venc_pago}
 <b>Cond. Venta: </b> {condicion_venta}"""
        return [
            VSpace(),
            RestrictParagraph(
                self.f(data).replace(" ", "&nbsp;"), w, h,
                styles["header_small"]),
            VSpace(),
        ]
コード例 #4
0
    def gen_header2(self, copy_number):
        nro_prefix = "Nº "
        w = self.header_col_width
        h = self.usable_height
        if self.cbte.cae:
            if copy_number == 1:
                invoice_copy_number_desc = "Original"
            if copy_number == 2:
                invoice_copy_number_desc = "Duplicado"
            elif copy_number == 3:
                invoice_copy_number_desc = "Triplicado"

        ret = [
            VSpace(),
            RestrictParagraph(
                self.f("{tipo_cbte[nombre]}") if self.cbte.cae else
                "No válido como factura", w, h, styles["header_big"]),
            VSpace(),
            RestrictParagraph(
                invoice_copy_number_desc if self.cbte.cae else "", w, h,
                styles["header_big"]),
            VSpace(),
            RestrictParagraph(
                self.f(nro_prefix + "{pp_numero}").format(
                    nro_prefix, self.cbte_data), w, h,
                styles["header_medium"]),
            VSpace(),
            RestrictParagraph(
                self.f("<b>Orden de Compra:</b> {}<br/>").format(
                    self.cbte.orden_compra.nro)
                if self.cbte.orden_compra else "" + self.
                f("""
        <b>Fecha de emision:</b> {fecha_emision}<br/>
        <b>CUIT:</b> {empresa[nro_doc_formatted]}<br/>""" +
                  self.gen_header_iibb() +
                  """<b>Fecha de inicio actividad:</b> {empresa[fecha_serv_desde]}
        """), w, h, styles["header_normal"]),
            VSpace(),
        ]

        return ret
コード例 #5
0
    def gen_footer_observaciones(self):
        w = self.usable_width
        h = self.usable_height

        if self.cbte.observaciones:
            return [
                VSpace(),
                RestrictParagraph(
                    "<b>Observaciones: </b> " + self.cbte.observaciones, w, h,
                    styles['header_small']),
                VSpace()
            ]
        else:
            return []
コード例 #6
0
    def gen_header1(self):
        w = self.header_col_width
        h = self.usable_height

        items = []

        if self.cbte.empresa.logo:
            items = items + [
                VSpace(),
                CenterRestrictImage(self.cbte.empresa.logo.path, w, 50),
                VSpace(),
                RestrictParagraph(self.f("{empresa[nombre]}"), w, h,
                                  styles["header_company_name"]),
            ]
        else:
            items = items + [
                VSpace(),
                RestrictParagraph(self.f("{empresa[nombre]}"), w, h,
                                  styles["header_company_name_large"]),
                VSpace(18),
            ]

        items = items + [
            # if LOGO else styles[ "header_company_name_large"])
            VSpace(),
            RestrictParagraph(
                self.f("""
                <b>Domicilio:</b> {empresa[domicilio]}<br/>
                <b>Localidad:</b> {empresa[localidad]}<br/>
                <b>Email:</b> {empresa[email]}<br/>
                <b>Condicion frente al IVA:</b> {empresa[condicion_iva]}
                """), w, h, styles["header_normal"]),
            VSpace(),
        ]

        return items
コード例 #7
0
    def gen_footer_legend(self):
        w = self.usable_width
        h = self.usable_height

        s = self

        def get_data():
            return "Página {} de {}".format(s.page_number,
                                            len(s.paged_detail_items))

        return [
            RestrictParagraph(
                "Esta factura electrónica fue confeccionada con el sistema de Facturación Electrónica Pirra. "
                "La información contenida en éste documento es privilegiada y confidencial, para uso exclusivo "
                "de los destinatarios de la misma y/o de quienes hayan sido autorizados específicamente para leerla.",
                w, h, styles['legend_xs']),
            VSpace(),
            PageCounterParagraph("Página 1 de 1", get_data, w, h,
                                 styles['legend_xs'])
        ]
コード例 #8
0
    def gen_detail_items(self):
        w = self.usable_width
        s = 50
        l = 65
        items = []

        for det in self.cbte_detail:

            it = [
                RestrictParagraph("{:.2f}".format(det.cant), s,
                                  self.detail_height, styles['detail_right']),
                RestrictParagraph(str(det.unidad), s, self.detail_height,
                                  styles['detail_left']),
                RestrictParagraph(
                    det.detalle,
                    w - (s * 5) - (l if self.cbte.discrimina_iva() else -s),
                    self.detail_height, styles['detail_left']),
                RestrictParagraph(
                    self._format_moneda(
                        det.precio_unit if self.cbte.discrimina_iva(
                        ) else det.precio_unitario_con_iva), s,
                    self.detail_height, styles['detail_right']),
            ]
            if self.cbte.discrimina_iva():
                it += [
                    RestrictParagraph(self._format_moneda(det.importe_neto), s,
                                      self.detail_height,
                                      styles['detail_right']),
                    RestrictParagraph(str(det.alicuota_iva), l,
                                      self.detail_height,
                                      styles['detail_right']),
                ]
            it += [
                RestrictParagraph(self._format_moneda(det.precio_total), s,
                                  self.detail_height, styles['detail_right']),
            ]
            items.append(it)
        return items
コード例 #9
0
 def gen_detail_header(self):
     w = self.usable_width
     s = 50
     l = 65
     data = [
         RestrictParagraph("Cant.", s, 40, styles['detail_header_right']),
         RestrictParagraph("Unidad", s, 40, styles['detail_header_left']),
         RestrictParagraph(
             "Descripción",
             w - (s * 5) - (l if self.cbte.discrimina_iva() else -s), 40,
             styles['detail_header_left']),
         RestrictParagraph("Precio Unit.", s, 40,
                           styles['detail_header_right']),
     ]
     if self.cbte.discrimina_iva():
         data += [
             RestrictParagraph("Subtotal", s, 40,
                               styles['detail_header_right']),
             RestrictParagraph("IVA", l, 40, styles['detail_header_right']),
         ]
     data += [
         RestrictParagraph("Total", s, 40, styles['detail_header_right']),
     ]
     return data
コード例 #10
0
 def gen_header_letter(self):
     if self.cbte.cae:
         if self.cbte.es_comprobante_m():
             return [
                 RestrictParagraph(self.f("{tipo_cbte[letra]}"), 68, 50,
                                   styles["header_letter"]),
                 RestrictParagraph(
                     "La operación igual o mayor a un mil pesos ($ 1.000.-) está sujeta a retención",
                     68, 50, styles["header_letter_xxs"]),
                 RestrictParagraph(self.f("COD. {tipo_cbte[id_afip]:02d}"),
                                   68, 50, styles["header_letter_xs"]),
             ]
         else:
             return [
                 RestrictParagraph(self.f("{tipo_cbte[letra]}"), 50, 50,
                                   styles["header_letter"]),
                 RestrictParagraph(self.f("COD. {tipo_cbte[id_afip]:02d}"),
                                   50, 50, styles["header_letter_xs"]),
             ]
     else:
         return [
             RestrictParagraph("No válido como factura", 50, 50,
                               styles["header_letter_xs"])
         ]