# Path: src/sii/lib/printing/helpers.py
# def escape_tex(string):
#     chars = '%|\$|&'
# 
#     return re.sub('(?<!\\\\)({0})'.format(chars), r'\\\1', string)
# 
# Path: src/sii/lib/printing/TemplateElement.py
# class TemplateElement(object):
# 
#     @property
#     def resources(self):
#         """ Requires the return of a list of `Resource` object providing
#         the filename the template is going to expect, and the data that
#         should be inside of it.
# 
#         In case of none, return an empty list.
#         """
#         return []
# 
#     @property
#     def carta(self) -> str:
#         """ Create TeX Template for printable medium: "US Letter"
#         """
#         raise NotImplementedError
# 
#     @property
#     def oficio(self) -> str:
#         """ Create TeX Template for printable medium: "American Foolscap"
#         """
#         raise NotImplementedError
# 
#     @property
#     def thermal80mm(self) -> str:
#         """ Create TeX Template for printable medium: "Thermal endless 80mm width"
#         """
#         raise NotImplementedError


from .helpers import escape_tex
from .TemplateElement import TemplateElement
            \\tabulinesep=_1.0mm^1.0mm
            \\vspace{1mm}

            \\begin{tabu}{X[-1r] X[-1l] X[-1r] X[-1l]}
                \\rowfont{\\footnotesize}
                \\everyrow{\\rowfont{\\footnotesize}}
                \\textbf{SEÑOR(ES):} & %s &
                \\textbf{R.U.T.:}    & %s \\\\
                \\textbf{DIRECCION:} & %s &
                \\textbf{COMUNA:}    & %s \\\\
                \\textbf{GIRO:}      & %s &
                \\textbf{CIUDAD:}    & %s \\\\
                \\hline
                \\textbf{VENDEDOR:}             & %s &
                \\textbf{PATENTE:}              & %s \\\\
                \\textbf{N\\textdegree PEDIDO:} & %s &
                                                & \\\\
            \\end{tabu}
        }
    \\end{mdframed}
    """
    def __init__(self, emission_date, expiration_date,
                       receivername, receiverrut, receiveraddress,
                       receivercomune, receiveractivity, receivercity='',
                       emittersalesman='', ordernumber='', licenceplate=''):
        self._emission_date    = emission_date
        self._expiration_date  = expiration_date

        self._receivername     = escape_tex(receivername)
        self._receiverrut      = receiverrut

# Path: src/sii/lib/printing/helpers.py
# def escape_tex(string):
#     chars = '%|\$|&'
# 
#     return re.sub('(?<!\\\\)({0})'.format(chars), r'\\\1', string)
# 
# Path: src/sii/lib/printing/TemplateElement.py
# class TemplateElement(object):
# 
#     @property
#     def resources(self):
#         """ Requires the return of a list of `Resource` object providing
#         the filename the template is going to expect, and the data that
#         should be inside of it.
# 
#         In case of none, return an empty list.
#         """
#         return []
# 
#     @property
#     def carta(self) -> str:
#         """ Create TeX Template for printable medium: "US Letter"
#         """
#         raise NotImplementedError
# 
#     @property
#     def oficio(self) -> str:
#         """ Create TeX Template for printable medium: "American Foolscap"
#         """
#         raise NotImplementedError
# 
#     @property
#     def thermal80mm(self) -> str:
#         """ Create TeX Template for printable medium: "Thermal endless 80mm width"
#         """
#         raise NotImplementedError


# Path: src/sii/lib/printing/SectionReceiver.py
from .helpers import escape_tex
from .TemplateElement import TemplateElement

            \\tabulinesep=_1.0mm^1.0mm
            \\vspace{1mm}

            \\begin{tabu}{X[-1r] X[-1l] X[-1r] X[-1l]}
                \\rowfont{\\footnotesize}
                \\everyrow{\\rowfont{\\footnotesize}}
                \\textbf{SEÑOR(ES):} & %s &
                \\textbf{R.U.T.:}    & %s \\\\
                \\textbf{DIRECCION:} & %s &
                \\textbf{COMUNA:}    & %s \\\\
                \\textbf{GIRO:}      & %s &
                \\textbf{CIUDAD:}    & %s \\\\
                \\hline
                \\textbf{VENDEDOR:}             & %s &
                \\textbf{PATENTE:}              & %s \\\\
                \\textbf{N\\textdegree PEDIDO:} & %s &
                                                & \\\\
            \\end{tabu}
        }
    \\end{mdframed}
    """
    def __init__(self, emission_date, expiration_date,
                       receivername, receiverrut, receiveraddress,
                       receivercomune, receiveractivity, receivercity='',
                       emittersalesman='', ordernumber='', licenceplate=''):
        self._emission_date    = emission_date
        self._expiration_date  = expiration_date

        self._receivername     = escape_tex(receivername)
        self._receiverrut      = receiverrut

        self._receiveraddress  = escape_tex(receiveraddress)