Compare commits

..

No commits in common. "master" and "v1.44.0" have entirely different histories.

60 changed files with 1433 additions and 6623 deletions

3
.gitignore vendored
View File

@ -2,7 +2,6 @@
__pycache__/
*.py[cod]
*$py.class
Pipfile*
# Django stuff:
*.log
@ -23,7 +22,6 @@ vedev/
# Virtualenv
.env/
virtual/
env
docs/build
cache/
@ -34,5 +32,4 @@ credenciales.conf
*.orig
rfc.db
Dockerfile
chuletas/

View File

@ -1,204 +1,3 @@
v 2.3.2 [10-Abr-2024]
- Fix: En las mercancias en la Carta Porte al generar el PDF.
v 2.3.1 [02-Abr-2024]
- Fix: En la cantidad de la mercancia en la Carta Porte.
v 2.3.0 [01-Abr-2024]
- Mejora: Soporte para complemento Carta Porte 3.0
- **IMPORTANTE**: Aunque no lo uses, esto afecta al JS de facturación, por
lo que tienes que forzar el refresco (CTRL+F5) si tienes algún problema.
v 2.2.0 [24-Ene-2024]
- Mejora: Soporte para complemento Comercio Exterior 2.0
- **IMPORTANTE**: Aunque no lo uses, esto afecta al JS de facturación, por
lo que tienes que forzar el refresco (CTRL+F5) si tienes algún problema.
v 2.1.0 [26-Dic-2023]
- Mejora: Se agrega filtro por día en facturas.
v 2.0.9 [20-Dic-2023]
- Fix: Issue 98 y 107
v 2.0.8 [30-Oct-2023]
---------------------
- Fix: Permitir generar CFDI de egreso para facturas globales sin datos globales.
- Fix: Permitir cambiar la zona horaria para cuando se usa en servidor.
Es necesario hacer una migración:
```
cd /opt/empresa-libre
git pull origin master
cd source/app/models
python main.py -bk
python main.py -m -r RFC
```
v 2.0.7 [06-Ju1-2023]
---------------------
- Fix: En tasa de retención de un Resico a una Persona Moral.
v 2.0.6 [14-Jun-2023]
---------------------
- Fix: Al generar complementos de pago con facturas con retención de impuestos.
v 2.0.5 [05-Jun-2023]
---------------------
- Fix: Al generar complementos de pago con facturas con varios impuestos.
- Fix: ticket #103, hay que usar {receptor.correo_facturas} y {receptor.telefonos}
v 2.0.2 [01-Abr-2023]
---------------------
- Fix: Obtener la clave del sat al facturar por lote.
v 2.0.1 [29-Mar-2023]
---------------------
- Fix ticket #97
Es necesario hacer una migración:
```
cd /opt/empresa-libre
git pull origin master
cd source/app/models
python main.py -bk
python main.py -m -r RFC
```
v 2.0.0 [08-Ene-2023]
----------------------
- Liberamos para todos la versión CFDI 4.0
- **IMPORTANTE** NO intentes timbrar si **antes** no has validado en nuestro demo que puedes timbrar tus CFDIs habituales.
* IMPORTANTE:
Es necesario hacer una migración:
```
cd /opt/empresa-libre
git pull origin master
cd source/app/models
python main.py -bk
python main.py -m -r RFC
```
Y reiniciar todo. IMPORTANTE: dependiendo desde que versión actualices, tal vez debas de hacer algún prodecimiento extra. Siempre revisa este historial.
v 2.0.0 [31-Mar-2022]
----------------------
- Primera versión de timbrado con CFDI4
- **IMPORTANTE** NO intentes timbrar si **antes** no has validado en nuestro demo que puedes timbrar tus CFDIs habituales.
v 1.47.0 [28-Mar-2022]
----------------------
- Mejora: Soporte basico para complemento Comercio Exterior.
v 1.46.5 [10-Mar-2022]
----------------------
- Error: Al timbrar nómina con Comercio Digital
v 1.46.4 [18-Feb-2022]
----------------------
- Error: Issue #54
v 1.46.3 [15-Feb-2022]
----------------------
- Error: Issue #53
v 1.46.2 [31-Ene-2022]
----------------------
- Error: Al generar Carta Porte sin remolque.
- Error: Al cancelar con Finkok.
v 1.46.1 [29-Ene-2022]
----------------------
- Error: Issue #49
- Mejora: Agregar validación para distancia en origen de Carta Porte.
v 1.46.0 [27-Ene-2022]
----------------------
- Mejora: Issue #45
- Mejora: Agregar tipos de persimos SCT para Carta Porte
- Mejora: Buscar estado y municipio por CP en Carta Porte
v 1.45.4 [25-Ene-2022]
----------------------
- Error: Al timbrar carta porte.
- Error: Al cancelar con Comercio Digital.
- Error: Issue #42
- Mejora: Issue #44
* IMPORTANTE: Es necesario subir de nuevo tus certificados de sello, **solo** si timbras con Comercio Digital.
v 1.45.3 [23-Ene-2022]
----------------------
- Error: El enviar por correo CFDI de pago. Ticket #40
v 1.45.2 [21-Ene-2022]
----------------------
- Error: Al cancelar un CFDI
v 1.45.1 [20-Ene-2022]
----------------------
- Error: Al enviar correos con la nueva configuración
* IMPORTANTE: Revisa tu configuración de correo para verificar que todo funcione.
v 1.45.0 [20-Ene-2022]
----------------------
- Importar Carta Porte desde archivo JSON
v 1.44.2 [19-Ene-2022]
----------------------
- Agregar opción STARTTLS que requieren algunos servidores de correo
* IMPORTANTE: Revisa tu configuración de correo para verificar si tienes que usar esta opción.
v 1.44.1 [19-Ene-2022]
----------------------
- Correciones en generación de Carta Porte v2.0
- Plantilla para representación impresa de Carta Porte v2.0
v 1.44.0 [10-Ene-2022]
----------------------
- Soporte para Carta Porte v2 con CFDI 3.3

View File

@ -14,12 +14,14 @@ contratar: administracion ARROBA empresalibre.net
G1: `A5DdXxCKPw3QKWVdDVs7CzkNugNUW1sHu5zDJFWxCU2h`
BCH: `qztd3l00xle5tffdqvh2snvadkuau2ml0uqm4n875d`
BTC: `3FhiXcXmAesmQzrNEngjHFnvaJRhU1AGWV`
## Requerimientos:
### Requerimientos:
* Servidor web, recomendado Nginx
* uwsgi
* python 3.8
* python3.7+
* xsltproc
* openssl
* xmlsec
@ -36,25 +38,5 @@ aplicaciones Python.
El sistema tiene soporte solo para PostgreSQL, debes de instalar el servidor de
la base de datos y su driver respectivo.
## Configuración para desarrollo local
* Crea un entorno virtual con python 3.8 y actívalo. Por ejemplo con virtualenv:
virtualenv .venv
source .venv/bin/activate
* Instala las dependencias
pip install -r requirements.txt
* Copia y ajusta algunos archivos necesarios.
- `source/app/conf.py`
- `source/app/controllers/pacs/comerciodigital/conf.py.example`
- `source/app/controllers/pacs/finkok/conf.py.example`
* Finalmente ejecutamos la aplicación. Para esto vamos a necesitar un servidor
wsgi como uwsgi:
pip install uwsgi
cd source/app
uwsgi main_debug.ini
* Ahora puedes ver la aplicación en http://localhost:8000

View File

@ -1,3 +0,0 @@
[ ] Permitir más de un remolque en la Carta Porte
[ ] Campos de captura de Comercio Exterior
[ ] Representación impresa de Comercio Exterior

View File

@ -1 +1,2 @@
2.3.2
1.44.0

20
docs/Makefile Normal file
View File

@ -0,0 +1,20 @@
# Minimal makefile for Sphinx documentation
#
# You can set these variables from the command line, and also
# from the environment for the first two.
SPHINXOPTS ?=
SPHINXBUILD ?= sphinx-build
SOURCEDIR = source
BUILDDIR = build
# Put it first so that "make" without argument is like "make help".
help:
@$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
.PHONY: help Makefile
# Catch-all target: route all unknown targets to Sphinx using the new
# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
%: Makefile
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)

35
docs/make.bat Normal file
View File

@ -0,0 +1,35 @@
@ECHO OFF
pushd %~dp0
REM Command file for Sphinx documentation
if "%SPHINXBUILD%" == "" (
set SPHINXBUILD=sphinx-build
)
set SOURCEDIR=source
set BUILDDIR=build
if "%1" == "" goto help
%SPHINXBUILD% >NUL 2>NUL
if errorlevel 9009 (
echo.
echo.The 'sphinx-build' command was not found. Make sure you have Sphinx
echo.installed, then set the SPHINXBUILD environment variable to point
echo.to the full path of the 'sphinx-build' executable. Alternatively you
echo.may add the Sphinx directory to PATH.
echo.
echo.If you don't have Sphinx installed, grab it from
echo.http://sphinx-doc.org/
exit /b 1
)
%SPHINXBUILD% -M %1 %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O%
goto end
:help
%SPHINXBUILD% -M help %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O%
:end
popd

21
docs/source/index.rst Normal file
View File

@ -0,0 +1,21 @@
.. Documentación de Empresa Libre documentation master file, created by
sphinx-quickstart on Sat Oct 23 21:49:03 2021.
You can adapt this file completely to your liking, but it should at least
contain the root `toctree` directive.
Documentación de Empresa Libre
==============================
.. toctree::
:maxdepth: 2
:caption: Contents:
inicio
Indices and tables
==================
* :ref:`genindex`
* :ref:`modindex`
* :ref:`search`

39
docs/source/inicio.rst Normal file
View File

@ -0,0 +1,39 @@
Introducción
============
Acerca de Empresa Libre
-----------------------
**Empresa Libre** es un sistema de facturación electrónica especialmente diseñado
para la legislación mexicana.
**Empresa Libre** es 100% Software Libre, recuerda, **Software Libre, NO gratis.**
Requerimientos
--------------
* Servidor web Nginx
* Servidor de bases de datos PostgreSQL
* uwsgi
* python3.7+
* xsltproc
* openssl
* xmlsec
y los requerimientos del archivo *requirements.txt*
También es necesario un certificado de sellos vigente para facturar.
Repositorio
-----------
En el `repositorio del proyecto`_, puedes usar el sistema de tickets para solicitar soporte gratuito.
Contratar soporte de pago ayuda al desarrollo y mantenimiento de **Empresa Libre**.
.. _repositorio del proyecto: https://git.cuates.net/elmau/empresa-libre

View File

@ -14,4 +14,9 @@ cryptography==3.4.8
xmlsec
segno
# pyqrcode
# pypng
# python-escpos
# pyusb
# pyserial
# qrcode

View File

@ -25,23 +25,16 @@ from logbook import Logger
log = Logger('XML')
CFDI_ACTUAL = 'cfdi40'
CFDI_ACTUAL = 'cfdi33'
NOMINA_ACTUAL = 'nomina12'
PUBLIC = 'PUBLICO EN GENERAL'
CFDI_EGRESO = 'E'
DEFAULT = {
'exportacion': '01',
}
SAT = {
'xsi': 'http://www.w3.org/2001/XMLSchema-instance',
'cfdi40': {
'version': '4.0',
'cfdi32': {
'version': '3.2',
'prefix': 'cfdi',
'xmlns': 'http://www.sat.gob.mx/cfd/4',
'schema': 'http://www.sat.gob.mx/cfd/4 http://www.sat.gob.mx/sitio_internet/cfd/4/cfdv40.xsd',
'xmlns': 'http://www.sat.gob.mx/cfd/3',
'schema': 'http://www.sat.gob.mx/cfd/3 http://www.sat.gob.mx/sitio_internet/cfd/3/cfdv32.xsd',
},
'cfdi33': {
'version': '3.3',
@ -49,12 +42,6 @@ SAT = {
'xmlns': 'http://www.sat.gob.mx/cfd/3',
'schema': 'http://www.sat.gob.mx/cfd/3 http://www.sat.gob.mx/sitio_internet/cfd/3/cfdv33.xsd',
},
'cfdi32': {
'version': '3.2',
'prefix': 'cfdi',
'xmlns': 'http://www.sat.gob.mx/cfd/3',
'schema': 'http://www.sat.gob.mx/cfd/3 http://www.sat.gob.mx/sitio_internet/cfd/3/cfdv32.xsd',
},
'nomina11': {
'version': '1.1',
'prefix': 'nomina',
@ -93,10 +80,10 @@ SAT = {
'schema': ' http://www.sat.gob.mx/iedu http://www.sat.gob.mx/sitio_internet/cfd/iedu/iedu.xsd',
},
'pagos': {
'version': '2.0',
'prefix': 'pago20',
'xmlns': 'http://www.sat.gob.mx/Pagos20',
'schema': ' http://www.sat.gob.mx/Pagos20 http://www.sat.gob.mx/sitio_internet/cfd/Pagos/Pagos20.xsd',
'version': '1.0',
'prefix': 'pago10',
'xmlns': 'http://www.sat.gob.mx/Pagos',
'schema': ' http://www.sat.gob.mx/Pagos http://www.sat.gob.mx/sitio_internet/cfd/Pagos/Pagos10.xsd',
},
'divisas': {
'version': '1.0',
@ -111,16 +98,10 @@ SAT = {
'schema': ' http://www.sat.gob.mx/leyendasFiscales http://www.sat.gob.mx/sitio_internet/cfd/leyendasFiscales/leyendasFisc.xsd',
},
'cartaporte': {
'version': '3.0',
'prefix': 'cartaporte30',
'xmlns': 'http://www.sat.gob.mx/CartaPorte30',
'schema': ' http://www.sat.gob.mx/CartaPorte30 http://www.sat.gob.mx/sitio_internet/cfd/CartaPorte/CartaPorte30.xsd',
},
'comercioe': {
'version': '2.0',
'prefix': 'cce20',
'xmlns': 'http://www.sat.gob.mx/ComercioExterior20',
'schema': ' http://www.sat.gob.mx/ComercioExterior20 http://www.sat.gob.mx/sitio_internet/cfd/ComercioExterior20/ComercioExterior20.xsd',
'prefix': 'cartaporte20',
'xmlns': 'http://www.sat.gob.mx/CartaPorte20',
'schema': ' http://www.sat.gob.mx/CartaPorte20 http://www.sat.gob.mx/sitio_internet/cfd/CartaPorte/CartaPorte20.xsd',
}
}
@ -141,10 +122,7 @@ class CFDI(object):
self._is_nomina = False
self._leyendas = False
self._carta_porte = False
self._comercio_exterior = False
self._divisas = ''
self._tipo_de_comprobante = ''
self._exportacion = DEFAULT['exportacion']
self.error = ''
def _now(self):
@ -155,8 +133,6 @@ class CFDI(object):
return ''
self._comprobante(datos['comprobante'])
if 'global' in datos:
self._informacion_global(datos['global'])
self._relacionados(datos['relacionados'])
self._emisor(datos['emisor'])
self._receptor(datos['receptor'])
@ -169,9 +145,7 @@ class CFDI(object):
if 'nomina' in datos:
self._nomina(datos['nomina'])
xml = self._to_pretty_xml(ET.tostring(self._cfdi, encoding='utf-8'))
return xml
return self._to_pretty_xml(ET.tostring(self._cfdi, encoding='utf-8'))
def add_sello(self, sello, cert_txt):
self._cfdi.attrib['Sello'] = sello
@ -200,9 +174,6 @@ class CFDI(object):
self._pagos = bool(datos['complementos'].get('pagos', False))
self._leyendas = bool(datos['complementos'].get('leyendas', False))
self._carta_porte = bool(datos['complementos'].get('cartaporte', False))
self._comercio_exterior = bool(datos['complementos'].get('comercioe', False))
if self._comercio_exterior:
self._exportacion = datos['complementos']['comercioe'].pop('Exportacion')
self._divisas = datos['comprobante'].pop('divisas', '')
@ -274,16 +245,10 @@ class CFDI(object):
attributes[name] = SAT['cartaporte']['xmlns']
schema_carta_porte = SAT['cartaporte']['schema']
schema_comercioe = ''
if self._comercio_exterior:
name = 'xmlns:{}'.format(SAT['comercioe']['prefix'])
attributes[name] = SAT['comercioe']['xmlns']
schema_carta_porte = SAT['comercioe']['schema']
attributes['xsi:schemaLocation'] = self._sat_cfdi['schema'] + \
schema_locales + schema_donativo + schema_ine + schema_edu + \
schema_divisas + schema_nomina + schema_pagos + schema_leyendas + \
schema_carta_porte + schema_comercioe
schema_carta_porte
attributes.update(datos)
if not 'Version' in attributes:
@ -291,23 +256,9 @@ class CFDI(object):
if not 'Fecha' in attributes:
attributes['Fecha'] = self._now()
# ~ cfdi4
if not 'Exportacion' in attributes:
attributes['Exportacion'] = self._exportacion
self._tipo_de_comprobante = attributes['TipoDeComprobante']
self._cfdi = ET.Element('{}:Comprobante'.format(self._pre), attributes)
return
def _informacion_global(self, datos):
if not datos:
return
node_name = '{}:InformacionGlobal'.format(self._pre)
node = ET.SubElement(self._cfdi, node_name, datos)
return
def _relacionados(self, datos):
if not datos or not datos['tipo'] or not datos['cfdis']:
return
@ -327,10 +278,6 @@ class CFDI(object):
return
def _receptor(self, datos):
receptor_name = datos['Nombre'].upper()
if receptor_name == PUBLIC and self._tipo_de_comprobante == CFDI_EGRESO:
receptor_name = datos['Nombre']
datos['Nombre'] = receptor_name
node_name = '{}:Receptor'.format(self._pre)
emisor = ET.SubElement(self._cfdi, node_name, datos)
return
@ -400,10 +347,6 @@ class CFDI(object):
for field in fields:
if field in datos:
attributes[field] = datos[field]
if not attributes:
return
node_name = '{}:Impuestos'.format(self._pre)
impuestos = ET.SubElement(self._cfdi, node_name, attributes)
@ -520,47 +463,6 @@ class CFDI(object):
return
def _complemento_comercio_exterior(self, datos):
prefix = SAT['comercioe']['prefix']
emisor = datos.pop('emisor')
propietarios = datos.pop('propietarios', {})
receptor = datos.pop('receptor')
destinatario = datos.pop('destinatario', {})
mercancias = datos.pop('mercancias')
attr = {'Version': SAT['comercioe']['version']}
attr.update(datos)
ce = ET.SubElement(
self._complemento, f'{prefix}:ComercioExterior', attr)
attributes = {}
if 'Curp' in emisor:
attributes = {'Curp': emisor.pop('Curp')}
node = ET.SubElement(ce, '{}:Emisor'.format(prefix), attributes)
ET.SubElement(node, '{}:Domicilio'.format(prefix), emisor)
attributes = {}
if 'NumRegIdTrib' in receptor:
attributes = {'NumRegIdTrib': receptor.pop('NumRegIdTrib')}
node = ET.SubElement(ce, '{}:Receptor'.format(prefix), attributes)
ET.SubElement(node, '{}:Domicilio'.format(prefix), receptor)
node = ET.SubElement(ce, '{}:Mercancias'.format(prefix))
fields = ('Marca', 'Modelo', 'SubModelo', 'NumeroSerie')
for row in mercancias:
detalle = {}
for f in fields:
if f in row and row[f]:
detalle[f] = row[f]
row.pop(f)
concepto = ET.SubElement(node, '{}:Mercancia'.format(prefix), row)
if detalle:
ET.SubElement(
concepto, '{}:DescripcionesEspecificas'.format(prefix), detalle)
return
def _complementos(self, datos):
if not datos:
return
@ -571,15 +473,11 @@ class CFDI(object):
if self._carta_porte:
datos = datos['cartaporte']
print('\nDatos', datos)
ubicaciones = datos.pop('ubicaciones')
mercancias = datos.pop('mercancias', ())
tiposfigura = datos.pop('tiposfigura', ())
autotransporte = datos.pop('autotransporte', {})
identificacion = autotransporte.pop('identificacion')
seguros = autotransporte.pop('seguros')
remolques = autotransporte.pop('remolques')
atributos = {'Version': SAT['cartaporte']['version']}
atributos.update(datos)
@ -588,15 +486,15 @@ class CFDI(object):
node = ET.SubElement(node_carta, f'{prefix}:Ubicaciones')
for ubicacion in ubicaciones:
domicilio = ubicacion.pop('domicilio', {})
dt = parser.parse(ubicacion['FechaHoraSalidaLlegada'])
ubicacion['FechaHoraSalidaLlegada'] = dt.isoformat()[:19]
sub_node = ET.SubElement(node, f'{prefix}:Ubicacion', ubicacion)
if domicilio:
ET.SubElement(sub_node, f'{prefix}:Domicilio', domicilio)
ET.SubElement(node, f'{prefix}:Ubicacion', ubicacion)
attr = mercancias
mercancias = attr.pop('mercancias')
autotransporte = attr.pop('autotransporte')
identificacion = autotransporte.pop('identificacion')
seguros = autotransporte.pop('seguros')
node = ET.SubElement(node_carta, f'{prefix}:Mercancias', attr)
for mercancia in mercancias:
@ -605,10 +503,6 @@ class CFDI(object):
sub_node = ET.SubElement(node, f'{prefix}:Autotransporte', autotransporte)
ET.SubElement(sub_node, f'{prefix}:IdentificacionVehicular', identificacion)
ET.SubElement(sub_node, f'{prefix}:Seguros', seguros)
if remolques:
node_remolques = ET.SubElement(sub_node, f'{prefix}:Remolques')
for remolque in remolques:
ET.SubElement(node_remolques, f'{prefix}:Remolque', remolque)
if tiposfigura:
sub_node = ET.SubElement(node_carta, f'{prefix}:FiguraTransporte')
@ -631,53 +525,21 @@ class CFDI(object):
atributos.update(datos['ine'])
node_ine = ET.SubElement(self._complemento, 'ine:INE', atributos)
if ine_key_entidad:
attr = {'ClaveEntidad': ine_key_entidad}
if ine_ambito:
attr['Ambito'] = ine_ambito
attr = {'ClaveEntidad': ine_key_entidad, 'Ambito': ine_ambito}
node_entidad = ET.SubElement(node_ine, 'ine:Entidad', attr)
attr = {'IdContabilidad': ine_id_conta}
ET.SubElement(node_entidad, 'ine:Contabilidad', attr)
if 'pagos' in datos:
datos = datos.pop('pagos')
totales = datos.pop('totales')
relacionados = datos.pop('relacionados')
taxes_pay = datos.pop('taxes_pay')
pre = SAT['pagos']['prefix']
attributes = {'Version': SAT['pagos']['version']}
pagos = ET.SubElement(
self._complemento, '{}:Pagos'.format(pre), attributes)
ET.SubElement(pagos, '{}:Totales'.format(pre), totales)
node_pago = ET.SubElement(pagos, '{}:Pago'.format(pre), datos)
for row in relacionados:
taxes = row.pop('taxes')
node = ET.SubElement(node_pago, f'{pre}:DoctoRelacionado', row)
nodex_tax = None
if taxes['traslados'] or taxes['retenciones']:
node_tax = ET.SubElement(node, f'{pre}:ImpuestosDR')
if taxes['retenciones']:
node = ET.SubElement(node_tax, f'{pre}:RetencionesDR')
for tax in taxes['retenciones']:
ET.SubElement(node, f'{pre}:RetencionDR', tax)
if taxes['traslados']:
node = ET.SubElement(node_tax, f'{pre}:TrasladosDR')
for tax in taxes['traslados']:
ET.SubElement(node, f'{pre}:TrasladoDR', tax)
if taxes_pay['traslados'] or taxes_pay['retenciones']:
node_tax = ET.SubElement(node_pago, f'{pre}:ImpuestosP')
if taxes_pay['retenciones']:
node = ET.SubElement(node_tax, f'{pre}:RetencionesP')
for key, importe in taxes_pay['retenciones'].items():
attr = {'ImpuestoP': key, 'ImporteP': importe}
ET.SubElement(node, f'{pre}:RetencionP', attr)
if taxes_pay['traslados']:
node = ET.SubElement(node_tax, f'{pre}:TrasladosP')
for key, tax in taxes_pay['traslados'].items():
ET.SubElement(node, f'{pre}:TrasladoP', tax)
ET.SubElement(node_pago, '{}:DoctoRelacionado'.format(pre), row)
if 'leyendas' in datos:
pre = SAT['leyendas']['prefix']
@ -687,8 +549,57 @@ class CFDI(object):
for leyend in datos['leyendas']:
ET.SubElement(node_leyend, '{}:Leyenda'.format(pre), leyend)
if self._comercio_exterior:
datos = datos.pop('comercioe')
self._complemento_comercio_exterior(datos)
if 'ce' in datos:
pre = 'cce11'
datos = datos.pop('ce')
emisor = datos.pop('emisor')
propietario = datos.pop('propietario')
receptor = datos.pop('receptor')
destinatario = datos.pop('destinatario')
conceptos = datos.pop('conceptos')
attributes = {}
attributes['xmlns:{}'.format(pre)] = \
'http://www.sat.gob.mx/ComercioExterior11'
attributes['xsi:schemaLocation'] = \
'http://www.sat.gob.mx/ComercioExterior11 ' \
'http://www.sat.gob.mx/sitio_internet/cfd/ComercioExterior11/ComercioExterior11.xsd'
attributes.update(datos)
ce = ET.SubElement(
complemento, '{}:ComercioExterior'.format(pre), attributes)
attributes = {}
if 'Curp' in emisor:
attributes = {'Curp': emisor.pop('Curp')}
node = ET.SubElement(ce, '{}:Emisor'.format(pre), attributes)
ET.SubElement(node, '{}:Domicilio'.format(pre), emisor)
if propietario:
ET.SubElement(ce, '{}:Propietario'.format(pre), propietario)
attributes = {}
if 'NumRegIdTrib' in receptor:
attributes = {'NumRegIdTrib': receptor.pop('NumRegIdTrib')}
node = ET.SubElement(ce, '{}:Receptor'.format(pre), attributes)
ET.SubElement(node, '{}:Domicilio'.format(pre), receptor)
attributes = {}
if 'NumRegIdTrib' in destinatario:
attributes = {'NumRegIdTrib': destinatario.pop('NumRegIdTrib')}
if 'Nombre' in destinatario:
attributes.update({'Nombre': destinatario.pop('Nombre')})
node = ET.SubElement(ce, '{}:Destinatario'.format(pre), attributes)
ET.SubElement(node, '{}:Domicilio'.format(pre), destinatario)
node = ET.SubElement(ce, '{}:Mercancias'.format(pre))
fields = ('Marca', 'Modelo', 'SubModelo', 'NumeroSerie')
for row in conceptos:
detalle = {}
for f in fields:
if f in row:
detalle[f] = row.pop(f)
concepto = ET.SubElement(node, '{}:Mercancia'.format(pre), row)
if detalle:
ET.SubElement(
concepto, '{}:DescripcionesEspecificas'.format(pre), detalle)
return

View File

@ -269,7 +269,9 @@ class SendMail(object):
def _login(self):
try:
if self._config['ssl'] and self._config['starttls']:
if self._config['ssl'] and (
'gmail' in self._config['servidor'] or
'outlook' in self._config['servidor']):
self._server = smtplib.SMTP(
self._config['servidor'],
self._config['puerto'], timeout=10)

View File

@ -2,7 +2,6 @@
import falcon
from middleware import get_template
from urllib.parse import unquote
class AppEmpresas(object):
@ -112,14 +111,6 @@ class AppValues(object):
def on_get(self, req, resp, table):
values = req.params
session = req.env['beaker.session']
if table == 'product':
original = values['name']
try:
values['name'] = unquote(req.query_string.split('=')[1])
except Exception as e:
values['name'] = original
if req.path in ('/values/titlelogin', '/values/empresas'):
req.context['result'] = self._db.get_values(table, values, session)
resp.status = falcon.HTTP_200
@ -289,7 +280,6 @@ class AppProducts(object):
def on_get(self, req, resp):
values = req.params
user = req.env['beaker.session']['userobj']
if 'opt' in values:
req.context['result'] = self._db.products_get(values, user)
else:
@ -542,16 +532,12 @@ class AppDocumentos(object):
self._db = db
def on_get(self, req, resp, type_doc, id_doc):
# ~ print('TD', type_doc)
session = req.env['beaker.session']
req.context['result'], file_name, content_type = \
self._db.get_doc(type_doc, id_doc, session['rfc'])
if not type_doc in ('pdf', 'pre', 'tpdf', 'pdfpago', 'html', 'nompdf'):
if not type_doc in ('pdf', 'pre', 'tpdf', 'pdfpago', 'html'):
resp.append_header('Content-Disposition',
'attachment; filename={}'.format(file_name))
if type_doc in ('pdf', 'nompdf', 'pdfpago'):
resp.append_header('Content-Disposition',
'inline; filename={}'.format(file_name))
resp.content_type = content_type
resp.status = falcon.HTTP_200
@ -801,27 +787,3 @@ class AppSATUnidadesPeso(object):
user = req.env['beaker.session']['userobj']
req.context['result'] = self._db.sat_unidades_peso_post(values, user)
resp.status = falcon.HTTP_200
class AppSATRegimenes(object):
def __init__(self, db):
self._db = db
def on_get(self, req, resp):
values = req.params
user = req.env['beaker.session']['userobj']
req.context['result'] = self._db.sat_regimenes_get(values, user)
resp.status = falcon.HTTP_200
class AppSociosRegimenes(object):
def __init__(self, db):
self._db = db
def on_get(self, req, resp):
values = req.params
user = req.env['beaker.session']['userobj']
req.context['result'] = self._db.socios_regimenes_get(values, user)
resp.status = falcon.HTTP_200

View File

@ -28,18 +28,6 @@ class SATCertificate(object):
self._init_values()
self._get_data_cer(cer)
self._get_data_key(key, password)
# ~ if not password:
# ~ self._test()
# ~ def _test(self):
# ~ key = self._get_key('')
# ~ self._p = ''
# ~ self._key_der = key.private_bytes(
# ~ encoding=serialization.Encoding.DER,
# ~ format=serialization.PrivateFormat.PKCS8,
# ~ encryption_algorithm=serialization.BestAvailableEncryption(self._p.encode())
# ~ )
# ~ return
def _init_values(self):
self._rfc = ''
@ -52,12 +40,10 @@ class SATCertificate(object):
self._is_fiel = False
self._are_couple = False
self._is_valid_time = False
self._key = b''
self._cer = b''
self._cer_pem = ''
self._cer_txt = ''
self._key_enc = b''
self._key_der = b''
self._p12 = b''
self._cer_modulus = 0
self._key_modulus = 0
@ -111,8 +97,6 @@ class SATCertificate(object):
return
def _get_data_key(self, key, password):
self._key = key
self._keyp = password
self._key_enc = key
if not key or not password:
return
@ -178,18 +162,15 @@ class SATCertificate(object):
node = xmlsec.tree.find_node(tree, 'X509Certificate')
node.text = self.cer_txt
node = xmlsec.tree.find_node(tree, 'X509IssuerName')
node.text = self.issuer
# ~ node = xmlsec.tree.find_node(tree, 'X509IssuerName')
# ~ node.text = self.issuer
node = xmlsec.tree.find_node(tree, 'X509SerialNumber')
node.text = self.serial_number
node = xmlsec.tree.find_node(tree, 'SignatureValue')
node.text = node.text.replace('\n', '')
node = xmlsec.tree.find_node(tree, 'Modulus')
node.text = node.text.replace('\n', '')
# ~ node = xmlsec.tree.find_node(tree, 'SignatureValue')
# ~ node.text = node.text.replace('\n', '')
# ~ xml_signed = ET.tostring(tree,
# ~ xml_declaration=True, encoding='UTF-8').decode()
xml_signed = ET.tostring(tree, encoding='UTF-8').decode().replace('\n', '')
xml_signed = ET.tostring(tree,
xml_declaration=True, encoding='UTF-8').decode()
return xml_signed

View File

@ -24,8 +24,7 @@ import lxml.etree as ET
import requests
from requests.exceptions import ConnectionError
from .conf import DEBUG
# ~ , AUTH
from .conf import DEBUG, AUTH
LOG_FORMAT = '%(asctime)s - %(levelname)s - %(message)s'
@ -41,35 +40,12 @@ logging.getLogger('requests').setLevel(logging.ERROR)
TIMEOUT = 10
NAMESPACES = {
'3.3': 'http://www.sat.gob.mx/cfd/3',
'4.0': 'http://www.sat.gob.mx/cfd/4',
'tdf': 'http://www.sat.gob.mx/TimbreFiscalDigital',
}
def pretty_print_POST(req):
"""
At this point it is completely built and ready
to be fired; it is "prepared".
However pay attention at the formatting used in
this function because it is programmed to be pretty
printed and may differ from the actual request.
"""
print('{}\n{}\r\n{}\r\n\r\n{}'.format(
'-----------START-----------',
req.method + ' ' + req.url,
'\r\n'.join('{}: {}'.format(k, v) for k, v in req.headers.items()),
req.body,
))
class PACComercioDigital(object):
ws = 'https://{}.comercio-digital.mx/{}'
api = 'https://app2.comercio-digital.mx/{}'
URL = {
'timbra': ws.format('ws', 'timbre4/timbrarV5'),
'timbra': ws.format('ws', 'timbre/timbrarV5.aspx'),
'cancel': ws.format('cancela', 'cancela4/cancelarUuid'),
'cancelxml': ws.format('cancela', 'cancela4/cancelarXml'),
'status': ws.format('cancela', 'arws/consultaEstatus'),
@ -84,7 +60,7 @@ class PACComercioDigital(object):
'702': '702 Error rfc/empresa invalido',
}
NS_CFDI = {
'cfdi': 'http://www.sat.gob.mx/cfd/4',
'cfdi': 'http://www.sat.gob.mx/cfd/3',
'tdf': 'http://www.sat.gob.mx/TimbreFiscalDigital',
}
@ -92,7 +68,7 @@ class PACComercioDigital(object):
ws = 'https://pruebas.comercio-digital.mx/{}'
ws6 = 'https://pruebas6.comercio-digital.mx/arws/{}'
URL = {
'timbra': ws.format('timbre4/timbrarV5'),
'timbra': ws.format('timbre/timbrarV5.aspx'),
'cancel': ws.format('cancela4/cancelarUuid'),
'cancelxml': ws.format('cancela4/cancelarXml'),
'status': ws6.format('consultaEstatus'),
@ -114,12 +90,6 @@ class PACComercioDigital(object):
headers['host'] = url.split('/')[2]
headers['Content-type'] = 'text/plain'
headers['Connection'] = 'Keep-Alive'
headers['Expect'] = '100-continue'
if DEBUG:
req = requests.Request('POST', url, headers=headers, data=data)
prepared = req.prepare()
pretty_print_POST(prepared)
try:
result = requests.post(url, data=data, headers=headers, timeout=TIMEOUT)
@ -132,14 +102,14 @@ class PACComercioDigital(object):
"""
Comercio Digital solo soporta la declaración con doble comilla
"""
# ~ tree = ET.fromstring(xml.encode())
# ~ xml = ET.tostring(tree,
# ~ pretty_print=True, doctype='<?xml version="1.0" encoding="utf-8"?>')
return xml.encode('utf-8')
tree = ET.fromstring(xml.encode())
xml = ET.tostring(tree,
pretty_print=True, doctype='<?xml version="1.0" encoding="utf-8"?>')
return xml
def stamp(self, cfdi, auth):
# ~ if DEBUG or not auth:
# ~ auth = AUTH
def stamp(self, cfdi, auth={}):
if DEBUG or not auth:
auth = AUTH
url = self.URL['timbra']
headers = {
@ -177,33 +147,31 @@ class PACComercioDigital(object):
return data
def _get_data_cancel(self, cfdi, info, auth):
info['pass'] = '12345678a'
info['tipo'] = 'cfdi'
info['key'] = base64.b64encode(info['key_enc']).decode()
info['cer'] = base64.b64encode(info['cer_ori']).decode()
info['key'] = base64.b64encode(info['key']).decode()
info['cer'] = base64.b64encode(info['cer']).decode()
tree = ET.fromstring(cfdi.encode())
version = tree.attrib['Version']
namespaces = {
'cfdi': NAMESPACES[version],
'tdf': NAMESPACES['tdf'],
NS_CFDI = {
'cfdi': 'http://www.sat.gob.mx/cfd/3',
'tdf': 'http://www.sat.gob.mx/TimbreFiscalDigital',
}
tree = ET.fromstring(cfdi.encode())
tipo = tree.xpath(
'string(//cfdi:Comprobante/@TipoDeComprobante)',
namespaces=namespaces)
namespaces=NS_CFDI)
total = tree.xpath(
'string(//cfdi:Comprobante/@Total)',
namespaces=namespaces)
namespaces=NS_CFDI)
rfc_emisor = tree.xpath(
'string(//cfdi:Comprobante/cfdi:Emisor/@Rfc)',
namespaces=namespaces)
namespaces=NS_CFDI)
rfc_receptor = tree.xpath(
'string(//cfdi:Comprobante/cfdi:Receptor/@Rfc)',
namespaces=namespaces)
namespaces=NS_CFDI)
uid = tree.xpath(
'string(//cfdi:Complemento/tdf:TimbreFiscalDigital/@UUID)',
namespaces=namespaces)
namespaces=NS_CFDI)
data = (
f"USER={auth['user']}",
f"PWDW={auth['pass']}",
@ -222,9 +190,9 @@ class PACComercioDigital(object):
)
return '\n'.join(data)
def cancel(self, cfdi, info, auth):
# ~ if DEBUG or not auth:
# ~ auth = AUTH
def cancel(self, cfdi, info, auth={}):
if DEBUG or not auth:
auth = AUTH
url = self.URL['cancel']
data = self._get_data_cancel(cfdi, info, auth)
@ -277,9 +245,9 @@ class PACComercioDigital(object):
return headers
def cancel_xml(self, xml, auth, cfdi='', info={'tipo': 'cfdi'}):
# ~ if DEBUG or not auth:
# ~ auth = AUTH
def cancel_xml(self, xml, auth={}, cfdi='', info={'tipo': 'cfdi3.3'}):
if DEBUG or not auth:
auth = AUTH
url = self.URL['cancelxml']
headers = self._get_headers_cancel_xml(cfdi, info, auth)
@ -304,9 +272,9 @@ class PACComercioDigital(object):
}
return data
def status(self, data, auth):
# ~ if not auth:
# ~ auth = AUTH
def status(self, data, auth={}):
if not auth:
auth = AUTH
url = self.URL['status']
data = (
@ -355,8 +323,8 @@ class PACComercioDigital(object):
return '\n'.join(data)
def client_add(self, data, auth):
# ~ auth = AUTH
def client_add(self, data):
auth = AUTH
url = self.URL['client']
data = self._get_data_client(auth, data)
@ -403,9 +371,9 @@ class PACComercioDigital(object):
return result.text
def client_add_timbres(self, data, auth):
# ~ if not auth:
# ~ auth = AUTH
def client_add_timbres(self, data, auth={}):
if not auth:
auth = AUTH
url = self.URL['timbres']
data = '\n'.join((
f"usr_ws={auth['user']}",

View File

@ -47,7 +47,7 @@ logging.getLogger('zeep').setLevel(logging.ERROR)
TIMEOUT = 10
DEBUG_SOAP = False
DEBUG_SOAP = True
class DebugPlugin(Plugin):
@ -72,10 +72,8 @@ class DebugPlugin(Plugin):
class PACFinkok(object):
WS = 'https://facturacion.finkok.com/servicios/soap/{}.wsdl'
NS_TYPE = 'ns1'
if DEBUG:
WS = 'https://demo-facturacion.finkok.com/servicios/soap/{}.wsdl'
NS_TYPE = 'ns0'
WS = 'http://demo-facturacion.finkok.com/servicios/soap/{}.wsdl'
URL = {
'quick_stamp': False,
'timbra': WS.format('stamp'),
@ -190,18 +188,11 @@ class PACFinkok(object):
return data
def _get_data_cancel(self, cfdi):
VERSIONS = {
'3.3': 'http://www.sat.gob.mx/cfd/3',
'4.0': 'http://www.sat.gob.mx/cfd/4',
}
NS_CFDI = {
'cfdi': 'http://www.sat.gob.mx/cfd/3',
'tdf': 'http://www.sat.gob.mx/TimbreFiscalDigital',
}
tree = ET.fromstring(cfdi.encode())
version = tree.attrib['Version']
NS_CFDI['cfdi'] = VERSIONS[version]
rfc_emisor = tree.xpath(
'string(//cfdi:Comprobante/cfdi:Emisor/@Rfc)',
namespaces=NS_CFDI)
@ -218,19 +209,15 @@ class PACFinkok(object):
method = 'cancel'
client = Client(self.URL[method],
transport=self._transport, plugins=self._plugins)
uuid_type = client.get_type(f'{self.NS_TYPE}:UUIDS')
ns1_uuid = client.get_type(f'{self.NS_TYPE}:UUID')
uuid_type = client.get_type('ns1:UUIDS')
# ~ sa = client.get_type('ns0:stringArray')
ns1_uuid = client.get_type('ns1:UUID')
data_uuid = {
'UUID': cfdi_uuid,
'FolioSustitucion': info['args']['uuid'],
'Motivo': info['args']['reason'],
}
# ~ 'UUIDS': uuid_type(uuids=sa(string=cfdi_uuid)),
args = {
'UUIDS': uuid_type(ns1_uuid(**data_uuid)),
'username': auth['user'],

View File

@ -30,7 +30,6 @@ import requests
import sqlite3
import socket
import subprocess
import sys
import tempfile
import textwrap
import threading
@ -45,6 +44,7 @@ from pathlib import Path
from xml.etree import ElementTree as ET
from xml.dom.minidom import parseString
try:
import uno
from com.sun.star.beans import PropertyValue
@ -52,20 +52,9 @@ try:
from com.sun.star.view.PaperFormat import LETTER
APP_LIBO = True
except ImportError:
path_fun = '/usr/lib/libreoffice/program/fundamentalrc'
path_uno = '/usr/lib/libreoffice/program/'
os.environ['URE_BOOTSTRAP'] = f'vnd.sun.star.pathname:{path_fun}'
os.environ['UNO_PATH'] = path_uno
sys.path.append(path_uno)
try:
import uno
from com.sun.star.beans import PropertyValue
from com.sun.star.awt import Size
from com.sun.star.view.PaperFormat import LETTER
APP_LIBO = True
except ImportError:
APP_LIBO = False
APP_LIBO = False
# ~ import pyqrcode
from dateutil import parser
from lxml import etree
@ -80,6 +69,7 @@ from settings import DEBUG, MV, log, template_lookup, COMPANIES, DB_SAT, \
PATH_XMLSEC, TEMPLATE_CANCEL, DEFAULT_SAT_PRODUCTO, DECIMALES, DIR_FACTURAS
from settings import USAR_TOKEN, API, DECIMALES_TAX
# ~ from .configpac import AUTH
from .utils import get_qr
@ -88,11 +78,9 @@ import segno
from .pacs.cfdi_cert import SATCertificate
from settings import (
CFDI_VERSIONS,
EXT,
MXN,
PATHS,
PRE_DEFAULT,
)
@ -303,8 +291,7 @@ def get_sat_productos(key):
def now():
n = datetime.datetime.now().replace(microsecond=0)
return n
return datetime.datetime.now().replace(microsecond=0)
def today():
@ -649,12 +636,6 @@ class LIBO(object):
self._set_cell('{cfdi.%s}' % k, v)
return
def _informacion_global(self, data):
for k, v in data.items():
print(k, v)
self._set_cell('{cfdi.%s}' % k, v)
return
def _emisor(self, data):
for k, v in data.items():
self._set_cell('{emisor.%s}' % k, v)
@ -752,12 +733,7 @@ class LIBO(object):
if pakings:
col8.append((pakings[i],))
self._total_cantidades += float(cantidad)
if not count:
if not cell_5 is None:
cell_5.CellStyle = self._get_style(cell_5)
if not cell_6 is None:
cell_6.CellStyle = self._get_style(cell_6)
return
style_5 = self._get_style(cell_5)
@ -897,6 +873,8 @@ class LIBO(object):
image = self._template.createInstance('com.sun.star.drawing.GraphicObjectShape')
gp = self._create_instance('com.sun.star.graphic.GraphicProvider')
pd.add(image)
# ~ image.GraphicURL = data['path_cbb']
# ~ properties = self._set_properties({'URL': self._path_url(data['path_cbb'])})
instance = 'com.sun.star.io.SequenceInputStream'
stream = self._create_instance(instance)
@ -905,11 +883,11 @@ class LIBO(object):
image.Graphic = gp.queryGraphic(properties)
s = Size()
s.Width = 4000
s.Height = 4000
s.Width = 4150
s.Height = 4500
image.setSize(s)
image.Anchor = self._set_cell('{timbre.cbb}')
# ~ _kill(data['path_cbb'])
return
def _donataria(self, data):
@ -956,152 +934,6 @@ class LIBO(object):
cell3 = self._set_cell(v=disposicion, cell=cell3)
return
def _carta_porte(self, data):
if not data:
return
# ~ print(data)
qr = data.pop('qr', False)
figuras = data.pop('figuras')
mercancias = data.pop('mercancias')
detalle = mercancias.pop('detalle')
mercancias = mercancias.pop('mercancias')
autotransporte = data.pop('autotransporte')
ubicaciones = data.pop('ubicaciones')
for k, v in data.items():
self._set_cell(f'{{cp.{k}}}', v)
for k, v in figuras.items():
self._set_cell(f'{{cp.{k}}}', v)
for k, v in autotransporte.items():
self._set_cell(f'{{cp.{k}}}', v)
for k, v in mercancias.items():
self._set_cell(f'{{cp.{k}}}', v)
first = True
count = len(ubicaciones) - 1
for i, ubicacion in enumerate(ubicaciones):
tipo = ubicacion['TipoUbicacion']
nombre = ubicacion['NombreRemitenteDestinatario']
rfc = ubicacion['RFCRemitenteDestinatario']
nombre_rfc = f"{nombre} ({rfc})"
fecha = ubicacion['FechaHoraSalidaLlegada']
domicilio = ubicacion['domicilio']
if first:
first = False
cell_1 = self._set_cell('{cp.TipoUbicacion}', tipo)
cell_2 = self._set_cell('{cp.NombreRemitenteDestinatario}', nombre)
cell_3 = self._set_cell('{cp.RFCRemitenteDestinatario}', rfc)
cell_4 = self._set_cell('{cp.FechaHoraSalidaLlegada}', fecha)
cell_5 = self._set_cell('{cp.Domicilio}', domicilio)
row = cell_1.CellAddress.Row + 1
self._sheet.getRows().insertByIndex(row, count)
self._copy_paste_rows(cell_1, count)
else:
cell_1 = self._set_cell(v=tipo, cell=cell_1)
cell_2 = self._set_cell(v=nombre, cell=cell_2)
cell_3 = self._set_cell(v=rfc, cell=cell_3)
cell_4 = self._set_cell(v=fecha, cell=cell_4)
cell_5 = self._set_cell(v=domicilio, cell=cell_5)
first = True
count = len(detalle) - 1
for i, mercancia in enumerate(detalle):
clave = mercancia['BienesTransp']
descripcion = mercancia['Descripcion']
unidad = mercancia['ClaveUnidad']
cantidad = mercancia['Cantidad']
peso = mercancia['PesoEnKg']
if first:
first = False
cell_1 = self._set_cell('{cp.BienesTransp}', clave)
cell_2 = self._set_cell('{cp.Descripcion}', descripcion)
cell_3 = self._set_cell('{cp.ClaveUnidad}', unidad)
cell_4 = self._set_cell('{cp.Cantidad}', cantidad)
cell_5 = self._set_cell('{cp.PesoEnKg}', peso)
if cell_1 is None:
break
if count > 0:
row = cell_1.CellAddress.Row + 1
self._sheet.getRows().insertByIndex(row, count)
self._copy_paste_rows(cell_1, count)
else:
cell_1 = self._set_cell(v=clave, cell=cell_1)
cell_2 = self._set_cell(v=descripcion, cell=cell_2)
cell_3 = self._set_cell(v=unidad, cell=cell_3)
cell_4 = self._set_cell(v=cantidad, cell=cell_4)
cell_5 = self._set_cell(v=peso, cell=cell_5)
if qr:
self._timbre_carta(qr)
return
def _timbre_carta(self, qr):
pd = self._sheet.getDrawPage()
image = self._template.createInstance('com.sun.star.drawing.GraphicObjectShape')
gp = self._create_instance('com.sun.star.graphic.GraphicProvider')
pd.add(image)
instance = 'com.sun.star.io.SequenceInputStream'
stream = self._create_instance(instance)
stream.initialize((uno.ByteSequence(qr.getvalue()),))
properties = self._set_properties({'InputStream': stream})
image.Graphic = gp.queryGraphic(properties)
s = Size()
s.Width = 4000
s.Height = 4000
image.setSize(s)
image.Anchor = self._set_cell('{cp.qr}')
return
def _comercio_exterior(self, data):
if not data:
return
emisor = data.pop('emisor')
receptor = data.pop('receptor')
mercancias = data.pop('mercancias')
for k, v in data.items():
self._set_cell(f'{{cce.{k}}}', v)
for k, v in emisor.items():
self._set_cell(f'{{cce.emisor.{k}}}', v)
for k, v in receptor.items():
self._set_cell(f'{{cce.receptor.{k}}}', v)
first = True
count = len(mercancias) - 1
for i, mercancia in enumerate(mercancias):
no_identificacion = mercancia['NoIdentificacion']
fraccion = mercancia['FraccionArancelaria']
unidad = mercancia['UnidadAduana']
cantidad = mercancia['CantidadAduana']
valor_unitario = mercancia['ValorUnitarioAduana']
valor_dolares = mercancia['ValorDolares']
if first:
first = False
cell_1 = self._set_cell('{cce.mercancia.noidentificacion}', no_identificacion)
cell_2 = self._set_cell('{cce.mercancia.fraccionarancelaria}', fraccion)
cell_3 = self._set_cell('{cce.mercancia.unidadaduana}', unidad)
cell_4 = self._set_cell('{cce.mercancia.cantidadaduana}', cantidad)
cell_5 = self._set_cell('{cce.mercancia.valorunitarioaduana}', valor_unitario)
cell_6 = self._set_cell('{cce.mercancia.valordolares}', valor_dolares)
if count > 0:
row = cell_1.CellAddress.Row + 1
self._sheet.getRows().insertByIndex(row, count)
self._copy_paste_rows(cell_1, count)
else:
cell_1 = self._set_cell(v=no_identificacion, cell=cell_1)
cell_2 = self._set_cell(v=fraccion, cell=cell_2)
cell_3 = self._set_cell(v=unidad, cell=cell_3)
cell_4 = self._set_cell(v=cantidad, cell=cell_4)
cell_5 = self._set_cell(v=valor_unitario, cell=cell_5)
cell_6 = self._set_cell(v=valor_dolares, cell=cell_6)
return
def _nomina(self, data):
if not data:
return
@ -1211,9 +1043,6 @@ class LIBO(object):
return
def _cfdipays(self, data):
VERSION2 = '2.0'
version = data['Version']
related = data.pop('related', [])
for k, v in data.items():
if k.lower() in ('monto',):
@ -1245,8 +1074,7 @@ class LIBO(object):
cell_1 = self._set_cell('{doc.uuid}', uuid)
cell_2 = self._set_cell('{doc.serie}', serie)
cell_3 = self._set_cell('{doc.folio}', folio)
if version != VERSION2:
cell_4 = self._set_cell('{doc.metodopago}', metodo_pago)
cell_4 = self._set_cell('{doc.metodopago}', metodo_pago)
cell_5 = self._set_cell('{doc.moneda}', moneda)
cell_6 = self._set_cell('{doc.parcialidad}', parcialidad)
cell_7 = self._set_cell('{doc.saldoanterior}', saldo_anterior, value=True)
@ -1256,8 +1084,7 @@ class LIBO(object):
col1.append((uuid,))
col2.append((serie,))
col3.append((folio,))
if version != VERSION2:
col4.append((metodo_pago,))
col4.append((metodo_pago,))
col5.append((moneda,))
col6.append((parcialidad,))
col7.append((float(saldo_anterior),))
@ -1283,9 +1110,8 @@ class LIBO(object):
target2 = self._sheet.getCellRangeByPosition(col, row1, col, row2)
col = cell_3.getCellAddress().Column
target3 = self._sheet.getCellRangeByPosition(col, row1, col, row2)
if version != VERSION2:
col = cell_4.getCellAddress().Column
target4 = self._sheet.getCellRangeByPosition(col, row1, col, row2)
col = cell_4.getCellAddress().Column
target4 = self._sheet.getCellRangeByPosition(col, row1, col, row2)
col = cell_5.getCellAddress().Column
target5 = self._sheet.getCellRangeByPosition(col, row1, col, row2)
col = cell_6.getCellAddress().Column
@ -1300,8 +1126,7 @@ class LIBO(object):
target1.setFormulaArray(tuple(col1))
target2.setDataArray(tuple(col2))
target3.setFormulaArray(tuple(col3))
if version != VERSION2:
target4.setDataArray(tuple(col4))
target4.setDataArray(tuple(col4))
target5.setDataArray(tuple(col5))
target6.setDataArray(tuple(col6))
target7.setDataArray(tuple(col7))
@ -1320,7 +1145,6 @@ class LIBO(object):
pakings = data.pop('pakings', [])
self._comprobante(data['comprobante'])
self._informacion_global(data.get('informacion_global', {}))
self._emisor(data['emisor'])
self._receptor(data['receptor'])
self._conceptos(data['conceptos'], pakings)
@ -1332,15 +1156,12 @@ class LIBO(object):
self._nomina(data['nomina'])
else:
self._totales(data['totales'])
self._timbre(data['timbre'])
self._donataria(data['donataria'])
self._ine(data['ine'])
self._divisas(data.get('divisas', {}))
self._leyendas(data.get('leyendas', ''))
self._carta_porte(data.get('carta_porte', {}))
self._comercio_exterior(data.get('comercio_exterior', {}))
self._timbre(data['timbre'])
self._cancelado(data['cancelada'])
self._others_values(data)
@ -1356,6 +1177,7 @@ class LIBO(object):
def pdf(self, path, data, ods=False):
options = {'AsTemplate': True, 'Hidden': True}
log.debug('Abrir plantilla...')
self._template = self._doc_open(path, options)
if self._template is None:
return b''
@ -1390,7 +1212,6 @@ class LIBO(object):
except KeyError:
msg = 'Hoja no existe'
return (), msg
return cursor.getDataArray(), ''
def products(self, path):
@ -1460,7 +1281,6 @@ class LIBO(object):
'codigo_postal',
'notas',
'correo',
'regimen_fiscal',
)
rows = tuple([dict(zip(fields, r)) for r in data[1:]])
msg = 'Empleados importados correctamente'
@ -1651,105 +1471,35 @@ class LIBO(object):
return (), msg
rows = tuple(data[1:])
return rows, ''
def _data_to_dict(self, rows):
data = {k: v for k, v in rows if v}
return data
def _current_region_to_tuple(self, cursor):
data = []
cursor.collapseToCurrentRegion()
rows = cursor.getDataArray()[1:]
if len(rows) == 1:
return data
keys = rows[0]
data = [dict(zip(keys, values)) for values in rows[1:]]
return data
def _get_data_ce(self, doc):
msg = ''
data = {}
try:
sheet = doc.Sheets[0]
rango = sheet['A2:B10']
data = self._data_to_dict(rango.DataArray)
rango = sheet['A13:B23']
data['emisor'] = self._data_to_dict(rango.DataArray)
rango = sheet['A26:B36']
data['receptor'] = self._data_to_dict(rango.DataArray)
rango = sheet['A39:B50']
data['destinatario'] = self._data_to_dict(rango.DataArray)
cursor = sheet.createCursorByRange(sheet['E12'])
data['propietarios'] = self._current_region_to_tuple(cursor)
cursor = sheet.createCursorByRange(sheet['A53'])
data['mercancias'] = self._current_region_to_tuple(cursor)
except Exception as e:
msg = str(e)
return data, msg
def get_ce(self, path):
options = {'AsTemplate': True, 'Hidden': True}
doc = self._doc_open(path, options)
if doc is None:
return (), 'No se pudo abrir la plantilla'
data, msg = self._get_data_ce(doc)
doc.close(True)
if len(data) == 1:
msg = 'Sin datos para importar'
return (), msg
return data, ''
def to_pdf(data, emisor_rfc, ods=False, pdf_from='1'):
rfc = data['emisor']['rfc']
default = 'plantilla_factura.ods'
if DEBUG:
rfc = emisor_rfc
version = data['comprobante']['version']
default = f'plantilla_factura_{version}.ods'
if 'nomina' in data and data['nomina']:
version = '{}_{}'.format(data['nomina']['version'], version)
default = 'plantilla_nomina.ods'
pagos = ''
if data.get('pagos', False):
version = '1.0'
pagos = 'pagos_'
if pdf_from == '2':
return to_pdf_from_json(rfc, version, data)
if 'nomina' in data and data['nomina']:
version_nomina = data['nomina']['version']
default = f'plantilla_nomina_{version}_{version_nomina}.ods'
version = f'{version}_cn_{version_nomina}'
if 'carta_porte' in data:
default = 'plantilla_ccp.ods'
version = '{}_ccp_{}'.format(version, data['carta_porte']['version'])
if data.get('pagos', False):
version_pagos = data['pays']['version']
default = f'plantilla_pagos_{version}_{version_pagos}.ods'
version = f'{version}_cp_{version_pagos}'
if data['donativo']:
version_donatarias = data['donataria']['version']
default = f'plantilla_donatarias_{version}_{version_donatarias}.ods'
version = f'{version}_cd_{version_donatarias}'
if 'comercio_exterior' in data:
version_cce = data['comercio_exterior']['version']
default = f'plantilla_cce_{version}_{version_cce}.ods'
version = f'{version}_cce_{version_cce}'
template_name = f'{rfc.lower()}_{version}.ods'
# ~ print('\nT', template_name, default)
if APP_LIBO:
app = LIBO()
if app.is_running:
path = get_template_ods(template_name, default)
donativo = ''
if data['donativo']:
donativo = '_donativo'
name = '{}_{}{}{}.ods'.format(rfc.lower(), pagos, version, donativo)
path = get_template_ods(name, default)
if path:
return app.pdf(path, data, ods)
@ -1759,7 +1509,6 @@ def to_pdf(data, emisor_rfc, ods=False, pdf_from='1'):
def to_pdf_from_json(rfc, version, data):
rfc = rfc.lower()
name = '{}_{}.json'.format(rfc, version)
print('name', name)
custom_styles = get_custom_styles(name)
path_logo = _join(PATHS['LOGOS'], f"{rfc}.png")
@ -1830,11 +1579,10 @@ def html_to_pdf(data):
def import_employees(rfc):
msg = 'No se pudo cargar el archivo'
name = '{}_employees.ods'.format(rfc.lower())
path = _join(PATH_MEDIA, 'tmp', name)
if not is_file(path):
return (), msg
return ()
msg = 'LibreOffice no se pudo iniciar'
if APP_LIBO:
@ -1879,6 +1627,24 @@ def to_letters(value, currency):
return NumLet(value, currency).letras
# ~ def get_qr(data, p=True):
# ~ qr = pyqrcode.create(data, mode='binary')
# ~ if p:
# ~ path = get_path_temp('.qr')
# ~ qr.png(path, scale=7)
# ~ return path
# ~ buffer = io.BytesIO()
# ~ qr.png(buffer, scale=8)
# ~ return base64.b64encode(buffer.getvalue()).decode()
# ~ def get_qr2(data, kind='svg'):
# ~ buffer = io.BytesIO()
# ~ segno.make(data).save(buffer, kind=kind, scale=8, border=2)
# ~ return buffer
def _get_relacionados(doc, version):
node = doc.find('{}CfdiRelacionados'.format(PRE[version]))
if node is None:
@ -1905,7 +1671,7 @@ def _comprobante(doc, options):
data['tiporelacion'] = options.get('tiporelacion', '')
return data
if data['version'] in CFDI_VERSIONS:
if data['version'] == '3.3':
tipos = {
'I': 'ingreso',
'E': 'egreso',
@ -1990,7 +1756,7 @@ def _receptor(doc, version, values):
return data
data['usocfdi'] = values['usocfdi']
# ~ data.update(values['receptor'])
data.update(values['receptor'])
return data
@ -2008,7 +1774,7 @@ def _conceptos(doc, version, options):
data.append(values)
continue
if version in CFDI_VERSIONS:
if version == '3.3':
if 'noidentificacion' in values:
values['noidentificacion'] = '{}\n(SAT {})'.format(
values['noidentificacion'], values['ClaveProdServ'])
@ -2072,22 +1838,19 @@ def _totales(doc, cfdi, version):
# ~ for n in node.getchildren():
for n in list(node):
tmp = CaseInsensitiveDict(n.attrib.copy())
if version in CFDI_VERSIONS:
tasa = ''
if 'tasaocuota' in tmp:
tasa = round(float(tmp['tasaocuota']), DECIMALES)
if version == '3.3':
tasa = round(float(tmp['tasaocuota']), DECIMALES)
title = 'Traslado {} {}'.format(tn.get(tmp['impuesto']), tasa)
else:
title = 'Traslado {} {}'.format(tmp['impuesto'], tmp['tasa'])
if 'importe' in tmp:
traslados.append((title, float(tmp['importe'])))
traslados.append((title, float(tmp['importe'])))
node = imp.find('{}Retenciones'.format(PRE[version]))
if node is not None:
# ~ for n in node.getchildren():
for n in list(node):
tmp = CaseInsensitiveDict(n.attrib.copy())
if version in CFDI_VERSIONS:
if version == '3.3':
title = 'Retención {} {}'.format(
tn.get(tmp['impuesto']), '')
else:
@ -2119,7 +1882,7 @@ def _totales(doc, cfdi, version):
def _timbre(doc, version, values, pdf_from='1'):
CADENA = '||{version}|{UUID}|{FechaTimbrado}|{selloCFD}|{noCertificadoSAT}||'
if version in CFDI_VERSIONS:
if version == '3.3':
CADENA = '||{Version}|{UUID}|{FechaTimbrado}|{SelloCFD}|{NoCertificadoSAT}||'
node = doc.find('{}Complemento/{}TimbreFiscalDigital'.format(
PRE[version], PRE['TIMBRE']))
@ -2249,54 +2012,19 @@ def _nomina(doc, data, values, version_cfdi):
return info
def _get_info_pays_2(node):
pre_pays = PRE_DEFAULT['PAGOS']['PRE']
data = CaseInsensitiveDict(node.attrib.copy())
path = f"{pre_pays}Totales"
totales = node.find(path)
data.update(CaseInsensitiveDict(totales.attrib.copy()))
path = f"{pre_pays}Pago"
node_pay = node.find(path)
data.update(CaseInsensitiveDict(node_pay.attrib.copy()))
related = []
for n in node_pay:
attr = CaseInsensitiveDict(n.attrib.copy())
if attr:
attr['metododepagodr'] = ''
related.append(attr)
data['related'] = related
return data
def _cfdipays(doc, data, version):
pre_pays = PRE_DEFAULT['PAGOS']['PRE']
path = f"{PRE[version]}Complemento/{pre_pays}Pagos"
node = doc.find(path)
node = doc.find('{}Complemento/{}Pagos'.format(PRE[version], PRE['pagos']))
if node is None:
pre_pays = PRE['PAGOS']['1.0']
path = f"{PRE[version]}Complemento/{pre_pays}Pagos"
node = doc.find(path)
if node is None:
log.error('Node pays not found...')
return {}
if version == '4.0':
info = _get_info_pays_2(node)
else:
info = CaseInsensitiveDict(node.attrib.copy())
related = []
for n1 in node:
info.update(CaseInsensitiveDict(n1.attrib.copy()))
for n2 in n1:
related.append(CaseInsensitiveDict(n2.attrib.copy()))
info = CaseInsensitiveDict(node.attrib.copy())
related = []
for n1 in node:
info.update(CaseInsensitiveDict(n1.attrib.copy()))
for n2 in n1:
related.append(CaseInsensitiveDict(n2.attrib.copy()))
info['related'] = related
info['related'] = related
data['comprobante']['totalenletras'] = to_letters(
float(info['monto']), info['monedap'])
@ -2309,7 +2037,6 @@ def get_data_from_xml(invoice, values, pdf_from='1'):
data = {'cancelada': invoice.cancelada, 'donativo': False}
if hasattr(invoice, 'donativo'):
data['donativo'] = invoice.donativo
doc = parse_xml(invoice.xml)
data['comprobante'] = _comprobante(doc, values)
version = data['comprobante']['version']
@ -2416,37 +2143,11 @@ class UpFile(object):
return
def save_template(rfc, opt, file_obj):
result = {'status': 'error', 'ok': False}
name_template = f'{rfc}{opt}'
path_template = _join(PATH_MEDIA, 'templates', name_template)
if save_file(path_template, file_obj.file.read()):
result = {'status': 'server', 'name': file_obj.filename, 'ok': True}
return result
def upload_file(rfc, opt, file_obj):
rfc = rfc.lower()
tmp = file_obj.filename.split('.')
ext = tmp[-1].lower()
versions = ('_3.2.ods',
'_3.3.ods', '_3.3_cd_1.1.ods', '_3.3_cp_1.0.ods', '_3.3_cn_1.2.ods', '_3.3_ccp_2.0.ods', '_3.3.json',
'_4.0.ods',
'_4.0_cn_1.2.ods',
'_4.0_cp_2.0.ods',
'_4.0_ccp_2.0.ods',
'_4.0_ccp_3.0.ods',
'_4.0_cd_1.1.ods',
'_4.0_cce_2.0.ods',
'_4.0.json',
)
if opt in versions:
return save_template(rfc, opt, file_obj)
EXTENSIONS = {
'txt_plantilla_factura_32': EXT['ODS'],
'txt_plantilla_factura_33': EXT['ODS'],
@ -2563,15 +2264,6 @@ def upload_file(rfc, opt, file_obj):
name = '{}_nomina.ods'.format(rfc.lower())
path = _join(PATH_MEDIA, 'tmp', name)
elif opt == 'ceods':
tmp = file_obj.filename.split('.')
ext = tmp[-1].lower()
if ext != 'ods':
msg = 'Extensión de archivo incorrecta, selecciona un archivo ODS'
return {'status': 'server', 'name': msg, 'ok': False}
name = '{}_ce.ods'.format(rfc.lower())
path = _join(PATH_MEDIA, 'tmp', name)
if save_file(path, file_obj.file.read()):
return {'status': 'server', 'name': file_obj.filename, 'ok': True}
@ -3049,20 +2741,6 @@ def import_invoice(rfc):
return (), 'No se encontro LibreOffice'
def import_ceods(rfc):
name = '{}_ce.ods'.format(rfc.lower())
path = _join(PATH_MEDIA, 'tmp', name)
if not is_file(path):
return (), 'No se encontró la plantilla'
if APP_LIBO:
app = LIBO()
if app.is_running:
return app.get_ce(path)
return (), 'No se encontro LibreOffice'
def calc_to_date(value):
return datetime.date.fromordinal(int(value) + 693594)
@ -3162,8 +2840,4 @@ def parse_xml2(xml_str):
return etree.fromstring(xml_str.encode('utf-8'))
def get_idccp():
uuid4 = str(uuid.uuid4()).upper()
custom_uuid_str = f'CCC{uuid4[3:]}'
return custom_uuid_str

View File

@ -30,7 +30,6 @@ import shlex
import shutil
import smtplib
import sqlite3
import ssl
import subprocess
import threading
import unicodedata
@ -55,7 +54,7 @@ from dateutil import parser
from .cfdi_xml import CFDI
from settings import DEBUG, DB_COMPANIES, PATHS, TEMPLATE_CANCEL, RFCS, PRE
from settings import DEBUG, DB_COMPANIES, PATHS, TEMPLATE_CANCEL, RFCS
from .pacs.cfdi_cert import SATCertificate
from .pacs import PACComercioDigital
@ -88,7 +87,6 @@ PACS = {
'finkok': PACFinkok,
'comercio': PACComercioDigital,
}
NS_CFDI = {
'cfdi': 'http://www.sat.gob.mx/cfd/3',
'tdf': 'http://www.sat.gob.mx/TimbreFiscalDigital',
@ -182,8 +180,10 @@ class SendMail(object):
return self._error
def _login(self):
hosts = ('gmail' in self._config['server'] or
'outlook' in self._config['server'])
try:
if self._config['ssl'] and self._config['starttls']:
if self._config['ssl'] and hosts:
self._server = smtplib.SMTP(
self._config['server'],
self._config['port'], timeout=TIMEOUT)
@ -256,135 +256,13 @@ class SendMail(object):
class CfdiToDict(object):
NS_VERSION = {
'cfdi3.3': 'http://www.sat.gob.mx/cfd/3',
'cfdi4.0': 'http://www.sat.gob.mx/cfd/4',
}
NS = {
'tfd': 'http://www.sat.gob.mx/TimbreFiscalDigital',
'cfdi': 'http://www.sat.gob.mx/cfd/3',
'divisas': 'http://www.sat.gob.mx/divisas',
'leyendasFisc': 'http://www.sat.gob.mx/leyendasFiscales',
'cartaporte20': 'http://www.sat.gob.mx/CartaPorte20',
'cartaporte30': 'http://www.sat.gob.mx/CartaPorte30',
'nomina12': 'http://www.sat.gob.mx/nomina12',
'cce20': 'http://www.sat.gob.mx/ComercioExterior20',
}
tipo_figura = {
'01': '[01] Operador',
'02': '[02] Propietario',
'03': '[03] Arrendador',
'04': '[04] Notificado',
}
REGIMEN_FISCAL = {
'601': '[601] General de Ley Personas Morales',
'603': '[603] Personas Morales con Fines no Lucrativos',
'605': '[605] Sueldos y Salarios e Ingresos Asimilados a Salarios',
'606': '[606] Arrendamiento',
'607': '[607] Régimen de Enajenación o Adquisición de Bienes',
'608': '[608] Demás ingresos',
'610': '[610] Residentes en el Extranjero sin Establecimiento Permanente en México',
'611': '[611] Ingresos por Dividendos (socios y accionistas)',
'612': '[612] Personas Físicas con Actividades Empresariales y Profesionales',
'614': '[614] Ingresos por intereses',
'615': '[615] Régimen de los ingresos por obtención de premios',
'616': '[616] Sin obligaciones fiscales',
'620': '[620] Sociedades Cooperativas de Producción que optan por diferir sus ingresos',
'621': '[621] Incorporación Fiscal',
'622': '[622] Actividades Agrícolas, Ganaderas, Silvícolas y Pesqueras',
'623': '[623] Opcional para Grupos de Sociedades',
'624': '[624] Coordinados',
'625': '[625] Régimen de las Actividades Empresariales con ingresos a través de Plataformas Tecnológicas',
'626': '[626] Régimen Simplificado de Confianza',
}
USO_CFDI = {
'G01': '[G01] Adquisición de mercancías.',
'G02': '[G02] Devoluciones, descuentos o bonificaciones.',
'G03': '[G03] Gastos en general.',
'I01': '[I01] Construcciones.',
'I02': '[I02] Mobiliario y equipo de oficina por inversiones.',
'I03': '[I03] Equipo de transporte.',
'I04': '[I04] Equipo de computo y accesorios.',
'I05': '[I05] Dados, troqueles, moldes, matrices y herramental.',
'I06': '[I06] Comunicaciones telefónicas.',
'I07': '[I07] Comunicaciones satelitales.',
'I08': '[I08] Otra maquinaria y equipo.',
'D01': '[D01] Honorarios médicos, dentales y gastos hospitalarios.',
'D02': '[D02] Gastos médicos por incapacidad o discapacidad.',
'D03': '[D03] Gastos funerales.',
'D04': '[D04] Donativos.',
'D05': '[D05] Intereses reales efectivamente pagados por créditos hipotecarios (casa habitación).',
'D06': '[D06] Aportaciones voluntarias al SAR.',
'D07': '[D07] Primas por seguros de gastos médicos.',
'D08': '[D08] Gastos de transportación escolar obligatoria.',
'D09': '[D09] Depósitos en cuentas para el ahorro, primas que tengan como base planes de pensiones.',
'D10': '[D10] Pagos por servicios educativos (colegiaturas).',
'S01': '[S01] Sin efectos fiscales.',
'CP01': '[CP01] Pagos',
'CN01': '[CN01] Nómina',
'P01': '[P01] Por definir',
}
PAISES = {
'MEX': 'México',
}
ESTADOS = {
'AGU': 'Aguascalientes',
'BCN': 'Baja California',
'BCS': 'Baja California Sur',
'CAM': 'Campeche',
'CHP': 'Chiapas',
'CHH': 'Chihuahua',
'COA': 'Coahuila',
'COL': 'Colima',
'DIF': 'Ciudad de México',
'DUR': 'Durango',
'GUA': 'Guanajuato',
'GRO': 'Guerrero',
'HID': 'Hidalgo',
'JAL': 'Jalisco',
'MEX': 'México',
'MIC': 'Michoacán',
'MOR': 'Morelos',
'NAC': 'Nacional',
'NAY': 'Nayarit',
'NLE': 'Nuevo León',
'OAX': 'Oaxaca',
'PUE': 'Puebla',
'QUE': 'Querétaro',
'ROO': 'Quintana Roo',
'SLP': 'San Luis Potosí',
'SIN': 'Sinaloa',
'SON': 'Sonora',
'TAB': 'Tabasco',
'TAM': 'Tamaulipas',
'TLA': 'Tlaxcala',
'VER': 'Veracruz',
'YUC': 'Yucatán',
'ZAC': 'Zacatecas',
}
PERIODICIDAD = {
'01': '[01] Diario',
'02': '[02] Semanal',
'03': '[03] Quincenal',
'04': '[04] Mensual',
'05': '[05] Bimestral',
}
MESES = {
'01': '[01] Enero',
'02': '[02] Febrero',
'03': '[03] Marzo',
'04': '[04] Abril',
'05': '[05] Mayo',
'06': '[06] Junio',
'07': '[07] Julio',
'08': '[08] Agosto',
'09': '[09] Septiembre',
'10': '[10] Octubre',
'11': '[11] Noviembre',
'12': '[12] Diciembre',
}
def __init__(self, xml):
self.version = ''
self._values = {
'leyendas': (),
}
@ -396,73 +274,13 @@ class CfdiToDict(object):
return self._values
def _get_values(self):
self.version = self._root.attrib['Version']
ns = f'cfdi{self.version}'
self.NS['cfdi'] = self.NS_VERSION[ns]
self._timbre_fiscal()
self._informacion_global()
self._receptor()
self._complementos()
return
def _timbre_fiscal(self):
path = '//tfd:TimbreFiscalDigital'
data = self._root.xpath(path, namespaces=self.NS)
if not data:
return
data = data[0]
attr = CaseInsensitiveDict(data.attrib)
self._fecha_timbrado = attr['FechaTimbrado']
return
def _informacion_global(self):
self._values['informacion_global'] = {}
path = '//cfdi:InformacionGlobal'
data = self._root.xpath(path, namespaces=self.NS)
if not data:
return
data = data[0]
attr = CaseInsensitiveDict(data.attrib)
value = f"Periodicidad Factura Global: {self.PERIODICIDAD[attr['Periodicidad']]} "
value += f"del mes {self.MESES[attr['Meses']]} "
value += f"del año {attr['Año']}"
self._values['informacion_global'] = {'informacion_global': value}
return
def _receptor(self):
path = '//cfdi:Receptor'
receptor = self._root.xpath(path, namespaces=self.NS)[0]
attr = CaseInsensitiveDict(receptor.attrib)
attr['usocfdi'] = self.USO_CFDI[attr['UsoCFDI']]
if self.version == '4.0':
attr['domiciliofiscal'] = attr['DomicilioFiscalReceptor']
attr['regimenfiscal'] = self.REGIMEN_FISCAL[attr['RegimenFiscalReceptor']]
self._values['receptor'] = attr
return
def _set_carta_porte_domicilio(self, data):
municipio = data['Municipio']
estado = self.ESTADOS[data['Estado']]
pais = self.PAISES[data['Pais']]
domicilio = f"{municipio}, {estado}, {pais}, C.P. {data['CodigoPostal']}"
return domicilio
def _complementos(self):
path = '//cfdi:Complemento'
complemento = self._root.xpath(path, namespaces=self.NS)[0]
path = '//nomina12:Nomina'
nomina = complemento.xpath(path, namespaces=self.NS)
if nomina:
for node in nomina[0]:
if 'Receptor' in node.tag:
attr = CaseInsensitiveDict(node.attrib)
self._values['receptor'].update(attr)
path = '//divisas:Divisas'
divisas = complemento.xpath(path, namespaces=self.NS)
if divisas:
@ -475,147 +293,6 @@ class CfdiToDict(object):
if node:
leyendas = [CaseInsensitiveDict(n.attrib) for n in node]
self._values['leyendas'] = leyendas
path = '//cartaporte20:CartaPorte'
carta_porte = complemento.xpath(path, namespaces=self.NS)
if carta_porte:
values = CaseInsensitiveDict(carta_porte[0].attrib)
for node in carta_porte[0]:
if 'FiguraTransporte' in node.tag:
figuras = CaseInsensitiveDict(node[0].attrib)
figuras['TipoFigura'] = self.tipo_figura[figuras['TipoFigura']]
values['figuras'] = figuras
elif 'Mercancias' in node.tag:
mercancias = CaseInsensitiveDict(node.attrib)
detalle = [CaseInsensitiveDict(n.attrib)
for n in node if 'Mercancia' in n.tag]
values['mercancias'] = {
'mercancias': mercancias,
'detalle': detalle,
}
path = '//cartaporte20:Autotransporte'
node_auto = node.xpath(path, namespaces=self.NS)[0]
values_auto = CaseInsensitiveDict(node_auto.attrib)
values['autotransporte'] = values_auto
path = '//cartaporte20:IdentificacionVehicular'
node_tmp = node_auto.xpath(path, namespaces=self.NS)[0]
values_auto = CaseInsensitiveDict(node_tmp.attrib)
values['autotransporte'].update(values_auto)
path = '//cartaporte20:Seguros'
node_tmp = node_auto.xpath(path, namespaces=self.NS)[0]
values_auto = CaseInsensitiveDict(node_tmp.attrib)
values['autotransporte'].update(values_auto)
path = '//cartaporte20:Remolques'
try:
node_tmp = node_auto.xpath(path, namespaces=self.NS)[0][0]
values_auto = CaseInsensitiveDict(node_tmp.attrib)
values['autotransporte'].update(values_auto)
except IndexError:
pass
elif 'Ubicaciones' in node.tag:
ubicaciones = []
for n in node:
ubicacion = CaseInsensitiveDict(n.attrib)
ubicacion['domicilio'] = self._set_carta_porte_domicilio(
CaseInsensitiveDict(n[0].attrib))
ubicaciones.append(ubicacion)
values['ubicaciones'] = ubicaciones
self._values['carta_porte'] = values
self._complemento_carta_porte(complemento)
self._complemento_comercio_exterior(complemento)
return
def _complemento_carta_porte(self, complemento):
path = '//cartaporte30:CartaPorte'
carta_porte = complemento.xpath(path, namespaces=self.NS)
if carta_porte:
self._get_carta_porte_3(carta_porte)
return
def _get_carta_porte_3(self, carta_porte):
URL = 'https://verificacfdi.facturaelectronica.sat.gob.mx/verificaccp/default.aspx'
PRE = '//cartaporte30'
values = CaseInsensitiveDict(carta_porte[0].attrib)
idccp = values['idccp']
for node in carta_porte[0]:
if 'FiguraTransporte' in node.tag:
figuras = CaseInsensitiveDict(node[0].attrib)
figuras['TipoFigura'] = self.tipo_figura[figuras['TipoFigura']]
values['figuras'] = figuras
elif 'Mercancias' in node.tag:
mercancias = CaseInsensitiveDict(node.attrib)
detalle = [CaseInsensitiveDict(n.attrib)
for n in node if 'Mercancia' in n.tag]
values['mercancias'] = {
'mercancias': mercancias,
'detalle': detalle,
}
path = f'{PRE}:Autotransporte'
node_auto = node.xpath(path, namespaces=self.NS)[0]
values_auto = CaseInsensitiveDict(node_auto.attrib)
values['autotransporte'] = values_auto
path = f'{PRE}:IdentificacionVehicular'
node_tmp = node_auto.xpath(path, namespaces=self.NS)[0]
values_auto = CaseInsensitiveDict(node_tmp.attrib)
values['autotransporte'].update(values_auto)
path = f'{PRE}:Seguros'
node_tmp = node_auto.xpath(path, namespaces=self.NS)[0]
values_auto = CaseInsensitiveDict(node_tmp.attrib)
values['autotransporte'].update(values_auto)
path = f'{PRE}:Remolques'
try:
node_tmp = node_auto.xpath(path, namespaces=self.NS)[0][0]
values_auto = CaseInsensitiveDict(node_tmp.attrib)
values['autotransporte'].update(values_auto)
except IndexError:
pass
elif 'Ubicaciones' in node.tag:
ubicaciones = []
for n in node:
ubicacion = CaseInsensitiveDict(n.attrib)
if ubicacion['TipoUbicacion'] == 'Origen':
fecha_origen = ubicacion['FechaHoraSalidaLlegada']
ubicacion['domicilio'] = self._set_carta_porte_domicilio(
CaseInsensitiveDict(n[0].attrib))
ubicaciones.append(ubicacion)
values['FechaOrigen'] = fecha_origen
values['ubicaciones'] = ubicaciones
qr_data = f'{URL}?IdCCP={idccp}&FechaOrig={fecha_origen}&FechaTimb={self._fecha_timbrado}'
values['qr'] = get_qr(qr_data, 'png')
self._values['carta_porte'] = values
return
def _complemento_comercio_exterior(self, complemento):
path = '//cce20:ComercioExterior'
comercio_exterior = complemento.xpath(path, namespaces=self.NS)
if comercio_exterior:
values = CaseInsensitiveDict(comercio_exterior[0].attrib)
for node in comercio_exterior[0]:
if 'Emisor' in node.tag:
values['emisor'] = CaseInsensitiveDict(node.attrib)
values['emisor'].update(CaseInsensitiveDict(node[0].attrib))
elif 'Receptor' in node.tag:
values['receptor'] = CaseInsensitiveDict(node.attrib)
values['receptor'].update(CaseInsensitiveDict(node[0].attrib))
elif 'Mercancias' in node.tag:
mercancias = [
CaseInsensitiveDict(m.attrib) for m in node]
values['mercancias'] = mercancias
self._values['comercio_exterior'] = values
return
@ -875,8 +552,7 @@ def db_backup_local():
def now():
n = datetime.datetime.now().replace(microsecond=0)
return n
return datetime.datetime.now().replace(microsecond=0)
def get_days(date):
@ -945,13 +621,14 @@ def xml_cancel(xml, auth, cert, name):
def get_client_balance(auth, rfc=''):
if not auth:
return 'p/c'
if DEBUG:
return '-d'
pac = PACS[auth['pac']]()
balance = pac.client_balance(auth, rfc)
if pac.error:
balance = 'p/e'
return balance
@ -964,6 +641,9 @@ def get_cert(args):
def make_xml(data, certificado):
cert = SATCertificate(certificado.cer, certificado.key_enc.encode())
if DEBUG:
data['emisor']['Rfc'] = certificado.rfc
data['emisor']['RegimenFiscal'] = '603'
cfdi = CFDI()
xml = ET.parse(BytesIO(cfdi.get_xml(data).encode()))
@ -980,28 +660,15 @@ def make_xml(data, certificado):
def get_pac_by_rfc(cfdi):
tree = ET.fromstring(cfdi.encode())
version = tree.attrib['Version']
namespaces = {'cfdi': PRE[version][1:-1], 'tdf': PRE['TIMBRE'][1:-1]}
path = 'string(//cfdi:Complemento/tdf:TimbreFiscalDigital/@RfcProvCertif)'
rfc_pac = tree.xpath(path, namespaces=namespaces)
rfc_pac = tree.xpath(path, namespaces=NS_CFDI)
return RFCS[rfc_pac]
def _cancel_with_cert(invoice, args, auth, certificado):
cert = SATCertificate(certificado.cer, certificado.key_enc.encode())
pac = PACS[auth['pac']]()
contra = ''
try:
contra = decrypt(bytes(certificado.p12).decode(), certificado.serie)
except Exception as e:
log.error(e)
if auth['pac'] == 'comercio':
msg = 'Es necesario subir de nuevo los certificados de sello'
data = {'ok': False, 'msg': msg, 'row': {}}
return data
info = {'cer': cert.cer_pem, 'key': cert.key_pem, 'cer_ori': cert.cer,
'key_enc': certificado.key, 'pass': contra, 'args': args}
info = {'cer': cert.cer_pem, 'key': cert.key_pem, 'args': args}
result = pac.cancel(invoice.xml, info, auth)
if pac.error:
@ -1015,26 +682,20 @@ def _cancel_with_cert(invoice, args, auth, certificado):
def cancel_xml_sign(invoice, args, auth, certificado):
# ~ if auth['pac'] == 'finkok':
# ~ if DEBUG:
return _cancel_with_cert(invoice, args, auth, certificado)
cert = SATCertificate(certificado.cer, certificado.key_enc.encode())
pac = PACS[auth['pac']]()
folio_new = ''
if args['uuid']:
folio_new = f' FolioSustitucion="{args["uuid"]}"'
data = {
'rfc': certificado.rfc,
'fecha': now().isoformat()[:19],
'uuid': str(invoice.uuid).upper(),
'motivo': args['reason'],
'folio': folio_new,
}
template = TEMPLATE_CANCEL.format(**data)
tree = ET.fromstring(template.encode())
sign_xml = cert.sign_xml(tree)
# ~ print(sign_xml)
result = pac.cancel_xml(sign_xml, auth, invoice.xml)
if pac.error:
@ -1049,20 +710,17 @@ def cancel_xml_sign(invoice, args, auth, certificado):
def _get_data_sat(xml):
BF = 'string(//*[local-name()="{}"]/@{})'
# ~ NS_CFDI = {'cfdi': 'http://www.sat.gob.mx/cfd/3'}
NS_CFDI = {'cfdi': 'http://www.sat.gob.mx/cfd/3'}
try:
tree = ET.fromstring(xml.encode())
version = tree.attrib['Version']
namespaces = {'cfdi': PRE[version][1:-1]}
emisor = escape(
tree.xpath('string(//cfdi:Emisor/@rfc)', namespaces=namespaces) or
tree.xpath('string(//cfdi:Emisor/@Rfc)', namespaces=namespaces)
tree.xpath('string(//cfdi:Emisor/@rfc)', namespaces=NS_CFDI) or
tree.xpath('string(//cfdi:Emisor/@Rfc)', namespaces=NS_CFDI)
)
receptor = escape(
tree.xpath('string(//cfdi:Receptor/@rfc)', namespaces=namespaces) or
tree.xpath('string(//cfdi:Receptor/@Rfc)', namespaces=namespaces)
tree.xpath('string(//cfdi:Receptor/@rfc)', namespaces=NS_CFDI) or
tree.xpath('string(//cfdi:Receptor/@Rfc)', namespaces=NS_CFDI)
)
total = tree.get('total') or tree.get('Total')
uuid = tree.xpath(BF.format('TimbreFiscalDigital', 'UUID'))
@ -1187,7 +845,6 @@ def _save_template(rfc, name, file_obj):
rfc = rfc.lower()
path = _join(PATHS['USER'], f'{rfc}{name}')
if save_file(path, file_obj.file.read()):
result['ok'] = True
@ -1208,18 +865,3 @@ def get_qr(data, kind='svg', in_base64=False):
if in_base64:
qr = base64.b64encode(qr.getvalue()).decode()
return qr
def to_date(value):
t = now().time()
d = datetime.datetime.strptime(value.split(' ')[0], '%Y-%m-%d')
dt = datetime.datetime.combine(d, t)
return dt
def adjust_time(date_invoice, hours):
new_date = date_invoice
if hours:
time_change = datetime.timedelta(hours=hours)
new_date = date_invoice + time_change
return new_date

View File

@ -25,8 +25,6 @@ from controllers.main import (AppEmpresas,
AppWareHouse,
AppWareHouseProduct,
AppSATUnidadesPeso,
AppSATRegimenes,
AppSociosRegimenes,
)
@ -80,8 +78,6 @@ api.add_route('/warehouseproduct', AppWareHouseProduct(db))
api.add_route('/ticketsdetails', AppTicketsDetails(db))
api.add_route('/users', AppUsers(db))
api.add_route('/satunidadespeso', AppSATUnidadesPeso(db))
api.add_route('/satregimenes', AppSATRegimenes(db))
api.add_route('/sociosregimenes', AppSociosRegimenes(db))
session_options = {

View File

@ -70,9 +70,6 @@ class StorageEngine(object):
def _get_importinvoice(self, values):
return main.import_invoice()
def _get_importceods(self, values):
return main.import_ceods()
def _get_main(self, values, session):
return main.config_main(session['userobj'])
@ -164,9 +161,6 @@ class StorageEngine(object):
def _get_unidades(self, values):
return main.SATUnidades.get_activos()
def _get_unitbykey(self, values):
return main.SATUnidades.get_activos_by_key()
def add_moneda(self, values):
return main.SATMonedas.add(values)
@ -203,10 +197,6 @@ class StorageEngine(object):
def _get_allusoscfdi(self, values):
return main.SATUsoCfdi.get_all()
def _get_allregimenes(self, values):
filters = {'opt': 'all'}
return main.SATRegimenes.get_data(filters, None)
def _get_allusuarios(self, values, session):
return main.Usuarios.get_(session['userobj'])
@ -234,9 +224,6 @@ class StorageEngine(object):
def _get_usocfdiupdate(self, values):
return main.SATUsoCfdi.actualizar(values)
def _get_regimenesupdate(self, values):
return main.SATRegimenes.actualizar(values)
def _get_emisorcuentasbanco(self, values):
return main.CuentasBanco.emisor()
@ -536,12 +523,6 @@ class StorageEngine(object):
def sat_unidades_peso_post(self, args, user):
return main.SATUnidadesPeso.post(args, user)
def sat_regimenes_get(self, filters, user):
return main.SATRegimenes.get_data(filters, user)
def socios_regimenes_get(self, filters, user):
return main.SociosRegimenes.get_data(filters, user)
# Companies only in MV
def _get_empresas(self, values):
return main.companies_get()

File diff suppressed because it is too large Load Diff

View File

@ -1,7 +1,7 @@
#!/usr/bin/env python3
# ~ Empresa Libre
# ~ Copyright (C) 2016-2018 Mauricio Baeza Servin (publico@cuates.net)
# ~ Copyright (C) 2016-2018 Mauricio Baeza Servin (web@correolibre.net)
# ~
# ~ This program is free software: you can redistribute it and/or modify
# ~ it under the terms of the GNU General Public License as published by
@ -28,9 +28,12 @@ from conf import DEBUG, MV, LOG_PATH
try:
from conf import DEFAULT_PASSWORD
except ImportError:
DEFAULT_PASSWORD = 'salgueiro4.0'
DEFAULT_PASSWORD = 'salgueiro3.3'
TITLE_APP = 'Empresa Libre'
try:
from conf import TITLE_APP
except ImportError:
TITLE_APP = 'Empresa Libre'
try:
from conf import NO_HTTPS
@ -39,8 +42,7 @@ except ImportError:
DEBUG = DEBUG
VERSION = '2.3.2'
VERSION = '1.44.0'
EMAIL_SUPPORT = ('soporte@empresalibre.mx',)
TITLE_APP = '{} v{}'.format(TITLE_APP, VERSION)
@ -125,29 +127,12 @@ if 'win' in sys.platform:
PATH_XMLSEC = os.path.join(PATH_BIN, 'xmlsec.exe')
PRE_DEFAULT = {
'CFDI': {'VERSION': '4.0', 'PRE': '{http://www.sat.gob.mx/cfd/4}'},
'NOMINA': {'VERSION': '1.2', 'PRE': '{http://www.sat.gob.mx/nomina12}'},
'PAGOS': {'VERSION': '2.0', 'PRE': '{http://www.sat.gob.mx/Pagos20}'},
'TIBRE': {'VERSION': '1.1', 'PRE': '{http://www.sat.gob.mx/TimbreFiscalDigital}'},
}
pre2 ='{http://www.sat.gob.mx/cfd/2}'
pre3 ='{http://www.sat.gob.mx/cfd/3}'
PRE_HISTORY = {
'CFDI': {'2.0': pre2, '2.2': pre2,
'3.0': pre3, '3.2': pre3, '3.3': pre3},
'NOMINA': {'1.1': '{http://www.sat.gob.mx/nomina}'},
'PAGOS': {'1.0': '{http://www.sat.gob.mx/Pagos}'},
}
PRE = {
'2.0': '{http://www.sat.gob.mx/cfd/2}',
'2.2': '{http://www.sat.gob.mx/cfd/2}',
'3.0': '{http://www.sat.gob.mx/cfd/3}',
'3.2': '{http://www.sat.gob.mx/cfd/3}',
'3.3': '{http://www.sat.gob.mx/cfd/3}',
'4.0': '{http://www.sat.gob.mx/cfd/4}',
'TIMBRE': '{http://www.sat.gob.mx/TimbreFiscalDigital}',
'DONATARIA': '{http://www.sat.gob.mx/donat}',
'INE': '{http://www.sat.gob.mx/ine}',
@ -156,15 +141,11 @@ PRE = {
'1.1': '{http://www.sat.gob.mx/nomina}',
'1.2': '{http://www.sat.gob.mx/nomina12}',
},
'PAGOS': {
'1.0': '{http://www.sat.gob.mx/Pagos}',
}
'pagos': '{http://www.sat.gob.mx/Pagos}',
}
# To delete
# ~ CURRENT_CFDI = '4.0'
# ~ CURRENT_CFDI_NOMINA = '1.2'
CURRENT_CFDI = '3.3'
CURRENT_CFDI_NOMINA = '1.2'
DECIMALES = 2
DECIMALES_TAX = 4
DECIMALES_PRECIOS = 4
@ -187,8 +168,7 @@ DEFAULT_CFDIPAY = {
'TYPE': 'P',
'WAYPAY': 'PPD',
'CURRENCY': 'XXX',
'TC': '1',
'USED': 'CP01',
'USED': 'P01',
'KEYSAT': '84111506',
'UNITKEY': 'ACT',
'DESCRIPTION': 'Pago',
@ -201,7 +181,7 @@ PUBLIC = 'Público en general'
DEFAULT_SAT_NOMINA = {
'SERIE': 'N',
'FORMA_PAGO': '99',
'USO_CFDI': 'CN01',
'USO_CFDI': 'P01',
'CLAVE': '84111505',
'UNIDAD': 'ACT',
'DESCRIPCION': 'Pago de nómina',
@ -213,7 +193,6 @@ CURRENCY_MN = 'MXN'
# ~ v2
CANCEL_VERSION = ('3.3', '4.0')
CFDI_VERSIONS = CANCEL_VERSION
IS_MV = MV
DB_COMPANIES = os.path.abspath(os.path.join(BASE_DIR, '..', 'db', 'rfc.db'))
@ -257,8 +236,6 @@ VALUES_PDF = {
},
}
RESICO = '626'
RFCS = {
'PUBLIC': 'XAXX010101000',
'FOREIGN': 'XEXX010101000',
@ -279,41 +256,37 @@ DEFAULT_GLOBAL = {
'clave_sat': '01010101',
}
# ~ TEMPLATE_CANCEL = """<CancelaCFD xmlns="http://cancelacfd.sat.gob.mx">
# ~ <Cancelacion xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" RfcEmisor="{rfc}" Fecha="{fecha}">
# ~ <Folios>
# ~ <Folio UUID="{uuid}" Motivo="{motivo}"{folio}/>
# ~ </Folios>
# ~ <Signature xmlns="http://www.w3.org/2000/09/xmldsig#">
# ~ <SignedInfo>
# ~ <CanonicalizationMethod Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315" />
# ~ <SignatureMethod Algorithm="http://www.w3.org/2000/09/xmldsig#rsa-sha1" />
# ~ <Reference URI="">
# ~ <Transforms>
# ~ <Transform Algorithm="http://www.w3.org/2000/09/xmldsig#enveloped-signature" />
# ~ </Transforms>
# ~ <DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1" />
# ~ <DigestValue/>
# ~ </Reference>
# ~ </SignedInfo>
# ~ <SignatureValue/>
# ~ <KeyInfo>
# ~ <X509Data>
# ~ <X509IssuerSerial>
# ~ <X509IssuerName/>
# ~ <X509SerialNumber/>
# ~ </X509IssuerSerial>
# ~ <X509Certificate/>
# ~ </X509Data>
# ~ <KeyValue>
# ~ <RSAKeyValue>
# ~ <Modulus/>
# ~ <Exponent/>
# ~ </RSAKeyValue>
# ~ </KeyValue>
# ~ </KeyInfo>
# ~ </Signature>
# ~ </Cancelacion>
# ~ </CancelaCFD>"""
TEMPLATE_CANCEL = """<CancelaCFD xmlns="http://cancelacfd.sat.gob.mx"><Cancelacion xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" Fecha="{fecha}" RfcEmisor="{rfc}" xmlns="http://cancelacfd.sat.gob.mx"><Folios><Folio UUID="{uuid}" Motivo="{motivo}"{folio}/></Folios><Signature xmlns="http://www.w3.org/2000/09/xmldsig#"><SignedInfo><CanonicalizationMethod Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315" /><SignatureMethod Algorithm="http://www.w3.org/2000/09/xmldsig#rsa-sha1" /><Reference URI=""><Transforms><Transform Algorithm="http://www.w3.org/2000/09/xmldsig#enveloped-signature" /></Transforms><DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1" /><DigestValue/></Reference></SignedInfo><SignatureValue/><KeyInfo><X509Data><X509IssuerSerial><X509IssuerName/><X509SerialNumber/></X509IssuerSerial><X509Certificate/></X509Data><KeyValue><RSAKeyValue><Modulus/><Exponent/></RSAKeyValue></KeyValue></KeyInfo></Signature></Cancelacion></CancelaCFD>"""
TEMPLATE_CANCEL = """<Cancelacion xmlns="http://cancelacfd.sat.gob.mx" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" RfcEmisor="{rfc}" Fecha="{fecha}">
<Folios>
<UUID>{uuid}</UUID>
</Folios>
<Signature xmlns="http://www.w3.org/2000/09/xmldsig#">
<SignedInfo>
<CanonicalizationMethod Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315" />
<SignatureMethod Algorithm="http://www.w3.org/2000/09/xmldsig#rsa-sha1" />
<Reference URI="">
<Transforms>
<Transform Algorithm="http://www.w3.org/2000/09/xmldsig#enveloped-signature" />
</Transforms>
<DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1" />
<DigestValue/>
</Reference>
</SignedInfo>
<SignatureValue/>
<KeyInfo>
<X509Data>
<X509IssuerSerial>
<X509IssuerName/>
<X509SerialNumber/>
</X509IssuerSerial>
<X509Certificate/>
</X509Data>
<KeyValue>
<RSAKeyValue>
<Modulus/>
<Exponent/>
</RSAKeyValue>
</KeyValue>
</KeyInfo>
</Signature>
</Cancelacion>"""

Binary file not shown.

View File

@ -104,7 +104,7 @@
{"key": "611", "name": "Ingresos por Dividendos (socios y accionistas)", "fisica": true, "activo": false},
{"key": "612", "name": "Personas Físicas con Actividades Empresariales y Profesionales", "fisica": true, "activo": true, "default": true},
{"key": "614", "name": "Ingresos por intereses", "fisica": true, "activo": true},
{"key": "616", "name": "Sin obligaciones fiscales", "fisica": true, "activo": true},
{"key": "616", "name": "Sin obligaciones fiscales", "fisica": true, "activo": false},
{"key": "620", "name": "Sociedades Cooperativas de Producción que optan por diferir sus ingresos", "moral": true, "activo": false},
{"key": "621", "name": "Incorporación Fiscal", "fisica": true, "activo": true},
{"key": "622", "name": "Actividades Agrícolas, Ganaderas, Silvícolas y Pesqueras", "fisica": true, "moral": true, "activo": false},
@ -682,10 +682,7 @@
{"key": "D08", "name": "Gastos de transportación escolar obligatoria.", "activo": false},
{"key": "D09", "name": "Depósitos en cuentas para el ahorro, primas que tengan como base planes de pensiones.", "activo": false},
{"key": "D10", "name": "Pagos por servicios educativos (colegiaturas)", "activo": true},
{"key": "P01", "name": "Por definir", "moral": true, "activo": false},
{"key": "S01", "name": "Sin efectos fiscales.", "moral": true, "activo": true},
{"key": "CP01", "name": "Pagos", "moral": true, "activo": true},
{"key": "CN01", "name": "Nómina", "moral": true, "activo": true}
{"key": "P01", "name": "Por definir", "moral": true, "activo": true}
]
},
{
@ -731,7 +728,7 @@
"pais": "MEX"
},
{
"key": "CMX",
"key": "DIF",
"name": "Ciudad de M\u00e9xico",
"pais": "MEX"
},

Binary file not shown.

Before

Width:  |  Height:  |  Size: 380 B

After

Width:  |  Height:  |  Size: 754 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB

View File

@ -60,7 +60,6 @@ var controllers = {
$$('grid_admin_unidades').attachEvent('onCheck', grid_admin_unidades_on_check)
$$('grid_admin_formasdepago').attachEvent('onCheck', grid_admin_formasdepago_on_check)
$$('grid_admin_usos_cfdi').attachEvent('onCheck', grid_admin_usos_cfdi_on_check)
$$('grid_admin_regimenes_fiscales').attachEvent('onCheck', grid_admin_regimenes_fiscales_on_check)
$$('grid_unidad_found').attachEvent('onValueSuggest', grid_unidad_found_click)
$$('grid_admin_unidades').attachEvent('onItemClick', grid_admin_unidades_click)
$$('grid_moneda_found').attachEvent('onValueSuggest', grid_moneda_found_click)
@ -77,13 +76,15 @@ var controllers = {
//~ Opciones
tb_options = $$('tab_options').getTabbar()
tb_options.attachEvent('onChange', tab_options_change)
$$('txt_plantilla_factura_32').attachEvent('onItemClick', txt_plantilla_factura_32_click)
$$('txt_plantilla_factura_33').attachEvent('onItemClick', txt_plantilla_factura_33_click)
$$('txt_plantilla_factura_html').attachEvent('onItemClick', txt_plantilla_factura_html_click)
//~ $$('txt_plantilla_factura_json').attachEvent('onItemClick', txt_plantilla_factura_json_click)
$$('txt_plantilla_factura_json').attachEvent('onItemClick', txt_plantilla_factura_json_click)
$$('txt_plantilla_factura_css').attachEvent('onItemClick', txt_plantilla_factura_css_click)
$$('txt_plantilla_ticket').attachEvent('onItemClick', txt_plantilla_ticket_click)
//~ $$('txt_plantilla_donataria').attachEvent('onItemClick', txt_plantilla_donataria_click)
//~ $$('txt_plantilla_nomina1233').attachEvent('onItemClick', txt_plantilla_nomina1233_click)
//~ $$('txt_plantilla_pagos10').attachEvent('onItemClick', txt_plantilla_pagos10_click)
$$('txt_plantilla_donataria').attachEvent('onItemClick', txt_plantilla_donataria_click)
$$('txt_plantilla_nomina1233').attachEvent('onItemClick', txt_plantilla_nomina1233_click)
$$('txt_plantilla_pagos10').attachEvent('onItemClick', txt_plantilla_pagos10_click)
$$('make_pdf_from').attachEvent('onChange', opt_make_pdf_from_on_change)
$$('cmd_template_upload').attachEvent('onItemClick', cmd_template_upload_click)
@ -114,7 +115,6 @@ var controllers = {
$$('chk_config_ine').attachEvent('onItemClick', chk_config_item_click)
$$('chk_config_edu').attachEvent('onItemClick', chk_config_item_click)
$$('chk_config_carta_porte').attachEvent('onItemClick', chk_config_item_click)
$$('chk_config_comercio_exterior').attachEvent('onItemClick', chk_config_item_click)
$$('chk_config_leyendas_fiscales').attachEvent('onItemClick', chk_config_item_click)
$$('cmd_admin_leyendas_fiscales').attachEvent('onItemClick', cmd_admin_leyendas_fiscales_click)
@ -134,9 +134,7 @@ var controllers = {
$$('chk_config_user_show_doc').attachEvent('onItemClick', chk_config_item_click)
$$('chk_config_invoice_by_ticket').attachEvent('onItemClick', chk_config_item_click)
$$('chk_config_show_total_cant').attachEvent('onItemClick', chk_config_item_click)
$$('chk_config_show_filter_by_day').attachEvent('onItemClick', chk_config_item_click)
$$('chk_cancel_invoices_by_admin').attachEvent('onItemClick', chk_config_item_click)
$$('chk_config_change_date_invoice').attachEvent('onItemClick', chk_config_item_click)
$$('chk_config_anticipo').attachEvent('onItemClick', chk_config_item_click)
@ -211,9 +209,7 @@ function cmd_save_emisor_click(){
msg = 'Longitud inválida del C.P. de Expedición'
msg_error(msg)
return
}
if(values.emisor_cp2){
}else if(values.emisor_cp2){
webix.ajax().sync().get('/values/cp', {cp: values.emisor_cp2}, {
error: function(text, data, xhr) {
msg = 'Error al consultar el C.P. de Expedición'
@ -222,12 +218,17 @@ function cmd_save_emisor_click(){
success: function(text, data, xhr) {
var values = data.json();
if (values.estado == undefined){
msg = 'No se encontró el C.P. de Expedición, asegurate de que sea correcto'
msg = 'No se encontró el C.P., asegurate de que sea correcto'
msg_error(msg)
}else{
valid_cp = true
}
}
})
}
if(!valid_cp){
return
}
if(values.es_ong){
if(!values.ong_autorizacion){
@ -443,15 +444,6 @@ function get_admin_usos_cfdi(){
}
function get_admin_regimenes_fiscales(){
webix.ajax().sync().get('/values/allregimenes', function(text, data){
var values = data.json()
$$('grid_admin_regimenes_fiscales').clearAll()
$$('grid_admin_regimenes_fiscales').parse(values, 'json')
})
}
function get_admin_usuarios(){
webix.ajax().sync().get('/values/allusuarios', function(text, data){
var rows = data.json()
@ -510,9 +502,7 @@ function set_config_templates(){
success: function(text, data, xhr) {
var values = data.json()
Object.keys(values).forEach(function(key){
if(key!='txt_plantilla_donataria'){
show(key, values[key])
}
show(key, values[key])
})
}
})
@ -953,42 +943,42 @@ function emisor_logo_click(id, e){
}
//~ function txt_plantilla_factura_33_click(e){
function txt_plantilla_factura_33_click(e){
//~ var body_elements = [
//~ {cols: [{width: 100}, {view: 'uploader', id: 'up_template', autosend: true, link: 'lst_files',
//~ value: 'Seleccionar archivo', upload: '/files/txt_plantilla_factura_33',
//~ width: 200}, {width: 100}]},
//~ {view: 'list', id: 'lst_files', type: 'uploader', autoheight:true,
//~ borderless: true},
//~ {},
//~ {cols: [{}, {view: 'button', label: 'Cerrar', autowidth: true,
//~ click:("$$('win_template').close();")}, {}]}
//~ ]
var body_elements = [
{cols: [{width: 100}, {view: 'uploader', id: 'up_template', autosend: true, link: 'lst_files',
value: 'Seleccionar archivo', upload: '/files/txt_plantilla_factura_33',
width: 200}, {width: 100}]},
{view: 'list', id: 'lst_files', type: 'uploader', autoheight:true,
borderless: true},
{},
{cols: [{}, {view: 'button', label: 'Cerrar', autowidth: true,
click:("$$('win_template').close();")}, {}]}
]
//~ var w = webix.ui({
//~ view: 'window',
//~ id: 'win_template',
//~ modal: true,
//~ position: 'center',
//~ head: 'Subir Plantilla 3.3 ODT',
//~ body: {
//~ view: 'form',
//~ elements: body_elements,
//~ }
//~ })
var w = webix.ui({
view: 'window',
id: 'win_template',
modal: true,
position: 'center',
head: 'Subir Plantilla 3.3 ODT',
body: {
view: 'form',
elements: body_elements,
}
})
//~ w.show()
w.show()
//~ $$('up_template').attachEvent('onUploadComplete', function(response){
//~ if(response.ok){
//~ $$('txt_plantilla_factura_33').setValue(response.name)
//~ msg_ok('Plantilla cargada correctamente')
//~ }else{
//~ msg_error(response.name)
//~ }
//~ })
//~ }
$$('up_template').attachEvent('onUploadComplete', function(response){
if(response.ok){
$$('txt_plantilla_factura_33').setValue(response.name)
msg_ok('Plantilla cargada correctamente')
}else{
msg_error(response.name)
}
})
}
function txt_plantilla_ticket_click(e){
@ -1029,42 +1019,42 @@ function txt_plantilla_ticket_click(e){
}
//~ function txt_plantilla_factura_32_click(e){
function txt_plantilla_factura_32_click(e){
//~ var body_elements = [
//~ {cols: [{width: 100}, {view: 'uploader', id: 'up_template', autosend: true, link: 'lst_files',
//~ value: 'Seleccionar archivo', upload: '/files/txt_plantilla_factura_32',
//~ width: 200}, {width: 100}]},
//~ {view: 'list', id: 'lst_files', type: 'uploader', autoheight:true,
//~ borderless: true},
//~ {},
//~ {cols: [{}, {view: 'button', label: 'Cerrar', autowidth: true,
//~ click:("$$('win_template').close();")}, {}]}
//~ ]
var body_elements = [
{cols: [{width: 100}, {view: 'uploader', id: 'up_template', autosend: true, link: 'lst_files',
value: 'Seleccionar archivo', upload: '/files/txt_plantilla_factura_32',
width: 200}, {width: 100}]},
{view: 'list', id: 'lst_files', type: 'uploader', autoheight:true,
borderless: true},
{},
{cols: [{}, {view: 'button', label: 'Cerrar', autowidth: true,
click:("$$('win_template').close();")}, {}]}
]
//~ var w = webix.ui({
//~ view: 'window',
//~ id: 'win_template',
//~ modal: true,
//~ position: 'center',
//~ head: 'Subir Plantilla 3.2 ODT',
//~ body: {
//~ view: 'form',
//~ elements: body_elements,
//~ }
//~ })
var w = webix.ui({
view: 'window',
id: 'win_template',
modal: true,
position: 'center',
head: 'Subir Plantilla 3.2 ODT',
body: {
view: 'form',
elements: body_elements,
}
})
//~ w.show()
w.show()
//~ $$('up_template').attachEvent('onUploadComplete', function(response){
//~ if(response.ok){
//~ $$('txt_plantilla_factura_32').setValue(response.name)
//~ msg_ok('Plantilla cargada correctamente')
//~ }else{
//~ msg_error(response.name)
//~ }
//~ })
//~ }
$$('up_template').attachEvent('onUploadComplete', function(response){
if(response.ok){
$$('txt_plantilla_factura_32').setValue(response.name)
msg_ok('Plantilla cargada correctamente')
}else{
msg_error(response.name)
}
})
}
function txt_plantilla_factura_html_click(e){
@ -1149,83 +1139,83 @@ function txt_plantilla_factura_css_click(e){
}
//~ function txt_plantilla_factura_json_click(e){
function txt_plantilla_factura_json_click(e){
//~ var body_elements = [
//~ {cols: [
//~ {width: 100},
//~ {view: 'uploader', id: 'up_template', autosend: true,
//~ link: 'lst_files', value: 'Seleccionar archivo',
//~ upload: '/files/txt_plantilla_factura_json', width: 200},
//~ {width: 100}]},
//~ {view: 'list', id: 'lst_files', type: 'uploader', autoheight: true,
//~ borderless: true},
//~ {},
//~ {cols: [{}, {view: 'button', label: 'Cerrar', autowidth: true,
//~ click:("$$('win_template').close();")}, {}]}
//~ ]
var body_elements = [
{cols: [
{width: 100},
{view: 'uploader', id: 'up_template', autosend: true,
link: 'lst_files', value: 'Seleccionar archivo',
upload: '/files/txt_plantilla_factura_json', width: 200},
{width: 100}]},
{view: 'list', id: 'lst_files', type: 'uploader', autoheight: true,
borderless: true},
{},
{cols: [{}, {view: 'button', label: 'Cerrar', autowidth: true,
click:("$$('win_template').close();")}, {}]}
]
//~ var w = webix.ui({
//~ view: 'window',
//~ id: 'win_template',
//~ modal: true,
//~ position: 'center',
//~ head: 'Subir Plantilla 3.3 JSON',
//~ body: {
//~ view: 'form',
//~ elements: body_elements,
//~ }
//~ })
var w = webix.ui({
view: 'window',
id: 'win_template',
modal: true,
position: 'center',
head: 'Subir Plantilla 3.3 JSON',
body: {
view: 'form',
elements: body_elements,
}
})
//~ w.show()
w.show()
//~ $$('up_template').attachEvent('onUploadComplete', function(response){
//~ if(response.ok){
//~ $$('txt_plantilla_factura_json').setValue(response.name)
//~ msg_ok('Plantilla cargada correctamente')
//~ }else{
//~ msg_error(response.name)
//~ }
//~ })
//~ }
$$('up_template').attachEvent('onUploadComplete', function(response){
if(response.ok){
$$('txt_plantilla_factura_json').setValue(response.name)
msg_ok('Plantilla cargada correctamente')
}else{
msg_error(response.name)
}
})
}
//~ function txt_plantilla_donataria_click(e){
function txt_plantilla_donataria_click(e){
//~ var body_elements = [
//~ {cols: [{width: 100}, {view: 'uploader', id: 'up_template', autosend: true, link: 'lst_files',
//~ value: 'Seleccionar archivo', upload: '/files/txt_plantilla_donataria',
//~ width: 200}, {width: 100}]},
//~ {view: 'list', id: 'lst_files', type: 'uploader', autoheight:true,
//~ borderless: true},
//~ {},
//~ {cols: [{}, {view: 'button', label: 'Cerrar', autowidth: true,
//~ click:("$$('win_template').close();")}, {}]}
//~ ]
var body_elements = [
{cols: [{width: 100}, {view: 'uploader', id: 'up_template', autosend: true, link: 'lst_files',
value: 'Seleccionar archivo', upload: '/files/txt_plantilla_donataria',
width: 200}, {width: 100}]},
{view: 'list', id: 'lst_files', type: 'uploader', autoheight:true,
borderless: true},
{},
{cols: [{}, {view: 'button', label: 'Cerrar', autowidth: true,
click:("$$('win_template').close();")}, {}]}
]
//~ var w = webix.ui({
//~ view: 'window',
//~ id: 'win_template',
//~ modal: true,
//~ position: 'center',
//~ head: 'Subir Plantilla Donataria',
//~ body: {
//~ view: 'form',
//~ elements: body_elements,
//~ }
//~ })
var w = webix.ui({
view: 'window',
id: 'win_template',
modal: true,
position: 'center',
head: 'Subir Plantilla Donataria',
body: {
view: 'form',
elements: body_elements,
}
})
//~ w.show()
w.show()
//~ $$('up_template').attachEvent('onUploadComplete', function(response){
//~ if(response.ok){
//~ $$('txt_plantilla_donataria').setValue(response.name)
//~ msg_ok('Plantilla cargada correctamente')
//~ }else{
//~ msg_error(response.name)
//~ }
//~ })
//~ }
$$('up_template').attachEvent('onUploadComplete', function(response){
if(response.ok){
$$('txt_plantilla_donataria').setValue(response.name)
msg_ok('Plantilla cargada correctamente')
}else{
msg_error(response.name)
}
})
}
function txt_plantilla_nomina1233_click(e){
@ -1266,6 +1256,44 @@ function txt_plantilla_nomina1233_click(e){
}
function txt_plantilla_pagos10_click(e){
var body_elements = [
{cols: [{width: 100}, {view: 'uploader', id: 'up_template',
autosend: true, link: 'lst_files', value: 'Seleccionar archivo',
upload: '/files/txt_plantilla_pagos10', width: 200}, {width: 100}]},
{view: 'list', id: 'lst_files', type: 'uploader', autoheight:true,
borderless: true},
{},
{cols: [{}, {view: 'button', label: 'Cerrar', autowidth: true,
click:("$$('win_template').close();")}, {}]}
]
var w = webix.ui({
view: 'window',
id: 'win_template',
modal: true,
position: 'center',
head: 'Subir Plantilla Factura de Pago',
body: {
view: 'form',
elements: body_elements,
}
})
w.show()
$$('up_template').attachEvent('onUploadComplete', function(response){
if(response.ok){
$$('txt_plantilla_pagos10').setValue(response.name)
msg_ok('Plantilla cargada correctamente')
}else{
msg_error(response.name)
}
})
}
function tab_options_change(nv, ov){
var cv = {
tab_admin_templates: 'templates',
@ -1290,8 +1318,6 @@ function tab_sat_change(nv, ov){
get_admin_formasdepago()
}else if(nv == 'Usos de CFDI'){
get_admin_usos_cfdi()
}else if(nv == 'Regimenes Fiscales'){
get_admin_regimenes_fiscales()
}
}
@ -1391,21 +1417,6 @@ function grid_admin_usos_cfdi_on_check(row, column, state){
}
function grid_admin_regimenes_fiscales_on_check(row, column, state){
var values = {
id: row,
field: column,
value: state,
}
webix.ajax().get('/values/regimenesupdate', values, {
error: function(text, data, xhr) {
},
success: function(text, data, xhr) {
}
})
}
function emisor_cuenta_saldo_inicial_change(new_value, old_value){
if(!isFinite(new_value)){
this.config.value = old_value

View File

@ -81,7 +81,6 @@ var bancos_controllers = {
$$('grid_bank_invoice_pay').attachEvent('onItemClick', grid_bank_invoice_pay_click)
$$('grid_cuentabanco').attachEvent('onItemDblClick', grid_cuentabanco_double_click)
$$('cmd_invoice_pay_sat').attachEvent('onItemClick', cmd_invoice_pay_sat_click)
$$('cmd_invoice_pay_cancel').attachEvent('onItemClick', cmd_invoice_pay_cancel_click)
init_config_bank()
}
@ -579,13 +578,13 @@ function validate_deposito(values){
return false
}
//~ if(grid.count() && current_currency!=CURRENCY_MN){
//~ if(type_change <= 1.0){
//~ msg = 'El Tipo de Cambio debe ser mayor a 1.00'
//~ msg_error(msg)
//~ return false
//~ }
//~ }
if(grid.count() && current_currency!=CURRENCY_MN){
if(type_change <= 1.0){
msg = 'El Tipo de Cambio debe ser mayor a 1.00'
msg_error(msg)
return false
}
}
var today = new Date()
if(values.deposito_fecha > today){
@ -954,7 +953,6 @@ function cmd_complemento_pago_click(){
}
set_data_pay(row)
$$('chk_pay_close_when_stamp').setValue(false)
$$('multi_bancos').setValue('bank_pay')
}
@ -995,8 +993,6 @@ function send_stamp_cfdi_pay(id_mov){
var g = $$('grid_cfdi_pay')
var data = {'opt': 'stamp', 'id_mov': id_mov}
var close = $$('chk_pay_close_when_stamp').getValue()
//~ ToDo Actualizar cantidad de facturas de pago en el movimiento
webix.ajax().sync().post('cfdipay', data, {
@ -1014,11 +1010,6 @@ function send_stamp_cfdi_pay(id_mov){
}
}
})
if(close){
$$('multi_bancos').setValue('banco_home')
}
}
function save_cfdi_pay(form){
@ -1072,61 +1063,6 @@ function cmd_pay_stamp_click(){
}
function cmd_win_cancel_pay_close_click(){
$$('win_invoice_cancel_pay').close()
}
function send_invoice_cancel_pay(reason='', uuid=''){
var grid = $$('grid_cfdi_pay')
var form = $$('form_bank_pay')
var values = form.getValues()
var data = {
'opt': 'cancel',
'id_mov': values.id_mov,
args: {
reason: reason,
uuid: uuid,
}
}
webix.ajax().post('cfdipay', data, function(text, data){
var values = data.json()
if(values.ok){
msg_ok(values.msg)
grid.updateItem(values.id, {'estatus': 'Cancelada'})
}else{
msg_error('No fue posible cancelar')
webix.alert({
title: 'Error al Cancelar',
text: values.msg,
type: 'alert-error'
})
}
})
}
function cmd_invoice_cancel_pay_click(){
var reason = $$('lst_reasons_cancel').getValue()
var uuid = $$('txt_cancel_uuid').getValue()
if(!reason){
msg = 'Selecciona un motivo para esta cancelación'
msg_error(msg)
return
}
if(reason=='01' & !uuid){
msg = 'Debes de capturar el UUID que reemplaza a este CFDI'
msg_error(msg)
return
}
send_invoice_cancel_pay(reason, uuid)
$$('win_invoice_cancel_pay').close()
}
function cmd_pay_cancel_click(){
var form = $$('form_bank_pay')
var values = form.getValues()
@ -1138,8 +1074,34 @@ function cmd_pay_cancel_click(){
return
}
win_invoice_cancel_pay.init()
$$('win_invoice_cancel_pay').show()
msg = '¿Estás seguro de cancelar esta factura?\n\nESTA ACCIÓN NO SE PUEDE DESHACER'
webix.confirm({
title: 'Cancelar Factura',
ok: 'Si',
cancel: 'No',
type: 'confirm-error',
text: msg,
callback:function(result){
if(result){
webix.ajax().post('/cfdipay', data, {
error:function(text, data, XmlHttpRequest){
msg = 'Ocurrio un error, consulta a soporte técnico'
msg_error(msg)
},
success:function(text, data, XmlHttpRequest){
values = data.json();
if(values.ok){
grid.updateItem(values.id, {'estatus': 'Cancelada'})
msg_ok(values.msg)
}else{
msg_error(values.msg)
}
}
})
}
}
})
}
@ -1427,83 +1389,3 @@ function cmd_invoice_pay_sat_click(){
})
}
function cmd_invoice_pay_cancel_click(){
var g = $$('grid_bank_invoice_pay')
if(g.count() == 0){
return
}
var row = g.getSelectedItem()
if (row == undefined){
msg_error('Selecciona una factura de pago')
return
}
if (row instanceof Array){
msg_error('Selecciona solo una factura de pago')
return
}
if(!row.uuid){
msg_error('La factura de pago no esta timbrada')
return
}
win_invoice_cancel_pay2.init()
$$('win_invoice_cancel_pay2').show()
}
function cmd_invoice_cancel_pay2_click(){
var reason = $$('lst_reasons_cancel2').getValue()
var uuid = $$('txt_cancel_uuid2').getValue()
if(!reason){
msg = 'Selecciona un motivo para esta cancelación'
msg_error(msg)
return
}
if(reason=='01' & !uuid){
msg = 'Debes de capturar el UUID que reemplaza a este CFDI'
msg_error(msg)
return
}
send_invoice_cancel_pay2(reason, uuid)
$$('win_invoice_cancel_pay2').close()
}
function cmd_win_cancel_pay_close2_click(){
$$('win_invoice_cancel_pay2').close()
}
function send_invoice_cancel_pay2(reason='', uuid=''){
var grid = $$('grid_bank_invoice_pay')
var row = grid.getSelectedItem()
var data = {
'opt': 'cancel2',
args: {
id: row.id,
reason: reason,
uuid: uuid,
}
}
webix.ajax().post('cfdipay', data, function(text, data){
var values = data.json()
if(values.ok){
msg_ok(values.msg)
grid.updateItem(row.id, {'estatus': 'Cancelada'})
}else{
msg_error('No fue posible cancelar')
webix.alert({
title: 'Error al Cancelar',
text: values.msg,
type: 'alert-error'
})
}
})
}

File diff suppressed because it is too large Load Diff

View File

@ -40,7 +40,6 @@ function configuracion_inicial(){
add_config({'key': 'used_cfdi_pays', 'value': values.pagos})
add_config({'key': 'multi_currency', 'value': values.multi_currency})
add_config({'key': 'pays_data_bank', 'value': values.pays_data_bank})
add_config({'key': 'show_filter_by_day', 'value': values.show_filter_by_day})
})
@ -116,19 +115,16 @@ function menu_user_click(id, e, node){
function current_dates(){
var fy = $$('filter_year')
var fm = $$('filter_month')
var fd = $$('filter_day')
var pfy = $$('prefilter_year')
var pfm = $$('prefilter_month')
var d = new Date()
fy.blockEvent()
fm.blockEvent()
fd.blockEvent()
pfy.blockEvent()
pfm.blockEvent()
fm.setValue(d.getMonth() + 1)
fd.setValue(d.getDate())
pfm.setValue(d.getMonth() + 1)
webix.ajax().sync().get('/values/filteryears', function(text, data){
var values = data.json()
@ -140,7 +136,6 @@ function current_dates(){
fy.unblockEvent()
fm.unblockEvent()
fd.unblockEvent()
pfy.unblockEvent()
pfm.unblockEvent()
}

View File

@ -255,10 +255,10 @@ function up_employees_upload_complete(response){
function delete_empleado(id){
webix.ajax().del('/employees', {id: id}, function(text, xml, xhr){
var msg = 'Empleado eliminado correctamente'
if(xhr.status == 200){
if (xhr.status == 200){
$$('grid_employees').remove(id);
msg_ok(msg)
}else{
} else {
msg = 'El Empleado tiene recibos timbrados'
msg_error(msg)
}
@ -485,43 +485,29 @@ function cmd_nomina_cancel_click(){
return
}
win_invoice_cancel_nomina.init()
$$('win_invoice_cancel_nomina').show()
msg = '¿Estás seguro de cancelar el recibo?<BR><BR>'
msg += row['empleado'] + ' (' + row['serie'] + '-' + row['folio'] + ')'
msg += '<BR><BR>ESTA ACCIÓN NO SE PUEDE DESHACER<BR><BR>'
webix.confirm({
title: 'Cancelar Nomina',
ok: 'Si',
cancel: 'No',
type: 'confirm-error',
text: msg,
callback:function(result){
if (result){
cancel_nomina(row['id'])
}
}
})
}
function cmd_win_cancel_nomina_close_click(){
$$('win_invoice_cancel_nomina').close()
}
function cmd_invoice_cancel_nomina_click(){
var reason = $$('lst_reasons_cancel').getValue()
var uuid = $$('txt_cancel_uuid').getValue()
if(!reason){
msg = 'Selecciona un motivo para esta cancelación'
msg_error(msg)
return
}
if(reason=='01' & !uuid){
msg = 'Debes de capturar el UUID que reemplaza a este CFDI'
msg_error(msg)
return
}
$$('win_invoice_cancel_nomina').close()
send_cancel_nomina(reason, uuid)
}
function send_cancel_nomina(reason, uuid){
function cancel_nomina(id){
var grid = $$('grid_nomina')
var row = grid.getSelectedItem()
var data = new Object()
data['opt'] = 'cancel'
data['id'] = row.id
data['args'] = {reason: reason, uuid: uuid}
data['id'] = id
webix.ajax().sync().post('nomina', data, {
error:function(text, data, XmlHttpRequest){
@ -531,7 +517,7 @@ function send_cancel_nomina(reason, uuid){
success:function(text, data, XmlHttpRequest){
values = data.json();
if(values.ok){
grid.updateItem(row.id, values.row)
grid.updateItem(id, values.row)
msg_ok(values.msg)
}else{
msg_error(values.msg)
@ -623,5 +609,3 @@ function cmd_nomina_sat_click(){
})
}

View File

@ -95,7 +95,6 @@ function cmd_new_partner_click(id, e, node){
$$('partner_balance').define('readonly', !cfg_partners['chk_config_change_balance_partner'])
get_partner_banks()
get_partner_accounts_bank(0)
get_sat_regimenes()
}
@ -124,7 +123,6 @@ function cmd_edit_partner_click(){
},
success: function(text, data, xhr){
var values = data.json()
$$('form_partner').clearValidation()
$$('form_partner').setValues(values)
$$('forma_pago').getList().load('/values/formapago')
@ -134,10 +132,8 @@ function cmd_edit_partner_click(){
if(values.tipo_persona == 1){
query = table_usocfdi.chain().find({fisica: true}).data()
get_sat_regimenes()
}else if(values.tipo_persona == 2){
query = table_usocfdi.chain().find({moral: true}).data()
get_sat_regimenes(true)
}else{
query = [{id: 'P01', value: 'Por definir'}]
}
@ -149,15 +145,12 @@ function cmd_edit_partner_click(){
$$('cuenta_proveedor').enable()
}
get_partner_accounts_bank(row['id'])
pause(250)
$$('lst_receptor_regimenes_fiscales').select(values.regimenes)
}
})
$$('multi_partners').setValue('partners_new')
$$('tab_partner').setValue('Datos Fiscales')
get_partner_banks()
}
@ -246,17 +239,7 @@ function cmd_save_partner_click(id, e, node){
}
}
var ids_regimenes = $$('lst_receptor_regimenes_fiscales').getSelectedId()
if(values.tipo_persona < 3){
if(!ids_regimenes){
msg = 'Selecciona al menos un Regimen Fiscal'
msg_error(msg)
return
}
}
values['accounts'] = $$('grid_partner_account_bank').data.getRange()
values['regimenes'] = ids_regimenes
webix.ajax().post('/partners', values, {
error:function(text, data, XmlHttpRequest){
@ -360,28 +343,18 @@ function opt_tipo_change(new_value, old_value){
$$('id_fiscal').define('value', '')
show('id_fiscal', new_value == 4)
$$('lst_receptor_regimenes_fiscales').clearAll()
var regimen_616 = {id: 11, value: '[616] Sin obligaciones fiscales'}
if (new_value == 1 || new_value == 2){
$$("rfc").define("value", "")
$$("rfc").define("readonly", false)
moral = false
if(new_value == 2){
moral = true
}
get_sat_regimenes(moral)
} else if (new_value == 3) {
$$("rfc").define("value", RFC_PUBLICO)
$$("nombre").define("value", PUBLICO)
$$("rfc").define("readonly", true)
$$('lst_receptor_regimenes_fiscales').parse(regimen_616)
} else if (new_value == 4) {
$$("rfc").define("value", RFC_EXTRANJERO)
$$("rfc").define("readonly", true)
$$("pais").define("readonly", false)
$$("pais").define("value", "")
$$('lst_receptor_regimenes_fiscales').parse(regimen_616)
}
$$("nombre").refresh();
@ -399,12 +372,10 @@ function opt_tipo_change(new_value, old_value){
}else if (new_value == 2){
query = table_usocfdi.chain().find({moral: true}).data()
}else{
query = [{id: 'S01', value: '[S01] Sin efectos fiscales. '}]
query = [{id: 'P01', value: 'Por definir'}]
}
$$('lst_uso_cfdi_socio').getList().parse(query)
$$('lst_uso_cfdi_socio').refresh()
}
@ -648,21 +619,3 @@ function partner_delete_account_bank(row){
}
})
}
function get_sat_regimenes(morales=false){
var data = {opt: 'actives', morales: morales}
webix.ajax().sync().get('/satregimenes', data, {
error: function(text, data, xhr) {
msg = 'Error al consultar'
msg_error(msg)
},
success: function(text, data, xhr) {
var values = data.json()
$$('lst_receptor_regimenes_fiscales').clearAll()
$$('lst_receptor_regimenes_fiscales').parse(values)
}
})
}

View File

@ -19,7 +19,7 @@ function products_default_config(){
if(cfg_products['inventario']){
$$('grid_products').showColumn('existencia')
}
//~ show('cant_by_packing', values.chk_use_packing)
show('cant_by_packing', values.chk_use_packing)
show('cmd_show_exists', values.chk_multi_stock)
}
})
@ -123,7 +123,6 @@ function cmd_edit_product_click(){
get_taxes()
$$('unidad').getList().load('/values/unidades')
configurar_producto()
var grid = $$('grid_products')
var row = grid.getSelectedItem()
if(row == undefined){
@ -132,10 +131,9 @@ function cmd_edit_product_click(){
}
$$('categoria').getList().load('/values/categorias')
webix.ajax().get('/products', {id: row['id']}, {
webix.ajax().get('/products', {id:row['id']}, {
error: function(text, data, xhr) {
msg_error(text)
msg_error()
},
success: function(text, data, xhr){
var values = data.json()
@ -232,9 +230,18 @@ function cmd_save_product_click(id, e, node){
}
var rows = $$('grid_product_taxes').getSelectedId(true, true)
//~ if (rows.length == 0){
//~ msg_error('Selecciona un impuesto')
//~ return
//~ }
var values = form.getValues();
if(!isFinite(values.cant_by_packing)){
msg_error('La cantidad por empaque debe ser un número')
return
}
if(!validate_sat_key_product(values.clave_sat, false)){
msg_error('La clave SAT no existe')
return
@ -245,19 +252,7 @@ function cmd_save_product_click(id, e, node){
return
}
if(values['objeto_impuesto']=='01' && rows.length > 0){
msg = 'Si Objeto de Impuestos = 01, no debes seleccionar ningún impuesto'
msg_error(msg)
return
}
if(values['objeto_impuesto']=='02' && rows.length == 0){
msg = 'Si Objeto de Impuestos = 02, debes de seleccionar al menos un impuesto'
msg_error(msg)
return
}
values['taxes'] = JSON.stringify(rows)
webix.ajax().sync().post('products', values, {
error:function(text, data, XmlHttpRequest){
msg = 'Ocurrio un error, consulta a soporte técnico'

View File

@ -149,9 +149,7 @@ function configuracion_inicial_ticket_to_invoice(){
var grid = $$('grid_tickets_active')
var gridt = $$('grid_tickets_invoice')
var form = $$('form_ticket_invoice')
var chk = $$('chk_is_invoice_day')
chk.setValue(false)
get_active_tickets(grid)
form.setValues({id_partner: 0, lbl_tclient: 'Ninguno'})
gridt.attachEvent('onAfterAdd', function(id, index){
@ -613,18 +611,12 @@ function cmd_cancelar_ticket_click(){
function chk_is_invoice_day_change(new_value, old_value){
var value = Boolean(new_value)
show('fs_ticket_search_client', !value)
enable('lst_global_periodicidad_2', value)
enable('lst_global_months_2', value)
var current_date = new Date()
var current_month = (current_date.getMonth() + 1).toString().padStart(2, '0')
$$('lst_global_months_2').setValue(current_month)
}
function send_timbrar_invoice(id){
//~ webix.ajax().get('/values/timbrar', {id: id, update: false}, function(text, data){
webix.ajax().post('invoices', {opt: 'timbrar', id: id, update: false}, function(text, data){
var values = data.json()
if(values.ok){
@ -652,7 +644,6 @@ function save_ticket_to_invoice(data){
if(values.ok){
msg_ok(values.msg)
send_timbrar_invoice(values.id)
$$('chk_is_invoice_day').setValue(false)
$$('multi_tickets').setValue('tickets_home')
}else{
msg_error(values.msg)
@ -689,26 +680,12 @@ function cmd_new_invoice_from_ticket_click(){
})
var data = new Object()
data['opt'] = 'invoice'
data['client'] = values.id_partner
data['tickets'] = tickets
data['is_invoice_day'] = chk.getValue()
data['opt'] = 'invoice'
var periodicidad = ''
if(data['is_invoice_day']){
periodicidad = $$('lst_global_periodicidad_2').getValue() + '|'
periodicidad += $$('lst_global_months_2').getValue() + '|'
periodicidad += new Date().getFullYear()
}
data['periodicidad'] = periodicidad
msg = 'Todos los datos son correctos.<BR><BR>'
if(data['is_invoice_day']){
msg += 'Es Factura Global.<BR><BR>'
}
msg += '¿Estás seguro de generar esta factura?'
msg = 'Todos los datos son correctos.<BR><BR>¿Estás seguro de generar esta factura?'
webix.confirm({
title: 'Generar Factura',
ok: 'Si',

View File

@ -15,7 +15,7 @@
//~ along with this program. If not, see <http://www.gnu.org/licenses/>.
var PUBLICO = "PUBLICO EN GENERAL";
var PUBLICO = "Público en general";
var RFC_PUBLICO = "XAXX010101000";
var RFC_EXTRANJERO = "XEXX010101000";
var PAIS = "México";
@ -24,7 +24,6 @@ var DECIMALES = 2;
var DECIMALES_TAX = 4;
var CLAVE_ANTICIPOS = '84111506';
var CURRENCY_MN = 'MXN';
var KEY_SAT_01 = '01010101';
var db = new loki('data.db');
@ -55,42 +54,6 @@ var months = [
{id: 12, value: 'Diciembre'},
]
var days = [
{id: -1, value: '00'},
{id: 1, value: '01'},
{id: 2, value: '02'},
{id: 3, value: '03'},
{id: 4, value: '04'},
{id: 5, value: '05'},
{id: 6, value: '06'},
{id: 7, value: '07'},
{id: 8, value: '08'},
{id: 9, value: '09'},
{id: 10, value: '10'},
{id: 11, value: '11'},
{id: 12, value: '12'},
{id: 13, value: '13'},
{id: 14, value: '14'},
{id: 15, value: '15'},
{id: 16, value: '16'},
{id: 17, value: '17'},
{id: 18, value: '18'},
{id: 19, value: '19'},
{id: 20, value: '20'},
{id: 21, value: '21'},
{id: 22, value: '22'},
{id: 23, value: '23'},
{id: 24, value: '24'},
{id: 25, value: '25'},
{id: 26, value: '26'},
{id: 27, value: '27'},
{id: 28, value: '28'},
{id: 29, value: '29'},
{id: 30, value: '30'},
{id: 31, value: '31'},
]
function get_icon(tipo){
icons = {
@ -664,33 +627,3 @@ function grid_parse(grid_name, values){
function activate_tab(parent, name){
$$(parent).getTabbar().setValue(name)
}
var opt_global_periodicidad = [
{id: '01', value: '[01] Diario'},
{id: '02', value: '[02] Semanal'},
{id: '03', value: '[03] Quincenal'},
{id: '04', value: '[04] Mensual'},
{id: '05', value: '[05] Bimestral'},
]
var opt_global_months = [
{id: '01', value: '[01] Enero'},
{id: '02', value: '[02] Febrero'},
{id: '03', value: '[03] Marzo'},
{id: '04', value: '[04] Abril'},
{id: '05', value: '[05] Mayo'},
{id: '06', value: '[06] Junio'},
{id: '07', value: '[07] Julio'},
{id: '08', value: '[08] Agosto'},
{id: '09', value: '[09] Septiembre'},
{id: '10', value: '[10] Octubre'},
{id: '11', value: '[11] Noviembre'},
{id: '12', value: '[12] Diciembre'},
{id: '13', value: '[13] Enero-Febrero'},
{id: '14', value: '[14] Marzo-Abril'},
{id: '15', value: '[15] Mayo-Junio'},
{id: '16', value: '[16] Julio-Agosto'},
{id: '17', value: '[17] Septiembre-Octubre'},
{id: '18', value: '[18] Noviembre-Diciembre'},
]

View File

@ -176,9 +176,7 @@ var emisor_datos_fiscales = [
invalidMessage: 'El C.P. es requerido'},
{view: 'text', id: 'emisor_cp2', name: 'emisor_cp2', width: 300,
label: 'C.P. de Expedición: ', attributes: {maxlength: 5}},
{view: 'counter', id: 'emisor_hours', name: 'emisor_hours', value: 0,
required: false, label: 'Horas Dif.: ', step: 1, min: -1, max: 3}
]},
{}]},
{cols: [
{view: 'label', label: 'Regimenes Fiscales *', required: true}, {}]},
{cols: [{view: 'list', id: 'lst_emisor_regimen', select: 'multiselect',
@ -485,9 +483,7 @@ var emisor_correo = [
{}]},
{cols: [
{view: 'checkbox', id: 'correo_ssl', name: 'correo_ssl',
label: 'Usar TLS/SSL: ', maxWidth: 210},
{view: 'checkbox', id: 'correo_starttls', name: 'correo_starttls',
label: 'Usar STARTTLS: '},
label: 'Usar TLS/SSL: '},
{}]},
{cols: [
{view: 'text', id: 'correo_usuario', name: 'correo_usuario',
@ -598,22 +594,8 @@ var type_make_pdf = [
]
//~ Templates
var opt_templates_cfdi = [
{id: '_4.0.ods', value: 'CFDI v4.0'},
{id: '_4.0_cn_1.2.ods', value: 'CFDI v4.0 - Nómina v1.2'},
{id: '_4.0_cp_2.0.ods', value: 'CFDI v4.0 - Pagos v2.0'},
{id: '_4.0_ccp_2.0.ods', value: 'CFDI v4.0 - Carta Porte v2.0'},
{id: '_4.0_ccp_3.0.ods', value: 'CFDI v4.0 - Carta Porte v3.0'},
{id: '_4.0_cd_1.1.ods', value: 'CFDI v4.0 - Donativos v1.1'},
{id: '_4.0_cce_2.0.ods', value: 'CFDI v4.0 - Comercio Exterior v2.0'},
{id: '_4.0.json', value: 'CFDI v4.0 - JSON'},
{id: '_3.3.ods', value: 'CFDI v3.3'},
{id: '_3.3_cn_1.2.ods', value: 'CFDI v3.3 - Nómina v1.2'},
{id: '_3.3_ccp_2.0.ods', value: 'CFDI v3.3 - Carta Porte v2.0'},
{id: '_3.3_cp_1.0.ods', value: 'CFDI v3.3 - Pagos v1.0'},
{id: '_3.3.json', value: 'CFDI v3.3 - JSON'},
{id: '_3.2.ods', value: 'CFDI v3.2'}
{id: '_3.3_cp_2.0.ods', value: 'CFDI v3.3 - Carta Porte 2.0'},
]
@ -626,6 +608,14 @@ var options_templates = [
{},
{maxWidth: 20} ]},
{maxHeight: 50},
{cols: [{maxWidth: 20},
{view: 'search', id: 'txt_plantilla_factura_32', name: 'plantilla_factura_32',
label: 'Plantilla Factura v3.2 (ODS): ', labelPosition: 'top',
icon: 'file'}, {maxWidth: 25},
{view: 'search', id: 'txt_plantilla_factura_33', labelPosition: 'top',
label: 'Plantilla Factura v3.3 (ODS): ', icon: 'file'},
{maxWidth: 20} ]},
{maxHeight: 20},
{cols: [{maxWidth: 20},
{view: 'search', id: 'txt_plantilla_factura_html', name: 'plantilla_factura_html',
label: 'Plantilla Factura v3.3 (HTML): ', labelPosition: 'top',
@ -633,11 +623,32 @@ var options_templates = [
{view: 'search', id: 'txt_plantilla_factura_css', name: 'plantilla_factura_css',
label: 'Archivo de estilos (CSS): ', labelPosition: 'top',
icon: 'file'}, {maxWidth: 20} ]},
{maxHeight: 20},
{cols: [{maxWidth: 20},
{view: 'search', id: 'txt_plantilla_factura_json', name: 'plantilla_factura_json',
label: 'Plantilla Factura v3.3 (JSON): ', labelPosition: 'top',
icon: 'file'}, {maxWidth: 25},
{}, {maxWidth: 20} ]},
{maxHeight: 20},
{cols: [{maxWidth: 20},
{view: 'search', id: 'txt_plantilla_nomina1233', name: 'plantilla_nomina1233',
label: 'Plantilla Nomina v1.2 - Cfdi 3.3 (ODS): ', labelPosition: 'top',
icon: 'file'}, {maxWidth: 40}, {}]},
{maxHeight: 20},
{cols: [{maxWidth: 20},
{view: 'search', id: 'txt_plantilla_pagos10', name: 'plantilla_pagos10',
label: 'Plantilla Factura de Pagos v1.0 - Cfdi 3.3 (ODS): ',
labelPosition: 'top', icon: 'file'}, {maxWidth: 40}, {}]},
{maxHeight: 20},
{cols: [{maxWidth: 20},
{view: 'search', id: 'txt_plantilla_ticket', name: 'plantilla_ticket',
label: 'Plantilla para Tickets (ODS): ', labelPosition: 'top',
icon: 'file'},
{view: 'search', id: 'txt_plantilla_donataria', name: 'plantilla_donataria',
label: 'Plantilla Donataria (solo ONGs): ', labelPosition: 'top',
icon: 'file'},
{}]},
{maxHeight: 20},
{cols: [{maxWidth: 20},
@ -672,7 +683,7 @@ var options_admin_otros = [
{view: 'checkbox', id: 'chk_config_tax_locales', labelWidth: 0,
labelRight: 'Impuestos locales, calcular antes del descuento'},
{view: 'checkbox', id: 'chk_config_tax_decimals', labelWidth: 0,
labelRight: 'Calcular impuestos con 4 decimales', hidden: true},
labelRight: 'Calcular impuestos con 4 decimales'},
{view: 'checkbox', id: 'chk_config_price_with_taxes_in_invoice', labelWidth: 0,
labelRight: 'Precio incluye impuestos'},
{view: 'checkbox', id: 'chk_config_add_same_product', labelWidth: 0,
@ -691,8 +702,6 @@ var options_admin_otros = [
labelRight: 'Factura global por ticket'},
{view: 'checkbox', id: 'chk_config_show_total_cant', labelWidth: 0,
labelRight: 'Mostrar total de cantidades'},
{view: 'checkbox', id: 'chk_config_show_filter_by_day', labelWidth: 0,
labelRight: 'Mostrar filtro por día'},
{}
]},
{cols: [{maxWidth: 15},
@ -700,11 +709,6 @@ var options_admin_otros = [
labelRight: 'Solo admins pueden cancelar'},
{}
]},
{cols: [{maxWidth: 15},
{view: 'checkbox', id: 'chk_config_change_date_invoice', labelWidth: 0,
labelRight: 'Permitir cambiar fecha al facturar [No recomendable]'},
{}
]},
{maxHeight: 15},
{template: 'Timbrado', type: 'section'},
@ -826,7 +830,7 @@ var options_admin_products = [
var options_admin_complements = [
{maxHeight: 10},
{maxHeight: 20},
{template: 'Complemento de Nómina', type: 'section'},
{cols: [{maxWidth: 15},
{view: 'checkbox', id: 'chk_usar_nomina', labelWidth: 0,
@ -836,7 +840,7 @@ var options_admin_complements = [
{view: 'text', id: 'txt_config_nomina_folio', name: 'config_nomina_folio',
label: 'Folio', labelWidth: 50, labelAlign: 'right'},
{maxWidth: 15}]},
{maxHeight: 10},
{maxHeight: 20},
{template: 'Complemento de Pagos', type: 'section'},
{cols: [{maxWidth: 15},
{view: 'checkbox', id: 'chk_config_pagos', labelWidth: 0,
@ -848,25 +852,25 @@ var options_admin_complements = [
{view: 'text', id: 'txt_config_cfdipay_folio', name: 'txt_config_cfdipay_serie',
label: 'Folio', labelWidth: 50, labelAlign: 'right'},
{maxWidth: 15}]},
{maxHeight: 10},
{maxHeight: 20},
{template: 'Complemento de Divisas', type: 'section'},
{cols: [{maxWidth: 15},
{view: 'checkbox', id: 'chk_config_divisas', labelWidth: 0,
labelRight: 'Usar complemento de divisas'},
{maxWidth: 15}]},
{maxHeight: 10},
{maxHeight: 20},
{template: 'Complemento INE', type: 'section'},
{cols: [{maxWidth: 15},
{view: 'checkbox', id: 'chk_config_ine', labelWidth: 0,
labelRight: 'Usar el complemento INE'},
{maxWidth: 15}]},
{maxHeight: 10},
{maxHeight: 20},
{template: 'Complemento para escuelas EDU', type: 'section'},
{cols: [{maxWidth: 15},
{view: 'checkbox', id: 'chk_config_edu', labelWidth: 0,
labelRight: 'Usar el complemento EDU'},
{maxWidth: 15}]},
{maxHeight: 10},
{maxHeight: 20},
{template: 'Complemento Leyendas Fiscales', type: 'section'},
{cols: [{maxWidth: 15},
{view: 'checkbox', id: 'chk_config_leyendas_fiscales', labelWidth: 0,
@ -875,17 +879,12 @@ var options_admin_complements = [
type: 'form', align: 'center', autowidth: true, disabled: true},
{}, {maxWidth: 15}
]},
{maxHeight: 10},
{maxHeight: 20},
{template: 'Complemento para Carta Porte', type: 'section'},
{cols: [{maxWidth: 15},
{view: 'checkbox', id: 'chk_config_carta_porte', labelWidth: 0,
labelRight: 'Usar el complemento Carta Porte'},
{maxWidth: 15}]},
{template: 'Complemento para Comercio Exterior', type: 'section'},
{cols: [{maxWidth: 15},
{view: 'checkbox', id: 'chk_config_comercio_exterior', labelWidth: 0,
labelRight: 'Usar el complemento Comercio Exterior'},
{maxWidth: 15}]},
]
@ -1134,19 +1133,6 @@ var grid_admin_usos_cfdi_cols = [
]
var grid_admin_regimenes_fiscales_cols = [
{id: 'id', header: 'ID', hidden: true},
{id: 'key', header: 'Clave', adjust: 'header'},
{id: 'name', header: 'Nombre', width: 500},
{id: 'fisica', header: 'Físicas', adjust: 'header',
template: format_bool_fisica},
{id: 'moral', header: 'Morales', adjust: 'header',
template: format_bool_moral},
{id: 'activo', header: 'Activa', template: '{common.checkbox()}',
editor: 'checkbox', adjust: 'header'},
]
var grid_admin_formasdepago = {
view: 'datatable',
id: 'grid_admin_formasdepago',
@ -1159,18 +1145,6 @@ var grid_admin_formasdepago = {
}
var grid_admin_regimenes_fiscales = {
view: 'datatable',
id: 'grid_admin_regimenes_fiscales',
select: 'cell',
adjust: true,
autowidth: true,
headermenu: true,
footer: true,
columns: grid_admin_regimenes_fiscales_cols,
}
var grid_admin_usos_cfdi = {
view: 'datatable',
id: 'grid_admin_usos_cfdi',
@ -1193,7 +1167,6 @@ var admin_taxes = [
'CEDULAR',
'CMIC',
'SUPERVISION',
'MANO DE OBRA',
]
var admin_sat_impuestos = {cols: [{maxWidth: 15},
@ -1342,16 +1315,6 @@ var sat_usos_cfdi = [
]
var msg_regimenes_fiscales = 'Administrar Regimenes Fiscales.'
var sat_regimenes_fiscales = [
{maxHeight: 20},
{cols: [{maxWidth: 15}, {view: 'label', label: msg_regimenes_fiscales}, {}]},
{maxHeight: 20},
{cols: [{maxWidth: 15}, grid_admin_regimenes_fiscales, {}]},
{maxHeight: 20},
]
var suggest_sat_unidades_peso = {
view: 'gridsuggest',
id: 'grid_unidadpeso_found',
@ -1449,7 +1412,6 @@ var tab_sat = {
{id: 'Unidades', rows: sat_unidades},
{id: 'Formas de Pago', rows: sat_formasdepago},
{id: 'Usos de CFDI', rows: sat_usos_cfdi},
{id: 'Regimenes Fiscales', rows: sat_regimenes_fiscales},
{id: 'Carta Porte', rows: tab_sat_carta_porte},
],
}

View File

@ -147,7 +147,7 @@ var grid_cfdi_pay_cols = [
{id: 'cliente', header: ['Razón Social'], fillspace: true},
{id: 'xml', header: 'XML', adjust: 'data', template: get_icon('xml')},
{id: 'pdf', header: 'PDF', adjust: 'data', template: get_icon('pdf')},
{id: 'email', header: '@', adjust: 'data', template: get_icon('email')}
{id: 'email', header: '', adjust: 'data', template: get_icon('email')}
]
@ -290,7 +290,7 @@ var grid_bank_invoice_pay_cols = [
{id: 'pdf', header: 'PDF', adjust: 'data', template: get_icon('pdf')},
//~ {id: 'ods', header: 'ODS', adjust: 'data', template: get_icon('table')},
//~ {id: 'zip', header: 'ZIP', adjust: 'data', template: get_icon('zip')},
{id: 'email', header: '@', adjust: 'data', template: get_icon('email')}
{id: 'email', header: '', adjust: 'data', template: get_icon('email')}
]
@ -347,8 +347,6 @@ var toolbar_bank_pay = [
type: 'iconButton', autowidth: true, icon: 'minus'},
{view: 'button', id: 'cmd_pay_delete', label: 'Eliminar',
type: 'iconButton', autowidth: true, icon: 'ban'},
{view: 'checkbox', id: 'chk_pay_close_when_stamp',
label: 'Cerrar al timbrar', tooltip: 'Cerrar al timbrar'},
{},
{view: 'icon', click: '$$("multi_bancos").setValue("banco_home")',
icon: 'times-circle'}
@ -367,13 +365,11 @@ var toolbar_bank_invoice_pay_filter = [
{view: 'richselect', id: 'filter_invoice_pay_year', label: 'Año',
labelAlign: 'right', labelWidth: 50, width: 150, options: []},
{view: 'richselect', id: 'filter_invoice_pay_month', label: 'Mes',
labelAlign: 'right', labelWidth: 50, width: 175, options: months},
labelAlign: 'right', labelWidth: 50, width: 200, options: months},
{view: 'daterangepicker', id: 'filter_invoice_pay_dates', label: 'Fechas',
labelAlign: 'right', width: 275},
labelAlign: 'right', width: 300},
{view: 'button', id: 'cmd_invoice_pay_sat', label: 'SAT',
type: 'iconButton', autowidth: true, icon: 'check-circle'},
{view: 'button', id: 'cmd_invoice_pay_cancel', label: 'Cancelar',
type: 'iconButton', autowidth: true, icon: 'ban'},
{},
]
@ -612,77 +608,3 @@ var win_mov_description = {
$$('cmd_close_mov_description').attachEvent('onItemClick', cmd_close_mov_description_click)
}
}
var opt_reasons_cancel_pay = [
{id: '', value: ''},
{id: '01', value: '[01] Comprobante emitido con errores con relación'},
{id: '02', value: '[02] Comprobante emitido con errores sin relación'},
{id: '03', value: '[03] No se llevó acabo la operación'},
{id: '04', value: '[04] Operación nominativa relacionada en una factura global'},
]
var body_invoice_cancel_pay = {rows: [{minHeight: 15},
{view: 'richselect', id: 'lst_reasons_cancel', labelPosition: 'top', label: 'Razón de cancelación', options: opt_reasons_cancel_pay, value: '', width: 400},
{view: 'text', id: 'txt_cancel_uuid', labelPosition: 'top', label: 'UUID que sustituye', width: 400},
{view: 'label', label: 'Esta acción no se puede deshacer', autowidth: true, align: 'center'},
{view: 'label', label: '¿Estás seguro de continuar?', autowidth: true, align: 'center'},
{cols: [{},
{view: 'button', id: 'cmd_invoice_cancel_pay', width: 100, label: 'Cancelar', type: 'danger', icon: 'ban'},
{maxWidth: 25},
{view: 'button', id: 'cmd_win_cancel_pay_close', width: 100, label: 'Cerrar'},
{}
]},
{minHeight: 20},
]}
var win_invoice_cancel_pay = {
init: function(){
webix.ui({
view: 'window',
id: 'win_invoice_cancel_pay',
modal: true,
width: 400,
position: 'center',
head: 'Cancelar CFDI',
body: body_invoice_cancel_pay,
})
$$('cmd_invoice_cancel_pay').attachEvent('onItemClick', cmd_invoice_cancel_pay_click)
$$('cmd_win_cancel_pay_close').attachEvent('onItemClick', cmd_win_cancel_pay_close_click)
}
}
var body_invoice_cancel_pay2 = {rows: [{minHeight: 15},
{view: 'richselect', id: 'lst_reasons_cancel2', labelPosition: 'top', label: 'Razón de cancelación', options: opt_reasons_cancel_pay, value: '', width: 400},
{view: 'text', id: 'txt_cancel_uuid2', labelPosition: 'top', label: 'UUID que sustituye', width: 400},
{view: 'label', label: 'Esta acción no se puede deshacer', autowidth: true, align: 'center'},
{view: 'label', label: '¿Estás seguro de continuar?', autowidth: true, align: 'center'},
{cols: [{},
{view: 'button', id: 'cmd_invoice_cancel_pay2', width: 100, label: 'Cancelar', type: 'danger', icon: 'ban'},
{maxWidth: 25},
{view: 'button', id: 'cmd_win_cancel_pay_close2', width: 100, label: 'Cerrar'},
{}
]},
{minHeight: 20},
]}
var win_invoice_cancel_pay2 = {
init: function(){
webix.ui({
view: 'window',
id: 'win_invoice_cancel_pay2',
modal: true,
width: 400,
position: 'center',
head: 'Cancelar CFDI de Pago',
body: body_invoice_cancel_pay2,
})
$$('cmd_invoice_cancel_pay2').attachEvent('onItemClick', cmd_invoice_cancel_pay2_click)
$$('cmd_win_cancel_pay_close2').attachEvent('onItemClick', cmd_win_cancel_pay_close2_click)
}
}

File diff suppressed because it is too large Load Diff

View File

@ -245,44 +245,3 @@ var win_import_nomina = {
$$('up_nomina').attachEvent('onUploadComplete', up_nomina_upload_complete)
}
}
var opt_reasons_cancel_nomina = [
{id: '', value: ''},
{id: '01', value: '[01] Comprobante emitido con errores con relación'},
{id: '02', value: '[02] Comprobante emitido con errores sin relación'},
{id: '03', value: '[03] No se llevó acabo la operación'},
{id: '04', value: '[04] Operación nominativa relacionada en una factura global'},
]
var body_invoice_cancel_nomina = {rows: [{minHeight: 15},
{view: 'richselect', id: 'lst_reasons_cancel', labelPosition: 'top', label: 'Razón de cancelación', options: opt_reasons_cancel_pay, value: '', width: 400},
{view: 'text', id: 'txt_cancel_uuid', labelPosition: 'top', label: 'UUID que sustituye', width: 400},
{view: 'label', label: 'Esta acción no se puede deshacer', autowidth: true, align: 'center'},
{view: 'label', label: '¿Estás segura de continuar?', autowidth: true, align: 'center'},
{cols: [{},
{view: 'button', id: 'cmd_invoice_cancel_nomina', width: 100, label: 'Cancelar', type: 'danger', icon: 'ban'},
{maxWidth: 25},
{view: 'button', id: 'cmd_win_cancel_nomina_close', width: 100, label: 'Cerrar'},
{}
]},
{minHeight: 20},
]}
var win_invoice_cancel_nomina = {
init: function(){
webix.ui({
view: 'window',
id: 'win_invoice_cancel_nomina',
modal: true,
width: 400,
position: 'center',
head: 'Cancelar CFDI',
body: body_invoice_cancel_nomina,
})
$$('cmd_invoice_cancel_nomina').attachEvent('onItemClick', cmd_invoice_cancel_nomina_click)
$$('cmd_win_cancel_nomina_close').attachEvent('onItemClick', cmd_win_cancel_nomina_close_click)
}
}

View File

@ -96,7 +96,7 @@ var controls_fiscales = [
{cols: [{view: 'text', id: 'no_interior', name: 'no_interior', width: 300,
label: 'No Interior: '},{}]},
{cols: [{view: 'search', id: 'codigo_postal', name: 'codigo_postal',
width: 300, label: 'C.P.: ', attributes: {maxlength: 5}, required: true},{}]},
width: 300, label: 'C.P.: ', attributes: {maxlength: 5}},{}]},
{view: 'text', id: 'colonia', name: 'colonia', label: 'Colonia: '},
{view: 'text', id: 'municipio', name: 'municipio', label: 'Municipio: '},
{view: 'text', id: 'estado', name: 'estado', label: 'Estado: '},
@ -122,12 +122,6 @@ var controls_fiscales = [
{view: 'richselect', id: 'lst_uso_cfdi_socio', name: 'uso_cfdi_socio',
label: 'Uso del CFDI', options: []},
{},
]},
{template: 'Regimenes Fiscales', type: 'section'},
{cols: [
{view: 'list', id: 'lst_receptor_regimenes_fiscales', data: [],
select: 'multiselect', width: 600, height: 125, required: true},
{},
]}
]
@ -165,7 +159,7 @@ var controls_others = [
label: 'Cuenta Proveedor: ', disabled: true}, {}]
},
{view: 'checkbox', name: 'es_ong', label: 'Es ONG: ', value: false},
{view: 'text', name: 'tags', label: 'Etiquetas', disabled: true,
{view: 'text', name: 'tags', label: 'Etiquetas',
tooltip: 'Utiles para filtrados rápidos. Separa por comas.'},
{view: 'textarea' , height: 200, name: 'notas', label: 'Notas'},
]

View File

@ -111,15 +111,6 @@ var suggest_sat_producto = {
}
var opt_tax_object = [
{id: '01', value: '[01] No objeto de impuesto.'},
{id: '02', value: '[02] Sí objeto de impuesto.'},
{id: '03', value: '[03] Sí objeto del impuesto y no obligado al desglose.'},
{id: '04', value: '[04] Sí objeto del impuesto y no causa impuesto.'},
{id: '05', value: '[05] Sí objeto del impuesto, IVA crédito PODEBI.'},
]
var controls_generals = [
{view: 'checkbox', id: 'es_activo_producto', name: 'es_activo_producto',
label: 'Activo: ', value: true,
@ -150,10 +141,13 @@ var controls_generals = [
{view: "richselect", id: "unidad", name: "unidad", label: "Unidad",
width: 300, labelWidth: 130, labelAlign: "right", required: true,
invalidMessage: "La Unidad es requerida", options: []},
{view: 'richselect', id: 'objeto_impuesto', name: 'objeto_impuesto', label: 'Objeto de Impuestos',
width: 500, labelWidth: 150, labelAlign: "right", required: true,
invalidMessage: 'Este campo es requerido', options: opt_tax_object},
{view: 'text', id: 'cant_by_packing', name: 'cant_by_packing',
labelAlign: 'right', labelWidth: 150, inputAlign: "right",
label: 'Cantidad por empaque:'},
{},
//~ {view: 'text', id: 'tags_producto', name: 'tags_producto',
//~ labelAlign: 'right', label: 'Etiquetas',
//~ placeholder: 'Separadas por comas'}
]},
{cols: [
{view: "currency", type: "text", id: "valor_unitario",

View File

@ -235,12 +235,7 @@ var cells_new_ticket = [
var toolbar_ticket_invoice = {view: 'toolbar', elements: [{},
{view: 'checkbox', id: 'chk_is_invoice_day', labelWidth: 0, width: 150,
labelRight: 'Es Factura Global'},
{view: 'richselect', id: 'lst_global_periodicidad_2', labelWidth: 90, width: 225,
label: 'Periodicidad:', options: opt_global_periodicidad, value: '01', disabled: true},
{view: 'richselect', id: 'lst_global_months_2', labelWidth: 50, width: 250,
label: 'Mes:', options: opt_global_months, value: '01', disabled: true},
{},
labelRight: 'Es factura del día'}, {},
{view: 'button', id: 'cmd_close_ticket_invoice', label: 'Cerrar',
type: 'danger', autowidth: true, align: 'center'}
]}

Binary file not shown.

Binary file not shown.

View File

@ -1,401 +1,347 @@
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:fn="http://www.w3.org/2005/xpath-functions" xmlns:cfdi="http://www.sat.gob.mx/cfd/4" xmlns:cce11="http://www.sat.gob.mx/ComercioExterior11" xmlns:donat="http://www.sat.gob.mx/donat" xmlns:divisas="http://www.sat.gob.mx/divisas" xmlns:implocal="http://www.sat.gob.mx/implocal" xmlns:leyendasFisc="http://www.sat.gob.mx/leyendasFiscales" xmlns:pfic="http://www.sat.gob.mx/pfic" xmlns:tpe="http://www.sat.gob.mx/TuristaPasajeroExtranjero" xmlns:nomina12="http://www.sat.gob.mx/nomina12" xmlns:registrofiscal="http://www.sat.gob.mx/registrofiscal" xmlns:pagoenespecie="http://www.sat.gob.mx/pagoenespecie" xmlns:aerolineas="http://www.sat.gob.mx/aerolineas" xmlns:valesdedespensa="http://www.sat.gob.mx/valesdedespensa" xmlns:notariospublicos="http://www.sat.gob.mx/notariospublicos" xmlns:vehiculousado="http://www.sat.gob.mx/vehiculousado" xmlns:servicioparcial="http://www.sat.gob.mx/servicioparcialconstruccion" xmlns:decreto="http://www.sat.gob.mx/renovacionysustitucionvehiculos" xmlns:destruccion="http://www.sat.gob.mx/certificadodestruccion" xmlns:obrasarte="http://www.sat.gob.mx/arteantiguedades" xmlns:ine="http://www.sat.gob.mx/ine" xmlns:iedu="http://www.sat.gob.mx/iedu" xmlns:ventavehiculos="http://www.sat.gob.mx/ventavehiculos" xmlns:detallista="http://www.sat.gob.mx/detallista" xmlns:ecc12="http://www.sat.gob.mx/EstadoDeCuentaCombustible12" xmlns:consumodecombustibles11="http://www.sat.gob.mx/ConsumoDeCombustibles11" xmlns:gceh="http://www.sat.gob.mx/GastosHidrocarburos10" xmlns:ieeh="http://www.sat.gob.mx/IngresosHidrocarburos10" xmlns:cartaporte20="http://www.sat.gob.mx/CartaPorte20" xmlns:pago20="http://www.sat.gob.mx/Pagos20">
<!-- Con el siguiente método se establece que la salida deberá ser en texto -->
<xsl:output method="text" version="1.0" encoding="UTF-8" indent="no"/>
<xsl:include href="utilerias.xslt"/>
<xsl:include href="nomina12.xslt"/>
<xsl:include href="divisas.xslt"/>
<xsl:include href="ine11.xslt"/>
<xsl:include href="iedu.xslt"/>
<xsl:include href="leyendasFisc.xslt"/>
<xsl:include href="cartaporte30.xslt"/>
<xsl:include href="comercioexterior20.xslt"/>
<xsl:include href="donat11.xslt"/>
<xsl:include href="pagos20.xslt"/>
<xsl:include href="implocal.xslt"/>
<!--
<xsl:include href="http://www.sat.gob.mx/sitio_internet/cfd/pfic/pfic.xslt"/>
<xsl:include href="http://www.sat.gob.mx/sitio_internet/cfd/TuristaPasajeroExtranjero/TuristaPasajeroExtranjero.xslt"/>
<xsl:include href="http://www.sat.gob.mx/sitio_internet/cfd/cfdiregistrofiscal/cfdiregistrofiscal.xslt"/>
<xsl:include href="http://www.sat.gob.mx/sitio_internet/cfd/pagoenespecie/pagoenespecie.xslt"/>
<xsl:include href="http://www.sat.gob.mx/sitio_internet/cfd/aerolineas/aerolineas.xslt"/>
<xsl:include href="http://www.sat.gob.mx/sitio_internet/cfd/valesdedespensa/valesdedespensa.xslt"/>
<xsl:include href="http://www.sat.gob.mx/sitio_internet/cfd/notariospublicos/notariospublicos.xslt"/>
<xsl:include href="http://www.sat.gob.mx/sitio_internet/cfd/vehiculousado/vehiculousado.xslt"/>
<xsl:include href="http://www.sat.gob.mx/sitio_internet/cfd/servicioparcialconstruccion/servicioparcialconstruccion.xslt"/>
<xsl:include href="http://www.sat.gob.mx/sitio_internet/cfd/renovacionysustitucionvehiculos/renovacionysustitucionvehiculos.xslt"/>
<xsl:include href="http://www.sat.gob.mx/sitio_internet/cfd/certificadodestruccion/certificadodedestruccion.xslt"/>
<xsl:include href="http://www.sat.gob.mx/sitio_internet/cfd/arteantiguedades/obrasarteantiguedades.xslt"/>
<xsl:include href="http://www.sat.gob.mx/sitio_internet/cfd/ventavehiculos/ventavehiculos11.xslt"/>
<xsl:include href="http://www.sat.gob.mx/sitio_internet/cfd/detallista/detallista.xslt"/>
<xsl:include href="http://www.sat.gob.mx/sitio_internet/cfd/EstadoDeCuentaCombustible/ecc12.xslt"/>
<xsl:include href="http://www.sat.gob.mx/sitio_internet/cfd/consumodecombustibles/consumodeCombustibles11.xslt"/>
<xsl:include href="http://www.sat.gob.mx/sitio_internet/cfd/GastosHidrocarburos10/GastosHidrocarburos10.xslt"/>
<xsl:include href="http://www.sat.gob.mx/sitio_internet/cfd/IngresosHidrocarburos10/IngresosHidrocarburos.xslt"/>
-->
<!-- Aquí iniciamos el procesamiento de la cadena original con su | inicial y el terminador || -->
<xsl:template match="/">|<xsl:apply-templates select="/cfdi:Comprobante"/>||</xsl:template>
<!-- Aquí iniciamos el procesamiento de los datos incluidos en el comprobante -->
<xsl:template match="cfdi:Comprobante">
<!-- Iniciamos el tratamiento de los atributos de comprobante -->
<xsl:call-template name="Requerido">
<xsl:with-param name="valor" select="./@Version"/>
</xsl:call-template>
<xsl:call-template name="Opcional">
<xsl:with-param name="valor" select="./@Serie"/>
</xsl:call-template>
<xsl:call-template name="Opcional">
<xsl:with-param name="valor" select="./@Folio"/>
</xsl:call-template>
<xsl:call-template name="Requerido">
<xsl:with-param name="valor" select="./@Fecha"/>
</xsl:call-template>
<xsl:call-template name="Opcional">
<xsl:with-param name="valor" select="./@FormaPago"/>
</xsl:call-template>
<xsl:call-template name="Requerido">
<xsl:with-param name="valor" select="./@NoCertificado"/>
</xsl:call-template>
<xsl:call-template name="Opcional">
<xsl:with-param name="valor" select="./@CondicionesDePago"/>
</xsl:call-template>
<xsl:call-template name="Requerido">
<xsl:with-param name="valor" select="./@SubTotal"/>
</xsl:call-template>
<xsl:call-template name="Opcional">
<xsl:with-param name="valor" select="./@Descuento"/>
</xsl:call-template>
<xsl:call-template name="Requerido">
<xsl:with-param name="valor" select="./@Moneda"/>
</xsl:call-template>
<xsl:call-template name="Opcional">
<xsl:with-param name="valor" select="./@TipoCambio"/>
</xsl:call-template>
<xsl:call-template name="Requerido">
<xsl:with-param name="valor" select="./@Total"/>
</xsl:call-template>
<xsl:call-template name="Requerido">
<xsl:with-param name="valor" select="./@TipoDeComprobante"/>
</xsl:call-template>
<xsl:call-template name="Requerido">
<xsl:with-param name="valor" select="./@Exportacion"/>
</xsl:call-template>
<xsl:call-template name="Opcional">
<xsl:with-param name="valor" select="./@MetodoPago"/>
</xsl:call-template>
<xsl:call-template name="Requerido">
<xsl:with-param name="valor" select="./@LugarExpedicion"/>
</xsl:call-template>
<xsl:call-template name="Opcional">
<xsl:with-param name="valor" select="./@Confirmacion"/>
</xsl:call-template>
<!--
Llamadas para procesar al los sub nodos del comprobante
-->
<xsl:apply-templates select="./cfdi:InformacionGlobal"/>
<xsl:apply-templates select="./cfdi:CfdiRelacionados"/>
<xsl:apply-templates select="./cfdi:Emisor"/>
<xsl:apply-templates select="./cfdi:Receptor"/>
<xsl:apply-templates select="./cfdi:Conceptos"/>
<xsl:apply-templates select="./cfdi:Impuestos"/>
<xsl:for-each select="./cfdi:Complemento">
<xsl:apply-templates select="."/>
</xsl:for-each>
</xsl:template>
<!-- Manejador de nodos tipo InformacionGlobal -->
<xsl:template match="cfdi:InformacionGlobal">
<!-- Iniciamos el tratamiento de los atributos del nodo tipo InformacionGlobal -->
<xsl:call-template name="Requerido">
<xsl:with-param name="valor" select="./@Periodicidad"/>
</xsl:call-template>
<xsl:call-template name="Requerido">
<xsl:with-param name="valor" select="./@Meses"/>
</xsl:call-template>
<xsl:call-template name="Requerido">
<xsl:with-param name="valor" select="./@Año"/>
</xsl:call-template>
</xsl:template>
<!-- Manejador de nodos tipo CFDIRelacionados -->
<xsl:template match="cfdi:CfdiRelacionados">
<!-- Iniciamos el tratamiento de los atributos del nodo tipo CFDIRelacionados -->
<xsl:call-template name="Requerido">
<xsl:with-param name="valor" select="./@TipoRelacion"/>
</xsl:call-template>
<xsl:for-each select="./cfdi:CfdiRelacionado">
<xsl:call-template name="Requerido">
<xsl:with-param name="valor" select="./@UUID"/>
</xsl:call-template>
</xsl:for-each>
</xsl:template>
<!-- Manejador de nodos tipo Emisor -->
<xsl:template match="cfdi:Emisor">
<!-- Iniciamos el tratamiento de los atributos del nodo tipo Emisor -->
<xsl:call-template name="Requerido">
<xsl:with-param name="valor" select="./@Rfc"/>
</xsl:call-template>
<xsl:call-template name="Requerido">
<xsl:with-param name="valor" select="./@Nombre"/>
</xsl:call-template>
<xsl:call-template name="Requerido">
<xsl:with-param name="valor" select="./@RegimenFiscal"/>
</xsl:call-template>
<xsl:call-template name="Opcional">
<xsl:with-param name="valor" select="./@FacAtrAdquirente"/>
</xsl:call-template>
</xsl:template>
<!-- Manejador de nodos tipo Receptor -->
<xsl:template match="cfdi:Receptor">
<!-- Iniciamos el tratamiento de los atributos del nodo tipo Receptor -->
<xsl:call-template name="Requerido">
<xsl:with-param name="valor" select="./@Rfc"/>
</xsl:call-template>
<xsl:call-template name="Requerido">
<xsl:with-param name="valor" select="./@Nombre"/>
</xsl:call-template>
<xsl:call-template name="Requerido">
<xsl:with-param name="valor" select="./@DomicilioFiscalReceptor"/>
</xsl:call-template>
<xsl:call-template name="Opcional">
<xsl:with-param name="valor" select="./@ResidenciaFiscal"/>
</xsl:call-template>
<xsl:call-template name="Opcional">
<xsl:with-param name="valor" select="./@NumRegIdTrib"/>
</xsl:call-template>
<xsl:call-template name="Requerido">
<xsl:with-param name="valor" select="./@RegimenFiscalReceptor"/>
</xsl:call-template>
<xsl:call-template name="Requerido">
<xsl:with-param name="valor" select="./@UsoCFDI"/>
</xsl:call-template>
</xsl:template>
<!-- Manejador de nodos tipo Conceptos -->
<xsl:template match="cfdi:Conceptos">
<!-- Llamada para procesar los distintos nodos tipo Concepto -->
<xsl:for-each select="./cfdi:Concepto">
<xsl:apply-templates select="."/>
</xsl:for-each>
</xsl:template>
<!--Manejador de nodos tipo Concepto-->
<xsl:template match="cfdi:Concepto">
<!-- Iniciamos el tratamiento de los atributos del Concepto -->
<xsl:call-template name="Requerido">
<xsl:with-param name="valor" select="./@ClaveProdServ"/>
</xsl:call-template>
<xsl:call-template name="Opcional">
<xsl:with-param name="valor" select="./@NoIdentificacion"/>
</xsl:call-template>
<xsl:call-template name="Requerido">
<xsl:with-param name="valor" select="./@Cantidad"/>
</xsl:call-template>
<xsl:call-template name="Requerido">
<xsl:with-param name="valor" select="./@ClaveUnidad"/>
</xsl:call-template>
<xsl:call-template name="Opcional">
<xsl:with-param name="valor" select="./@Unidad"/>
</xsl:call-template>
<xsl:call-template name="Requerido">
<xsl:with-param name="valor" select="./@Descripcion"/>
</xsl:call-template>
<xsl:call-template name="Requerido">
<xsl:with-param name="valor" select="./@ValorUnitario"/>
</xsl:call-template>
<xsl:call-template name="Requerido">
<xsl:with-param name="valor" select="./@Importe"/>
</xsl:call-template>
<xsl:call-template name="Opcional">
<xsl:with-param name="valor" select="./@Descuento"/>
</xsl:call-template>
<xsl:call-template name="Requerido">
<xsl:with-param name="valor" select="./@ObjetoImp"/>
</xsl:call-template>
<!-- Manejo de sub nodos de información Traslado de Conceptos:Concepto:Impuestos:Traslados-->
<xsl:for-each select="./cfdi:Impuestos/cfdi:Traslados/cfdi:Traslado">
<xsl:call-template name="Requerido">
<xsl:with-param name="valor" select="./@Base"/>
</xsl:call-template>
<xsl:call-template name="Requerido">
<xsl:with-param name="valor" select="./@Impuesto"/>
</xsl:call-template>
<xsl:call-template name="Requerido">
<xsl:with-param name="valor" select="./@TipoFactor"/>
</xsl:call-template>
<xsl:call-template name="Opcional">
<xsl:with-param name="valor" select="./@TasaOCuota"/>
</xsl:call-template>
<xsl:call-template name="Opcional">
<xsl:with-param name="valor" select="./@Importe"/>
</xsl:call-template>
</xsl:for-each>
<!-- Manejo de sub nodos de Retencion por cada una de los Conceptos:Concepto:Impuestos:Retenciones-->
<xsl:for-each select="./cfdi:Impuestos/cfdi:Retenciones/cfdi:Retencion">
<xsl:call-template name="Requerido">
<xsl:with-param name="valor" select="./@Base"/>
</xsl:call-template>
<xsl:call-template name="Requerido">
<xsl:with-param name="valor" select="./@Impuesto"/>
</xsl:call-template>
<xsl:call-template name="Requerido">
<xsl:with-param name="valor" select="./@TipoFactor"/>
</xsl:call-template>
<xsl:call-template name="Requerido">
<xsl:with-param name="valor" select="./@TasaOCuota"/>
</xsl:call-template>
<xsl:call-template name="Requerido">
<xsl:with-param name="valor" select="./@Importe"/>
</xsl:call-template>
</xsl:for-each>
<!-- Manejo de los distintos sub nodos a cuenta de terceros de forma indistinta a su grado de dependencia -->
<xsl:for-each select="./cfdi:ACuentaTerceros">
<xsl:apply-templates select="."/>
</xsl:for-each>
<!-- Manejo de los distintos sub nodos de información aduanera de forma indistinta a su grado de dependencia -->
<xsl:for-each select="./cfdi:InformacionAduanera">
<xsl:apply-templates select="."/>
</xsl:for-each>
<!-- Llamada al manejador de nodos de CuentaPredial en caso de existir -->
<xsl:if test="./cfdi:CuentaPredial">
<xsl:apply-templates select="./cfdi:CuentaPredial"/>
</xsl:if>
<!-- Llamada al manejador de nodos de ComplementoConcepto en caso de existir -->
<xsl:if test="./cfdi:ComplementoConcepto">
<xsl:apply-templates select="./cfdi:ComplementoConcepto"/>
</xsl:if>
<!-- Llamada al manejador de nodos de Parte en caso de existir -->
<xsl:for-each select=".//cfdi:Parte">
<xsl:apply-templates select="."/>
</xsl:for-each>
</xsl:template>
<!-- Manejador de nodos tipo ACuentaTerceros -->
<xsl:template match="cfdi:ACuentaTerceros">
<!-- Manejo de los atributos del nodo tipo ACuentaTerceros -->
<xsl:call-template name="Requerido">
<xsl:with-param name="valor" select="./@RfcACuentaTerceros"/>
</xsl:call-template>
<xsl:call-template name="Requerido">
<xsl:with-param name="valor" select="./@NombreACuentaTerceros"/>
</xsl:call-template>
<xsl:call-template name="Requerido">
<xsl:with-param name="valor" select="./@RegimenFiscalACuentaTerceros"/>
</xsl:call-template>
<xsl:call-template name="Requerido">
<xsl:with-param name="valor" select="./@DomicilioFiscalACuentaTerceros"/>
</xsl:call-template>
</xsl:template>
<!-- Manejador de nodos tipo Información Aduanera -->
<xsl:template match="cfdi:InformacionAduanera">
<!-- Manejo de los atributos de la información aduanera -->
<xsl:call-template name="Requerido">
<xsl:with-param name="valor" select="./@NumeroPedimento"/>
</xsl:call-template>
</xsl:template>
<!-- Manejador de nodos tipo Información CuentaPredial -->
<xsl:template match="cfdi:CuentaPredial">
<xsl:call-template name="Requerido">
<xsl:with-param name="valor" select="./@Numero"/>
</xsl:call-template>
</xsl:template>
<!-- Manejador de nodos tipo ComplementoConcepto -->
<xsl:template match="cfdi:ComplementoConcepto">
<xsl:for-each select="./*">
<xsl:apply-templates select="."/>
</xsl:for-each>
</xsl:template>
<!-- Manejador de nodos tipo Parte -->
<xsl:template match="cfdi:Parte">
<!-- Iniciamos el tratamiento de los atributos de Parte-->
<xsl:call-template name="Requerido">
<xsl:with-param name="valor" select="./@ClaveProdServ"/>
</xsl:call-template>
<xsl:call-template name="Opcional">
<xsl:with-param name="valor" select="./@NoIdentificacion"/>
</xsl:call-template>
<xsl:call-template name="Requerido">
<xsl:with-param name="valor" select="./@Cantidad"/>
</xsl:call-template>
<xsl:call-template name="Opcional">
<xsl:with-param name="valor" select="./@Unidad"/>
</xsl:call-template>
<xsl:call-template name="Requerido">
<xsl:with-param name="valor" select="./@Descripcion"/>
</xsl:call-template>
<xsl:call-template name="Opcional">
<xsl:with-param name="valor" select="./@ValorUnitario"/>
</xsl:call-template>
<xsl:call-template name="Opcional">
<xsl:with-param name="valor" select="./@Importe"/>
</xsl:call-template>
<!-- Manejador de nodos tipo InformacionAduanera-->
<xsl:for-each select=".//cfdi:InformacionAduanera">
<xsl:apply-templates select="."/>
</xsl:for-each>
</xsl:template>
<!-- Manejador de nodos tipo Complemento -->
<xsl:template match="cfdi:Complemento">
<xsl:for-each select="./*">
<xsl:apply-templates select="."/>
</xsl:for-each>
</xsl:template>
<!-- Manejador de nodos tipo Domicilio fiscal -->
<xsl:template match="cfdi:Impuestos">
<!-- Manejo de sub nodos de Retencion por cada una de los Impuestos:Retenciones-->
<xsl:for-each select="./cfdi:Retenciones/cfdi:Retencion">
<xsl:call-template name="Requerido">
<xsl:with-param name="valor" select="./@Impuesto"/>
</xsl:call-template>
<xsl:call-template name="Requerido">
<xsl:with-param name="valor" select="./@Importe"/>
</xsl:call-template>
</xsl:for-each>
<!-- Iniciamos el tratamiento de los atributos de TotalImpuestosRetenidos-->
<xsl:call-template name="Opcional">
<xsl:with-param name="valor" select="./@TotalImpuestosRetenidos"/>
</xsl:call-template>
<!-- Manejo de sub nodos de información Traslado de Impuestos:Traslados-->
<xsl:for-each select="./cfdi:Traslados/cfdi:Traslado">
<xsl:call-template name="Requerido">
<xsl:with-param name="valor" select="./@Base"/>
</xsl:call-template>
<xsl:call-template name="Requerido">
<xsl:with-param name="valor" select="./@Impuesto"/>
</xsl:call-template>
<xsl:call-template name="Requerido">
<xsl:with-param name="valor" select="./@TipoFactor"/>
</xsl:call-template>
<xsl:call-template name="Opcional">
<xsl:with-param name="valor" select="./@TasaOCuota"/>
</xsl:call-template>
<xsl:call-template name="Opcional">
<xsl:with-param name="valor" select="./@Importe"/>
</xsl:call-template>
</xsl:for-each>
<!-- Iniciamos el tratamiento de los atributos de TotalImpuestosTrasladados-->
<xsl:call-template name="Opcional">
<xsl:with-param name="valor" select="./@TotalImpuestosTrasladados"/>
</xsl:call-template>
</xsl:template>
</xsl:stylesheet>
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:fn="http://www.w3.org/2005/xpath-functions" xmlns:cfdi="http://www.sat.gob.mx/cfd/3" xmlns:cce11="http://www.sat.gob.mx/ComercioExterior11" xmlns:donat="http://www.sat.gob.mx/donat" xmlns:divisas="http://www.sat.gob.mx/divisas" xmlns:implocal="http://www.sat.gob.mx/implocal" xmlns:leyendasFisc="http://www.sat.gob.mx/leyendasFiscales" xmlns:pfic="http://www.sat.gob.mx/pfic" xmlns:tpe="http://www.sat.gob.mx/TuristaPasajeroExtranjero" xmlns:nomina12="http://www.sat.gob.mx/nomina12" xmlns:registrofiscal="http://www.sat.gob.mx/registrofiscal" xmlns:pagoenespecie="http://www.sat.gob.mx/pagoenespecie" xmlns:aerolineas="http://www.sat.gob.mx/aerolineas" xmlns:valesdedespensa="http://www.sat.gob.mx/valesdedespensa" xmlns:consumodecombustibles="http://www.sat.gob.mx/consumodecombustibles" xmlns:notariospublicos="http://www.sat.gob.mx/notariospublicos" xmlns:vehiculousado="http://www.sat.gob.mx/vehiculousado" xmlns:servicioparcial="http://www.sat.gob.mx/servicioparcialconstruccion" xmlns:decreto="http://www.sat.gob.mx/renovacionysustitucionvehiculos" xmlns:destruccion="http://www.sat.gob.mx/certificadodestruccion" xmlns:obrasarte="http://www.sat.gob.mx/arteantiguedades" xmlns:ine="http://www.sat.gob.mx/ine" xmlns:iedu="http://www.sat.gob.mx/iedu" xmlns:ventavehiculos="http://www.sat.gob.mx/ventavehiculos" xmlns:terceros="http://www.sat.gob.mx/terceros" xmlns:pago10="http://www.sat.gob.mx/Pagos">
<!-- Con el siguiente método se establece que la salida deberá ser en texto -->
<xsl:output method="text" version="1.0" encoding="UTF-8" indent="no"/>
<xsl:include href="utilerias.xslt"/>
<xsl:include href="comercioexterior11.xslt"/>
<xsl:include href="leyendasFisc.xslt"/>
<xsl:include href="nomina12.xslt"/>
<xsl:include href="implocal.xslt"/>
<xsl:include href="donat11.xslt"/>
<xsl:include href="ine11.xslt"/>
<xsl:include href="iedu.xslt"/>
<xsl:include href="pagos10.xslt"/>
<xsl:include href="divisas.xslt"/>
<xsl:include href="servicioconstruccion.xslt"/>
<xsl:include href="cartaporte20.xslt"/>
<!--
<xsl:include href="ecc11.xslt"/>
<xsl:include href="pfic.xslt"/>
<xsl:include href="TuristaPasajeroExtranjero.xslt"/>
<xsl:include href="cfdiregistrofiscal.xslt"/>
<xsl:include href="pagoenespecie.xslt"/>
<xsl:include href="aerolineas.xslt"/>
<xsl:include href="valesdedespensa.xslt"/>
<xsl:include href="consumodecombustibles.xslt"/>
<xsl:include href="notariospublicos.xslt"/>
<xsl:include href="vehiculousado.xslt"/>
<xsl:include href="servicioparcialconstruccion.xslt"/>
<xsl:include href="renovacionysustitucionvehiculos.xslt"/>
<xsl:include href="certificadodedestruccion.xslt"/>
<xsl:include href="obrasarteantiguedades.xslt"/>
<xsl:include href="ventavehiculos11.xslt"/>
<xsl:include href="terceros11.xslt"/>
-->
<!-- Aquí iniciamos el procesamiento de la cadena original con su | inicial y el terminador || -->
<xsl:template match="/">|<xsl:apply-templates select="/cfdi:Comprobante"/>||</xsl:template>
<!-- Aquí iniciamos el procesamiento de los datos incluidos en el comprobante -->
<xsl:template match="cfdi:Comprobante">
<!-- Iniciamos el tratamiento de los atributos de comprobante -->
<xsl:call-template name="Requerido">
<xsl:with-param name="valor" select="./@Version"/>
</xsl:call-template>
<xsl:call-template name="Opcional">
<xsl:with-param name="valor" select="./@Serie"/>
</xsl:call-template>
<xsl:call-template name="Opcional">
<xsl:with-param name="valor" select="./@Folio"/>
</xsl:call-template>
<xsl:call-template name="Requerido">
<xsl:with-param name="valor" select="./@Fecha"/>
</xsl:call-template>
<xsl:call-template name="Opcional">
<xsl:with-param name="valor" select="./@FormaPago"/>
</xsl:call-template>
<xsl:call-template name="Requerido">
<xsl:with-param name="valor" select="./@NoCertificado"/>
</xsl:call-template>
<xsl:call-template name="Opcional">
<xsl:with-param name="valor" select="./@CondicionesDePago"/>
</xsl:call-template>
<xsl:call-template name="Requerido">
<xsl:with-param name="valor" select="./@SubTotal"/>
</xsl:call-template>
<xsl:call-template name="Opcional">
<xsl:with-param name="valor" select="./@Descuento"/>
</xsl:call-template>
<xsl:call-template name="Requerido">
<xsl:with-param name="valor" select="./@Moneda"/>
</xsl:call-template>
<xsl:call-template name="Opcional">
<xsl:with-param name="valor" select="./@TipoCambio"/>
</xsl:call-template>
<xsl:call-template name="Requerido">
<xsl:with-param name="valor" select="./@Total"/>
</xsl:call-template>
<xsl:call-template name="Requerido">
<xsl:with-param name="valor" select="./@TipoDeComprobante"/>
</xsl:call-template>
<xsl:call-template name="Opcional">
<xsl:with-param name="valor" select="./@MetodoPago"/>
</xsl:call-template>
<xsl:call-template name="Requerido">
<xsl:with-param name="valor" select="./@LugarExpedicion"/>
</xsl:call-template>
<xsl:call-template name="Opcional">
<xsl:with-param name="valor" select="./@Confirmacion"/>
</xsl:call-template>
<!--
Llamadas para procesar al los sub nodos del comprobante
-->
<xsl:apply-templates select="./cfdi:CfdiRelacionados"/>
<xsl:apply-templates select="./cfdi:Emisor"/>
<xsl:apply-templates select="./cfdi:Receptor"/>
<xsl:apply-templates select="./cfdi:Conceptos"/>
<xsl:apply-templates select="./cfdi:Impuestos"/>
<xsl:for-each select="./cfdi:Complemento">
<xsl:apply-templates select="."/>
</xsl:for-each>
</xsl:template>
<!-- Manejador de nodos tipo CFDIRelacionados -->
<xsl:template match="cfdi:CfdiRelacionados">
<!-- Iniciamos el tratamiento de los atributos del CFDIRelacionados -->
<xsl:call-template name="Requerido">
<xsl:with-param name="valor" select="./@TipoRelacion"/>
</xsl:call-template>
<xsl:for-each select="./cfdi:CfdiRelacionado">
<xsl:call-template name="Requerido">
<xsl:with-param name="valor" select="./@UUID"/>
</xsl:call-template>
</xsl:for-each>
</xsl:template>
<!-- Manejador de nodos tipo Emisor -->
<xsl:template match="cfdi:Emisor">
<!-- Iniciamos el tratamiento de los atributos del Emisor -->
<xsl:call-template name="Requerido">
<xsl:with-param name="valor" select="./@Rfc"/>
</xsl:call-template>
<xsl:call-template name="Opcional">
<xsl:with-param name="valor" select="./@Nombre"/>
</xsl:call-template>
<xsl:call-template name="Requerido">
<xsl:with-param name="valor" select="./@RegimenFiscal"/>
</xsl:call-template>
</xsl:template>
<!-- Manejador de nodos tipo Receptor -->
<xsl:template match="cfdi:Receptor">
<!-- Iniciamos el tratamiento de los atributos del Receptor -->
<xsl:call-template name="Requerido">
<xsl:with-param name="valor" select="./@Rfc"/>
</xsl:call-template>
<xsl:call-template name="Opcional">
<xsl:with-param name="valor" select="./@Nombre"/>
</xsl:call-template>
<xsl:call-template name="Opcional">
<xsl:with-param name="valor" select="./@ResidenciaFiscal"/>
</xsl:call-template>
<xsl:call-template name="Opcional">
<xsl:with-param name="valor" select="./@NumRegIdTrib"/>
</xsl:call-template>
<xsl:call-template name="Requerido">
<xsl:with-param name="valor" select="./@UsoCFDI"/>
</xsl:call-template>
</xsl:template>
<!-- Manejador de nodos tipo Conceptos -->
<xsl:template match="cfdi:Conceptos">
<!-- Llamada para procesar los distintos nodos tipo Concepto -->
<xsl:for-each select="./cfdi:Concepto">
<xsl:apply-templates select="."/>
</xsl:for-each>
</xsl:template>
<!--Manejador de nodos tipo Concepto-->
<xsl:template match="cfdi:Concepto">
<!-- Iniciamos el tratamiento de los atributos del Concepto -->
<xsl:call-template name="Requerido">
<xsl:with-param name="valor" select="./@ClaveProdServ"/>
</xsl:call-template>
<xsl:call-template name="Opcional">
<xsl:with-param name="valor" select="./@NoIdentificacion"/>
</xsl:call-template>
<xsl:call-template name="Requerido">
<xsl:with-param name="valor" select="./@Cantidad"/>
</xsl:call-template>
<xsl:call-template name="Requerido">
<xsl:with-param name="valor" select="./@ClaveUnidad"/>
</xsl:call-template>
<xsl:call-template name="Opcional">
<xsl:with-param name="valor" select="./@Unidad"/>
</xsl:call-template>
<xsl:call-template name="Requerido">
<xsl:with-param name="valor" select="./@Descripcion"/>
</xsl:call-template>
<xsl:call-template name="Requerido">
<xsl:with-param name="valor" select="./@ValorUnitario"/>
</xsl:call-template>
<xsl:call-template name="Requerido">
<xsl:with-param name="valor" select="./@Importe"/>
</xsl:call-template>
<xsl:call-template name="Opcional">
<xsl:with-param name="valor" select="./@Descuento"/>
</xsl:call-template>
<!-- Manejo de sub nodos de información Traslado de Conceptos:Concepto:Impuestos:Traslados-->
<xsl:for-each select="./cfdi:Impuestos/cfdi:Traslados/cfdi:Traslado">
<xsl:call-template name="Requerido">
<xsl:with-param name="valor" select="./@Base"/>
</xsl:call-template>
<xsl:call-template name="Requerido">
<xsl:with-param name="valor" select="./@Impuesto"/>
</xsl:call-template>
<xsl:call-template name="Requerido">
<xsl:with-param name="valor" select="./@TipoFactor"/>
</xsl:call-template>
<xsl:call-template name="Opcional">
<xsl:with-param name="valor" select="./@TasaOCuota"/>
</xsl:call-template>
<xsl:call-template name="Opcional">
<xsl:with-param name="valor" select="./@Importe"/>
</xsl:call-template>
</xsl:for-each>
<!-- Manejo de sub nodos de Retencion por cada una de los Conceptos:Concepto:Impuestos:Retenciones-->
<xsl:for-each select="./cfdi:Impuestos/cfdi:Retenciones/cfdi:Retencion">
<xsl:call-template name="Requerido">
<xsl:with-param name="valor" select="./@Base"/>
</xsl:call-template>
<xsl:call-template name="Requerido">
<xsl:with-param name="valor" select="./@Impuesto"/>
</xsl:call-template>
<xsl:call-template name="Requerido">
<xsl:with-param name="valor" select="./@TipoFactor"/>
</xsl:call-template>
<xsl:call-template name="Requerido">
<xsl:with-param name="valor" select="./@TasaOCuota"/>
</xsl:call-template>
<xsl:call-template name="Requerido">
<xsl:with-param name="valor" select="./@Importe"/>
</xsl:call-template>
</xsl:for-each>
<!-- Manejo de los distintos sub nodos de información aduanera de forma indistinta a su grado de dependencia -->
<xsl:for-each select="./cfdi:InformacionAduanera">
<xsl:apply-templates select="."/>
</xsl:for-each>
<!-- Llamada al manejador de nodos de CuentaPredial en caso de existir -->
<xsl:if test="./cfdi:CuentaPredial">
<xsl:apply-templates select="./cfdi:CuentaPredial"/>
</xsl:if>
<!-- Llamada al manejador de nodos de ComplementoConcepto en caso de existir -->
<xsl:if test="./cfdi:ComplementoConcepto">
<xsl:apply-templates select="./cfdi:ComplementoConcepto"/>
</xsl:if>
<!-- Llamada al manejador de nodos de Parte en caso de existir -->
<xsl:for-each select=".//cfdi:Parte">
<xsl:apply-templates select="."/>
</xsl:for-each>
</xsl:template>
<!-- Manejador de nodos tipo Información Aduanera -->
<xsl:template match="cfdi:InformacionAduanera">
<!-- Manejo de los atributos de la información aduanera -->
<xsl:call-template name="Requerido">
<xsl:with-param name="valor" select="./@NumeroPedimento"/>
</xsl:call-template>
</xsl:template>
<!-- Manejador de nodos tipo Información CuentaPredial -->
<xsl:template match="cfdi:CuentaPredial">
<xsl:call-template name="Requerido">
<xsl:with-param name="valor" select="./@Numero"/>
</xsl:call-template>
</xsl:template>
<!-- Manejador de nodos tipo ComplementoConcepto -->
<xsl:template match="cfdi:ComplementoConcepto">
<xsl:for-each select="./*">
<xsl:apply-templates select="."/>
</xsl:for-each>
</xsl:template>
<!-- Manejador de nodos tipo Parte -->
<xsl:template match="cfdi:Parte">
<!-- Iniciamos el tratamiento de los atributos de Parte-->
<xsl:call-template name="Requerido">
<xsl:with-param name="valor" select="./@ClaveProdServ"/>
</xsl:call-template>
<xsl:call-template name="Opcional">
<xsl:with-param name="valor" select="./@NoIdentificacion"/>
</xsl:call-template>
<xsl:call-template name="Requerido">
<xsl:with-param name="valor" select="./@Cantidad"/>
</xsl:call-template>
<xsl:call-template name="Opcional">
<xsl:with-param name="valor" select="./@Unidad"/>
</xsl:call-template>
<xsl:call-template name="Requerido">
<xsl:with-param name="valor" select="./@Descripcion"/>
</xsl:call-template>
<xsl:call-template name="Opcional">
<xsl:with-param name="valor" select="./@ValorUnitario"/>
</xsl:call-template>
<xsl:call-template name="Opcional">
<xsl:with-param name="valor" select="./@Importe"/>
</xsl:call-template>
<!-- Manejador de nodos tipo InformacionAduanera-->
<xsl:for-each select=".//cfdi:InformacionAduanera">
<xsl:apply-templates select="."/>
</xsl:for-each>
</xsl:template>
<!-- Manejador de nodos tipo Complemento -->
<xsl:template match="cfdi:Complemento">
<xsl:for-each select="./*">
<xsl:apply-templates select="."/>
</xsl:for-each>
</xsl:template>
<!-- Manejador de nodos tipo Domicilio fiscal -->
<xsl:template match="cfdi:Impuestos">
<!-- Manejo de sub nodos de Retencion por cada una de los Impuestos:Retenciones-->
<xsl:for-each select="./cfdi:Retenciones/cfdi:Retencion">
<xsl:call-template name="Requerido">
<xsl:with-param name="valor" select="./@Impuesto"/>
</xsl:call-template>
<xsl:call-template name="Requerido">
<xsl:with-param name="valor" select="./@Importe"/>
</xsl:call-template>
</xsl:for-each>
<!-- Iniciamos el tratamiento de los atributos de TotalImpuestosRetenidos-->
<xsl:call-template name="Opcional">
<xsl:with-param name="valor" select="./@TotalImpuestosRetenidos"/>
</xsl:call-template>
<!-- Manejo de sub nodos de información Traslado de Impuestos:Traslados-->
<xsl:for-each select="./cfdi:Traslados/cfdi:Traslado">
<xsl:call-template name="Requerido">
<xsl:with-param name="valor" select="./@Impuesto"/>
</xsl:call-template>
<xsl:call-template name="Requerido">
<xsl:with-param name="valor" select="./@TipoFactor"/>
</xsl:call-template>
<xsl:call-template name="Requerido">
<xsl:with-param name="valor" select="./@TasaOCuota"/>
</xsl:call-template>
<xsl:call-template name="Requerido">
<xsl:with-param name="valor" select="./@Importe"/>
</xsl:call-template>
</xsl:for-each>
<!-- Iniciamos el tratamiento de los atributos de TotalImpuestosTrasladados-->
<xsl:call-template name="Opcional">
<xsl:with-param name="valor" select="./@TotalImpuestosTrasladados"/>
</xsl:call-template>
</xsl:template>
</xsl:stylesheet>

View File

@ -1,347 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:fn="http://www.w3.org/2005/xpath-functions" xmlns:cfdi="http://www.sat.gob.mx/cfd/3" xmlns:cce11="http://www.sat.gob.mx/ComercioExterior11" xmlns:donat="http://www.sat.gob.mx/donat" xmlns:divisas="http://www.sat.gob.mx/divisas" xmlns:implocal="http://www.sat.gob.mx/implocal" xmlns:leyendasFisc="http://www.sat.gob.mx/leyendasFiscales" xmlns:pfic="http://www.sat.gob.mx/pfic" xmlns:tpe="http://www.sat.gob.mx/TuristaPasajeroExtranjero" xmlns:nomina12="http://www.sat.gob.mx/nomina12" xmlns:registrofiscal="http://www.sat.gob.mx/registrofiscal" xmlns:pagoenespecie="http://www.sat.gob.mx/pagoenespecie" xmlns:aerolineas="http://www.sat.gob.mx/aerolineas" xmlns:valesdedespensa="http://www.sat.gob.mx/valesdedespensa" xmlns:consumodecombustibles="http://www.sat.gob.mx/consumodecombustibles" xmlns:notariospublicos="http://www.sat.gob.mx/notariospublicos" xmlns:vehiculousado="http://www.sat.gob.mx/vehiculousado" xmlns:servicioparcial="http://www.sat.gob.mx/servicioparcialconstruccion" xmlns:decreto="http://www.sat.gob.mx/renovacionysustitucionvehiculos" xmlns:destruccion="http://www.sat.gob.mx/certificadodestruccion" xmlns:obrasarte="http://www.sat.gob.mx/arteantiguedades" xmlns:ine="http://www.sat.gob.mx/ine" xmlns:iedu="http://www.sat.gob.mx/iedu" xmlns:ventavehiculos="http://www.sat.gob.mx/ventavehiculos" xmlns:terceros="http://www.sat.gob.mx/terceros" xmlns:pago10="http://www.sat.gob.mx/Pagos">
<!-- Con el siguiente método se establece que la salida deberá ser en texto -->
<xsl:output method="text" version="1.0" encoding="UTF-8" indent="no"/>
<xsl:include href="utilerias.xslt"/>
<xsl:include href="comercioexterior11.xslt"/>
<xsl:include href="leyendasFisc.xslt"/>
<xsl:include href="nomina12.xslt"/>
<xsl:include href="implocal.xslt"/>
<xsl:include href="donat11.xslt"/>
<xsl:include href="ine11.xslt"/>
<xsl:include href="iedu.xslt"/>
<xsl:include href="pagos10.xslt"/>
<xsl:include href="divisas.xslt"/>
<xsl:include href="servicioconstruccion.xslt"/>
<xsl:include href="cartaporte20.xslt"/>
<!--
<xsl:include href="ecc11.xslt"/>
<xsl:include href="pfic.xslt"/>
<xsl:include href="TuristaPasajeroExtranjero.xslt"/>
<xsl:include href="cfdiregistrofiscal.xslt"/>
<xsl:include href="pagoenespecie.xslt"/>
<xsl:include href="aerolineas.xslt"/>
<xsl:include href="valesdedespensa.xslt"/>
<xsl:include href="consumodecombustibles.xslt"/>
<xsl:include href="notariospublicos.xslt"/>
<xsl:include href="vehiculousado.xslt"/>
<xsl:include href="servicioparcialconstruccion.xslt"/>
<xsl:include href="renovacionysustitucionvehiculos.xslt"/>
<xsl:include href="certificadodedestruccion.xslt"/>
<xsl:include href="obrasarteantiguedades.xslt"/>
<xsl:include href="ventavehiculos11.xslt"/>
<xsl:include href="terceros11.xslt"/>
-->
<!-- Aquí iniciamos el procesamiento de la cadena original con su | inicial y el terminador || -->
<xsl:template match="/">|<xsl:apply-templates select="/cfdi:Comprobante"/>||</xsl:template>
<!-- Aquí iniciamos el procesamiento de los datos incluidos en el comprobante -->
<xsl:template match="cfdi:Comprobante">
<!-- Iniciamos el tratamiento de los atributos de comprobante -->
<xsl:call-template name="Requerido">
<xsl:with-param name="valor" select="./@Version"/>
</xsl:call-template>
<xsl:call-template name="Opcional">
<xsl:with-param name="valor" select="./@Serie"/>
</xsl:call-template>
<xsl:call-template name="Opcional">
<xsl:with-param name="valor" select="./@Folio"/>
</xsl:call-template>
<xsl:call-template name="Requerido">
<xsl:with-param name="valor" select="./@Fecha"/>
</xsl:call-template>
<xsl:call-template name="Opcional">
<xsl:with-param name="valor" select="./@FormaPago"/>
</xsl:call-template>
<xsl:call-template name="Requerido">
<xsl:with-param name="valor" select="./@NoCertificado"/>
</xsl:call-template>
<xsl:call-template name="Opcional">
<xsl:with-param name="valor" select="./@CondicionesDePago"/>
</xsl:call-template>
<xsl:call-template name="Requerido">
<xsl:with-param name="valor" select="./@SubTotal"/>
</xsl:call-template>
<xsl:call-template name="Opcional">
<xsl:with-param name="valor" select="./@Descuento"/>
</xsl:call-template>
<xsl:call-template name="Requerido">
<xsl:with-param name="valor" select="./@Moneda"/>
</xsl:call-template>
<xsl:call-template name="Opcional">
<xsl:with-param name="valor" select="./@TipoCambio"/>
</xsl:call-template>
<xsl:call-template name="Requerido">
<xsl:with-param name="valor" select="./@Total"/>
</xsl:call-template>
<xsl:call-template name="Requerido">
<xsl:with-param name="valor" select="./@TipoDeComprobante"/>
</xsl:call-template>
<xsl:call-template name="Opcional">
<xsl:with-param name="valor" select="./@MetodoPago"/>
</xsl:call-template>
<xsl:call-template name="Requerido">
<xsl:with-param name="valor" select="./@LugarExpedicion"/>
</xsl:call-template>
<xsl:call-template name="Opcional">
<xsl:with-param name="valor" select="./@Confirmacion"/>
</xsl:call-template>
<!--
Llamadas para procesar al los sub nodos del comprobante
-->
<xsl:apply-templates select="./cfdi:CfdiRelacionados"/>
<xsl:apply-templates select="./cfdi:Emisor"/>
<xsl:apply-templates select="./cfdi:Receptor"/>
<xsl:apply-templates select="./cfdi:Conceptos"/>
<xsl:apply-templates select="./cfdi:Impuestos"/>
<xsl:for-each select="./cfdi:Complemento">
<xsl:apply-templates select="."/>
</xsl:for-each>
</xsl:template>
<!-- Manejador de nodos tipo CFDIRelacionados -->
<xsl:template match="cfdi:CfdiRelacionados">
<!-- Iniciamos el tratamiento de los atributos del CFDIRelacionados -->
<xsl:call-template name="Requerido">
<xsl:with-param name="valor" select="./@TipoRelacion"/>
</xsl:call-template>
<xsl:for-each select="./cfdi:CfdiRelacionado">
<xsl:call-template name="Requerido">
<xsl:with-param name="valor" select="./@UUID"/>
</xsl:call-template>
</xsl:for-each>
</xsl:template>
<!-- Manejador de nodos tipo Emisor -->
<xsl:template match="cfdi:Emisor">
<!-- Iniciamos el tratamiento de los atributos del Emisor -->
<xsl:call-template name="Requerido">
<xsl:with-param name="valor" select="./@Rfc"/>
</xsl:call-template>
<xsl:call-template name="Opcional">
<xsl:with-param name="valor" select="./@Nombre"/>
</xsl:call-template>
<xsl:call-template name="Requerido">
<xsl:with-param name="valor" select="./@RegimenFiscal"/>
</xsl:call-template>
</xsl:template>
<!-- Manejador de nodos tipo Receptor -->
<xsl:template match="cfdi:Receptor">
<!-- Iniciamos el tratamiento de los atributos del Receptor -->
<xsl:call-template name="Requerido">
<xsl:with-param name="valor" select="./@Rfc"/>
</xsl:call-template>
<xsl:call-template name="Opcional">
<xsl:with-param name="valor" select="./@Nombre"/>
</xsl:call-template>
<xsl:call-template name="Opcional">
<xsl:with-param name="valor" select="./@ResidenciaFiscal"/>
</xsl:call-template>
<xsl:call-template name="Opcional">
<xsl:with-param name="valor" select="./@NumRegIdTrib"/>
</xsl:call-template>
<xsl:call-template name="Requerido">
<xsl:with-param name="valor" select="./@UsoCFDI"/>
</xsl:call-template>
</xsl:template>
<!-- Manejador de nodos tipo Conceptos -->
<xsl:template match="cfdi:Conceptos">
<!-- Llamada para procesar los distintos nodos tipo Concepto -->
<xsl:for-each select="./cfdi:Concepto">
<xsl:apply-templates select="."/>
</xsl:for-each>
</xsl:template>
<!--Manejador de nodos tipo Concepto-->
<xsl:template match="cfdi:Concepto">
<!-- Iniciamos el tratamiento de los atributos del Concepto -->
<xsl:call-template name="Requerido">
<xsl:with-param name="valor" select="./@ClaveProdServ"/>
</xsl:call-template>
<xsl:call-template name="Opcional">
<xsl:with-param name="valor" select="./@NoIdentificacion"/>
</xsl:call-template>
<xsl:call-template name="Requerido">
<xsl:with-param name="valor" select="./@Cantidad"/>
</xsl:call-template>
<xsl:call-template name="Requerido">
<xsl:with-param name="valor" select="./@ClaveUnidad"/>
</xsl:call-template>
<xsl:call-template name="Opcional">
<xsl:with-param name="valor" select="./@Unidad"/>
</xsl:call-template>
<xsl:call-template name="Requerido">
<xsl:with-param name="valor" select="./@Descripcion"/>
</xsl:call-template>
<xsl:call-template name="Requerido">
<xsl:with-param name="valor" select="./@ValorUnitario"/>
</xsl:call-template>
<xsl:call-template name="Requerido">
<xsl:with-param name="valor" select="./@Importe"/>
</xsl:call-template>
<xsl:call-template name="Opcional">
<xsl:with-param name="valor" select="./@Descuento"/>
</xsl:call-template>
<!-- Manejo de sub nodos de información Traslado de Conceptos:Concepto:Impuestos:Traslados-->
<xsl:for-each select="./cfdi:Impuestos/cfdi:Traslados/cfdi:Traslado">
<xsl:call-template name="Requerido">
<xsl:with-param name="valor" select="./@Base"/>
</xsl:call-template>
<xsl:call-template name="Requerido">
<xsl:with-param name="valor" select="./@Impuesto"/>
</xsl:call-template>
<xsl:call-template name="Requerido">
<xsl:with-param name="valor" select="./@TipoFactor"/>
</xsl:call-template>
<xsl:call-template name="Opcional">
<xsl:with-param name="valor" select="./@TasaOCuota"/>
</xsl:call-template>
<xsl:call-template name="Opcional">
<xsl:with-param name="valor" select="./@Importe"/>
</xsl:call-template>
</xsl:for-each>
<!-- Manejo de sub nodos de Retencion por cada una de los Conceptos:Concepto:Impuestos:Retenciones-->
<xsl:for-each select="./cfdi:Impuestos/cfdi:Retenciones/cfdi:Retencion">
<xsl:call-template name="Requerido">
<xsl:with-param name="valor" select="./@Base"/>
</xsl:call-template>
<xsl:call-template name="Requerido">
<xsl:with-param name="valor" select="./@Impuesto"/>
</xsl:call-template>
<xsl:call-template name="Requerido">
<xsl:with-param name="valor" select="./@TipoFactor"/>
</xsl:call-template>
<xsl:call-template name="Requerido">
<xsl:with-param name="valor" select="./@TasaOCuota"/>
</xsl:call-template>
<xsl:call-template name="Requerido">
<xsl:with-param name="valor" select="./@Importe"/>
</xsl:call-template>
</xsl:for-each>
<!-- Manejo de los distintos sub nodos de información aduanera de forma indistinta a su grado de dependencia -->
<xsl:for-each select="./cfdi:InformacionAduanera">
<xsl:apply-templates select="."/>
</xsl:for-each>
<!-- Llamada al manejador de nodos de CuentaPredial en caso de existir -->
<xsl:if test="./cfdi:CuentaPredial">
<xsl:apply-templates select="./cfdi:CuentaPredial"/>
</xsl:if>
<!-- Llamada al manejador de nodos de ComplementoConcepto en caso de existir -->
<xsl:if test="./cfdi:ComplementoConcepto">
<xsl:apply-templates select="./cfdi:ComplementoConcepto"/>
</xsl:if>
<!-- Llamada al manejador de nodos de Parte en caso de existir -->
<xsl:for-each select=".//cfdi:Parte">
<xsl:apply-templates select="."/>
</xsl:for-each>
</xsl:template>
<!-- Manejador de nodos tipo Información Aduanera -->
<xsl:template match="cfdi:InformacionAduanera">
<!-- Manejo de los atributos de la información aduanera -->
<xsl:call-template name="Requerido">
<xsl:with-param name="valor" select="./@NumeroPedimento"/>
</xsl:call-template>
</xsl:template>
<!-- Manejador de nodos tipo Información CuentaPredial -->
<xsl:template match="cfdi:CuentaPredial">
<xsl:call-template name="Requerido">
<xsl:with-param name="valor" select="./@Numero"/>
</xsl:call-template>
</xsl:template>
<!-- Manejador de nodos tipo ComplementoConcepto -->
<xsl:template match="cfdi:ComplementoConcepto">
<xsl:for-each select="./*">
<xsl:apply-templates select="."/>
</xsl:for-each>
</xsl:template>
<!-- Manejador de nodos tipo Parte -->
<xsl:template match="cfdi:Parte">
<!-- Iniciamos el tratamiento de los atributos de Parte-->
<xsl:call-template name="Requerido">
<xsl:with-param name="valor" select="./@ClaveProdServ"/>
</xsl:call-template>
<xsl:call-template name="Opcional">
<xsl:with-param name="valor" select="./@NoIdentificacion"/>
</xsl:call-template>
<xsl:call-template name="Requerido">
<xsl:with-param name="valor" select="./@Cantidad"/>
</xsl:call-template>
<xsl:call-template name="Opcional">
<xsl:with-param name="valor" select="./@Unidad"/>
</xsl:call-template>
<xsl:call-template name="Requerido">
<xsl:with-param name="valor" select="./@Descripcion"/>
</xsl:call-template>
<xsl:call-template name="Opcional">
<xsl:with-param name="valor" select="./@ValorUnitario"/>
</xsl:call-template>
<xsl:call-template name="Opcional">
<xsl:with-param name="valor" select="./@Importe"/>
</xsl:call-template>
<!-- Manejador de nodos tipo InformacionAduanera-->
<xsl:for-each select=".//cfdi:InformacionAduanera">
<xsl:apply-templates select="."/>
</xsl:for-each>
</xsl:template>
<!-- Manejador de nodos tipo Complemento -->
<xsl:template match="cfdi:Complemento">
<xsl:for-each select="./*">
<xsl:apply-templates select="."/>
</xsl:for-each>
</xsl:template>
<!-- Manejador de nodos tipo Domicilio fiscal -->
<xsl:template match="cfdi:Impuestos">
<!-- Manejo de sub nodos de Retencion por cada una de los Impuestos:Retenciones-->
<xsl:for-each select="./cfdi:Retenciones/cfdi:Retencion">
<xsl:call-template name="Requerido">
<xsl:with-param name="valor" select="./@Impuesto"/>
</xsl:call-template>
<xsl:call-template name="Requerido">
<xsl:with-param name="valor" select="./@Importe"/>
</xsl:call-template>
</xsl:for-each>
<!-- Iniciamos el tratamiento de los atributos de TotalImpuestosRetenidos-->
<xsl:call-template name="Opcional">
<xsl:with-param name="valor" select="./@TotalImpuestosRetenidos"/>
</xsl:call-template>
<!-- Manejo de sub nodos de información Traslado de Impuestos:Traslados-->
<xsl:for-each select="./cfdi:Traslados/cfdi:Traslado">
<xsl:call-template name="Requerido">
<xsl:with-param name="valor" select="./@Impuesto"/>
</xsl:call-template>
<xsl:call-template name="Requerido">
<xsl:with-param name="valor" select="./@TipoFactor"/>
</xsl:call-template>
<xsl:call-template name="Requerido">
<xsl:with-param name="valor" select="./@TasaOCuota"/>
</xsl:call-template>
<xsl:call-template name="Requerido">
<xsl:with-param name="valor" select="./@Importe"/>
</xsl:call-template>
</xsl:for-each>
<!-- Iniciamos el tratamiento de los atributos de TotalImpuestosTrasladados-->
<xsl:call-template name="Opcional">
<xsl:with-param name="valor" select="./@TotalImpuestosTrasladados"/>
</xsl:call-template>
</xsl:template>
</xsl:stylesheet>

View File

@ -1,744 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:fn="http://www.w3.org/2005/xpath-functions" xmlns:cartaporte30="http://www.sat.gob.mx/CartaPorte30">
<xsl:template match="cartaporte30:CartaPorte">
<!--Manejador de nodos tipo CartaPorte-->
<xsl:call-template name="Requerido">
<xsl:with-param name="valor" select="./@Version"/>
</xsl:call-template>
<xsl:call-template name="Requerido">
<xsl:with-param name="valor" select="./@IdCCP"/>
</xsl:call-template>
<xsl:call-template name="Requerido">
<xsl:with-param name="valor" select="./@TranspInternac"/>
</xsl:call-template>
<xsl:call-template name="Opcional">
<xsl:with-param name="valor" select="./@RegimenAduanero"/>
</xsl:call-template>
<xsl:call-template name="Opcional">
<xsl:with-param name="valor" select="./@EntradaSalidaMerc"/>
</xsl:call-template>
<xsl:call-template name="Opcional">
<xsl:with-param name="valor" select="./@PaisOrigenDestino"/>
</xsl:call-template>
<xsl:call-template name="Opcional">
<xsl:with-param name="valor" select="./@ViaEntradaSalida"/>
</xsl:call-template>
<xsl:call-template name="Opcional">
<xsl:with-param name="valor" select="./@TotalDistRec"/>
</xsl:call-template>
<xsl:call-template name="Opcional">
<xsl:with-param name="valor" select="./@RegistroISTMO"/>
</xsl:call-template>
<xsl:call-template name="Opcional">
<xsl:with-param name="valor" select="./@UbicacionPoloOrigen"/>
</xsl:call-template>
<xsl:call-template name="Opcional">
<xsl:with-param name="valor" select="./@UbicacionPoloDestino"/>
</xsl:call-template>
<!-- Iniciamos el manejo de los elementos hijo en la secuencia -->
<xsl:for-each select="./cartaporte30:Ubicaciones">
<xsl:apply-templates select="."/>
</xsl:for-each>
<xsl:for-each select="./cartaporte30:Mercancias">
<xsl:apply-templates select="."/>
</xsl:for-each>
<xsl:for-each select="./cartaporte30:FiguraTransporte">
<xsl:apply-templates select="."/>
</xsl:for-each>
</xsl:template>
<!-- Iniciamos el manejo de los elementos hijo en la secuencia Ubicaciones-->
<xsl:template match="cartaporte30:Ubicaciones">
<!-- Iniciamos el tratamiento de los atributos de Ubicacion-->
<xsl:for-each select="./cartaporte30:Ubicacion">
<xsl:apply-templates select="."/>
</xsl:for-each>
</xsl:template>
<!-- Iniciamos el manejo de los elementos hijo en la secuencia Ubicacion-->
<xsl:template match="cartaporte30:Ubicacion">
<!--Manejador de nodos tipo Ubicacion-->
<xsl:call-template name="Requerido">
<xsl:with-param name="valor" select="./@TipoUbicacion"/>
</xsl:call-template>
<xsl:call-template name="Opcional">
<xsl:with-param name="valor" select="./@IDUbicacion"/>
</xsl:call-template>
<xsl:call-template name="Requerido">
<xsl:with-param name="valor" select="./@RFCRemitenteDestinatario"/>
</xsl:call-template>
<xsl:call-template name="Opcional">
<xsl:with-param name="valor" select="./@NombreRemitenteDestinatario"/>
</xsl:call-template>
<xsl:call-template name="Opcional">
<xsl:with-param name="valor" select="./@NumRegIdTrib"/>
</xsl:call-template>
<xsl:call-template name="Opcional">
<xsl:with-param name="valor" select="./@ResidenciaFiscal"/>
</xsl:call-template>
<xsl:call-template name="Opcional">
<xsl:with-param name="valor" select="./@NumEstacion"/>
</xsl:call-template>
<xsl:call-template name="Opcional">
<xsl:with-param name="valor" select="./@NombreEstacion"/>
</xsl:call-template>
<xsl:call-template name="Opcional">
<xsl:with-param name="valor" select="./@NavegacionTrafico"/>
</xsl:call-template>
<xsl:call-template name="Requerido">
<xsl:with-param name="valor" select="./@FechaHoraSalidaLlegada"/>
</xsl:call-template>
<xsl:call-template name="Opcional">
<xsl:with-param name="valor" select="./@TipoEstacion"/>
</xsl:call-template>
<xsl:call-template name="Opcional">
<xsl:with-param name="valor" select="./@DistanciaRecorrida"/>
</xsl:call-template>
<!-- Iniciamos el tratamiento de los atributos de cartaporte30:Domicilio-->
<xsl:for-each select="./cartaporte30:Domicilio">
<!-- Iniciamos el manejo de los elementos hijo en la secuencia Domicilio-->
<!-- Iniciamos el manejo de los nodos dependientes -->
<xsl:call-template name="Opcional">
<xsl:with-param name="valor" select="./@Calle"/>
</xsl:call-template>
<xsl:call-template name="Opcional">
<xsl:with-param name="valor" select="./@NumeroExterior"/>
</xsl:call-template>
<xsl:call-template name="Opcional">
<xsl:with-param name="valor" select="./@NumeroInterior"/>
</xsl:call-template>
<xsl:call-template name="Opcional">
<xsl:with-param name="valor" select="./@Colonia"/>
</xsl:call-template>
<xsl:call-template name="Opcional">
<xsl:with-param name="valor" select="./@Localidad"/>
</xsl:call-template>
<xsl:call-template name="Opcional">
<xsl:with-param name="valor" select="./@Referencia"/>
</xsl:call-template>
<xsl:call-template name="Opcional">
<xsl:with-param name="valor" select="./@Municipio"/>
</xsl:call-template>
<xsl:call-template name="Requerido">
<xsl:with-param name="valor" select="./@Estado"/>
</xsl:call-template>
<xsl:call-template name="Requerido">
<xsl:with-param name="valor" select="./@Pais"/>
</xsl:call-template>
<xsl:call-template name="Requerido">
<xsl:with-param name="valor" select="./@CodigoPostal"/>
</xsl:call-template>
</xsl:for-each>
</xsl:template>
<!-- Iniciamos el manejo de los elementos hijo en la secuencia Origen-->
<xsl:template match="cartaporte30:Mercancias">
<!--Manejador de nodos tipo cartaporte30:Mercancias-->
<xsl:call-template name="Requerido">
<xsl:with-param name="valor" select="./@PesoBrutoTotal"/>
</xsl:call-template>
<xsl:call-template name="Requerido">
<xsl:with-param name="valor" select="./@UnidadPeso"/>
</xsl:call-template>
<xsl:call-template name="Opcional">
<xsl:with-param name="valor" select="./@PesoNetoTotal"/>
</xsl:call-template>
<xsl:call-template name="Requerido">
<xsl:with-param name="valor" select="./@NumTotalMercancias"/>
</xsl:call-template>
<xsl:call-template name="Opcional">
<xsl:with-param name="valor" select="./@CargoPorTasacion"/>
</xsl:call-template>
<xsl:call-template name="Opcional">
<xsl:with-param name="valor" select="./@LogisticaInversaRecoleccionDevolucion"/>
</xsl:call-template>
<!-- Iniciamos el tratamiento de los atributos de cartaporte30:Mercancia-->
<xsl:for-each select="./cartaporte30:Mercancia">
<xsl:apply-templates select="."/>
</xsl:for-each>
<!-- Iniciamos el tratamiento de los atributos de cartaporte30:Autotransporte-->
<xsl:for-each select="./cartaporte30:Autotransporte">
<xsl:apply-templates select="."/>
</xsl:for-each>
<!-- Iniciamos el tratamiento de los atributos de cartaporte30:TransporteMaritimo-->
<xsl:for-each select="./cartaporte30:TransporteMaritimo">
<xsl:apply-templates select="."/>
</xsl:for-each>
<!-- Iniciamos el tratamiento de los atributos de cartaporte30:TransporteAereo-->
<xsl:for-each select="./cartaporte30:TransporteAereo">
<xsl:apply-templates select="."/>
</xsl:for-each>
<!-- Iniciamos el tratamiento de los atributos de cartaporte30:TransporteFerroviario-->
<xsl:for-each select="./cartaporte30:TransporteFerroviario">
<xsl:apply-templates select="."/>
</xsl:for-each>
</xsl:template>
<!-- Iniciamos el manejo de los elementos hijo en la secuencia Mercancia-->
<xsl:template match="cartaporte30:Mercancia">
<!--Manejador de nodos tipo cartaporte30:Mercancia-->
<xsl:call-template name="Requerido">
<xsl:with-param name="valor" select="./@BienesTransp"/>
</xsl:call-template>
<xsl:call-template name="Opcional">
<xsl:with-param name="valor" select="./@ClaveSTCC"/>
</xsl:call-template>
<xsl:call-template name="Requerido">
<xsl:with-param name="valor" select="./@Descripcion"/>
</xsl:call-template>
<xsl:call-template name="Requerido">
<xsl:with-param name="valor" select="./@Cantidad"/>
</xsl:call-template>
<xsl:call-template name="Requerido">
<xsl:with-param name="valor" select="./@ClaveUnidad"/>
</xsl:call-template>
<xsl:call-template name="Opcional">
<xsl:with-param name="valor" select="./@Unidad"/>
</xsl:call-template>
<xsl:call-template name="Opcional">
<xsl:with-param name="valor" select="./@Dimensiones"/>
</xsl:call-template>
<xsl:call-template name="Opcional">
<xsl:with-param name="valor" select="./@MaterialPeligroso"/>
</xsl:call-template>
<xsl:call-template name="Opcional">
<xsl:with-param name="valor" select="./@CveMaterialPeligroso"/>
</xsl:call-template>
<xsl:call-template name="Opcional">
<xsl:with-param name="valor" select="./@Embalaje"/>
</xsl:call-template>
<xsl:call-template name="Opcional">
<xsl:with-param name="valor" select="./@DescripEmbalaje"/>
</xsl:call-template>
<xsl:call-template name="Opcional">
<xsl:with-param name="valor" select="./@SectorCOFEPRIS"/>
</xsl:call-template>
<xsl:call-template name="Opcional">
<xsl:with-param name="valor" select="./@NombreIngredienteActivo"/>
</xsl:call-template>
<xsl:call-template name="Opcional">
<xsl:with-param name="valor" select="./@NomQuimico"/>
</xsl:call-template>
<xsl:call-template name="Opcional">
<xsl:with-param name="valor" select="./@DenominacionGenericaProd"/>
</xsl:call-template>
<xsl:call-template name="Opcional">
<xsl:with-param name="valor" select="./@DenominacionDistintivaProd"/>
</xsl:call-template>
<xsl:call-template name="Opcional">
<xsl:with-param name="valor" select="./@Fabricante"/>
</xsl:call-template>
<xsl:call-template name="Opcional">
<xsl:with-param name="valor" select="./@FechaCaducidad"/>
</xsl:call-template>
<xsl:call-template name="Opcional">
<xsl:with-param name="valor" select="./@LoteMedicamento"/>
</xsl:call-template>
<xsl:call-template name="Opcional">
<xsl:with-param name="valor" select="./@FormaFarmaceutica"/>
</xsl:call-template>
<xsl:call-template name="Opcional">
<xsl:with-param name="valor" select="./@CondicionesEspTransp"/>
</xsl:call-template>
<xsl:call-template name="Opcional">
<xsl:with-param name="valor" select="./@RegistroSanitarioFolioAutorizacion"/>
</xsl:call-template>
<xsl:call-template name="Opcional">
<xsl:with-param name="valor" select="./@PermisoImportacion"/>
</xsl:call-template>
<xsl:call-template name="Opcional">
<xsl:with-param name="valor" select="./@FolioImpoVUCEM"/>
</xsl:call-template>
<xsl:call-template name="Opcional">
<xsl:with-param name="valor" select="./@NumCAS"/>
</xsl:call-template>
<xsl:call-template name="Opcional">
<xsl:with-param name="valor" select="./@RazonSocialEmpImp"/>
</xsl:call-template>
<xsl:call-template name="Opcional">
<xsl:with-param name="valor" select="./@NumRegSanPlagCOFEPRIS"/>
</xsl:call-template>
<xsl:call-template name="Opcional">
<xsl:with-param name="valor" select="./@DatosFabricante"/>
</xsl:call-template>
<xsl:call-template name="Opcional">
<xsl:with-param name="valor" select="./@DatosFormulador"/>
</xsl:call-template>
<xsl:call-template name="Opcional">
<xsl:with-param name="valor" select="./@DatosMaquilador"/>
</xsl:call-template>
<xsl:call-template name="Opcional">
<xsl:with-param name="valor" select="./@UsoAutorizado"/>
</xsl:call-template>
<xsl:call-template name="Requerido">
<xsl:with-param name="valor" select="./@PesoEnKg"/>
</xsl:call-template>
<xsl:call-template name="Opcional">
<xsl:with-param name="valor" select="./@ValorMercancia"/>
</xsl:call-template>
<xsl:call-template name="Opcional">
<xsl:with-param name="valor" select="./@Moneda"/>
</xsl:call-template>
<xsl:call-template name="Opcional">
<xsl:with-param name="valor" select="./@FraccionArancelaria"/>
</xsl:call-template>
<xsl:call-template name="Opcional">
<xsl:with-param name="valor" select="./@UUIDComercioExt"/>
</xsl:call-template>
<xsl:call-template name="Opcional">
<xsl:with-param name="valor" select="./@TipoMateria"/>
</xsl:call-template>
<xsl:call-template name="Opcional">
<xsl:with-param name="valor" select="./@DescripcionMateria"/>
</xsl:call-template>
<!-- Iniciamos el tratamiento de los atributos de cartaporte30:DocumentacionAduanera-->
<xsl:for-each select="./cartaporte30:DocumentacionAduanera">
<xsl:apply-templates select="."/>
</xsl:for-each>
<!-- Iniciamos el tratamiento de los atributos de cartaporte30:GuiasIdentificacion-->
<xsl:for-each select="./cartaporte30:GuiasIdentificacion">
<xsl:apply-templates select="."/>
</xsl:for-each>
<!-- Iniciamos el tratamiento de los atributos de cartaporte30:CantidadTransporta-->
<xsl:for-each select="./cartaporte30:CantidadTransporta">
<xsl:apply-templates select="."/>
</xsl:for-each>
<!-- Iniciamos el tratamiento de los atributos de cartaporte30:DetalleMercancia-->
<xsl:for-each select="./cartaporte30:DetalleMercancia">
<xsl:apply-templates select="."/>
</xsl:for-each>
</xsl:template>
<!-- Iniciamos el manejo de los elementos hijo en la secuencia DocumentacionAduanera-->
<xsl:template match="cartaporte30:DocumentacionAduanera">
<!-- Iniciamos el manejo de los nodos dependientes -->
<xsl:call-template name="Requerido">
<xsl:with-param name="valor" select="./@TipoDocumento"/>
</xsl:call-template>
<xsl:call-template name="Opcional">
<xsl:with-param name="valor" select="./@NumPedimento"/>
</xsl:call-template>
<xsl:call-template name="Opcional">
<xsl:with-param name="valor" select="./@IdentDocAduanero"/>
</xsl:call-template>
<xsl:call-template name="Opcional">
<xsl:with-param name="valor" select="./@RFCImpo"/>
</xsl:call-template>
</xsl:template>
<!-- Iniciamos el manejo de los elementos hijo en la secuencia GuiasIdentificacion-->
<xsl:template match="cartaporte30:GuiasIdentificacion">
<!-- Iniciamos el manejo de los nodos dependientes -->
<xsl:call-template name="Requerido">
<xsl:with-param name="valor" select="./@NumeroGuiaIdentificacion"/>
</xsl:call-template>
<xsl:call-template name="Requerido">
<xsl:with-param name="valor" select="./@DescripGuiaIdentificacion"/>
</xsl:call-template>
<xsl:call-template name="Requerido">
<xsl:with-param name="valor" select="./@PesoGuiaIdentificacion"/>
</xsl:call-template>
</xsl:template>
<!-- Iniciamos el manejo de los elementos hijo en la secuencia CantidadTransporta-->
<xsl:template match="cartaporte30:CantidadTransporta">
<!-- Iniciamos el manejo de los nodos dependientes -->
<xsl:call-template name="Requerido">
<xsl:with-param name="valor" select="./@Cantidad"/>
</xsl:call-template>
<xsl:call-template name="Requerido">
<xsl:with-param name="valor" select="./@IDOrigen"/>
</xsl:call-template>
<xsl:call-template name="Requerido">
<xsl:with-param name="valor" select="./@IDDestino"/>
</xsl:call-template>
<xsl:call-template name="Opcional">
<xsl:with-param name="valor" select="./@CvesTransporte"/>
</xsl:call-template>
</xsl:template>
<!-- Iniciamos el manejo de los elementos hijo en la secuencia DetalleMercancia-->
<xsl:template match="cartaporte30:DetalleMercancia">
<!-- Iniciamos el manejo de los nodos dependientes -->
<xsl:call-template name="Requerido">
<xsl:with-param name="valor" select="./@UnidadPesoMerc"/>
</xsl:call-template>
<xsl:call-template name="Requerido">
<xsl:with-param name="valor" select="./@PesoBruto"/>
</xsl:call-template>
<xsl:call-template name="Requerido">
<xsl:with-param name="valor" select="./@PesoNeto"/>
</xsl:call-template>
<xsl:call-template name="Requerido">
<xsl:with-param name="valor" select="./@PesoTara"/>
</xsl:call-template>
<xsl:call-template name="Opcional">
<xsl:with-param name="valor" select="./@NumPiezas"/>
</xsl:call-template>
</xsl:template>
<!-- Iniciamos el manejo de los elementos hijo en la secuencia Autotransporte-->
<xsl:template match="cartaporte30:Autotransporte">
<!--Manejador de nodos tipo cartaporte30:Autotransporte-->
<xsl:call-template name="Requerido">
<xsl:with-param name="valor" select="./@PermSCT"/>
</xsl:call-template>
<xsl:call-template name="Requerido">
<xsl:with-param name="valor" select="./@NumPermisoSCT"/>
</xsl:call-template>
<!-- Iniciamos el tratamiento de los atributos de cartaporte30:IdentificacionVehicular-->
<xsl:for-each select="./cartaporte30:IdentificacionVehicular">
<xsl:apply-templates select="."/>
</xsl:for-each>
<!-- Iniciamos el tratamiento de los atributos de cartaporte30:Seguros-->
<xsl:for-each select="./cartaporte30:Seguros">
<xsl:apply-templates select="."/>
</xsl:for-each>
<!-- Iniciamos el tratamiento de los atributos de cartaporte30:Remolques-->
<xsl:for-each select="./cartaporte30:Remolques">
<xsl:apply-templates select="."/>
</xsl:for-each>
</xsl:template>
<!-- Iniciamos el manejo de los elementos hijo en la secuencia IdentificacionVehicular-->
<xsl:template match="cartaporte30:IdentificacionVehicular">
<!-- Iniciamos el manejo de los nodos dependientes -->
<xsl:call-template name="Requerido">
<xsl:with-param name="valor" select="./@ConfigVehicular"/>
</xsl:call-template>
<xsl:call-template name="Requerido">
<xsl:with-param name="valor" select="./@PesoBrutoVehicular"/>
</xsl:call-template>
<xsl:call-template name="Requerido">
<xsl:with-param name="valor" select="./@PlacaVM"/>
</xsl:call-template>
<xsl:call-template name="Requerido">
<xsl:with-param name="valor" select="./@AnioModeloVM"/>
</xsl:call-template>
</xsl:template>
<!-- Iniciamos el manejo de los elementos hijo en la secuencia Seguros-->
<xsl:template match="cartaporte30:Seguros">
<!-- Iniciamos el manejo de los nodos dependientes -->
<xsl:call-template name="Requerido">
<xsl:with-param name="valor" select="./@AseguraRespCivil"/>
</xsl:call-template>
<xsl:call-template name="Requerido">
<xsl:with-param name="valor" select="./@PolizaRespCivil"/>
</xsl:call-template>
<xsl:call-template name="Opcional">
<xsl:with-param name="valor" select="./@AseguraMedAmbiente"/>
</xsl:call-template>
<xsl:call-template name="Opcional">
<xsl:with-param name="valor" select="./@PolizaMedAmbiente"/>
</xsl:call-template>
<xsl:call-template name="Opcional">
<xsl:with-param name="valor" select="./@AseguraCarga"/>
</xsl:call-template>
<xsl:call-template name="Opcional">
<xsl:with-param name="valor" select="./@PolizaCarga"/>
</xsl:call-template>
<xsl:call-template name="Opcional">
<xsl:with-param name="valor" select="./@PrimaSeguro"/>
</xsl:call-template>
</xsl:template>
<!-- Iniciamos el manejo de los elementos hijo en la secuencia Remolques-->
<xsl:template match="cartaporte30:Remolques">
<!-- Iniciamos el tratamiento de los atributos de cartaporte30:Remolque-->
<xsl:for-each select="./cartaporte30:Remolque">
<xsl:apply-templates select="."/>
</xsl:for-each>
</xsl:template>
<!-- Iniciamos el manejo de los elementos hijo en la secuencia Remolque-->
<xsl:template match="cartaporte30:Remolque">
<!-- Iniciamos el manejo de los nodos dependientes -->
<xsl:call-template name="Requerido">
<xsl:with-param name="valor" select="./@SubTipoRem"/>
</xsl:call-template>
<xsl:call-template name="Requerido">
<xsl:with-param name="valor" select="./@Placa"/>
</xsl:call-template>
</xsl:template>
<!-- Iniciamos el manejo de los elementos hijo en la secuencia TransporteMaritimo-->
<xsl:template match="cartaporte30:TransporteMaritimo">
<!--Manejador de nodos tipo cartaporte30:TransporteMaritimo-->
<xsl:call-template name="Opcional">
<xsl:with-param name="valor" select="./@PermSCT"/>
</xsl:call-template>
<xsl:call-template name="Opcional">
<xsl:with-param name="valor" select="./@NumPermisoSCT"/>
</xsl:call-template>
<xsl:call-template name="Opcional">
<xsl:with-param name="valor" select="./@NombreAseg"/>
</xsl:call-template>
<xsl:call-template name="Opcional">
<xsl:with-param name="valor" select="./@NumPolizaSeguro"/>
</xsl:call-template>
<xsl:call-template name="Requerido">
<xsl:with-param name="valor" select="./@TipoEmbarcacion"/>
</xsl:call-template>
<xsl:call-template name="Requerido">
<xsl:with-param name="valor" select="./@Matricula"/>
</xsl:call-template>
<xsl:call-template name="Requerido">
<xsl:with-param name="valor" select="./@NumeroOMI"/>
</xsl:call-template>
<xsl:call-template name="Opcional">
<xsl:with-param name="valor" select="./@AnioEmbarcacion"/>
</xsl:call-template>
<xsl:call-template name="Opcional">
<xsl:with-param name="valor" select="./@NombreEmbarc"/>
</xsl:call-template>
<xsl:call-template name="Requerido">
<xsl:with-param name="valor" select="./@NacionalidadEmbarc"/>
</xsl:call-template>
<xsl:call-template name="Requerido">
<xsl:with-param name="valor" select="./@UnidadesDeArqBruto"/>
</xsl:call-template>
<xsl:call-template name="Requerido">
<xsl:with-param name="valor" select="./@TipoCarga"/>
</xsl:call-template>
<xsl:call-template name="Opcional">
<xsl:with-param name="valor" select="./@Eslora"/>
</xsl:call-template>
<xsl:call-template name="Opcional">
<xsl:with-param name="valor" select="./@Manga"/>
</xsl:call-template>
<xsl:call-template name="Opcional">
<xsl:with-param name="valor" select="./@Calado"/>
</xsl:call-template>
<xsl:call-template name="Opcional">
<xsl:with-param name="valor" select="./@Puntal"/>
</xsl:call-template>
<xsl:call-template name="Opcional">
<xsl:with-param name="valor" select="./@LineaNaviera"/>
</xsl:call-template>
<xsl:call-template name="Requerido">
<xsl:with-param name="valor" select="./@NombreAgenteNaviero"/>
</xsl:call-template>
<xsl:call-template name="Requerido">
<xsl:with-param name="valor" select="./@NumAutorizacionNaviero"/>
</xsl:call-template>
<xsl:call-template name="Opcional">
<xsl:with-param name="valor" select="./@NumViaje"/>
</xsl:call-template>
<xsl:call-template name="Opcional">
<xsl:with-param name="valor" select="./@NumConocEmbarc"/>
</xsl:call-template>
<xsl:call-template name="Opcional">
<xsl:with-param name="valor" select="./@PermisoTempNavegacion"/>
</xsl:call-template>
<!-- Iniciamos el tratamiento de los atributos de cartaporte30:Contenedor-->
<xsl:for-each select="./cartaporte30:Contenedor">
<!-- Iniciamos el manejo de los elementos hijo en la secuencia Contenedor-->
<!-- Iniciamos el manejo de los nodos dependientes -->
<xsl:call-template name="Requerido">
<xsl:with-param name="valor" select="./@TipoContenedor"/>
</xsl:call-template>
<xsl:call-template name="Opcional">
<xsl:with-param name="valor" select="./@MatriculaContenedor"/>
</xsl:call-template>
<xsl:call-template name="Opcional">
<xsl:with-param name="valor" select="./@NumPrecinto"/>
</xsl:call-template>
<xsl:call-template name="Opcional">
<xsl:with-param name="valor" select="./@IdCCPRelacionado"/>
</xsl:call-template>
<xsl:call-template name="Opcional">
<xsl:with-param name="valor" select="./@PlacaVMCCP"/>
</xsl:call-template>
<xsl:call-template name="Opcional">
<xsl:with-param name="valor" select="./@FechaCertificacionCCP"/>
</xsl:call-template>
</xsl:for-each>
<!-- Iniciamos el tratamiento de los atributos de cartaporte30:RemolquesCCP-->
<xsl:for-each select="./cartaporte30:RemolquesCCP">
<xsl:apply-templates select="."/>
</xsl:for-each>
</xsl:template>
<!-- Iniciamos el manejo de los elementos hijo en la secuencia RemolquesCCP-->
<xsl:template match="cartaporte30:RemolquesCCP">
<!-- Iniciamos el tratamiento de los atributos de cartaporte30:RemolqueCCP-->
<xsl:for-each select="./cartaporte30:RemolqueCCP">
<xsl:apply-templates select="."/>
</xsl:for-each>
</xsl:template>
<!-- Iniciamos el manejo de los elementos hijo en la secuencia RemolqueCCP-->
<xsl:template match="cartaporte30:RemolqueCCP">
<!-- Iniciamos el manejo de los nodos dependientes -->
<xsl:call-template name="Requerido">
<xsl:with-param name="valor" select="./@SubTipoRemCCP"/>
</xsl:call-template>
<xsl:call-template name="Requerido">
<xsl:with-param name="valor" select="./@PlacaCCP"/>
</xsl:call-template>
</xsl:template>
<!-- Iniciamos el manejo de los elementos hijo en la secuencia TransporteAereo-->
<xsl:template match="cartaporte30:TransporteAereo">
<!--Manejador de nodos tipo cartaporte30:TransporteAereo-->
<xsl:call-template name="Requerido">
<xsl:with-param name="valor" select="./@PermSCT"/>
</xsl:call-template>
<xsl:call-template name="Requerido">
<xsl:with-param name="valor" select="./@NumPermisoSCT"/>
</xsl:call-template>
<xsl:call-template name="Opcional">
<xsl:with-param name="valor" select="./@MatriculaAeronave"/>
</xsl:call-template>
<xsl:call-template name="Opcional">
<xsl:with-param name="valor" select="./@NombreAseg"/>
</xsl:call-template>
<xsl:call-template name="Opcional">
<xsl:with-param name="valor" select="./@NumPolizaSeguro"/>
</xsl:call-template>
<xsl:call-template name="Requerido">
<xsl:with-param name="valor" select="./@NumeroGuia"/>
</xsl:call-template>
<xsl:call-template name="Opcional">
<xsl:with-param name="valor" select="./@LugarContrato"/>
</xsl:call-template>
<xsl:call-template name="Requerido">
<xsl:with-param name="valor" select="./@CodigoTransportista"/>
</xsl:call-template>
<xsl:call-template name="Opcional">
<xsl:with-param name="valor" select="./@RFCEmbarcador"/>
</xsl:call-template>
<xsl:call-template name="Opcional">
<xsl:with-param name="valor" select="./@NumRegIdTribEmbarc"/>
</xsl:call-template>
<xsl:call-template name="Opcional">
<xsl:with-param name="valor" select="./@ResidenciaFiscalEmbarc"/>
</xsl:call-template>
<xsl:call-template name="Opcional">
<xsl:with-param name="valor" select="./@NombreEmbarcador"/>
</xsl:call-template>
</xsl:template>
<!-- Iniciamos el manejo de los elementos hijo en la secuencia TransporteFerroviario-->
<xsl:template match="cartaporte30:TransporteFerroviario">
<!--Manejador de nodos tipo cartaporte30:TransporteFerroviario-->
<xsl:call-template name="Requerido">
<xsl:with-param name="valor" select="./@TipoDeServicio"/>
</xsl:call-template>
<xsl:call-template name="Requerido">
<xsl:with-param name="valor" select="./@TipoDeTrafico"/>
</xsl:call-template>
<xsl:call-template name="Opcional">
<xsl:with-param name="valor" select="./@NombreAseg"/>
</xsl:call-template>
<xsl:call-template name="Opcional">
<xsl:with-param name="valor" select="./@NumPolizaSeguro"/>
</xsl:call-template>
<!-- Iniciamos el tratamiento de los atributos de cartaporte30:DerechosDePaso-->
<xsl:for-each select="./cartaporte30:DerechosDePaso">
<xsl:apply-templates select="."/>
</xsl:for-each>
<!-- Iniciamos el tratamiento de los atributos de cartaporte30:Carro-->
<xsl:for-each select="./cartaporte30:Carro">
<xsl:apply-templates select="."/>
</xsl:for-each>
</xsl:template>
<!-- Iniciamos el manejo de los elementos hijo en la secuencia DerechosDePaso-->
<xsl:template match="cartaporte30:DerechosDePaso">
<!-- Iniciamos el manejo de los nodos dependientes -->
<xsl:call-template name="Requerido">
<xsl:with-param name="valor" select="./@TipoDerechoDePaso"/>
</xsl:call-template>
<xsl:call-template name="Requerido">
<xsl:with-param name="valor" select="./@KilometrajePagado"/>
</xsl:call-template>
</xsl:template>
<!-- Iniciamos el manejo de los elementos hijo en la secuencia Carro-->
<xsl:template match="cartaporte30:Carro">
<!--Manejador de nodos tipo cartaporte30:Carro-->
<xsl:call-template name="Requerido">
<xsl:with-param name="valor" select="./@TipoCarro"/>
</xsl:call-template>
<xsl:call-template name="Requerido">
<xsl:with-param name="valor" select="./@MatriculaCarro"/>
</xsl:call-template>
<xsl:call-template name="Requerido">
<xsl:with-param name="valor" select="./@GuiaCarro"/>
</xsl:call-template>
<xsl:call-template name="Requerido">
<xsl:with-param name="valor" select="./@ToneladasNetasCarro"/>
</xsl:call-template>
<!-- Iniciamos el tratamiento de los atributos de cartaporte30:Contenedor -->
<xsl:for-each select="./cartaporte30:Contenedor ">
<!-- Iniciamos el manejo de los elementos hijo en la secuencia Contenedor-->
<!-- Iniciamos el manejo de los nodos dependientes -->
<xsl:call-template name="Requerido">
<xsl:with-param name="valor" select="./@TipoContenedor"/>
</xsl:call-template>
<xsl:call-template name="Requerido">
<xsl:with-param name="valor" select="./@PesoContenedorVacio"/>
</xsl:call-template>
<xsl:call-template name="Requerido">
<xsl:with-param name="valor" select="./@PesoNetoMercancia"/>
</xsl:call-template>
</xsl:for-each>
</xsl:template>
<!-- Iniciamos el manejo de los elementos hijo en la secuencia FiguraTransporte-->
<xsl:template match="cartaporte30:FiguraTransporte">
<!--Manejador de nodos tipo cartaporte30:FiguraTransporte-->
<!-- Iniciamos el tratamiento de los atributos de cartaporte30:TiposFigura-->
<xsl:for-each select="./cartaporte30:TiposFigura ">
<xsl:apply-templates select="."/>
</xsl:for-each>
</xsl:template>
<!-- Iniciamos el manejo de los elementos hijo en la secuencia TiposFigura-->
<xsl:template match="cartaporte30:TiposFigura">
<!-- Iniciamos el tratamiento de los atributos de cartaporte30:TiposFigura-->
<xsl:call-template name="Requerido">
<xsl:with-param name="valor" select="./@TipoFigura"/>
</xsl:call-template>
<xsl:call-template name="Opcional">
<xsl:with-param name="valor" select="./@RFCFigura"/>
</xsl:call-template>
<xsl:call-template name="Opcional">
<xsl:with-param name="valor" select="./@NumLicencia"/>
</xsl:call-template>
<xsl:call-template name="Requerido">
<xsl:with-param name="valor" select="./@NombreFigura"/>
</xsl:call-template>
<xsl:call-template name="Opcional">
<xsl:with-param name="valor" select="./@NumRegIdTribFigura"/>
</xsl:call-template>
<xsl:call-template name="Opcional">
<xsl:with-param name="valor" select="./@ResidenciaFiscalFigura"/>
</xsl:call-template>
<xsl:for-each select="./cartaporte30:PartesTransporte">
<xsl:apply-templates select="."/>
</xsl:for-each>
<!-- Iniciamos el tratamiento de los atributos de cartaporte30:Domicilio -->
<xsl:for-each select="./cartaporte30:Domicilio ">
<!-- Iniciamos el manejo de los elementos hijo en la secuencia Domicilio -->
<!-- Iniciamos el manejo de los nodos dependientes -->
<xsl:call-template name="Opcional">
<xsl:with-param name="valor" select="./@Calle"/>
</xsl:call-template>
<xsl:call-template name="Opcional">
<xsl:with-param name="valor" select="./@NumeroExterior"/>
</xsl:call-template>
<xsl:call-template name="Opcional">
<xsl:with-param name="valor" select="./@NumeroInterior"/>
</xsl:call-template>
<xsl:call-template name="Opcional">
<xsl:with-param name="valor" select="./@Colonia"/>
</xsl:call-template>
<xsl:call-template name="Opcional">
<xsl:with-param name="valor" select="./@Localidad"/>
</xsl:call-template>
<xsl:call-template name="Opcional">
<xsl:with-param name="valor" select="./@Referencia"/>
</xsl:call-template>
<xsl:call-template name="Opcional">
<xsl:with-param name="valor" select="./@Municipio"/>
</xsl:call-template>
<xsl:call-template name="Requerido">
<xsl:with-param name="valor" select="./@Estado"/>
</xsl:call-template>
<xsl:call-template name="Requerido">
<xsl:with-param name="valor" select="./@Pais"/>
</xsl:call-template>
<xsl:call-template name="Requerido">
<xsl:with-param name="valor" select="./@CodigoPostal"/>
</xsl:call-template>
</xsl:for-each>
</xsl:template>
<!-- Iniciamos el manejo de los elementos hijo en la secuencia PartesTransporte -->
<xsl:template match="cartaporte30:PartesTransporte">
<!-- Manejador de nodos tipo cartaporte30:PartesTransporte -->
<xsl:call-template name="Requerido">
<xsl:with-param name="valor" select="./@ParteTransporte"/>
</xsl:call-template>
</xsl:template>
</xsl:stylesheet>

View File

@ -1,171 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:fn="http://www.w3.org/2005/xpath-functions" xmlns:cce20="http://www.sat.gob.mx/ComercioExterior20">
<xsl:template match="cce20:ComercioExterior">
<!--Manejador de nodos tipo ComercioExterior-->
<xsl:call-template name="Requerido">
<xsl:with-param name="valor" select="./@Version" />
</xsl:call-template>
<xsl:call-template name="Opcional">
<xsl:with-param name="valor" select="./@MotivoTraslado" />
</xsl:call-template>
<xsl:call-template name="Requerido">
<xsl:with-param name="valor" select="./@ClaveDePedimento" />
</xsl:call-template>
<xsl:call-template name="Requerido">
<xsl:with-param name="valor" select="./@CertificadoOrigen" />
</xsl:call-template>
<xsl:call-template name="Opcional">
<xsl:with-param name="valor" select="./@NumCertificadoOrigen" />
</xsl:call-template>
<xsl:call-template name="Opcional">
<xsl:with-param name="valor" select="./@NumeroExportadorConfiable" />
</xsl:call-template>
<xsl:call-template name="Opcional">
<xsl:with-param name="valor" select="./@Incoterm" />
</xsl:call-template>
<xsl:call-template name="Opcional">
<xsl:with-param name="valor" select="./@Observaciones" />
</xsl:call-template>
<xsl:call-template name="Requerido">
<xsl:with-param name="valor" select="./@TipoCambioUSD" />
</xsl:call-template>
<xsl:call-template name="Requerido">
<xsl:with-param name="valor" select="./@TotalUSD" />
</xsl:call-template>
<!-- Iniciamos el manejo de los elementos hijo en la secuencia -->
<xsl:apply-templates select="./cce20:Emisor" />
<xsl:apply-templates select="./cce20:Receptor" />
<xsl:for-each select="./cce20:Destinatario">
<xsl:apply-templates select="."/>
</xsl:for-each>
<xsl:apply-templates select="./cce20:Mercancias" />
</xsl:template>
<xsl:template match="cce20:Emisor">
<!-- Iniciamos el tratamiento de los atributos de cce20:Emisor-->
<xsl:call-template name="Opcional">
<xsl:with-param name="valor" select="./@Curp" />
</xsl:call-template>
<xsl:apply-templates select="./cce20:Domicilio" />
</xsl:template>
<xsl:template match="cce20:Propietario">
<!-- Iniciamos el tratamiento de los atributos de cce20:Propietario-->
<xsl:call-template name="Requerido">
<xsl:with-param name="valor" select="./@NumRegIdTrib" />
</xsl:call-template>
<xsl:call-template name="Requerido">
<xsl:with-param name="valor" select="./@ResidenciaFiscal" />
</xsl:call-template>
</xsl:template>
<xsl:template match="cce20:Receptor">
<!-- Tratamiento de los atributos de cce20:Receptor-->
<xsl:call-template name="Opcional">
<xsl:with-param name="valor" select="./@NumRegIdTrib" />
</xsl:call-template>
<xsl:apply-templates select="./cce20:Domicilio" />
</xsl:template>
<xsl:template match="cce20:Destinatario">
<!-- Tratamiento de los atributos de cce20:Destinatario-->
<xsl:call-template name="Opcional">
<xsl:with-param name="valor" select="./@NumRegIdTrib" />
</xsl:call-template>
<xsl:call-template name="Opcional">
<xsl:with-param name="valor" select="./@Nombre" />
</xsl:call-template>
<!-- Manejo de los nodos dependientes -->
<xsl:for-each select="./cce20:Domicilio">
<xsl:apply-templates select="."/>
</xsl:for-each>
</xsl:template>
<xsl:template match="cce20:Mercancias">
<!-- Iniciamos el manejo de los nodos dependientes -->
<xsl:for-each select="./cce20:Mercancia">
<xsl:apply-templates select="."/>
</xsl:for-each>
</xsl:template>
<xsl:template match="cce20:Domicilio">
<!-- Iniciamos el tratamiento de los atributos de cce20:Domicilio-->
<xsl:call-template name="Requerido">
<xsl:with-param name="valor" select="./@Calle" />
</xsl:call-template>
<xsl:call-template name="Opcional">
<xsl:with-param name="valor" select="./@NumeroExterior" />
</xsl:call-template>
<xsl:call-template name="Opcional">
<xsl:with-param name="valor" select="./@NumeroInterior" />
</xsl:call-template>
<xsl:call-template name="Opcional">
<xsl:with-param name="valor" select="./@Colonia" />
</xsl:call-template>
<xsl:call-template name="Opcional">
<xsl:with-param name="valor" select="./@Localidad" />
</xsl:call-template>
<xsl:call-template name="Opcional">
<xsl:with-param name="valor" select="./@Referencia" />
</xsl:call-template>
<xsl:call-template name="Opcional">
<xsl:with-param name="valor" select="./@Municipio" />
</xsl:call-template>
<xsl:call-template name="Requerido">
<xsl:with-param name="valor" select="./@Estado" />
</xsl:call-template>
<xsl:call-template name="Requerido">
<xsl:with-param name="valor" select="./@Pais" />
</xsl:call-template>
<xsl:call-template name="Requerido">
<xsl:with-param name="valor" select="./@CodigoPostal" />
</xsl:call-template>
</xsl:template>
<xsl:template match="cce20:Mercancia">
<xsl:call-template name="Requerido">
<xsl:with-param name="valor" select="./@NoIdentificacion" />
</xsl:call-template>
<xsl:call-template name="Opcional">
<xsl:with-param name="valor" select="./@FraccionArancelaria" />
</xsl:call-template>
<xsl:call-template name="Opcional">
<xsl:with-param name="valor" select="./@CantidadAduana" />
</xsl:call-template>
<xsl:call-template name="Opcional">
<xsl:with-param name="valor" select="./@UnidadAduana" />
</xsl:call-template>
<xsl:call-template name="Opcional">
<xsl:with-param name="valor" select="./@ValorUnitarioAduana" />
</xsl:call-template>
<xsl:call-template name="Requerido">
<xsl:with-param name="valor" select="./@ValorDolares" />
</xsl:call-template>
<xsl:for-each select="./cce20:DescripcionesEspecificas">
<xsl:apply-templates select="."/>
</xsl:for-each>
</xsl:template>
<xsl:template match="cce20:DescripcionesEspecificas">
<xsl:call-template name="Requerido">
<xsl:with-param name="valor" select="./@Marca" />
</xsl:call-template>
<xsl:call-template name="Opcional">
<xsl:with-param name="valor" select="./@Modelo" />
</xsl:call-template>
<xsl:call-template name="Opcional">
<xsl:with-param name="valor" select="./@SubModelo" />
</xsl:call-template>
<xsl:call-template name="Opcional">
<xsl:with-param name="valor" select="./@NumeroSerie" />
</xsl:call-template>
</xsl:template>
</xsl:stylesheet>

View File

@ -1,233 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:fn="http://www.w3.org/2005/xpath-functions" xmlns:pago20="http://www.sat.gob.mx/Pagos20">
<xsl:template match="pago20:Pagos">
<!--Manejador de Atributos Pagos-->
<xsl:call-template name="Requerido">
<xsl:with-param name="valor" select="./@Version" />
</xsl:call-template>
<!-- Iniciamos el manejo de los elementos de tipo Totales. -->
<xsl:for-each select="./pago20:Totales">
<xsl:apply-templates select="."/>
</xsl:for-each>
<!-- Iniciamos el manejo de los elementos de tipo Pago. -->
<xsl:for-each select="./pago20:Pago">
<xsl:apply-templates select="."/>
</xsl:for-each>
</xsl:template>
<!-- Iniciamos el tratamiento de los atributos de pago20:Totales. -->
<xsl:template match="pago20:Totales">
<xsl:call-template name="Opcional">
<xsl:with-param name="valor" select="./@TotalRetencionesIVA" />
</xsl:call-template>
<xsl:call-template name="Opcional">
<xsl:with-param name="valor" select="./@TotalRetencionesISR" />
</xsl:call-template>
<xsl:call-template name="Opcional">
<xsl:with-param name="valor" select="./@TotalRetencionesIEPS" />
</xsl:call-template>
<xsl:call-template name="Opcional">
<xsl:with-param name="valor" select="./@TotalTrasladosBaseIVA16" />
</xsl:call-template>
<xsl:call-template name="Opcional">
<xsl:with-param name="valor" select="./@TotalTrasladosImpuestoIVA16" />
</xsl:call-template>
<xsl:call-template name="Opcional">
<xsl:with-param name="valor" select="./@TotalTrasladosBaseIVA8" />
</xsl:call-template>
<xsl:call-template name="Opcional">
<xsl:with-param name="valor" select="./@TotalTrasladosImpuestoIVA8" />
</xsl:call-template>
<xsl:call-template name="Opcional">
<xsl:with-param name="valor" select="./@TotalTrasladosBaseIVA0" />
</xsl:call-template>
<xsl:call-template name="Opcional">
<xsl:with-param name="valor" select="./@TotalTrasladosImpuestoIVA0" />
</xsl:call-template>
<xsl:call-template name="Opcional">
<xsl:with-param name="valor" select="./@TotalTrasladosBaseIVAExento" />
</xsl:call-template>
<xsl:call-template name="Requerido">
<xsl:with-param name="valor" select="./@MontoTotalPagos" />
</xsl:call-template>
</xsl:template>
<!-- Iniciamos el tratamiento de los atributos de pago20:Pago -->
<xsl:template match="pago20:Pago">
<xsl:call-template name="Requerido">
<xsl:with-param name="valor" select="./@FechaPago" />
</xsl:call-template>
<xsl:call-template name="Requerido">
<xsl:with-param name="valor" select="./@FormaDePagoP" />
</xsl:call-template>
<xsl:call-template name="Requerido">
<xsl:with-param name="valor" select="./@MonedaP" />
</xsl:call-template>
<xsl:call-template name="Opcional">
<xsl:with-param name="valor" select="./@TipoCambioP" />
</xsl:call-template>
<xsl:call-template name="Requerido">
<xsl:with-param name="valor" select="./@Monto" />
</xsl:call-template>
<xsl:call-template name="Opcional">
<xsl:with-param name="valor" select="./@NumOperacion" />
</xsl:call-template>
<xsl:call-template name="Opcional">
<xsl:with-param name="valor" select="./@RfcEmisorCtaOrd" />
</xsl:call-template>
<xsl:call-template name="Opcional">
<xsl:with-param name="valor" select="./@NomBancoOrdExt" />
</xsl:call-template>
<xsl:call-template name="Opcional">
<xsl:with-param name="valor" select="./@CtaOrdenante" />
</xsl:call-template>
<xsl:call-template name="Opcional">
<xsl:with-param name="valor" select="./@RfcEmisorCtaBen" />
</xsl:call-template>
<xsl:call-template name="Opcional">
<xsl:with-param name="valor" select="./@CtaBeneficiario" />
</xsl:call-template>
<xsl:call-template name="Opcional">
<xsl:with-param name="valor" select="./@TipoCadPago" />
</xsl:call-template>
<xsl:call-template name="Opcional">
<xsl:with-param name="valor" select="./@CertPago" />
</xsl:call-template>
<xsl:call-template name="Opcional">
<xsl:with-param name="valor" select="./@CadPago" />
</xsl:call-template>
<xsl:call-template name="Opcional">
<xsl:with-param name="valor" select="./@SelloPago" />
</xsl:call-template>
<!-- Iniciamos el tratamiento de los atributos de pago20:DocumentoRelacionado. -->
<xsl:for-each select="./pago20:DoctoRelacionado">
<xsl:apply-templates select="."/>
</xsl:for-each>
<!-- Iniciamos el tratamiento de los atributos de pago20:ImpuestosP. -->
<xsl:for-each select="./pago20:ImpuestosP">
<xsl:apply-templates select="."/>
</xsl:for-each>
</xsl:template>
<!-- Iniciamos el tratamiento de los atributos de pago20:DoctoRelacionado. -->
<xsl:template match="pago20:DoctoRelacionado">
<xsl:call-template name="Requerido">
<xsl:with-param name="valor" select="./@IdDocumento" />
</xsl:call-template>
<xsl:call-template name="Opcional">
<xsl:with-param name="valor" select="./@Serie" />
</xsl:call-template>
<xsl:call-template name="Opcional">
<xsl:with-param name="valor" select="./@Folio" />
</xsl:call-template>
<xsl:call-template name="Requerido">
<xsl:with-param name="valor" select="./@MonedaDR" />
</xsl:call-template>
<xsl:call-template name="Opcional">
<xsl:with-param name="valor" select="./@EquivalenciaDR" />
</xsl:call-template>
<xsl:call-template name="Requerido">
<xsl:with-param name="valor" select="./@NumParcialidad" />
</xsl:call-template>
<xsl:call-template name="Requerido">
<xsl:with-param name="valor" select="./@ImpSaldoAnt" />
</xsl:call-template>
<xsl:call-template name="Requerido">
<xsl:with-param name="valor" select="./@ImpPagado" />
</xsl:call-template>
<xsl:call-template name="Requerido">
<xsl:with-param name="valor" select="./@ImpSaldoInsoluto" />
</xsl:call-template>
<xsl:call-template name="Requerido">
<xsl:with-param name="valor" select="./@ObjetoImpDR" />
</xsl:call-template>
<!-- Iniciamos el tratamiento de los atributos del subnodo ImpuestosDR-RetencionesDR-RetencionDR. -->
<xsl:for-each select="./pago20:ImpuestosDR/pago20:RetencionesDR/pago20:RetencionDR">
<xsl:call-template name="Requerido">
<xsl:with-param name="valor" select="./@BaseDR"/>
</xsl:call-template>
<xsl:call-template name="Requerido">
<xsl:with-param name="valor" select="./@ImpuestoDR" />
</xsl:call-template>
<xsl:call-template name="Requerido">
<xsl:with-param name="valor" select="./@TipoFactorDR" />
</xsl:call-template>
<xsl:call-template name="Requerido">
<xsl:with-param name="valor" select="./@TasaOCuotaDR" />
</xsl:call-template>
<xsl:call-template name="Requerido">
<xsl:with-param name="valor" select="./@ImporteDR" />
</xsl:call-template>
</xsl:for-each>
<!-- Iniciamos el tratamiento de los atributos del subnodo ImpuestosDR-TrasladosDR-TrasladoDR. -->
<xsl:for-each select="./pago20:ImpuestosDR/pago20:TrasladosDR/pago20:TrasladoDR">
<xsl:call-template name="Requerido">
<xsl:with-param name="valor" select="./@BaseDR"/>
</xsl:call-template>
<xsl:call-template name="Requerido">
<xsl:with-param name="valor" select="./@ImpuestoDR" />
</xsl:call-template>
<xsl:call-template name="Requerido">
<xsl:with-param name="valor" select="./@TipoFactorDR" />
</xsl:call-template>
<xsl:call-template name="Opcional">
<xsl:with-param name="valor" select="./@TasaOCuotaDR" />
</xsl:call-template>
<xsl:call-template name="Opcional">
<xsl:with-param name="valor" select="./@ImporteDR" />
</xsl:call-template>
</xsl:for-each>
</xsl:template>
<!-- Iniciamos el tratamiento de los atributos de pago20:ImpuestosP. -->
<xsl:template match="pago20:ImpuestosP">
<xsl:apply-templates select="./pago20:RetencionesP"/>
<xsl:apply-templates select="./pago20:TrasladosP"/>
</xsl:template>
<xsl:template match="pago20:RetencionesP">
<xsl:for-each select="./pago20:RetencionP">
<xsl:apply-templates select="."/>
</xsl:for-each>
</xsl:template>
<xsl:template match="pago20:TrasladosP">
<xsl:for-each select="./pago20:TrasladoP">
<xsl:apply-templates select="."/>
</xsl:for-each>
</xsl:template>
<xsl:template match="pago20:RetencionP">
<xsl:call-template name="Requerido">
<xsl:with-param name="valor" select="./@ImpuestoP" />
</xsl:call-template>
<xsl:call-template name="Requerido">
<xsl:with-param name="valor" select="./@ImporteP" />
</xsl:call-template>
</xsl:template>
<xsl:template match="pago20:TrasladoP">
<xsl:call-template name="Requerido">
<xsl:with-param name="valor" select="./@BaseP" />
</xsl:call-template>
<xsl:call-template name="Requerido">
<xsl:with-param name="valor" select="./@ImpuestoP" />
</xsl:call-template>
<xsl:call-template name="Requerido">
<xsl:with-param name="valor" select="./@TipoFactorP" />
</xsl:call-template>
<xsl:call-template name="Opcional">
<xsl:with-param name="valor" select="./@TasaOCuotaP" />
</xsl:call-template>
<xsl:call-template name="Opcional">
<xsl:with-param name="valor" select="./@ImporteP" />
</xsl:call-template>
</xsl:template>
</xsl:stylesheet>

View File

@ -1,22 +1,22 @@
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:fn="http://www.w3.org/2005/xpath-functions">
<xsl:stylesheet version="1.1" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:fn="http://www.w3.org/2005/xpath-functions">
<!-- Manejador de datos requeridos -->
<xsl:template name="Requerido">
<xsl:param name="valor"/>|<xsl:call-template name="ManejaEspacios">
<xsl:with-param name="s" select="$valor"/>
</xsl:call-template>
</xsl:template>
<!-- Manejador de datos requeridos -->
<xsl:template name="Requerido">
<xsl:param name="valor"/>|<xsl:call-template name="ManejaEspacios">
<xsl:with-param name="s" select="$valor"/>
</xsl:call-template>
</xsl:template>
<!-- Manejador de datos opcionales -->
<xsl:template name="Opcional">
<xsl:param name="valor"/>
<xsl:if test="$valor">|<xsl:call-template name="ManejaEspacios"><xsl:with-param name="s" select="$valor"/></xsl:call-template></xsl:if>
</xsl:template>
<!-- Normalizador de espacios en blanco -->
<xsl:template name="ManejaEspacios">
<xsl:param name="s"/>
<xsl:value-of select="normalize-space(string($s))"/>
</xsl:template>
<!-- Manejador de datos opcionales -->
<xsl:template name="Opcional">
<xsl:param name="valor"/>
<xsl:if test="$valor">|<xsl:call-template name="ManejaEspacios"><xsl:with-param name="s" select="$valor"/></xsl:call-template></xsl:if>
</xsl:template>
<!-- Normalizador de espacios en blanco -->
<xsl:template name="ManejaEspacios">
<xsl:param name="s"/>
<xsl:value-of select="normalize-space(string($s))"/>
</xsl:template>
</xsl:stylesheet>

View File

@ -1,22 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.1" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:fn="http://www.w3.org/2005/xpath-functions">
<!-- Manejador de datos requeridos -->
<xsl:template name="Requerido">
<xsl:param name="valor"/>|<xsl:call-template name="ManejaEspacios">
<xsl:with-param name="s" select="$valor"/>
</xsl:call-template>
</xsl:template>
<!-- Manejador de datos opcionales -->
<xsl:template name="Opcional">
<xsl:param name="valor"/>
<xsl:if test="$valor">|<xsl:call-template name="ManejaEspacios"><xsl:with-param name="s" select="$valor"/></xsl:call-template></xsl:if>
</xsl:template>
<!-- Normalizador de espacios en blanco -->
<xsl:template name="ManejaEspacios">
<xsl:param name="s"/>
<xsl:value-of select="normalize-space(string($s))"/>
</xsl:template>
</xsl:stylesheet>