From 2509d23a392a22006da62bd20f982f36fd391a63 Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Thu, 27 Aug 2015 22:05:05 +0000 Subject: factura (27aug15) git-svn-id: svn://tug.org/texlive/trunk@38223 c570f23f-e606-0410-a88d-b1316a301751 --- Master/texmf-dist/tex/latex/factura/factura.cls | 592 +++++++++++++----------- Master/texmf-dist/tex/latex/factura/factura.def | 8 +- 2 files changed, 314 insertions(+), 286 deletions(-) (limited to 'Master/texmf-dist/tex/latex/factura') diff --git a/Master/texmf-dist/tex/latex/factura/factura.cls b/Master/texmf-dist/tex/latex/factura/factura.cls index cc71d655842..b39686ea09a 100644 --- a/Master/texmf-dist/tex/latex/factura/factura.cls +++ b/Master/texmf-dist/tex/latex/factura/factura.cls @@ -35,7 +35,7 @@ %% \NeedsTeXFormat{LaTeX2e}[1995/12/01] \ProvidesClass{factura} -[2015/04/13 v2.05^^J +[2015/08/26 v2.1^^J Clase para elaborar facturas legales en la^^J República Bolivariana de Venezuela. ] @@ -64,6 +64,11 @@ República Bolivariana de Venezuela. \newif\if@DescR \newif\if@DescA \newif\if@DescE +\newif\if@DescGnum +\newif\if@DescRnum +\newif\if@DescAnum +\newif\if@DescEnum +\newif\if@Descuentos \newif\if@csv \newif\if@cdu \@cdutrue \newif\if@dcu @@ -76,7 +81,6 @@ República Bolivariana de Venezuela. \newif\if@reporte \newif\if@nombre \newif\if@impdesc -\newif\if@descuentostotales \RequirePackage{xifthen}% 'xifthen' para algunos de los condicionales. \RequirePackage{etoolbox}% 'etoolbox' para los condicionales binarios. @@ -98,6 +102,7 @@ República Bolivariana de Venezuela. \newboolean{LineaHastaColDos} \newboolean{LineaHastaFinal} \newboolean{LineaHastaTotal} + %% Condicionales auxiliares para la posición de los objetos fijos cuando son medidos desde la derecha, o desde abajo. \newboolean{FechaXnegativo} \newboolean{FechaYnegativo} @@ -252,12 +257,22 @@ República Bolivariana de Venezuela. \ifdefvoid{\@Contacto}{\if@nombre\else\ClassWarning{factura}{** Pudiera definirse una persona de contacto **}{}\fi}{}% } -%% Escribimos el total como comentario en el .log. -\AtEndDocument{\if@factura\ClassInfo{factura}{\@@Total: \space\space\space \@Moneda \Total}{}\fi} +%% Escribimos el total como comentario en el .log, y avisamos cuando la fecha no sea la de hoy. +\AtEndDocument{% + \edef\@Hoy{\ifnum\number\day<10 0\fi\the\day-\ifnum\number\month<10 0\fi\the\month-\the\year}% + \ifx\undefined\@Fecha + \else + \edef\@Fecha{\@Fecha}% + \ifx\@Fecha\@Hoy + \else + \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} %% La geometría en formato de factura y de reporte. %% El margen superior está definido desde el encabezado con los datos del cliente. -%% El margen inferior está definido hasta el final de la descripción (o del renglón de la factura si no hay descripción). +%% El margen inferior está definido hasta el final de la descripción (o del cuadro de la factura si no hay descripción). %% Hay elementos que salen fuera de estos márgenes, como las firmas, las condiciones de pago, la numeración y la fecha. \def\GeometriaFactura#1{\gdef\@GeometriaFactura{#1}} \def\GeometriaReporte#1{\gdef\@GeometriaReporte{#1}} @@ -268,32 +283,52 @@ República Bolivariana de Venezuela. \def\@ImpuestoA{\@AlicuotaA} %% Fijamos en cero los descuentos totales (necesario). -\def\@DescuentoGPorc{0} -\def\@DescuentoRPorc{0} -\def\@DescuentoAPorc{0} -\def\@DescuentoEPorc{0} +\def\@DescuentoGporc{0} +\def\@DescuentoRporc{0} +\def\@DescuentoAporc{0} +\def\@DescuentoEporc{0} +\def\@DescuentoGnum{0} +\def\@DescuentoRnum{0} +\def\@DescuentoAnum{0} +\def\@DescuentoEnum{0} %% \Fecha, \RazonSocial, \Nombre, \RIF, \CI, \Contacto, \Dirección, \Telefono, \Email, \Emisor, \Proveedor. \def\Fecha#1{\gdef\@Fecha{#1}} \def\RazonSocial#1{\gdef\@RazonSocial{#1}} -\let\RS\RazonSocial \def\Nombre#1{\gdef\@RazonSocial{#1}\@nombretrue} \def\RIF#1{\gdef\@RIF{#1}} \def\CI#1{\gdef\@RIF{#1}\let\@@RIF\@@CI\let\@CI\@RIF} \def\Contacto#1{\gdef\@Contacto{#1}} \def\Direccion#1{\gdef\@Direccion{#1}} \def\Telefono#1{\gdef\@Telefono{#1}} -\let\Tel\Telefono \def\Email#1{\gdef\@Email{#1}} \def\Emisor#1{\gdef\@Emisor{#1}} \def\Proveedor#1{\gdef\@Proveedor{#1}} -%% Los descuentos. -\def\Descuento#1{\@descuentostotalestrue\gdef\@DescuentoGPorc{#1}\gdef\@DescuentoRPorc{#1}\gdef\@DescuentoAPorc{#1}\gdef\@DescuentoEPorc{#1}} -\def\DescuentoG#1{\@descuentostotalestrue\gdef\@DescuentoGPorc{#1}} -\def\DescuentoR#1{\@descuentostotalestrue\gdef\@DescuentoRPorc{#1}} -\def\DescuentoA#1{\@descuentostotalestrue\gdef\@DescuentoAPorc{#1}} -\def\DescuentoE#1{\@descuentostotalestrue\gdef\@DescuentoEPorc{#1}} +%% Los descuentos totales. +\NewDocumentCommand{\Descuento}{s m}{% + \IfBooleanTF{#1} + {\@DescGnumtrue\@DescRnumtrue\@DescAnumtrue\@DescEnumtrue + \gdef\@DescuentoGnum{#2}\gdef\@DescuentoRnum{#2}\gdef\@DescuentoAnum{#2}\gdef\@DescuentoEnum{#2}} + {\@DescGnumfalse\@DescRnumfalse\@DescAnumfalse\@DescEnumfalse + \gdef\@DescuentoGporc{#2}\gdef\@DescuentoRporc{#2}\gdef\@DescuentoAporc{#2}\gdef\@DescuentoEporc{#2}}% + \@DescGtrue\@DescRtrue\@DescAtrue\@DescEtrue\@Descuentostrue} + +\NewDocumentCommand{\DescuentoG}{s m}{% + \IfBooleanTF{#1}{\@DescGnumtrue\gdef\@DescuentoGnum{#2}}{\@DescGnumfalse\gdef\@DescuentoGporc{#2}}% + \@DescGtrue\@Descuentostrue} + +\NewDocumentCommand{\DescuentoR}{s m}{% + \IfBooleanTF{#1}{\@DescRnumtrue\gdef\@DescuentoRnum{#2}}{\@DescRnumfalse\gdef\@DescuentoRporc{#2}}% + \@DescRtrue\@Descuentostrue} + +\NewDocumentCommand{\DescuentoA}{s m}{% + \IfBooleanTF{#1}{\@DescAnumtrue\gdef\@DescuentoAnum{#2}}{\@DescAnumfalse\gdef\@DescuentoAporc{#2}}% + \@DescAtrue\@Descuentostrue} + +\NewDocumentCommand{\DescuentoE}{s m}{% + \IfBooleanTF{#1}{\@DescEnumtrue\gdef\@DescuentoEnum{#2}}{\@DescEnumfalse\gdef\@DescuentoEporc{#2}}% + \@DescEtrue\@Descuentostrue} \def\Denom#1{\gdef\@Denominacion{#1}}% La denominación puede ser 'FACTURA', 'COTIZACIÓN' u otra. \def\@Denominacion{\@@DenomFactura}% Se predetermina la factura. @@ -316,21 +351,17 @@ República Bolivariana de Venezuela. \ifx\@undefined\@NumControl\let\@NumControl\@Num\fi \ifx\@undefined\@NumSerieControl\gdef\@NumSerieControl{00}\fi % Establecemos los porcentajes de las alícuotas, y redondeamos los descuentos. - \FPupn\@AlicuotaGPorc{\@AlicuotaG{} 100 * \@DigitosPorc{} round clip}% - \FPupn\@AlicuotaRPorc{\@AlicuotaR{} 100 * \@DigitosPorc{} round clip}% - \FPupn\@AlicuotaAPorc{\@AlicuotaA{} 100 * \@DigitosPorc{} round clip}% - \FPupn\@DescuentoGPorc{\@DescuentoGPorc{} \@DigitosPorc{} round clip}% - \FPupn\@DescuentoRPorc{\@DescuentoRPorc{} \@DigitosPorc{} round clip}% - \FPupn\@DescuentoAPorc{\@DescuentoAPorc{} \@DigitosPorc{} round clip}% - \FPupn\@DescuentoEPorc{\@DescuentoEPorc{} \@DigitosPorc{} round clip}% - \FPupn\@DescuentoGFactor{100 \@DescuentoGPorc{} / \@DigitosPorc{} round}% - \FPupn\@DescuentoRFactor{100 \@DescuentoRPorc{} / \@DigitosPorc{} round}% - \FPupn\@DescuentoAFactor{100 \@DescuentoAPorc{} / \@DigitosPorc{} round}% - \FPupn\@DescuentoEFactor{100 \@DescuentoEPorc{} / \@DigitosPorc{} round}% - \FPifeq\@DescuentoGPorc{0}\else\@DescGtrue\fi - \FPifeq\@DescuentoRPorc{0}\else\@DescRtrue\fi - \FPifeq\@DescuentoAPorc{0}\else\@DescAtrue\fi - \FPifeq\@DescuentoEPorc{0}\else\@DescEtrue\fi} + \FPupn\@AlicuotaGporc{\@AlicuotaG{} 100 * \@DigitosPorc{} round clip}% + \FPupn\@AlicuotaRporc{\@AlicuotaR{} 100 * \@DigitosPorc{} round clip}% + \FPupn\@AlicuotaAporc{\@AlicuotaA{} 100 * \@DigitosPorc{} round clip}% + \FPupn\@DescuentoGporc{\@DescuentoGporc{} \@DigitosPorc{} round clip}% + \FPupn\@DescuentoRporc{\@DescuentoRporc{} \@DigitosPorc{} round clip}% + \FPupn\@DescuentoAporc{\@DescuentoAporc{} \@DigitosPorc{} round clip}% + \FPupn\@DescuentoEporc{\@DescuentoEporc{} \@DigitosPorc{} round clip}% + \FPupn\@DescuentoGfactor{100 \@DescuentoGporc{} / \@DigitosPorc{} round}% + \FPupn\@DescuentoRfactor{100 \@DescuentoRporc{} / \@DigitosPorc{} round}% + \FPupn\@DescuentoAfactor{100 \@DescuentoAporc{} / \@DigitosPorc{} round}% + \FPupn\@DescuentoEfactor{100 \@DescuentoEporc{} / \@DigitosPorc{} round}} %% Posiciones (X,Y) de los objetos: i) fecha, ii) denominación, iii) condiciones, iv) número de control, v) firmas. \def\PosFecha#1#2{% @@ -380,7 +411,7 @@ República Bolivariana de Venezuela. %% Separación mínima horizontal entre los totales en modo de filas y distancia vertical entre esas líneas, fija. \def\SepFilas#1#2{\setlength{\@SeparaMinTotales}{#1}\setlength{\@SeparaFilas}{#2}} -%% Separación vertical entre los elementos de la factura (entre el encabezado y el renglón de la 'factura', luego desde dicho renglón hasta la descripción, o hasta los totales en modo de filas). +%% Separación vertical entre los elementos de la factura (entre el encabezado y el cuadro de la 'factura', luego desde dicho cuadro hasta la descripción, o hasta los totales en modo de filas). \def\SepElementos#1{\setlength{\@SeparaElementos}{#1}} %% Separación horizontal entre las cajas del encabezado y separación interna entre la línea y el texto. @@ -396,7 +427,7 @@ República Bolivariana de Venezuela. \def\LineaDescrip#1#2#3{\setlength{\@EspesorLineaDescrip}{#1}\setlength{\@EsquinaLineaDescrip}{#2}\setlength{\@SombraDescrip}{#3}} %% El espacio vertical que hay que avanzar sólo en la primera página del reporte antes de empezar a escribir sobre él. Usable cuando la primera página tiene un membrete y las demás no, es decir, cuando se usa \FondoReporte y no \FondoReporte*. -\def\InicioReporte#1{\setlength{\@InicioRep}{#1}} +\def\InicioReporte#1{\setlength{\@InicioReporte}{#1}} %% Tipos de letra para cada elemento posible: %% Esta es la letra de la descripción de los items; y el espacio \baselineskip de *toda* la tabla de la factura se fija en este comando únicamente (se predeterminó 18pt). @@ -478,8 +509,6 @@ República Bolivariana de Venezuela. \end{textblock*}} \fi} -\let\Firma\FirmaFactura - \NewDocumentCommand{\FirmaReporte}{O{} O{0pt} O{0pt} G{\@Proveedor} O{2cm} O{1.5cm}}{% \Firma[imagen][x-corr][y-corr]{texto}[posición en X desde la derecha][tamaño linea] \renewcommand{\baselinestretch}{1}\selectfont \newif\if@firma@dibujo @@ -533,8 +562,6 @@ República Bolivariana de Venezuela. \gdef\@FondoFactura{#1}% \fi} -\let\Fondo\FondoFactura - %% Con \FondoReporte le damos el nombre del archivo que contiene el formato del reporte. Existen dos posibilidades: que dicho fondo salga en todas las páginas o sólo en la primera. \NewDocumentCommand{\FondoReporte}{s m}{% \if@reporte @@ -595,7 +622,7 @@ República Bolivariana de Venezuela. \newlength{\@SeparaElementos} \newlength{\@SeparaMinTotales} \newlength{\@SeparaFilas} -\newlength{\@InicioRep} +\newlength{\@InicioReporte} \newlength{\@FirmaFacturaXcorr} \newlength{\@FirmaFacturaYcorr} \newlength{\@FirmaReporteXcorr} @@ -656,7 +683,12 @@ República Bolivariana de Venezuela. %% Comando para escribir el encabezado en el modo de reporte. \newcommand\@EncabezadoReporte{% \vspace*{-\topskip}% - \vspace*{\@InicioRep}% + \if@fondoreporte + \if@fondoreportestar + \else + \vspace*{\@InicioReporte}% + \fi + \fi \@EscribeDatosReporte \@LetraReporte} @@ -669,6 +701,211 @@ República Bolivariana de Venezuela. \ifnum\value{page}=1\else\ClassError{factura}{** La factura ocupa mas que una pagina **}{}\fi } +%% Presentación de totales en modo de columnas. +\newcommand{\@EscribeTotalCol}[1]{% + \expandafter\FPifeq\csname Desc#1\endcsname{0}% + \if@ivaexpresado\@EscribeTotalColBI{#1}\fi + \else + \@EscribeTotalColSubt{#1}% + \@EscribeTotalColDesc{#1}% + \if@ivaexpresado\@EscribeTotalColBI{#1}\fi + \fi} + +%% Forma agupada para la presentación de totales en modo de columnas. +\newcommand{\@EscribeTotalColAgrupado}{% + \if@Exento\if@DescE\@EscribeTotalColSubt{E}\fi\fi + \if@BIR\if@DescR\@EscribeTotalColSubt{R}\fi\fi + \if@DescG\@EscribeTotalColSubt{G}\fi + \if@BIA\if@DescA\@EscribeTotalColSubt{A}\fi\fi + \if@Exento\if@DescE\@EscribeTotalColDesc{E}\fi\fi + \if@BIR\if@DescR\@EscribeTotalColDesc{R}\fi\fi + \if@DescG\@EscribeTotalColDesc{G}\fi + \if@BIA\if@DescA\@EscribeTotalColDesc{A}\fi\fi + \if@Exento\@EscribeTotalColBI{E}\fi + \if@BIR\@EscribeTotalColBI{R}\fi + \@EscribeTotalColBI{G}% + \if@BIA\@EscribeTotalColBI{A}\fi + \if@ivaexpresado + \if@BIR\@EscribeTotalColAlicuota{R}\fi + \@EscribeTotalColAlicuota{G}% + \if@BIA\@EscribeTotalColAlicuota{A}\fi + \fi} + +\newcommand{\@EscribeTotalColBI}[1]{% + {\@LetraTitTotales \csname @@BI#1\endcsname + \ifthenelse{\equal{#1}{E}}{}{\if@G\ \hfill(\csname @Alicuota#1porc\endcsname\%)\else\mbox{}\fi}} + & \@LetraNumTotales\numprint{\csname BI#1\endcsname} \\} + +\newcommand{\@EscribeTotalColAlicuota}[1]{% + {\@LetraTitTotales \csname @@Alicuota#1\endcsname\ \hfill (\csname @Alicuota#1porc\endcsname\%)} + & \@LetraNumTotales\numprint{\csname Alicuota#1\endcsname} \\} + +\newcommand{\@EscribeTotalColSubt}[1]{% + {\@LetraTitTotales \csname @@Subtotal#1\endcsname} + & \@LetraNumTotales\numprint{\csname Subt#1\endcsname} \\} + +\newcommand{\@EscribeTotalColDesc}[1]{% + {\@LetraTitTotales \csname @@Descuento#1\endcsname + \csname if@Desc#1num\endcsname \else \ \hfill (\csname @Descuento#1porc\endcsname\%)\fi} + & \@LetraNumTotales\numprint{\csname Desc#1\endcsname} \\} + +%% Presentación de los totales en modo filas. +\newcommand{\@EscribeTotalFilasBI}[1]{% + \@EscribeTotalFilasBIizq{#1}: & \@EscribeTotalFilasBIder{#1}} + +\newcommand{\@EscribeTotalFilasAlicuota}[1]{% + \@EscribeTotalFilasAlicuotaizq{#1}: & \@EscribeTotalFilasAlicuotader{#1}} + +\newcommand{\@EscribeTotalFilasDesc}[1]{% + \@EscribeTotalFilasDescizq{#1}: & \@EscribeTotalFilasDescder{#1}} + +\newcommand{\@EscribeTotalFilasSoloBI}[1]{% + {\@LetraTitTotales\@EscribeTotalFilasBIizq{#1}:} {\@LetraNumTotales\@EscribeTotalFilasBIder{#1}}} + +\newcommand{\@EscribeTotalFilasSoloDesc}[1]{% + {\@LetraTitTotales\@EscribeTotalFilasDescizq{#1}:} {\@LetraNumTotales\@EscribeTotalFilasDescder{#1}}} + +\newcommand{\@EscribeTotalFilasSoloAlicuota}[1]{% + {\@LetraTitTotales\@EscribeTotalFilasAlicuotaizq{#1}:} {\@LetraNumTotales\@EscribeTotalFilasAlicuotader{#1}}} + +\newcommand{\@EscribeTotalFilasBIizq}[1]{% + \@LetraTitTotales\csname @@BI#1\endcsname + \ifthenelse{\equal{#1}{G}} + {\if@G \ (\@AlicuotaGporc\%)\fi}% Si hay otra B.I. que no sea general, colocamos el porcentaje explícito en la general. + {\ifthenelse{\equal{#1}{E}}{}{\ (\csname @Alicuota#1porc\endcsname\%)}}} + +\newcommand{\@EscribeTotalFilasBIder}[1]{% + \@LetraNumTotales\numprint{\csname BI#1\endcsname}} + +\newcommand{\@EscribeTotalFilasAlicuotaizq}[1]{% + \@LetraTitTotales\csname @@Alicuota#1\endcsname \ (\csname @Alicuota#1porc\endcsname\%)} + +\newcommand{\@EscribeTotalFilasAlicuotader}[1]{% + \@LetraNumTotales\numprint{\csname Alicuota#1\endcsname}} + +\newcommand{\@EscribeTotalFilasDescizq}[1]{% + \@LetraTitTotales\csname @@Descuento#1\endcsname \ (\csname @Descuento#1porc\endcsname\%)} + +\newcommand{\@EscribeTotalFilasDescder}[1]{% + \@LetraNumTotales\numprint{\csname Desc#1\endcsname}} + +\newcommand{\@EscribeTotalFilas}[2][]{% + \@EscribeTotalFilasAuxTabla{% + \csname @EscribeTotalFilasBI\endcsname{#2}% + \ifthenelse{\equal{#2}{E}}{% + \ifthenelse{\equal{#1}{T}}{% + \\[\@SeparaFilas]% + \@LetraTitTotal\@@Total: & \@LetraNumTotal\numprint{\Total}}{}}% + {\\[\@SeparaFilas]% + \csname @EscribeTotalFilasAlicuota\endcsname{#2}}}} + +\newcommand{\@GeneraCajasTotalesFilas}{% + \if@Exento + \newbox{\@CajaBIE}\newbox{\@CajaBIET}% + \savebox{\@CajaBIE}{\@EscribeTotalFilasSoloBI{E}}% + \savebox{\@CajaBIET}{\@EscribeTotalFilas[T]{E}}% + \fi + \if@BIR + \addtocounter{IVANoGeneral}{1}% + \newbox{\@CajaBIR}\newbox{\@CajaAliR}\newbox{\@CajaBIAliR}% + \savebox{\@CajaBIR}{\@EscribeTotalFilasSoloBI{R}}% + \savebox{\@CajaAliR}{\@EscribeTotalFilasSoloAlicuota{R}}% + \savebox{\@CajaBIAliR}{\@EscribeTotalFilas{R}}% + \fi + \newbox{\@CajaBIG}\newbox{\@CajaAliG}\newbox{\@CajaBIAliG}% + \savebox{\@CajaBIG}{\@EscribeTotalFilasSoloBI{G}}% + \savebox{\@CajaAliG}{\@EscribeTotalFilasSoloAlicuota{G}}% + \savebox{\@CajaBIAliG}{\@EscribeTotalFilas{G}}% + \if@BIA + \addtocounter{IVANoGeneral}{1}% + \newbox{\@CajaBIA}\newbox{\@CajaAliA}\newbox{\@CajaBIAliA}% + \savebox{\@CajaBIA}{\@EscribeTotalFilasSoloBI{A}}% + \savebox{\@CajaAliA}{\@EscribeTotalFilasSoloAlicuota{A}}% + \savebox{\@CajaBIAliA}{\@EscribeTotalFilas{A}}% + \fi} + +\newcommand{\@EscribeTotalesFilasGET}{% + \hspace*{\@SepTotales}\usebox{\@CajaBIG}% + \hspace*{\@SepTotales}\usebox{\@CajaAliG}% + \if@Exento\hspace*{\@SepTotales}\usebox{\@CajaBIE}\fi + \hspace*{\@SepTotales}\usebox{\@CajaTotal}% + \if@centrado\hspace*{\@SepTotales}\fi} + +\newcommand{\@EscribeTotalesFilasGxET}{% + \if@BIR\hspace*{\@SepTotales}\usebox{\@CajaBIAliR}\fi + \hspace*{\@SepTotales}\usebox{\@CajaBIAliG}% + \if@BIA\hspace*{\@SepTotales}\usebox{\@CajaBIAliA}\fi + \hspace*{\@SepTotales}\if@Exento\usebox{\@CajaBIET}\else\usebox{\@CajaTotal}\fi + \if@centrado\hspace*{\@SepTotales}\fi} + +\newcommand{\@EscribeTotalesFilasRGA}{% + \hspace*{\@SepTotales}\usebox{\@CajaBIAliR}% + \hspace*{\@SepTotales}\usebox{\@CajaBIAliG}% + \hspace*{\@SepTotales}\usebox{\@CajaBIAliA}% + \hspace*{\@SepTotales}} + +\newcommand{\@EscribeTotalesFilasRGAET}{% + \@EscribeTotalesFilasRGA + \if@Exento\usebox{\@CajaBIET}\else\usebox{\@CajaTotal}\fi + \if@centrado\hspace*{\@SepTotales}\fi} + +\newcommand{\@EscribeTotalFilasAuxTabla}[1]{% + \begin{tabular}[b]{@{}l@{\extracolsep{1ex}}r@{}}% ¡Esta tabla tiene que abrir hacia abajo para que la separación entre las filas se pueda colocar con \@SeparaFilas! + #1 + \end{tabular}} + +%% Comando que guarda la posición en X para el nodo A de la línea. +\newcommand{\@LineaNodoACoordX}{\hspace*{-\tabcolsep}\zsaveposx{LineaNodoACoordX}\hspace*{\tabcolsep}} +%% Comando que guarda la posición en X para el nodo B de la línea. +\newcommand{\@LineaNodoBCoordX}{\hspace*{-\tabcolsep}\zsaveposx{LineaNodoBCoordX}\hspace*{\tabcolsep}} + +%% Escribe la letra que designa al tipo de impuesto que aplica al ítem. +\newcommand{\@EscribeTipoDeImpuesto}[1]{% + \@LetraTipoIVA%\fi% El espacio antes de la letra. + \ifthenelse{\equal{#1}{E}}{\@DenomAlicuotaE}{}% Si está exento escribimos '(E)'. + \ifthenelse{\equal{#1}{R}}{\@DenomAlicuotaR}{}% Si tiene IVA reducido escribimos 'R'. + \ifthenelse{\equal{#1}{A}}{\@DenomAlicuotaA}{}% Si tiene IVA adicional escribimos 'A'. + \ifthenelse{\equal{#1}{G}}{\if@G\@DenomAlicuotaG\fi}{}}% Una 'G' para IVA general si hace falta. + +%% 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}{% + \FPset\BIG{0}\global\let\BIG\BIG + \FPset\BIR{0}\global\let\BIR\BIR + \FPset\BIA{0}\global\let\BIA\BIA + \FPset\BIE{0}\global\let\BIE\BIE + \FPset\SubtE{0}\global\let\SubtE\SubtE + \FPset\SubtG{0}\global\let\SubtG\SubtG + \FPset\SubtR{0}\global\let\SubtR\SubtR + \FPset\SubtA{0}\global\let\SubtA\SubtA + \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\AlicuotaG{0}\global\let\AlicuotaG\AlicuotaG + \FPset\AlicuotaR{0}\global\let\AlicuotaR\AlicuotaR + \FPset\AlicuotaA{0}\global\let\AlicuotaA\AlicuotaA} + +%% Comandos para calcular todos los totales parciales y el total general. +\newcommand{\@CalculaTotalesI}{% + \FPifeq\SubtG{0}\else\@CalculaTotalesII{G}\fi + \FPifeq\SubtR{0}\else\@CalculaTotalesII{R}\fi + \FPifeq\SubtA{0}\else\@CalculaTotalesII{A}\fi + \FPifeq\SubtE{0}\else\@CalculaTotalesII{E}\fi + \FPupn\Total{\BIE{} \BIR{} + \BIG{} + \BIA{} + \AlicuotaR{} + \AlicuotaG{} + \AlicuotaA{} + \@DigitosMoneda{} round}% + \global\let\Total\Total} + +\newcommand{\@CalculaTotalesII}[1]{% + % Sumamos al descuento. + \expandafter\FPupn\csname Desc#1\endcsname{\csname @Descuento#1factor\endcsname{} \csname Subt#1\endcsname{} * \csname @Descuento#1num\endcsname{} + \@DigitosMoneda{} round}% + \global\expandafter\let\csname Desc#1\expandafter\endcsname\csname Desc#1\endcsname + % Sumamos a la base imponible. + \expandafter\FPupn\csname BI#1\endcsname{\csname Desc#1\endcsname{} \csname Subt#1\endcsname{} - \@DigitosMoneda{} round}% + \global\expandafter\let\csname BI#1\expandafter\endcsname\csname BI#1\endcsname + \ifthenelse{\equal{#1}{E}}{}{% + % Sumamos a la alícuota. + \expandafter\FPupn\csname Alicuota#1\endcsname{\csname BI#1\endcsname{} \csname @Impuesto#1\endcsname{} * \@DigitosMoneda{} round}% + \global\expandafter\let\csname Alicuota#1\expandafter\endcsname\csname Alicuota#1\endcsname}} + %% 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 @@ -679,216 +916,12 @@ República Bolivariana de Venezuela. \savebox{\@CajaEspacioVacio}{\parbox[b][\@EspacioVacioInicial-\@EspacioVacioFinal]{1pt}{\mbox{}}}% \ifdim \ht\@CajaEspacioVacio=0pt \global\@lineafalse \fi \fi - \ifx\undefined\Total\relax\else\ClassError{factura}{** Parece ya haber un renglón de montos **}{}\fi + \ifx\undefined\Total\relax\else\ClassError{factura}{** Parece ya haberse usado un entorno de factura **}{}\fi % % http://tex.stackexchange.com/questions/111203/tabularx-bottom-alignment-on-r-or-l-columns-when-x-column-wraps \renewcommand{\tabularxcolumn}[1]{m{##1}}% TODO: Cuando el campo de la descripción en la factura ocupa más que una línea, los de al lado salen centrados. - % 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}{% - \FPset\BIG{0}\global\let\BIG\BIG - \FPset\BIR{0}\global\let\BIR\BIR - \FPset\BIA{0}\global\let\BIA\BIA - \FPset\BIE{0}\global\let\BIE\BIE - \FPset\SubtE{0}\global\let\SubtE\SubtE - \FPset\SubtG{0}\global\let\SubtG\SubtG - \FPset\SubtR{0}\global\let\SubtR\SubtR - \FPset\SubtA{0}\global\let\SubtA\SubtA - \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\AlicuotaG{0}\global\let\AlicuotaG\AlicuotaG - \FPset\AlicuotaR{0}\global\let\AlicuotaR\AlicuotaR - \FPset\AlicuotaA{0}\global\let\AlicuotaA\AlicuotaA}% - % - % Escribe la letra que designa al tipo de impuesto que aplica al ítem. - \newcommand\@EscribeTipoDeImpuesto[1]{% - \if@G\@LetraTipoIVA\ \fi% El espacio antes de la letra. - \ifthenelse{\equal{##1}{E}}{\@DenomAlicuotaE\hfill}{}% Si está exento, escribimos '(E)' al lado del p/t también. - \ifthenelse{\equal{##1}{R}}{\@DenomAlicuotaR\hfill}{}% Si tiene IVA reducido, escribimos 'R'. - \ifthenelse{\equal{##1}{A}}{\@DenomAlicuotaA\hfill}{}% Si tiene IVA adicional, escribimos 'A'. - \ifthenelse{\equal{##1}{G}}{\if@G\@DenomAlicuotaG\hfill\fi}{}% Una 'G' para IVA general si hace falta. - \if@G\ \fi}% El espacio entre el tipo de impuesto y el precio. - % - % Suma el ítem actual a la base imponible acumulada. - \newcommand{\@TotalizaItem}[1]{% - \expandafter\FPupn\csname Subt##1\endcsname{\PrecioT{} \expandafter\csname Subt##1\endcsname{} + \@DigitosMoneda{} round}% Agregamos al subtotal. - \global\expandafter\let\csname Subt##1\expandafter\endcsname\csname Subt##1\endcsname - \expandafter\FPupn\csname Desc##1\endcsname{\PrecioT{} \expandafter\csname @Descuento##1Factor\endcsname{} * \expandafter\csname Desc##1\endcsname{} + \@DigitosMoneda{} round}% Agregamos al descuento. - \global\expandafter\let\csname Desc##1\expandafter\endcsname\csname Desc##1\endcsname - \expandafter\FPupn\csname BI##1\endcsname{\PrecioT{} \expandafter\csname @Descuento##1Factor\endcsname{} * \PrecioT{} - \expandafter\csname BI##1\endcsname{} + \@DigitosMoneda{} round}% Agregamos a la base imponible. - \global\expandafter\let\csname BI##1\expandafter\endcsname\csname BI##1\endcsname - % Si es un ítem exento, no hay alícuota a agregar. - \ifthenelse{\equal{##1}{E}}{}{% - \expandafter\FPupn\csname Alicuota##1\endcsname{\PrecioT{} \expandafter\csname @Descuento##1Factor\endcsname{} * \PrecioT{} - \expandafter\csname @Impuesto##1\endcsname{} * \expandafter\csname Alicuota##1\endcsname{} + \@DigitosMoneda{} round}% Agregamos al IVA. - \global\expandafter\let\csname Alicuota##1\expandafter\endcsname\csname Alicuota##1\endcsname}}% - % - % Comando para sumar todos los totales y general el total general. - \newcommand{\@TotalTotal}{% - \FPupn{\Total}{\BIE{} \BIR{} + \BIG{} + \BIA{} + \AlicuotaR{} + \AlicuotaG{} + \AlicuotaA{} + \@DigitosMoneda{} round}% - \global\let\Total\Total}% - % - % Presentación de totales en modo de columnas. - \newcommand{\@EscribeTotalCol}[1]{% - \csname - if@Desc##1\endcsname% - \@EscribeTotalColSubt{##1}% - \@EscribeTotalColDesc{##1}% - \if@ivaexpresado\@EscribeTotalColBI{##1}\fi - \else - \if@ivaexpresado\@EscribeTotalColBI{##1}\fi - \fi}% - % Forma agupada para la presentación de totales en modo de columnas. - \newcommand{\@EscribeTotalColAgrupado}{% - \if@Exento\if@DescE\@EscribeTotalColSubt{E}\fi\fi - \if@BIR\if@DescR\@EscribeTotalColSubt{R}\fi\fi - \if@DescG\@EscribeTotalColSubt{G}\fi - \if@BIA\if@DescA\@EscribeTotalColSubt{A}\fi\fi - \if@Exento\if@DescE\@EscribeTotalColDesc{E}\fi\fi - \if@BIR\if@DescR\@EscribeTotalColDesc{R}\fi\fi - \if@DescG\@EscribeTotalColDesc{G}\fi - \if@BIA\if@DescA\@EscribeTotalColDesc{A}\fi\fi - \if@Exento\@EscribeTotalColBI{E}\fi - \if@BIR\@EscribeTotalColBI{R}\fi - \@EscribeTotalColBI{G}% - \if@BIA\@EscribeTotalColBI{A}\fi - \if@ivaexpresado - \if@BIR\@EscribeTotalColAlicuota{R}\fi - \@EscribeTotalColAlicuota{G}% - \if@BIA\@EscribeTotalColAlicuota{A}\fi - \fi} - % - \newcommand{\@EscribeTotalColBI}[1]{% - {\ \@LetraTitTotales \csname @@BI##1\endcsname - \ifthenelse{\equal{##1}{G}}{% - % Colocamos el porcentaje explícito en la base imponible general si es requerido. - \if@G\ \hfill(\@AlicuotaGPorc\%)\else\mbox{}\fi}% - {\hfill\ifthenelse{\equal{##1}{E}}{}{\ (\csname @Alicuota##1Porc\endcsname\%)}}}% - & \@LetraNumTotales\numprint{\csname BI##1\endcsname} \\}% - % - \newcommand{\@EscribeTotalColAlicuota}[1]{% - {\ \@LetraTitTotales \csname @@Alicuota##1\endcsname\ \hfill (\csname @Alicuota##1Porc\endcsname\%)}% - & \@LetraNumTotales\numprint{\csname Alicuota##1\endcsname} \\}% - % - \newcommand{\@EscribeTotalColSubt}[1]{% - {\ \@LetraTitTotales \csname @@Subtotal##1\endcsname}% - & \@LetraNumTotales\numprint{\csname Subt##1\endcsname} \\}% - % - \newcommand{\@EscribeTotalColDesc}[1]{% - {\ \@LetraTitTotales \csname @@Descuento##1\endcsname \ \hfill (\csname @Descuento##1Porc\endcsname\%)}% - & \@LetraNumTotales\numprint{\csname Desc##1\endcsname} \\}% - % - % Presentación de totales en modo filas. - \newcommand{\@EscribeTotalFilasBI}[1]{% - \@EscribeTotalFilasBIizq{##1}: & \@EscribeTotalFilasBIder{##1}}% - % - \newcommand{\@EscribeTotalFilasAlicuota}[1]{% - \@EscribeTotalFilasAlicuotaizq{##1}: & \@EscribeTotalFilasAlicuotader{##1}}% - % - \newcommand{\@EscribeTotalFilasDesc}[1]{% - \@EscribeTotalFilasDescizq{##1}: & \@EscribeTotalFilasDescder{##1}}% - % - \newcommand{\@EscribeTotalFilasSoloBI}[1]{% - {\@LetraTitTotales\@EscribeTotalFilasBIizq{##1}:} {\@LetraNumTotales\@EscribeTotalFilasBIder{##1}}}% - % - \newcommand{\@EscribeTotalFilasSoloDesc}[1]{% - {\@LetraTitTotales\@EscribeTotalFilasDescizq{##1}:} {\@LetraNumTotales\@EscribeTotalFilasDescder{##1}}}% - % - \newcommand{\@EscribeTotalFilasSoloAlicuota}[1]{% - {\@LetraTitTotales\@EscribeTotalFilasAlicuotaizq{##1}:} {\@LetraNumTotales\@EscribeTotalFilasAlicuotader{##1}}}% - % - \newcommand{\@EscribeTotalFilasBIizq}[1]{% - \@LetraTitTotales\csname @@BI##1\endcsname - \ifthenelse{\equal{##1}{G}} - {\if@G \ (\@AlicuotaGPorc\%)\fi}% Si hay otra B.I. que no sea general, colocamos el porcentaje explícito en la general. - {\ifthenelse{\equal{##1}{E}}{}{\ (\csname @Alicuota##1Porc\endcsname\%)}}}% - % - \newcommand{\@EscribeTotalFilasBIder}[1]{% - \@LetraNumTotales\numprint{\csname BI##1\endcsname}}% % - \newcommand{\@EscribeTotalFilasAlicuotaizq}[1]{% - \@LetraTitTotales\csname @@Alicuota##1\endcsname \ (\csname @Alicuota##1Porc\endcsname\%)}% - % - \newcommand{\@EscribeTotalFilasAlicuotader}[1]{% - \@LetraNumTotales\numprint{\csname Alicuota##1\endcsname}}% - % - \newcommand{\@EscribeTotalFilasDescizq}[1]{% - \@LetraTitTotales\csname @@Descuento##1\endcsname \ (\csname @Descuento##1Porc\endcsname\%)}% - % - \newcommand{\@EscribeTotalFilasDescder}[1]{% - \@LetraNumTotales\numprint{\csname Desc##1\endcsname}}% - % - \newcommand{\@EscribeTotalFilas}[2][]{% - \@EscribeTotalFilasAuxTabla{% - \csname @EscribeTotalFilasBI\endcsname{##2}% - \ifthenelse{\equal{##2}{E}}{% - \ifthenelse{\equal{##1}{T}}{% - \\[\@SeparaFilas]% - \@LetraTitTotal\@@Total: & \@LetraNumTotal\numprint{\Total}}{}}% - {\\[\@SeparaFilas]% - \csname @EscribeTotalFilasAlicuota\endcsname{##2}}}}% - % - \newcommand{\@GeneraCajasTotalesFilas}{% - \if@Exento - \newbox{\@CajaBIE}\newbox{\@CajaBIET}% - \savebox{\@CajaBIE}{\@EscribeTotalFilasSoloBI{E}}% - \savebox{\@CajaBIET}{\@EscribeTotalFilas[T]{E}}% - \fi - \if@BIR - \addtocounter{IVANoGeneral}{1}% - \newbox{\@CajaBIR}\newbox{\@CajaAliR}\newbox{\@CajaBIAliR}% - \savebox{\@CajaBIR}{\@EscribeTotalFilasSoloBI{R}}% - \savebox{\@CajaAliR}{\@EscribeTotalFilasSoloAlicuota{R}}% - \savebox{\@CajaBIAliR}{\@EscribeTotalFilas{R}}% - \fi - \newbox{\@CajaBIG}\newbox{\@CajaAliG}\newbox{\@CajaBIAliG}% - \savebox{\@CajaBIG}{\@EscribeTotalFilasSoloBI{G}}% - \savebox{\@CajaAliG}{\@EscribeTotalFilasSoloAlicuota{G}}% - \savebox{\@CajaBIAliG}{\@EscribeTotalFilas{G}}% - \if@BIA - \addtocounter{IVANoGeneral}{1}% - \newbox{\@CajaBIA}\newbox{\@CajaAliA}\newbox{\@CajaBIAliA}% - \savebox{\@CajaBIA}{\@EscribeTotalFilasSoloBI{A}}% - \savebox{\@CajaAliA}{\@EscribeTotalFilasSoloAlicuota{A}}% - \savebox{\@CajaBIAliA}{\@EscribeTotalFilas{A}}% - \fi} - % - \newcommand{\@EscribeTotalesFilasGET}{% - \hspace*{\@SepTotales}\usebox{\@CajaBIG}% - \hspace*{\@SepTotales}\usebox{\@CajaAliG}% - \if@Exento\hspace*{\@SepTotales}\usebox{\@CajaBIE}\fi - \hspace*{\@SepTotales}\usebox{\@CajaTotal}% - \if@centrado\hspace*{\@SepTotales}\fi} - % - \newcommand{\@EscribeTotalesFilasGxET}{% - \if@BIR\hspace*{\@SepTotales}\usebox{\@CajaBIAliR}\fi - \hspace*{\@SepTotales}\usebox{\@CajaBIAliG}% - \if@BIA\hspace*{\@SepTotales}\usebox{\@CajaBIAliA}\fi - \hspace*{\@SepTotales}\if@Exento\usebox{\@CajaBIET}\else\usebox{\@CajaTotal}\fi - \if@centrado\hspace*{\@SepTotales}\fi}% - % - \newcommand{\@EscribeTotalesFilasRGA}{% - \hspace*{\@SepTotales}\usebox{\@CajaBIAliR}% - \hspace*{\@SepTotales}\usebox{\@CajaBIAliG}% - \hspace*{\@SepTotales}\usebox{\@CajaBIAliA}% - \hspace*{\@SepTotales}}% - % - \newcommand{\@EscribeTotalesFilasRGAET}{% - \@EscribeTotalesFilasRGA - \if@Exento\usebox{\@CajaBIET}\else\usebox{\@CajaTotal}\fi - \if@centrado\hspace*{\@SepTotales}\fi}% - % - \newcommand{\@EscribeTotalFilasAuxTabla}[1]{% - \begin{tabular}[b]{@{}l@{\extracolsep{1ex}}r@{}}% ¡Esta tabla tiene que abrir hacia abajo para que la separación entre las filas se pueda colocar con \@SeparaFilas! - ##1 - \end{tabular}}% - % - % Comando que graba la posición en X para el nodo A de la línea. - \newcommand{\@LineaNodoACoordX}{\hspace*{-\tabcolsep}\zsaveposx{LineaNodoACoordX}\hspace*{\tabcolsep}}% - % Comando que graba la posición en X para el nodo B de la línea. - \newcommand{\@LineaNodoBCoordX}{\hspace*{-\tabcolsep}\zsaveposx{LineaNodoBCoordX}\hspace*{\tabcolsep}}% - % - % Comando interno para el ítem. + % Comando interno para todos los ítems. \newcommand{\@ITEM}[5]{% 1. [R|G|A|E]; 2. cantidad; 3. descripción; 4. p/u; 5. dcto. % Calculamos. \FPupn\PrecioU{##4 \@DigitosMoneda{} round}% @@ -897,25 +930,25 @@ República Bolivariana de Venezuela. \global\let\PrecioU\PrecioU \global\let\Dcto\Dcto \global\let\PrecioT\PrecioT - % Primer campo - Acá puede ir la cantidad (cdu) o la descripción (dcu y duc). + % Primer campo: Acá puede ir la cantidad (cdu) o la descripción (dcu y duc). \ifbool{SinCantidad}{}{% \ifbool{PrimeroDesc} {##3% dcu y duc. - \if@impdesc\hfill\@EscribeTipoDeImpuesto{##1}\fi}% dcu y duc. + \if@impdesc~\hfill\@EscribeTipoDeImpuesto{##1}\fi}% dcu y duc. {\@LetraNumeros\numprint{##2}}}% cdu. & - % Segundo campo - Acá puede ir la descripción (cdu), la cantidad (dcu), o el precio unitario (duc). + % Segundo campo: Acá puede ir la descripción (cdu), la cantidad (dcu), o el precio unitario (duc). \ifbool{PrimeroDesc}{% \if@dcu \@LetraNumeros\numprint{##2}% dcu. \else - \if@impdesc\else\@EscribeTipoDeImpuesto{##1}\fi% duc. + \if@impdesc\else\@EscribeTipoDeImpuesto{##1}\ \hfill\fi% duc. \@LetraNumeros\numprint{\PrecioU}% duc. \fi}% {##3% cdu. - \if@impdesc\hfill\@EscribeTipoDeImpuesto{##1}\fi}% cdu. + \if@impdesc~\hfill\@EscribeTipoDeImpuesto{##1}\fi}% cdu. & - % Tercer campo - Acá puede ir el precio unitario (cdu y dcu) o la cantidad (duc). + % Tercer campo: Acá puede ir el precio unitario (cdu y dcu) o la cantidad (duc). \FPifeq\PrecioU{##4}\else\ClassWarning{factura}{** Se está introduciendo un precio con más de dos decimales: (##3 -> ##4) **}{}\fi% Advertimos cuando el precio unitario tiene más de dos decimales. \ifbool{SinCantidad}{}{% \if@duc @@ -923,23 +956,23 @@ República Bolivariana de Venezuela. % ¡Está alineado a la derecha para que la totalización no se descuadre! \mbox{}\hfill\@LetraNumeros\numprint{##2}\hfill\mbox{}% duc. \else - \if@impdesc\else\@EscribeTipoDeImpuesto{##1}\fi% dcu y cdu. + \if@impdesc\else\@EscribeTipoDeImpuesto{##1}\ \hfill\fi% dcu y cdu. \@LetraNumeros\numprint{\PrecioU}% dcu y cdu. \fi}% & - % Cuatro campo - Descuento. + % Cuarto campo: Descuento. \ifbool{Descuentos}{\FPifeq\Dcto{0}\else\@LetraNumeros\numprint{\Dcto}\%\fi}{}% & - % Quinto campo - El total. - \if@impdesc\else\@EscribeTipoDeImpuesto{##1}\fi% + % Quinto campo: El total. + \if@impdesc\else\@EscribeTipoDeImpuesto{##1}\ \hfill\fi \@LetraNumeros\numprint{\PrecioT}% % Escribimos al csv. \if@csv \ifbool{SinCantidad} {\if@descuentos - \immediate\write\csv{"\unexpanded{##3}","##5","\PrecioT","##1"} + \immediate\write\csv{"\unexpanded{##3}","##5","\PrecioT","##1"}% \else - \immediate\write\csv{"\unexpanded{##3}","\PrecioT","##1"} + \immediate\write\csv{"\unexpanded{##3}","\PrecioT","##1"}% \fi} {\if@cdu \if@descuentos @@ -963,8 +996,9 @@ República Bolivariana de Venezuela. \fi \fi}% \fi - % - \@TotalizaItem{##1}% + % 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@lineaitem\hline\fi}% % @@ -1020,11 +1054,11 @@ República Bolivariana de Venezuela. {% Sin cantidad: \ifbool{SinLineasV} {\ifbool{Descuentos} - {\begin{tabularx}{\textwidth}{ l@{\extracolsep{0pt}} X r c r }} - {\begin{tabularx}{\textwidth}{ l@{\extracolsep{0pt}} X r r@{\extracolsep{0pt}} r }}} + {\begin{tabularx}{\textwidth}{ l@{\extracolsep{0pt}} X@{\extracolsep{0pt}} r c r }} + {\begin{tabularx}{\textwidth}{ l@{\extracolsep{0pt}} X@{\extracolsep{0pt}} r r@{\extracolsep{0pt}} r }}} {\ifbool{Descuentos} - {\begin{tabularx}{\textwidth}{|l@{\extracolsep{0pt}} X r|c|r|}}% - {\begin{tabularx}{\textwidth}{|l@{\extracolsep{0pt}} X r|r@{\extracolsep{0pt}} r|}}}% + {\begin{tabularx}{\textwidth}{|l@{\extracolsep{0pt}} X@{\extracolsep{0pt}} r|c|r|}} + {\begin{tabularx}{\textwidth}{|l@{\extracolsep{0pt}} X@{\extracolsep{0pt}} r|r@{\extracolsep{0pt}} r|}}}% \hline \@ZERO \if@csv @@ -1154,6 +1188,7 @@ República Bolivariana de Venezuela. {\multicolumn{5}{|r}\begingroup \ifdim \ht\@CajaEspacioVacio=0pt \else \if@linea\zsaveposx{LineaNodoBCoordX}\zsaveposy{LineaNodoBCoordY}\fi\fi \begin{tabular}[b]{@{\extracolsep{2\tabcolsep}}lr|}}% Una vaina loca... tuve que meter también el tabular con la línea '|' porque no pude poner esa línea en el multicolumn. + \@CalculaTotalesI \if@agrupado \@EscribeTotalColAgrupado \else @@ -1162,18 +1197,18 @@ República Bolivariana de Venezuela. \@EscribeTotalCol{G}\if@ivaexpresado\@EscribeTotalColAlicuota{G}\fi \if@BIA\@EscribeTotalCol{A}\if@ivaexpresado\@EscribeTotalColAlicuota{A}\fi\fi \fi - \if@ivaexpresado\cline{2-2}\fi% - \hfill \@LetraTitTotal\@@Total & \@TotalTotal\@LetraNumTotal\numprint{\Total}\\ - \end{tabular}\endgroup% + \if@ivaexpresado\cline{2-2}\fi + \hfill \@LetraTitTotal\@@Total & \@LetraNumTotal\numprint{\Total}\\ + \end{tabular}\endgroup \\\hline \fi \end{tabularx}% % \if@filas + \@CalculaTotalesI \@LetraNumTotales \vspace*{\@SeparaElementos}\par \if@exparriba\else\vfill\fi - \@TotalTotal \@GeneraCajasTotalesFilas \newbox{\@CajaTotal}% \savebox{\@CajaTotal}{{\@LetraTitTotal\@@Total}: \@LetraNumTotal\numprint{\Total}}% @@ -1256,8 +1291,8 @@ República Bolivariana de Venezuela. \fi % Los descuentos totales no son compatibles -y no sé si lo serán- con el modo de totalización en filas. \if@filas - \if@descuentostotales - \ClassWarning{factura}{La opción 'filas' no es compatible aún con los descuentos totales; sin efecto opción 'filas'.}{} + \if@Descuentos + \ClassWarning{factura}{La opción 'filas' no es compatible con los descuentos totales; sin efecto opción 'filas'.}{} \@filasfalse\boolfalse{Filas} \fi \fi @@ -1323,8 +1358,6 @@ República Bolivariana de Venezuela. \NewDocumentCommand{\Descripcion}{s m}{} \fi -\let\desc\Descripcion - \if@reporte \ifdefvoid{\@EstiloPag}{\let\@EstiloPag\@EstiloPagNoTitulo}{}% \if@factura @@ -1338,7 +1371,7 @@ República Bolivariana de Venezuela. \fi \fancy@setoffs \@CargaFondoReporte - \@EncabezadoReporte% + \@EncabezadoReporte \if@fondoreporte \if@fondoreportestar \pagestyle{solopie}% @@ -1513,15 +1546,10 @@ República Bolivariana de Venezuela. \addtolength{\@LineaNodoYo}{\@EspacioVacioInicial-\@EspacioVacioFinal}% \if@filas \else - % \FPifeq no se puede meter en un \else... (?) Por eso el uso de \ifthenelse. Katastrophal. - \ifthenelse{\equal{\@DescuentoGPorc}{0}}{}{\addtolength{\@LineaNodoYo}{2\baselineskip}}% - \ifthenelse{\equal{\@DescuentoRPorc}{0}}{}{\if@BIR\addtolength{\@LineaNodoYo}{2\baselineskip}\fi}% - \ifthenelse{\equal{\@DescuentoAPorc}{0}}{}{\if@BIA\addtolength{\@LineaNodoYo}{2\baselineskip}\fi}% - \ifthenelse{\equal{\@DescuentoEPorc}{0}}{}{\if@Exento\addtolength{\@LineaNodoYo}{2\baselineskip}\fi}% -%% \FPifeq\@DescuentoGPorc{0}\else\addtolength{\@LineaNodoYo}{2\baselineskip}\fi -%% \FPifeq\@DescuentoRPorc{0}\else\if@BIR\addtolength{\@LineaNodoYo}{2\baselineskip}\fi\fi -%% \FPifeq\@DescuentoAPorc{0}\else\if@BIA\addtolength{\@LineaNodoYo}{2\baselineskip}\fi\fi -%% \FPifeq\@DescuentoEPorc{0}\else\if@Exento\addtolength{\@LineaNodoYo}{2\baselineskip}\fi\fi + \if@DescG \addtolength{\@LineaNodoYo}{2\baselineskip}\fi + \if@DescR \if@BIR \addtolength{\@LineaNodoYo}{2\baselineskip}\fi\fi + \if@DescA \if@BIA \addtolength{\@LineaNodoYo}{2\baselineskip}\fi\fi + \if@DescE \if@Exento \addtolength{\@LineaNodoYo}{2\baselineskip}\fi\fi \addtolength{\@LineaNodoYo}{\baselineskip/2}% \if@ivaexpresado \addtolength{\@LineaNodoYo}{2\baselineskip}% diff --git a/Master/texmf-dist/tex/latex/factura/factura.def b/Master/texmf-dist/tex/latex/factura/factura.def index 665d30d2043..e3d685c4642 100644 --- a/Master/texmf-dist/tex/latex/factura/factura.def +++ b/Master/texmf-dist/tex/latex/factura/factura.def @@ -34,13 +34,13 @@ %% and factura-beispiel-rechnung.tex. %% \ProvidesFile{factura.def} -[2015/04/13 v2.05^^J +[2015/08/26 v2.1^^J Archivo valores iniciales y condiciones de borde para factura.cls ] %% La geometría en formato de factura y de reporte. %% El margen superior está definido desde el encabezado con los datos del cliente. -%% El margen inferior está definido hasta el final de la descripción (o del renglón de la factura si no hay descripción). +%% El margen inferior está definido hasta el final de la descripción (o del cuadro de la factura si no hay descripción). %% Hay elementos que salen fuera de estos márgenes, como las firmas, las condiciones de pago, la numeración y la fecha. \GeometriaFactura{letterpaper,vmargin={5cm,5.5cm}, hmargin={1cm,1cm},footskip=0pt, headsep=0pt, headheight=0pt} \GeometriaReporte{letterpaper,vmargin={2.8cm,2.5cm},hmargin={3cm,2cm},footskip=1.2cm,headsep=0.777cm,headheight=1.5cm} @@ -66,7 +66,7 @@ Archivo valores iniciales y condiciones de borde para factura.cls \def\@DenomAlicuotaA{A} \def\@DenomAlicuotaE{(E)} -%% Macros cuya definición es un texto, y no suele ser necesario cambiarlas: +%% Macros que guardan textos que corresponden a nombres de campos: \def\@@Fecha{Fecha de emisi\'on:} \def\@@RazonSocial{Raz\'on social:} \def\@@Cantidad{Cantidad} @@ -124,7 +124,7 @@ Archivo valores iniciales y condiciones de borde para factura.cls %% Separación mínima horizontal entre los totales en modo de filas y distancia vertical entre esas líneas, fija. \SepFilas{0.8cm}{2.5pt} -%% Separación vertical entre los elementos de la factura (entre el encabezado y el renglón de la 'factura', luego desde dicho renglón hasta la descripción, o hasta los totales en modo de filas). +%% Separación vertical entre los elementos de la factura (entre el encabezado y el cuadro de la 'factura', luego desde dicho cuadro hasta la descripción, o hasta los totales en modo de filas). \SepElementos{0.2cm} %% Separación horizontal entre las cajas del encabezado y separación interna entre la línea y el texto. -- cgit v1.2.3