Compare commits

...

201 Commits

Author SHA1 Message Date
El Mau 34a981a2dd Fix: en mercancias en Carta porte al generar el PDF 2024-04-10 20:54:26 -06:00
El Mau 66549e271b Fix: en mercancias en Carta porte al generar el PDF 2024-04-10 20:54:01 -06:00
El Mau 884b10bd79 Fix in js 2024-04-02 10:59:54 -06:00
El Mau fd050159ba Fix in js 2024-04-02 10:59:23 -06:00
El Mau 8199667188 Fix in Carta Porte 3.0 2024-04-02 10:31:58 -06:00
El Mau 05d3f617eb Fix in Carta Porte 2024-04-02 10:31:28 -06:00
El Mau 0ec4f0c2c9 Add support for Carta Porte 3.0 2024-04-02 00:25:41 -06:00
El Mau 29bfb42abc PDF from Carta Porte v3 2024-04-02 00:20:44 -06:00
El Mau 7f129b84b2 Stamp Carta Porte v3 2024-04-01 14:09:57 -06:00
El Mau 13a3c106c6 UI for Carta Porte v3 2024-03-31 22:28:13 -06:00
El Mau 0c7abf634b Update changelog 2024-03-04 14:07:10 -06:00
El Mau f0c4423fc8 Add support for Comercio Exterior 2.0 2024-01-24 15:07:26 -06:00
El Mau d925587a98 PDF from CE in version 2.0 2024-01-24 13:45:23 -06:00
El Mau 510ebdd1e5 Stamp CE in version 2.0 2024-01-21 23:20:27 -06:00
El Mau d2e92098da Import from ODS 2024-01-18 22:29:49 -06:00
El Mau c1ce206835 Import from json 2024-01-17 23:49:58 -06:00
El Mau 1efa280920 Import from json 2024-01-16 22:51:58 -06:00
El Mau 6fd8f9e2ea Add UI for CE 2024-01-14 22:42:26 -06:00
El Mau e3a44e6400 Add filter by day 2023-12-26 21:38:22 -06:00
El Mau 390ec60fdd Add filter by day 2023-12-26 21:37:45 -06:00
El Mau 957160755a Fix issue #98 and #107 2023-12-20 18:55:18 -06:00
El Mau 070ee31a1b Update changelog 2023-12-20 18:54:25 -06:00
El Mau 2620159408 Fix issue #98 2023-12-20 18:51:38 -06:00
El Mau 4d9bc4a172 Fix issue #107 2023-12-20 18:36:44 -06:00
El Mau 17ed56e9d7 Fix for CFDI egreso for General Public 2023-11-05 22:15:17 -06:00
El Mau 5057ac57ae Fix for CFDI egreso for General Public 2023-11-05 22:13:45 -06:00
El Mau 410a7080da Modify name for Public RFC 2023-10-30 16:51:38 -06:00
El Mau edd8d560bd Update changelog and version 2023-10-30 00:12:40 -06:00
El Mau bd1699d082 Add support for change time zone 2023-10-30 00:02:48 -06:00
El Mau 6d4023bb17 Update SATA catalog 2023-10-29 22:40:05 -06:00
Mauricio beda45690f Fix in retention tax for RESICOs 2023-07-06 11:16:04 -06:00
Mauricio 8feba167af Fix in retention tax for RESICOs 2023-07-06 11:15:15 -06:00
Mauricio 4dbb797d99 Fix tax retention in pay complement 2023-06-14 21:42:17 -06:00
Mauricio cd424b71dc Update changelog 2023-06-14 20:20:30 -06:00
Mauricio ea13d11319 Fix - Retencion tax in pay complement 2023-06-14 20:19:21 -06:00
Mauricio d9c863820a Merge pull request 'Añade información de desarrollo al readme' (#105) from categulario/empresa-libre:improve-readme into develop
Reviewed-on: #105
2023-06-06 15:23:46 -06:00
Categulario 6815d6c64c
improve readme with information on how to run locally 2023-06-05 22:34:09 -06:00
Mauricio 402cb7d70c Fix #103 2023-06-05 16:25:37 -06:00
Mauricio a5f1114774 Update changelog 2023-06-05 16:25:07 -06:00
Mauricio 2588a5f0b8 Fix #103 2023-06-05 16:22:53 -06:00
Mauricio eeae157772 Fix in complement pays 2023-05-25 21:59:13 -06:00
Mauricio 7cad4093d4 Fix in global invoice 2023-04-20 13:21:19 -06:00
Mauricio 7caf6423e1 Fix in global invoice 2023-04-20 13:20:48 -06:00
Mauricio 8a3aea41eb Add index in tickets 2023-04-15 19:23:56 -06:00
Mauricio bd49356d3f Add index in tickets 2023-04-15 18:13:45 -06:00
Mauricio 3b54ef0a36 Fix in global invoice 2023-04-14 17:56:12 -06:00
Mauricio 497a4be392 Update version 2023-04-14 17:55:48 -06:00
Mauricio 7fc6264322 Fix in global invoice 2023-04-14 17:55:00 -06:00
Mauricio c5d0e97212 Fix: al obtener la clave del sat al facturar en lote 2023-04-01 15:10:07 -06:00
Mauricio 5bbad9ef58 Fix: al obtener la clave del sat al facturar en lote 2023-04-01 15:09:27 -06:00
Mauricio 8e7aa23d1b Validate exists partner in edit 2023-03-29 17:36:17 -06:00
Mauricio f3d8b1dae5 Fix issue #97 2023-03-29 13:32:31 -06:00
Mauricio 2c684ae6bd Fix issue #97 2023-03-29 13:31:23 -06:00
el Mau febea3f289 Fix #96 2023-03-21 10:56:55 -06:00
el Mau 5facb96662 Fix #96 2023-03-21 10:55:16 -06:00
el Mau 6411c2e51e Fix in taxes in invoice pay 2023-03-13 17:16:30 -06:00
el Mau eeb128fda6 Fix in taxes in invoice pay 2023-03-13 17:16:15 -06:00
el Mau a078e27703 Fix in taxes in invoice pay 2023-03-13 14:01:26 -06:00
el Mau 28ef53043f Fix in taxes in invoice pay 2023-03-13 13:59:24 -06:00
el Mau e956c243f7 Fix in invoice pay 2023-03-10 14:56:19 -06:00
el Mau 1b33413de2 Fix in invoice pay 2023-03-10 14:55:57 -06:00
el Mau 64541a84b9 Fix in invoice pay with tax IVA 0 2023-03-07 11:53:28 -06:00
el Mau 834c1faae6 Fix in invoice pay with tax IVA 0 2023-03-07 11:53:04 -06:00
el Mau affe57bfcd Add validate for cancel movement bank 2023-03-06 16:10:07 -06:00
el Mau 4dc54ade1e Add validate for cancel movement bank 2023-03-06 16:09:37 -06:00
el Mau e72739a5fe Add cancel invoice pay in admin list 2023-03-06 00:48:01 -06:00
el Mau dd7b9c1680 Add cancel invoice pay in admin list 2023-03-06 00:47:34 -06:00
el Mau 9823bd967f Fix for exempted tax 2023-03-03 01:38:37 -06:00
el Mau aee467d98f Fix for exempted tax 2023-03-03 01:38:19 -06:00
el Mau 64917527f7 Validate tax object 2023-03-01 22:24:26 -06:00
el Mau 5f56179ebb Validate tax object 2023-03-01 22:24:00 -06:00
el Mau 955a0348f8 Can select month in global invoice 2023-03-01 18:45:50 -06:00
el Mau 0826b0cea2 Can select month in global invoice 2023-03-01 18:45:21 -06:00
el Mau 8b0f9fbc64 Can select global options for public invoice 2023-03-01 18:17:56 -06:00
el Mau f3d827364b Can select global options for public invoice 2023-03-01 18:16:52 -06:00
el Mau 50cbb3bae8 Fix in tax IVA retention 2023-03-01 14:32:33 -06:00
el Mau a7c8d80219 Fix in tax IVA retention 2023-03-01 14:32:01 -06:00
el Mau ca9d7a02e3 Update requirements.txt 2023-02-24 14:08:14 -06:00
el Mau 31fcb63e51 Update requirements.txt 2023-02-24 14:07:44 -06:00
el Mau bd7a31ea8a Fix global invoice 2023-02-24 12:45:52 -06:00
el Mau 6a6b6ca395 Fix global invoice 2023-02-23 18:20:10 -06:00
el Mau 3148c5ba82 Fix type change in deposit 2023-02-22 11:07:38 -06:00
el Mau 5f62ad7750 Fix type change in deposit 2023-02-22 11:06:37 -06:00
el Mau ff44162622 Fix type change in deposit 2023-02-21 22:16:25 -06:00
el Mau a37b3a5c23 Fix type change in deposit 2023-02-21 22:09:42 -06:00
el Mau 4fdea6173b Fix invoice pay in others currencies 2023-02-20 19:15:40 -06:00
el Mau 968c2744ec Fix pay invoice in other currencies 2023-02-20 19:10:29 -06:00
el Mau c9d85ca2e7 Fix make PDF from pays 1.0 2023-02-19 14:00:06 -06:00
el Mau 93e64eafd8 Fix make PDF from pays 1.0 2023-02-18 12:56:22 -06:00
el Mau 1984103ff5 Fix make PDF from pays 1.0 2023-02-18 12:40:05 -06:00
el Mau e4ba06c0ff Fix in tax object 04 2023-02-17 14:24:33 -06:00
el Mau 38bb267e55 Fix in tax object 04 2023-02-17 14:24:17 -06:00
el Mau 602467c8e9 Fix in tax object 04 2023-02-17 13:44:42 -06:00
el Mau 4020237f68 Fix in tax object 04 2023-02-17 13:43:43 -06:00
el Mau 933c9820e6 Fix with tax exento 2023-02-16 23:38:03 -06:00
el Mau 51daf0ad5e Stamp with tax exento 2023-02-16 23:09:35 -06:00
el Mau 709c524830 Show message when delete product 2023-02-16 22:30:08 -06:00
el Mau 434e15bb5b Fix in cancel with Finkok 2023-02-08 21:43:38 -06:00
el Mau ae5949c529 Fix in cancel with Finkok 2023-02-08 19:25:53 -06:00
el Mau af5fa3c812 Fix in templates 2023-02-01 22:45:48 -06:00
el Mau 6d399fcb39 Fix in templates 2023-02-01 22:45:24 -06:00
el Mau 8003fc42b9 Add template in json for 4.0 2023-02-01 22:27:13 -06:00
el Mau 7a0fb2b243 Add template in json for 4.0 2023-02-01 22:26:10 -06:00
el Mau 83bebde169 Fix use cfdi P01 2023-02-01 08:56:55 -06:00
el Mau 76d5f51d78 Fix use cfdi P01 2023-02-01 08:56:28 -06:00
el Mau 5f641c632e Get message error in import invoice by lote 2023-01-31 22:07:43 -06:00
el Mau 85eb7cd58c Get message error in import invoice by lote 2023-01-31 22:07:06 -06:00
el Mau 1c11a1b013 Fix get sum by tax ISR 2023-01-30 22:16:07 -06:00
el Mau 701bb68478 Fix sum for ISR tax 2023-01-30 22:10:25 -06:00
el Mau f13491d983 Fix get sum basy pay for IVA 2023-01-30 20:12:09 -06:00
el Mau 4020365616 Fix get base pay 2023-01-30 20:09:57 -06:00
el Mau a90f218c76 Fix node tax in invoice pay 2023-01-27 12:00:36 -06:00
el Mau 37995befd8 Fix node tax in invoice pay 2023-01-27 12:00:09 -06:00
el Mau 746c827492 Validate regimen fiscal in pay invoice 2023-01-23 16:18:11 -06:00
el Mau 3cea54c07c Validate regimen fiscal in pay invoice 2023-01-23 16:17:47 -06:00
el Mau 661eff1dc3 Validate regimen fiscal in pay invoice 2023-01-23 16:05:38 -06:00
el Mau cd11456ec3 Validate regimen fiscal in pay invoice 2023-01-23 16:05:22 -06:00
el Mau 2526a8f5aa Validate regimen fiscal in pay invoice 2023-01-23 15:39:04 -06:00
el Mau 0a13004419 Validate regimen fiscal in pay invoice 2023-01-23 15:38:28 -06:00
el Mau 296874a9b1 Admin regimenes 2023-01-22 12:57:35 -06:00
el Mau 34b1af1319 Admin regimenes 2023-01-21 23:19:44 -06:00
el Mau 5fbf80fb92 Show keys in invoice 2023-01-21 20:19:28 -06:00
el Mau b56fee5f73 Show key by regimen in invoice 2023-01-21 20:06:31 -06:00
el Mau c9ca45b60d Add keys in regimenes fiscales 2023-01-21 19:46:06 -06:00
el Mau 86e7f50621 Fix in validate CP 2023-01-13 22:25:48 -06:00
el Mau 2cef108856 Fix in validate CP 2023-01-13 22:21:03 -06:00
el Mau 260ba62b2e Fix in validate CP 2023-01-12 12:02:02 -06:00
el Mau 76d15e482b Fix in validate CP 2023-01-12 12:01:37 -06:00
el Mau 8e2446e8f5 Fix in complement pay without taxes 2023-01-12 00:33:39 -06:00
el Mau 482a0385cd Fix in complement pay without taxes 2023-01-12 00:33:11 -06:00
el Mau 29e02e649d Fix error in nomina 2023-01-11 00:27:42 -06:00
el Mau 5aece843bf Fix error in nomina 2023-01-11 00:24:35 -06:00
el Mau d47e059d93 CFDI 4.0 2023-01-10 00:07:17 -06:00
el Mau 89f79de9b6 Add template for donatarias 2023-01-10 00:06:40 -06:00
el Mau fbaa85f13a Fix #84 2023-01-09 23:11:52 -06:00
el Mau bed6039fff Fix #84 2023-01-09 17:46:40 -06:00
el Mau acbaecbfc5 Fix in preinvoice 2023-01-09 15:18:08 -06:00
el Mau 8dddb7b293 Update changelog 2023-01-08 19:29:36 -06:00
el Mau 24777f691e CFDI 4.0 2023-01-07 07:37:32 -06:00
el Mau 1d270aa478 Add templates 2023-01-06 21:42:46 -06:00
el Mau 8872af8c50 Fix in unit in invoice 2023-01-06 19:04:50 -06:00
el Mau d57ded161c Proporcional taxes in pays complements 2023-01-04 18:29:30 -06:00
el Mau 0c8d6d3cea Fix #83 2023-01-04 13:02:33 -06:00
el Mau f14c1f74d8 PDF for pays complement 2023-01-02 22:59:39 -06:00
el Mau 210f50a7d7 Add months in global invoice 2023-01-02 14:56:34 -06:00
el Mau 5418b23200 Plantillas 2023-01-01 22:58:58 -06:00
el Mau a13c7c0a1d Factura global 2022-12-31 17:30:01 -06:00
el Mau a6276a33fb Update temaple for Leyendas Fiscales 2022-10-27 22:37:05 -05:00
el Mau e3bd1e8871 Fix - Query SAT 2022-10-25 20:22:48 -05:00
el Mau 2ddb3d6b75 Fix - Cancel v4.0 2022-10-25 14:59:37 -05:00
Mauricio Baeza 4cda9f7f21 Update CP Db 2022-08-02 22:13:05 -05:00
Mauricio Baeza 7c184c9513 Update CP db 2022-08-01 21:31:44 -05:00
Mauricio Baeza aea8aeaecf Fix in import employes 2022-06-17 13:30:21 -05:00
Mauricio Baeza e08e4e038f Set name client to upper case 2022-06-09 13:50:33 -05:00
Mauricio Baeza 496dcf7162 Add some complements 2022-06-05 20:24:08 -05:00
Mauricio Baeza f8cd99084a Stamp Nomina with Cfdi 4.0 2022-06-04 21:52:28 -05:00
Mauricio Baeza 1e824bd841 Fix set current regimen in edit 2022-06-02 22:46:31 -05:00
Mauricio Baeza bc0cd9f3e1 Fix get data foro version 3.3 2022-05-31 22:14:17 -05:00
Mauricio Baeza ae259e461b Add template for CFDI 4.0 2022-05-30 13:30:47 -05:00
Mauricio Baeza 1a507d2eeb Add template for CFDI 4.0 2022-05-29 22:57:26 -05:00
Mauricio Baeza f766f92618 Minor changes 2022-05-25 23:18:21 -05:00
Mauricio Baeza ad56356a6f Quitar referencia a paquetes 2022-05-16 14:44:42 -05:00
El Mau c6cf33c4c4 Obtener datos de periodicidad para factura glbal 2022-04-18 21:45:30 -05:00
El Mau dbc3910297 Guardar periodicidad de factura global 2022-04-17 16:33:50 -05:00
El Mau 6c78a282fe Agregar periodicidad en UI para factura del día 2022-04-17 16:01:05 -05:00
El Mau f8c2c5e2d6 Agregar objeto de impuestos a productos 2022-04-16 21:58:42 -05:00
El Mau 7d40e79f3c Quitar validacion de empaques 2022-04-15 22:13:49 -05:00
El Mau a36034a476 Agregar controles para objeto de impuesto en productos 2022-04-14 23:01:02 -05:00
El Mau de2ab5cedd Obtener regimen fiscal del receptor al facturar desde tickets 2022-04-11 22:47:37 -05:00
El Mau b60e2d6a37 Timbrado con público en general 2022-04-07 21:31:42 -05:00
El Mau d9021cca4a Seleccionar regimen para público en general 2022-04-05 22:05:16 -05:00
El Mau 7bbef31936 Regresar regimenes del cliente al seleccionar 2022-04-03 23:00:02 -05:00
El Mau 74e7f12088 Regresar CP del cliente al refacturar 2022-04-02 23:13:37 -06:00
El Mau 20c0757f04 Regresar productos en orden al refacturar 2022-04-02 23:13:37 -06:00
El Mau 3a5fbc609b Regresar productos en orden al refacturar 2022-04-01 09:50:10 -06:00
El Mau 5e888d2337 Regresar productos en orden al refacturar 2022-04-01 09:49:15 -06:00
El Mau d97fd4867a Cambiar URLs para timbrado con Comercio Digital 2022-03-29 18:27:40 -06:00
El Mau e58b8f90af Cambiar demo de Finkok a https 2022-03-29 17:29:21 -06:00
El Mau 50d4a3f4b7 Soporte inicial para CFDI 4.0 2022-03-29 15:40:14 -06:00
El Mau 1978edfaf0 Tablas para borrar 2022-03-28 22:40:41 -06:00
El Mau 7ca87d1811 Timbrado de Complemento de Pagos 2.0 2022-03-28 22:40:41 -06:00
El Mau a7bc6d6f6c Agregar xlst para pagos 2.0 2022-03-28 22:40:41 -06:00
El Mau 1991c68b3b Soporte basico para Comercio Exterior 2022-03-28 22:39:55 -06:00
El Mau bebcd29710 Agregar cadena para Cfdi 4 2022-03-28 22:37:08 -06:00
El Mau de856f28ab Soporte basico para complemento Comercio Exterior 2022-03-28 21:34:10 -06:00
El Mau e726cda085 Soporte basico para complemento Comercio Exterior 2022-03-28 21:33:39 -06:00
El Mau eee386a97b Soporte basico para complemento Comercio Exterior 2022-03-17 21:22:27 -06:00
El Mau ae21403c59 Error al timbrar nomina 2022-03-10 20:26:27 -06:00
El Mau 110d41cf6e Actualizar VERSION 2022-03-10 20:25:51 -06:00
El Mau bd6fb65a1b Fix - Problema al timbra nómina con Comercio Digital 2022-03-10 19:24:29 -06:00
El Mau b68d79d0ca Fix issue #54 2022-02-18 14:59:01 -06:00
El Mau 670aca3886 Fix - Issue #54 2022-02-18 14:57:13 -06:00
El Mau 68c0203039 Fix issue #53 2022-02-15 23:51:27 -06:00
El Mau b2cdd0efbe Fix - Issue #53 2022-02-15 23:50:02 -06:00
El Mau 51af15f311 Error al generar Carta Porte sin remolque 2022-02-01 21:31:49 -06:00
El Mau edf35aa5ce Error al cancelar con Finkok 2022-02-01 21:31:06 -06:00
El Mau b19d087d10 Error al generar Carta Porte sin remolque 2022-01-31 18:48:43 -06:00
El Mau 64ef75fbf5 Mejoras en Carta Porte 2022-01-30 14:50:05 -06:00
El Mau d6a8c1e3fa Actualizar lista de cambios 2022-01-30 14:48:32 -06:00
El Mau a7080bf954 Agregar validación para distancia en origen de Carta Porte 2022-01-30 14:47:34 -06:00
El Mau 3ddf99075e Reporte #49, arreglado 2022-01-29 20:47:30 -06:00
58 changed files with 5822 additions and 1380 deletions

3
.gitignore vendored
View File

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

View File

@ -1,3 +1,151 @@
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

View File

@ -15,12 +15,11 @@ contratar: administracion ARROBA empresalibre.net
G1: `A5DdXxCKPw3QKWVdDVs7CzkNugNUW1sHu5zDJFWxCU2h`
BCH: `qztd3l00xle5tffdqvh2snvadkuau2ml0uqm4n875d`
### Requerimientos:
## Requerimientos:
* Servidor web, recomendado Nginx
* uwsgi
* python3.7+
* python 3.8
* xsltproc
* openssl
* xmlsec
@ -37,5 +36,25 @@ 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

3
TODO.md Normal file
View File

@ -0,0 +1,3 @@
[ ] 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,2 +1 @@
1.46.0
2.3.2

View File

@ -1,20 +0,0 @@
# 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)

View File

@ -1,35 +0,0 @@
@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

View File

@ -1,21 +0,0 @@
.. 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`

View File

@ -1,39 +0,0 @@
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,9 +14,4 @@ cryptography==3.4.8
xmlsec
segno
# pyqrcode
# pypng
# python-escpos
# pyusb
# pyserial
# qrcode

View File

@ -25,16 +25,23 @@ from logbook import Logger
log = Logger('XML')
CFDI_ACTUAL = 'cfdi33'
CFDI_ACTUAL = 'cfdi40'
NOMINA_ACTUAL = 'nomina12'
PUBLIC = 'PUBLICO EN GENERAL'
CFDI_EGRESO = 'E'
DEFAULT = {
'exportacion': '01',
}
SAT = {
'xsi': 'http://www.w3.org/2001/XMLSchema-instance',
'cfdi32': {
'version': '3.2',
'cfdi40': {
'version': '4.0',
'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',
'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',
},
'cfdi33': {
'version': '3.3',
@ -42,6 +49,12 @@ 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',
@ -80,10 +93,10 @@ SAT = {
'schema': ' http://www.sat.gob.mx/iedu http://www.sat.gob.mx/sitio_internet/cfd/iedu/iedu.xsd',
},
'pagos': {
'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',
'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',
},
'divisas': {
'version': '1.0',
@ -98,10 +111,16 @@ 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': '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',
'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',
}
}
@ -122,7 +141,10 @@ 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):
@ -133,6 +155,8 @@ 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'])
@ -145,7 +169,9 @@ class CFDI(object):
if 'nomina' in datos:
self._nomina(datos['nomina'])
return self._to_pretty_xml(ET.tostring(self._cfdi, encoding='utf-8'))
xml = self._to_pretty_xml(ET.tostring(self._cfdi, encoding='utf-8'))
return xml
def add_sello(self, sello, cert_txt):
self._cfdi.attrib['Sello'] = sello
@ -174,6 +200,9 @@ 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', '')
@ -245,10 +274,16 @@ 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_carta_porte + schema_comercioe
attributes.update(datos)
if not 'Version' in attributes:
@ -256,9 +291,23 @@ 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
@ -278,6 +327,10 @@ 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
@ -347,6 +400,10 @@ 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)
@ -463,6 +520,47 @@ 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
@ -477,6 +575,11 @@ class CFDI(object):
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)
@ -494,10 +597,6 @@ class CFDI(object):
attr = mercancias
mercancias = attr.pop('mercancias')
autotransporte = attr.pop('autotransporte')
identificacion = autotransporte.pop('identificacion')
seguros = autotransporte.pop('seguros')
remolque = autotransporte.pop('remolque')
node = ET.SubElement(node_carta, f'{prefix}:Mercancias', attr)
for mercancia in mercancias:
@ -506,9 +605,10 @@ 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 remolque['SubTipoRem'] and remolque['Placa']:
tmp = ET.SubElement(sub_node, f'{prefix}:Remolques')
ET.SubElement(tmp, f'{prefix}:Remolque', remolque)
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')
@ -531,21 +631,53 @@ 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, 'Ambito': ine_ambito}
attr = {'ClaveEntidad': ine_key_entidad}
if ine_ambito:
attr['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:
ET.SubElement(node_pago, '{}:DoctoRelacionado'.format(pre), row)
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)
if 'leyendas' in datos:
pre = SAT['leyendas']['prefix']
@ -555,57 +687,8 @@ class CFDI(object):
for leyend in datos['leyendas']:
ET.SubElement(node_leyend, '{}:Leyenda'.format(pre), leyend)
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')
if self._comercio_exterior:
datos = datos.pop('comercioe')
self._complemento_comercio_exterior(datos)
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

@ -542,12 +542,16 @@ 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'):
if not type_doc in ('pdf', 'pre', 'tpdf', 'pdfpago', 'html', 'nompdf'):
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
@ -797,3 +801,27 @@ 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

@ -41,6 +41,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):
"""
@ -63,7 +69,7 @@ class PACComercioDigital(object):
ws = 'https://{}.comercio-digital.mx/{}'
api = 'https://app2.comercio-digital.mx/{}'
URL = {
'timbra': ws.format('ws', 'timbre/timbrarV5.aspx'),
'timbra': ws.format('ws', 'timbre4/timbrarV5'),
'cancel': ws.format('cancela', 'cancela4/cancelarUuid'),
'cancelxml': ws.format('cancela', 'cancela4/cancelarXml'),
'status': ws.format('cancela', 'arws/consultaEstatus'),
@ -78,7 +84,7 @@ class PACComercioDigital(object):
'702': '702 Error rfc/empresa invalido',
}
NS_CFDI = {
'cfdi': 'http://www.sat.gob.mx/cfd/3',
'cfdi': 'http://www.sat.gob.mx/cfd/4',
'tdf': 'http://www.sat.gob.mx/TimbreFiscalDigital',
}
@ -86,7 +92,7 @@ class PACComercioDigital(object):
ws = 'https://pruebas.comercio-digital.mx/{}'
ws6 = 'https://pruebas6.comercio-digital.mx/arws/{}'
URL = {
'timbra': ws.format('timbre/timbrarV5.aspx'),
'timbra': ws.format('timbre4/timbrarV5'),
'cancel': ws.format('cancela4/cancelarUuid'),
'cancelxml': ws.format('cancela4/cancelarXml'),
'status': ws6.format('consultaEstatus'),
@ -126,10 +132,10 @@ 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
# ~ 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')
def stamp(self, cfdi, auth):
# ~ if DEBUG or not auth:
@ -175,26 +181,29 @@ class PACComercioDigital(object):
info['key'] = base64.b64encode(info['key_enc']).decode()
info['cer'] = base64.b64encode(info['cer_ori']).decode()
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']
namespaces = {
'cfdi': NAMESPACES[version],
'tdf': NAMESPACES['tdf'],
}
tipo = tree.xpath(
'string(//cfdi:Comprobante/@TipoDeComprobante)',
namespaces=NS_CFDI)
namespaces=namespaces)
total = tree.xpath(
'string(//cfdi:Comprobante/@Total)',
namespaces=NS_CFDI)
namespaces=namespaces)
rfc_emisor = tree.xpath(
'string(//cfdi:Comprobante/cfdi:Emisor/@Rfc)',
namespaces=NS_CFDI)
namespaces=namespaces)
rfc_receptor = tree.xpath(
'string(//cfdi:Comprobante/cfdi:Receptor/@Rfc)',
namespaces=NS_CFDI)
namespaces=namespaces)
uid = tree.xpath(
'string(//cfdi:Complemento/tdf:TimbreFiscalDigital/@UUID)',
namespaces=NS_CFDI)
namespaces=namespaces)
data = (
f"USER={auth['user']}",
f"PWDW={auth['pass']}",

View File

@ -47,7 +47,7 @@ logging.getLogger('zeep').setLevel(logging.ERROR)
TIMEOUT = 10
DEBUG_SOAP = True
DEBUG_SOAP = False
class DebugPlugin(Plugin):
@ -72,8 +72,10 @@ class DebugPlugin(Plugin):
class PACFinkok(object):
WS = 'https://facturacion.finkok.com/servicios/soap/{}.wsdl'
NS_TYPE = 'ns1'
if DEBUG:
WS = 'http://demo-facturacion.finkok.com/servicios/soap/{}.wsdl'
WS = 'https://demo-facturacion.finkok.com/servicios/soap/{}.wsdl'
NS_TYPE = 'ns0'
URL = {
'quick_stamp': False,
'timbra': WS.format('stamp'),
@ -188,11 +190,18 @@ 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)
@ -209,15 +218,19 @@ class PACFinkok(object):
method = 'cancel'
client = Client(self.URL[method],
transport=self._transport, plugins=self._plugins)
uuid_type = client.get_type('ns1:UUIDS')
uuid_type = client.get_type(f'{self.NS_TYPE}:UUIDS')
ns1_uuid = client.get_type(f'{self.NS_TYPE}:UUID')
# ~ 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,6 +30,7 @@ import requests
import sqlite3
import socket
import subprocess
import sys
import tempfile
import textwrap
import threading
@ -44,7 +45,6 @@ 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,9 +52,20 @@ try:
from com.sun.star.view.PaperFormat import LETTER
APP_LIBO = True
except ImportError:
APP_LIBO = False
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
# ~ import pyqrcode
from dateutil import parser
from lxml import etree
@ -69,7 +80,6 @@ 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
@ -78,9 +88,11 @@ import segno
from .pacs.cfdi_cert import SATCertificate
from settings import (
CFDI_VERSIONS,
EXT,
MXN,
PATHS,
PRE_DEFAULT,
)
@ -291,7 +303,8 @@ def get_sat_productos(key):
def now():
return datetime.datetime.now().replace(microsecond=0)
n = datetime.datetime.now().replace(microsecond=0)
return n
def today():
@ -636,6 +649,12 @@ 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)
@ -733,7 +752,12 @@ 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)
@ -873,8 +897,6 @@ 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)
@ -883,11 +905,11 @@ class LIBO(object):
image.Graphic = gp.queryGraphic(properties)
s = Size()
s.Width = 4150
s.Height = 4500
s.Width = 4000
s.Height = 4000
image.setSize(s)
image.Anchor = self._set_cell('{timbre.cbb}')
# ~ _kill(data['path_cbb'])
return
def _donataria(self, data):
@ -939,6 +961,7 @@ class LIBO(object):
return
# ~ print(data)
qr = data.pop('qr', False)
figuras = data.pop('figuras')
mercancias = data.pop('mercancias')
detalle = mercancias.pop('detalle')
@ -997,6 +1020,10 @@ class LIBO(object):
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)
@ -1007,7 +1034,72 @@ class LIBO(object):
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):
@ -1119,6 +1211,9 @@ 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',):
@ -1150,7 +1245,8 @@ 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)
cell_4 = self._set_cell('{doc.metodopago}', metodo_pago)
if version != VERSION2:
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)
@ -1160,7 +1256,8 @@ class LIBO(object):
col1.append((uuid,))
col2.append((serie,))
col3.append((folio,))
col4.append((metodo_pago,))
if version != VERSION2:
col4.append((metodo_pago,))
col5.append((moneda,))
col6.append((parcialidad,))
col7.append((float(saldo_anterior),))
@ -1186,8 +1283,9 @@ class LIBO(object):
target2 = self._sheet.getCellRangeByPosition(col, row1, col, row2)
col = cell_3.getCellAddress().Column
target3 = self._sheet.getCellRangeByPosition(col, row1, col, row2)
col = cell_4.getCellAddress().Column
target4 = 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_5.getCellAddress().Column
target5 = self._sheet.getCellRangeByPosition(col, row1, col, row2)
col = cell_6.getCellAddress().Column
@ -1202,7 +1300,8 @@ class LIBO(object):
target1.setFormulaArray(tuple(col1))
target2.setDataArray(tuple(col2))
target3.setFormulaArray(tuple(col3))
target4.setDataArray(tuple(col4))
if version != VERSION2:
target4.setDataArray(tuple(col4))
target5.setDataArray(tuple(col5))
target6.setDataArray(tuple(col6))
target7.setDataArray(tuple(col7))
@ -1221,6 +1320,7 @@ 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)
@ -1238,6 +1338,7 @@ class LIBO(object):
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'])
@ -1289,6 +1390,7 @@ class LIBO(object):
except KeyError:
msg = 'Hoja no existe'
return (), msg
return cursor.getDataArray(), ''
def products(self, path):
@ -1358,6 +1460,7 @@ class LIBO(object):
'codigo_postal',
'notas',
'correo',
'regimen_fiscal',
)
rows = tuple([dict(zip(fields, r)) for r in data[1:]])
msg = 'Empleados importados correctamente'
@ -1548,41 +1651,105 @@ 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']
if 'nomina' in data and data['nomina']:
default = 'plantilla_nomina.ods'
version = '{}_{}'.format(data['nomina']['version'], version)
if 'carta_porte' in data:
default = 'plantilla_factura_cp.ods'
version = '{}_cp_{}'.format(version, data['carta_porte']['version'])
pagos = ''
if data.get('pagos', False):
version = '1.0'
pagos = 'pagos_'
default = f'plantilla_factura_{version}.ods'
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:
donativo = ''
if data['donativo']:
donativo = '_donativo'
name = '{}_{}{}{}.ods'.format(rfc.lower(), pagos, version, donativo)
path = get_template_ods(name, default)
path = get_template_ods(template_name, default)
if path:
return app.pdf(path, data, ods)
@ -1592,6 +1759,7 @@ 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")
@ -1662,10 +1830,11 @@ 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 ()
return (), msg
msg = 'LibreOffice no se pudo iniciar'
if APP_LIBO:
@ -1710,24 +1879,6 @@ 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:
@ -1754,7 +1905,7 @@ def _comprobante(doc, options):
data['tiporelacion'] = options.get('tiporelacion', '')
return data
if data['version'] == '3.3':
if data['version'] in CFDI_VERSIONS:
tipos = {
'I': 'ingreso',
'E': 'egreso',
@ -1839,7 +1990,7 @@ def _receptor(doc, version, values):
return data
data['usocfdi'] = values['usocfdi']
data.update(values['receptor'])
# ~ data.update(values['receptor'])
return data
@ -1857,7 +2008,7 @@ def _conceptos(doc, version, options):
data.append(values)
continue
if version == '3.3':
if version in CFDI_VERSIONS:
if 'noidentificacion' in values:
values['noidentificacion'] = '{}\n(SAT {})'.format(
values['noidentificacion'], values['ClaveProdServ'])
@ -1921,19 +2072,22 @@ def _totales(doc, cfdi, version):
# ~ for n in node.getchildren():
for n in list(node):
tmp = CaseInsensitiveDict(n.attrib.copy())
if version == '3.3':
tasa = round(float(tmp['tasaocuota']), DECIMALES)
if version in CFDI_VERSIONS:
tasa = ''
if 'tasaocuota' in tmp:
tasa = round(float(tmp['tasaocuota']), DECIMALES)
title = 'Traslado {} {}'.format(tn.get(tmp['impuesto']), tasa)
else:
title = 'Traslado {} {}'.format(tmp['impuesto'], tmp['tasa'])
traslados.append((title, float(tmp['importe'])))
if 'importe' in tmp:
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 == '3.3':
if version in CFDI_VERSIONS:
title = 'Retención {} {}'.format(
tn.get(tmp['impuesto']), '')
else:
@ -1965,7 +2119,7 @@ def _totales(doc, cfdi, version):
def _timbre(doc, version, values, pdf_from='1'):
CADENA = '||{version}|{UUID}|{FechaTimbrado}|{selloCFD}|{noCertificadoSAT}||'
if version == '3.3':
if version in CFDI_VERSIONS:
CADENA = '||{Version}|{UUID}|{FechaTimbrado}|{SelloCFD}|{NoCertificadoSAT}||'
node = doc.find('{}Complemento/{}TimbreFiscalDigital'.format(
PRE[version], PRE['TIMBRE']))
@ -2095,19 +2249,54 @@ 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):
node = doc.find('{}Complemento/{}Pagos'.format(PRE[version], PRE['pagos']))
pre_pays = PRE_DEFAULT['PAGOS']['PRE']
path = f"{PRE[version]}Complemento/{pre_pays}Pagos"
node = doc.find(path)
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 {}
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()))
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['related'] = related
info['related'] = related
data['comprobante']['totalenletras'] = to_letters(
float(info['monto']), info['monedap'])
@ -2120,6 +2309,7 @@ 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']
@ -2226,11 +2416,37 @@ 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'],
@ -2347,6 +2563,15 @@ 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}
@ -2824,6 +3049,20 @@ 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)
@ -2923,4 +3162,8 @@ 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

@ -55,7 +55,7 @@ from dateutil import parser
from .cfdi_xml import CFDI
from settings import DEBUG, DB_COMPANIES, PATHS, TEMPLATE_CANCEL, RFCS
from settings import DEBUG, DB_COMPANIES, PATHS, TEMPLATE_CANCEL, RFCS, PRE
from .pacs.cfdi_cert import SATCertificate
from .pacs import PACComercioDigital
@ -88,6 +88,7 @@ PACS = {
'finkok': PACFinkok,
'comercio': PACComercioDigital,
}
NS_CFDI = {
'cfdi': 'http://www.sat.gob.mx/cfd/3',
'tdf': 'http://www.sat.gob.mx/TimbreFiscalDigital',
@ -255,11 +256,18 @@ 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 = {
'cfdi': 'http://www.sat.gob.mx/cfd/3',
'tfd': 'http://www.sat.gob.mx/TimbreFiscalDigital',
'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',
@ -267,6 +275,54 @@ class CfdiToDict(object):
'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',
}
@ -305,8 +361,30 @@ class CfdiToDict(object):
'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': (),
}
@ -318,9 +396,54 @@ 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']]
@ -332,6 +455,14 @@ class CfdiToDict(object):
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:
@ -397,6 +528,94 @@ class CfdiToDict(object):
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
@ -656,7 +875,8 @@ def db_backup_local():
def now():
return datetime.datetime.now().replace(microsecond=0)
n = datetime.datetime.now().replace(microsecond=0)
return n
def get_days(date):
@ -725,6 +945,9 @@ def xml_cancel(xml, auth, cert, name):
def get_client_balance(auth, rfc=''):
if not auth:
return 'p/c'
pac = PACS[auth['pac']]()
balance = pac.client_balance(auth, rfc)
if pac.error:
@ -741,9 +964,6 @@ 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()))
@ -760,17 +980,28 @@ 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=NS_CFDI)
rfc_pac = tree.xpath(path, namespaces=namespaces)
return RFCS[rfc_pac]
def _cancel_with_cert(invoice, args, auth, certificado):
cert = SATCertificate(certificado.cer, certificado.key_enc.encode())
pac = PACS[auth['pac']]()
# ~ info = {'cer': cert.cer_pem, 'key': cert.key_pem, 'pass': '', 'args': args}
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': decrypt(bytes(certificado.p12).decode(), certificado.serie), 'args': args}
'key_enc': certificado.key, 'pass': contra, 'args': args}
result = pac.cancel(invoice.xml, info, auth)
if pac.error:
@ -818,17 +1049,20 @@ 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=NS_CFDI) or
tree.xpath('string(//cfdi:Emisor/@Rfc)', namespaces=NS_CFDI)
tree.xpath('string(//cfdi:Emisor/@rfc)', namespaces=namespaces) or
tree.xpath('string(//cfdi:Emisor/@Rfc)', namespaces=namespaces)
)
receptor = escape(
tree.xpath('string(//cfdi:Receptor/@rfc)', namespaces=NS_CFDI) or
tree.xpath('string(//cfdi:Receptor/@Rfc)', namespaces=NS_CFDI)
tree.xpath('string(//cfdi:Receptor/@rfc)', namespaces=namespaces) or
tree.xpath('string(//cfdi:Receptor/@Rfc)', namespaces=namespaces)
)
total = tree.get('total') or tree.get('Total')
uuid = tree.xpath(BF.format('TimbreFiscalDigital', 'UUID'))
@ -953,6 +1187,7 @@ 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
@ -973,3 +1208,18 @@ 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,6 +25,8 @@ from controllers.main import (AppEmpresas,
AppWareHouse,
AppWareHouseProduct,
AppSATUnidadesPeso,
AppSATRegimenes,
AppSociosRegimenes,
)
@ -78,6 +80,8 @@ 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,6 +70,9 @@ 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'])
@ -200,6 +203,10 @@ 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'])
@ -227,6 +234,9 @@ 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()
@ -526,6 +536,12 @@ 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

@ -28,12 +28,9 @@ from conf import DEBUG, MV, LOG_PATH
try:
from conf import DEFAULT_PASSWORD
except ImportError:
DEFAULT_PASSWORD = 'salgueiro3.3'
DEFAULT_PASSWORD = 'salgueiro4.0'
try:
from conf import TITLE_APP
except ImportError:
TITLE_APP = 'Empresa Libre'
TITLE_APP = 'Empresa Libre'
try:
from conf import NO_HTTPS
@ -42,7 +39,8 @@ except ImportError:
DEBUG = DEBUG
VERSION = '1.46.0'
VERSION = '2.3.2'
EMAIL_SUPPORT = ('soporte@empresalibre.mx',)
TITLE_APP = '{} v{}'.format(TITLE_APP, VERSION)
@ -127,12 +125,29 @@ 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}',
@ -141,11 +156,15 @@ PRE = {
'1.1': '{http://www.sat.gob.mx/nomina}',
'1.2': '{http://www.sat.gob.mx/nomina12}',
},
'pagos': '{http://www.sat.gob.mx/Pagos}',
'PAGOS': {
'1.0': '{http://www.sat.gob.mx/Pagos}',
}
}
CURRENT_CFDI = '3.3'
CURRENT_CFDI_NOMINA = '1.2'
# To delete
# ~ CURRENT_CFDI = '4.0'
# ~ CURRENT_CFDI_NOMINA = '1.2'
DECIMALES = 2
DECIMALES_TAX = 4
DECIMALES_PRECIOS = 4
@ -168,7 +187,8 @@ DEFAULT_CFDIPAY = {
'TYPE': 'P',
'WAYPAY': 'PPD',
'CURRENCY': 'XXX',
'USED': 'P01',
'TC': '1',
'USED': 'CP01',
'KEYSAT': '84111506',
'UNITKEY': 'ACT',
'DESCRIPTION': 'Pago',
@ -181,7 +201,7 @@ PUBLIC = 'Público en general'
DEFAULT_SAT_NOMINA = {
'SERIE': 'N',
'FORMA_PAGO': '99',
'USO_CFDI': 'P01',
'USO_CFDI': 'CN01',
'CLAVE': '84111505',
'UNIDAD': 'ACT',
'DESCRIPCION': 'Pago de nómina',
@ -193,6 +213,7 @@ 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'))
@ -236,6 +257,8 @@ VALUES_PDF = {
},
}
RESICO = '626'
RFCS = {
'PUBLIC': 'XAXX010101000',
'FOREIGN': 'XEXX010101000',

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": false},
{"key": "616", "name": "Sin obligaciones fiscales", "fisica": true, "activo": true},
{"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,7 +682,10 @@
{"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": 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}
]
},
{
@ -728,7 +731,7 @@
"pais": "MEX"
},
{
"key": "DIF",
"key": "CMX",
"name": "Ciudad de M\u00e9xico",
"pais": "MEX"
},

Binary file not shown.

Before

Width:  |  Height:  |  Size: 754 B

After

Width:  |  Height:  |  Size: 380 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 22 KiB

View File

@ -60,6 +60,7 @@ 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)
@ -76,15 +77,13 @@ 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)
@ -115,6 +114,7 @@ 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,7 +134,9 @@ 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)
@ -209,7 +211,9 @@ function cmd_save_emisor_click(){
msg = 'Longitud inválida del C.P. de Expedición'
msg_error(msg)
return
}else if(values.emisor_cp2){
}
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'
@ -218,17 +222,12 @@ 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., asegurate de que sea correcto'
msg = 'No se encontró el C.P. de Expedición, asegurate de que sea correcto'
msg_error(msg)
}else{
valid_cp = true
}
}
})
}
if(!valid_cp){
return
}
if(values.es_ong){
if(!values.ong_autorizacion){
@ -444,6 +443,15 @@ 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()
@ -502,7 +510,9 @@ function set_config_templates(){
success: function(text, data, xhr) {
var values = data.json()
Object.keys(values).forEach(function(key){
show(key, values[key])
if(key!='txt_plantilla_donataria'){
show(key, values[key])
}
})
}
})
@ -943,42 +953,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){
@ -1019,42 +1029,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){
@ -1139,83 +1149,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){
@ -1256,44 +1266,6 @@ 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',
@ -1318,6 +1290,8 @@ 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()
}
}
@ -1417,6 +1391,21 @@ 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,6 +81,7 @@ 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()
}
@ -578,13 +579,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){
@ -953,6 +954,7 @@ function cmd_complemento_pago_click(){
}
set_data_pay(row)
$$('chk_pay_close_when_stamp').setValue(false)
$$('multi_bancos').setValue('bank_pay')
}
@ -993,6 +995,8 @@ 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, {
@ -1010,6 +1014,11 @@ function send_stamp_cfdi_pay(id_mov){
}
}
})
if(close){
$$('multi_bancos').setValue('banco_home')
}
}
function save_cfdi_pay(form){
@ -1063,6 +1072,61 @@ 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()
@ -1074,34 +1138,8 @@ function cmd_pay_cancel_click(){
return
}
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)
}
}
})
}
}
})
win_invoice_cancel_pay.init()
$$('win_invoice_cancel_pay').show()
}
@ -1389,3 +1427,83 @@ 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,6 +40,7 @@ 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})
})
@ -115,16 +116,19 @@ 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()
@ -136,6 +140,7 @@ 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,29 +485,43 @@ function cmd_nomina_cancel_click(){
return
}
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'])
}
}
})
win_invoice_cancel_nomina.init()
$$('win_invoice_cancel_nomina').show()
}
function cancel_nomina(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){
var grid = $$('grid_nomina')
var row = grid.getSelectedItem()
var data = new Object()
data['opt'] = 'cancel'
data['id'] = id
data['id'] = row.id
data['args'] = {reason: reason, uuid: uuid}
webix.ajax().sync().post('nomina', data, {
error:function(text, data, XmlHttpRequest){
@ -517,7 +531,7 @@ function cancel_nomina(id){
success:function(text, data, XmlHttpRequest){
values = data.json();
if(values.ok){
grid.updateItem(id, values.row)
grid.updateItem(row.id, values.row)
msg_ok(values.msg)
}else{
msg_error(values.msg)
@ -609,3 +623,5 @@ function cmd_nomina_sat_click(){
})
}

View File

@ -95,6 +95,7 @@ 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()
}
@ -123,6 +124,7 @@ 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')
@ -132,8 +134,10 @@ 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'}]
}
@ -145,12 +149,15 @@ 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()
}
@ -239,7 +246,17 @@ 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){
@ -343,18 +360,28 @@ 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();
@ -372,10 +399,12 @@ function opt_tipo_change(new_value, old_value){
}else if (new_value == 2){
query = table_usocfdi.chain().find({moral: true}).data()
}else{
query = [{id: 'P01', value: 'Por definir'}]
query = [{id: 'S01', value: '[S01] Sin efectos fiscales. '}]
}
$$('lst_uso_cfdi_socio').getList().parse(query)
$$('lst_uso_cfdi_socio').refresh()
}
@ -619,3 +648,21 @@ 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,6 +123,7 @@ 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){
@ -131,9 +132,10 @@ 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()
msg_error(text)
},
success: function(text, data, xhr){
var values = data.json()
@ -230,18 +232,9 @@ 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
@ -252,7 +245,19 @@ 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,7 +149,9 @@ 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){
@ -611,12 +613,18 @@ 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){
@ -644,6 +652,7 @@ 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)
@ -680,12 +689,26 @@ 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'
msg = 'Todos los datos son correctos.<BR><BR>¿Estás seguro de generar esta factura?'
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?'
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 = "Público en general";
var PUBLICO = "PUBLICO EN GENERAL";
var RFC_PUBLICO = "XAXX010101000";
var RFC_EXTRANJERO = "XEXX010101000";
var PAIS = "México";
@ -24,6 +24,7 @@ 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');
@ -54,6 +55,42 @@ 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 = {
@ -627,3 +664,33 @@ 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,7 +176,9 @@ 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',
@ -596,8 +598,22 @@ var type_make_pdf = [
]
//~ Templates
var opt_templates_cfdi = [
{id: '_3.3_cp_2.0.ods', value: 'CFDI v3.3 - Carta Porte 2.0'},
{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'}
]
@ -610,14 +626,6 @@ 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',
@ -625,32 +633,11 @@ 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},
@ -685,7 +672,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'},
labelRight: 'Calcular impuestos con 4 decimales', hidden: true},
{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,
@ -704,6 +691,8 @@ 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},
@ -711,6 +700,11 @@ 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'},
@ -832,7 +826,7 @@ var options_admin_products = [
var options_admin_complements = [
{maxHeight: 20},
{maxHeight: 10},
{template: 'Complemento de Nómina', type: 'section'},
{cols: [{maxWidth: 15},
{view: 'checkbox', id: 'chk_usar_nomina', labelWidth: 0,
@ -842,7 +836,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: 20},
{maxHeight: 10},
{template: 'Complemento de Pagos', type: 'section'},
{cols: [{maxWidth: 15},
{view: 'checkbox', id: 'chk_config_pagos', labelWidth: 0,
@ -854,25 +848,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: 20},
{maxHeight: 10},
{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: 20},
{maxHeight: 10},
{template: 'Complemento INE', type: 'section'},
{cols: [{maxWidth: 15},
{view: 'checkbox', id: 'chk_config_ine', labelWidth: 0,
labelRight: 'Usar el complemento INE'},
{maxWidth: 15}]},
{maxHeight: 20},
{maxHeight: 10},
{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: 20},
{maxHeight: 10},
{template: 'Complemento Leyendas Fiscales', type: 'section'},
{cols: [{maxWidth: 15},
{view: 'checkbox', id: 'chk_config_leyendas_fiscales', labelWidth: 0,
@ -881,12 +875,17 @@ var options_admin_complements = [
type: 'form', align: 'center', autowidth: true, disabled: true},
{}, {maxWidth: 15}
]},
{maxHeight: 20},
{maxHeight: 10},
{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}]},
]
@ -1135,6 +1134,19 @@ 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',
@ -1147,6 +1159,18 @@ 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',
@ -1169,6 +1193,7 @@ var admin_taxes = [
'CEDULAR',
'CMIC',
'SUPERVISION',
'MANO DE OBRA',
]
var admin_sat_impuestos = {cols: [{maxWidth: 15},
@ -1317,6 +1342,16 @@ 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',
@ -1414,6 +1449,7 @@ 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

@ -347,6 +347,8 @@ 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'}
@ -365,11 +367,13 @@ 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: 200, options: months},
labelAlign: 'right', labelWidth: 50, width: 175, options: months},
{view: 'daterangepicker', id: 'filter_invoice_pay_dates', label: 'Fechas',
labelAlign: 'right', width: 300},
labelAlign: 'right', width: 275},
{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'},
{},
]
@ -608,3 +612,77 @@ 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)
}
}

View File

@ -224,6 +224,8 @@ var toolbar_invoices_generate = {view: 'toolbar', elements: [{},
labelWidth: 0, width: 100, hidden: true},
{view: 'checkbox', id: 'chk_cfdi_donativo', labelRight: 'Es Donativo',
labelWidth: 0, width: 100, hidden: true},
{view: 'button', id: 'cmd_show_global_information', label: 'Global',
type: 'iconButton', autowidth: true, hidden: false, icon: 'file-code-o'},
{}]}
@ -232,6 +234,8 @@ var toolbar_invoices_filter = [
labelWidth: 50, width: 150, options: []},
{view: 'richselect', id: 'filter_month', label: 'Mes', labelAlign: 'right',
labelWidth: 50, width: 200, options: months},
{view: 'richselect', id: 'filter_day', label: 'Día', labelAlign: 'right',
labelWidth: 50, width: 125, options: days},
{view: 'daterangepicker', id: 'filter_dates', label: 'Fechas',
labelAlign: 'right', width: 300},
{},
@ -418,6 +422,7 @@ var suggest_partners = {
{id: 'rfc', adjust: 'data'},
{id: 'forma_pago', hidden: true},
{id: 'uso_cfdi', hidden: true},
{id: 'codigo_postal', hidden: true},
],
dataFeed:function(text){
if (text.length > 2){
@ -484,8 +489,11 @@ var suggest_students = {
}
var body_comprobante = {rows: [{
cols: [
var body_comprobante = {rows: [
{view: 'datepicker', id: 'date_invoice', label: 'Fecha', format: '%d-%F-%Y',
required: true, invalidMessage: 'Selecciona una fecha', hidden: true
},
{cols: [
{
view: 'richselect',
id: 'lst_tipo_comprobante',
@ -515,8 +523,8 @@ var body_comprobante = {rows: [{
var opt_metodo_pago = [
{id: 'PUE', value: 'Pago en una sola exhibición'},
{id: 'PPD', value: 'Pago en parcialidades o diferido'}
{id: 'PUE', value: '[PUE] Pago en una sola exhibición'},
{id: 'PPD', value: '[PPD] Pago en parcialidades o diferido'}
]
@ -596,6 +604,10 @@ var controls_generate = [
autowidth:true},
{view: 'label', id: 'lbl_client', name: 'lbl_client',
label: 'Ninguno'},
]},
{cols: [{
view: 'richselect', id: 'lst_invoice_client_regimen',
label: 'Regimen Fiscal: ', labelWidth: 150, options: []}
]}
]}},
{view: 'fieldset', label: 'Buscar Producto', body: {rows: [
@ -833,20 +845,66 @@ var controls_leyendas_fiscales = [
]
var opt_transporte_internacional = [
var opt_ccp_transporte_internacional = [
{id: 'Sí', value: 'Sí'},
{id: 'No', value: 'No'},
]
var opt_entrada_salida = [
var opt_ccp_regimen_aduanero = [
{id: '', value: ''},
{id: 'IMD', value: '[IMD] Definitivo de importación.'},
{id: 'EXD', value: '[EXD] Definitivo de exportación.'},
{id: 'ITR', value: '[ITR] Temporales de importación para retomar al extranjero en el mismo estado.'},
{id: 'ITE', value: '[ITE] Temporales de importación para elaboración, transformación o reparación para empresas con programa IMMEX.'},
{id: 'ETR', value: '[ETR] Temporales de exportación para retornar al país en el mismo estado.'},
{id: 'ETE', value: '[ETE] Temporales de exportación para elaboración, transformación o reparación.'},
{id: 'DFI', value: '[DFI] Depósito Fiscal.'},
{id: 'RFE', value: '[RFE] Elaboración, transformación o reparación en recinto fiscalizado.'},
{id: 'RFS', value: '[RFS] Recinto fiscalizado estratégico.'},
{id: 'TRA', value: '[TRA] Tránsitos.'},
]
var opt_ccp_entrada_salida = [
{id: '', value: ''},
{id: 'Entrada', value: 'Entrada'},
{id: 'Salida', value: 'Salida'},
]
var opt_origen_destino = [
var opt_ccp_pais_origen = [
{id: '', value: ''},
]
var opt_ccp_via_entrada = [
{id: '', value: ''},
{id: '01', value: '[01] Autotransporte'},
{id: '02', value: '[02] Marítimo'},
{id: '03', value: '[03] Aéreo'},
{id: '04', value: '[04] Ferroviario'},
]
var opt_ccp_ubicacion_polo = [
{id: '', value: ''},
{id: '01', value: '[01] Coatzacoalcos I'},
{id: '02', value: '[02] Coatzacoalcos II'},
{id: '03', value: '[03] Texistepec'},
{id: '04', value: '[04] San Juan Evangelista'},
{id: '05', value: '[05] Salina Cruz'},
{id: '06', value: '[06] San Blas Atempa'},
]
var opt_ccp_registro_istmo = [
{id: '', value: ''},
{id: 'Si', value: 'Sí'},
]
var opt_ccp_origen_destino = [
{id: 'Origen', value: 'Origen'},
{id: 'Destino', value: 'Destino'},
]
@ -861,12 +919,12 @@ var date_suggest = {
}
var opt_countries = [
var opt_ccp_countries = [
{id: 'MEX', value: 'México'},
]
var opt_carta_estados = [
var opt_ccp_carta_estados = [
{id: 'AGU', value: 'Aguascalientes'},
{id: 'BCN', value: 'Baja California'},
{id: 'BCS', value: 'Baja California Sur'},
@ -903,18 +961,25 @@ var opt_carta_estados = [
]
var grid_cols_carta_ubicaciones = [
var grid_cols_ccp_ubicaciones = [
{id: 'id', header: 'ID', hidden: true},
{id: 'delete', header: '', hidden: true, width: 30, css: 'delete'},
{id: 'TipoUbicacion', header: 'Tipo de Ubicación', editor: 'select', options: opt_origen_destino, fillspace: 1},
{id: 'delete', header: '', width: 30, css: 'delete'},
{id: 'TipoUbicacion', header: 'TipoUbicacion', editor: 'select', options: opt_ccp_origen_destino, fillspace: 1},
//~ {id: 'IDUbicacion', header: 'IDUbicacion', hidden: true, editor: 'text', fillspace: 1},
{id: 'RFCRemitenteDestinatario', header: 'RFC Rem/Des', editor: 'text', fillspace: 1},
{id: 'NombreRemitenteDestinatario', header: 'Nombre Rem/Des', editor: 'text', fillspace: 1},
//~ {id: 'NumRegIdTrib', header: 'NumRegIdTrib', hidden: true, editor: 'text', fillspace: 1},
//~ {id: 'ResidenciaFiscal', header: 'ResidenciaFiscal', hidden: true, editor: 'text', fillspace: 1},
//~ {id: 'NumEstacion', header: 'NumEstacion', hidden: true, editor: 'text', fillspace: 1},
//~ {id: 'NombreEstacion', header: 'NombreEstacion', hidden: true, editor: 'text', fillspace: 1},
//~ {id: 'NavegacionTrafico', header: 'NavegacionTrafico', hidden: true, editor: 'text', fillspace: 1},
{id: 'FechaHoraSalidaLlegada', header: 'Fecha/Hora', editor: 'date', suggest: date_suggest, format: webix.Date.dateToStr("%D, %d-%M-%Y %h:%i"), footer: 'Total distancia:', fillspace: 1},
//~ {id: 'TipoEstacion', header: 'TipoEstacion', hidden: true, editor: 'text', fillspace: 1},
{id: 'DistanciaRecorrida', header: 'Distancia (KM)', editor: 'text', format: webix.i18n.numberFormat, css: 'right', footer: {content: 'summColumn', css: 'right'}, fillspace: 1},
{id: 'Municipio', headerd: 'Municipio', editor: 'text', fillspace: 1},
{id: 'Estado', headerd: 'Estado', editor: 'select', options: opt_carta_estados, fillspace: 1},
{id: 'Pais', headerd: 'Pais', editor: 'select', options: opt_countries, fillspace: 1},
{id: 'CodigoPostal', headerd: 'C.P.', editor: 'text', fillspace: 1},
{id: 'Municipio', header: 'Municipio', editor: 'text', fillspace: 1},
{id: 'Estado', header: 'Estado', editor: 'select', options: opt_ccp_carta_estados, fillspace: 1},
{id: 'Pais', header: 'País', editor: 'select', options: opt_ccp_countries, fillspace: 1},
{id: 'CodigoPostal', header: 'C.P.', editor: 'text', fillspace: 1},
]
//~ Calle
//~ NumeroExterior
@ -924,19 +989,29 @@ var grid_cols_carta_ubicaciones = [
//~ Referencia
var grid_cols_carta_mercancias = [
var grid_cols_ccp_mercancias = [
{id: 'id', header: 'ID', hidden: true},
{id: 'delete', header: '', width: 30, css: 'delete'},
{id: 'BienesTransp', header: 'Clave SAT', editor: 'text', fillspace: 1},
//~ {id: 'ClaveSTCC', header: 'ClaveSTCC', editor: 'text', fillspace: 1},
{id: 'Descripcion', header: 'Descripción', editor: 'text', fillspace: 1},
{id: 'Cantidad', header: 'Cantidad', editor: 'text', format: webix.i18n.numberFormat, css: 'right', fillspace: 1},
{id: 'ClaveUnidad', header: 'Unidad', editor: 'select', options: 'values/unitbykey', footer: 'Total peso:', fillspace: 1},
//~ {id: 'ValorMercancia', header: 'Valor Mercancia', format: webix.i18n.priceFormat, css: 'right', footer: 'Total peso:', fillspace: 1},
//~ {id: 'Unidad', header: 'Unidad', editor: 'text', fillspace: 1},
//~ {id: 'Dimensiones', header: 'Dimensiones', editor: 'text', fillspace: 1},
//~ {id: 'MaterialPeligroso', header: 'MaterialPeligroso', editor: 'text', fillspace: 1},
//~ {id: 'CveMaterialPeligroso', header: 'CveMaterialPeligroso', editor: 'text', fillspace: 1},
//~ {id: 'Embalaje', header: 'Embalaje', editor: 'text', fillspace: 1},
//~ {id: 'DescripEmbalaje', header: 'DescripEmbalaje', editor: 'text', fillspace: 1},
//~ {id: 'SectorCOFEPRIS', header: 'SectorCOFEPRIS', editor: 'text', fillspace: 1},
{id: 'PesoEnKg', header: 'Peso (Kg)', format: webix.i18n.numberFormat, css: 'right', editor: 'text', footer: {content: 'summColumn', css: 'right'}, fillspace: 1},
//~ {id: 'ValorMercancia', header: 'Valor Mercancia', format: webix.i18n.priceFormat, css: 'right', footer: 'Total peso:', fillspace: 1},
//~ {id: 'Moneda', header: 'Moneda', editor: 'text', fillspace: 1},
//~ {id: 'FraccionArancelaria', header: 'FraccionArancelaria', editor: 'text', fillspace: 1},
]
var opt_carta_tipo_permiso_sct = [
var opt_ccp_tipo_permiso_sct = [
{id: 'TPAF01', value: '[TPAF01] Autotransporte Federal de carga general.'},
{id: 'TPAF02', value: '[TPAF02] Transporte privado de carga.'},
{id: 'TPAF03', value: '[TPAF03] Autotransporte Federal de Carga Especializada de materiales y residuos peligrosos.'},
@ -966,7 +1041,7 @@ var opt_carta_tipo_permiso_sct = [
]
var opt_config_auto = [
var opt_ccp_config_auto = [
{id: '', value: ''},
{id: 'VL', value: '[VL] Vehículo ligero de carga (2 llantas en el eje delantero y 2 llantas en el eje trasero)'},
{id: 'C2', value: '[C2] Camión Unitario (2 llantas en el eje delantero y 4 llantas en el eje trasero)'},
@ -1005,7 +1080,7 @@ var opt_config_auto = [
]
var opt_carta_tipo_remolque = [
var opt_ccp_tipo_remolque = [
{id: '', value: ''},
{id: 'CTR001', value: '[CTR001] Caballete'},
{id: 'CTR002', value: '[CTR002] Caja'},
@ -1041,27 +1116,42 @@ var opt_carta_tipo_remolque = [
]
var opt_carta_aseguradoras = [
{id: 'General de Seguros', value: 'General de Seguros'},
{id: 'Qualitas', value: 'Qualitas'},
]
//~ var opt_carta_aseguradoras = [
//~ {id: 'General de Seguros', value: 'General de Seguros'},
//~ {id: 'Qualitas', value: 'Qualitas'},
//~ ]
var grid_cols_carta_autotransporte = [
var grid_cols_ccp_autotransporte = [
{id: 'id', header: 'ID', hidden: true},
{id: 'PermSCT', header: 'Tipo Permiso SCT', editor: 'select', options: opt_carta_tipo_permiso_sct, fillspace: 1},
{id: 'NumPermisoSCT', header: 'Número Permiso SCT', editor: 'text', fillspace: 1},
{id: 'ConfigVehicular', header: 'Clave Autotransporte', editor: 'select', options: opt_config_auto, fillspace: 1},
{id: 'PermSCT', header: 'PermSCT', editor: 'select', options: opt_ccp_tipo_permiso_sct, fillspace: 1},
{id: 'NumPermisoSCT', header: 'NumPermisoSCT', editor: 'text', fillspace: 1},
{id: 'ConfigVehicular', header: 'ConfigVehicular', editor: 'select', options: opt_ccp_config_auto, fillspace: 1},
{id: 'PesoBrutoVehicular', header: 'PesoBrutoVehicular', editor: 'text', format: webix.i18n.numberFormat, css: 'right', fillspace: 1},
{id: 'PlacaVM', header: 'Placa', editor: 'text', fillspace: 1},
{id: 'AnioModeloVM', header: 'Modelo (Año)', editor: 'text', fillspace: 1},
{id: 'SubTipoRem', header: 'ST Remolque', editor: 'select', options: opt_carta_tipo_remolque, fillspace: 1},
//~ {id: 'SubTipoRem', header: 'ST Remolque', editor: 'select', options: opt_ccp_tipo_remolque, fillspace: 1},
//~ {id: 'Placa', header: 'Placa', editor: 'text', fillspace: 1},
]
var grid_cols_ccp_remolques = [
{id: 'id', header: 'ID', hidden: true},
{id: 'delete', header: '', width: 30, css: 'delete'},
{id: 'SubTipoRem', header: 'SubTipo Remolque', editor: 'select', options: opt_ccp_tipo_remolque, fillspace: 1},
{id: 'Placa', header: 'Placa', editor: 'text', fillspace: 1},
]
var grid_cols_ccp_seguros = [
{id: 'id', header: 'ID', hidden: true},
{id: 'AseguraRespCivil', header: 'Aseguradora', editor: 'text', fillspace: 1},
{id: 'PolizaRespCivil', header: 'Póliza', editor: 'text', fillspace: 1},
//~ {id: 'AseguraMedAmbiente', header: 'AseguraMedAmbiente', editor: 'text', fillspace: 1},
//~ {id: 'PolizaMedAmbiente', header: 'PolizaMedAmbiente', editor: 'text', fillspace: 1},
//~ {id: 'AseguraCarga', header: 'AseguraCarga', editor: 'text', fillspace: 1},
//~ {id: 'PolizaCarga', header: 'PolizaCarga', editor: 'text', fillspace: 1},
//~ {id: 'PrimaSeguro', header: 'PrimaSeguro', editor: 'text', format: webix.i18n.numberFormat, css: 'right', fillspace: 1},
]
var opt_tipos_figura = [
var opt_ccp_tipos_figura = [
{id: '', value: ''},
{id: '01', value: '[01] Operador'},
{id: '02', value: '[02] Propietario'},
@ -1070,101 +1160,167 @@ var opt_tipos_figura = [
]
var grid_cols_carta_tipos_figuras = [
var grid_cols_ccp_tipos_figuras = [
{id: 'id', header: 'ID', hidden: true},
{id: 'TipoFigura', header: 'Tipo Figura', editor: 'select', options: opt_tipos_figura, fillspace: 1},
{id: 'RFCFigura', header: 'RFC Figura', editor: 'text', fillspace: 1},
{id: 'NombreFigura', header: 'Nombre Figura', editor: 'text', fillspace: 1},
{id: 'NumLicencia', header: 'Número de Licencia', editor: 'text', fillspace: 1},
{id: 'TipoFigura', header: 'TipoFigura', editor: 'select', options: opt_ccp_tipos_figura, fillspace: 1},
{id: 'RFCFigura', header: 'RFCFigura', editor: 'text', fillspace: 1},
{id: 'NumLicencia', header: 'NumLicencia', editor: 'text', fillspace: 1},
{id: 'NombreFigura', header: 'NombreFigura', editor: 'text', fillspace: 1},
//~ {id: 'NumRegIdTribFigura', header: 'NumRegIdTribFigura', editor: 'text', fillspace: 1},
//~ {id: 'ResidenciaFiscalFigura', header: 'ResidenciaFiscalFigura', editor: 'text', fillspace: 1},
//~ {id: 'Municipio', header: 'Municipio', editor: 'text', fillspace: 1},
//~ {id: 'Estado', header: 'Estado', editor: 'select', options: opt_ccp_carta_estados, fillspace: 1},
//~ {id: 'Pais', header: 'País', editor: 'select', options: opt_ccp_countries, fillspace: 1},
//~ {id: 'CodigoPostal', header: 'C.P.', editor: 'text', fillspace: 1},
]
var grid_carta_ubicaciones = {
var grid_ccp_ubicaciones = {
view: 'datatable',
id: 'grid_carta_ubicaciones',
id: 'grid_ccp_ubicaciones',
multiselect: false,
adjust: true,
autoheight: true,
headermenu: true,
editable: true,
footer: true,
columns: grid_cols_carta_ubicaciones,
//~ data: data_tmp1,
data: [
{delete: '-', TipoUbicacion: 'Origen', Pais: 'MEX'},
{delete: '-', TipoUbicacion: 'Destino', Pais: 'MEX'},
]
columns: grid_cols_ccp_ubicaciones,
}
var grid_carta_mercancias = {
var grid_ccp_mercancias = {
view: 'datatable',
id: 'grid_carta_mercancias',
id: 'grid_ccp_mercancias',
multiselect: false,
adjust: true,
autoheight: true,
headermenu: true,
editable: true,
footer: true,
columns: grid_cols_carta_mercancias,
columns: grid_cols_ccp_mercancias,
}
var grid_carta_autotransporte = {
var grid_ccp_autotransporte = {
view: 'datatable',
id: 'grid_carta_autotransporte',
id: 'grid_ccp_autotransporte',
multiselect: false,
adjust: true,
autoheight: true,
headermenu: true,
editable: true,
columns: grid_cols_carta_autotransporte,
columns: grid_cols_ccp_autotransporte,
data: [{id: 0}],
//~ data: data_tmp2,
}
var grid_carta_tipos_figuras = {
var grid_ccp_remolques = {
view: 'datatable',
id: 'grid_carta_tipos_figuras',
id: 'grid_ccp_remolques',
multiselect: false,
adjust: true,
autoheight: true,
headermenu: true,
editable: true,
columns: grid_cols_carta_tipos_figuras,
columns: grid_cols_ccp_remolques,
}
var grid_ccp_seguros = {
view: 'datatable',
id: 'grid_ccp_seguros',
multiselect: false,
adjust: true,
autoheight: true,
headermenu: true,
editable: true,
columns: grid_cols_ccp_seguros,
data: [{id: 0}],
//~ data: data_tmp3,
}
var body_carta_mercancias = {rows:[
var grid_ccp_tipos_figuras = {
view: 'datatable',
id: 'grid_ccp_tipos_figuras',
multiselect: false,
adjust: true,
autoheight: true,
headermenu: true,
editable: true,
columns: grid_cols_ccp_tipos_figuras,
data: [{id: 0}],
}
var body_ccp_ubicaciones = {rows:[
{cols: [
{view: 'button', id: 'cmd_carta_add_product', label: 'Agregar Mercancía', icon: 'plus',
{view: 'button', id: 'cmd_ccp_agregar_ubicacion', label: 'Agregar Ubicación', icon: 'plus',
type: 'iconButton', autowidth: true, align: 'center'},
{view: 'button', id: 'cmd_carta_copy_from_invoice', label: 'Copiar de CFDI', icon: 'copy',
{}]},
{maxHeight: 10},
grid_ccp_ubicaciones,
]}
var body_ccp_mercancias = {rows:[
{cols: [
{view: 'button', id: 'cmd_ccp_add_product', label: 'Agregar Mercancía', icon: 'plus',
type: 'iconButton', autowidth: true, align: 'center'},
//~ {view: 'button', id: 'cmd_carta_copy_from_invoice', label: 'Copiar de CFDI', icon: 'copy',
//~ type: 'iconButton', autowidth: true, align: 'center'},
{},
{view: 'richselect', id: 'lst_carta_UnidadPeso', label: 'Unidad de Peso: ',
labelWidth: 110, maxWidth: 300, options: '/satunidadespeso?opt=active'}
]},
{maxHeight: 10},
grid_carta_mercancias,
grid_ccp_mercancias,
]}
var body_carta_ubicaciones = {rows:[
grid_carta_ubicaciones,
var body_ccp_autotransporte = {rows:[
grid_ccp_autotransporte,
{minHeight: 10},
{cols: [
{view: 'button', id: 'cmd_ccp_agregar_remolque', label: 'Agregar Remolque', icon: 'plus',
type: 'iconButton', autowidth: true, align: 'center'},
{}]},
{minHeight: 10},
grid_ccp_remolques,
{minHeight: 10},
grid_ccp_seguros,
]}
var body_carta_autotransporte = {rows:[
grid_carta_autotransporte,
var body_ccp_tipos_figuras = {rows:[
grid_ccp_tipos_figuras,
]}
var body_carta_tipos_figuras = {rows:[
grid_carta_tipos_figuras,
var body_cp_datos_generales = {rows:[
{cols: [{maxWidth: 15},
{view: 'richselect', id: 'lst_cp_TranspInternac', labelPosition: 'top',
label: 'TranspInternac', options: opt_ccp_transporte_internacional,
value: 'No', readonly: true},
{view: 'richselect', id: 'lst_cp_RegimenAduanero', labelPosition: 'top',
label: 'RegimenAduanero', options: opt_ccp_regimen_aduanero,
value: '', disabled: true},
{view: 'richselect', id: 'lst_cp_EntradaSalidaMerc', labelPosition: 'top',
label: 'EntradaSalidaMerc', options: opt_ccp_entrada_salida,
value: '', disabled: true},
{view: 'richselect', id: 'lst_cp_PaisOrigenDestino', labelPosition: 'top',
label: 'PaisOrigenDestino', options: opt_ccp_pais_origen,
value: '', disabled: true},
{view: 'richselect', id: 'lst_cp_ViaEntradaSalida', labelPosition: 'top',
label: 'ViaEntradaSalida', options: opt_ccp_via_entrada,
value: '', disabled: true},
]},
{cols: [{maxWidth: 15},
{view: 'richselect', id: 'lst_cp_RegistroISTMO', labelPosition: 'top',
label: 'RegistroISTMO', options: opt_ccp_registro_istmo,
value: '', readonly: false},
{view: 'richselect', id: 'lst_cp_UbicacionPoloOrigen', labelPosition: 'top',
label: 'UbicacionPoloOrigen', options: opt_ccp_ubicacion_polo,
value: '', disabled: true},
{view: 'richselect', id: 'lst_cp_UbicacionPoloDestino', labelPosition: 'top',
label: 'UbicacionPoloDestino', options: opt_ccp_ubicacion_polo,
value: '', disabled: true},
{}]},
]}
@ -1177,24 +1333,276 @@ var controls_carta_porte = [
{view: 'button', id: 'cmd_carta_import_ods', label: 'Importar ODS',
icon: 'upload', type: 'iconButton', autowidth: true, align: 'center'},
{maxWidth: 15}]},
{view: 'fieldset', label: 'Mercancias', body: body_carta_mercancias},
{view: 'fieldset', label: 'Datos generales', body: body_cp_datos_generales},
{view: 'fieldset', label: 'Ubicaciones', body: body_ccp_ubicaciones},
{view: 'fieldset', label: 'Mercancias', body: body_ccp_mercancias},
{view: 'fieldset', label: 'Autotransporte', body: body_ccp_autotransporte},
{view: 'fieldset', label: 'Tipos Figura', body: body_ccp_tipos_figuras},
]
var opt_ce_exportacion = [
{id: '02', value: '[02] Definitiva con clave A1'},
{id: '03', value: '[03] Temporal'},
{id: '04', value: '[04] Definitiva con clave distinta a A1'},
]
var opt_ce_motivo_traslado = [
{id: '', value: ''},
{id: '01', value: '[01] Envío de mercancias facturadas con anterioridad'},
{id: '02', value: '[02] Reubicación de mercancías propias'},
{id: '03', value: '[03] Envío de mercancías objeto de contrato de consignación'},
{id: '04', value: '[04] Envío de mercancías para posterior enajenación'},
{id: '05', value: '[05] Envío de mercancías propiedad de terceros'},
{id: '99', value: '[99] Otros'},
]
var opt_ce_clave_pedimento = [
{id: 'A1', value: '[A1] Definitiva'},
]
var opt_ce_certificado_origen = [
{id: '0', value: '[0] No funge'},
{id: '1', value: '[1] Funge'},
]
var opt_ce_incoterm = [
{id: 'CFR', value: '[CFR] Coste y flete (puerto de destino convenido)'},
{id: 'CIF', value: '[CIF] Coste, seguro y flete (puerto de destino convenido)'},
{id: 'CPT', value: '[CPT] Trasnporte pagado hasta el lugar de destino convenido'},
{id: 'CIP', value: '[CIP] Trasnporte y seguro pagado hasta el lugar de destino convenido'},
{id: 'DAP', value: '[DAP] Entregada en lugar'},
{id: 'DDP', value: '[DDP] Entregada derechos pagados en lugar de destino convenido'},
{id: 'DPU', value: '[DPU] Entregada y descargada en lugar acordado'},
{id: 'EXW', value: '[EXW] En fábrica (lugar convenido)'},
{id: 'FCA', value: '[FCA] Franco transportista (lugar designado)'},
{id: 'FAS', value: '[FAS] Franco al costado del buque (puerto de carga convenido)'},
{id: 'FOB', value: '[FOB] Franco a bordo (puerto de carga convenido)'},
]
var body_ce_datos_generales = {rows:[
{cols: [{maxWidth: 15},
{view: 'richselect', id: 'lst_carta_TranspInternac', labelPosition: 'top',
label: 'Transporte Internacional', options: opt_transporte_internacional,
value: 'No', readonly: true},
{view: 'richselect', id: 'lst_carta_EntradaSalidaMerc', labelPosition: 'top',
label: 'Entrada o Salida', options: opt_entrada_salida,
value: '', disabled: true},
{view: 'richselect', id: 'lst_carta_PaisOrigenDestino', labelPosition: 'top',
label: 'País Origen/Destino', options: [],
value: '', disabled: true},
{view: 'richselect', id: 'lst_carta_ViaEntradaSalida', labelPosition: 'top',
label: 'Vía de Entrada o Salida', options: [],
value: '', disabled: true},
]},
{view: 'fieldset', label: 'Ubicaciones', body: body_carta_ubicaciones},
{view: 'fieldset', label: 'Autotransporte', body: body_carta_autotransporte},
{view: 'fieldset', label: 'Tipos Figura', body: body_carta_tipos_figuras},
{view: 'richselect', id: 'lst_ce_exportacion', label: 'Exportación: ',
value: '02', labelWidth: 130, minWidth: 400, options: opt_ce_exportacion},
{view: 'richselect', id: 'lst_ce_motivo_traslado', label: 'Motivo Traslado: ',
labelWidth: 130, minWidth: 500, options: opt_ce_motivo_traslado},
{},
{maxWidth: 15}]},
{cols: [{maxWidth: 15},
{view: 'richselect', id: 'lst_ce_clave_pedimento', label: 'Clave de Pedimento: ',
value: 'A1', labelWidth: 130, minWidth: 400, maxWidth: 400, options: opt_ce_clave_pedimento},
{view: 'richselect', id: 'lst_ce_certificado_origen', label: 'Certificado Origen: ',
value: '0', labelWidth: 130, maxWidth: 300, options: opt_ce_certificado_origen},
{view: 'text', id: 'txt_ce_numero_certificado', label: 'Nº Certificado:', labelWidth: 100},
{maxWidth: 15}]},
{cols: [{maxWidth: 15},
{view: 'text', id: 'txt_ce_numero_exportador', label: 'Nº Exportador: ',
labelWidth: 130, minWidth: 400, maxWidth: 500},
{view: 'richselect', id: 'lst_ce_incoterm', label: 'Incoterm: ', value: 'CFR',
labelWidth: 130, minWidth: 500, maxWidth: 500, options: opt_ce_incoterm},
{view: 'text', id: 'txt_ce_observaciones', label: 'Observaciones:', labelWidth: 100},
{maxWidth: 15}]},
{cols: [{maxWidth: 15},
{view: 'text', id: 'txt_ce_total_usd', label: 'Total USD: ',
labelWidth: 130, minWidth: 400, inputAlign: 'right'},
{view: 'text', id: 'txt_ce_tipo_cambio_usd', label: 'Tipo Cambio USD:', labelWidth: 130,
inputAlign: 'right'},
{},
{view: 'button', id: 'cmd_ce_tipo_cambio', label: 'TC Banxico',
type: 'iconButton', autowidth: true, icon: ''},
{maxWidth: 15}]},
]}
var grid_cols_ce_emisor = [
{id: 'id', header: 'ID', hidden: true},
{id: 'Curp', header: 'Curp', editor: 'text', fillspace: 1},
{id: 'Calle', header: 'Calle *', editor: 'text', fillspace: 1},
{id: 'NumeroExterior', header: 'Numero Exterior', editor: 'text', fillspace: 1},
{id: 'NumeroInterior', header: 'Número Interior', editor: 'text', fillspace: 1},
{id: 'Colonia', header: 'Colonia', editor: 'text', fillspace: 1},
{id: 'Municipio', header: 'Municipio', editor: 'text', fillspace: 1},
{id: 'Estado', header: 'Estado *', editor: 'text', fillspace: 1},
{id: 'Pais', header: 'País *', editor: 'text', fillspace: 1},
{id: 'CodigoPostal', header: 'C.P. *', editor: 'text', fillspace: 1},
]
var grid_ce_emisor = {
view: 'datatable',
id: 'grid_ce_emisor',
multiselect: false,
adjust: true,
autoheight: true,
headermenu: true,
editable: true,
columns: grid_cols_ce_emisor,
data: [{id: 0}],
}
var body_ce_emisor = {rows:[
grid_ce_emisor
]}
var grid_cols_ce_propietarios = [
{id: 'id', header: 'ID', hidden: true},
{id: 'delete', header: '', width: 30, css: 'delete'},
{id: 'NumRegIdTrib', header: 'Registro Fiscal', editor: 'text', fillspace: 1},
{id: 'ResidenciaFiscal', header: 'Residencia Fiscal', editor: 'text', fillspace: 1},
]
var grid_ce_propietarios = {
view: 'datatable',
id: 'grid_ce_propietarios',
multiselect: false,
adjust: true,
autoheight: true,
headermenu: true,
editable: true,
footer: false,
columns: grid_cols_ce_propietarios,
}
var body_ce_propietarios = {rows:[
{cols: [
{view: 'button', id: 'cmd_ce_add_propietario', label: 'Agregar Propietario',
icon: 'plus', type: 'iconButton', autowidth: true, align: 'center'},
{},
]},
{maxHeight: 10},
grid_ce_propietarios
]}
var grid_cols_ce_receptor = [
{id: 'id', header: 'ID', hidden: true},
{id: 'NumRegIdTrib', header: 'Registro Fiscal', editor: 'text', fillspace: 1},
{id: 'Calle', header: 'Calle *', editor: 'text', fillspace: 1},
{id: 'NumeroExterior', header: 'Numero Exterior', editor: 'text', fillspace: 1},
{id: 'NumeroInterior', header: 'Número Interior', editor: 'text', fillspace: 1},
{id: 'Colonia', header: 'Colonia', editor: 'text', fillspace: 1},
{id: 'Municipio', header: 'Municipio', editor: 'text', fillspace: 1},
{id: 'Estado', header: 'Estado *', editor: 'text', fillspace: 1},
{id: 'Pais', header: 'País *', editor: 'text', fillspace: 1},
{id: 'CodigoPostal', header: 'C.P. *', editor: 'text', fillspace: 1},
]
var grid_ce_receptor = {
view: 'datatable',
id: 'grid_ce_receptor',
multiselect: false,
adjust: true,
autoheight: true,
headermenu: true,
editable: true,
columns: grid_cols_ce_receptor,
data: [{id: 0}],
}
var body_ce_receptor = {rows:[
grid_ce_receptor
]}
var grid_cols_ce_destinatario = [
{id: 'id', header: 'ID', hidden: true},
{id: 'NumRegIdTrib', header: 'Registro Fiscal', editor: 'text', fillspace: 1},
{id: 'Nombre', header: 'Nombre', editor: 'text', fillspace: 1},
{id: 'Calle', header: 'Calle *', editor: 'text', fillspace: 1},
{id: 'NumeroExterior', header: 'No Exterior', editor: 'text', fillspace: 1},
{id: 'NumeroInterior', header: 'No Interior', editor: 'text', fillspace: 1},
{id: 'Colonia', header: 'Colonia', editor: 'text', fillspace: 1},
{id: 'Municipio', header: 'Municipio', editor: 'text', fillspace: 1},
{id: 'Estado', header: 'Estado *', editor: 'text', fillspace: 1},
{id: 'Pais', header: 'País *', editor: 'text', fillspace: 1},
{id: 'CodigoPostal', header: 'C.P. *', editor: 'text', fillspace: 1},
]
var grid_ce_destinatario = {
view: 'datatable',
id: 'grid_ce_destinatario',
multiselect: false,
adjust: true,
autoheight: true,
headermenu: true,
editable: true,
columns: grid_cols_ce_destinatario,
data: [{id: 0}],
}
var body_ce_destinatario = {rows:[
grid_ce_destinatario
]}
var grid_cols_ce_mercancias = [
{id: 'id', header: 'ID', hidden: true},
{id: 'delete', header: '', width: 30, css: 'delete'},
{id: 'NoIdentificacion', header: 'Clave', editor: 'text', fillspace: 1},
{id: 'FraccionArancelaria', header: 'Fraccion Arancelaria', editor: 'text', fillspace: 1},
{id: 'CantidadAduana', header: 'Cantidad Aduana', editor: 'text', fillspace: 1},
{id: 'UnidadAduana', header: 'Unidad Aduana', editor: 'text', fillspace: 1},
{id: 'ValorUnitarioAduana', header: 'PU Aduana', editor: 'text', fillspace: 1},
{id: 'ValorDolares', header: 'Valor USD', editor: 'text', fillspace: 1},
{id: 'Marca', header: 'Marca', editor: 'text', hidden: true, fillspace: 1},
{id: 'Modelo', header: 'Modelo', editor: 'text', hidden: true, fillspace: 1},
{id: 'SubModelo', header: 'SubModelo', editor: 'text', hidden: true, fillspace: 1},
{id: 'NumeroSerie', header: 'Serie', editor: 'text', hidden: true, fillspace: 1},
]
var grid_ce_mercancias = {
view: 'datatable',
id: 'grid_ce_mercancias',
multiselect: false,
adjust: true,
autoheight: true,
headermenu: true,
editable: true,
footer: true,
columns: grid_cols_ce_mercancias,
}
var body_ce_mercancias = {rows:[
{cols: [
{view: 'button', id: 'cmd_ce_add_mercancia', label: 'Agregar Mercancía',
icon: 'plus', type: 'iconButton', autowidth: true, align: 'center'},
{},
]},
{maxHeight: 10},
grid_ce_mercancias
]}
var controls_comercio_exterior = [
{cols: [{maxWidth: 15},
{view: 'checkbox', id: 'chk_cfdi_usar_comercioe', labelWidth: 0,
labelRight: 'Usar el complemento Comercio Exterior'},
{},
{view: 'button', id: 'cmd_import_json_comercioe', label: 'Importar JSON',
icon: 'upload', type: 'iconButton', autowidth: true, align: 'center'},
{view: 'button', id: 'cmd_ce_import_ods', label: 'Importar ODS',
icon: 'upload', type: 'iconButton', autowidth: true, align: 'center'},
{maxWidth: 15}]},
{view: 'fieldset', label: 'Datos generales', body: body_ce_datos_generales},
{view: 'fieldset', label: 'Emisor', body: body_ce_emisor},
{view: 'fieldset', label: 'Propietario', body: body_ce_propietarios},
{view: 'fieldset', label: 'Receptor', body: body_ce_receptor},
{view: 'fieldset', label: 'Destinatario', body: body_ce_destinatario},
{view: 'fieldset', label: 'Mercancías', body: body_ce_mercancias},
]
@ -1211,6 +1619,19 @@ var form_carta_porte = {
}
var form_comercio_exterior = {
type: 'space',
responsive: true,
cols: [{
view: 'form',
id: 'form_comercio_exterior',
complexData: true,
scroll: true,
elements: controls_comercio_exterior,
}]
}
var controls_invoices = [
{
view: 'tabview',
@ -1222,6 +1643,7 @@ var controls_invoices = [
{id: 'INE', rows: controls_ine},
{id: 'Leyendas Fiscales', rows: controls_leyendas_fiscales},
{id: 'Carta Porte', rows: [form_carta_porte]},
{id: 'Comercio Exterior', rows: [form_comercio_exterior]},
]
},
]
@ -1288,7 +1710,13 @@ var win_import_invoice = {
width: 400,
modal: true,
position: 'center',
head: 'Importar Factura de Plantilla',
head: {view: 'toolbar',
elements: [
{view: 'label', label: 'Importar Factura en Lote'},
{view: 'icon', icon: 'times-circle',
click: '$$("win_import_invoice").close()'},
]
},
body: body_upload_invoice,
})
$$('cmd_upload_invoice').attachEvent('onItemClick', cmd_upload_invoice_click)
@ -1364,7 +1792,114 @@ var win_carta_import_json = {
head: 'Importar Carta Porte JSON',
body: body_upload_carta_json,
})
//~ $$('cmd_upload_invoice').attachEvent('onItemClick', cmd_upload_invoice_click)
$$('up_invoice_json').attachEvent('onAfterFileAdd', up_invoice_json_on_after_file_add)
}
}
var body_upload_json_comercioe = {rows: [
{view: 'form', id: 'form_upload_comercioe', rows: [
{cols: [{},
{view: 'uploader', id: 'up_invoice_json', autosend: false,
link: 'lst_upload_invoice', value: 'Seleccionar Archivo',
accept:'application/json', upload: ''}, {}]},
{cols: [
{view: 'list', id: 'lst_upload_invoice', name: 'lst_upload_invoice',
type: 'uploader', autoheight: true, borderless: true}]},
]},
]}
var win_import_json_comercioe = {
init: function(){
webix.ui({
view: 'window',
id: 'win_import_json_comercioe',
width: 400,
modal: true,
position: 'center',
head: 'Importar Comerio Exterior JSON',
body: body_upload_json_comercioe,
})
$$('up_invoice_json').attachEvent('onAfterFileAdd', up_invoice_json_comercioe_on_after_file_add)
}
}
var body_global_information = {rows: [{minHeight: 5},
{view: 'richselect', id: 'lst_global_periodicidad', label: 'Periodicidad:', options: opt_global_periodicidad, value: '01'},
{view: 'richselect', id: 'lst_global_months', label: 'Mes:', options: opt_global_months, value: '01'},
{view: 'richselect', id: 'lst_global_year', label: 'Año:', options: []},
{view: 'label', label: '¿Guardar estos datos?', width: 300, align: 'center'},
{cols: [{},
{view: 'button', id: 'cmd_save_global_information', width: 100, label: 'Si Guardar'},
{maxWidth: 25},
{view: 'button', id: 'cmd_win_global_close', width: 100, label: 'No, Cerrar'},
{}
]},
{minHeight: 10},
]}
var win_global_information = {
init: function(){
webix.ui({
view: 'window',
id: 'win_global_information',
modal: true,
width: 400,
position: 'center',
head: 'Información Global',
body: body_global_information,
})
var current_date = new Date()
var current_month = (current_date.getMonth() + 1).toString().padStart(2, '0')
$$('lst_global_months').setValue(current_month)
var current_year = current_date.getFullYear()
$$('lst_global_year').getList().parse([{id: current_year, value: current_year}])
$$('lst_global_year').setValue(current_year)
$$('cmd_save_global_information').attachEvent('onItemClick', cmd_save_global_information_click)
$$('cmd_win_global_close').attachEvent('onItemClick', cmd_win_global_close_click)
}
}
var body_win_ce_import_ods = {rows: [
{view: 'form', id: 'form_ce_import_ods', rows: [
{cols: [{},
{view: 'uploader', id: 'ce_up_template', autosend: false,
link: 'lst_ce_up_template', value: 'Seleccionar Archivo',
upload: '/files/ceods'}, {}]},
{cols: [
{view: 'list', id: 'lst_ce_up_template',
type: 'uploader', autoheight: true, borderless: true}]},
{cols: [{}, {view: 'button', id: 'cmd_ce_upload_ods',
label: 'Importar Plantilla'}, {}]},
]},
]}
var win_ce_import_ods = {
init: function(){
webix.ui({
view: 'window',
id: 'win_ce_import_ods',
width: 400,
modal: true,
position: 'center',
head: {view: 'toolbar',
elements: [
{view: 'label', label: 'Importar desde archivo ODS'},
{view: 'icon', icon: 'times-circle',
click: '$$("win_ce_import_ods").close()'},
]
},
body: body_win_ce_import_ods,
})
$$('cmd_ce_upload_ods').attachEvent('onItemClick', cmd_ce_upload_ods_click)
$$('ce_up_template').attachEvent('onUploadComplete', ce_up_template_complete)
}
}

View File

@ -245,3 +245,44 @@ 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}},{}]},
width: 300, label: 'C.P.: ', attributes: {maxlength: 5}, required: true},{}]},
{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,6 +122,12 @@ 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},
{},
]}
]
@ -159,7 +165,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',
{view: 'text', name: 'tags', label: 'Etiquetas', disabled: true,
tooltip: 'Utiles para filtrados rápidos. Separa por comas.'},
{view: 'textarea' , height: 200, name: 'notas', label: 'Notas'},
]

View File

@ -111,6 +111,15 @@ 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,
@ -141,13 +150,10 @@ 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: 'text', id: 'cant_by_packing', name: 'cant_by_packing',
labelAlign: 'right', labelWidth: 150, inputAlign: "right",
label: 'Cantidad por empaque:'},
{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: 'tags_producto', name: 'tags_producto',
//~ labelAlign: 'right', label: 'Etiquetas',
//~ placeholder: 'Separadas por comas'}
]},
{cols: [
{view: "currency", type: "text", id: "valor_unitario",

View File

@ -235,7 +235,12 @@ 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 del día'}, {},
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},
{},
{view: 'button', id: 'cmd_close_ticket_invoice', label: 'Cerrar',
type: 'danger', autowidth: true, align: 'center'}
]}

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -1,347 +1,401 @@
<?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>
<?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>

347
source/xslt/cadena3.3.xslt Normal file
View File

@ -0,0 +1,347 @@
<?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

@ -0,0 +1,744 @@
<?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

@ -0,0 +1,171 @@
<?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>

233
source/xslt/pagos20.xslt Normal file
View File

@ -0,0 +1,233 @@
<?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="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">
<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">
<!-- 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

@ -0,0 +1,22 @@
<?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>