-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathSectionReferences.py
More file actions
125 lines (111 loc) · 3.35 KB
/
SectionReferences.py
File metadata and controls
125 lines (111 loc) · 3.35 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
# -*- coding: utf-8 -*-
""" References Section of the Document
Contains:
* Document Type
* Document Serial Number
* Document Date
* Reason of Reference
"""
from .TemplateElement import TemplateElement
DOC_TYPE_STRINGS = {
30 : "FACTURA",
32 : "FACTURA NO AFECTA O EXENTA",
33 : "FACTURA ELECTRÓNICA",
34 : "FACTURA NO AFECTA O EXENTA ELECTRÓNICA",
35 : "BOLETA",
38 : "BOLETA EXENTA",
39 : "BOLETA ELECTRÓNICA",
40 : "LIQUIDACIÓN FACTURA",
41 : "BOLETA EXENTA ELECTRÓNICA",
43 : "LIQUIDACIÓN FACTURA ELECTRÓNICA",
45 : "FACTURA DE COMPRA",
46 : "FACTURA DE COMPRA ELECTRÓNICA",
50 : "GUÍA DE DESPACHO.",
52 : "GUÍA DE DESPACHO ELECTRÓNICA",
55 : "NOTA DE DÉBITO",
56 : "NOTA DE DÉBITO ELECTRÓNICA",
60 : "NOTA DE CRÉDITO",
61 : "NOTA DE CRÉDITO ELECTRÓNICA",
103 : "LIQUIDACIÓN",
110 : "FACTURA DE EXPORTACIÓN ELECTRÓNICA",
111 : "NOTA DE DÉBITO DE EXPORTACIÓN ELECTRÓNICA",
112 : "NOTA DE CRÉDITO DE EXPORTACIÓN ELECTRÓNICA",
801 : "ORDEN DE COMPRA",
802 : "NOTA DE PEDIDO",
803 : "CONTRATO",
804 : "RESOLUCIÓN",
805 : "PROCESO CHILECOMPRA",
806 : "FICHA CHILECOMPRA",
807 : "DUS",
808 : "B/L (CONOCIMIENTO DE EMBARQUE)",
809 : "AWB (AIR WILL BILL)",
810 : "MIC/DTA",
811 : "CARTA DE PORTE",
812 : "RESOLUCIÓN DEL SNA DONDE CALIFICA SERVICIOS DE EXPORTACIÓN",
813 : "PASAPORTE",
814 : "CERTIFICADO DE DEPÓSITO BOLSA PROD. CHILE.",
815 : "VALE DE PRENDA BOLSA PROD. CHILE",
'SET': "SET"
}
class SectionReferences(TemplateElement):
"""
%% -----------------------------------------------------------------
%% SECTION - References
%% -----------------------------------------------------------------
{
%%%% ITEM TABLE
\\begin{longtabu}{@{} X[-1l] X[l] X[-1r] X[-1r] X[-1r] @{}}
%%%% HEADER
\\rowfont{\\%s}
\\everyrow{\\rowfont{\\%s}}
\\textbf{Nro.} &
\\textbf{Razón} &
\\textbf{Tipo} &
\\textbf{Folio} &
\\textbf{Fecha} \\\\
%%\\tabucline{1-4}
\\firsthline[1mm]
%%%% CONTENT
%s
\\end{longtabu}
}
"""
def __init__(self):
self._refs = []
def append_reference(self, reason, index, dte_type, dte_serial, dte_date):
self._refs.append((
index,
reason,
DOC_TYPE_STRINGS[dte_type],
dte_serial,
dte_date
))
@property
def carta(self):
return self.__doc__ % (
'small',
'footnotesize',
self._build_references(),
)
@property
def oficio(self):
return self.__doc__ % (
'small',
'footnotesize',
self._build_references()
)
@property
def thermal80mm(self):
return self.__doc__ % (
'scriptsize',
'scriptsize',
self._build_references()
)
def _build_references(self):
refs = []
for ref in self._refs:
refs.append('{0} & {1} & {2} & {3} & {4}\\\\'.format(*ref))
if refs:
return ('\n' + ' ' * 4 * 3).join(refs)
else:
return '– sin referencias –'