summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/source/latex/factura
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2016-05-16 20:36:12 +0000
committerKarl Berry <karl@freefriends.org>2016-05-16 20:36:12 +0000
commit5a4815a1e4e22f0b4bf7358647c51bb9ec342fe0 (patch)
tree01f384a3e983e713b06d43bab04245238c59d4e4 /Master/texmf-dist/source/latex/factura
parentc1224c35298e95661e09676cbab3d5830612ce87 (diff)
factura (16may16)
git-svn-id: svn://tug.org/texlive/trunk@41202 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/source/latex/factura')
-rw-r--r--Master/texmf-dist/source/latex/factura/factura.dtx470
1 files changed, 300 insertions, 170 deletions
diff --git a/Master/texmf-dist/source/latex/factura/factura.dtx b/Master/texmf-dist/source/latex/factura/factura.dtx
index dc5208958aa..7f45dc8f7f0 100644
--- a/Master/texmf-dist/source/latex/factura/factura.dtx
+++ b/Master/texmf-dist/source/latex/factura/factura.dtx
@@ -163,7 +163,7 @@ and factura-beispiel-rechnung.tex.
%<class>\ProvidesClass{factura}
%<def>\ProvidesFile{factura.def}
%<*class|def>
-[2016/02/07 v2.6
+[2016/05/16 v2.72
%<class>Clase para elaborar facturas legales
%<class>en la República Bolivariana de Venezuela.
%<def>Archivo valores iniciales y condiciones de borde para factura.cls
@@ -172,7 +172,7 @@ and factura-beispiel-rechnung.tex.
%</class|def>
%<*driver>
\documentclass{ltxdoc}
-\usepackage[letterpaper,marginparsep=10pt,vmargin={3.3cm,2cm},hmargin={4cm,2cm}]{geometry}
+\usepackage[letterpaper,marginparsep=10pt,vmargin={3.2cm,2cm},hmargin={4cm,2cm}]{geometry}
\usepackage[usenames,dvipsnames]{color}
\usepackage[spanish]{babel}
\usepackage{paralist,calc,verbatim,graphicx,array,todo,etoolbox,metalogo,ifxetex,ifluatex,footnote,hypdoc}
@@ -334,6 +334,11 @@ and factura-beispiel-rechnung.tex.
% \changes{v2.6}{2016/03/07}{{\slshape parbox}es para cada elemento en la tabla, para asegurar que la denominación del gravámen quede alineada correctamente.}
% \changes{v2.6}{2016/03/07}{Quitados los paquetes \texttt{xifthen} y \texttt{pbox}. Arreglada la presentación de los datos del cliente cuando el resumen es más grande.}
% \changes{v2.6}{2016/03/07}{Cuando había descuentos totales y se pedía modo de totalización en filas, este modo no se apagaba correctamente y la línea oblicua daba problemas. Arreglado.}
+% \changes{v2.72}{2016/05/16}{Las macros internas \cs{@DescripcionAuxCmd} y \cs{@EscribeTipoDeImpuesto} fueron modificadas.}
+% \changes{v2.72}{2016/05/16}{Arreglada la alineación a la derecha en algunos casos en los precios.}
+% \changes{v2.72}{2016/05/16}{Se incluyó dentro de \cs{\@ITEM} la opción para soportar \cs{ItemX}.}
+% \changes{v2.72}{2016/05/16}{Ahora se procesa el entorno de la factura aún cuando se pide sólo el reporte, para poder tomar las referencias y los totales. Para eso se cambiaron de sitio varias macros internas.}
+% \changes{v2.72}{2016/05/16}{Agregadas las etiquetas y las referencias.}
%
% \DoNotIndex{}
%
@@ -977,7 +982,7 @@ and factura-beispiel-rechnung.tex.
%
% }
%
-% \section{Tipografía para cada texto}
+% \section{Tipografías para cada elemento a escribir}
%
% Cada elemento escrito en la factura o reporte es sujeto a ser mostrado con una tipografía distinta, para lo cual existen comandos con los que se asigna el tipo de letra o estilo para cada cosa que sale escrita en el documento, por ejemplo, se puede cambiar el tipo de letra con el que se escribe la fecha, el tipo de letra con el que salen los elementos dentro del cuadro de la factura, el tipo de letra de los totales, de los títulos, de las cabeceras o piés de página en el reporte, etc.
%
@@ -1072,7 +1077,7 @@ and factura-beispiel-rechnung.tex.
%
% Incluye un archivo cuya extensión debe ser |.def| o |.tex|, con cualquiera de los comandos anteriores que modifican el estilo del documento, identifican al cliente o al proveedor del servicio.
%
-% \noindent \DescribeMacro{\mostrar}{\color{RoyalBlue}|\mostrar{@-macro}|}
+% \noindent \DescribeMacro{\mostrar}{\color{RoyalBlue}|\mostrar|\marg{@-macro}}
%
% Por último, disponemos del comando |\mostrar| cuya función es escribir lo que está alojado en una macro interna que contenga un símbolo ``|@|'' en su nombre. Es necesario un comando para mostrar una macro con este símbolo para que el usuario no tenga que usar |\makeatletter| y |\makeatother|.
%
@@ -1080,6 +1085,56 @@ and factura-beispiel-rechnung.tex.
%
% }
%
+% \section{Etiquetas y referencias}
+%
+% Esta clase |factura| soporta agregar etiquetas a cada elemento de la factura que luego en la descripción larga o en el reporte queramos referenciar.
+%
+% \noindent \DescribeMacro{\label}{\color{RoyalBlue}|\label|\marg{etiqueta}}
+%
+% Para ello usamos la conocida macro |\label| de \LaTeX{} justamente después del ítem que nos interese luego referenciar, por ejemplo:
+%
+% \iffalse
+%<*literal>
+% \fi
+\begin{verbatim}
+\begin{factura}
+ \Item{1}{Artículo gravado con IVA general}{1000}
+ \Item{3}{Otro artículo gravado con IVA general}{1500}\label{el-otro}
+\end{factura}
+\end{verbatim}
+% \iffalse
+%</literal>
+% \fi
+%
+% De esta forma creamos una etiqueta llamada ``el-otro'' para el segundo elemento, que luego podremos citar en la descripción larga o en el reporte con comandos similares a los que \LaTeX{} provee para referenciar etiquetas.
+%
+% \noindent \DescribeMacro{\itemref}{\color{RoyalBlue}|\itemref|\marg{etiqueta}}\\
+% \noindent \DescribeMacro{\cantref}{\color{RoyalBlue}|\cantref|\marg{etiqueta}}\\
+% \noindent \DescribeMacro{\descref}{\color{RoyalBlue}|\descref|\marg{etiqueta}}\\
+% \noindent \DescribeMacro{\puref}{\color{RoyalBlue}|\puref|\marg{etiqueta}}\\
+% \noindent \DescribeMacro{\dctoref}{\color{RoyalBlue}|\dctoref|\marg{etiqueta}}\\
+% \noindent \DescribeMacro{\ptref}{\color{RoyalBlue}|\ptref|\marg{etiqueta}}\par
+%
+% Los comandos anteriores son para usarse donde queramos hacer la cita, es decir, en la descripción larga o en el reporte.
+%
+% Si se quiere mostrar el número que ocupa el ítem en la lista, lo hacemos con |\itemref|, que en el ejemplo aparecería el número ``|2|'' indicando que es el segundo ítem de la factura. Con |\cantref| escribimos la cantidad del elemento citado mediante la etiqueta, en nuestro ejemplo sería ``|3|''. Para la descripción del ítem usamos |\descref|, que en el caso del ejemplo sería el texto ``|Otro artículo gravado con IVA general|''. Para el precio unitario usamos |\puref|; en el ejemplo ``|1.500,00|''. Si se quiere mostrar el descuento del ítem citado usamos |\dctoref|, que para el ejemplo sería ``|0|''. Por último, para mostar el precio total usamos |\ptref|, y en nuestro ejemplo eso escribiría ``|4.500,00|''.
+%
+% Podemos ver que el uso de los comandos |\puref| y |\ptref| nos muestran el precio en el mismo formato con el que lo vemos en la presentación de la factura, en cuanto al redondeo y al separador de miles y decimal.
+%
+% Con la asignación de estas etiquetas y su uso mediante las referencias podemos de manera conveniente citar cualquier ítem que se haya facturado, de manera dinámica sin tener que reescribir en la descripción larga o en el reporte aquello que ya se escribió en el cuadro de la factura.
+%
+% Por otra parte, también podemos en la descripción larga y en el resumen referirnos al signo monetario con el comando |\Moneda|, y a cualquiera de los totales de la siguiente forma:
+%
+% \begin{tabular}{rl}
+% \hline
+% Total & Comando \\ \hline
+% Bases imponibles & |\BIG|, |\BIE|, |\BIR|, |\BIA| \\
+% IVA & |\AlicuotaG|, |\AlicuotaR|, |\AlicuotaA| \\
+% Subtotales\footnote{El subtotal es el monto sin aplicar el descuento, que coincide con la base imponible cuando no hay descuento.} & |\SubtG|, |\SubtE|, |\SubtR|, |\SubtA| \\
+% Descuentos & |\DescG|, |\DescE|, |\DescR|, |\DescA| \\
+% Total final & |\Total|
+% \end{tabular}
+%
% \section{Más personalizaciones}
%
% \DescribeMacro{\@PosicionaFecha}
@@ -1240,10 +1295,16 @@ and factura-beispiel-rechnung.tex.
% |\LetraReporte| & Tipografía para el texto del reporte. \\
% |\Item[RAEX]| & Agrega un elemento a la factura\footnote{Estos comandos \cs{Item} se escriben dentro del ambiente \texttt{factura} y no en el preámbulo.}. \\
% |\Descripcion| & Descripción larga de la factura\footnote{El comando \cs{Descripcion} se escribe dentro del documento, luego del ambiente \texttt{factura}, y no en el preámbulo.}. \\
+% |\label| & Agrega una etiqueta a un ítem de la factura\footnote{Se mantiene el nombre ``\cs{label}'' por compatibilidad con los comandos conocidos de \LaTeX. Este comando también se escribe dentro del ambiente \texttt{factura}.}. \\
+% |\itemref| & Hace referencia al número de línea que ocupa el ítem etiquetado\footnote{También se mantienen los nombres de las macros que terminan en ``\texttt{ref}'' por compatibilidad con comandos de \LaTeX{} como \cs{pageref}.}. \\
+% |\cantref| & Hace referencia a la cantidad del ítem. \\
+% |\descref| & Hace referencia a la descripción del ítem. \\
+% |\puref| & Hace referencia al precio unitario del ítem. \\
+% |\dctoref| & Hace referencia al descuento del ítem. \\
+% |\ptref| & Hace referencia al precio total del ítem. \\
+% |\mostrar| & Mostramos una variable que contenga ``|@|'' sin usar ``|\makeatletter|''\footnote{Este comando tampoco se usa en el preámbulo sino en cualquier otra parte del documento.}.
% \end{tabular}
%
-% \todo*{Agregar etiquetas y referencias.}
-%
% \StopEventually{\endorgo}
%
% \begin{macrocode}
@@ -1290,6 +1351,7 @@ and factura-beispiel-rechnung.tex.
\newif\if@nombre
\newif\if@pagado
\newif\if@impdesc
+\newif\if@pruebaref
\RequirePackage{etoolbox}% 'etoolbox' para los condicionales binarios.
@@ -1425,6 +1487,7 @@ and factura-beispiel-rechnung.tex.
\RequirePackage{tabularx}% Con 'tabularx' hacemos la tabla.
\RequirePackage{environ}% Con 'environ' podemos usar tabularx dentro del ambiente de la factura y escribir texto en el enddef.
\RequirePackage{fancyhdr}% Las cabeceras fancy; así se use solamente en reporte, hay que cargarlo siempre.
+\RequirePackage{MnSymbol}% Para el símbolo $\lcurvearrowsw$ cuando la descripción ocupa más de una línea.
\AtBeginDocument{% Da error si algún campo necesario no está definido.
\if@reporte
@@ -1480,7 +1543,7 @@ and factura-beispiel-rechnung.tex.
\ClassWarning{factura}{** Fecha del documento\space \@Fecha\space distinta de la fecha de hoy. **}{}%
\fi
\fi
- \if@factura\ClassInfo{factura}{\@@Total: \space\space\space \@Moneda \Total}{}\fi}
+ \if@factura\ClassInfo{factura}{\@@Total: \space\space\space \Moneda \Total}{}\fi}
%</class>
%<*class|def>
@@ -1512,7 +1575,7 @@ and factura-beispiel-rechnung.tex.
\def\@DigitosNumeracion{5}
%% La moneda:
-\def\@Moneda{Bs.}
+\def\Moneda{Bs.}
%% Al lado de cada ítem va la letra que designa el gravamen que aplica sobre él:
\def\@DenomAlicuotaG{G}
@@ -1562,14 +1625,18 @@ and factura-beispiel-rechnung.tex.
\def\@@Proveedor{Proveedor:}
\def\@@Cliente{Cliente:}
-%% i) Carácter de fin de línea en el cuadro de la factura,
-%% ii) carácter para separar el teléfono del e-mail del cliente,
-%% iii) carácter para los campos vacíos cuando se usa \ItemX,
-%% iv) carácter para las celdas vacíos cuando la descripción del ítem ocupa más que una línea.
-\def\@CaracterEOL{$\hookleftarrow$}
+%% i) carácter para separar el teléfono del e-mail del cliente,
+%% ii) carácter para los campos vacíos cuando se usa \ItemX,
+%% iii) carácter para las celdas vacíos cuando la descripción del ítem ocupa más que una línea.
+%% iv) carácter de retorno de carro en el cuadro de la factura,
\def\@CaracterSeparaTelefonoEmail{$\diamond$}
\def\@CaracterItemXVacio{...}
\def\@CaracterCeldasVacias{$\cdot$}
+\def\@CaracterCR{$\lcurvearrowsw\!$}% (del paquete MnSymbol)
+%% \def\@CaracterCR{$\hookleftarrow$}% también puede usarse este.
+
+%% Separación entre la última letra y el carácter que indica que se continúa en la línea siguiente en la descripción cuando ocupa más de una línea. No vale la pena hacer una macro para cambiar esto.
+\setlength{\@SeparaFinLineaDesc}{0.05cm}
%% Separación entre el inicio de una columna en la tabla y el inicio del texto.
\tabcolsep=0.15cm
@@ -1975,6 +2042,7 @@ and factura-beispiel-rechnung.tex.
\newlength{\@SeparaElementos}
\newlength{\@SeparaMinTotales}
\newlength{\@SeparaFilas}
+\newlength{\@SeparaFinLineaDesc}
\newlength{\@InicioReporte}
\newlength{\@FirmaFacturaXcorr}
\newlength{\@FirmaFacturaYcorr}
@@ -1996,6 +2064,7 @@ and factura-beispiel-rechnung.tex.
\newbox{\@CajaCond}
\newbox{\@CajaEspacioVacio}
\newbox{\@CajaPrueba}
+\newbox{\@CajaCaracterCR}
%% Contadores para uso interno para uso interno:
\newcounter{@IVANoGeneral}% '0' con sólo IVA G, '1' cuando hay IVA R o IVA A, y '2' cuando hay ambos.
@@ -2061,11 +2130,14 @@ and factura-beispiel-rechnung.tex.
%% http://tex.stackexchange.com/questions/296035/insert-a-special-character-at-each-end-of-line-in-a-paragraph
%% http://tex.stackexchange.com/questions/248944/how-to-put-before-lines
\newcommand{\@DescripcionAuxCmd}[2]{%
- \setbox0\hbox{\parbox[t]{\linewidth}{#1\par\global\count1=\prevgraf}}%
+ \setbox0\hbox{\parbox[t]{\linewidth}{#1%
+ \if@impdesc\hfill\ \@EscribeTipoDeImpuesto{#2}\fi%
+ \par\global\count1=\prevgraf}}%
\ifnum\count1 = 1
- #1\if@impdesc\hfill\ \@EscribeTipoDeImpuesto*{#2}\fi
+ #1%
+ \if@impdesc\hfill\ \@EscribeTipoDeImpuesto{#2}\fi
\else
- \parbox[t]{\linewidth-1em}{%
+ \parbox[t]{\linewidth-\wd\@CajaCaracterCR-\@SeparaFinLineaDesc}{%
\David@XStart#1\David@XEnd
\par
\count0=\prevgraf
@@ -2074,10 +2146,10 @@ and factura-beispiel-rechnung.tex.
\ifnum\count0=\count2
\if@impdesc
\vskip-\baselineskip
- \mbox{}\hfill\rlap{\hspace*{1em}\llap{\@EscribeTipoDeImpuesto*{#2}}}%
+ \mbox{}\hfill\rlap{\hspace*{\wd\@CajaCaracterCR}\hspace*{\@SeparaFinLineaDesc}\llap{\@EscribeTipoDeImpuesto{#2}}}%
\fi
\else
- \mbox{}\hfill\rlap{\hspace*{0.1em}\@CaracterEOL}%
+ \mbox{}\hfill\rlap{\hspace*{\@SeparaFinLineaDesc}\usebox{\@CajaCaracterCR}}%
\fi
\vskip-2\baselineskip
\advance\count0 -1
@@ -2085,9 +2157,7 @@ and factura-beispiel-rechnung.tex.
\repeat
\kern\count2\baselineskip\mbox{}%
\strut}%
- \fi
- \global\expandafter\newcount\csname c@Item\expandafter\romannumeral\value{@NumItem}Lineas\endcsname
- \global\expandafter\csname c@Item\expandafter\romannumeral\value{@NumItem}Lineas\endcsname=\count1}
+ \fi}
%% Comandos auxiliares para colocar en \parbox cada celda.
\newcommand{\@CantidadAuxCmd}[1]{%
@@ -2278,22 +2348,15 @@ and factura-beispiel-rechnung.tex.
\newcommand{\@LineaNodoBCoordX}{\hspace*{-\tabcolsep}\zsaveposx{LineaNodoBCoordX}\hspace*{\tabcolsep}}
%% Escribe la letra que designa al tipo de impuesto que aplica al ítem.
-\NewDocumentCommand{\@EscribeTipoDeImpuesto}{s m}{%
+\NewDocumentCommand{\@EscribeTipoDeImpuesto}{m}{%
% Hay que abrir un grupo de ejecución porque el cambio en la tipografía altera la celda.
- \ifx#2G{%
- \if@G
- {\@LetraTipoIVA\@DenomAlicuotaG}% Si tiene IVA general escribimos 'G' si se solicita.
- \IfBooleanF{#1}{\ \hfill}%
- \else
- \hfill
- \fi}\fi
- {\if@G
- {\@LetraTipoIVA
- \ifx#2E\@DenomAlicuotaE\fi% Si está exento escribimos '(E)'.
- \ifx#2R\@DenomAlicuotaR\fi% Si tiene IVA reducido escribimos 'R'.
- \ifx#2A\@DenomAlicuotaA\fi% Si tiene IVA adicional escribimos 'A'.
- \IfBooleanF{#1}{\ \hfill}}%
- \fi}}
+ {\if@G
+ \@LetraTipoIVA
+ \ifx#1G\@DenomAlicuotaG\fi% Si tiene IVA general escribimos 'G'.
+ \ifx#1E\@DenomAlicuotaE\fi% Si está exento escribimos '(E)'.
+ \ifx#1R\@DenomAlicuotaR\fi% Si tiene IVA reducido escribimos 'R'.
+ \ifx#1A\@DenomAlicuotaA\fi% Si tiene IVA adicional escribimos 'A'.
+ \fi}}
%% Comando para poner en cero los contadores de los totales porque el ambiente de la factura se evalúa tres veces y los totales se sumarían todos tres veces.
\newcommand{\@ZERO}{%
@@ -2305,10 +2368,12 @@ and factura-beispiel-rechnung.tex.
\FPset\SubtG{0}\global\let\SubtG\SubtG
\FPset\SubtR{0}\global\let\SubtR\SubtR
\FPset\SubtA{0}\global\let\SubtA\SubtA
+ \FPset\SubtX{0}\global\let\SubtX\SubtX
\FPset\DescE{0}\global\let\DescE\DescE
\FPset\DescG{0}\global\let\DescG\DescG
\FPset\DescR{0}\global\let\DescR\DescR
\FPset\DescA{0}\global\let\DescA\DescA
+ \FPset\DescX{0}\global\let\DescX\DescX
\FPset\AlicuotaG{0}\global\let\AlicuotaG\AlicuotaG
\FPset\AlicuotaR{0}\global\let\AlicuotaR\AlicuotaR
\FPset\AlicuotaA{0}\global\let\AlicuotaA\AlicuotaA}
@@ -2340,7 +2405,7 @@ and factura-beispiel-rechnung.tex.
\def\@FacturaAuxColumnasEval{
% Primera línea.
\ifbool{SinLineasVertExt}{}{|}
- % Columna 'X' con DCU, columna fantasma con 'sincantidad' y columa 'c' con CDU.
+ % Columna 'X' con DCU, columna fantasma con 'sincantidad' y columna 'c' con CDU.
\ifbool{PrimeroDesc}{X}{
\ifbool{SinCantidad}{l@{\extracolsep{0pt}}}{c}}
% Segunda línea.
@@ -2366,6 +2431,55 @@ and factura-beispiel-rechnung.tex.
\edef\@FacturaAuxInicioCmd{\noexpand\begin{tabularx}{\textwidth}{\@FacturaAuxColumnasEval}}
+%% Comando para hacer los cálculos sobre cada ítem y establecer las macros con el contenido de cada ítem introducido.
+\newcommand{\@CalculaItem}[5]{%
+ \addtocounter{@NumItem}{1}%
+ % Calculamos.
+ \FPupn\PrecioU{#4 \@DigitosMoneda{} round}%
+ \ifx\\#5\\\FPset\Dcto{0}\else\FPupn\Dcto{#5 \@DigitosPorc{} round clip}\fi% Fijamos en 0 el descuento si no se especifica.
+ \FPupn\PrecioT{100 \Dcto{} 100 - / #2 * \PrecioU{} * \@DigitosMoneda{} round}%
+ \global\let\PrecioU\PrecioU
+ \global\let\Dcto\Dcto
+ \global\let\PrecioT\PrecioT
+ % Suma el elemento actual al subtotal acumulado.
+ \expandafter\FPupn\csname Subt#1\endcsname{\PrecioT{} \csname Subt#1\endcsname{} + \@DigitosMoneda{} round}%
+ \global\expandafter\let\csname Subt#1\expandafter\endcsname\csname Subt#1\endcsname
+ % Guardamos en macros cada elemento agregado a la factura; por ejemplo: \@Item@i@Cantidad contiene la cantidad que se introdujo para el primer ítem; así mismo con ii@, @iii@, y así mismo también con @Descripcion, @PrecioU, @Descuento y @PrecioT.
+ \expandafter\gdef\csname @Item@\romannumeral\value{@NumItem}@Cantidad\endcsname{\numprint{#2}}%
+ \expandafter\gdef\csname @Item@\romannumeral\value{@NumItem}@Descripcion\endcsname{#3}%
+ \expandafter\global\expandafter\edef\csname @Item@\romannumeral\value{@NumItem}@PrecioU\endcsname{\noexpand\numprint{\PrecioU}}%
+ \expandafter\global\expandafter\edef\csname @Item@\romannumeral\value{@NumItem}@Descuento\endcsname{\noexpand\numprint{\Dcto}}%
+ \expandafter\global\expandafter\edef\csname @Item@\romannumeral\value{@NumItem}@PrecioT\endcsname{\noexpand\numprint{\PrecioT}}}
+
+% Macro interna para saber si una etiqueta existe o no.
+\gdef\@pruebaref#1{%
+ \expandafter\ifx\csname @Etiqueta@@#1\endcsname\relax
+ \ClassWarning{factura}{La etiqueta `#1' no está definida}{}\ignorespaces
+ \@pruebareffalse
+ \else
+ \@pruebareftrue
+ \fi}
+
+% Comandos para las referencias: i) referencia al número de ítem, ii) a la cantidad, iii) a la descripción, iv) al precio unitario, v) al descuento, vi) al precio total.
+\gdef\itemref#1{\@pruebaref{#1}\if@pruebaref \csname @Etiqueta@@#1\endcsname \fi}
+\gdef\cantref#1{\@pruebaref{#1}\if@pruebaref \csname @Item@\expandafter\romannumeral\csname @Etiqueta@@#1\endcsname @Cantidad\endcsname \fi}
+\gdef\descref#1{\@pruebaref{#1}\if@pruebaref \csname @Item@\expandafter\romannumeral\csname @Etiqueta@@#1\endcsname @Descripcion\endcsname \fi}
+\gdef\puref#1{\@pruebaref{#1}\if@pruebaref \csname @Item@\expandafter\romannumeral\csname @Etiqueta@@#1\endcsname @PrecioU\endcsname \fi}
+\gdef\dctoref#1{\@pruebaref{#1}\if@pruebaref \csname @Item@\expandafter\romannumeral\csname @Etiqueta@@#1\endcsname @Descuento\endcsname \fi}
+\gdef\ptref#1{\@pruebaref{#1}\if@pruebaref \csname @Item@\expandafter\romannumeral\csname @Etiqueta@@#1\endcsname @PrecioT\endcsname \fi}
+
+% Definimos un comando para la etiqueta, que se define dentro del entorno de la factura para que tenga alcance local; cuando se acaba dicho entorno, el comando \label vuelve a ser lo que está definido en latex.ltx.
+\newcommand{\label@factura}[1]{%
+ \expandafter\ifx\csname @Etiqueta@@#1\endcsname\relax
+ \expandafter\global\expandafter\edef\csname @Etiqueta@@#1\endcsname{\arabic{@NumItem}}\ignorespaces
+ \else
+ \expandafter\if\csname @Etiqueta@@#1\endcsname\the@NumItem
+ \ClassInfo{factura}{Etiqueta `#1' definida para el ítem \arabic{@NumItem}}{}%
+ \else
+ \ClassWarning{factura}{La etiqueta `#1' se definió más de una vez}{}\ignorespaces
+ \fi
+ \fi}
+
%% Comando auxiliar para la definición del ambiente de la factura; al final de este comando está el texto que va en el enddef del ambiente de la factura.
\newcommand{\@FacturaAuxCmd}[1]{%
\if@exparriba
@@ -2405,16 +2519,18 @@ and factura-beispiel-rechnung.tex.
\def\David@XLeft##1{\David@XPad{\romannumeral\value{@NumItem}}{\hbox{##1}}{}}%
\def\David@XRight##1{\David@XPad{\romannumeral\value{@NumItem}}{}{\hbox{##1}}}%
%
- % Comando interno para todos los ítems.
- \newcommand{\@ITEM}[5]{% 1. [R|G|A|E]; 2. cantidad; 3. descripción; 4. p/u; 5. dcto.
- \addtocounter{@NumItem}{1}%
- % Calculamos.
- \FPupn\PrecioU{##4 \@DigitosMoneda{} round}%
- \ifx\\##5\\\FPset\Dcto{0}\else\FPupn\Dcto{##5 \@DigitosPorc{} round clip}\fi% Fijamos en 0 el descuento si no se especifica.
- \FPupn\PrecioT{100 \Dcto{} 100 - / ##2 * \PrecioU{} * \@DigitosMoneda{} round}%
- \global\let\PrecioU\PrecioU
- \global\let\Dcto\Dcto
- \global\let\PrecioT\PrecioT
+ % Caja auxiliar para el caracter de retorno de carro y poder saber si tamaño en el campo de la descripción.
+ \savebox{\@CajaCaracterCR}{\@LetraItems\@CaracterCR}
+ %
+ % Comando interno general para agregar cualquier ítem.
+ \newcommand{\@ITEM}[5]{% 1. [R|G|A|E|X]; 2. cantidad; 3. descripción; 4. p/u; 5. dcto.
+ \@CalculaItem{##1}{##2}{##3}{##4}{##5}%
+ % Si no es el primer ítem, entonces hace falta \\ para terminar el ítem anterior.
+ \ifnum\value{@NumItem}=1%
+ \else
+ \\
+ \if@conlineasha\hline\fi% Líneas para separar cada ítem, si hiciera falta.
+ \fi
% Primer campo: Acá puede ir la cantidad (cdu) o la descripción (dcu y duc).
\ifbool{SinCantidad}{}{%
\ifbool{PrimeroDesc}
@@ -2426,7 +2542,11 @@ and factura-beispiel-rechnung.tex.
\if@dcu
\David@XRight{\@CantidadAuxCmd{\mbox{}\hfill \@LetraNumeros \numprint{##2}\hfill\mbox{}}}% dcu.
\else
- \David@XRight{\@PrecioUAuxCmd{\if@impdesc\else\@EscribeTipoDeImpuesto{##1}\fi \@LetraNumeros \numprint{\PrecioU}}}% duc.
+ \David@XRight{\@PrecioUAuxCmd{%
+ \ifx##1X \hfill \@CaracterItemXVacio \hfill\mbox{}%
+ \else
+ \if@impdesc\else\@EscribeTipoDeImpuesto{##1}\fi \hfill \@LetraNumeros \numprint{\PrecioU}
+ \fi}}% duc.
\fi}
{\@DescripcionAuxCmd{##3}{##1}}% cdu.
&
@@ -2436,132 +2556,65 @@ and factura-beispiel-rechnung.tex.
\if@duc
\David@XRight{\@CantidadAuxCmd{\mbox{}\hfill \@LetraNumeros \numprint{##2}\hfill\mbox{}}}% duc.
\else
- \David@XRight{\@PrecioUAuxCmd{\if@impdesc\else\@EscribeTipoDeImpuesto{##1}\fi \@LetraNumeros \numprint{\PrecioU}}}% dcu y cdu.
+ \David@XRight{\@PrecioUAuxCmd{%
+ \ifx##1X \hfill \@CaracterItemXVacio \hfill\mbox{}%
+ \else
+ \if@impdesc\else\@EscribeTipoDeImpuesto{##1}\fi \hfill \@LetraNumeros \numprint{\PrecioU}
+ \fi}}% dcu y cdu.
\fi}%
&
% Cuarto campo: Descuento.
- \ifbool{Descuentos}{\FPifeq\Dcto{0}\else\David@XRight{\@DescuentoAuxCmd{\mbox{}\hfill \@LetraNumeros \numprint{\Dcto}\%\hfill\mbox{}}}\fi}{}% Tenemos que usar un condicional booleano porque si no da problemas con el condicional \FPifeq.
+ \ifbool{Descuentos}{%
+ \David@XRight{\@DescuentoAuxCmd{%
+ \ifx##1X \hfill \@CaracterItemXVacio \hfill\mbox{}%
+ \else
+ \mbox{}\hfill \@LetraNumeros \numprint{\Dcto}\%\hfill\mbox{}
+ \fi}}}{}% Tenemos que usar un condicional booleano porque si no da problemas con el condicional \FPifeq.
&
% Quinto campo: El total.
- \David@XRight{\@PrecioTAuxCmd{\if@impdesc\else\@EscribeTipoDeImpuesto{##1}\fi \@LetraNumeros \numprint{\PrecioT}}}%
+ \David@XRight{\@PrecioTAuxCmd{%
+ \ifx##1X \hfill \@CaracterItemXVacio \hfill\mbox{}%
+ \else
+ \if@impdesc\else\@EscribeTipoDeImpuesto{##1}\fi \hfill \@LetraNumeros \numprint{\PrecioT}
+ \fi}}%
% Escribimos al csv.
\if@csv
\ifbool{SinCantidad}
{\if@descuentos
- \immediate\write\csv{"\unexpanded{##3}","##5","\PrecioT","##1"}%
+ \immediate\write\csv{"\unexpanded{##3}","\Dcto","\PrecioT","##1"}%
\else
\immediate\write\csv{"\unexpanded{##3}","\PrecioT","##1"}%
\fi}
{\if@cdu
\if@descuentos
- \immediate\write\csv{"##2","\unexpanded{##3}","##4","##5","\PrecioT","##1"}%
+ \immediate\write\csv{"##2","\unexpanded{##3}","\PrecioU","\Dcto","\PrecioT","##1"}%
\else
- \immediate\write\csv{"##2","\unexpanded{##3}","##4","\PrecioT","##1"}%
+ \immediate\write\csv{"##2","\unexpanded{##3}","\PrecioU","\PrecioT","##1"}%
\fi
\fi
\if@dcu
\if@descuentos
- \immediate\write\csv{"\unexpanded{##3}","##2","##4","##5","\PrecioT","##1"}%
+ \immediate\write\csv{"\unexpanded{##3}","##2","\PrecioU","\Dcto","\PrecioT","##1"}%
\else
- \immediate\write\csv{"\unexpanded{##3}","##2","##4","\PrecioT","##1"}%
+ \immediate\write\csv{"\unexpanded{##3}","##2","\PrecioU","\PrecioT","##1"}%
\fi
\fi
\if@duc
\if@descuentos
- \immediate\write\csv{"\unexpanded{##3}","##4","##2","##5","\PrecioT","##1"}%
+ \immediate\write\csv{"\unexpanded{##3}","\PrecioU","##2","\Dcto","\PrecioT","##1"}%
\else
- \immediate\write\csv{"\unexpanded{##3}","##4","##2","\PrecioT","##1"}%
+ \immediate\write\csv{"\unexpanded{##3}","\PrecioU","##2","\PrecioT","##1"}%
\fi
\fi}%
- \fi
- % Suma el elemento actual al subtotal acumulado.
- \expandafter\FPupn\csname Subt##1\endcsname{\PrecioT{} \csname Subt##1\endcsname{} + \@DigitosMoneda{} round}%
- \global\expandafter\let\csname Subt##1\expandafter\endcsname\csname Subt##1\endcsname
- \\
- \if@conlineasha\hline\fi}%
- %
- \ifbool{SinCantidad}
- % Definamos todos los comandos \Item***.
- {%
- \if@descuentos
- \newcommand{\Item}[3]{\@ITEM{G}{1}{##1}{##2}{##3}}% Ítem normal.
- \newcommand{\ItemR}[3]{\global\@BIRtrue\global\@Gtrue\@ITEM{R}{1}{##1}{##2}{##3}}% Ítem con IVA reducido.
- \newcommand{\ItemA}[3]{\global\@BIAtrue\global\@Gtrue\@ITEM{A}{1}{##1}{##2}{##3}}% Ítem con IVA reducido.
- \newcommand{\ItemE}[3]{\global\@Exentotrue\global\@Gtrue\@ITEM{E}{1}{##1}{##2}{##3}}% Ítem con IVA reducido.
- \else
- \newcommand{\Item}[2]{\@ITEM{G}{1}{##1}{##2}{0}}% Ítem normal.
- \newcommand{\ItemR}[2]{\global\@BIRtrue\global\@Gtrue\@ITEM{R}{1}{##1}{##2}{0}}% Ítem con IVA reducido.
- \newcommand{\ItemA}[2]{\global\@BIAtrue\global\@Gtrue\@ITEM{A}{1}{##1}{##2}{0}}% Ítem con IVA reducido.
- \newcommand{\ItemE}[2]{\global\@Exentotrue\global\@Gtrue\@ITEM{E}{1}{##1}{##2}{0}}% Ítem con IVA reducido.
- \fi
- \let\ItemG\Item
- \newcommand{\ItemX}[1]{% Ítem sin precio.
- \if@csv\immediate\write\csv{"\unexpanded{##1}"}\fi
- & ##1 && \if@descuentos \@CaracterItemXVacio \fi & \hfill \@CaracterItemXVacio \hfill\mbox{}\\
- \if@conlineasha\hline\fi}%
- \if@csv
- \if@descuentos
- \immediate\write\csv{"\@@Descripcion","\@@Descuento","\@@Precio \space (\@Moneda)"}
- \else
- \immediate\write\csv{"\@@Descripcion","\@@Precio \space (\@Moneda)"}
- \fi
- \fi}
- {%
- \if@descuentos
- \newcommand{\Item}[4]{\@ITEM{G}{##1}{##2}{##3}{##4}}% Ítem normal.
- \newcommand{\ItemR}[4]{\global\@BIRtrue\global\@Gtrue\@ITEM{R}{##1}{##2}{##3}{##4}}% Ítem con IVA reducido.
- \newcommand{\ItemA}[4]{\global\@BIAtrue\global\@Gtrue\@ITEM{A}{##1}{##2}{##3}{##4}}% Ítem con IVA adicional.
- \newcommand{\ItemE}[4]{\global\@Exentotrue\global\@Gtrue\@ITEM{E}{##1}{##2}{##3}{##4}}% Ítem exento de IVA.
- \else
- \newcommand{\Item}[3]{\@ITEM{G}{##1}{##2}{##3}{0}}% Ítem normal.
- \newcommand{\ItemR}[3]{\global\@BIRtrue\global\@Gtrue\@ITEM{R}{##1}{##2}{##3}{0}}% Ítem con IVA reducido.
- \newcommand{\ItemA}[3]{\global\@BIAtrue\global\@Gtrue\@ITEM{A}{##1}{##2}{##3}{0}}% Ítem con IVA adicional.
- \newcommand{\ItemE}[3]{\global\@Exentotrue\global\@Gtrue\@ITEM{E}{##1}{##2}{##3}{0}}% Ítem exento de IVA.
- \fi
- \let\ItemG\Item
- \newcommand{\ItemX}[2]{% Ítem sin precio.
- \if@cdu
- \if@csv\immediate\write\csv{"##1","\unexpanded{##2}",""}\fi
- \@LetraNumeros\numprint{##1} & ##2 & \hfill \@CaracterItemXVacio \hfill\mbox{} & \if@descuentos \@CaracterItemXVacio \fi & \hfill \@CaracterItemXVacio \hfill\mbox{} \\
- \fi
- \if@dcu
- \if@csv\immediate\write\csv{"\unexpanded{##2}","##1",""}\fi
- ##2 & \@LetraNumeros\numprint{##1} & \hfill \@CaracterItemXVacio \hfill\mbox{} & \if@descuentos \@CaracterItemXVacio \fi & \hfill \@CaracterItemXVacio \hfill\mbox{} \\
- \fi
- \if@duc
- \if@csv\immediate\write\csv{"\unexpanded{##2}","","##1"}\fi
- ##2 & \hfill \@CaracterItemXVacio \hfill\mbox{} & \@LetraNumeros\numprint{##1} & \if@descuentos \@CaracterItemXVacio \fi & \hfill \@CaracterItemXVacio \hfill\mbox{} \\
- \fi
- \if@conlineasha\hline\fi}%
- \if@csv
- \if@cdu
- \if@descuentos
- \immediate\write\csv{"\@@Cantidad","\@@Descripcion","\@@PrecioU \space (\@Moneda)","\@@Descuento","\@@PrecioT \space (\@Moneda)"}%
- \else
- \immediate\write\csv{"\@@Cantidad","\@@Descripcion","\@@PrecioU \space (\@Moneda)","\@@PrecioT \space (\@Moneda)"}%
- \fi
- \fi
- \if@dcu
- \if@descuentos
- \immediate\write\csv{"\@@Descripcion","\@@Cantidad","\@@PrecioU \space (\@Moneda)","\@@Descuento","\@@PrecioT \space (\@Moneda)"}%
- \else
- \immediate\write\csv{"\@@Descripcion","\@@Cantidad","\@@PrecioU \space (\@Moneda)","\@@PrecioT \space (\@Moneda)"}%
- \fi
- \fi
- \if@duc
- \if@descuentos
- \immediate\write\csv{"\@@Descripcion","\@@PrecioU \space (\@Moneda)","\@@Cantidad","\@@Descuento","\@@PrecioT \space (\@Moneda)"}%
- \else
- \immediate\write\csv{"\@@Descripcion","\@@PrecioU \space (\@Moneda)","\@@Cantidad","\@@PrecioT \space (\@Moneda)"}%
- \fi
- \fi
- \fi}
+ \fi}%
%
+ % Usamos la definición de \label@factura dentro del entorno de la factura para que sea local aquí nada más.
+ \let\label\label@factura
\@LetraItems% Este es el tipo de letra que tendrán los ítems, y en este tipo de letra se define el \baselineskip de toda la factura.
\@FacturaAuxInicioCmd
\ifbool{SinLineasHoriExt}{}{\hline}%
\@ZERO
- % Estamos en la cantidad o la descripción.
+ % Estamos en la cantidad, o la descripción.
\ifbool{LineaDesdeColUno}{\@LineaNodoACoordX}{}%
\ifbool{SinCantidad}{}{\ifbool{PrimeroDesc}{\@DescripcionAuxCmd{\@LetraTitCuadro \@@Descripcion}{}}{\@CantidadAuxCmd{\mbox{}\hfill \@LetraTitCuadro \@@Cantidad \hfill\mbox{}}}}%
&% Avanzamos hasta la descripción, la cantidad o el precio unitario.
@@ -2570,7 +2623,7 @@ and factura-beispiel-rechnung.tex.
\ifbool{SinCantidad}{\@DescripcionAuxCmd{\@LetraTitCuadro \@@Descripcion}{}}
{\if@cdu \@DescripcionAuxCmd{\@LetraTitCuadro \@@Descripcion}{}\fi
\if@dcu \@CantidadAuxCmd{\mbox{}\hfill \@LetraTitCuadro \@@Cantidad \hfill\mbox{}}\fi
- \if@duc \@PrecioUAuxCmd{\mbox{}\hfill \@LetraTitCuadro \@@PrecioU \hfill\mbox{}}\fi}%
+ \if@duc \@PrecioUAuxCmd{\mbox{}\hfill \@LetraTitCuadro \@@PrecioU \space (\Moneda)\hfill\mbox{}}\fi}%
&% Avanzamos hasta el precio unitario, o la cantidad, o columna fantasma cuando es 'sincantidad'.
\ifbool{SinCantidad}{%
\ifbool{LineaHastaColDos}{\hspace*{\tabcolsep}\zsaveposx{LineaNodoBCoordX}\hspace*{-\tabcolsep}}{}}%
@@ -2579,18 +2632,19 @@ and factura-beispiel-rechnung.tex.
\if@duc
\@CantidadAuxCmd{\mbox{}\hfill \@LetraTitCuadro \@@Cantidad \hfill\mbox{}}%
\else
- \@PrecioUAuxCmd{\mbox{}\hfill \@LetraTitCuadro \@@PrecioU \space (\@Moneda)\hfill\mbox{}}%
+ \@PrecioUAuxCmd{\mbox{}\hfill \@LetraTitCuadro \@@PrecioU \space (\Moneda)\hfill\mbox{}}%
\fi}%
&% Avanzamos hasta el descuento, que puede o no existir.
\if@descuentos \@DescuentoAuxCmd{\mbox{}\hfill \@LetraTitCuadro \@@Descuento \hfill\mbox{}}\fi
&% Avanzamos hasta el precio total.
- \@PrecioTAuxCmd{\mbox{}\hfill \@LetraTitCuadro \ifbool{SinCantidad}{\@@Precio}{\@@PrecioT}\space (\@Moneda)\hfill\mbox{}}%
+ \@PrecioTAuxCmd{\mbox{}\hfill \@LetraTitCuadro \ifbool{SinCantidad}{\@@Precio}{\@@PrecioT}\space (\Moneda)\hfill\mbox{}}%
\ifbool{LineaHastaFinal}{\hspace*{\tabcolsep}\zsaveposx{LineaNodoBCoordX}\hspace*{-\tabcolsep}}{}%
\\
\ifbool{SinLineasHoriInt}{}{\hline}%
%
#1% Aquí entran todos los items que el usuario declara dentro del ambiente.
- %
+ \\% El último fin de línea se hace aquí.
+ \if@conlineasha\hline\fi% Se verifica si hace falta una línea horizontal o no.
\if@filas
% Esto en lugar de \if@exparriba para que no se haga una linea vacía en la tabla cuando la caja está vacía.
\ifdim \ht\@CajaEspacioVacio=0pt
@@ -2706,6 +2760,68 @@ and factura-beispiel-rechnung.tex.
\if@exparriba\zsaveposy{EspacioVacioFinal}\fi
\vspace*{\@SeparaElementos}\par}
+ \ifbool{SinCantidad}
+ % Definamos todos los comandos \Item***.
+ {%
+ \if@descuentos
+ \newcommand{\Item}[3]{\@ITEM{G}{1}{#1}{#2}{#3}}% Ítem normal.
+ \newcommand{\ItemR}[3]{\global\@BIRtrue\global\@Gtrue\@ITEM{R}{1}{#1}{#2}{#3}}% Ítem con IVA reducido.
+ \newcommand{\ItemA}[3]{\global\@BIAtrue\global\@Gtrue\@ITEM{A}{1}{#1}{#2}{#3}}% Ítem con IVA reducido.
+ \newcommand{\ItemE}[3]{\global\@Exentotrue\global\@Gtrue\@ITEM{E}{1}{#1}{#2}{#3}}% Ítem con IVA reducido.
+ \else
+ \newcommand{\Item}[2]{\@ITEM{G}{1}{#1}{#2}{0}}% Ítem normal.
+ \newcommand{\ItemR}[2]{\global\@BIRtrue\global\@Gtrue\@ITEM{R}{1}{#1}{#2}{0}}% Ítem con IVA reducido.
+ \newcommand{\ItemA}[2]{\global\@BIAtrue\global\@Gtrue\@ITEM{A}{1}{#1}{#2}{0}}% Ítem con IVA reducido.
+ \newcommand{\ItemE}[2]{\global\@Exentotrue\global\@Gtrue\@ITEM{E}{1}{#1}{#2}{0}}% Ítem con IVA reducido.
+ \fi
+ \newcommand{\ItemX}[1]{\@ITEM{X}{1}{#1}{0}{0}}% Ítem sin precio.
+ \let\ItemG\Item
+ \if@csv
+ \if@descuentos
+ \immediate\write\csv{"\@@Descripcion","\@@Descuento","\@@Precio \space (\Moneda)"}
+ \else
+ \immediate\write\csv{"\@@Descripcion","\@@Precio \space (\Moneda)"}
+ \fi
+ \fi}
+ {%
+ \if@descuentos
+ \newcommand{\Item}[4]{\@ITEM{G}{#1}{#2}{#3}{#4}}% Ítem normal.
+ \newcommand{\ItemR}[4]{\global\@BIRtrue\global\@Gtrue\@ITEM{R}{#1}{#2}{#3}{#4}}% Ítem con IVA reducido.
+ \newcommand{\ItemA}[4]{\global\@BIAtrue\global\@Gtrue\@ITEM{A}{#1}{#2}{#3}{#4}}% Ítem con IVA adicional.
+ \newcommand{\ItemE}[4]{\global\@Exentotrue\global\@Gtrue\@ITEM{E}{#1}{#2}{#3}{#4}}% Ítem exento de IVA.
+ \else
+ \newcommand{\Item}[3]{\@ITEM{G}{#1}{#2}{#3}{0}}% Ítem normal.
+ \newcommand{\ItemR}[3]{\global\@BIRtrue\global\@Gtrue\@ITEM{R}{#1}{#2}{#3}{0}}% Ítem con IVA reducido.
+ \newcommand{\ItemA}[3]{\global\@BIAtrue\global\@Gtrue\@ITEM{A}{#1}{#2}{#3}{0}}% Ítem con IVA adicional.
+ \newcommand{\ItemE}[3]{\global\@Exentotrue\global\@Gtrue\@ITEM{E}{#1}{#2}{#3}{0}}% Ítem exento de IVA.
+ \fi
+ \newcommand{\ItemX}[2]{\@ITEM{X}{#1}{#2}{0}{0}}% Ítem sin precio.
+ \let\ItemG\Item
+ \if@csv
+ \if@cdu
+ \if@descuentos
+ \immediate\write\csv{"\@@Cantidad","\@@Descripcion","\@@PrecioU \space (\Moneda)","\@@Descuento","\@@PrecioT \space (\Moneda)"}%
+ \else
+ \immediate\write\csv{"\@@Cantidad","\@@Descripcion","\@@PrecioU \space (\Moneda)","\@@PrecioT \space (\Moneda)"}%
+ \fi
+ \fi
+ \if@dcu
+ \if@descuentos
+ \immediate\write\csv{"\@@Descripcion","\@@Cantidad","\@@PrecioU \space (\Moneda)","\@@Descuento","\@@PrecioT \space (\Moneda)"}%
+ \else
+ \immediate\write\csv{"\@@Descripcion","\@@Cantidad","\@@PrecioU \space (\Moneda)","\@@PrecioT \space (\Moneda)"}%
+ \fi
+ \fi
+ \if@duc
+ \if@descuentos
+ \immediate\write\csv{"\@@Descripcion","\@@PrecioU \space (\Moneda)","\@@Cantidad","\@@Descuento","\@@PrecioT \space (\Moneda)"}%
+ \else
+ \immediate\write\csv{"\@@Descripcion","\@@PrecioU \space (\Moneda)","\@@Cantidad","\@@PrecioT \space (\Moneda)"}%
+ \fi
+ \fi
+ \fi}
+
+
\if@factura
% Los descuentos totales no son compatibles -y no sé si lo serán- con el modo de totalización en filas.
\if@filas
@@ -2782,8 +2898,13 @@ and factura-beispiel-rechnung.tex.
\end{tikzpicture}
\par\vspace*{\@SombraDescrip}}%
\else
- \RenewEnviron{factura}{}
- \NewDocumentCommand{\Descripcion}{s m}{}
+ \RenewEnviron{factura}{%
+ \@ZERO
+ \let\label\label@factura
+ \let\@ITEM\@CalculaItem
+ \BODY
+ \@CalculaTotalesI}
+ \NewDocumentCommand{\Descripcion}{s +m}{}
\fi
\if@reporte
@@ -3016,34 +3137,34 @@ and factura-beispiel-rechnung.tex.
\if@csv
\if@Exento
\if@DescE
- \immediate\write\csv{Totales: \@@SubtotalE: \@Moneda \SubtE}%
- \immediate\write\csv{Totales: \@@DescuentoE: \@Moneda \DescE}%
+ \immediate\write\csv{Totales: \@@SubtotalE: \Moneda \SubtE}%
+ \immediate\write\csv{Totales: \@@DescuentoE: \Moneda \DescE}%
\fi
- \immediate\write\csv{Totales: \@@BIE: \@Moneda \BIE}%
+ \immediate\write\csv{Totales: \@@BIE: \Moneda \BIE}%
\fi
\if@BIR
\if@DescE
- \immediate\write\csv{Totales: \@@SubtotalR: \@Moneda \SubtR}%
- \immediate\write\csv{Totales: \@@DescuentoR: \@Moneda \DescR}%
+ \immediate\write\csv{Totales: \@@SubtotalR: \Moneda \SubtR}%
+ \immediate\write\csv{Totales: \@@DescuentoR: \Moneda \DescR}%
\fi
- \immediate\write\csv{Totales: \@@BIR: \@Moneda \BIR}%
- \immediate\write\csv{Totales: \@@AlicuotaR: \@Moneda \AlicuotaR}%
+ \immediate\write\csv{Totales: \@@BIR: \Moneda \BIR}%
+ \immediate\write\csv{Totales: \@@AlicuotaR: \Moneda \AlicuotaR}%
\fi
\if@DescG
- \immediate\write\csv{Totales: \@@SubtotalG: \@Moneda \SubtG}%
- \immediate\write\csv{Totales: \@@DescuentoG: \@Moneda \DescG}%
+ \immediate\write\csv{Totales: \@@SubtotalG: \Moneda \SubtG}%
+ \immediate\write\csv{Totales: \@@DescuentoG: \Moneda \DescG}%
\fi
- \immediate\write\csv{Totales: \@@BIG: \@Moneda \BIG}%
- \immediate\write\csv{Totales: \@@AlicuotaG: \@Moneda \AlicuotaG}%
+ \immediate\write\csv{Totales: \@@BIG: \Moneda \BIG}%
+ \immediate\write\csv{Totales: \@@AlicuotaG: \Moneda \AlicuotaG}%
\if@BIA
\if@DescA
- \immediate\write\csv{Totales: \@@SubtotalA: \@Moneda \SubtA}%
- \immediate\write\csv{Totales: \@@DescuentoA: \@Moneda \DescA}%
+ \immediate\write\csv{Totales: \@@SubtotalA: \Moneda \SubtA}%
+ \immediate\write\csv{Totales: \@@DescuentoA: \Moneda \DescA}%
\fi
- \immediate\write\csv{Totales: \@@BIA: \@Moneda \BIA}%
- \immediate\write\csv{Totales: \@@AlicuotaA: \@Moneda \AlicuotaA}%
+ \immediate\write\csv{Totales: \@@BIA: \Moneda \BIA}%
+ \immediate\write\csv{Totales: \@@AlicuotaA: \Moneda \AlicuotaA}%
\fi
- \immediate\write\csv{Totales: \@@Total: \@Moneda \Total}%
+ \immediate\write\csv{Totales: \@@Total: \Moneda \Total}%
\immediate\closeout\csv
\fi}
@@ -3225,6 +3346,8 @@ and factura-beispiel-rechnung.tex.
%<factdos|factcuatro|factcinco>%% Agregando un ítem sin precio (\ItemX),
%<factdos|facttres>%% Con artículos gravados con todos los IVA,
%
+%<factseis|repdos>%% Con etiquetas y referencias,
+%
%<!facttres&!reptres&!beispiel>%% Con descripción larga (\Descripcion).
%<facttres|reptres>%% Sin descripción larga.
%<beispiel>%% Adaptado a otra legislación.
@@ -3274,13 +3397,13 @@ and factura-beispiel-rechnung.tex.
%<beispiel>\usepackage[ngerman]{babel}
%<beispiel>\usepackage[T1]{fontenc}
%<beispiel>
+%<beispiel> \def\Moneda{\euro{}}
%<beispiel>\makeatletter
%<beispiel> \def\@AlicuotaG{0.19}
%<beispiel> \def\@AlicuotaR{0.07}
%<beispiel> \def\@DenomAlicuotaG{A}
%<beispiel> \def\@DenomAlicuotaR{C}
%<beispiel> \def\@DenomAlicuotaE{B}
-%<beispiel> \def\@Moneda{\euro{}}
%<beispiel> \def\@@Datos{Kundenidentifikation}
%<beispiel> \def\@@Resumen{Zusammenfassung}
%<beispiel> \def\@@Fecha{Datum:}
@@ -3363,7 +3486,7 @@ and factura-beispiel-rechnung.tex.
%<factseis>\makeatother
%<!factuno&!factcinco>
%<cotiza>% \Denom{PRESUPUESTO} % También podemos cambiar el nombre del documento
-\Fecha{05-03-2016}
+\Fecha{05-11-2016}
%<factcinco|factseis|cotiza|prefac|repuno|repdos|beispiel>\Num{1}
%<!factdos&!factcuatro&!beispiel>\RazonSocial{Ayala San Vicente Usureros}
%<factdos|factcuatro|beispiel>\Nombre{Jacinto de Ayala y San Vicente}
@@ -3389,7 +3512,8 @@ and factura-beispiel-rechnung.tex.
\begin{document}
%<!reptres>
%<!reptres>\begin{factura}
-%<!factdos&!factcinco&!reptres&!beispiel> \Item{1}{ítem con IVA general}{1000}
+%<!factdos&!factcinco&!factseis&!repdos&!reptres&!beispiel> \Item{1}{ítem con IVA general}{1000}
+%<factseis|repdos> \Item{2}{ítem con IVA general}{1000}\label{primeritem}
%<factuno|factcuatro> \Item{4}{otro ítem con IVA general}{100}
%<facttres|prefac> \ItemR{1}{ítem con IVA reducido}{1000}
%<facttres> \ItemA{1}{ítem con IVA adicional}{1000}
@@ -3407,12 +3531,18 @@ and factura-beispiel-rechnung.tex.
%<beispiel> \ItemE{1}{Artikel mit kein MwSt}{100}
%<!reptres>\end{factura}
%<!facttres&!reptres>
-%<!facttres&!reptres&!beispiel>\Descripcion{Descripción larga del servicio}
+%<!facttres&!factseis&!reptres&!beispiel>\Descripcion{Descripción larga del servicio}
+%<factseis>\Descripcion{Descripción larga del servicio.
+%<factseis>
%<beispiel>\Descripcion{Lange Beschreibung.}
%<repuno|repdos|reptres|factcinco|factocho>
%<repuno|repdos|reptres|factcinco|factocho>\begin{reporte}
-%<repuno|repdos|reptres|factcinco|factocho> El reporte - página 1\newpage El reporte - página 2 \newpage El reporte - página 3
-%<repdos|factcinco|factocho> \FirmaReporte[\includegraphics[width=5cm]{factura-ejemplo-firma}][0pt][21pt]
+%<repuno|repdos|reptres|factcinco|factocho> El reporte - página 1\newpage El reporte - página 2 \newpage El reporte - página 3.
+%<repdos>
+%<factseis|repdos> Se facturaron \cantref{primeritem} \descref{primeritem} por un valor de \Moneda\puref{primeritem} cada uno, dando un total de \Moneda\ptref{primeritem}. El IVA es de \Moneda\AlicuotaG, y el total final es \Moneda\Total.
+%<factseis|repdos> % También podemos usar \itemref{primeritem}, \dctoref{primeritem}, y en cuanto a las totalizaciones: \BIE, \BIR, \BIA, \AlicuotaR, \AlicuotaA, \SubtG, \SubtE, \SubtR, \SubtA, \DescG, \DescE, \DescR, \DescA para los demás totales.
+%<factseis>}
+%<repdos%<repdos|factcinco|factocho> \FirmaReporte[\includegraphics[width=5cm]{factura-ejemplo-firma}][0pt][21pt]
%<reptres> \vspace{1.5cm}\FirmaReporte
%<repuno|repdos|reptres|factcinco|factocho>\end{reporte}