Compare commits
480 Commits
Author | SHA1 | Date |
---|---|---|
El Mau | 34a981a2dd | |
El Mau | 66549e271b | |
El Mau | 884b10bd79 | |
El Mau | fd050159ba | |
El Mau | 8199667188 | |
El Mau | 05d3f617eb | |
El Mau | 0ec4f0c2c9 | |
El Mau | 29bfb42abc | |
El Mau | 7f129b84b2 | |
El Mau | 13a3c106c6 | |
El Mau | 0c7abf634b | |
El Mau | f0c4423fc8 | |
El Mau | d925587a98 | |
El Mau | 510ebdd1e5 | |
El Mau | d2e92098da | |
El Mau | c1ce206835 | |
El Mau | 1efa280920 | |
El Mau | 6fd8f9e2ea | |
El Mau | e3a44e6400 | |
El Mau | 390ec60fdd | |
El Mau | 957160755a | |
El Mau | 070ee31a1b | |
El Mau | 2620159408 | |
El Mau | 4d9bc4a172 | |
El Mau | 17ed56e9d7 | |
El Mau | 5057ac57ae | |
El Mau | 410a7080da | |
El Mau | edd8d560bd | |
El Mau | bd1699d082 | |
El Mau | 6d4023bb17 | |
Mauricio | beda45690f | |
Mauricio | 8feba167af | |
Mauricio | 4dbb797d99 | |
Mauricio | cd424b71dc | |
Mauricio | ea13d11319 | |
Mauricio | d9c863820a | |
Categulario | 6815d6c64c | |
Mauricio | 402cb7d70c | |
Mauricio | a5f1114774 | |
Mauricio | 2588a5f0b8 | |
Mauricio | eeae157772 | |
Mauricio | 7cad4093d4 | |
Mauricio | 7caf6423e1 | |
Mauricio | 8a3aea41eb | |
Mauricio | bd49356d3f | |
Mauricio | 3b54ef0a36 | |
Mauricio | 497a4be392 | |
Mauricio | 7fc6264322 | |
Mauricio | c5d0e97212 | |
Mauricio | 5bbad9ef58 | |
Mauricio | 8e7aa23d1b | |
Mauricio | f3d8b1dae5 | |
Mauricio | 2c684ae6bd | |
el Mau | febea3f289 | |
el Mau | 5facb96662 | |
el Mau | 6411c2e51e | |
el Mau | eeb128fda6 | |
el Mau | a078e27703 | |
el Mau | 28ef53043f | |
el Mau | e956c243f7 | |
el Mau | 1b33413de2 | |
el Mau | 64541a84b9 | |
el Mau | 834c1faae6 | |
el Mau | affe57bfcd | |
el Mau | 4dc54ade1e | |
el Mau | e72739a5fe | |
el Mau | dd7b9c1680 | |
el Mau | 9823bd967f | |
el Mau | aee467d98f | |
el Mau | 64917527f7 | |
el Mau | 5f56179ebb | |
el Mau | 955a0348f8 | |
el Mau | 0826b0cea2 | |
el Mau | 8b0f9fbc64 | |
el Mau | f3d827364b | |
el Mau | 50cbb3bae8 | |
el Mau | a7c8d80219 | |
el Mau | ca9d7a02e3 | |
el Mau | 31fcb63e51 | |
el Mau | bd7a31ea8a | |
el Mau | 6a6b6ca395 | |
el Mau | 3148c5ba82 | |
el Mau | 5f62ad7750 | |
el Mau | ff44162622 | |
el Mau | a37b3a5c23 | |
el Mau | 4fdea6173b | |
el Mau | 968c2744ec | |
el Mau | c9d85ca2e7 | |
el Mau | 93e64eafd8 | |
el Mau | 1984103ff5 | |
el Mau | e4ba06c0ff | |
el Mau | 38bb267e55 | |
el Mau | 602467c8e9 | |
el Mau | 4020237f68 | |
el Mau | 933c9820e6 | |
el Mau | 51daf0ad5e | |
el Mau | 709c524830 | |
el Mau | 434e15bb5b | |
el Mau | ae5949c529 | |
el Mau | af5fa3c812 | |
el Mau | 6d399fcb39 | |
el Mau | 8003fc42b9 | |
el Mau | 7a0fb2b243 | |
el Mau | 83bebde169 | |
el Mau | 76d5f51d78 | |
el Mau | 5f641c632e | |
el Mau | 85eb7cd58c | |
el Mau | 1c11a1b013 | |
el Mau | 701bb68478 | |
el Mau | f13491d983 | |
el Mau | 4020365616 | |
el Mau | a90f218c76 | |
el Mau | 37995befd8 | |
el Mau | 746c827492 | |
el Mau | 3cea54c07c | |
el Mau | 661eff1dc3 | |
el Mau | cd11456ec3 | |
el Mau | 2526a8f5aa | |
el Mau | 0a13004419 | |
el Mau | 296874a9b1 | |
el Mau | 34b1af1319 | |
el Mau | 5fbf80fb92 | |
el Mau | b56fee5f73 | |
el Mau | c9ca45b60d | |
el Mau | 86e7f50621 | |
el Mau | 2cef108856 | |
el Mau | 260ba62b2e | |
el Mau | 76d15e482b | |
el Mau | 8e2446e8f5 | |
el Mau | 482a0385cd | |
el Mau | 29e02e649d | |
el Mau | 5aece843bf | |
el Mau | d47e059d93 | |
el Mau | 89f79de9b6 | |
el Mau | fbaa85f13a | |
el Mau | bed6039fff | |
el Mau | acbaecbfc5 | |
el Mau | 8dddb7b293 | |
el Mau | 24777f691e | |
el Mau | 1d270aa478 | |
el Mau | 8872af8c50 | |
el Mau | d57ded161c | |
el Mau | 0c8d6d3cea | |
el Mau | f14c1f74d8 | |
el Mau | 210f50a7d7 | |
el Mau | 5418b23200 | |
el Mau | a13c7c0a1d | |
el Mau | a6276a33fb | |
el Mau | e3bd1e8871 | |
el Mau | 2ddb3d6b75 | |
Mauricio Baeza | 4cda9f7f21 | |
Mauricio Baeza | 7c184c9513 | |
Mauricio Baeza | aea8aeaecf | |
Mauricio Baeza | e08e4e038f | |
Mauricio Baeza | 496dcf7162 | |
Mauricio Baeza | f8cd99084a | |
Mauricio Baeza | 1e824bd841 | |
Mauricio Baeza | bc0cd9f3e1 | |
Mauricio Baeza | ae259e461b | |
Mauricio Baeza | 1a507d2eeb | |
Mauricio Baeza | f766f92618 | |
Mauricio Baeza | ad56356a6f | |
El Mau | c6cf33c4c4 | |
El Mau | dbc3910297 | |
El Mau | 6c78a282fe | |
El Mau | f8c2c5e2d6 | |
El Mau | 7d40e79f3c | |
El Mau | a36034a476 | |
El Mau | de2ab5cedd | |
El Mau | b60e2d6a37 | |
El Mau | d9021cca4a | |
El Mau | 7bbef31936 | |
El Mau | 74e7f12088 | |
El Mau | 20c0757f04 | |
El Mau | 3a5fbc609b | |
El Mau | 5e888d2337 | |
El Mau | d97fd4867a | |
El Mau | e58b8f90af | |
El Mau | 50d4a3f4b7 | |
El Mau | 1978edfaf0 | |
El Mau | 7ca87d1811 | |
El Mau | a7bc6d6f6c | |
El Mau | 1991c68b3b | |
El Mau | bebcd29710 | |
El Mau | de856f28ab | |
El Mau | e726cda085 | |
El Mau | eee386a97b | |
El Mau | ae21403c59 | |
El Mau | 110d41cf6e | |
El Mau | bd6fb65a1b | |
El Mau | b68d79d0ca | |
El Mau | 670aca3886 | |
El Mau | 68c0203039 | |
El Mau | b2cdd0efbe | |
El Mau | 51af15f311 | |
El Mau | edf35aa5ce | |
El Mau | b19d087d10 | |
El Mau | 64ef75fbf5 | |
El Mau | d6a8c1e3fa | |
El Mau | a7080bf954 | |
El Mau | 3ddf99075e | |
El Mau | bd6ba5d4d0 | |
El Mau | 6a18934b19 | |
El Mau | 61548c9135 | |
El Mau | fe3f743e32 | |
El Mau | c83e6981ae | |
El Mau | 39b9af125c | |
El Mau | dd606be46b | |
El Mau | 34df8882b3 | |
El Mau | e992103c57 | |
El Mau | 8f74d24b14 | |
El Mau | 480ec57d1e | |
El Mau | a38247727c | |
El Mau | 702aa264d8 | |
El Mau | 0422eece40 | |
El Mau | 12774af7ac | |
El Mau | b16eabd773 | |
El Mau | 1bab1cb23c | |
El Mau | 15a05e38f7 | |
El Mau | a0a8e0ce62 | |
El Mau | 825e23e369 | |
El Mau | 121831a139 | |
El Mau | c09a5749da | |
El Mau | 01ccbcabd5 | |
El Mau | cc0eee1443 | |
El Mau | 7a88c4b97f | |
El Mau | 0e7db2b711 | |
El Mau | 65851182c3 | |
El Mau | 2de98b9b92 | |
El Mau | 5a24bc159d | |
El Mau | f84721716c | |
El Mau | 8b91532b82 | |
El Mau | 0a98338fad | |
El Mau | 7bcf6d6e3c | |
El Mau | dbc8717575 | |
El Mau | 0adcd7f30f | |
El Mau | d237b33020 | |
El Mau | 5b997f7858 | |
El Mau | a609c0c6f5 | |
El Mau | d70cae64b7 | |
El Mau | 9daf07693a | |
El Mau | e40acd28ba | |
El Mau | 88dd9ca04b | |
El Mau | d2f879c224 | |
El Mau | 4922010caf | |
El Mau | ff8bc31f50 | |
El Mau | e795e87461 | |
El Mau | d2c361e174 | |
El Mau | 6b0ca817a3 | |
El Mau | 84fd8f57df | |
El Mau | f105f2a0fa | |
El Mau | ea145c630b | |
El Mau | 88bb6d9411 | |
El Mau | 0498217b65 | |
El Mau | 581e8bbdc5 | |
El Mau | c79e8492d3 | |
El Mau | f9df0d34d0 | |
El Mau | f06022ac69 | |
El Mau | 074cdc475f | |
El Mau | 0f041ed975 | |
El Mau | 6de30c3417 | |
El Mau | 8bbd2ba62b | |
El Mau | 00c58d9b41 | |
El Mau | a3d291c893 | |
El Mau | 86bc032413 | |
El Mau | a91feb15d7 | |
El Mau | 3ffc54f966 | |
El Mau | b3663dfcc6 | |
El Mau | 3cc11430d7 | |
El Mau | 4ae5197ced | |
El Mau | bf601dfcef | |
El Mau | 481594839d | |
El Mau | 7b2467f99a | |
El Mau | 2f22ad4cc8 | |
El Mau | 46d6329754 | |
El Mau | 2a2689a61b | |
El Mau | 76663fdd67 | |
El Mau | 54ab86a089 | |
El Mau | 7fe5251153 | |
El Mau | fe4829c6b8 | |
El Mau | bb90b3f6d7 | |
El Mau | f4779dbb99 | |
El Mau | 47ec5ad360 | |
El Mau | 80957afb84 | |
El Mau | b9af99aad6 | |
El Mau | 43e932e445 | |
El Mau | 8a151d42ad | |
El Mau | db77f6972d | |
El Mau | ef2314880f | |
El Mau | 1a1cb1173e | |
El Mau | fe26744a8f | |
El Mau | 69402e03bb | |
El Mau | 4a84654117 | |
El Mau | 81428c4f8e | |
El Mau | 28ef107949 | |
El Mau | e372f064b4 | |
El Mau | 46efb3693c | |
El Mau | d2bacc3b6b | |
El Mau | 264090f2a6 | |
El Mau | 425cd53df1 | |
El Mau | b7e8bb3cff | |
El Mau | 1df477e0b1 | |
El Mau | 9b09fbbcd1 | |
El Mau | f793cd2240 | |
El Mau | 54f2a574a3 | |
El Mau | 219f7c6712 | |
El Mau | 342f64a18b | |
El Mau | e880256cde | |
El Mau | 3a1cb8d142 | |
El Mau | 42a840f85c | |
Mauricio Baeza | 2e5f4ac27e | |
Mauricio Baeza | 98f091a347 | |
Mauricio Baeza | 82ec2faac5 | |
Mauricio Baeza | 11c0cc4899 | |
Mauricio Baeza | 1c9c829296 | |
Mauricio Baeza | 03f26b65e4 | |
Mauricio Baeza | 00f2b2b126 | |
Mauricio Baeza | c77438216d | |
Mauricio Baeza | b02b2b0e63 | |
Mauricio Baeza | 75788474ba | |
Mauricio Baeza | 866e8c40b9 | |
Mauricio Baeza | c64de2bbb9 | |
Mauricio Baeza | cd35884999 | |
Mauricio Baeza | c4e29e47fa | |
Mauricio Baeza | 00cbe4d557 | |
Mauricio Baeza | a95a6842f9 | |
Mauricio Baeza | 30a4a276dd | |
Mauricio Baeza | 416bc65174 | |
Mauricio Baeza | 3dd88f14d6 | |
Mauricio Baeza | fb24346601 | |
Mauricio Baeza | f792b79655 | |
Mauricio Baeza | 2055a904f6 | |
Mauricio Baeza | 7a1fd8fcaf | |
Mauricio Baeza | cd22a5a24d | |
Mauricio Baeza | 25e86cd28c | |
Mauricio Baeza | 4aad1a94eb | |
Mauricio Baeza | 229be3b415 | |
Mauricio Baeza | bc53171969 | |
Mauricio Baeza | 61a8937eb3 | |
Mauricio Baeza | be75abeb54 | |
Mauricio Baeza | 2c314a3891 | |
Mauricio Baeza | 7fc1d42381 | |
Mauricio Baeza | 0957cf673f | |
Mauricio Baeza | f99adaf109 | |
Mauricio Baeza | 91cfbb0508 | |
Mauricio Baeza | 4f18e1e01f | |
Mauricio Baeza | 7e7b08b1c0 | |
Mauricio Baeza | 4006322f30 | |
Mauricio Baeza | 935483f7ee | |
Mauricio Baeza | 80b766783d | |
Mauricio Baeza | 8822687308 | |
Mauricio Baeza | 0512e0f6dd | |
Mauricio Baeza | 93f0d09f4d | |
Mauricio Baeza | 870d95cb5a | |
Mauricio Baeza | 9fa35d5592 | |
Mauricio Baeza | 2bfe86973a | |
Mauricio Baeza | 896be35e3b | |
Mauricio Baeza | f2af10c2df | |
Mauricio Baeza | 8f7aaac563 | |
Mauricio Baeza | 8a615144a6 | |
Mauricio Baeza | 227204abec | |
Mauricio Baeza | 637c69b9c7 | |
Mauricio Baeza | 4f3bdbda95 | |
Mauricio Baeza | 34c467d26e | |
Mauricio Baeza | d61672dac4 | |
Mauricio Baeza | 1aa6540ac1 | |
Mauricio Baeza | 1b87591f62 | |
Mauricio Baeza | 986020a4a3 | |
Mauricio Baeza | 3514944f5d | |
Mauricio Baeza | 9be913c47d | |
Mauricio Baeza | b9d87f0343 | |
Mauricio Baeza | 585632882d | |
Mauricio Baeza | 920ff62e98 | |
Mauricio Baeza | dc61d3b010 | |
Mauricio Baeza | 62a0a82699 | |
Mauricio Baeza | 702ac88b38 | |
Mauricio Baeza | 535cc9d527 | |
Mauricio Baeza | cf35cd08cd | |
Mauricio Baeza | e9eeab8c2c | |
Mauricio Baeza | a518278b55 | |
Mauricio Baeza | 0442019ea5 | |
Mauricio Baeza | fa94e36e7f | |
Mauricio Baeza | 348be949ac | |
Mauricio Baeza | 565f36be3a | |
Mauricio Baeza | 7062151e79 | |
Mauricio Baeza | 5f1edc76ca | |
Mauricio Baeza | 5729a1f83e | |
Mauricio Baeza | 1a9087b13a | |
Mauricio Baeza | a2670cb92c | |
Mauricio Baeza | a8667a5d4f | |
Mauricio Baeza | 952dcba7ae | |
Mauricio Baeza | 676ff29b57 | |
Mauricio Baeza | 12a24c1117 | |
Mauricio Baeza | e59941db34 | |
Mauricio Baeza | 0e881eb17a | |
Mauricio Baeza | fa01e6cf01 | |
Mauricio Baeza | 51e2464141 | |
Mauricio Baeza | 3e43cc3b46 | |
Mauricio Baeza | b5bdcbbeb3 | |
Mauricio Baeza | 4f71dd0de3 | |
Mauricio Baeza | 720c9f0cb1 | |
Mauricio Baeza | 66d740e8d1 | |
Mauricio Baeza | 892906c46f | |
Mauricio Baeza | aa68225571 | |
Mauricio Baeza | 4f40bc3bfa | |
Mauricio Baeza | b03fbebe09 | |
Mauricio Baeza | 3cdbe14287 | |
Mauricio Baeza | 0bbf0b438f | |
Mauricio Baeza | c98cdd7fff | |
Mauricio Baeza | f0b5fa5ae9 | |
Mauricio Baeza | 537cecbb0b | |
Mauricio Baeza | 7f44f7f26d | |
Mauricio Baeza | c1e1c5ad7c | |
Mauricio Baeza | 3c574425eb | |
Mauricio Baeza | 5b8cd0ecb2 | |
Mauricio Baeza | 05a51741b6 | |
Mauricio Baeza | b3e2671359 | |
Mauricio Baeza | 5c047ee9d5 | |
Mauricio Baeza | b680d728a7 | |
Mauricio Baeza | 431422361b | |
Mauricio Baeza | 85e58c2728 | |
Mauricio Baeza | 739ac08205 | |
Mauricio Baeza | 64adba1588 | |
Mauricio Baeza | de06f706a6 | |
Mauricio Baeza | 6785dfebf7 | |
Mauricio Baeza | aaccece897 | |
Mauricio Baeza | 94f5df0723 | |
Mauricio Baeza | f813fb4dd8 | |
Mauricio Baeza | 49d5838822 | |
Mauricio Baeza | 51b4386b24 | |
Mauricio Baeza | 38f3c125cd | |
Mauricio Baeza | e678083eea | |
Mauricio Baeza | b612991476 | |
Mauricio Baeza | 32679fced3 | |
Mauricio Baeza | 8e4bf56846 | |
Mauricio Baeza | 0084197906 | |
Mauricio Baeza | ace4ef21a7 | |
Mauricio Baeza | 17fa99e45b | |
Mauricio Baeza | e547ce0113 | |
Mauricio Baeza | 858fd829aa | |
Mauricio Baeza | 788a1723b4 | |
Mauricio Baeza | 4b9df44dac | |
Mauricio Baeza | cca598310b | |
Mauricio Baeza | 39071be43b | |
Mauricio Baeza | e633f8e2bf | |
Mauricio Baeza | 21fd903943 | |
Mauricio Baeza | fec1c8523a | |
Mauricio Baeza | 0a04ec6c26 | |
Mauricio Baeza | a7945dba58 | |
Mauricio Baeza | 348a7f6ecb | |
Mauricio Baeza | cf189b08fa | |
Mauricio Baeza | 9423aeef6c | |
Mauricio Baeza | 90eec635ce | |
Mauricio Baeza | 8f15961d20 | |
Mauricio Baeza | 8a8f05384b | |
Mauricio Baeza | a54ad8d760 | |
Mauricio Baeza | 0389c0734f | |
Mauricio Baeza | cb04910a84 | |
Mauricio Baeza | 38c9c676af | |
Mauricio Baeza | e0d1f40a11 | |
Mauricio Baeza | d8ecae2c8f | |
Mauricio Baeza | 85c5a37798 | |
Mauricio Baeza | 56e52782f4 | |
Mauricio Baeza | aae856bb74 | |
Mauricio Baeza | 95399798f8 | |
Mauricio Baeza | 75e4f2e1c0 | |
Mauricio Baeza | f02b6782be | |
Mauricio Baeza | bd7508fe6b | |
Mauricio Baeza | 1f3e51861d | |
Mauricio Baeza | 3a51a50c8e | |
Mauricio Baeza | 1c6f9cd5f7 | |
Mauricio Baeza | b6c5c72df8 | |
Mauricio Baeza | 8d815bf570 | |
Mauricio Baeza | afced92aff | |
Mauricio Baeza | 443b916056 | |
Mauricio Baeza | 1d18d97b90 | |
Mauricio Baeza | 43808efc91 | |
Mauricio Baeza | 3ef195ed48 | |
Mauricio Baeza | 980a7aafdb | |
Mauricio Baeza | 1e95b180e8 |
|
@ -2,6 +2,7 @@
|
|||
__pycache__/
|
||||
*.py[cod]
|
||||
*$py.class
|
||||
Pipfile*
|
||||
|
||||
# Django stuff:
|
||||
*.log
|
||||
|
@ -14,7 +15,7 @@ source/media
|
|||
# Sphinx documentation
|
||||
*.xlsx
|
||||
|
||||
docs/bk/
|
||||
bk/
|
||||
source/docs/
|
||||
site/
|
||||
vedev/
|
||||
|
@ -22,8 +23,9 @@ vedev/
|
|||
# Virtualenv
|
||||
.env/
|
||||
virtual/
|
||||
env
|
||||
|
||||
docs/
|
||||
docs/build
|
||||
cache/
|
||||
credenciales.conf
|
||||
*.sqlite
|
||||
|
@ -32,4 +34,5 @@ credenciales.conf
|
|||
*.orig
|
||||
rfc.db
|
||||
Dockerfile
|
||||
chuletas/
|
||||
|
||||
|
|
352
CHANGELOG.md
352
CHANGELOG.md
|
@ -1,3 +1,355 @@
|
|||
v 2.3.2 [10-Abr-2024]
|
||||
- Fix: En las mercancias en la Carta Porte al generar el PDF.
|
||||
|
||||
|
||||
v 2.3.1 [02-Abr-2024]
|
||||
- Fix: En la cantidad de la mercancia en la Carta Porte.
|
||||
|
||||
|
||||
v 2.3.0 [01-Abr-2024]
|
||||
- Mejora: Soporte para complemento Carta Porte 3.0
|
||||
- **IMPORTANTE**: Aunque no lo uses, esto afecta al JS de facturación, por
|
||||
lo que tienes que forzar el refresco (CTRL+F5) si tienes algún problema.
|
||||
|
||||
|
||||
v 2.2.0 [24-Ene-2024]
|
||||
- Mejora: Soporte para complemento Comercio Exterior 2.0
|
||||
- **IMPORTANTE**: Aunque no lo uses, esto afecta al JS de facturación, por
|
||||
lo que tienes que forzar el refresco (CTRL+F5) si tienes algún problema.
|
||||
|
||||
|
||||
v 2.1.0 [26-Dic-2023]
|
||||
- Mejora: Se agrega filtro por día en facturas.
|
||||
|
||||
|
||||
v 2.0.9 [20-Dic-2023]
|
||||
- Fix: Issue 98 y 107
|
||||
|
||||
|
||||
v 2.0.8 [30-Oct-2023]
|
||||
---------------------
|
||||
- Fix: Permitir generar CFDI de egreso para facturas globales sin datos globales.
|
||||
- Fix: Permitir cambiar la zona horaria para cuando se usa en servidor.
|
||||
|
||||
Es necesario hacer una migración:
|
||||
```
|
||||
cd /opt/empresa-libre
|
||||
|
||||
git pull origin master
|
||||
|
||||
cd source/app/models
|
||||
|
||||
python main.py -bk
|
||||
|
||||
python main.py -m -r RFC
|
||||
```
|
||||
|
||||
|
||||
v 2.0.7 [06-Ju1-2023]
|
||||
---------------------
|
||||
- Fix: En tasa de retención de un Resico a una Persona Moral.
|
||||
|
||||
|
||||
v 2.0.6 [14-Jun-2023]
|
||||
---------------------
|
||||
- Fix: Al generar complementos de pago con facturas con retención de impuestos.
|
||||
|
||||
|
||||
v 2.0.5 [05-Jun-2023]
|
||||
---------------------
|
||||
- Fix: Al generar complementos de pago con facturas con varios impuestos.
|
||||
- Fix: ticket #103, hay que usar {receptor.correo_facturas} y {receptor.telefonos}
|
||||
|
||||
|
||||
v 2.0.2 [01-Abr-2023]
|
||||
---------------------
|
||||
- Fix: Obtener la clave del sat al facturar por lote.
|
||||
|
||||
|
||||
v 2.0.1 [29-Mar-2023]
|
||||
---------------------
|
||||
- Fix ticket #97
|
||||
|
||||
Es necesario hacer una migración:
|
||||
```
|
||||
cd /opt/empresa-libre
|
||||
|
||||
git pull origin master
|
||||
|
||||
cd source/app/models
|
||||
|
||||
python main.py -bk
|
||||
|
||||
python main.py -m -r RFC
|
||||
```
|
||||
|
||||
|
||||
v 2.0.0 [08-Ene-2023]
|
||||
----------------------
|
||||
- Liberamos para todos la versión CFDI 4.0
|
||||
- **IMPORTANTE** NO intentes timbrar si **antes** no has validado en nuestro demo que puedes timbrar tus CFDIs habituales.
|
||||
|
||||
* IMPORTANTE:
|
||||
|
||||
Es necesario hacer una migración:
|
||||
|
||||
```
|
||||
cd /opt/empresa-libre
|
||||
|
||||
git pull origin master
|
||||
|
||||
cd source/app/models
|
||||
|
||||
python main.py -bk
|
||||
|
||||
python main.py -m -r RFC
|
||||
```
|
||||
|
||||
Y reiniciar todo. IMPORTANTE: dependiendo desde que versión actualices, tal vez debas de hacer algún prodecimiento extra. Siempre revisa este historial.
|
||||
|
||||
|
||||
v 2.0.0 [31-Mar-2022]
|
||||
----------------------
|
||||
- Primera versión de timbrado con CFDI4
|
||||
- **IMPORTANTE** NO intentes timbrar si **antes** no has validado en nuestro demo que puedes timbrar tus CFDIs habituales.
|
||||
|
||||
|
||||
v 1.47.0 [28-Mar-2022]
|
||||
----------------------
|
||||
- Mejora: Soporte basico para complemento Comercio Exterior.
|
||||
|
||||
|
||||
v 1.46.5 [10-Mar-2022]
|
||||
----------------------
|
||||
- Error: Al timbrar nómina con Comercio Digital
|
||||
|
||||
|
||||
v 1.46.4 [18-Feb-2022]
|
||||
----------------------
|
||||
- Error: Issue #54
|
||||
|
||||
|
||||
v 1.46.3 [15-Feb-2022]
|
||||
----------------------
|
||||
- Error: Issue #53
|
||||
|
||||
|
||||
v 1.46.2 [31-Ene-2022]
|
||||
----------------------
|
||||
- Error: Al generar Carta Porte sin remolque.
|
||||
- Error: Al cancelar con Finkok.
|
||||
|
||||
|
||||
v 1.46.1 [29-Ene-2022]
|
||||
----------------------
|
||||
- Error: Issue #49
|
||||
- Mejora: Agregar validación para distancia en origen de Carta Porte.
|
||||
|
||||
|
||||
v 1.46.0 [27-Ene-2022]
|
||||
----------------------
|
||||
- Mejora: Issue #45
|
||||
- Mejora: Agregar tipos de persimos SCT para Carta Porte
|
||||
- Mejora: Buscar estado y municipio por CP en Carta Porte
|
||||
|
||||
|
||||
v 1.45.4 [25-Ene-2022]
|
||||
----------------------
|
||||
- Error: Al timbrar carta porte.
|
||||
- Error: Al cancelar con Comercio Digital.
|
||||
- Error: Issue #42
|
||||
- Mejora: Issue #44
|
||||
|
||||
* IMPORTANTE: Es necesario subir de nuevo tus certificados de sello, **solo** si timbras con Comercio Digital.
|
||||
|
||||
|
||||
v 1.45.3 [23-Ene-2022]
|
||||
----------------------
|
||||
- Error: El enviar por correo CFDI de pago. Ticket #40
|
||||
|
||||
|
||||
v 1.45.2 [21-Ene-2022]
|
||||
----------------------
|
||||
- Error: Al cancelar un CFDI
|
||||
|
||||
|
||||
v 1.45.1 [20-Ene-2022]
|
||||
----------------------
|
||||
- Error: Al enviar correos con la nueva configuración
|
||||
|
||||
|
||||
* IMPORTANTE: Revisa tu configuración de correo para verificar que todo funcione.
|
||||
|
||||
|
||||
v 1.45.0 [20-Ene-2022]
|
||||
----------------------
|
||||
- Importar Carta Porte desde archivo JSON
|
||||
|
||||
|
||||
v 1.44.2 [19-Ene-2022]
|
||||
----------------------
|
||||
- Agregar opción STARTTLS que requieren algunos servidores de correo
|
||||
|
||||
* IMPORTANTE: Revisa tu configuración de correo para verificar si tienes que usar esta opción.
|
||||
|
||||
|
||||
v 1.44.1 [19-Ene-2022]
|
||||
----------------------
|
||||
- Correciones en generación de Carta Porte v2.0
|
||||
- Plantilla para representación impresa de Carta Porte v2.0
|
||||
|
||||
|
||||
v 1.44.0 [10-Ene-2022]
|
||||
----------------------
|
||||
- Soporte para Carta Porte v2 con CFDI 3.3
|
||||
- Soporte para el nuevo esquema de cancelación del SAT
|
||||
|
||||
* 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
|
||||
```
|
||||
|
||||
|
||||
v 1.43.0 [12-Dic-2021]
|
||||
----------------------
|
||||
- Soporte para entradas de almacen.
|
||||
- Soporte para multi almacen.
|
||||
- Soporte para regenerar un ticket.
|
||||
- Soporte para movimientos entre almacenes
|
||||
- Consulta en SAT para estatus de nómina
|
||||
|
||||
* IMPORTANTE:
|
||||
|
||||
Instalar nuevo requerimiento:
|
||||
|
||||
```
|
||||
pip install segno
|
||||
```
|
||||
|
||||
Es necesario hacer una migración:
|
||||
|
||||
```
|
||||
git pull origin master
|
||||
|
||||
cd source/app/models
|
||||
|
||||
python main.py -bk
|
||||
|
||||
python main.py -m -r RFC
|
||||
```
|
||||
|
||||
v 1.42.2 [14-Sep-2021]
|
||||
----------------------
|
||||
- Los productos pueden no llevar ningún impuesto.
|
||||
|
||||
|
||||
v 1.42.1 [01-Jun-2021]
|
||||
----------------------
|
||||
- Error - Ticket #5
|
||||
|
||||
|
||||
v 1.42.0 [24-May-2021]
|
||||
----------------------
|
||||
- Opción para que solo un admin pueda cancelar.
|
||||
|
||||
|
||||
v 1.41.4 [13-Abr-2021]
|
||||
----------------------
|
||||
- Error - Ticket #4
|
||||
|
||||
|
||||
v 1.41.3 [12-Feb-2021]
|
||||
----------------------
|
||||
- Error - Ticket #3
|
||||
|
||||
|
||||
v 1.41.2 [12-Feb-2021]
|
||||
----------------------
|
||||
- Error - Ticket #2
|
||||
|
||||
|
||||
v 1.41.1 [11-Feb-2021]
|
||||
----------------------
|
||||
- Error - Ticket #1
|
||||
|
||||
|
||||
v 1.41.0 [10-Feb-2021]
|
||||
----------------------
|
||||
- Importar clientes desde archivo CSV
|
||||
|
||||
|
||||
v 1.40.1 [09-Feb-2021]
|
||||
----------------------
|
||||
- Fix #422
|
||||
|
||||
|
||||
v 1.40.0 [05-ene-2021]
|
||||
----------------------
|
||||
- Error: Al parsear XML en Python 3.9+
|
||||
- Mejora: Agregar versión de Empresa Libre a plantilla.
|
||||
- Mejora: Sellado en memoria
|
||||
- Mejora: Se agrega un segundo PAC y se refactoriza el timbrado.
|
||||
|
||||
* **IMPORTANTE**
|
||||
|
||||
Es necesario seguir una serie de pasos **obligatorios** para migrar a esta
|
||||
versión, **no continues hasta seguir paso a paso** estas instrucciones.
|
||||
**Antes** de comenzar ten a la mano tus certificados de sello para timbrar, es
|
||||
necesario subirlos de nuevo. **NO actualices si no tienes tus certificados**
|
||||
con su respectiva contraseña, te quedarás sin poder timbrar.
|
||||
|
||||
Estas instrucciones solamente aplican para la maquina virtual con Ubuntu Server,
|
||||
la ultima y única versión sobre la que se dará soporte.
|
||||
|
||||
1. Entra a la parte administrativa y toma de tus credenciales de timbrado en el
|
||||
menú "Emisor" ficha "Otros Datos", usuario y token de timbrado.
|
||||
1. Agregar nuevos requerimientos `sudo apt install pkgconf libxml2-dev libxmlsec1-dev libxmlsec1-openssl`
|
||||
1. Agregar nuevo requerimiento `pip install --user xmlsec`
|
||||
1. Entrar a la carpeta del sistema: `/opt/empresa-libre`
|
||||
1. Actualizar `git pull origin master`
|
||||
1. Entrar a `source/app/controllers/pacs/comerciodigital` y copiar `conf.py.example` a `conf.py`
|
||||
1. Entrar a `source/app/controllers/pacs/finkok` y copiar `conf.py.example` a `conf.py`
|
||||
1. Agregar la variable `TOKEN = ''` al archivo `source/app/conf.py` mira el archivo de ejemplo en el mismo directorio.
|
||||
1. Reiniciar el servicio: `sudo systemctl restart empresalibre`
|
||||
1. Si no ves los cambios descritos a continuación, fuerza el refresco de tu navegador, generalmente con **CTRL+F5**
|
||||
1. Sube de nuevo tus certificados en el menú "Emisor" ficha "Certificado".
|
||||
1. Ve al menú "Opciones", ficha "Otros".
|
||||
1. Selecciona tu PAC, si tu usuario es un correo electrónico, invariablemente
|
||||
debes seleccionar Finkok. Si tienes duda ponte en contacto con nosotros.
|
||||
1. Establece las credenciales del punto 1.
|
||||
1. Guarda los datos.
|
||||
|
||||
|
||||
v 1.39.1 [17-sep-2020]
|
||||
----------------------
|
||||
- Error: Esquema para complemento IEDU
|
||||
|
||||
|
||||
v 1.39.0 [25-ago-2020]
|
||||
----------------------
|
||||
- Mejora: Consulta de las facturas de pago en el SAT
|
||||
- Mejora: Mostrar totales en nómina
|
||||
- Mejora: Mostrar totales por cantidad al facturar
|
||||
- Mejora: Validar líneas con importe cero antes de facturar
|
||||
- Error: Validaciones de namespace en CFDI de nómina por parte del PAC
|
||||
|
||||
|
||||
v 1.38.1 [30-mar-2020]
|
||||
----------------------
|
||||
- Error: En nómina al timbrar asimilados
|
||||
|
||||
|
||||
v 1.38.0 [08-mar-2020]
|
||||
----------------------
|
||||
- Mejora: Factura global por ticket o nota
|
||||
|
|
|
@ -13,9 +13,3 @@
|
|||
* Propon nuevas funcionalidades
|
||||
* Difunde Empresa Libre
|
||||
|
||||
|
||||
### Prioridades
|
||||
|
||||
1. [X] Darle continuidad a la facturación de los clientes
|
||||
2. Cubrir todas las funcionalidades que cubre ahora Factura Libre
|
||||
3. Agregar nuevas funcionalidades
|
||||
|
|
36
README.md
36
README.md
|
@ -10,25 +10,51 @@ Este proyecto está en continuo desarrollo, contratar un esquema de soporte,
|
|||
nos ayuda a continuar su desarrollo. Ponte en contacto con nosotros para
|
||||
contratar: administracion ARROBA empresalibre.net
|
||||
|
||||
#### Ahora también puede aportar con Bitcoin Cash (BCH):
|
||||
#### Ahora también puede aportar con criptomonedas:
|
||||
|
||||
`pq763fj7kxxf2wtf360lfsy5ydw84yz72q76hanhxq`
|
||||
G1: `A5DdXxCKPw3QKWVdDVs7CzkNugNUW1sHu5zDJFWxCU2h`
|
||||
BCH: `qztd3l00xle5tffdqvh2snvadkuau2ml0uqm4n875d`
|
||||
|
||||
|
||||
### Requerimientos:
|
||||
## Requerimientos:
|
||||
|
||||
* Servidor web, recomendado Nginx
|
||||
* uwsgi
|
||||
* python3.6+
|
||||
* python 3.8
|
||||
* xsltproc
|
||||
* openssl
|
||||
* xmlsec
|
||||
|
||||
* Ubuntu 20.04
|
||||
|
||||
```
|
||||
apt install pkg-config libxml2-dev libxmlsec1-dev libxmlsec1-openssl xsltproc
|
||||
```
|
||||
|
||||
Debería de funcionar con cualquier combinación servidor-wsgi que soporte
|
||||
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
|
||||
|
|
|
@ -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
|
|
@ -8,8 +8,10 @@ bcrypt
|
|||
python-dateutil
|
||||
zeep
|
||||
chardet
|
||||
pyqrcode
|
||||
pypng
|
||||
reportlab
|
||||
psycopg2-binary
|
||||
cryptography
|
||||
cryptography==3.4.8
|
||||
xmlsec
|
||||
segno
|
||||
|
||||
# python-escpos
|
||||
|
|
|
@ -13,13 +13,9 @@ TITLE_APP = 'Empresa Libre'
|
|||
#~ Establece una ruta accesible para el servidor web
|
||||
LOG_PATH = '/var/log/empresalibre/empresa-libre.log'
|
||||
|
||||
# ~ Establece los valores para sincronizar los backups de la base de datos
|
||||
# ~ por ejemplo
|
||||
# ~ SEAFILE_SERVER = {
|
||||
# ~ 'URL': 'https://tu_servidor_seafile',
|
||||
# ~ 'USER': 'tu_usuario',
|
||||
# ~ 'PASS': 'tu_contraseña',
|
||||
# ~ 'REPO': 'id_repo',
|
||||
# ~ }
|
||||
|
||||
SEAFILE_SERVER = {}
|
||||
# ~ Establece un token personalizado para encriptar las claves
|
||||
# ~ from secrets import token_hex
|
||||
# ~ token_hex(32)
|
||||
# ~ IMPORTANTE: Cada vez que cambies este valor, debes de subir de nuevo
|
||||
# ~ tus certificados
|
||||
TOKEN = ''
|
||||
|
|
|
@ -20,20 +20,28 @@ import datetime
|
|||
from xml.etree import ElementTree as ET
|
||||
from xml.dom.minidom import parseString
|
||||
|
||||
from dateutil import parser
|
||||
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',
|
||||
|
@ -41,17 +49,23 @@ 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',
|
||||
'xmlns': 'http://www.sat.gob.mx/nomina',
|
||||
'schema': 'http://www.sat.gob.mx/nomina http://www.sat.gob.mx/sitio_internet/cfd/nomina/nomina11.xsd',
|
||||
'schema': ' http://www.sat.gob.mx/nomina http://www.sat.gob.mx/sitio_internet/cfd/nomina/nomina11.xsd',
|
||||
},
|
||||
'nomina': {
|
||||
'version': '1.2',
|
||||
'prefix': 'nomina12',
|
||||
'xmlns': 'http://www.sat.gob.mx/nomina12',
|
||||
'schema': 'http://www.sat.gob.mx/nomina12 http://www.sat.gob.mx/sitio_internet/cfd/nomina/nomina12.xsd',
|
||||
'schema': ' http://www.sat.gob.mx/nomina12 http://www.sat.gob.mx/sitio_internet/cfd/nomina/nomina12.xsd',
|
||||
},
|
||||
'locales': {
|
||||
'version': '1.0',
|
||||
|
@ -76,13 +90,13 @@ SAT = {
|
|||
'version': '1.0',
|
||||
'prefix': 'iedu',
|
||||
'xmlns': 'http://www.sat.gob.mx/iedu',
|
||||
'schema': ' http://www.sat.gob.mx/iedu http://www.sat.gob.mx/sitio_internet/cfd/ine/iedu.xsd',
|
||||
'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',
|
||||
|
@ -96,6 +110,18 @@ SAT = {
|
|||
'xmlns': 'http://www.sat.gob.mx/leyendasFiscales',
|
||||
'schema': ' http://www.sat.gob.mx/leyendasFiscales http://www.sat.gob.mx/sitio_internet/cfd/leyendasFiscales/leyendasFisc.xsd',
|
||||
},
|
||||
'cartaporte': {
|
||||
'version': '3.0',
|
||||
'prefix': 'cartaporte30',
|
||||
'xmlns': 'http://www.sat.gob.mx/CartaPorte30',
|
||||
'schema': ' http://www.sat.gob.mx/CartaPorte30 http://www.sat.gob.mx/sitio_internet/cfd/CartaPorte/CartaPorte30.xsd',
|
||||
},
|
||||
'comercioe': {
|
||||
'version': '2.0',
|
||||
'prefix': 'cce20',
|
||||
'xmlns': 'http://www.sat.gob.mx/ComercioExterior20',
|
||||
'schema': ' http://www.sat.gob.mx/ComercioExterior20 http://www.sat.gob.mx/sitio_internet/cfd/ComercioExterior20/ComercioExterior20.xsd',
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -114,7 +140,11 @@ class CFDI(object):
|
|||
self._pagos = False
|
||||
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):
|
||||
|
@ -125,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'])
|
||||
|
@ -137,10 +169,13 @@ 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'))
|
||||
|
||||
def add_sello(self, sello):
|
||||
return xml
|
||||
|
||||
def add_sello(self, sello, cert_txt):
|
||||
self._cfdi.attrib['Sello'] = sello
|
||||
self._cfdi.attrib['Certificado'] = cert_txt
|
||||
return self._to_pretty_xml(ET.tostring(self._cfdi, encoding='utf-8'))
|
||||
|
||||
def _to_pretty_xml(self, source):
|
||||
|
@ -164,6 +199,10 @@ class CFDI(object):
|
|||
self._ine = True
|
||||
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', '')
|
||||
|
||||
|
@ -229,9 +268,22 @@ class CFDI(object):
|
|||
attributes[name] = SAT['leyendas']['xmlns']
|
||||
schema_leyendas = SAT['leyendas']['schema']
|
||||
|
||||
schema_carta_porte = ''
|
||||
if self._carta_porte:
|
||||
name = 'xmlns:{}'.format(SAT['cartaporte']['prefix'])
|
||||
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_divisas + schema_nomina + schema_pagos + schema_leyendas + \
|
||||
schema_carta_porte + schema_comercioe
|
||||
attributes.update(datos)
|
||||
|
||||
if not 'Version' in attributes:
|
||||
|
@ -239,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
|
||||
|
@ -261,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
|
||||
|
@ -269,7 +339,8 @@ class CFDI(object):
|
|||
from xml.sax.saxutils import escape, unescape
|
||||
|
||||
conceptos = ET.SubElement(self._cfdi, '{}:Conceptos'.format(self._pre))
|
||||
for row in reversed(datos):
|
||||
# ~ for row in reversed(datos):
|
||||
for row in datos:
|
||||
complemento = {}
|
||||
if 'complemento' in row:
|
||||
complemento = row.pop('complemento')
|
||||
|
@ -329,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)
|
||||
|
||||
|
@ -445,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
|
||||
|
@ -453,6 +569,52 @@ class CFDI(object):
|
|||
self._complemento = ET.SubElement(
|
||||
self._cfdi, '{}:Complemento'.format(self._pre))
|
||||
|
||||
if self._carta_porte:
|
||||
datos = datos['cartaporte']
|
||||
ubicaciones = datos.pop('ubicaciones')
|
||||
mercancias = datos.pop('mercancias', ())
|
||||
tiposfigura = datos.pop('tiposfigura', ())
|
||||
|
||||
autotransporte = datos.pop('autotransporte', {})
|
||||
identificacion = autotransporte.pop('identificacion')
|
||||
seguros = autotransporte.pop('seguros')
|
||||
remolques = autotransporte.pop('remolques')
|
||||
|
||||
atributos = {'Version': SAT['cartaporte']['version']}
|
||||
atributos.update(datos)
|
||||
|
||||
prefix = SAT['cartaporte']['prefix']
|
||||
node_carta = ET.SubElement(self._complemento, f'{prefix}:CartaPorte', atributos)
|
||||
|
||||
node = ET.SubElement(node_carta, f'{prefix}:Ubicaciones')
|
||||
for ubicacion in ubicaciones:
|
||||
domicilio = ubicacion.pop('domicilio', {})
|
||||
dt = parser.parse(ubicacion['FechaHoraSalidaLlegada'])
|
||||
ubicacion['FechaHoraSalidaLlegada'] = dt.isoformat()[:19]
|
||||
sub_node = ET.SubElement(node, f'{prefix}:Ubicacion', ubicacion)
|
||||
if domicilio:
|
||||
ET.SubElement(sub_node, f'{prefix}:Domicilio', domicilio)
|
||||
|
||||
attr = mercancias
|
||||
mercancias = attr.pop('mercancias')
|
||||
|
||||
node = ET.SubElement(node_carta, f'{prefix}:Mercancias', attr)
|
||||
for mercancia in mercancias:
|
||||
ET.SubElement(node, f'{prefix}:Mercancia', mercancia)
|
||||
|
||||
sub_node = ET.SubElement(node, f'{prefix}:Autotransporte', autotransporte)
|
||||
ET.SubElement(sub_node, f'{prefix}:IdentificacionVehicular', identificacion)
|
||||
ET.SubElement(sub_node, f'{prefix}:Seguros', seguros)
|
||||
if remolques:
|
||||
node_remolques = ET.SubElement(sub_node, f'{prefix}:Remolques')
|
||||
for remolque in remolques:
|
||||
ET.SubElement(node_remolques, f'{prefix}:Remolque', remolque)
|
||||
|
||||
if tiposfigura:
|
||||
sub_node = ET.SubElement(node_carta, f'{prefix}:FiguraTransporte')
|
||||
for figura in tiposfigura:
|
||||
ET.SubElement(sub_node, f'{prefix}:TiposFigura', figura)
|
||||
|
||||
if self._divisas:
|
||||
atributos = {
|
||||
'version': SAT['divisas']['version'],
|
||||
|
@ -462,19 +624,60 @@ class CFDI(object):
|
|||
|
||||
if 'ine' in datos:
|
||||
atributos = {'Version': SAT['ine']['version']}
|
||||
ine_key_entidad = datos['ine'].pop('ClaveEntidad', '')
|
||||
ine_ambito = datos['ine'].pop('Ambito', '')
|
||||
if ine_key_entidad:
|
||||
ine_id_conta = datos['ine'].pop('IdContabilidad', '')
|
||||
atributos.update(datos['ine'])
|
||||
ET.SubElement(self._complemento, 'ine:INE', atributos)
|
||||
node_ine = ET.SubElement(self._complemento, 'ine:INE', atributos)
|
||||
if ine_key_entidad:
|
||||
attr = {'ClaveEntidad': ine_key_entidad}
|
||||
if ine_ambito:
|
||||
attr['Ambito'] = ine_ambito
|
||||
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']
|
||||
|
@ -484,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
|
||||
|
|
|
@ -1,13 +0,0 @@
|
|||
#!/usr/bin/env python3
|
||||
|
||||
|
||||
DEBUG = False
|
||||
|
||||
#~ Ecodex
|
||||
ID_INTEGRADOR = ''
|
||||
|
||||
#~ Finkok
|
||||
FINKOK= {
|
||||
'USER': '',
|
||||
'PASS': '',
|
||||
}
|
|
@ -1,90 +0,0 @@
|
|||
#!/usr/bin/env python3
|
||||
|
||||
|
||||
from .conf import DEBUG, ID_INTEGRADOR, FINKOK
|
||||
|
||||
DEBUG = DEBUG
|
||||
TIMEOUT = 10
|
||||
|
||||
#~ PACs que han proporcionado un entorno de pruebas libre y abierto
|
||||
#~ ecodex, finkok
|
||||
PAC = 'finkok'
|
||||
|
||||
|
||||
def ecodex(debug):
|
||||
NEW_SERVER = True
|
||||
auth = {'ID': ID_INTEGRADOR}
|
||||
if debug:
|
||||
#~ No cambies este ID de pruebas
|
||||
auth = {'ID': '2b3a8764-d586-4543-9b7e-82834443f219'}
|
||||
|
||||
base_url = 'https://servicios.ecodex.com.mx:4043/Servicio{}.svc?wsdl'
|
||||
if NEW_SERVER:
|
||||
base_url = 'https://serviciosnominas.ecodex.com.mx:4043/Servicio{}.svc?wsdl'
|
||||
base_api = 'https://api.ecodex.com.mx/{}'
|
||||
if debug:
|
||||
base_url = 'https://wsdev.ecodex.com.mx:2045/Servicio{}.svc?wsdl'
|
||||
base_api = 'https://pruebasapi.ecodex.com.mx/{}'
|
||||
url = {
|
||||
'seguridad': base_url.format('Seguridad'),
|
||||
'clients': base_url.format('Clientes'),
|
||||
'timbra': base_url.format('Timbrado'),
|
||||
'token': base_api.format('token?version=2'),
|
||||
'docs': base_api.format('api/documentos'),
|
||||
'hash': base_api.format('api/Documentos/{}'),
|
||||
'codes': {
|
||||
'HASH': 'DUPLICIDAD EN HASH',
|
||||
}
|
||||
}
|
||||
return auth, url
|
||||
|
||||
|
||||
#~ IMPORTANTE: Si quieres hacer pruebas, con tu propio correo de usuario y
|
||||
#~ contraseña, ponte en contacto con Finkok para que te asignen tus datos de
|
||||
#~ acceso, consulta su documentación para ver las diferentes opciones de acceso.
|
||||
#~ Si solo estas haciendo pruebas de timbrado y ancelación, con estos datos debería
|
||||
#~ ser suficiente.
|
||||
def finkok(debug):
|
||||
USER = FINKOK['USER']
|
||||
PASS = FINKOK['PASS']
|
||||
TOKEN = ''
|
||||
auth = {
|
||||
'DEBUG': debug,
|
||||
'USER': '',
|
||||
'PASS': TOKEN or PASS,
|
||||
'RESELLER': {'USER': USER, 'PASS': PASS}
|
||||
}
|
||||
if debug:
|
||||
USER = 'pruebas-finkok@correolibre.net'
|
||||
PASS = ''
|
||||
TOKEN = '5c9a88da105bff9a8c430cb713f6d35269f51674bdc5963c1501b7316366'
|
||||
auth = {
|
||||
'DEBUG': debug,
|
||||
'USER': USER,
|
||||
'PASS': TOKEN or PASS,
|
||||
'RESELLER': {
|
||||
'USER': '',
|
||||
'PASS': ''
|
||||
}
|
||||
}
|
||||
|
||||
base_url = 'https://facturacion.finkok.com/servicios/soap/{}.wsdl'
|
||||
if debug:
|
||||
base_url = 'http://demo-facturacion.finkok.com/servicios/soap/{}.wsdl'
|
||||
url = {
|
||||
'timbra': base_url.format('stamp'),
|
||||
'quick_stamp': False,
|
||||
'cancel': base_url.format('cancel'),
|
||||
'client': base_url.format('registration'),
|
||||
'util': base_url.format('utilities'),
|
||||
'codes': {
|
||||
'200': 'Comprobante timbrado satisfactoriamente',
|
||||
'307': 'Comprobante timbrado previamente',
|
||||
'205': 'No Encontrado',
|
||||
}
|
||||
}
|
||||
return auth, url
|
||||
|
||||
|
||||
AUTH, URL = globals()[PAC](DEBUG)
|
||||
|
|
@ -1,5 +1,6 @@
|
|||
#!/usr/bin/env python3
|
||||
|
||||
import io
|
||||
import os
|
||||
import re
|
||||
import smtplib
|
||||
|
@ -268,9 +269,7 @@ class SendMail(object):
|
|||
|
||||
def _login(self):
|
||||
try:
|
||||
if self._config['ssl'] and (
|
||||
'gmail' in self._config['servidor'] or
|
||||
'outlook' in self._config['servidor']):
|
||||
if self._config['ssl'] and self._config['starttls']:
|
||||
self._server = smtplib.SMTP(
|
||||
self._config['servidor'],
|
||||
self._config['puerto'], timeout=10)
|
||||
|
@ -597,7 +596,7 @@ class TemplateInvoice(BaseDocTemplate):
|
|||
p = Paragraph(v, ps)
|
||||
ls.append(p)
|
||||
|
||||
cbb = Image(data['path_cbb'])
|
||||
cbb = Image(data['cbb'])
|
||||
cbb.drawHeight = 4 * cm
|
||||
cbb.drawWidth = 4 * cm
|
||||
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
|
||||
import falcon
|
||||
from middleware import get_template
|
||||
from urllib.parse import unquote
|
||||
|
||||
|
||||
class AppEmpresas(object):
|
||||
|
@ -111,6 +112,14 @@ class AppValues(object):
|
|||
def on_get(self, req, resp, table):
|
||||
values = req.params
|
||||
session = req.env['beaker.session']
|
||||
|
||||
if table == 'product':
|
||||
original = values['name']
|
||||
try:
|
||||
values['name'] = unquote(req.query_string.split('=')[1])
|
||||
except Exception as e:
|
||||
values['name'] = original
|
||||
|
||||
if req.path in ('/values/titlelogin', '/values/empresas'):
|
||||
req.context['result'] = self._db.get_values(table, values, session)
|
||||
resp.status = falcon.HTTP_200
|
||||
|
@ -279,7 +288,12 @@ class AppProducts(object):
|
|||
|
||||
def on_get(self, req, resp):
|
||||
values = req.params
|
||||
req.context['result'] = self._db.get_products(values)
|
||||
user = req.env['beaker.session']['userobj']
|
||||
|
||||
if 'opt' in values:
|
||||
req.context['result'] = self._db.products_get(values, user)
|
||||
else:
|
||||
req.context['result'] = self._db.get_products(values)
|
||||
resp.status = falcon.HTTP_200
|
||||
|
||||
def on_post(self, req, resp):
|
||||
|
@ -494,14 +508,18 @@ class AppNomina(object):
|
|||
|
||||
def on_get(self, req, resp):
|
||||
values = req.params
|
||||
by = values.get('by', '')
|
||||
req.context['result'] = self._db.get_nomina(values)
|
||||
if 'download' in by:
|
||||
name = req.context['result']['name']
|
||||
req.context['blob'] = req.context['result']['data']
|
||||
resp.content_type = 'application/octet-stream'
|
||||
resp.append_header(
|
||||
'Content-Disposition', f'attachment; filename={name}')
|
||||
user = req.env['beaker.session']['userobj']
|
||||
if 'opt' in values:
|
||||
req.context['result'] = self._db.nomina_get(values, user)
|
||||
else:
|
||||
by = values.get('by', '')
|
||||
req.context['result'] = self._db.get_nomina(values)
|
||||
if 'download' in by:
|
||||
name = req.context['result']['name']
|
||||
req.context['blob'] = req.context['result']['data']
|
||||
resp.content_type = 'application/octet-stream'
|
||||
resp.append_header(
|
||||
'Content-Disposition', f'attachment; filename={name}')
|
||||
resp.status = falcon.HTTP_200
|
||||
|
||||
def on_post(self, req, resp):
|
||||
|
@ -524,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
|
||||
|
||||
|
@ -632,3 +654,174 @@ class AppSociosCuentasBanco(object):
|
|||
req.context['result'] = self._db.partners_accounts_bank(values)
|
||||
resp.status = falcon.HTTP_200
|
||||
|
||||
|
||||
class AppCert(object):
|
||||
|
||||
def __init__(self, db):
|
||||
self._db = db
|
||||
|
||||
def on_get(self, req, resp):
|
||||
values = req.params
|
||||
req.context['result'] = self._db.cert_get(values)
|
||||
resp.status = falcon.HTTP_200
|
||||
|
||||
def on_post(self, req, resp):
|
||||
values = req.params
|
||||
req.context['result'] = self._db.cert_post(values)
|
||||
resp.status = falcon.HTTP_200
|
||||
|
||||
|
||||
class AppSucursales(object):
|
||||
|
||||
def __init__(self, db):
|
||||
self._db = db
|
||||
|
||||
def on_get(self, req, resp):
|
||||
values = req.params
|
||||
req.context['result'] = self._db.sucursales_get(values)
|
||||
resp.status = falcon.HTTP_200
|
||||
|
||||
def on_post(self, req, resp):
|
||||
values = req.params
|
||||
req.context['result'] = self._db.sucursales_post(values)
|
||||
resp.status = falcon.HTTP_200
|
||||
|
||||
|
||||
class AppPartnerProducts(object):
|
||||
|
||||
def __init__(self, db):
|
||||
self._db = db
|
||||
|
||||
def on_get(self, req, resp):
|
||||
values = req.params
|
||||
req.context['result'] = self._db.partner_products_get(values)
|
||||
resp.status = falcon.HTTP_200
|
||||
|
||||
def on_post(self, req, resp):
|
||||
values = req.params
|
||||
req.context['result'] = self._db.partner_products_post(values)
|
||||
resp.status = falcon.HTTP_200
|
||||
|
||||
|
||||
class AppInventoryEntries(object):
|
||||
|
||||
def __init__(self, db):
|
||||
self._db = db
|
||||
|
||||
def on_get(self, req, resp):
|
||||
values = req.params
|
||||
req.context['result'] = self._db.inventory_entries_get(values)
|
||||
resp.status = falcon.HTTP_200
|
||||
|
||||
def on_post(self, req, resp):
|
||||
values = req.params
|
||||
user = req.env['beaker.session']['userobj']
|
||||
req.context['result'] = self._db.inventory_entries_post(values, user)
|
||||
resp.status = falcon.HTTP_200
|
||||
|
||||
|
||||
class AppWareHouse(object):
|
||||
|
||||
def __init__(self, db):
|
||||
self._db = db
|
||||
|
||||
def on_get(self, req, resp):
|
||||
values = req.params
|
||||
req.context['result'] = self._db.warehouse_get(values)
|
||||
resp.status = falcon.HTTP_200
|
||||
|
||||
def on_post(self, req, resp):
|
||||
values = req.params
|
||||
user = req.env['beaker.session']['userobj']
|
||||
req.context['result'] = self._db.warehouse_post(values, user)
|
||||
resp.status = falcon.HTTP_200
|
||||
|
||||
|
||||
class AppWareHouseProduct(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.warehouseproduct_get(values, user)
|
||||
resp.status = falcon.HTTP_200
|
||||
|
||||
def on_post(self, req, resp):
|
||||
values = req.params
|
||||
user = req.env['beaker.session']['userobj']
|
||||
req.context['result'] = self._db.warehouseproduct_post(values, user)
|
||||
resp.status = falcon.HTTP_200
|
||||
|
||||
|
||||
class AppTicketsDetails(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.ticketsdetails_get(values, user)
|
||||
resp.status = falcon.HTTP_200
|
||||
|
||||
|
||||
class AppUsers(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.users_get(values, user)
|
||||
resp.status = falcon.HTTP_200
|
||||
|
||||
def on_post(self, req, resp):
|
||||
values = req.params
|
||||
user = req.env['beaker.session']['userobj']
|
||||
req.context['result'] = self._db.users_post(values, user)
|
||||
resp.status = falcon.HTTP_200
|
||||
|
||||
|
||||
class AppSATUnidadesPeso(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_unidades_peso_get(values, user)
|
||||
resp.status = falcon.HTTP_200
|
||||
|
||||
def on_post(self, req, resp):
|
||||
values = req.params
|
||||
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
|
||||
|
|
|
@ -1,755 +0,0 @@
|
|||
#!/usr/bin/env python3
|
||||
|
||||
#~ import re
|
||||
#~ from xml.etree import ElementTree as ET
|
||||
#~ from requests import Request, Session, exceptions
|
||||
import datetime
|
||||
import hashlib
|
||||
import os
|
||||
import requests
|
||||
import time
|
||||
from lxml import etree
|
||||
from xml.dom.minidom import parseString
|
||||
from xml.sax.saxutils import escape, unescape
|
||||
from uuid import UUID
|
||||
|
||||
from logbook import Logger
|
||||
from zeep import Client
|
||||
from zeep.plugins import HistoryPlugin
|
||||
from zeep.cache import SqliteCache
|
||||
from zeep.transports import Transport
|
||||
from zeep.exceptions import Fault, TransportError
|
||||
from requests.exceptions import ConnectionError
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
from configpac import DEBUG, TIMEOUT, AUTH, URL
|
||||
else:
|
||||
from .configpac import DEBUG, TIMEOUT, AUTH, URL
|
||||
|
||||
|
||||
log = Logger('PAC')
|
||||
#~ node = client.create_message(client.service, SERVICE, **args)
|
||||
#~ print(etree.tostring(node, pretty_print=True).decode())
|
||||
|
||||
|
||||
class Ecodex(object):
|
||||
|
||||
def __init__(self, auth, url):
|
||||
self.auth = auth
|
||||
self.url = url
|
||||
self.codes = self.url['codes']
|
||||
self.error = ''
|
||||
self.message = ''
|
||||
self._transport = Transport(cache=SqliteCache(), timeout=TIMEOUT)
|
||||
self._plugins = None
|
||||
self._history = None
|
||||
if DEBUG:
|
||||
self._history = HistoryPlugin()
|
||||
self._plugins = [self._history]
|
||||
|
||||
def _get_token(self, rfc):
|
||||
client = Client(self.url['seguridad'],
|
||||
transport=self._transport, plugins=self._plugins)
|
||||
try:
|
||||
result = client.service.ObtenerToken(rfc, self._get_epoch())
|
||||
except Fault as e:
|
||||
self.error = str(e)
|
||||
log.error(self.error)
|
||||
return ''
|
||||
|
||||
s = '{}|{}'.format(self.auth['ID'], result.Token)
|
||||
return hashlib.sha1(s.encode()).hexdigest()
|
||||
|
||||
def _get_token_rest(self, rfc):
|
||||
data = {
|
||||
'rfc': rfc,
|
||||
'grant_type': 'authorization_token',
|
||||
}
|
||||
headers = {'Content-type': 'application/x-www-form-urlencoded'}
|
||||
result = requests.post(URL['token'], data=data, headers=headers)
|
||||
data = result.json()
|
||||
s = '{}|{}'.format(AUTH['ID'], data['service_token'])
|
||||
return hashlib.sha1(s.encode()).hexdigest(), data['access_token']
|
||||
|
||||
def _validate_xml(self, xml):
|
||||
NS_CFDI = {'cfdi': 'http://www.sat.gob.mx/cfd/3'}
|
||||
if os.path.isfile(xml):
|
||||
tree = etree.parse(xml).getroot()
|
||||
else:
|
||||
tree = etree.fromstring(xml.encode())
|
||||
|
||||
fecha = tree.get('Fecha')
|
||||
rfc = tree.xpath('string(//cfdi:Emisor/@Rfc)', namespaces=NS_CFDI)
|
||||
data = {
|
||||
'ComprobanteXML': etree.tostring(tree).decode(),
|
||||
'RFC': rfc,
|
||||
'Token': self._get_token(rfc),
|
||||
'TransaccionID': self._get_epoch(fecha),
|
||||
}
|
||||
return data
|
||||
|
||||
def _get_by_hash(self, sh, rfc):
|
||||
token, access_token = self._get_token_rest(rfc)
|
||||
url = URL['hash'].format(sh)
|
||||
headers = {
|
||||
'Authorization': 'Bearer {}'.format(access_token),
|
||||
'X-Auth-Token': token,
|
||||
}
|
||||
result = requests.get(url, headers=headers)
|
||||
if result.status_code == 200:
|
||||
print (result.json())
|
||||
return
|
||||
|
||||
def timbra_xml(self, xml):
|
||||
data = self._validate_xml(xml)
|
||||
client = Client(self.url['timbra'],
|
||||
transport=self._transport, plugins=self._plugins)
|
||||
try:
|
||||
result = client.service.TimbraXML(**data)
|
||||
except Fault as e:
|
||||
error = str(e)
|
||||
if self.codes['HASH'] in error:
|
||||
sh = error.split(' ')[3]
|
||||
return self._get_by_hash(sh[:40], data['RFC'])
|
||||
self.error = error
|
||||
return ''
|
||||
|
||||
tree = parseString(result.ComprobanteXML.DatosXML)
|
||||
xml = tree.toprettyxml(encoding='utf-8').decode('utf-8')
|
||||
return xml
|
||||
|
||||
def _get_epoch(self, date=None):
|
||||
if isinstance(date, str):
|
||||
f = '%Y-%m-%dT%H:%M:%S'
|
||||
e = int(time.mktime(time.strptime(date, f)))
|
||||
else:
|
||||
date = datetime.datetime.now()
|
||||
e = int(time.mktime(date.timetuple()))
|
||||
return e
|
||||
|
||||
def estatus_cuenta(self, rfc):
|
||||
#~ Codigos:
|
||||
#~ 100 = Cuenta encontrada
|
||||
#~ 101 = RFC no dado de alta en el sistema ECODEX
|
||||
token = self._get_token(rfc)
|
||||
if not token:
|
||||
return {}
|
||||
|
||||
data = {
|
||||
'RFC': rfc,
|
||||
'Token': token,
|
||||
'TransaccionID': self._get_epoch()
|
||||
}
|
||||
client = Client(URL['clients'],
|
||||
transport=self._transport, plugins=self._plugins)
|
||||
try:
|
||||
result = client.service.EstatusCuenta(**data)
|
||||
except Fault as e:
|
||||
log.error(str(e))
|
||||
return
|
||||
#~ print (result)
|
||||
return result.Estatus
|
||||
|
||||
|
||||
class Finkok(object):
|
||||
|
||||
def __init__(self, auth={}):
|
||||
self.codes = URL['codes']
|
||||
self.error = ''
|
||||
self.message = ''
|
||||
self._transport = Transport(cache=SqliteCache(), timeout=TIMEOUT)
|
||||
self._plugins = None
|
||||
self._history = None
|
||||
self.uuid = ''
|
||||
self.fecha = None
|
||||
if DEBUG:
|
||||
self._history = HistoryPlugin()
|
||||
self._plugins = [self._history]
|
||||
self._auth = AUTH
|
||||
else:
|
||||
self._auth = auth
|
||||
|
||||
def _debug(self):
|
||||
if not DEBUG:
|
||||
return
|
||||
print('SEND', self._history.last_sent)
|
||||
print('RESULT', self._history.last_received)
|
||||
return
|
||||
|
||||
def _check_result(self, method, result):
|
||||
# ~ print ('CODE', result.CodEstatus)
|
||||
# ~ print ('INCIDENCIAS', result.Incidencias)
|
||||
self.message = ''
|
||||
MSG = {
|
||||
'OK': 'Comprobante timbrado satisfactoriamente',
|
||||
'307': 'Comprobante timbrado previamente',
|
||||
}
|
||||
status = result.CodEstatus
|
||||
if status is None and result.Incidencias:
|
||||
for i in result.Incidencias['Incidencia']:
|
||||
self.error += 'Error: {}\n{}\n{}'.format(
|
||||
i['CodigoError'], i['MensajeIncidencia'], i['ExtraInfo'])
|
||||
return ''
|
||||
|
||||
if method == 'timbra' and status in (MSG['OK'], MSG['307']):
|
||||
#~ print ('UUID', result.UUID)
|
||||
#~ print ('FECHA', result.Fecha)
|
||||
if status == MSG['307']:
|
||||
self.message = MSG['307']
|
||||
tree = parseString(result.xml)
|
||||
response = tree.toprettyxml(encoding='utf-8').decode('utf-8')
|
||||
self.uuid = result.UUID
|
||||
self.fecha = result.Fecha
|
||||
|
||||
return response
|
||||
|
||||
def _load_file(self, path):
|
||||
try:
|
||||
with open(path, 'rb') as f:
|
||||
data = f.read()
|
||||
except Exception as e:
|
||||
self.error = str(e)
|
||||
return
|
||||
return data
|
||||
|
||||
def _validate_xml(self, file_xml):
|
||||
if os.path.isfile(file_xml):
|
||||
try:
|
||||
with open(file_xml, 'rb') as f:
|
||||
xml = f.read()
|
||||
except Exception as e:
|
||||
self.error = str(e)
|
||||
return False, ''
|
||||
else:
|
||||
xml = file_xml.encode('utf-8')
|
||||
return True, xml
|
||||
|
||||
def _validate_uuid(self, uuid):
|
||||
try:
|
||||
UUID(uuid)
|
||||
return True
|
||||
except ValueError:
|
||||
self.error = 'UUID no válido: {}'.format(uuid)
|
||||
return False
|
||||
|
||||
def timbra_xml(self, file_xml):
|
||||
self.error = ''
|
||||
|
||||
if not DEBUG and not self._auth:
|
||||
self.error = 'Sin datos para timbrar'
|
||||
return
|
||||
|
||||
method = 'timbra'
|
||||
ok, xml = self._validate_xml(file_xml)
|
||||
if not ok:
|
||||
return ''
|
||||
client = Client(
|
||||
URL[method], transport=self._transport, plugins=self._plugins)
|
||||
|
||||
args = {
|
||||
'username': self._auth['USER'],
|
||||
'password': self._auth['PASS'],
|
||||
'xml': xml,
|
||||
}
|
||||
if URL['quick_stamp']:
|
||||
try:
|
||||
result = client.service.quick_stamp(**args)
|
||||
except Fault as e:
|
||||
self.error = str(e)
|
||||
return
|
||||
else:
|
||||
try:
|
||||
result = client.service.stamp(**args)
|
||||
except Fault as e:
|
||||
self.error = str(e)
|
||||
return
|
||||
except TransportError as e:
|
||||
if '413' in str(e):
|
||||
self.error = '413<BR><BR><b>Documento muy grande para timbrar</b>'
|
||||
else:
|
||||
self.error = str(e)
|
||||
return
|
||||
except ConnectionError as e:
|
||||
msg = '502 - Error de conexión'
|
||||
self.error = msg
|
||||
return
|
||||
|
||||
return self._check_result(method, result)
|
||||
|
||||
def _get_xml(self, uuid):
|
||||
if not self._validate_uuid(uuid):
|
||||
return ''
|
||||
|
||||
method = 'util'
|
||||
client = Client(
|
||||
URL[method], transport=self._transport, plugins=self._plugins)
|
||||
|
||||
args = {
|
||||
'username': self._auth['USER'],
|
||||
'password': self._auth['PASS'],
|
||||
'uuid': uuid,
|
||||
'taxpayer_id': self.rfc,
|
||||
'invoice_type': 'I',
|
||||
}
|
||||
try:
|
||||
result = client.service.get_xml(**args)
|
||||
except Fault as e:
|
||||
self.error = str(e)
|
||||
return ''
|
||||
except TransportError as e:
|
||||
self.error = str(e)
|
||||
return ''
|
||||
|
||||
if result.error:
|
||||
self.error = result.error
|
||||
return ''
|
||||
|
||||
tree = parseString(result.xml)
|
||||
xml = tree.toprettyxml(encoding='utf-8').decode('utf-8')
|
||||
return xml
|
||||
|
||||
def recupera_xml(self, file_xml='', uuid=''):
|
||||
self.error = ''
|
||||
if uuid:
|
||||
return self._get_xml(uuid)
|
||||
|
||||
method = 'timbra'
|
||||
ok, xml = self._validate_xml(file_xml)
|
||||
if not ok:
|
||||
return ''
|
||||
client = Client(
|
||||
URL[method], transport=self._transport, plugins=self._plugins)
|
||||
try:
|
||||
result = client.service.stamped(
|
||||
xml, self._auth['user'], self._auth['pass'])
|
||||
except Fault as e:
|
||||
self.error = str(e)
|
||||
return ''
|
||||
|
||||
return self._check_result(method, result)
|
||||
|
||||
def estatus_xml(self, uuid):
|
||||
method = 'timbra'
|
||||
if not self._validate_uuid(uuid):
|
||||
return ''
|
||||
client = Client(
|
||||
URL[method], transport=self._transport, plugins=self._plugins)
|
||||
try:
|
||||
result = client.service.query_pending(
|
||||
self._auth['USER'], self._auth['PASS'], uuid)
|
||||
return result.status
|
||||
except Fault as e:
|
||||
self.error = str(e)
|
||||
return ''
|
||||
|
||||
def cancel_xml(self, rfc, uuid, cer, key):
|
||||
# ~ for u in uuids:
|
||||
# ~ if not self._validate_uuid(u):
|
||||
# ~ return ''
|
||||
|
||||
method = 'cancel'
|
||||
client = Client(
|
||||
URL[method], transport=self._transport, plugins=self._plugins)
|
||||
uuid_type = client.get_type('ns1:UUIDS')
|
||||
sa = client.get_type('ns0:stringArray')
|
||||
|
||||
args = {
|
||||
'UUIDS': uuid_type(uuids=sa(string=uuid)),
|
||||
'username': self._auth['USER'],
|
||||
'password': self._auth['PASS'],
|
||||
'taxpayer_id': rfc,
|
||||
'cer': cer,
|
||||
'key': key,
|
||||
'store_pending': False,
|
||||
}
|
||||
try:
|
||||
result = client.service.cancel(**args)
|
||||
except Fault as e:
|
||||
self.error = str(e)
|
||||
return ''
|
||||
|
||||
if result.CodEstatus and self.codes['205'] in result.CodEstatus:
|
||||
self.error = result.CodEstatus
|
||||
return ''
|
||||
|
||||
return result
|
||||
|
||||
def cancel_signature(self, file_xml):
|
||||
method = 'cancel'
|
||||
if os.path.isfile(file_xml):
|
||||
root = etree.parse(file_xml).getroot()
|
||||
else:
|
||||
root = etree.fromstring(file_xml.encode())
|
||||
|
||||
xml = etree.tostring(root)
|
||||
|
||||
client = Client(
|
||||
URL[method], transport=self._transport, plugins=self._plugins)
|
||||
|
||||
args = {
|
||||
'username': self._auth['USER'],
|
||||
'password': self._auth['PASS'],
|
||||
'xml': xml,
|
||||
'store_pending': False,
|
||||
}
|
||||
|
||||
try:
|
||||
result = client.service.cancel_signature(**args)
|
||||
return result
|
||||
except Fault as e:
|
||||
self.error = str(e)
|
||||
return ''
|
||||
|
||||
def get_acuse(self, rfc, uuids, type_acuse='C'):
|
||||
for u in uuids:
|
||||
if not self._validate_uuid(u):
|
||||
return ''
|
||||
|
||||
method = 'cancel'
|
||||
client = Client(
|
||||
URL[method], transport=self._transport, plugins=self._plugins)
|
||||
|
||||
args = {
|
||||
'username': self._auth['USER'],
|
||||
'password': self._auth['PASS'],
|
||||
'taxpayer_id': rfc,
|
||||
'uuid': '',
|
||||
'type': type_acuse,
|
||||
}
|
||||
try:
|
||||
result = []
|
||||
for u in uuids:
|
||||
args['uuid'] = u
|
||||
r = client.service.get_receipt(**args)
|
||||
result.append(r)
|
||||
except Fault as e:
|
||||
self.error = str(e)
|
||||
return ''
|
||||
|
||||
return result
|
||||
|
||||
def estatus_cancel(self, uuids):
|
||||
for u in uuids:
|
||||
if not self._validate_uuid(u):
|
||||
return ''
|
||||
|
||||
method = 'cancel'
|
||||
client = Client(
|
||||
URL[method], transport=self._transport, plugins=self._plugins)
|
||||
|
||||
args = {
|
||||
'username': self._auth['USER'],
|
||||
'password': self._auth['PASS'],
|
||||
'uuid': '',
|
||||
}
|
||||
try:
|
||||
result = []
|
||||
for u in uuids:
|
||||
args['uuid'] = u
|
||||
r = client.service.query_pending_cancellation(**args)
|
||||
result.append(r)
|
||||
except Fault as e:
|
||||
self.error = str(e)
|
||||
return ''
|
||||
|
||||
return result
|
||||
|
||||
def add_token(self, rfc, email):
|
||||
"""Agrega un nuevo token al cliente para timbrado.
|
||||
Se requiere cuenta de reseller para usar este método
|
||||
|
||||
Args:
|
||||
rfc (str): El RFC del cliente, ya debe existir
|
||||
email (str): El correo del cliente, funciona como USER al timbrar
|
||||
|
||||
Returns:
|
||||
dict
|
||||
'username': 'username',
|
||||
'status': True or False
|
||||
'name': 'name',
|
||||
'success': True or False
|
||||
'token': 'Token de timbrado',
|
||||
'message': None
|
||||
"""
|
||||
auth = AUTH['RESELLER']
|
||||
|
||||
method = 'util'
|
||||
client = Client(
|
||||
URL[method], transport=self._transport, plugins=self._plugins)
|
||||
args = {
|
||||
'username': auth['USER'],
|
||||
'password': auth['PASS'],
|
||||
'name': rfc,
|
||||
'token_username': email,
|
||||
'taxpayer_id': rfc,
|
||||
'status': True,
|
||||
}
|
||||
try:
|
||||
result = client.service.add_token(**args)
|
||||
except Fault as e:
|
||||
self.error = str(e)
|
||||
return ''
|
||||
|
||||
return result
|
||||
|
||||
def get_date(self):
|
||||
method = 'util'
|
||||
client = Client(
|
||||
URL[method], transport=self._transport, plugins=self._plugins)
|
||||
try:
|
||||
result = client.service.datetime(AUTH['USER'], AUTH['PASS'])
|
||||
except Fault as e:
|
||||
self.error = str(e)
|
||||
return ''
|
||||
|
||||
if result.error:
|
||||
self.error = result.error
|
||||
return
|
||||
|
||||
return result.datetime
|
||||
|
||||
def add_client(self, rfc, type_user=False):
|
||||
"""Agrega un nuevo cliente para timbrado.
|
||||
Se requiere cuenta de reseller para usar este método
|
||||
|
||||
Args:
|
||||
rfc (str): El RFC del nuevo cliente
|
||||
|
||||
Kwargs:
|
||||
type_user (bool): False == 'P' == Prepago or True == 'O' == On demand
|
||||
|
||||
Returns:
|
||||
dict
|
||||
'message':
|
||||
'Account Created successfully'
|
||||
'Account Already exists'
|
||||
'success': True or False
|
||||
"""
|
||||
auth = AUTH['RESELLER']
|
||||
|
||||
tu = {False: 'P', True: 'O'}
|
||||
method = 'client'
|
||||
client = Client(
|
||||
URL[method], transport=self._transport, plugins=self._plugins)
|
||||
args = {
|
||||
'reseller_username': auth['USER'],
|
||||
'reseller_password': auth['PASS'],
|
||||
'taxpayer_id': rfc,
|
||||
'type_user': tu[type_user],
|
||||
'added': datetime.datetime.now().isoformat()[:19],
|
||||
}
|
||||
try:
|
||||
result = client.service.add(**args)
|
||||
except Fault as e:
|
||||
self.error = str(e)
|
||||
return ''
|
||||
|
||||
return result
|
||||
|
||||
def edit_client(self, rfc, status=True):
|
||||
"""
|
||||
Se requiere cuenta de reseller para usar este método
|
||||
status = 'A' or 'S'
|
||||
"""
|
||||
auth = AUTH['RESELLER']
|
||||
|
||||
sv = {False: 'S', True: 'A'}
|
||||
method = 'client'
|
||||
client = Client(
|
||||
URL[method], transport=self._transport, plugins=self._plugins)
|
||||
args = {
|
||||
'reseller_username': auth['USER'],
|
||||
'reseller_password': auth['PASS'],
|
||||
'taxpayer_id': rfc,
|
||||
'status': sv[status],
|
||||
}
|
||||
try:
|
||||
result = client.service.edit(**args)
|
||||
except Fault as e:
|
||||
self.error = str(e)
|
||||
return ''
|
||||
|
||||
return result
|
||||
|
||||
def get_client(self, rfc):
|
||||
"""Regresa el estatus del cliente
|
||||
.
|
||||
Se requiere cuenta de reseller para usar este método
|
||||
|
||||
Args:
|
||||
rfc (str): El RFC del emisor
|
||||
|
||||
Returns:
|
||||
dict
|
||||
'message': None,
|
||||
'users': {
|
||||
'ResellerUser': [
|
||||
{
|
||||
'status': 'A',
|
||||
'counter': 0,
|
||||
'taxpayer_id': '',
|
||||
'credit': 0
|
||||
}
|
||||
]
|
||||
} or None si no existe
|
||||
"""
|
||||
auth = AUTH['RESELLER']
|
||||
|
||||
method = 'client'
|
||||
client = Client(
|
||||
URL[method], transport=self._transport, plugins=self._plugins)
|
||||
args = {
|
||||
'reseller_username': auth['USER'],
|
||||
'reseller_password': auth['PASS'],
|
||||
'taxpayer_id': rfc,
|
||||
}
|
||||
|
||||
try:
|
||||
result = client.service.get(**args)
|
||||
except Fault as e:
|
||||
self.error = str(e)
|
||||
return ''
|
||||
except TransportError as e:
|
||||
self.error = str(e)
|
||||
return ''
|
||||
|
||||
return result
|
||||
|
||||
def assign_client(self, rfc, credit):
|
||||
"""Agregar credito a un emisor
|
||||
|
||||
Se requiere cuenta de reseller para usar este método
|
||||
|
||||
Args:
|
||||
rfc (str): El RFC del emisor, debe existir
|
||||
credit (int): Cantidad de folios a agregar
|
||||
|
||||
Returns:
|
||||
dict
|
||||
'success': True or False,
|
||||
'credit': nuevo credito despues de agregar or None
|
||||
'message':
|
||||
'Success, added {credit} of credit to {RFC}'
|
||||
'RFC no encontrado'
|
||||
"""
|
||||
auth = AUTH['RESELLER']
|
||||
|
||||
method = 'client'
|
||||
client = Client(
|
||||
URL[method], transport=self._transport, plugins=self._plugins)
|
||||
args = {
|
||||
'username': auth['USER'],
|
||||
'password': auth['PASS'],
|
||||
'taxpayer_id': rfc,
|
||||
'credit': credit,
|
||||
}
|
||||
try:
|
||||
result = client.service.assign(**args)
|
||||
except Fault as e:
|
||||
self.error = str(e)
|
||||
return ''
|
||||
|
||||
return result
|
||||
|
||||
def client_get_timbres(self, rfc):
|
||||
method = 'client'
|
||||
client = Client(
|
||||
URL[method], transport=self._transport, plugins=self._plugins)
|
||||
args = {
|
||||
'reseller_username': self._auth['USER'],
|
||||
'reseller_password': self._auth['PASS'],
|
||||
'taxpayer_id': rfc,
|
||||
}
|
||||
|
||||
try:
|
||||
self.result = client.service.get(**args)
|
||||
except Fault as e:
|
||||
self.error = str(e)
|
||||
return 0
|
||||
except TransportError as e:
|
||||
self.error = str(e)
|
||||
return 0
|
||||
except ConnectionError:
|
||||
self.error = 'Verifica la conexión a internet'
|
||||
return 0
|
||||
|
||||
success = bool(self.result.users)
|
||||
if not success:
|
||||
self.error = self.result.message or 'RFC no existe'
|
||||
return 0
|
||||
|
||||
return self.result.users.ResellerUser[0].credit
|
||||
|
||||
|
||||
def _get_data_sat(path):
|
||||
BF = 'string(//*[local-name()="{}"]/@{})'
|
||||
NS_CFDI = {'cfdi': 'http://www.sat.gob.mx/cfd/3'}
|
||||
|
||||
try:
|
||||
if os.path.isfile(path):
|
||||
tree = etree.parse(path).getroot()
|
||||
else:
|
||||
tree = etree.fromstring(path.encode())
|
||||
|
||||
data = {}
|
||||
emisor = escape(
|
||||
tree.xpath('string(//cfdi:Emisor/@rfc)', namespaces=NS_CFDI) or
|
||||
tree.xpath('string(//cfdi:Emisor/@Rfc)', namespaces=NS_CFDI)
|
||||
)
|
||||
receptor = escape(
|
||||
tree.xpath('string(//cfdi:Receptor/@rfc)', namespaces=NS_CFDI) or
|
||||
tree.xpath('string(//cfdi:Receptor/@Rfc)', namespaces=NS_CFDI)
|
||||
)
|
||||
data['total'] = tree.get('total') or tree.get('Total')
|
||||
data['emisor'] = emisor
|
||||
data['receptor'] = receptor
|
||||
data['uuid'] = tree.xpath(BF.format('TimbreFiscalDigital', 'UUID'))
|
||||
except Exception as e:
|
||||
print (e)
|
||||
return {}
|
||||
|
||||
return '?re={emisor}&rr={receptor}&tt={total}&id={uuid}'.format(**data)
|
||||
|
||||
|
||||
def get_status_sat(xml):
|
||||
data = _get_data_sat(xml)
|
||||
if not data:
|
||||
return 'XML inválido'
|
||||
|
||||
data = """<?xml version="1.0" encoding="UTF-8"?>
|
||||
<soap:Envelope
|
||||
xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
|
||||
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
|
||||
<soap:Header/>
|
||||
<soap:Body>
|
||||
<Consulta xmlns="http://tempuri.org/">
|
||||
<expresionImpresa>
|
||||
{}
|
||||
</expresionImpresa>
|
||||
</Consulta>
|
||||
</soap:Body>
|
||||
</soap:Envelope>""".format(data)
|
||||
headers = {
|
||||
'SOAPAction': '"http://tempuri.org/IConsultaCFDIService/Consulta"',
|
||||
'Content-type': 'text/xml; charset="UTF-8"'
|
||||
}
|
||||
URL = 'https://consultaqr.facturaelectronica.sat.gob.mx/consultacfdiservice.svc'
|
||||
|
||||
try:
|
||||
result = requests.post(URL, data=data, headers=headers)
|
||||
tree = etree.fromstring(result.text)
|
||||
node = tree.xpath("//*[local-name() = 'Estado']")[0]
|
||||
except Exception as e:
|
||||
return 'Error: {}'.format(str(e))
|
||||
|
||||
return node.text
|
||||
|
||||
|
||||
def main():
|
||||
return
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
|
@ -0,0 +1,4 @@
|
|||
#!/usr/bin/env python
|
||||
|
||||
from .comerciodigital import PACComercioDigital
|
||||
from .finkok import PACFinkok
|
|
@ -0,0 +1,350 @@
|
|||
#!/usr/bin/env python3
|
||||
|
||||
import argparse
|
||||
import base64
|
||||
import datetime
|
||||
import getpass
|
||||
import hashlib
|
||||
import subprocess
|
||||
from pathlib import Path
|
||||
|
||||
import lxml.etree as ET
|
||||
import xmlsec
|
||||
from cryptography.hazmat.backends import default_backend
|
||||
from cryptography.hazmat.primitives import serialization
|
||||
from cryptography import x509
|
||||
from cryptography.x509.oid import NameOID
|
||||
from cryptography.x509.oid import ExtensionOID
|
||||
from cryptography.hazmat.primitives import hashes
|
||||
from cryptography.hazmat.primitives.asymmetric import padding
|
||||
|
||||
from conf import TOKEN
|
||||
|
||||
|
||||
class SATCertificate(object):
|
||||
|
||||
def __init__(self, cer=b'', key=b'', password=''):
|
||||
self._error = ''
|
||||
self._init_values()
|
||||
self._get_data_cer(cer)
|
||||
self._get_data_key(key, password)
|
||||
# ~ if not password:
|
||||
# ~ self._test()
|
||||
|
||||
# ~ def _test(self):
|
||||
# ~ key = self._get_key('')
|
||||
# ~ self._p = ''
|
||||
# ~ self._key_der = key.private_bytes(
|
||||
# ~ encoding=serialization.Encoding.DER,
|
||||
# ~ format=serialization.PrivateFormat.PKCS8,
|
||||
# ~ encryption_algorithm=serialization.BestAvailableEncryption(self._p.encode())
|
||||
# ~ )
|
||||
# ~ return
|
||||
|
||||
def _init_values(self):
|
||||
self._rfc = ''
|
||||
self._serial_number = ''
|
||||
self._serial_number2 = ''
|
||||
self._subject = ''
|
||||
self._issuer = ''
|
||||
self._not_before = None
|
||||
self._not_after = None
|
||||
self._is_fiel = False
|
||||
self._are_couple = False
|
||||
self._is_valid_time = False
|
||||
self._key = b''
|
||||
self._cer = b''
|
||||
self._cer_pem = ''
|
||||
self._cer_txt = ''
|
||||
self._key_enc = b''
|
||||
self._key_der = b''
|
||||
self._p12 = b''
|
||||
self._cer_modulus = 0
|
||||
self._key_modulus = 0
|
||||
return
|
||||
|
||||
def __str__(self):
|
||||
msg = '\tRFC: {}\n'.format(self.rfc)
|
||||
msg += '\tNo de Serie: {}\n'.format(self.serial_number)
|
||||
msg += '\tVálido desde: {}\n'.format(self.not_before)
|
||||
msg += '\tVálido hasta: {}\n'.format(self.not_after)
|
||||
msg += '\tEs vigente: {}\n'.format(self.is_valid_time)
|
||||
msg += '\tSon pareja: {}\n'.format(self.are_couple)
|
||||
msg += '\tEs FIEL: {}\n'.format(self.is_fiel)
|
||||
return msg
|
||||
|
||||
def __bool__(self):
|
||||
return self.is_valid
|
||||
|
||||
def _get_hash(self):
|
||||
digest = hashes.Hash(hashes.SHA512(), default_backend())
|
||||
digest.update(self._rfc.encode())
|
||||
digest.update(self._serial_number.encode())
|
||||
digest.update(TOKEN.encode())
|
||||
return digest.finalize()
|
||||
|
||||
def _get_data_cer(self, cer):
|
||||
self._cer = cer
|
||||
obj = x509.load_der_x509_certificate(cer, default_backend())
|
||||
|
||||
self._issuer = obj.issuer.rfc4514_string()
|
||||
self._subject = obj.subject.rfc4514_string()
|
||||
|
||||
self._rfc = obj.subject.get_attributes_for_oid(
|
||||
NameOID.X500_UNIQUE_IDENTIFIER)[0].value.split(' ')[0]
|
||||
self._serial_number2 = '{0:x}'.format(obj.serial_number)
|
||||
self._serial_number = self._serial_number2[1::2]
|
||||
self._not_before = obj.not_valid_before
|
||||
self._not_after = obj.not_valid_after
|
||||
now = datetime.datetime.utcnow()
|
||||
self._is_valid_time = (now > self.not_before) and (now < self.not_after)
|
||||
if not self._is_valid_time:
|
||||
msg = 'El certificado no es vigente'
|
||||
self._error = msg
|
||||
|
||||
self._is_fiel = obj.extensions.get_extension_for_oid(
|
||||
ExtensionOID.KEY_USAGE).value.key_agreement
|
||||
|
||||
self._cer_pem = obj.public_bytes(serialization.Encoding.PEM).decode()
|
||||
self._cer_txt = ''.join(self._cer_pem.split('\n')[1:-2])
|
||||
self._cer_modulus = obj.public_key().public_numbers().n
|
||||
return
|
||||
|
||||
def _get_data_key(self, key, password):
|
||||
self._key = key
|
||||
self._keyp = password
|
||||
self._key_enc = key
|
||||
if not key or not password:
|
||||
return
|
||||
|
||||
try:
|
||||
obj = serialization.load_der_private_key(
|
||||
key, password.encode(), default_backend())
|
||||
except ValueError:
|
||||
msg = 'La contraseña es incorrecta'
|
||||
self._error = msg
|
||||
return
|
||||
|
||||
p = self._get_hash()
|
||||
self._key_enc = obj.private_bytes(
|
||||
encoding=serialization.Encoding.PEM,
|
||||
format=serialization.PrivateFormat.PKCS8,
|
||||
encryption_algorithm=serialization.BestAvailableEncryption(p)
|
||||
)
|
||||
|
||||
self._key_modulus = obj.public_key().public_numbers().n
|
||||
self._are_couple = self._cer_modulus == self._key_modulus
|
||||
if not self._are_couple:
|
||||
msg = 'El CER y el KEY no son pareja'
|
||||
self._error = msg
|
||||
return
|
||||
|
||||
def _get_key(self, password):
|
||||
if not password:
|
||||
password = self._get_hash()
|
||||
private_key = serialization.load_pem_private_key(
|
||||
self._key_enc, password=password, backend=default_backend())
|
||||
return private_key
|
||||
|
||||
def _get_key_pem(self):
|
||||
obj = self._get_key('')
|
||||
key_pem = obj.private_bytes(
|
||||
encoding=serialization.Encoding.PEM,
|
||||
format=serialization.PrivateFormat.PKCS8,
|
||||
encryption_algorithm=serialization.NoEncryption()
|
||||
)
|
||||
return key_pem
|
||||
|
||||
# Not work
|
||||
def _get_p12(self):
|
||||
obj = serialization.pkcs12.serialize_key_and_certificates('test',
|
||||
self.key_pem, self.cer_pem, None,
|
||||
encryption_algorithm=serialization.NoEncryption()
|
||||
)
|
||||
return obj
|
||||
|
||||
def sign(self, data, password=''):
|
||||
private_key = self._get_key(password)
|
||||
firma = private_key.sign(data, padding.PKCS1v15(), hashes.SHA256())
|
||||
return base64.b64encode(firma).decode()
|
||||
|
||||
def sign_xml(self, tree):
|
||||
node = xmlsec.tree.find_node(tree, xmlsec.constants.NodeSignature)
|
||||
ctx = xmlsec.SignatureContext()
|
||||
key = xmlsec.Key.from_memory(
|
||||
self.key_pem, xmlsec.constants.KeyDataFormatPem)
|
||||
ctx.key = key
|
||||
ctx.sign(node)
|
||||
|
||||
node = xmlsec.tree.find_node(tree, 'X509Certificate')
|
||||
node.text = self.cer_txt
|
||||
node = xmlsec.tree.find_node(tree, 'X509IssuerName')
|
||||
node.text = self.issuer
|
||||
node = xmlsec.tree.find_node(tree, 'X509SerialNumber')
|
||||
node.text = self.serial_number
|
||||
node = xmlsec.tree.find_node(tree, 'SignatureValue')
|
||||
node.text = node.text.replace('\n', '')
|
||||
node = xmlsec.tree.find_node(tree, 'Modulus')
|
||||
node.text = node.text.replace('\n', '')
|
||||
|
||||
# ~ xml_signed = ET.tostring(tree,
|
||||
# ~ xml_declaration=True, encoding='UTF-8').decode()
|
||||
xml_signed = ET.tostring(tree, encoding='UTF-8').decode().replace('\n', '')
|
||||
|
||||
return xml_signed
|
||||
|
||||
@property
|
||||
def rfc(self):
|
||||
return self._rfc
|
||||
|
||||
@property
|
||||
def serial_number(self):
|
||||
return self._serial_number
|
||||
|
||||
@property
|
||||
def serial_number2(self):
|
||||
return self._serial_number2
|
||||
|
||||
@property
|
||||
def issuer(self):
|
||||
return self._issuer
|
||||
|
||||
@property
|
||||
def subject(self):
|
||||
return self._subject
|
||||
|
||||
@property
|
||||
def not_before(self):
|
||||
return self._not_before
|
||||
|
||||
@property
|
||||
def not_after(self):
|
||||
return self._not_after
|
||||
|
||||
@property
|
||||
def is_fiel(self):
|
||||
return self._is_fiel
|
||||
|
||||
@property
|
||||
def are_couple(self):
|
||||
return self._are_couple
|
||||
|
||||
@property
|
||||
def is_valid(self):
|
||||
return not bool(self.error)
|
||||
|
||||
@property
|
||||
def is_valid_time(self):
|
||||
return self._is_valid_time
|
||||
|
||||
@property
|
||||
def cer(self):
|
||||
return self._cer
|
||||
|
||||
@property
|
||||
def cer_pem(self):
|
||||
return self._cer_pem.encode()
|
||||
|
||||
@property
|
||||
def cer_txt(self):
|
||||
return self._cer_txt
|
||||
|
||||
@property
|
||||
def key_pem(self):
|
||||
return self._get_key_pem()
|
||||
|
||||
@property
|
||||
def key_enc(self):
|
||||
return self._key_enc
|
||||
|
||||
@property
|
||||
def p12(self):
|
||||
return self._get_p12()
|
||||
|
||||
@property
|
||||
def error(self):
|
||||
return self._error
|
||||
|
||||
@classmethod
|
||||
def save_cert(cls, obj):
|
||||
import hashlib
|
||||
|
||||
cer = x509.load_pem_x509_certificate(obj.cer_pem.encode(), default_backend())
|
||||
cer_der = cer.public_bytes(serialization.Encoding.DER)
|
||||
token = hashlib.md5(obj.rfc.encode()).hexdigest()
|
||||
path = Path(f'/tmp/{obj.rfc}.key')
|
||||
path.write_text(obj.key_enc)
|
||||
args = f'openssl rsa -inform PEM -outform PEM -in "{str(path)}" -passin pass:{token}'
|
||||
pem = subprocess.check_output(args, shell=True).decode()
|
||||
key = serialization.load_pem_private_key(
|
||||
pem.encode(), password=None, backend=default_backend())
|
||||
|
||||
digest = hashes.Hash(hashes.SHA512(), default_backend())
|
||||
digest.update(obj.rfc.encode())
|
||||
digest.update(obj.serie.encode())
|
||||
digest.update(TOKEN.encode())
|
||||
p = digest.finalize()
|
||||
|
||||
key_enc = key.private_bytes(
|
||||
encoding=serialization.Encoding.PEM,
|
||||
format=serialization.PrivateFormat.PKCS8,
|
||||
encryption_algorithm=serialization.BestAvailableEncryption(p)
|
||||
)
|
||||
|
||||
cert = SATCertificate(cer_der, key_enc)
|
||||
obj.key_enc = cert.key_enc
|
||||
obj.cer = cert.cer
|
||||
obj.serie = cert.serial_number
|
||||
obj.desde = cert.not_before
|
||||
obj.hasta = cert.not_after
|
||||
obj.save()
|
||||
return
|
||||
|
||||
|
||||
def main(args):
|
||||
# ~ contra = getpass.getpass('Introduce la contraseña del archivo KEY: ')
|
||||
contra = '12345678a'
|
||||
if not contra.strip():
|
||||
msg = 'La contraseña es requerida'
|
||||
print(msg)
|
||||
return
|
||||
|
||||
path_cer = Path(args.cer)
|
||||
path_key = Path(args.key)
|
||||
|
||||
if not path_cer.is_file():
|
||||
msg = 'El archivo CER es necesario'
|
||||
print(msg)
|
||||
return
|
||||
|
||||
if not path_key.is_file():
|
||||
msg = 'El archivo KEY es necesario'
|
||||
print(msg)
|
||||
return
|
||||
|
||||
cer = path_cer.read_bytes()
|
||||
key = path_key.read_bytes()
|
||||
cert = SATCertificate(cer, key, contra)
|
||||
|
||||
if cert.error:
|
||||
print(cert.error)
|
||||
else:
|
||||
print(cert)
|
||||
return
|
||||
|
||||
|
||||
def _process_command_line_arguments():
|
||||
parser = argparse.ArgumentParser(description='CFDI Certificados')
|
||||
|
||||
help = 'Archivo CER'
|
||||
parser.add_argument('-c', '--cer', help=help, default='')
|
||||
help = 'Archivo KEY'
|
||||
parser.add_argument('-k', '--key', help=help, default='')
|
||||
|
||||
args = parser.parse_args()
|
||||
return args
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
args = _process_command_line_arguments()
|
||||
main(args)
|
|
@ -17,12 +17,16 @@
|
|||
# ~ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
|
||||
import base64
|
||||
import logging
|
||||
|
||||
import lxml.etree as ET
|
||||
import requests
|
||||
from requests.exceptions import ConnectionError
|
||||
|
||||
from .conf import DEBUG
|
||||
# ~ , AUTH
|
||||
|
||||
|
||||
LOG_FORMAT = '%(asctime)s - %(levelname)s - %(message)s'
|
||||
LOG_DATE = '%d/%m/%Y %H:%M:%S'
|
||||
|
@ -31,26 +35,44 @@ logging.addLevelName(logging.DEBUG, '\x1b[33mDEBUG\033[1;0m')
|
|||
logging.addLevelName(logging.INFO, '\x1b[32mINFO\033[1;0m')
|
||||
logging.basicConfig(level=logging.DEBUG, format=LOG_FORMAT, datefmt=LOG_DATE)
|
||||
log = logging.getLogger(__name__)
|
||||
|
||||
logging.getLogger('requests').setLevel(logging.ERROR)
|
||||
|
||||
|
||||
try:
|
||||
from .conf import DEBUG, AUTH
|
||||
except ImportError:
|
||||
DEBUG = False
|
||||
log.debug('Need make conf.py')
|
||||
|
||||
|
||||
TIMEOUT = 10
|
||||
|
||||
NAMESPACES = {
|
||||
'3.3': 'http://www.sat.gob.mx/cfd/3',
|
||||
'4.0': 'http://www.sat.gob.mx/cfd/4',
|
||||
'tdf': 'http://www.sat.gob.mx/TimbreFiscalDigital',
|
||||
}
|
||||
|
||||
|
||||
def pretty_print_POST(req):
|
||||
"""
|
||||
At this point it is completely built and ready
|
||||
to be fired; it is "prepared".
|
||||
|
||||
However pay attention at the formatting used in
|
||||
this function because it is programmed to be pretty
|
||||
printed and may differ from the actual request.
|
||||
"""
|
||||
print('{}\n{}\r\n{}\r\n\r\n{}'.format(
|
||||
'-----------START-----------',
|
||||
req.method + ' ' + req.url,
|
||||
'\r\n'.join('{}: {}'.format(k, v) for k, v in req.headers.items()),
|
||||
req.body,
|
||||
))
|
||||
|
||||
|
||||
class PACComercioDigital(object):
|
||||
ws = 'https://{}.comercio-digital.mx/{}'
|
||||
api = 'https://app2.comercio-digital.mx/{}'
|
||||
URL = {
|
||||
'timbra': ws.format('ws', 'timbre/timbrarV5.aspx'),
|
||||
'cancel': ws.format('cancela', 'cancela3/cancelarUuid'),
|
||||
'cancelxml': ws.format('cancela', 'cancela3/cancelarXml'),
|
||||
'timbra': ws.format('ws', 'timbre4/timbrarV5'),
|
||||
'cancel': ws.format('cancela', 'cancela4/cancelarUuid'),
|
||||
'cancelxml': ws.format('cancela', 'cancela4/cancelarXml'),
|
||||
'status': ws.format('cancela', 'arws/consultaEstatus'),
|
||||
'client': api.format('x3/altaEmpresa'),
|
||||
'saldo': api.format('x3/saldo'),
|
||||
'timbres': api.format('x3/altaTimbres'),
|
||||
|
@ -59,18 +81,21 @@ class PACComercioDigital(object):
|
|||
'000': '000 Exitoso',
|
||||
'004': '004 RFC {} ya esta dado de alta con Estatus=A',
|
||||
'704': '704 Usuario Invalido',
|
||||
'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',
|
||||
}
|
||||
|
||||
if DEBUG:
|
||||
ws = 'https://pruebas.comercio-digital.mx/{}'
|
||||
ws6 = 'https://pruebas6.comercio-digital.mx/arws/{}'
|
||||
URL = {
|
||||
'timbra': ws.format('timbre/timbrarV5.aspx'),
|
||||
'cancel': ws.format('cancela3/cancelarUuid'),
|
||||
'cancelxml': ws.format('cancela3/cancelarXml'),
|
||||
'timbra': ws.format('timbre4/timbrarV5'),
|
||||
'cancel': ws.format('cancela4/cancelarUuid'),
|
||||
'cancelxml': ws.format('cancela4/cancelarXml'),
|
||||
'status': ws6.format('consultaEstatus'),
|
||||
'client': api.format('x3/altaEmpresa'),
|
||||
'saldo': api.format('x3/saldo'),
|
||||
'timbres': api.format('x3/altaTimbres'),
|
||||
|
@ -78,8 +103,6 @@ class PACComercioDigital(object):
|
|||
|
||||
def __init__(self):
|
||||
self.error = ''
|
||||
self.cfdi_uuid = ''
|
||||
self.date_stamped = ''
|
||||
|
||||
def _error(self, msg):
|
||||
self.error = str(msg)
|
||||
|
@ -91,6 +114,12 @@ class PACComercioDigital(object):
|
|||
headers['host'] = url.split('/')[2]
|
||||
headers['Content-type'] = 'text/plain'
|
||||
headers['Connection'] = 'Keep-Alive'
|
||||
headers['Expect'] = '100-continue'
|
||||
|
||||
if DEBUG:
|
||||
req = requests.Request('POST', url, headers=headers, data=data)
|
||||
prepared = req.prepare()
|
||||
pretty_print_POST(prepared)
|
||||
|
||||
try:
|
||||
result = requests.post(url, data=data, headers=headers, timeout=TIMEOUT)
|
||||
|
@ -103,14 +132,14 @@ class PACComercioDigital(object):
|
|||
"""
|
||||
Comercio Digital solo soporta la declaración con doble comilla
|
||||
"""
|
||||
tree = ET.fromstring(xml.encode())
|
||||
xml = ET.tostring(tree,
|
||||
pretty_print=True, doctype='<?xml version="1.0" encoding="utf-8"?>')
|
||||
return xml
|
||||
# ~ 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:
|
||||
auth = AUTH
|
||||
def stamp(self, cfdi, auth):
|
||||
# ~ if DEBUG or not auth:
|
||||
# ~ auth = AUTH
|
||||
|
||||
url = self.URL['timbra']
|
||||
headers = {
|
||||
|
@ -133,36 +162,48 @@ class PACComercioDigital(object):
|
|||
|
||||
xml = result.content
|
||||
tree = ET.fromstring(xml)
|
||||
self.cfdi_uuid = tree.xpath(
|
||||
cfdi_uuid = tree.xpath(
|
||||
'string(//cfdi:Complemento/tdf:TimbreFiscalDigital/@UUID)',
|
||||
namespaces=self.NS_CFDI)
|
||||
self.date_stamped = tree.xpath(
|
||||
date_stamped = tree.xpath(
|
||||
'string(//cfdi:Complemento/tdf:TimbreFiscalDigital/@FechaTimbrado)',
|
||||
namespaces=self.NS_CFDI)
|
||||
|
||||
return xml.decode()
|
||||
data = {
|
||||
'xml': xml.decode(),
|
||||
'uuid': cfdi_uuid,
|
||||
'date': date_stamped,
|
||||
}
|
||||
return data
|
||||
|
||||
def _get_data_cancel(self, cfdi, info, auth):
|
||||
NS_CFDI = {
|
||||
'cfdi': 'http://www.sat.gob.mx/cfd/3',
|
||||
'tdf': 'http://www.sat.gob.mx/TimbreFiscalDigital',
|
||||
info['tipo'] = 'cfdi'
|
||||
info['key'] = base64.b64encode(info['key_enc']).decode()
|
||||
info['cer'] = base64.b64encode(info['cer_ori']).decode()
|
||||
|
||||
tree = ET.fromstring(cfdi.encode())
|
||||
version = tree.attrib['Version']
|
||||
|
||||
namespaces = {
|
||||
'cfdi': NAMESPACES[version],
|
||||
'tdf': NAMESPACES['tdf'],
|
||||
}
|
||||
tree = ET.fromstring(cfdi)
|
||||
|
||||
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']}",
|
||||
|
@ -171,17 +212,19 @@ class PACComercioDigital(object):
|
|||
f"PWDK={info['pass']}",
|
||||
f"KEYF={info['key']}",
|
||||
f"CERT={info['cer']}",
|
||||
f"TIPO={info['tipo']}",
|
||||
f"TIPO1={info['tipo']}",
|
||||
f"ACUS=SI",
|
||||
f"RFCR={rfc_receptor}",
|
||||
f"TIPOC={tipo}",
|
||||
f"TOTAL={total}",
|
||||
f"UUIDREL={info['args']['uuid']}",
|
||||
f"MOTIVO={info['args']['reason']}",
|
||||
)
|
||||
return '\n'.join(data)
|
||||
|
||||
def cancel(self, cfdi, info, auth={}):
|
||||
if not auth:
|
||||
auth = AUTH
|
||||
def cancel(self, cfdi, info, auth):
|
||||
# ~ if DEBUG or not auth:
|
||||
# ~ auth = AUTH
|
||||
url = self.URL['cancel']
|
||||
data = self._get_data_cancel(cfdi, info, auth)
|
||||
|
||||
|
@ -197,15 +240,23 @@ class PACComercioDigital(object):
|
|||
self._error(result.headers['errmsg'])
|
||||
return ''
|
||||
|
||||
return result.content
|
||||
tree = ET.fromstring(result.text)
|
||||
date_cancel = tree.xpath('string(//Acuse/@Fecha)')[:19]
|
||||
|
||||
data = {
|
||||
'acuse': result.text,
|
||||
'date': date_cancel,
|
||||
}
|
||||
|
||||
return data
|
||||
|
||||
def _get_headers_cancel_xml(self, cfdi, info, auth):
|
||||
NS_CFDI = {
|
||||
'cfdi': 'http://www.sat.gob.mx/cfd/3',
|
||||
'tdf': 'http://www.sat.gob.mx/TimbreFiscalDigital',
|
||||
}
|
||||
tree = ET.fromstring(cfdi)
|
||||
tipo = tree.xpath(
|
||||
tree = ET.fromstring(cfdi.encode())
|
||||
tipocfdi = tree.xpath(
|
||||
'string(//cfdi:Comprobante/@TipoDeComprobante)',
|
||||
namespaces=NS_CFDI)
|
||||
total = tree.xpath(
|
||||
|
@ -220,15 +271,16 @@ class PACComercioDigital(object):
|
|||
'pwdws': auth['pass'],
|
||||
'rfcr': rfc_receptor,
|
||||
'total': total,
|
||||
'tipocfdi': tipo,
|
||||
'tipocfdi': tipocfdi,
|
||||
}
|
||||
headers.update(info)
|
||||
|
||||
return headers
|
||||
|
||||
def cancel_xml(self, cfdi, xml, info, auth={}):
|
||||
if not auth:
|
||||
auth = AUTH
|
||||
def cancel_xml(self, xml, auth, cfdi='', info={'tipo': 'cfdi'}):
|
||||
# ~ if DEBUG or not auth:
|
||||
# ~ auth = AUTH
|
||||
|
||||
url = self.URL['cancelxml']
|
||||
headers = self._get_headers_cancel_xml(cfdi, info, auth)
|
||||
result = self._post(url, xml, headers)
|
||||
|
@ -243,7 +295,39 @@ class PACComercioDigital(object):
|
|||
self._error(result.headers['errmsg'])
|
||||
return ''
|
||||
|
||||
return result.content
|
||||
tree = ET.fromstring(result.text)
|
||||
date_cancel = tree.xpath('string(//Acuse/@Fecha)')[:19]
|
||||
|
||||
data = {
|
||||
'acuse': result.text,
|
||||
'date': date_cancel,
|
||||
}
|
||||
return data
|
||||
|
||||
def status(self, data, auth):
|
||||
# ~ if not auth:
|
||||
# ~ auth = AUTH
|
||||
url = self.URL['status']
|
||||
|
||||
data = (
|
||||
f"USER={auth['user']}",
|
||||
f"PWDW={auth['pass']}",
|
||||
f"RFCR={data['rfc_receptor']}",
|
||||
f"RFCE={data['rfc_emisor']}",
|
||||
f"TOTAL={data['total']}",
|
||||
f"UUID={data['uuid']}",
|
||||
)
|
||||
data = '\n'.join(data)
|
||||
result = self._post(url, data)
|
||||
|
||||
if result is None:
|
||||
return ''
|
||||
|
||||
if result.status_code != 200:
|
||||
self._error(result.status_code)
|
||||
return self.error
|
||||
|
||||
return result.text
|
||||
|
||||
def _get_data_client(self, auth, values):
|
||||
data = [f"usr_ws={auth['user']}", f"pwd_ws={auth['pass']}"]
|
||||
|
@ -271,8 +355,8 @@ class PACComercioDigital(object):
|
|||
|
||||
return '\n'.join(data)
|
||||
|
||||
def client_add(self, data):
|
||||
auth = AUTH
|
||||
def client_add(self, data, auth):
|
||||
# ~ auth = AUTH
|
||||
url = self.URL['client']
|
||||
data = self._get_data_client(auth, data)
|
||||
|
||||
|
@ -291,7 +375,7 @@ class PACComercioDigital(object):
|
|||
|
||||
return True
|
||||
|
||||
def client_balance(self, data):
|
||||
def client_balance(self, data, rfc=''):
|
||||
url = self.URL['saldo']
|
||||
host = url.split('/')[2]
|
||||
headers = {
|
||||
|
@ -299,6 +383,7 @@ class PACComercioDigital(object):
|
|||
'Host': host,
|
||||
'Connection' : 'Keep-Alive',
|
||||
}
|
||||
data = {'usr': data['user'], 'pwd': data['pass']}
|
||||
try:
|
||||
result = requests.get(url, params=data, headers=headers, timeout=TIMEOUT)
|
||||
except ConnectionError as e:
|
||||
|
@ -312,11 +397,15 @@ class PACComercioDigital(object):
|
|||
self._error(result.text)
|
||||
return ''
|
||||
|
||||
if result.text == self.CODES['702']:
|
||||
self._error(result.text)
|
||||
return ''
|
||||
|
||||
return result.text
|
||||
|
||||
def client_add_timbres(self, data, auth={}):
|
||||
if not auth:
|
||||
auth = AUTH
|
||||
def client_add_timbres(self, data, auth):
|
||||
# ~ if not auth:
|
||||
# ~ auth = AUTH
|
||||
url = self.URL['timbres']
|
||||
data = '\n'.join((
|
||||
f"usr_ws={auth['user']}",
|
|
@ -17,11 +17,9 @@
|
|||
# ~ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
|
||||
# ~ Siempre consulta la documentación de Finkok
|
||||
# ~ AUTH = Puedes usar credenciales genericas para timbrar, o exclusivas para
|
||||
# ~ cada emisor
|
||||
# ~ RESELLER = Algunos procesos como agregar emisores, solo pueden ser usadas
|
||||
# ~ con una cuenta de reseller
|
||||
# ~ Siempre consulta la documentación de PAC
|
||||
# ~ AUTH = Las credenciales de timbrado proporcionadas por el PAC
|
||||
# ~ NO cambies las credenciales de prueba
|
||||
|
||||
|
||||
DEBUG = False
|
|
@ -0,0 +1,3 @@
|
|||
#!/usr/bin/env python3
|
||||
|
||||
from .finkok import PACFinkok
|
|
@ -0,0 +1,46 @@
|
|||
#!/usr/bin/env python
|
||||
# ~
|
||||
# ~ PAC
|
||||
# ~ Copyright (C) 2018-2019 Mauricio Baeza Servin - public [AT] elmau [DOT] net
|
||||
# ~
|
||||
# ~ This program is free software: you can redistribute it and/or modify
|
||||
# ~ it under the terms of the GNU General Public License as published by
|
||||
# ~ the Free Software Foundation, either version 3 of the License, or
|
||||
# ~ (at your option) any later version.
|
||||
# ~
|
||||
# ~ This program is distributed in the hope that it will be useful,
|
||||
# ~ but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# ~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# ~ GNU General Public License for more details.
|
||||
# ~
|
||||
# ~ You should have received a copy of the GNU General Public License
|
||||
# ~ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
|
||||
# ~ Siempre consulta la documentación de PAC
|
||||
# ~ AUTH = Las credenciales de timbrado proporcionadas por el PAC
|
||||
# ~ NO cambies las credenciales de prueba
|
||||
|
||||
|
||||
DEBUG = False
|
||||
|
||||
|
||||
AUTH = {
|
||||
'user': '',
|
||||
'pass': '',
|
||||
'RESELLER': {
|
||||
'user': '',
|
||||
'pass': ''
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if DEBUG:
|
||||
AUTH = {
|
||||
'user': 'pruebas-finkok@correolibre.net',
|
||||
'pass': '5c9a88da105bff9a8c430cb713f6d35269f51674bdc5963c1501b7316366',
|
||||
'RESELLER': {
|
||||
'user': '',
|
||||
'pass': ''
|
||||
}
|
||||
}
|
|
@ -0,0 +1,580 @@
|
|||
#!/usr/bin/env python
|
||||
# ~
|
||||
# ~ PAC
|
||||
# ~ Copyright (C) 2018-2019 Mauricio Baeza Servin - public [AT] elmau [DOT] net
|
||||
# ~
|
||||
# ~ This program is free software: you can redistribute it and/or modify
|
||||
# ~ it under the terms of the GNU General Public License as published by
|
||||
# ~ the Free Software Foundation, either version 3 of the License, or
|
||||
# ~ (at your option) any later version.
|
||||
# ~
|
||||
# ~ This program is distributed in the hope that it will be useful,
|
||||
# ~ but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# ~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# ~ GNU General Public License for more details.
|
||||
# ~
|
||||
# ~ You should have received a copy of the GNU General Public License
|
||||
# ~ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
# ~ import base64
|
||||
import datetime
|
||||
import logging
|
||||
import os
|
||||
import re
|
||||
from io import BytesIO
|
||||
from xml.sax.saxutils import unescape
|
||||
|
||||
import lxml.etree as ET
|
||||
from zeep import Client
|
||||
from zeep.plugins import Plugin
|
||||
from zeep.cache import SqliteCache
|
||||
from zeep.transports import Transport
|
||||
from zeep.exceptions import Fault, TransportError
|
||||
from requests.exceptions import ConnectionError
|
||||
|
||||
from .conf import DEBUG, AUTH
|
||||
|
||||
|
||||
LOG_FORMAT = '%(asctime)s - %(levelname)s - %(message)s'
|
||||
LOG_DATE = '%d/%m/%Y %H:%M:%S'
|
||||
logging.addLevelName(logging.ERROR, '\033[1;41mERROR\033[1;0m')
|
||||
logging.addLevelName(logging.DEBUG, '\x1b[33mDEBUG\033[1;0m')
|
||||
logging.addLevelName(logging.INFO, '\x1b[32mINFO\033[1;0m')
|
||||
logging.basicConfig(level=logging.DEBUG, format=LOG_FORMAT, datefmt=LOG_DATE)
|
||||
log = logging.getLogger(__name__)
|
||||
logging.getLogger('requests').setLevel(logging.ERROR)
|
||||
logging.getLogger('zeep').setLevel(logging.ERROR)
|
||||
|
||||
|
||||
TIMEOUT = 10
|
||||
DEBUG_SOAP = False
|
||||
|
||||
|
||||
class DebugPlugin(Plugin):
|
||||
|
||||
def _to_string(self, envelope, name):
|
||||
if DEBUG_SOAP:
|
||||
data = ET.tostring(envelope, pretty_print=True, encoding='utf-8').decode()
|
||||
path = f'/tmp/soap_{name}.xml'
|
||||
with open(path, 'w') as f:
|
||||
f.write(data)
|
||||
# ~ print(data)
|
||||
return
|
||||
|
||||
def egress(self, envelope, http_headers, operation, binding_options):
|
||||
self._to_string(envelope, 'request')
|
||||
return envelope, http_headers
|
||||
|
||||
def ingress(self, envelope, http_headers, operation):
|
||||
self._to_string(envelope, 'response')
|
||||
return envelope, http_headers
|
||||
|
||||
|
||||
class PACFinkok(object):
|
||||
WS = 'https://facturacion.finkok.com/servicios/soap/{}.wsdl'
|
||||
NS_TYPE = 'ns1'
|
||||
if DEBUG:
|
||||
WS = 'https://demo-facturacion.finkok.com/servicios/soap/{}.wsdl'
|
||||
NS_TYPE = 'ns0'
|
||||
URL = {
|
||||
'quick_stamp': False,
|
||||
'timbra': WS.format('stamp'),
|
||||
'cancel': WS.format('cancel'),
|
||||
'client': WS.format('registration'),
|
||||
'util': WS.format('utilities'),
|
||||
}
|
||||
CODE = {
|
||||
'200': 'Comprobante timbrado satisfactoriamente',
|
||||
'205': 'No Encontrado',
|
||||
'307': 'Comprobante timbrado previamente',
|
||||
'702': 'No se encontro el RFC del emisor',
|
||||
'IP': 'Invalid Passphrase',
|
||||
'IPMSG': 'Frase de paso inválida',
|
||||
'NE': 'No Encontrado',
|
||||
}
|
||||
|
||||
def __init__(self):
|
||||
self._error = ''
|
||||
self._transport = Transport(cache=SqliteCache(), timeout=TIMEOUT)
|
||||
self._plugins = [DebugPlugin()]
|
||||
|
||||
@property
|
||||
def error(self):
|
||||
return self._error
|
||||
|
||||
def _validate_result(self, result):
|
||||
if hasattr(result, 'Incidencias') and not result.Incidencias is None:
|
||||
fault = result.Incidencias.Incidencia[0]
|
||||
cod_error = fault.CodigoError.encode('utf-8').decode()
|
||||
msg_error = fault.MensajeIncidencia.encode('utf-8').decode()
|
||||
error = 'Error: {}\n{}'.format(cod_error, msg_error)
|
||||
if cod_error == '307':
|
||||
return result
|
||||
|
||||
self._error = self.CODE.get(cod_error, error)
|
||||
return {}
|
||||
|
||||
if hasattr(result, 'CodEstatus'):
|
||||
ce = result.CodEstatus
|
||||
if ce is None:
|
||||
return result
|
||||
|
||||
if ce == self.CODE['IP']:
|
||||
self._error = self.CODE['IPMSG']
|
||||
return {}
|
||||
|
||||
if self.CODE['NE'] in ce:
|
||||
self._error = 'UUID ' + self.CODE['NE']
|
||||
return {}
|
||||
|
||||
if ce == 'UUID Not Found':
|
||||
self._error = 'UUID ' + self.CODE['NE']
|
||||
return {}
|
||||
|
||||
if self.CODE['200'] != ce:
|
||||
self._error = ce
|
||||
return {}
|
||||
|
||||
return result
|
||||
|
||||
return result
|
||||
|
||||
def _get_result(self, client, method, args):
|
||||
self._error = ''
|
||||
try:
|
||||
result = getattr(client.service, method)(**args)
|
||||
except Fault as e:
|
||||
self._error = str(e)
|
||||
return {}
|
||||
except TransportError as e:
|
||||
if '413' in str(e):
|
||||
self._error = '413<BR><BR><b>Documento muy grande para timbrar</b>'
|
||||
else:
|
||||
self._error = str(e)
|
||||
return {}
|
||||
except ConnectionError as e:
|
||||
msg = '502 - Error de conexión'
|
||||
self._error = msg
|
||||
return {}
|
||||
|
||||
return self._validate_result(result)
|
||||
|
||||
def _to_string(self, data):
|
||||
root = ET.parse(BytesIO(data.encode('utf-8'))).getroot()
|
||||
xml = ET.tostring(root,
|
||||
pretty_print=True, xml_declaration=True, encoding='utf-8')
|
||||
return xml.decode('utf-8')
|
||||
|
||||
def stamp(self, cfdi, auth={}):
|
||||
if DEBUG or not auth:
|
||||
auth = AUTH
|
||||
|
||||
method = 'timbra'
|
||||
client = Client(self.URL[method],
|
||||
transport=self._transport, plugins=self._plugins)
|
||||
args = {
|
||||
'username': auth['user'],
|
||||
'password': auth['pass'],
|
||||
'xml': cfdi.encode('utf-8'),
|
||||
}
|
||||
result = self._get_result(client, 'stamp', args)
|
||||
if self.error:
|
||||
log.error(self.error)
|
||||
return ''
|
||||
|
||||
data = {
|
||||
'xml': self._to_string(result.xml),
|
||||
'uuid': result.UUID,
|
||||
'date': result.Fecha,
|
||||
}
|
||||
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 = {
|
||||
'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)
|
||||
cfdi_uuid = tree.xpath(
|
||||
'string(//cfdi:Complemento/tdf:TimbreFiscalDigital/@UUID)',
|
||||
namespaces=NS_CFDI)
|
||||
return rfc_emisor, cfdi_uuid
|
||||
|
||||
def cancel(self, cfdi, info, auth={}):
|
||||
if DEBUG or not auth:
|
||||
auth = AUTH
|
||||
|
||||
rfc_emisor, cfdi_uuid = self._get_data_cancel(cfdi)
|
||||
method = 'cancel'
|
||||
client = Client(self.URL[method],
|
||||
transport=self._transport, plugins=self._plugins)
|
||||
|
||||
uuid_type = client.get_type(f'{self.NS_TYPE}:UUIDS')
|
||||
ns1_uuid = client.get_type(f'{self.NS_TYPE}:UUID')
|
||||
|
||||
# ~ sa = client.get_type('ns0:stringArray')
|
||||
|
||||
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'],
|
||||
'password': auth['pass'],
|
||||
'taxpayer_id': rfc_emisor,
|
||||
'cer': info['cer'],
|
||||
'key': info['key'],
|
||||
'store_pending': False,
|
||||
}
|
||||
|
||||
result = self._get_result(client, 'cancel', args)
|
||||
if self.error:
|
||||
log.error(self.error)
|
||||
return ''
|
||||
|
||||
folio = result['Folios']['Folio'][0]
|
||||
status = folio['EstatusUUID']
|
||||
if status != '201':
|
||||
log.debug(f'Cancel status: {status} - {cfdi_uuid}')
|
||||
|
||||
data = {
|
||||
'acuse': result['Acuse'],
|
||||
'date': result['Fecha'],
|
||||
}
|
||||
return data
|
||||
|
||||
def cancel_xml(self, xml, auth={}, cfdi=''):
|
||||
if DEBUG or not auth:
|
||||
auth = AUTH
|
||||
|
||||
method = 'cancel'
|
||||
client = Client(self.URL[method],
|
||||
transport=self._transport, plugins=self._plugins)
|
||||
client.set_ns_prefix('can', 'http://facturacion.finkok.com/cancel')
|
||||
args = {
|
||||
'xml': xml.encode(),
|
||||
'username': auth['user'],
|
||||
'password': auth['pass'],
|
||||
'store_pending': False,
|
||||
}
|
||||
result = self._get_result(client, 'cancel_signature', args)
|
||||
if self.error:
|
||||
log.error(self.error)
|
||||
return ''
|
||||
|
||||
folio = result['Folios']['Folio'][0]
|
||||
status = folio['EstatusUUID']
|
||||
|
||||
if status == '708':
|
||||
self._error = 'Error 708 del SAT, intenta más tarde.'
|
||||
log.error(self.error)
|
||||
return ''
|
||||
|
||||
if status != '201':
|
||||
log.debug(f'Cancel status: {status} -')
|
||||
|
||||
data = {
|
||||
'acuse': result['Acuse'],
|
||||
'date': result['Fecha'],
|
||||
}
|
||||
return data
|
||||
|
||||
def client_add(self, rfc, type_user=False):
|
||||
"""Agrega un nuevo cliente para timbrado.
|
||||
Se requiere cuenta de reseller para usar este método
|
||||
|
||||
Args:
|
||||
rfc (str): El RFC del nuevo cliente
|
||||
|
||||
Kwargs:
|
||||
type_user (bool):
|
||||
False == 'P' == Prepago
|
||||
True == 'O' == On demand
|
||||
|
||||
Returns:
|
||||
True or False
|
||||
|
||||
origin PAC
|
||||
'message':
|
||||
'Account Created successfully'
|
||||
'Account Already exists'
|
||||
'success': True or False
|
||||
"""
|
||||
auth = AUTH['RESELLER']
|
||||
tu = {True: 'O', False: 'P'}
|
||||
|
||||
method = 'client'
|
||||
client = Client(
|
||||
self.URL[method], transport=self._transport, plugins=self._plugins)
|
||||
|
||||
args = {
|
||||
'reseller_username': auth['user'],
|
||||
'reseller_password': auth['pass'],
|
||||
'taxpayer_id': rfc,
|
||||
'type_user': tu[type_user],
|
||||
'added': datetime.datetime.now().isoformat()[:19],
|
||||
}
|
||||
|
||||
result = self._get_result(client, 'add', args)
|
||||
if self.error:
|
||||
return False
|
||||
|
||||
if not result.success:
|
||||
self.error = result.message
|
||||
return False
|
||||
|
||||
# ~ PAC success debería ser False
|
||||
msg = 'Account Already exists'
|
||||
if result.message == msg:
|
||||
self.error = msg
|
||||
return True
|
||||
|
||||
return result.success
|
||||
|
||||
def client_get_token(self, rfc, email):
|
||||
"""Genera un nuevo token al cliente para timbrado.
|
||||
Se requiere cuenta de reseller para usar este método
|
||||
|
||||
Args:
|
||||
rfc (str): El RFC del cliente, ya debe existir
|
||||
email (str): El correo del cliente, funciona como USER al timbrar
|
||||
|
||||
Returns:
|
||||
token (str): Es la contraseña para timbrar
|
||||
|
||||
origin PAC
|
||||
dict
|
||||
'username': 'username',
|
||||
'status': True or False
|
||||
'name': 'name',
|
||||
'success': True or False
|
||||
'token': 'Token de timbrado',
|
||||
'message': None
|
||||
"""
|
||||
auth = AUTH['RESELLER']
|
||||
method = 'util'
|
||||
client = Client(
|
||||
self.URL[method], transport=self._transport, plugins=self._plugins)
|
||||
args = {
|
||||
'username': auth['user'],
|
||||
'password': auth['pass'],
|
||||
'name': rfc,
|
||||
'token_username': email,
|
||||
'taxpayer_id': rfc,
|
||||
'status': True,
|
||||
}
|
||||
|
||||
result = self._get_result(client, 'add_token', args)
|
||||
if self.error:
|
||||
log.error(self.error)
|
||||
return ''
|
||||
|
||||
if not result.success:
|
||||
self.error = result.message
|
||||
log.error(self.error)
|
||||
return ''
|
||||
|
||||
return result.token
|
||||
|
||||
def client_add_timbres(self, rfc, credit):
|
||||
"""Agregar credito a un emisor
|
||||
|
||||
Se requiere cuenta de reseller
|
||||
|
||||
Args:
|
||||
rfc (str): El RFC del emisor, debe existir
|
||||
credit (int): Cantidad de folios a agregar
|
||||
|
||||
Returns:
|
||||
dict
|
||||
'success': True or False,
|
||||
'credit': nuevo credito despues de agregar or None
|
||||
'message':
|
||||
'Success, added {credit} of credit to {RFC}.'
|
||||
'RFC no encontrado'
|
||||
"""
|
||||
auth = AUTH['RESELLER']
|
||||
|
||||
method = 'client'
|
||||
client = Client(
|
||||
self.URL[method], transport=self._transport, plugins=self._plugins)
|
||||
args = {
|
||||
'username': auth['user'],
|
||||
'password': auth['pass'],
|
||||
'taxpayer_id': rfc,
|
||||
'credit': credit,
|
||||
}
|
||||
|
||||
result = self._get_result(client, 'assign', args)
|
||||
if self.error:
|
||||
log.error(error)
|
||||
return ''
|
||||
|
||||
if not result.success:
|
||||
self.error = result.message
|
||||
return 0
|
||||
|
||||
return result.credit
|
||||
|
||||
def client_balance(self, auth={}, rfc=''):
|
||||
"""Regresa los timbres restantes del cliente
|
||||
Se pueden usar las credenciales de relleser o las credenciales del emisor
|
||||
|
||||
Args:
|
||||
auth (dict): Credenciales del emisor
|
||||
rfc (str): El RFC del emisor
|
||||
|
||||
Returns:
|
||||
int Cantidad de timbres restantes
|
||||
"""
|
||||
if not auth:
|
||||
auth = AUTH['RESELLER']
|
||||
|
||||
method = 'client'
|
||||
client = Client(self.URL[method],
|
||||
transport=self._transport, plugins=self._plugins)
|
||||
args = {
|
||||
'reseller_username': auth['user'],
|
||||
'reseller_password': auth['pass'],
|
||||
'taxpayer_id': rfc,
|
||||
}
|
||||
result = self._get_result(client, 'get', args)
|
||||
|
||||
if self.error:
|
||||
log.error(self.error)
|
||||
return ''
|
||||
|
||||
success = bool(result.users)
|
||||
if not success:
|
||||
self._error = result.message or 'RFC no existe'
|
||||
log.error(self.error)
|
||||
return 0
|
||||
|
||||
return result.users.ResellerUser[0].credit
|
||||
|
||||
def client_set_status(self, rfc, status):
|
||||
"""Edita el estatus (Activo o Suspendido) de un cliente
|
||||
Se requiere cuenta de reseller para usar este método
|
||||
|
||||
Args:
|
||||
rfc (str): El RFC del cliente
|
||||
|
||||
Kwargs:
|
||||
status (bool):
|
||||
True == 'A' == Activo
|
||||
False == 'S' == Suspendido
|
||||
|
||||
Returns:
|
||||
dict
|
||||
'message':
|
||||
'Account Created successfully'
|
||||
'Account Already exists'
|
||||
'success': True or False
|
||||
"""
|
||||
auth = AUTH['RESELLER']
|
||||
ts = {True: 'A', False: 'S'}
|
||||
method = 'client'
|
||||
client = Client(self.URL[method],
|
||||
transport=self._transport, plugins=self._plugins)
|
||||
|
||||
args = {
|
||||
'reseller_username': auth['user'],
|
||||
'reseller_password': auth['pass'],
|
||||
'taxpayer_id': rfc,
|
||||
'status': ts[status],
|
||||
}
|
||||
result = self._get_result(client, 'edit', args)
|
||||
|
||||
if self.error:
|
||||
return False
|
||||
|
||||
if not result.success:
|
||||
self.error = result.message
|
||||
return False
|
||||
|
||||
return True
|
||||
|
||||
def client_switch(self, rfc, type_user):
|
||||
"""Edita el tipo de timbrado (OnDemand o Prepago) de un cliente
|
||||
Se requiere cuenta de reseller para usar este método
|
||||
|
||||
Args:
|
||||
rfc (str): El RFC del cliente
|
||||
|
||||
Kwargs:
|
||||
status (bool):
|
||||
True == 'O' == OnDemand
|
||||
False == 'P' == Prepago
|
||||
|
||||
Returns:
|
||||
dict
|
||||
'message':
|
||||
'Account Created successfully'
|
||||
'Account Already exists'
|
||||
'success': True or False
|
||||
"""
|
||||
auth = AUTH['RESELLER']
|
||||
tu = {True: 'O', False: 'P'}
|
||||
method = 'client'
|
||||
client = Client(self.URL[method],
|
||||
transport=self._transport, plugins=self._plugins)
|
||||
|
||||
args = {
|
||||
'username': auth['user'],
|
||||
'password': auth['pass'],
|
||||
'taxpayer_id': rfc,
|
||||
'type_user': tu[type_user],
|
||||
}
|
||||
result = self._get_result(client, 'switch', args)
|
||||
|
||||
if self.error:
|
||||
return False
|
||||
|
||||
if not result.success:
|
||||
self.error = result.message
|
||||
return False
|
||||
|
||||
return True
|
||||
|
||||
def client_report_folios(self, rfc, date_from, date_to, invoice_type='I'):
|
||||
"""Obtiene un reporte del total de facturas timbradas
|
||||
"""
|
||||
auth = AUTH['RESELLER']
|
||||
|
||||
args = {
|
||||
'username': auth['user'],
|
||||
'password': auth['pass'],
|
||||
'taxpayer_id': rfc,
|
||||
'date_from': date_from,
|
||||
'date_to': date_to,
|
||||
'invoice_type': invoice_type,
|
||||
}
|
||||
|
||||
method = 'util'
|
||||
client = Client(self.URL[method],
|
||||
transport=self._transport, plugins=self._plugins)
|
||||
|
||||
result = self._get_result(client, 'report_total', args)
|
||||
|
||||
if result.result is None:
|
||||
# ~ PAC - Debería regresar RFC inexistente o sin registros
|
||||
self.error = 'RFC no existe o no tiene registros'
|
||||
return 0
|
||||
|
||||
total = result.result.ReportTotal[0].total
|
||||
|
||||
return total
|
|
@ -0,0 +1,87 @@
|
|||
#!/usr/bin/env python3
|
||||
|
||||
from decimal import Decimal, getcontext
|
||||
# ~ getcontext().prec = 6
|
||||
|
||||
import lxml.etree as ET
|
||||
from requests.structures import CaseInsensitiveDict as CIDict
|
||||
|
||||
|
||||
NS_CFDI = {
|
||||
'cfdi': 'http://www.sat.gob.mx/cfd/3',
|
||||
'tfd': 'http://www.sat.gob.mx/TimbreFiscalDigital',
|
||||
'nomina12': 'http://www.sat.gob.mx/nomina12',
|
||||
}
|
||||
PRE = '/cfdi:Comprobante'
|
||||
|
||||
|
||||
class CfdiRead(object):
|
||||
|
||||
def __init__(self, source):
|
||||
self._source = source
|
||||
self._data = {}
|
||||
self._error = ''
|
||||
self._rfc_emisor = ''
|
||||
self._rfc_receptor = ''
|
||||
self._parse()
|
||||
|
||||
@property
|
||||
def source(self):
|
||||
return self._source
|
||||
|
||||
@property
|
||||
def data(self):
|
||||
return self._data
|
||||
|
||||
@property
|
||||
def rfc_emisor(self):
|
||||
return self._rfc_emisor
|
||||
|
||||
@property
|
||||
def rfc_receptor(self):
|
||||
return self._rfc_receptor
|
||||
|
||||
@property
|
||||
def error(self):
|
||||
return self._error
|
||||
|
||||
def _parse(self):
|
||||
self._tree = ET.fromstring(self.source)
|
||||
self._data['cfdi'] = dict(self._tree.attrib)
|
||||
|
||||
node_name = f'{PRE}/cfdi:Emisor'
|
||||
self._data['emisor'] = self._get_attr(node_name)
|
||||
self._rfc_emisor = self._data['emisor']['Rfc']
|
||||
|
||||
node_name = f'{PRE}/cfdi:Receptor'
|
||||
self._data['receptor'] = self._get_attr(node_name)
|
||||
self._rfc_receptor = self._data['receptor']['Rfc']
|
||||
|
||||
node_name = f'{PRE}/cfdi:Complemento/tfd:TimbreFiscalDigital'
|
||||
self._data['timbre'] = self._get_attr(node_name)
|
||||
|
||||
self._parse_details()
|
||||
return
|
||||
|
||||
def _get_attr(self, node_name):
|
||||
node = self._tree.xpath(node_name, namespaces=NS_CFDI)[0]
|
||||
attr = dict(node.attrib)
|
||||
return attr
|
||||
|
||||
def _parse_details(self):
|
||||
node_name = f'{PRE}/cfdi:Conceptos/cfdi:Concepto'
|
||||
details = self._tree.xpath(node_name, namespaces=NS_CFDI)
|
||||
rows = []
|
||||
for detail in details:
|
||||
row = dict(detail.attrib)
|
||||
for k, v in row.items():
|
||||
if k in ('Cantidad', 'ValorUnitario', 'Descuento', 'Importe'):
|
||||
row[k] = Decimal(v)
|
||||
# ~ row['taxes'] = self._get_taxes(detail)
|
||||
rows.append(row)
|
||||
self._data['conceptos'] = rows
|
||||
return
|
||||
|
||||
|
||||
class CfdiWrite(object):
|
||||
pass
|
File diff suppressed because it is too large
Load Diff
|
@ -18,8 +18,10 @@
|
|||
|
||||
import base64
|
||||
import collections
|
||||
import csv
|
||||
import datetime
|
||||
import getpass
|
||||
import io
|
||||
import json
|
||||
import logging
|
||||
import math
|
||||
|
@ -28,10 +30,13 @@ import shlex
|
|||
import shutil
|
||||
import smtplib
|
||||
import sqlite3
|
||||
import ssl
|
||||
import subprocess
|
||||
import threading
|
||||
import unicodedata
|
||||
import zipfile
|
||||
from pathlib import Path
|
||||
from xml.sax.saxutils import escape
|
||||
|
||||
from email.mime.multipart import MIMEMultipart
|
||||
from email.mime.base import MIMEBase
|
||||
|
@ -48,11 +53,17 @@ from cryptography.hazmat.backends import default_backend
|
|||
from cryptography.hazmat.primitives import hashes
|
||||
from dateutil import parser
|
||||
|
||||
import seafileapi
|
||||
from .cfdi_xml import CFDI
|
||||
|
||||
from settings import DEBUG, DB_COMPANIES, PATHS
|
||||
from .comercio import PACComercioDigital
|
||||
# ~ from .finkok import PACFinkok
|
||||
from settings import DEBUG, DB_COMPANIES, PATHS, TEMPLATE_CANCEL, RFCS, PRE
|
||||
|
||||
from .pacs.cfdi_cert import SATCertificate
|
||||
from .pacs import PACComercioDigital
|
||||
from .pacs import PACFinkok
|
||||
|
||||
# ~ v2
|
||||
import segno
|
||||
from .pycfdi import CfdiRead
|
||||
|
||||
|
||||
LOG_FORMAT = '%(asctime)s - %(levelname)s - %(message)s'
|
||||
|
@ -74,10 +85,16 @@ if DEBUG:
|
|||
PSQL = 'psql -h localhost -U postgres'
|
||||
|
||||
PACS = {
|
||||
# ~ '': PACFinkok,
|
||||
'finkok': PACFinkok,
|
||||
'comercio': PACComercioDigital,
|
||||
}
|
||||
|
||||
NS_CFDI = {
|
||||
'cfdi': 'http://www.sat.gob.mx/cfd/3',
|
||||
'tdf': 'http://www.sat.gob.mx/TimbreFiscalDigital',
|
||||
}
|
||||
|
||||
|
||||
#~ https://github.com/kennethreitz/requests/blob/v1.2.3/requests/structures.py#L37
|
||||
class CaseInsensitiveDict(collections.MutableMapping):
|
||||
"""
|
||||
|
@ -165,10 +182,8 @@ class SendMail(object):
|
|||
return self._error
|
||||
|
||||
def _login(self):
|
||||
hosts = ('gmail' in self._config['server'] or
|
||||
'outlook' in self._config['server'])
|
||||
try:
|
||||
if self._config['ssl'] and hosts:
|
||||
if self._config['ssl'] and self._config['starttls']:
|
||||
self._server = smtplib.SMTP(
|
||||
self._config['server'],
|
||||
self._config['port'], timeout=TIMEOUT)
|
||||
|
@ -241,13 +256,135 @@ 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',
|
||||
'02': '[02] Propietario',
|
||||
'03': '[03] Arrendador',
|
||||
'04': '[04] Notificado',
|
||||
}
|
||||
REGIMEN_FISCAL = {
|
||||
'601': '[601] General de Ley Personas Morales',
|
||||
'603': '[603] Personas Morales con Fines no Lucrativos',
|
||||
'605': '[605] Sueldos y Salarios e Ingresos Asimilados a Salarios',
|
||||
'606': '[606] Arrendamiento',
|
||||
'607': '[607] Régimen de Enajenación o Adquisición de Bienes',
|
||||
'608': '[608] Demás ingresos',
|
||||
'610': '[610] Residentes en el Extranjero sin Establecimiento Permanente en México',
|
||||
'611': '[611] Ingresos por Dividendos (socios y accionistas)',
|
||||
'612': '[612] Personas Físicas con Actividades Empresariales y Profesionales',
|
||||
'614': '[614] Ingresos por intereses',
|
||||
'615': '[615] Régimen de los ingresos por obtención de premios',
|
||||
'616': '[616] Sin obligaciones fiscales',
|
||||
'620': '[620] Sociedades Cooperativas de Producción que optan por diferir sus ingresos',
|
||||
'621': '[621] Incorporación Fiscal',
|
||||
'622': '[622] Actividades Agrícolas, Ganaderas, Silvícolas y Pesqueras',
|
||||
'623': '[623] Opcional para Grupos de Sociedades',
|
||||
'624': '[624] Coordinados',
|
||||
'625': '[625] Régimen de las Actividades Empresariales con ingresos a través de Plataformas Tecnológicas',
|
||||
'626': '[626] Régimen Simplificado de Confianza',
|
||||
}
|
||||
USO_CFDI = {
|
||||
'G01': '[G01] Adquisición de mercancías.',
|
||||
'G02': '[G02] Devoluciones, descuentos o bonificaciones.',
|
||||
'G03': '[G03] Gastos en general.',
|
||||
'I01': '[I01] Construcciones.',
|
||||
'I02': '[I02] Mobiliario y equipo de oficina por inversiones.',
|
||||
'I03': '[I03] Equipo de transporte.',
|
||||
'I04': '[I04] Equipo de computo y accesorios.',
|
||||
'I05': '[I05] Dados, troqueles, moldes, matrices y herramental.',
|
||||
'I06': '[I06] Comunicaciones telefónicas.',
|
||||
'I07': '[I07] Comunicaciones satelitales.',
|
||||
'I08': '[I08] Otra maquinaria y equipo.',
|
||||
'D01': '[D01] Honorarios médicos, dentales y gastos hospitalarios.',
|
||||
'D02': '[D02] Gastos médicos por incapacidad o discapacidad.',
|
||||
'D03': '[D03] Gastos funerales.',
|
||||
'D04': '[D04] Donativos.',
|
||||
'D05': '[D05] Intereses reales efectivamente pagados por créditos hipotecarios (casa habitación).',
|
||||
'D06': '[D06] Aportaciones voluntarias al SAR.',
|
||||
'D07': '[D07] Primas por seguros de gastos médicos.',
|
||||
'D08': '[D08] Gastos de transportación escolar obligatoria.',
|
||||
'D09': '[D09] Depósitos en cuentas para el ahorro, primas que tengan como base planes de pensiones.',
|
||||
'D10': '[D10] Pagos por servicios educativos (colegiaturas).',
|
||||
'S01': '[S01] Sin efectos fiscales.',
|
||||
'CP01': '[CP01] Pagos',
|
||||
'CN01': '[CN01] Nómina',
|
||||
'P01': '[P01] Por definir',
|
||||
}
|
||||
PAISES = {
|
||||
'MEX': 'México',
|
||||
}
|
||||
ESTADOS = {
|
||||
'AGU': 'Aguascalientes',
|
||||
'BCN': 'Baja California',
|
||||
'BCS': 'Baja California Sur',
|
||||
'CAM': 'Campeche',
|
||||
'CHP': 'Chiapas',
|
||||
'CHH': 'Chihuahua',
|
||||
'COA': 'Coahuila',
|
||||
'COL': 'Colima',
|
||||
'DIF': 'Ciudad de México',
|
||||
'DUR': 'Durango',
|
||||
'GUA': 'Guanajuato',
|
||||
'GRO': 'Guerrero',
|
||||
'HID': 'Hidalgo',
|
||||
'JAL': 'Jalisco',
|
||||
'MEX': 'México',
|
||||
'MIC': 'Michoacán',
|
||||
'MOR': 'Morelos',
|
||||
'NAC': 'Nacional',
|
||||
'NAY': 'Nayarit',
|
||||
'NLE': 'Nuevo León',
|
||||
'OAX': 'Oaxaca',
|
||||
'PUE': 'Puebla',
|
||||
'QUE': 'Querétaro',
|
||||
'ROO': 'Quintana Roo',
|
||||
'SLP': 'San Luis Potosí',
|
||||
'SIN': 'Sinaloa',
|
||||
'SON': 'Sonora',
|
||||
'TAB': 'Tabasco',
|
||||
'TAM': 'Tamaulipas',
|
||||
'TLA': 'Tlaxcala',
|
||||
'VER': 'Veracruz',
|
||||
'YUC': 'Yucatán',
|
||||
'ZAC': 'Zacatecas',
|
||||
}
|
||||
PERIODICIDAD = {
|
||||
'01': '[01] Diario',
|
||||
'02': '[02] Semanal',
|
||||
'03': '[03] Quincenal',
|
||||
'04': '[04] Mensual',
|
||||
'05': '[05] Bimestral',
|
||||
}
|
||||
MESES = {
|
||||
'01': '[01] Enero',
|
||||
'02': '[02] Febrero',
|
||||
'03': '[03] Marzo',
|
||||
'04': '[04] Abril',
|
||||
'05': '[05] Mayo',
|
||||
'06': '[06] Junio',
|
||||
'07': '[07] Julio',
|
||||
'08': '[08] Agosto',
|
||||
'09': '[09] Septiembre',
|
||||
'10': '[10] Octubre',
|
||||
'11': '[11] Noviembre',
|
||||
'12': '[12] Diciembre',
|
||||
}
|
||||
|
||||
def __init__(self, xml):
|
||||
self.version = ''
|
||||
self._values = {
|
||||
'leyendas': (),
|
||||
}
|
||||
|
@ -259,13 +396,73 @@ class CfdiToDict(object):
|
|||
return self._values
|
||||
|
||||
def _get_values(self):
|
||||
self.version = self._root.attrib['Version']
|
||||
ns = f'cfdi{self.version}'
|
||||
self.NS['cfdi'] = self.NS_VERSION[ns]
|
||||
self._timbre_fiscal()
|
||||
self._informacion_global()
|
||||
self._receptor()
|
||||
self._complementos()
|
||||
return
|
||||
|
||||
def _timbre_fiscal(self):
|
||||
path = '//tfd:TimbreFiscalDigital'
|
||||
data = self._root.xpath(path, namespaces=self.NS)
|
||||
if not data:
|
||||
return
|
||||
|
||||
data = data[0]
|
||||
attr = CaseInsensitiveDict(data.attrib)
|
||||
self._fecha_timbrado = attr['FechaTimbrado']
|
||||
return
|
||||
|
||||
def _informacion_global(self):
|
||||
self._values['informacion_global'] = {}
|
||||
|
||||
path = '//cfdi:InformacionGlobal'
|
||||
data = self._root.xpath(path, namespaces=self.NS)
|
||||
if not data:
|
||||
return
|
||||
|
||||
data = data[0]
|
||||
attr = CaseInsensitiveDict(data.attrib)
|
||||
|
||||
value = f"Periodicidad Factura Global: {self.PERIODICIDAD[attr['Periodicidad']]} "
|
||||
value += f"del mes {self.MESES[attr['Meses']]} "
|
||||
value += f"del año {attr['Año']}"
|
||||
self._values['informacion_global'] = {'informacion_global': value}
|
||||
return
|
||||
|
||||
def _receptor(self):
|
||||
path = '//cfdi:Receptor'
|
||||
receptor = self._root.xpath(path, namespaces=self.NS)[0]
|
||||
attr = CaseInsensitiveDict(receptor.attrib)
|
||||
attr['usocfdi'] = self.USO_CFDI[attr['UsoCFDI']]
|
||||
if self.version == '4.0':
|
||||
attr['domiciliofiscal'] = attr['DomicilioFiscalReceptor']
|
||||
attr['regimenfiscal'] = self.REGIMEN_FISCAL[attr['RegimenFiscalReceptor']]
|
||||
self._values['receptor'] = attr
|
||||
return
|
||||
|
||||
def _set_carta_porte_domicilio(self, data):
|
||||
municipio = data['Municipio']
|
||||
estado = self.ESTADOS[data['Estado']]
|
||||
pais = self.PAISES[data['Pais']]
|
||||
domicilio = f"{municipio}, {estado}, {pais}, C.P. {data['CodigoPostal']}"
|
||||
return domicilio
|
||||
|
||||
def _complementos(self):
|
||||
path = '//cfdi:Complemento'
|
||||
complemento = self._root.xpath(path, namespaces=self.NS)[0]
|
||||
|
||||
path = '//nomina12:Nomina'
|
||||
nomina = complemento.xpath(path, namespaces=self.NS)
|
||||
if nomina:
|
||||
for node in nomina[0]:
|
||||
if 'Receptor' in node.tag:
|
||||
attr = CaseInsensitiveDict(node.attrib)
|
||||
self._values['receptor'].update(attr)
|
||||
|
||||
path = '//divisas:Divisas'
|
||||
divisas = complemento.xpath(path, namespaces=self.NS)
|
||||
if divisas:
|
||||
|
@ -278,6 +475,147 @@ class CfdiToDict(object):
|
|||
if node:
|
||||
leyendas = [CaseInsensitiveDict(n.attrib) for n in node]
|
||||
self._values['leyendas'] = leyendas
|
||||
|
||||
path = '//cartaporte20:CartaPorte'
|
||||
carta_porte = complemento.xpath(path, namespaces=self.NS)
|
||||
if carta_porte:
|
||||
values = CaseInsensitiveDict(carta_porte[0].attrib)
|
||||
for node in carta_porte[0]:
|
||||
if 'FiguraTransporte' in node.tag:
|
||||
figuras = CaseInsensitiveDict(node[0].attrib)
|
||||
figuras['TipoFigura'] = self.tipo_figura[figuras['TipoFigura']]
|
||||
values['figuras'] = figuras
|
||||
elif 'Mercancias' in node.tag:
|
||||
mercancias = CaseInsensitiveDict(node.attrib)
|
||||
detalle = [CaseInsensitiveDict(n.attrib)
|
||||
for n in node if 'Mercancia' in n.tag]
|
||||
values['mercancias'] = {
|
||||
'mercancias': mercancias,
|
||||
'detalle': detalle,
|
||||
}
|
||||
|
||||
path = '//cartaporte20:Autotransporte'
|
||||
node_auto = node.xpath(path, namespaces=self.NS)[0]
|
||||
values_auto = CaseInsensitiveDict(node_auto.attrib)
|
||||
values['autotransporte'] = values_auto
|
||||
|
||||
path = '//cartaporte20:IdentificacionVehicular'
|
||||
node_tmp = node_auto.xpath(path, namespaces=self.NS)[0]
|
||||
values_auto = CaseInsensitiveDict(node_tmp.attrib)
|
||||
values['autotransporte'].update(values_auto)
|
||||
|
||||
path = '//cartaporte20:Seguros'
|
||||
node_tmp = node_auto.xpath(path, namespaces=self.NS)[0]
|
||||
values_auto = CaseInsensitiveDict(node_tmp.attrib)
|
||||
values['autotransporte'].update(values_auto)
|
||||
|
||||
path = '//cartaporte20:Remolques'
|
||||
try:
|
||||
node_tmp = node_auto.xpath(path, namespaces=self.NS)[0][0]
|
||||
values_auto = CaseInsensitiveDict(node_tmp.attrib)
|
||||
values['autotransporte'].update(values_auto)
|
||||
except IndexError:
|
||||
pass
|
||||
elif 'Ubicaciones' in node.tag:
|
||||
ubicaciones = []
|
||||
for n in node:
|
||||
ubicacion = CaseInsensitiveDict(n.attrib)
|
||||
ubicacion['domicilio'] = self._set_carta_porte_domicilio(
|
||||
CaseInsensitiveDict(n[0].attrib))
|
||||
ubicaciones.append(ubicacion)
|
||||
|
||||
values['ubicaciones'] = ubicaciones
|
||||
|
||||
self._values['carta_porte'] = values
|
||||
|
||||
self._complemento_carta_porte(complemento)
|
||||
self._complemento_comercio_exterior(complemento)
|
||||
|
||||
return
|
||||
|
||||
def _complemento_carta_porte(self, complemento):
|
||||
path = '//cartaporte30:CartaPorte'
|
||||
carta_porte = complemento.xpath(path, namespaces=self.NS)
|
||||
if carta_porte:
|
||||
self._get_carta_porte_3(carta_porte)
|
||||
return
|
||||
|
||||
def _get_carta_porte_3(self, carta_porte):
|
||||
URL = 'https://verificacfdi.facturaelectronica.sat.gob.mx/verificaccp/default.aspx'
|
||||
PRE = '//cartaporte30'
|
||||
values = CaseInsensitiveDict(carta_porte[0].attrib)
|
||||
idccp = values['idccp']
|
||||
for node in carta_porte[0]:
|
||||
if 'FiguraTransporte' in node.tag:
|
||||
figuras = CaseInsensitiveDict(node[0].attrib)
|
||||
figuras['TipoFigura'] = self.tipo_figura[figuras['TipoFigura']]
|
||||
values['figuras'] = figuras
|
||||
elif 'Mercancias' in node.tag:
|
||||
mercancias = CaseInsensitiveDict(node.attrib)
|
||||
detalle = [CaseInsensitiveDict(n.attrib)
|
||||
for n in node if 'Mercancia' in n.tag]
|
||||
values['mercancias'] = {
|
||||
'mercancias': mercancias,
|
||||
'detalle': detalle,
|
||||
}
|
||||
|
||||
path = f'{PRE}:Autotransporte'
|
||||
node_auto = node.xpath(path, namespaces=self.NS)[0]
|
||||
values_auto = CaseInsensitiveDict(node_auto.attrib)
|
||||
values['autotransporte'] = values_auto
|
||||
|
||||
path = f'{PRE}:IdentificacionVehicular'
|
||||
node_tmp = node_auto.xpath(path, namespaces=self.NS)[0]
|
||||
values_auto = CaseInsensitiveDict(node_tmp.attrib)
|
||||
values['autotransporte'].update(values_auto)
|
||||
|
||||
path = f'{PRE}:Seguros'
|
||||
node_tmp = node_auto.xpath(path, namespaces=self.NS)[0]
|
||||
values_auto = CaseInsensitiveDict(node_tmp.attrib)
|
||||
values['autotransporte'].update(values_auto)
|
||||
|
||||
path = f'{PRE}:Remolques'
|
||||
try:
|
||||
node_tmp = node_auto.xpath(path, namespaces=self.NS)[0][0]
|
||||
values_auto = CaseInsensitiveDict(node_tmp.attrib)
|
||||
values['autotransporte'].update(values_auto)
|
||||
except IndexError:
|
||||
pass
|
||||
elif 'Ubicaciones' in node.tag:
|
||||
ubicaciones = []
|
||||
for n in node:
|
||||
ubicacion = CaseInsensitiveDict(n.attrib)
|
||||
if ubicacion['TipoUbicacion'] == 'Origen':
|
||||
fecha_origen = ubicacion['FechaHoraSalidaLlegada']
|
||||
ubicacion['domicilio'] = self._set_carta_porte_domicilio(
|
||||
CaseInsensitiveDict(n[0].attrib))
|
||||
ubicaciones.append(ubicacion)
|
||||
values['FechaOrigen'] = fecha_origen
|
||||
values['ubicaciones'] = ubicaciones
|
||||
qr_data = f'{URL}?IdCCP={idccp}&FechaOrig={fecha_origen}&FechaTimb={self._fecha_timbrado}'
|
||||
values['qr'] = get_qr(qr_data, 'png')
|
||||
self._values['carta_porte'] = values
|
||||
return
|
||||
|
||||
def _complemento_comercio_exterior(self, complemento):
|
||||
path = '//cce20:ComercioExterior'
|
||||
comercio_exterior = complemento.xpath(path, namespaces=self.NS)
|
||||
|
||||
if comercio_exterior:
|
||||
values = CaseInsensitiveDict(comercio_exterior[0].attrib)
|
||||
|
||||
for node in comercio_exterior[0]:
|
||||
if 'Emisor' in node.tag:
|
||||
values['emisor'] = CaseInsensitiveDict(node.attrib)
|
||||
values['emisor'].update(CaseInsensitiveDict(node[0].attrib))
|
||||
elif 'Receptor' in node.tag:
|
||||
values['receptor'] = CaseInsensitiveDict(node.attrib)
|
||||
values['receptor'].update(CaseInsensitiveDict(node[0].attrib))
|
||||
elif 'Mercancias' in node.tag:
|
||||
mercancias = [
|
||||
CaseInsensitiveDict(m.attrib) for m in node]
|
||||
values['mercancias'] = mercancias
|
||||
self._values['comercio_exterior'] = values
|
||||
return
|
||||
|
||||
|
||||
|
@ -491,29 +829,6 @@ def _backup_db(rfc, is_mv, url_seafile):
|
|||
shutil.copy(path, path_target)
|
||||
else:
|
||||
log.error('\tNo existe la carpeta compartida...')
|
||||
|
||||
# ~ sql = 'select correo_timbrado, token_soporte from emisor;'
|
||||
# ~ args = 'psql -U postgres -d {} -Atc "{}"'.format(data['name'], sql)
|
||||
# ~ result = _call(args)
|
||||
# ~ if not result:
|
||||
# ~ log.error('\tSin datos para backup remoto')
|
||||
# ~ return
|
||||
|
||||
# ~ data = result.strip().split('|')
|
||||
# ~ if not data[1]:
|
||||
# ~ log.error('\tSin token de soporte')
|
||||
# ~ return
|
||||
|
||||
# ~ email = data[0]
|
||||
# ~ uuid = data[1]
|
||||
# ~ email = 'hola@elmau.net'
|
||||
# ~ uuid = 'cc42c591-cf66-499a-ae70-c09df5646be9'
|
||||
|
||||
# ~ log.debug(url_seafile, email, _get_pass(rfc))
|
||||
# ~ client = seafileapi.connect(url_seafile, email, _get_pass(rfc))
|
||||
# ~ repo = client.repos.get_repo(uuid)
|
||||
# ~ print(repo)
|
||||
|
||||
return
|
||||
|
||||
|
||||
|
@ -560,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):
|
||||
|
@ -583,26 +899,24 @@ def get_pass():
|
|||
return True, password
|
||||
|
||||
|
||||
def xml_stamp(xml, auth, name):
|
||||
def xml_stamp(xml, auth):
|
||||
if not DEBUG and not auth:
|
||||
msg = 'Sin datos para timbrar'
|
||||
result = {'ok': False, 'error': msg}
|
||||
return result
|
||||
|
||||
result = {'ok': True, 'error': ''}
|
||||
auth = {'user': auth['USER'], 'pass': auth['PASS']}
|
||||
|
||||
pac = PACS[name]()
|
||||
xml_stamped = pac.stamp(xml, auth)
|
||||
pac = PACS[auth['pac']]()
|
||||
response = pac.stamp(xml, auth)
|
||||
|
||||
if not xml_stamped:
|
||||
if not response:
|
||||
result['ok'] = False
|
||||
result['error'] = pac.error
|
||||
return result
|
||||
|
||||
result['xml'] = xml_stamped
|
||||
result['uuid'] = pac.cfdi_uuid
|
||||
result['fecha'] = pac.date_stamped
|
||||
result.update(response)
|
||||
|
||||
return result
|
||||
|
||||
|
||||
|
@ -630,14 +944,282 @@ def xml_cancel(xml, auth, cert, name):
|
|||
return data, result
|
||||
|
||||
|
||||
def get_client_balance(auth, name):
|
||||
if DEBUG:
|
||||
return '-d'
|
||||
def get_client_balance(auth, rfc=''):
|
||||
if not auth:
|
||||
return 'p/c'
|
||||
|
||||
pac = PACS[name]()
|
||||
auth = {'usr': auth['USER'], 'pwd': auth['PASS']}
|
||||
balance = pac.client_balance(auth)
|
||||
pac = PACS[auth['pac']]()
|
||||
balance = pac.client_balance(auth, rfc)
|
||||
if pac.error:
|
||||
balance = '-e'
|
||||
|
||||
balance = 'p/e'
|
||||
return balance
|
||||
|
||||
|
||||
def get_cert(args):
|
||||
cer = base64.b64decode(args['cer'].split(',')[1])
|
||||
key = base64.b64decode(args['key'].split(',')[1])
|
||||
cert = SATCertificate(cer, key, args['contra'])
|
||||
return cert
|
||||
|
||||
|
||||
def make_xml(data, certificado):
|
||||
cert = SATCertificate(certificado.cer, certificado.key_enc.encode())
|
||||
|
||||
cfdi = CFDI()
|
||||
xml = ET.parse(BytesIO(cfdi.get_xml(data).encode()))
|
||||
|
||||
path_xslt = _join(PATHS['xslt'], 'cadena.xslt')
|
||||
xslt = open(path_xslt, 'rb')
|
||||
transfor = ET.XSLT(ET.parse(xslt))
|
||||
cadena = str(transfor(xml)).encode()
|
||||
stamp = cert.sign(cadena)
|
||||
xslt.close()
|
||||
|
||||
return cfdi.add_sello(stamp, cert.cer_txt)
|
||||
|
||||
|
||||
def get_pac_by_rfc(cfdi):
|
||||
tree = ET.fromstring(cfdi.encode())
|
||||
version = tree.attrib['Version']
|
||||
namespaces = {'cfdi': PRE[version][1:-1], 'tdf': PRE['TIMBRE'][1:-1]}
|
||||
path = 'string(//cfdi:Complemento/tdf:TimbreFiscalDigital/@RfcProvCertif)'
|
||||
rfc_pac = tree.xpath(path, namespaces=namespaces)
|
||||
return RFCS[rfc_pac]
|
||||
|
||||
|
||||
def _cancel_with_cert(invoice, args, auth, certificado):
|
||||
cert = SATCertificate(certificado.cer, certificado.key_enc.encode())
|
||||
pac = PACS[auth['pac']]()
|
||||
contra = ''
|
||||
try:
|
||||
contra = decrypt(bytes(certificado.p12).decode(), certificado.serie)
|
||||
except Exception as e:
|
||||
log.error(e)
|
||||
if auth['pac'] == 'comercio':
|
||||
msg = 'Es necesario subir de nuevo los certificados de sello'
|
||||
data = {'ok': False, 'msg': msg, 'row': {}}
|
||||
return data
|
||||
|
||||
info = {'cer': cert.cer_pem, 'key': cert.key_pem, 'cer_ori': cert.cer,
|
||||
'key_enc': certificado.key, 'pass': contra, 'args': args}
|
||||
|
||||
result = pac.cancel(invoice.xml, info, auth)
|
||||
if pac.error:
|
||||
data = {'ok': False, 'msg': pac.error, 'row': {}}
|
||||
return data
|
||||
|
||||
msg = 'Factura cancelada correctamente'
|
||||
data = {'ok': True, 'msg': msg, 'row': {'estatus': 'Cancelada'},
|
||||
'date': result['date'], 'acuse': result['acuse']}
|
||||
return data
|
||||
|
||||
|
||||
def cancel_xml_sign(invoice, args, auth, certificado):
|
||||
# ~ if auth['pac'] == 'finkok':
|
||||
return _cancel_with_cert(invoice, args, auth, certificado)
|
||||
|
||||
cert = SATCertificate(certificado.cer, certificado.key_enc.encode())
|
||||
pac = PACS[auth['pac']]()
|
||||
folio_new = ''
|
||||
if args['uuid']:
|
||||
folio_new = f' FolioSustitucion="{args["uuid"]}"'
|
||||
data = {
|
||||
'rfc': certificado.rfc,
|
||||
'fecha': now().isoformat()[:19],
|
||||
'uuid': str(invoice.uuid).upper(),
|
||||
'motivo': args['reason'],
|
||||
'folio': folio_new,
|
||||
}
|
||||
|
||||
template = TEMPLATE_CANCEL.format(**data)
|
||||
tree = ET.fromstring(template.encode())
|
||||
sign_xml = cert.sign_xml(tree)
|
||||
# ~ print(sign_xml)
|
||||
result = pac.cancel_xml(sign_xml, auth, invoice.xml)
|
||||
|
||||
if pac.error:
|
||||
data = {'ok': False, 'msg': pac.error, 'row': {}}
|
||||
return data
|
||||
|
||||
msg = 'Factura cancelada correctamente'
|
||||
data = {'ok': True, 'msg': msg, 'row': {'estatus': 'Cancelada'},
|
||||
'date': result['date'], 'acuse': result['acuse']}
|
||||
return data
|
||||
|
||||
|
||||
def _get_data_sat(xml):
|
||||
BF = 'string(//*[local-name()="{}"]/@{})'
|
||||
# ~ NS_CFDI = {'cfdi': 'http://www.sat.gob.mx/cfd/3'}
|
||||
|
||||
try:
|
||||
tree = ET.fromstring(xml.encode())
|
||||
version = tree.attrib['Version']
|
||||
namespaces = {'cfdi': PRE[version][1:-1]}
|
||||
|
||||
emisor = escape(
|
||||
tree.xpath('string(//cfdi:Emisor/@rfc)', namespaces=namespaces) or
|
||||
tree.xpath('string(//cfdi:Emisor/@Rfc)', namespaces=namespaces)
|
||||
)
|
||||
receptor = escape(
|
||||
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'))
|
||||
except Exception as e:
|
||||
return ''
|
||||
|
||||
data = f'?re={emisor}&rr={receptor}&tt={total}&id={uuid}'
|
||||
return data
|
||||
|
||||
|
||||
def get_status_sat(xml):
|
||||
data = _get_data_sat(xml)
|
||||
if not data:
|
||||
return 'XML inválido'
|
||||
|
||||
data = """<?xml version="1.0" encoding="UTF-8"?>
|
||||
<soap:Envelope
|
||||
xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
|
||||
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
|
||||
<soap:Header/>
|
||||
<soap:Body>
|
||||
<Consulta xmlns="http://tempuri.org/">
|
||||
<expresionImpresa>
|
||||
{}
|
||||
</expresionImpresa>
|
||||
</Consulta>
|
||||
</soap:Body>
|
||||
</soap:Envelope>""".format(data)
|
||||
headers = {
|
||||
'SOAPAction': '"http://tempuri.org/IConsultaCFDIService/Consulta"',
|
||||
'Content-type': 'text/xml; charset="UTF-8"'
|
||||
}
|
||||
URL = 'https://consultaqr.facturaelectronica.sat.gob.mx/consultacfdiservice.svc'
|
||||
|
||||
try:
|
||||
result = requests.post(URL, data=data, headers=headers)
|
||||
tree = ET.fromstring(result.text)
|
||||
node = tree.xpath("//*[local-name() = 'Estado']")[0]
|
||||
except Exception as e:
|
||||
return 'Error: {}'.format(str(e))
|
||||
|
||||
return node.text
|
||||
|
||||
|
||||
def spaces(value):
|
||||
return '\n'.join([' '.join(l.split()) for l in value.split('\n')])
|
||||
|
||||
|
||||
def to_slug(string):
|
||||
value = (unicodedata.normalize('NFKD', string)
|
||||
.encode('ascii', 'ignore')
|
||||
.decode('ascii').lower())
|
||||
return value.replace(' ', '_')
|
||||
|
||||
|
||||
def read_csv(path, args={'delimiter': '|'}):
|
||||
with open(path) as f:
|
||||
reader = csv.DictReader(f, **args)
|
||||
rows = [r for r in reader]
|
||||
return rows
|
||||
|
||||
|
||||
def _products_from_xml(rfc, data):
|
||||
result = {'status': 'server', 'error': ''}
|
||||
cfdi = CfdiRead(data)
|
||||
|
||||
if not DEBUG and rfc != cfdi.rfc_receptor:
|
||||
msg = f'El receptor no es: {rfc}'
|
||||
result['error'] = msg
|
||||
return result
|
||||
|
||||
result['data'] = cfdi.data
|
||||
# ~ result['data']['xml'] = cfdi.source
|
||||
del result['data']['cfdi']['Certificado']
|
||||
del result['data']['cfdi']['NoCertificado']
|
||||
del result['data']['cfdi']['Sello']
|
||||
del result['data']['timbre']['SelloCFD']
|
||||
del result['data']['timbre']['SelloSAT']
|
||||
|
||||
emisor = result['data']['emisor']
|
||||
emisor['rfc'] = emisor.pop('Rfc')
|
||||
emisor['nombre'] = emisor.pop('Nombre')
|
||||
result['data']['emisor'] = emisor
|
||||
|
||||
products = result['data']['conceptos']
|
||||
rows = []
|
||||
for p in products:
|
||||
row = {
|
||||
'key': p['NoIdentificacion'],
|
||||
'key_sat': p['ClaveProdServ'],
|
||||
'description': p['Descripcion'],
|
||||
'unit': p['Unidad'],
|
||||
'unit_value': p['ValorUnitario'],
|
||||
'import': p['Importe'],
|
||||
'cant': p['Cantidad'],
|
||||
}
|
||||
rows.append(row)
|
||||
result['data']['conceptos'] = rows
|
||||
|
||||
return result
|
||||
|
||||
|
||||
def save_file(path, data, modo='wb'):
|
||||
try:
|
||||
with open(path, modo) as f:
|
||||
f.write(data)
|
||||
return True
|
||||
except:
|
||||
return False
|
||||
|
||||
|
||||
def _save_template(rfc, name, file_obj):
|
||||
result = {'status': 'server', 'ok': False}
|
||||
|
||||
ext1 = name[-3:]
|
||||
ext2 = file_obj.filename.split('.')[-1].lower()
|
||||
if ext1 != ext2:
|
||||
msg = f'Extensión incorrecta del archivo: {ext2}'
|
||||
result['error'] = msg
|
||||
return result
|
||||
|
||||
rfc = rfc.lower()
|
||||
path = _join(PATHS['USER'], f'{rfc}{name}')
|
||||
|
||||
if save_file(path, file_obj.file.read()):
|
||||
result['ok'] = True
|
||||
|
||||
return result
|
||||
|
||||
|
||||
def upload_file(rfc, name, file_obj):
|
||||
if name == 'productsadd':
|
||||
return _products_from_xml(rfc, file_obj.file.read())
|
||||
|
||||
return _save_template(rfc, name, file_obj)
|
||||
|
||||
|
||||
def get_qr(data, kind='svg', in_base64=False):
|
||||
buffer = io.BytesIO()
|
||||
segno.make(data).save(buffer, kind=kind, scale=8, border=2)
|
||||
qr = buffer
|
||||
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
|
||||
|
|
|
@ -17,7 +17,16 @@ from controllers.main import (AppEmpresas,
|
|||
AppDocumentos, AppFiles, AppPreInvoices, AppCuentasBanco,
|
||||
AppMovimientosBanco, AppTickets, AppStudents, AppEmployees, AppNomina,
|
||||
AppInvoicePay, AppCfdiPay, AppSATBancos, AppSociosCuentasBanco,
|
||||
AppSATFormaPago, AppSATLeyendaFiscales
|
||||
AppSATFormaPago, AppSATLeyendaFiscales, AppCert, AppSucursales,
|
||||
AppPartnerProducts,
|
||||
AppInventoryEntries,
|
||||
AppTicketsDetails,
|
||||
AppUsers,
|
||||
AppWareHouse,
|
||||
AppWareHouseProduct,
|
||||
AppSATUnidadesPeso,
|
||||
AppSATRegimenes,
|
||||
AppSociosRegimenes,
|
||||
)
|
||||
|
||||
|
||||
|
@ -62,6 +71,17 @@ api.add_route('/satbancos', AppSATBancos(db))
|
|||
api.add_route('/satformapago', AppSATFormaPago(db))
|
||||
api.add_route('/socioscb', AppSociosCuentasBanco(db))
|
||||
api.add_route('/leyendasfiscales', AppSATLeyendaFiscales(db))
|
||||
api.add_route('/cert', AppCert(db))
|
||||
api.add_route('/sucursales', AppSucursales(db))
|
||||
api.add_route('/partnerproducts', AppPartnerProducts(db))
|
||||
api.add_route('/inventoryentries', AppInventoryEntries(db))
|
||||
api.add_route('/warehouse', AppWareHouse(db))
|
||||
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 = {
|
||||
|
|
|
@ -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'])
|
||||
|
||||
|
@ -120,12 +123,6 @@ class StorageEngine(object):
|
|||
def enviar_prefac(self, values):
|
||||
return main.PreFacturas.enviar(values['id'])
|
||||
|
||||
# ~ def _get_cancelinvoice(self, values):
|
||||
# ~ return main.Facturas.cancel(values['id'])
|
||||
|
||||
# ~ def _get_statussat(self, values):
|
||||
# ~ return main.Facturas.get_status_sat(values['id'])
|
||||
|
||||
def _get_verifysat(self, values):
|
||||
return main.Facturas.get_verify_sat(values['id'])
|
||||
|
||||
|
@ -167,6 +164,9 @@ class StorageEngine(object):
|
|||
def _get_unidades(self, values):
|
||||
return main.SATUnidades.get_activos()
|
||||
|
||||
def _get_unitbykey(self, values):
|
||||
return main.SATUnidades.get_activos_by_key()
|
||||
|
||||
def add_moneda(self, values):
|
||||
return main.SATMonedas.add(values)
|
||||
|
||||
|
@ -203,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'])
|
||||
|
||||
|
@ -230,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()
|
||||
|
||||
|
@ -242,6 +249,9 @@ class StorageEngine(object):
|
|||
def _get_satunidades(self, values):
|
||||
return main.get_sat_unidades(values['key'])
|
||||
|
||||
def _get_satunidadespeso(self, values):
|
||||
return main.get_sat_unidadespeso(values['key'])
|
||||
|
||||
def _get_satproductos(self, values):
|
||||
return main.get_sat_productos(values['key'])
|
||||
|
||||
|
@ -372,7 +382,7 @@ class StorageEngine(object):
|
|||
if opt == 'add':
|
||||
return main.Tickets.add(values, user)
|
||||
if opt == 'cancel':
|
||||
return main.Tickets.cancel(values)
|
||||
return main.Tickets.cancel(values, user)
|
||||
if opt == 'invoice':
|
||||
return main.Tickets.invoice(values, user)
|
||||
if opt == 'print':
|
||||
|
@ -471,6 +481,67 @@ class StorageEngine(object):
|
|||
def sat_leyendas_fiscales_delete(self, values):
|
||||
return main.SATLeyendasFiscales.remove(values)
|
||||
|
||||
# ~ v2
|
||||
def cert_get(self, filters):
|
||||
return main.Certificado.get_data(filters)
|
||||
|
||||
def cert_post(self, filters):
|
||||
return main.Certificado.post(filters)
|
||||
|
||||
def sucursales_get(self, filters):
|
||||
return main.Sucursales.get_data(filters)
|
||||
|
||||
def sucursales_post(self, filters):
|
||||
return main.Sucursales.post(filters)
|
||||
|
||||
def partner_products_get(self, filters):
|
||||
return main.PartnerProducts.get_data(filters)
|
||||
|
||||
def inventory_entries_get(self, filters):
|
||||
return main.InventoryEntries.get_data(filters)
|
||||
|
||||
def inventory_entries_post(self, filters, user):
|
||||
return main.InventoryEntries.post(filters, user)
|
||||
|
||||
def warehouse_get(self, filters):
|
||||
return main.Almacenes.get_data(filters)
|
||||
|
||||
def warehouse_post(self, values, user):
|
||||
return main.Almacenes.post(values, user)
|
||||
|
||||
def warehouseproduct_get(self, filters, user):
|
||||
return main.WareHouseProduct.get_data(filters, user)
|
||||
|
||||
def warehouseproduct_post(self, filters, user):
|
||||
return main.WareHouseProduct.post(filters, user)
|
||||
|
||||
def users_get(self, filters, user):
|
||||
return main.Usuarios.get_data(filters, user)
|
||||
|
||||
def users_post(self, args, user):
|
||||
return main.Usuarios.post(args, user)
|
||||
|
||||
def ticketsdetails_get(self, filters, user):
|
||||
return main.TicketsDetalle.get_data(filters, user)
|
||||
|
||||
def products_get(self, filters, user):
|
||||
return main.Productos.get_data(filters, user)
|
||||
|
||||
def nomina_get(self, filters, user):
|
||||
return main.CfdiNomina.get_data(filters, user)
|
||||
|
||||
def sat_unidades_peso_get(self, filters, user):
|
||||
return main.SATUnidadesPeso.get_data(filters, user)
|
||||
|
||||
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
|
@ -1,5 +0,0 @@
|
|||
from seafileapi.client import SeafileApiClient
|
||||
|
||||
def connect(server, username, password):
|
||||
client = SeafileApiClient(server, username, password)
|
||||
return client
|
|
@ -1,7 +0,0 @@
|
|||
|
||||
class SeafileAdmin(object):
|
||||
def lists_users(self, maxcount=100):
|
||||
pass
|
||||
|
||||
def list_user_repos(self, username):
|
||||
pass
|
|
@ -1,77 +0,0 @@
|
|||
import requests
|
||||
from seafileapi.utils import urljoin
|
||||
from seafileapi.exceptions import ClientHttpError
|
||||
from seafileapi.repos import Repos
|
||||
|
||||
class SeafileApiClient(object):
|
||||
"""Wraps seafile web api"""
|
||||
def __init__(self, server, username=None, password=None, token=None):
|
||||
"""Wraps various basic operations to interact with seahub http api.
|
||||
"""
|
||||
self.server = server
|
||||
self.username = username
|
||||
self.password = password
|
||||
self._token = token
|
||||
|
||||
self.repos = Repos(self)
|
||||
self.groups = Groups(self)
|
||||
|
||||
if token is None:
|
||||
self._get_token()
|
||||
|
||||
def _get_token(self):
|
||||
data = {
|
||||
'username': self.username,
|
||||
'password': self.password,
|
||||
}
|
||||
url = urljoin(self.server, '/api2/auth-token/')
|
||||
res = requests.post(url, data=data)
|
||||
if res.status_code != 200:
|
||||
raise ClientHttpError(res.status_code, res.content)
|
||||
token = res.json()['token']
|
||||
assert len(token) == 40, 'The length of seahub api auth token should be 40'
|
||||
self._token = token
|
||||
|
||||
def __str__(self):
|
||||
return 'SeafileApiClient[server=%s, user=%s]' % (self.server, self.username)
|
||||
|
||||
__repr__ = __str__
|
||||
|
||||
def get(self, *args, **kwargs):
|
||||
return self._send_request('GET', *args, **kwargs)
|
||||
|
||||
def post(self, *args, **kwargs):
|
||||
return self._send_request('POST', *args, **kwargs)
|
||||
|
||||
def put(self, *args, **kwargs):
|
||||
return self._send_request('PUT', *args, **kwargs)
|
||||
|
||||
def delete(self, *args, **kwargs):
|
||||
return self._send_request('delete', *args, **kwargs)
|
||||
|
||||
def _send_request(self, method, url, *args, **kwargs):
|
||||
if not url.startswith('http'):
|
||||
url = urljoin(self.server, url)
|
||||
|
||||
headers = kwargs.get('headers', {})
|
||||
headers.setdefault('Authorization', 'Token ' + self._token)
|
||||
kwargs['headers'] = headers
|
||||
|
||||
expected = kwargs.pop('expected', 200)
|
||||
if not hasattr(expected, '__iter__'):
|
||||
expected = (expected, )
|
||||
resp = requests.request(method, url, *args, **kwargs)
|
||||
if resp.status_code not in expected:
|
||||
msg = 'Expected %s, but get %s' % \
|
||||
(' or '.join(map(str, expected)), resp.status_code)
|
||||
raise ClientHttpError(resp.status_code, msg)
|
||||
|
||||
return resp
|
||||
|
||||
|
||||
class Groups(object):
|
||||
def __init__(self, client):
|
||||
pass
|
||||
|
||||
def create_group(self, name):
|
||||
pass
|
|
@ -1,25 +0,0 @@
|
|||
|
||||
class ClientHttpError(Exception):
|
||||
"""This exception is raised if the returned http response is not as
|
||||
expected"""
|
||||
def __init__(self, code, message):
|
||||
super(ClientHttpError, self).__init__()
|
||||
self.code = code
|
||||
self.message = message
|
||||
|
||||
def __str__(self):
|
||||
return 'ClientHttpError[%s: %s]' % (self.code, self.message)
|
||||
|
||||
class OperationError(Exception):
|
||||
"""Expcetion to raise when an opeartion is failed"""
|
||||
pass
|
||||
|
||||
|
||||
class DoesNotExist(Exception):
|
||||
"""Raised when not matching resource can be found."""
|
||||
def __init__(self, msg):
|
||||
super(DoesNotExist, self).__init__()
|
||||
self.msg = msg
|
||||
|
||||
def __str__(self):
|
||||
return 'DoesNotExist: %s' % self.msg
|
|
@ -1,250 +0,0 @@
|
|||
import io
|
||||
import os
|
||||
import posixpath
|
||||
import re
|
||||
from seafileapi.utils import querystr
|
||||
|
||||
ZERO_OBJ_ID = '0000000000000000000000000000000000000000'
|
||||
|
||||
class _SeafDirentBase(object):
|
||||
"""Base class for :class:`SeafFile` and :class:`SeafDir`.
|
||||
|
||||
It provides implementation of their common operations.
|
||||
"""
|
||||
isdir = None
|
||||
|
||||
def __init__(self, repo, path, object_id, size=0):
|
||||
"""
|
||||
:param:`path` the full path of this entry within its repo, like
|
||||
"/documents/example.md"
|
||||
|
||||
:param:`size` The size of a file. It should be zero for a dir.
|
||||
"""
|
||||
self.client = repo.client
|
||||
self.repo = repo
|
||||
self.path = path
|
||||
self.id = object_id
|
||||
self.size = size
|
||||
|
||||
@property
|
||||
def name(self):
|
||||
return posixpath.basename(self.path)
|
||||
|
||||
def list_revisions(self):
|
||||
pass
|
||||
|
||||
def delete(self):
|
||||
suffix = 'dir' if self.isdir else 'file'
|
||||
url = '/api2/repos/%s/%s/' % (self.repo.id, suffix) + querystr(p=self.path)
|
||||
resp = self.client.delete(url)
|
||||
return resp
|
||||
|
||||
def rename(self, newname):
|
||||
"""Change file/folder name to newname
|
||||
"""
|
||||
suffix = 'dir' if self.isdir else 'file'
|
||||
url = '/api2/repos/%s/%s/' % (self.repo.id, suffix) + querystr(p=self.path, reloaddir='true')
|
||||
postdata = {'operation': 'rename', 'newname': newname}
|
||||
resp = self.client.post(url, data=postdata)
|
||||
succeeded = resp.status_code == 200
|
||||
if succeeded:
|
||||
if self.isdir:
|
||||
new_dirent = self.repo.get_dir(os.path.join(os.path.dirname(self.path), newname))
|
||||
else:
|
||||
new_dirent = self.repo.get_file(os.path.join(os.path.dirname(self.path), newname))
|
||||
for key in list(self.__dict__.keys()):
|
||||
self.__dict__[key] = new_dirent.__dict__[key]
|
||||
return succeeded
|
||||
|
||||
def _copy_move_task(self, operation, dirent_type, dst_dir, dst_repo_id=None):
|
||||
url = '/api/v2.1/copy-move-task/'
|
||||
src_repo_id = self.repo.id
|
||||
src_parent_dir = os.path.dirname(self.path)
|
||||
src_dirent_name = os.path.basename(self.path)
|
||||
dst_repo_id = dst_repo_id
|
||||
dst_parent_dir = dst_dir
|
||||
operation = operation
|
||||
dirent_type = dirent_type
|
||||
postdata = {'src_repo_id': src_repo_id, 'src_parent_dir': src_parent_dir,
|
||||
'src_dirent_name': src_dirent_name, 'dst_repo_id': dst_repo_id,
|
||||
'dst_parent_dir': dst_parent_dir, 'operation': operation,
|
||||
'dirent_type': dirent_type}
|
||||
return self.client.post(url, data=postdata)
|
||||
|
||||
def copyTo(self, dst_dir, dst_repo_id=None):
|
||||
"""Copy file/folder to other directory (also to a different repo)
|
||||
"""
|
||||
if dst_repo_id is None:
|
||||
dst_repo_id = self.repo.id
|
||||
|
||||
dirent_type = 'dir' if self.isdir else 'file'
|
||||
resp = self._copy_move_task('copy', dirent_type, dst_dir, dst_repo_id)
|
||||
return resp.status_code == 200
|
||||
|
||||
def moveTo(self, dst_dir, dst_repo_id=None):
|
||||
"""Move file/folder to other directory (also to a different repo)
|
||||
"""
|
||||
if dst_repo_id is None:
|
||||
dst_repo_id = self.repo.id
|
||||
|
||||
dirent_type = 'dir' if self.isdir else 'file'
|
||||
resp = self._copy_move_task('move', dirent_type, dst_dir, dst_repo_id)
|
||||
succeeded = resp.status_code == 200
|
||||
if succeeded:
|
||||
new_repo = self.client.repos.get_repo(dst_repo_id)
|
||||
dst_path = os.path.join(dst_dir, os.path.basename(self.path))
|
||||
if self.isdir:
|
||||
new_dirent = new_repo.get_dir(dst_path)
|
||||
else:
|
||||
new_dirent = new_repo.get_file(dst_path)
|
||||
for key in list(self.__dict__.keys()):
|
||||
self.__dict__[key] = new_dirent.__dict__[key]
|
||||
return succeeded
|
||||
|
||||
def get_share_link(self):
|
||||
pass
|
||||
|
||||
class SeafDir(_SeafDirentBase):
|
||||
isdir = True
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
super(SeafDir, self).__init__(*args, **kwargs)
|
||||
self.entries = None
|
||||
self.entries = kwargs.pop('entries', None)
|
||||
|
||||
def ls(self, force_refresh=False):
|
||||
"""List the entries in this dir.
|
||||
|
||||
Return a list of objects of class :class:`SeafFile` or :class:`SeafDir`.
|
||||
"""
|
||||
if self.entries is None or force_refresh:
|
||||
self.load_entries()
|
||||
|
||||
return self.entries
|
||||
|
||||
def share_to_user(self, email, permission):
|
||||
url = '/api2/repos/%s/dir/shared_items/' % self.repo.id + querystr(p=self.path)
|
||||
putdata = {
|
||||
'share_type': 'user',
|
||||
'username': email,
|
||||
'permission': permission
|
||||
}
|
||||
resp = self.client.put(url, data=putdata)
|
||||
return resp.status_code == 200
|
||||
|
||||
def create_empty_file(self, name):
|
||||
"""Create a new empty file in this dir.
|
||||
Return a :class:`SeafFile` object of the newly created file.
|
||||
"""
|
||||
# TODO: file name validation
|
||||
path = posixpath.join(self.path, name)
|
||||
url = '/api2/repos/%s/file/' % self.repo.id + querystr(p=path, reloaddir='true')
|
||||
postdata = {'operation': 'create'}
|
||||
resp = self.client.post(url, data=postdata)
|
||||
self.id = resp.headers['oid']
|
||||
self.load_entries(resp.json())
|
||||
return SeafFile(self.repo, path, ZERO_OBJ_ID, 0)
|
||||
|
||||
def mkdir(self, name):
|
||||
"""Create a new sub folder right under this dir.
|
||||
|
||||
Return a :class:`SeafDir` object of the newly created sub folder.
|
||||
"""
|
||||
path = posixpath.join(self.path, name)
|
||||
url = '/api2/repos/%s/dir/' % self.repo.id + querystr(p=path, reloaddir='true')
|
||||
postdata = {'operation': 'mkdir'}
|
||||
resp = self.client.post(url, data=postdata)
|
||||
self.id = resp.headers['oid']
|
||||
self.load_entries(resp.json())
|
||||
return SeafDir(self.repo, path, ZERO_OBJ_ID)
|
||||
|
||||
def upload(self, fileobj, filename):
|
||||
"""Upload a file to this folder.
|
||||
|
||||
:param:fileobj :class:`File` like object
|
||||
:param:filename The name of the file
|
||||
|
||||
Return a :class:`SeafFile` object of the newly uploaded file.
|
||||
"""
|
||||
if isinstance(fileobj, str):
|
||||
fileobj = io.BytesIO(fileobj)
|
||||
upload_url = self._get_upload_link()
|
||||
files = {
|
||||
'file': (filename, fileobj),
|
||||
'parent_dir': self.path,
|
||||
}
|
||||
self.client.post(upload_url, files=files)
|
||||
return self.repo.get_file(posixpath.join(self.path, filename))
|
||||
|
||||
def upload_local_file(self, filepath, name=None):
|
||||
"""Upload a file to this folder.
|
||||
|
||||
:param:filepath The path to the local file
|
||||
:param:name The name of this new file. If None, the name of the local file would be used.
|
||||
|
||||
Return a :class:`SeafFile` object of the newly uploaded file.
|
||||
"""
|
||||
name = name or os.path.basename(filepath)
|
||||
with open(filepath, 'r') as fp:
|
||||
return self.upload(fp, name)
|
||||
|
||||
def _get_upload_link(self):
|
||||
url = '/api2/repos/%s/upload-link/' % self.repo.id
|
||||
resp = self.client.get(url)
|
||||
return re.match(r'"(.*)"', resp.text).group(1)
|
||||
|
||||
def get_uploadable_sharelink(self):
|
||||
"""Generate a uploadable shared link to this dir.
|
||||
|
||||
Return the url of this link.
|
||||
"""
|
||||
pass
|
||||
|
||||
def load_entries(self, dirents_json=None):
|
||||
if dirents_json is None:
|
||||
url = '/api2/repos/%s/dir/' % self.repo.id + querystr(p=self.path)
|
||||
dirents_json = self.client.get(url).json()
|
||||
|
||||
self.entries = [self._load_dirent(entry_json) for entry_json in dirents_json]
|
||||
|
||||
def _load_dirent(self, dirent_json):
|
||||
path = posixpath.join(self.path, dirent_json['name'])
|
||||
if dirent_json['type'] == 'file':
|
||||
return SeafFile(self.repo, path, dirent_json['id'], dirent_json['size'])
|
||||
else:
|
||||
return SeafDir(self.repo, path, dirent_json['id'], 0)
|
||||
|
||||
@property
|
||||
def num_entries(self):
|
||||
if self.entries is None:
|
||||
self.load_entries()
|
||||
return len(self.entries) if self.entries is not None else 0
|
||||
|
||||
def __str__(self):
|
||||
return 'SeafDir[repo=%s,path=%s,entries=%s]' % \
|
||||
(self.repo.id[:6], self.path, self.num_entries)
|
||||
|
||||
__repr__ = __str__
|
||||
|
||||
class SeafFile(_SeafDirentBase):
|
||||
isdir = False
|
||||
|
||||
def update(self, fileobj):
|
||||
"""Update the content of this file"""
|
||||
pass
|
||||
|
||||
def __str__(self):
|
||||
return 'SeafFile[repo=%s,path=%s,size=%s]' % \
|
||||
(self.repo.id[:6], self.path, self.size)
|
||||
|
||||
def _get_download_link(self):
|
||||
url = '/api2/repos/%s/file/' % self.repo.id + querystr(p=self.path)
|
||||
resp = self.client.get(url)
|
||||
return re.match(r'"(.*)"', resp.text).group(1)
|
||||
|
||||
def get_content(self):
|
||||
"""Get the content of the file"""
|
||||
url = self._get_download_link()
|
||||
return self.client.get(url).content
|
||||
|
||||
__repr__ = __str__
|
|
@ -1,22 +0,0 @@
|
|||
|
||||
|
||||
class Group(object):
|
||||
def __init__(self, client, group_id, group_name):
|
||||
self.client = client
|
||||
self.group_id = group_id
|
||||
self.group_name = group_name
|
||||
|
||||
def list_memebers(self):
|
||||
pass
|
||||
|
||||
def delete(self):
|
||||
pass
|
||||
|
||||
def add_member(self, username):
|
||||
pass
|
||||
|
||||
def remove_member(self, username):
|
||||
pass
|
||||
|
||||
def list_group_repos(self):
|
||||
pass
|
|
@ -1,99 +0,0 @@
|
|||
from urllib.parse import urlencode
|
||||
from seafileapi.files import SeafDir, SeafFile
|
||||
from seafileapi.utils import raise_does_not_exist
|
||||
|
||||
class Repo(object):
|
||||
"""
|
||||
A seafile library
|
||||
"""
|
||||
def __init__(self, client, repo_id, repo_name,
|
||||
encrypted, owner, perm):
|
||||
self.client = client
|
||||
self.id = repo_id
|
||||
self.name = repo_name
|
||||
self.encrypted = encrypted
|
||||
self.owner = owner
|
||||
self.perm = perm
|
||||
|
||||
@classmethod
|
||||
def from_json(cls, client, repo_json):
|
||||
|
||||
repo_id = repo_json['id']
|
||||
repo_name = repo_json['name']
|
||||
encrypted = repo_json['encrypted']
|
||||
perm = repo_json['permission']
|
||||
owner = repo_json['owner']
|
||||
|
||||
return cls(client, repo_id, repo_name, encrypted, owner, perm)
|
||||
|
||||
def is_readonly(self):
|
||||
return 'w' not in self.perm
|
||||
|
||||
@raise_does_not_exist('The requested file does not exist')
|
||||
def get_file(self, path):
|
||||
"""Get the file object located in `path` in this repo.
|
||||
|
||||
Return a :class:`SeafFile` object
|
||||
"""
|
||||
assert path.startswith('/')
|
||||
url = '/api2/repos/%s/file/detail/' % self.id
|
||||
query = '?' + urlencode(dict(p=path))
|
||||
file_json = self.client.get(url + query).json()
|
||||
|
||||
return SeafFile(self, path, file_json['id'], file_json['size'])
|
||||
|
||||
@raise_does_not_exist('The requested dir does not exist')
|
||||
def get_dir(self, path):
|
||||
"""Get the dir object located in `path` in this repo.
|
||||
|
||||
Return a :class:`SeafDir` object
|
||||
"""
|
||||
assert path.startswith('/')
|
||||
url = '/api2/repos/%s/dir/' % self.id
|
||||
query = '?' + urlencode(dict(p=path))
|
||||
resp = self.client.get(url + query)
|
||||
dir_id = resp.headers['oid']
|
||||
dir_json = resp.json()
|
||||
dir = SeafDir(self, path, dir_id)
|
||||
dir.load_entries(dir_json)
|
||||
return dir
|
||||
|
||||
def delete(self):
|
||||
"""Remove this repo. Only the repo owner can do this"""
|
||||
self.client.delete('/api2/repos/' + self.id)
|
||||
|
||||
def list_history(self):
|
||||
"""List the history of this repo
|
||||
|
||||
Returns a list of :class:`RepoRevision` object.
|
||||
"""
|
||||
pass
|
||||
|
||||
## Operations only the repo owner can do:
|
||||
|
||||
def update(self, name=None):
|
||||
"""Update the name of this repo. Only the repo owner can do
|
||||
this.
|
||||
"""
|
||||
pass
|
||||
|
||||
def get_settings(self):
|
||||
"""Get the settings of this repo. Returns a dict containing the following
|
||||
keys:
|
||||
|
||||
`history_limit`: How many days of repo history to keep.
|
||||
"""
|
||||
pass
|
||||
|
||||
def restore(self, commit_id):
|
||||
pass
|
||||
|
||||
class RepoRevision(object):
|
||||
def __init__(self, client, repo, commit_id):
|
||||
self.client = client
|
||||
self.repo = repo
|
||||
self.commit_id = commit_id
|
||||
|
||||
def restore(self):
|
||||
"""Restore the repo to this revision"""
|
||||
self.repo.revert(self.commit_id)
|
|
@ -1,26 +0,0 @@
|
|||
from seafileapi.repo import Repo
|
||||
from seafileapi.utils import raise_does_not_exist
|
||||
|
||||
class Repos(object):
|
||||
def __init__(self, client):
|
||||
self.client = client
|
||||
|
||||
def create_repo(self, name, password=None):
|
||||
data = {'name': name}
|
||||
if password:
|
||||
data['passwd'] = password
|
||||
repo_json = self.client.post('/api2/repos/', data=data).json()
|
||||
return self.get_repo(repo_json['repo_id'])
|
||||
|
||||
@raise_does_not_exist('The requested library does not exist')
|
||||
def get_repo(self, repo_id):
|
||||
"""Get the repo which has the id `repo_id`.
|
||||
|
||||
Raises :exc:`DoesNotExist` if no such repo exists.
|
||||
"""
|
||||
repo_json = self.client.get('/api2/repos/' + repo_id).json()
|
||||
return Repo.from_json(self.client, repo_json)
|
||||
|
||||
def list_repos(self):
|
||||
repos_json = self.client.get('/api2/repos/').json()
|
||||
return [Repo.from_json(self.client, j) for j in repos_json]
|
|
@ -1,57 +0,0 @@
|
|||
import string
|
||||
import random
|
||||
from functools import wraps
|
||||
from urllib.parse import urlencode
|
||||
from seafileapi.exceptions import ClientHttpError, DoesNotExist
|
||||
|
||||
def randstring(length=0):
|
||||
if length == 0:
|
||||
length = random.randint(1, 30)
|
||||
return ''.join(random.choice(string.lowercase) for i in range(length))
|
||||
|
||||
def urljoin(base, *args):
|
||||
url = base
|
||||
if url[-1] != '/':
|
||||
url += '/'
|
||||
for arg in args:
|
||||
arg = arg.strip('/')
|
||||
url += arg + '/'
|
||||
if '?' in url:
|
||||
url = url[:-1]
|
||||
return url
|
||||
|
||||
def raise_does_not_exist(msg):
|
||||
"""Decorator to turn a function that get a http 404 response to a
|
||||
:exc:`DoesNotExist` exception."""
|
||||
def decorator(func):
|
||||
@wraps(func)
|
||||
def wrapped(*args, **kwargs):
|
||||
try:
|
||||
return func(*args, **kwargs)
|
||||
except ClientHttpError as e:
|
||||
if e.code == 404:
|
||||
raise DoesNotExist(msg)
|
||||
else:
|
||||
raise
|
||||
return wrapped
|
||||
return decorator
|
||||
|
||||
def to_utf8(obj):
|
||||
if isinstance(obj, str):
|
||||
return obj.encode('utf-8')
|
||||
return obj
|
||||
|
||||
def querystr(**kwargs):
|
||||
return '?' + urlencode(kwargs)
|
||||
|
||||
def utf8lize(obj):
|
||||
if isinstance(obj, dict):
|
||||
return {k: to_utf8(v) for k, v in obj.items()}
|
||||
|
||||
if isinstance(obj, list):
|
||||
return [to_utf8(x) for x in ob]
|
||||
|
||||
if instance(obj, str):
|
||||
return obj.encode('utf-8')
|
||||
|
||||
return obj
|
|
@ -1,7 +1,7 @@
|
|||
#!/usr/bin/env python3
|
||||
|
||||
# ~ Empresa Libre
|
||||
# ~ Copyright (C) 2016-2018 Mauricio Baeza Servin (web@correolibre.net)
|
||||
# ~ Copyright (C) 2016-2018 Mauricio Baeza Servin (publico@cuates.net)
|
||||
# ~
|
||||
# ~ This program is free software: you can redistribute it and/or modify
|
||||
# ~ it under the terms of the GNU General Public License as published by
|
||||
|
@ -28,17 +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 SEAFILE_SERVER
|
||||
except ImportError:
|
||||
SEAFILE_SERVER = {}
|
||||
|
||||
try:
|
||||
from conf import TITLE_APP
|
||||
except ImportError:
|
||||
TITLE_APP = 'Empresa Libre'
|
||||
TITLE_APP = 'Empresa Libre'
|
||||
|
||||
try:
|
||||
from conf import NO_HTTPS
|
||||
|
@ -47,7 +39,8 @@ except ImportError:
|
|||
|
||||
|
||||
DEBUG = DEBUG
|
||||
VERSION = '1.38.0'
|
||||
VERSION = '2.3.2'
|
||||
|
||||
EMAIL_SUPPORT = ('soporte@empresalibre.mx',)
|
||||
TITLE_APP = '{} v{}'.format(TITLE_APP, VERSION)
|
||||
|
||||
|
@ -78,8 +71,8 @@ PATH_SESSIONS = {
|
|||
|
||||
IV = 'valores_iniciales.json'
|
||||
INIT_VALUES = os.path.abspath(os.path.join(BASE_DIR, '..', 'db', IV))
|
||||
CT = 'cancel_template.xml'
|
||||
TEMPLATE_CANCEL = os.path.abspath(os.path.join(PATH_TEMPLATES, CT))
|
||||
# ~ CT = 'cancel_template.xml'
|
||||
# ~ TEMPLATE_CANCEL = os.path.abspath(os.path.join(PATH_TEMPLATES, CT))
|
||||
|
||||
PATH_XSLT = os.path.abspath(os.path.join(BASE_DIR, '..', 'xslt'))
|
||||
PATH_BIN = os.path.abspath(os.path.join(BASE_DIR, '..', 'bin'))
|
||||
|
@ -132,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}',
|
||||
|
@ -146,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
|
||||
|
@ -173,7 +187,8 @@ DEFAULT_CFDIPAY = {
|
|||
'TYPE': 'P',
|
||||
'WAYPAY': 'PPD',
|
||||
'CURRENCY': 'XXX',
|
||||
'USED': 'P01',
|
||||
'TC': '1',
|
||||
'USED': 'CP01',
|
||||
'KEYSAT': '84111506',
|
||||
'UNITKEY': 'ACT',
|
||||
'DESCRIPTION': 'Pago',
|
||||
|
@ -186,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',
|
||||
|
@ -197,6 +212,9 @@ API = 'https://api.empresalibre.net{}'
|
|||
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'))
|
||||
path_bk = os.path.join(path_docs, 'tmp')
|
||||
|
@ -212,6 +230,10 @@ EXT = {
|
|||
}
|
||||
MXN = 'MXN'
|
||||
|
||||
CARTA_PORTE = {
|
||||
'MONEDA': 'XXX',
|
||||
}
|
||||
|
||||
PATHS = {
|
||||
'STATIC': path_static,
|
||||
'CSS': path_css,
|
||||
|
@ -222,6 +244,7 @@ PATHS = {
|
|||
'BK': path_bk,
|
||||
'LOCAL': path_local,
|
||||
'SAT': path_sat,
|
||||
'xslt': PATH_XSLT,
|
||||
}
|
||||
|
||||
VALUES_PDF = {
|
||||
|
@ -234,13 +257,19 @@ VALUES_PDF = {
|
|||
},
|
||||
}
|
||||
|
||||
RESICO = '626'
|
||||
|
||||
RFCS = {
|
||||
'PUBLIC': 'XAXX010101000',
|
||||
'FOREIGN': 'XEXX010101000',
|
||||
'CVD110412TF6': 'finkok',
|
||||
'SCD110105654': 'comercio',
|
||||
'AAA010101AAA': 'comercio',
|
||||
'SPR190613I52': 'comercio',
|
||||
}
|
||||
|
||||
URL = {
|
||||
'SEAFILE': 'https://seafile.elmau.net',
|
||||
'SEAFILE': 'https://seafile.cuates.net',
|
||||
}
|
||||
|
||||
DEFAULT_GLOBAL = {
|
||||
|
@ -249,3 +278,42 @@ DEFAULT_GLOBAL = {
|
|||
'descripcion': 'Venta',
|
||||
'clave_sat': '01010101',
|
||||
}
|
||||
|
||||
# ~ TEMPLATE_CANCEL = """<CancelaCFD xmlns="http://cancelacfd.sat.gob.mx">
|
||||
# ~ <Cancelacion xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" RfcEmisor="{rfc}" Fecha="{fecha}">
|
||||
# ~ <Folios>
|
||||
# ~ <Folio UUID="{uuid}" Motivo="{motivo}"{folio}/>
|
||||
# ~ </Folios>
|
||||
# ~ <Signature xmlns="http://www.w3.org/2000/09/xmldsig#">
|
||||
# ~ <SignedInfo>
|
||||
# ~ <CanonicalizationMethod Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315" />
|
||||
# ~ <SignatureMethod Algorithm="http://www.w3.org/2000/09/xmldsig#rsa-sha1" />
|
||||
# ~ <Reference URI="">
|
||||
# ~ <Transforms>
|
||||
# ~ <Transform Algorithm="http://www.w3.org/2000/09/xmldsig#enveloped-signature" />
|
||||
# ~ </Transforms>
|
||||
# ~ <DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1" />
|
||||
# ~ <DigestValue/>
|
||||
# ~ </Reference>
|
||||
# ~ </SignedInfo>
|
||||
# ~ <SignatureValue/>
|
||||
# ~ <KeyInfo>
|
||||
# ~ <X509Data>
|
||||
# ~ <X509IssuerSerial>
|
||||
# ~ <X509IssuerName/>
|
||||
# ~ <X509SerialNumber/>
|
||||
# ~ </X509IssuerSerial>
|
||||
# ~ <X509Certificate/>
|
||||
# ~ </X509Data>
|
||||
# ~ <KeyValue>
|
||||
# ~ <RSAKeyValue>
|
||||
# ~ <Modulus/>
|
||||
# ~ <Exponent/>
|
||||
# ~ </RSAKeyValue>
|
||||
# ~ </KeyValue>
|
||||
# ~ </KeyInfo>
|
||||
# ~ </Signature>
|
||||
# ~ </Cancelacion>
|
||||
# ~ </CancelaCFD>"""
|
||||
|
||||
TEMPLATE_CANCEL = """<CancelaCFD xmlns="http://cancelacfd.sat.gob.mx"><Cancelacion xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" Fecha="{fecha}" RfcEmisor="{rfc}" xmlns="http://cancelacfd.sat.gob.mx"><Folios><Folio UUID="{uuid}" Motivo="{motivo}"{folio}/></Folios><Signature xmlns="http://www.w3.org/2000/09/xmldsig#"><SignedInfo><CanonicalizationMethod Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315" /><SignatureMethod Algorithm="http://www.w3.org/2000/09/xmldsig#rsa-sha1" /><Reference URI=""><Transforms><Transform Algorithm="http://www.w3.org/2000/09/xmldsig#enveloped-signature" /></Transforms><DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1" /><DigestValue/></Reference></SignedInfo><SignatureValue/><KeyInfo><X509Data><X509IssuerSerial><X509IssuerName/><X509SerialNumber/></X509IssuerSerial><X509Certificate/></X509Data><KeyValue><RSAKeyValue><Modulus/><Exponent/></RSAKeyValue></KeyValue></KeyInfo></Signature></Cancelacion></CancelaCFD>"""
|
||||
|
|
BIN
source/db/cp.db
BIN
source/db/cp.db
Binary file not shown.
BIN
source/db/sat.db
BIN
source/db/sat.db
Binary file not shown.
|
@ -0,0 +1,473 @@
|
|||
id key name
|
||||
1 Tu Contenedor externo
|
||||
2 X1A Tambor de acero
|
||||
3 X1B Tambor de aluminio
|
||||
4 X1D Tambor contrachapado
|
||||
5 X1F Contenedor flexible
|
||||
6 X1G Tambor de fibra
|
||||
7 X1w Tambor de madera
|
||||
8 X2C Barril de madera
|
||||
9 X3A Bidón de acero
|
||||
10 X3H Bidón de plástico
|
||||
11 X43 Bolsa de gran tamaño
|
||||
12 X44 Bolsa de plástico
|
||||
13 X4A Caja de acero
|
||||
14 X4B Caja de aluminio
|
||||
15 X4C Caja de madera natural
|
||||
16 X4D Caja de contrachapado
|
||||
17 X4F Caja de madera reconstituida
|
||||
18 X4G Caja de cartón
|
||||
19 X4H Caja de plástico
|
||||
20 X5H Bolsa de plástico tejido
|
||||
21 X5L Bolsa textil
|
||||
22 X5M Bolsa de papel
|
||||
23 X6H Recipiente de plástico, Contenedor compuesto.
|
||||
24 X6P Recipiente de vidrio, Contenedor compuesto.
|
||||
25 X7A Estuche para carro
|
||||
26 X7B Estuche de madera
|
||||
27 X8A Pallet de madera
|
||||
28 X8B Cajón de madera
|
||||
29 X8C Madera flejada
|
||||
30 XAA Contenedor intermedio para gráneles de plástico rígido
|
||||
31 XAB Contenedor de fibra
|
||||
32 XAC Contenedor de papel
|
||||
33 XAD Contenedor de madera
|
||||
34 XAE Aerosol
|
||||
35 XAF Pallet modular con collares, 80cms * 60cms
|
||||
36 XAG Pallet o empaquetado
|
||||
37 XAH Pallet, 100cms X 110cms
|
||||
38 XAI Contenedor tipo concha
|
||||
39 XAJ Cono
|
||||
40 XAL Esfera
|
||||
41 XAM Ampolleta no protegida
|
||||
42 XAP Ampolleta protegida
|
||||
43 XAT Atomizador
|
||||
44 XAV Cápsula
|
||||
45 XB4 Cinturón
|
||||
46 XBA Barril
|
||||
47 XBB Bobina
|
||||
48 XBC Cajón para botellas / Estante para botellas
|
||||
49 XBD Tablero
|
||||
50 XBE Flejado
|
||||
51 XBF Globo no protegido
|
||||
52 XBG Bolso
|
||||
53 XBH Manojo
|
||||
54 XBI Compartimiento
|
||||
55 XBJ Cubeta
|
||||
56 XBK Cesta
|
||||
57 XBL Paca comprimida
|
||||
58 XBM Cuenco
|
||||
59 XBN Paca no comprimida
|
||||
60 XBO Botella no-protegida y cilíndrica
|
||||
61 XBP Globo protegido
|
||||
62 XBQ Botella cilíndrica protegida
|
||||
63 XBR Barra
|
||||
64 XBS Botella, no-protegida en forma de bulbo
|
||||
65 XBT Rollo de tela
|
||||
66 XBU Butt
|
||||
67 XBV Botella de bulbo protegido
|
||||
68 XBW Caja para líquidos
|
||||
69 XBX Caja
|
||||
70 XBY Tablero, con fleje/ agrupados/ armados
|
||||
71 XBZ Barras, con fleje/ agrupados/ armados
|
||||
72 XCA Lata rectangular
|
||||
73 XCB Cajón para cerveza
|
||||
74 XCC Mantequera
|
||||
75 XCD Lata con mango y boquilla
|
||||
76 XCE Cesto tejido
|
||||
77 XCF Cofre
|
||||
78 XCG Contenedor tipo Jaula
|
||||
79 XCH Cajonera
|
||||
80 XCI Frasco
|
||||
81 XCJ Ataúd
|
||||
82 XCK Barrica
|
||||
83 XCL Espiral
|
||||
84 XCM Paquete de tarjetas
|
||||
85 XCN Contenedor, no especificado como equipo de transporte
|
||||
86 XCO Garrafón no protegido
|
||||
87 XCP Garrafón protegido
|
||||
88 XCQ Cartucho
|
||||
89 XCR Cajón
|
||||
90 XCS Estuche
|
||||
91 XCT Cartón
|
||||
92 XCU Vaso
|
||||
93 XCV Cubierta
|
||||
94 XCW Jaula estilo rodillo
|
||||
95 XCX Lata cilíndrica
|
||||
96 XCY Cilindro
|
||||
97 XCZ Lona
|
||||
98 XDA Cajón multicapa de plástico
|
||||
99 XDB Cajón de varias capas de madera
|
||||
100 XDC Cajón multicapa de cartón
|
||||
101 XDG Jaula, Según la clasificación de la compañía (Commonwealth Handling Equipment Pool (CHEP))
|
||||
102 XDH Caja, Según la clasificación de la compañía (CHEP), Eurobox
|
||||
103 XDI Tambor de hierro
|
||||
104 XDJ damajuana o garrafa, no protegido
|
||||
105 XDK Cajón a granel, cartón
|
||||
106 XDL Cajas de plástico
|
||||
107 XDM Cajones a granel de madera
|
||||
108 XDN Dispensador
|
||||
109 XDP damajuana o garrafa, protegido
|
||||
110 XDR Tambor
|
||||
111 XDS Bandeja de una capa sin cubierta y de plástico
|
||||
112 XDT Bandeja de una capa sin cubierta y de madera
|
||||
113 XDU Bandeja de una capa sin cubierta y poliestireno
|
||||
114 XDV Bandeja de una capa sin cubierta y de cartón
|
||||
115 XDW Bandeja de dos capas sin tapa y con bandeja de plástico
|
||||
116 XDX Bandeja de dos capas sin cubierta y de madera
|
||||
117 XDY Bandeja de dos capas sin cubierta y de cartón
|
||||
118 XEC Bolsa de plástico
|
||||
119 XED Estuche, con pallet de base
|
||||
120 XEE Estuche, con pallet base de madera
|
||||
121 XEF Estuche, con pallet base de cartón
|
||||
122 XEG Estuche, con pallet base de plástico
|
||||
123 XEH Estuche, con pallet base de metal
|
||||
124 XEI Estuche isotérmico
|
||||
125 XEN Sobre
|
||||
126 XFB Bolsa flexible
|
||||
127 XFC Cajón para fruta
|
||||
128 XFD Cajón enmarcado
|
||||
129 XFE Tanque flexible
|
||||
130 XFI Firkin
|
||||
131 XFL Matraz
|
||||
132 XFO Cajón para zapatos
|
||||
133 XFP Caja auxiliar para película fotográfica
|
||||
134 XFR Marco
|
||||
135 XFT Contenedor para alimentos
|
||||
136 XFW Carro de cama plana
|
||||
137 XFX Bolsa flexible tipo contenedor
|
||||
138 XGB Botella para gas
|
||||
139 XGI Viga
|
||||
140 XGL Contenedor tipo galón
|
||||
141 XGR Recipiente de vidrio
|
||||
142 XGU Bandeja contenedor para apilar horizontalmente objetos planos
|
||||
143 XGY Costal de Yute
|
||||
144 XGZ Vigas con correas o agrupadas
|
||||
145 XHA Cesta con mango y de plástico
|
||||
146 XHB Cesta con mango y de madera
|
||||
147 XHC Cesta con asa y de cartón
|
||||
148 XHG Hogshead
|
||||
149 XHN Gancho
|
||||
150 XHR Cesto
|
||||
151 XIA Paquete con pantalla y de madera
|
||||
152 XIB Paquete con pantalla y de cartón
|
||||
153 XIC Paquete con pantalla y de plástico
|
||||
154 XID Paquete con pantalla y de metal
|
||||
155 XIE Paquete de mostrador.
|
||||
156 XIF Envase para alimentos
|
||||
157 XIG Paquete envuelto en papel
|
||||
158 XIH Tambor de plástico
|
||||
159 XIK Paquete de cartón con los agujeros para botellas
|
||||
160 XIL Bandeja rígida con tapa y apilable (CEN TS 14482: 2002)
|
||||
161 XIN Lingote
|
||||
162 XIZ Lingotes con correas/ agrupados
|
||||
163 XJB Bolsa jumbo
|
||||
164 XJC Bidón rectangular
|
||||
165 XJG Jarra
|
||||
166 XJR Tarro
|
||||
167 XJT Bolsa de yute
|
||||
168 XJY Bidón, cilíndrico
|
||||
169 XKG Barrilete
|
||||
170 XKI Kit (Conjunto de piezas)
|
||||
171 XLE Valijas
|
||||
172 XLG Bitácora
|
||||
173 XLT Lote
|
||||
174 XLU Caja de arrastre
|
||||
175 XLV Contenedor pequeño
|
||||
176 XLZ Registros con fleje/ agrupados/ armados
|
||||
177 XMA Cajón metálico
|
||||
178 XMB Múltiplo de bolsas
|
||||
179 XMC Cajón para leche
|
||||
180 XME Contenedor de metal
|
||||
181 XMR Recipiente de metal
|
||||
182 XMS Saco milti-pared
|
||||
183 XMT Tapete
|
||||
184 XMW Contenedor envuelto en plástico
|
||||
185 XMX Caja pequeña de cerillos
|
||||
186 XNA No disponible
|
||||
187 XNE Sin empaque o no empaquetado
|
||||
188 XNF Sin empaque o no empaquetado, unidad simple
|
||||
189 XNG Sin empaque o no empaquetado, unidades múltiples
|
||||
190 XNS Caja nido
|
||||
191 XNT Red
|
||||
192 XNU Red de plástico con tubo
|
||||
193 XNV Red textil con tubo
|
||||
194 XOA Pallet, Según la clasificación de la compañía (Commonwealth Handling Equipment Pool (CHEP) 40 cm x 60 cm
|
||||
195 XOB Pallet, Según la clasificación de la compañía (Commonwealth Handling Equipment Pool (CHEP) 80 cm x 120 cm
|
||||
196 XOC Pallet, Según la clasificación de la compañía (Commonwealth Handling Equipment Pool (CHEP) 100 cm x 120 cm
|
||||
197 XOD Pallet, AS 4068-1993
|
||||
198 XOE Pallet, ISO T11
|
||||
199 XOF Plataforma, peso o dimensión no especificada
|
||||
200 XOK Bloque
|
||||
201 XOT Octabin
|
||||
202 XP2 Charola
|
||||
203 XPA Cajetilla
|
||||
204 XPB Pallet, Caja combinada y abierta con caja y pallet.
|
||||
205 XPC Paquete postal
|
||||
206 XPD Pallet modular con collares (80cms * 100cms)
|
||||
207 XPE Pallet modular con collares (80cms * 120cms)
|
||||
208 XPF Corral
|
||||
209 XPG Placa
|
||||
210 XPH Cantaro
|
||||
211 XPI Pleca
|
||||
212 XPJ Canastilla
|
||||
213 XPK Paquete
|
||||
214 XPL Balde
|
||||
215 XPN Tablón
|
||||
216 XPO Bolsa pequeña
|
||||
217 XPR Contenedor de plástico
|
||||
218 XPT Maceta
|
||||
219 XPU Cacerola
|
||||
220 XPV Tubos, con fleje/ agrupados/ armados
|
||||
221 XPX Pallet
|
||||
222 XPY Placas con fleje/ agrupados/ armados
|
||||
223 XPZ Tablones con fleje/ agrupados/ armados
|
||||
224 XQA Tambor de acero con cabeza no desmontable
|
||||
225 XQB Tambor de acero con cabeza extraíble
|
||||
226 XQC Tambor de aluminio con cabeza no extraíble
|
||||
227 XQD Tambor de aluminio con cabeza extraíble
|
||||
228 XQF Tambor, plástico con cabeza no desmontable
|
||||
229 XQG Tambor, plástico, cabeza extraíble
|
||||
230 XQH Barril de madera con tapón
|
||||
231 XQJ Barril de madera con cabeza desprendible
|
||||
232 XQK Bidón de acero con cabeza no desmontable
|
||||
233 XQL Bidón de acero con cabeza desmontable
|
||||
234 XQM Bidón de plástico con cabeza no desmontable
|
||||
235 XQN Bidón de plástico con cabeza extraíble
|
||||
236 XQP Caja de madera natural estándar
|
||||
237 XQQ Caja de madera natural con muros a prueba de filtraciones
|
||||
238 XQR Caja de plástico expandida
|
||||
239 XQS Caja de plástico sólida
|
||||
240 XRD Rod
|
||||
241 XRG Anillo
|
||||
242 XRJ Estante, Perchero para ropa
|
||||
243 XRK Estante
|
||||
244 XRL Carrete
|
||||
245 XRO Rollo
|
||||
246 XRT Red Roja
|
||||
247 XRZ Varillas con fleje/ agrupados/ armados
|
||||
248 XSA Saco
|
||||
249 XSB Losa
|
||||
250 XSC Cajón poco profundo
|
||||
251 XSD Huso
|
||||
252 XSE Baúl
|
||||
253 XSH Bolsa pequeña hermética
|
||||
254 XSI Patín
|
||||
255 XSK Carcasa esqueleto
|
||||
256 XSL Hoja de deslizamiento
|
||||
257 XSM Hoja de metal
|
||||
258 XSO Carrete pequeño
|
||||
259 XSP Hoja de empaque de plástico
|
||||
260 XSS Cajón de acero
|
||||
261 XSU Maleta
|
||||
262 XSV Sobre de acero
|
||||
263 XSW Envoltorio
|
||||
264 XSY Manga
|
||||
265 XSZ Hojas con fleje/ agrupados/ armados
|
||||
266 XT1 Tableta
|
||||
267 XTB Tina
|
||||
268 XTC Caja para té
|
||||
269 XTD Tubo plegable
|
||||
270 XTG Contenedor de tanque genérico
|
||||
271 XTI Tierce
|
||||
272 XTK Tanque rectangular
|
||||
273 XTL Tina con tapa
|
||||
274 XTN Hojalata
|
||||
275 XTO Tonel
|
||||
276 XTR Maletero
|
||||
277 XTS Estructura
|
||||
278 XTT Bolsa de mano
|
||||
279 XTU Tubo
|
||||
280 XTV Tubo con boquilla
|
||||
281 XTW Pallet tricapa
|
||||
282 XTY Tanque cilíndrico
|
||||
283 XTZ Tubos con fleje/ agrupados/ armados
|
||||
284 XUC Sin empaque
|
||||
285 XUN Unidad
|
||||
286 XVA Tanque
|
||||
287 XVG Tanque de gas (a 1,031 mbar y 15° C)
|
||||
288 XVI Frasco pequeño
|
||||
289 XVK Paquete transportable
|
||||
290 XVL Contenedor para líquidos a granel
|
||||
291 XVN Vehículo
|
||||
292 XVO "Contenedor para sólido de partículas grandes a granel (""nódulos"")"
|
||||
293 XVP Envasado al vacío
|
||||
294 XVQ Tanque para Gas licuado (a temperatura / presión anormal)
|
||||
295 XVR Contenedor para sólidos de partículas granulares a granel (Granos)
|
||||
296 XVS Contenedor de chatarra a granel
|
||||
297 XVY "Contenedor para sólido de partículas finas a granel (""polvos"")"
|
||||
298 XWA Contenedor de granel intermedio
|
||||
299 XWB Botella de mimbre
|
||||
300 XWC Contenedor intermedio para gráneles y de acero
|
||||
301 XWD Contenedor intermedio para gráneles y de aluminio
|
||||
302 XWF Contenedor intermedio para gráneles y de metal
|
||||
303 XWG Contenedor intermedio para gráneles y de acero presurizado menor a 10 kpa
|
||||
304 XWH Contenedor intermedio para gráneles y de aluminio, presurizado menor a 10 kpa
|
||||
305 XWJ Contenedor intermedio para gráneles y de metal con una presión de 10 kpa
|
||||
306 XWK Contenedor intermedio para gráneles y de acero para líquido
|
||||
307 XWL Contenedor intermedio para gráneles y de aluminio para líquido
|
||||
308 XWM Contenedor intermedio para gráneles y de metal para líquido
|
||||
309 XWN Contenedor intermedio para gráneles con tejido plástico sin capa con revestimiento
|
||||
310 XWP Contenedor intermedio para gráneles con tejido plástico y recubierto
|
||||
311 XWQ Contenedor intermedio para gráneles con tejido plástico con revestimiento
|
||||
312 XWR Contenedor intermedio para gráneles con tejido plástico, revestido y con forro
|
||||
313 XWS Contenedor intermedio para gráneles con película de plástico
|
||||
314 XWT Contenedor intermedio para gráneles textil sin capa / forro
|
||||
315 XWU Contenedor intermedio para gráneles de madera natural con forro interior
|
||||
316 XWV Contenedor intermedio para gráneles textil recubierto
|
||||
317 XWW Contenedor intermedio para gráneles textil con revestimiento
|
||||
318 XWX Contenedor intermedio para gráneles textil recubierto y con forro
|
||||
319 XWY Contenedor intermedio para gráneles contrachapado con revestimiento interior
|
||||
320 XWZ Contenedor intermedio para gráneles de madera reconstituida con revestimiento interior
|
||||
321 XXA Bolsa de tejido plástico, sin abrigo interior ni forro
|
||||
322 XXB Bolsa de tejido plástico a prueba de filtraciones
|
||||
323 XXC Bolsa de tejido plástico resistente al agua
|
||||
324 XXD Bolsa con película de plástico
|
||||
325 XXF Bolsa textil sin capa ni forro interior
|
||||
326 XXG Bolsa textil a prueba de filtraciones
|
||||
327 XXH Bolsa textil resistente al agua
|
||||
328 XXJ Bolsa de papel multi-pared
|
||||
329 XXK Bolsa de papel multi-pared, resistente al agua
|
||||
330 XYA Empaque compuesto, recipiente de plástico en tambor de acero
|
||||
331 XYB Empaque compuesto, recipiente de plástico en cajas de acero
|
||||
332 XYC Empaque compuesto, recipiente de plástico en tambor de aluminio
|
||||
333 XYD Empaque compuesto, recipiente de plástico en cajón de aluminio
|
||||
334 XYF Empaque compuesto, recipiente de plástico en caja de madera
|
||||
335 XYG Empaque compuesto, recipiente de plástico en tambor de madera contrachapada
|
||||
336 XYH Empaque compuesto, recipiente de plástico en caja de madera contrachapada
|
||||
337 XYJ Empaque compuesto, recipiente de plástico en tambor de fibra
|
||||
338 XYK Empaque compuesto, recipiente de plástico en caja de cartón
|
||||
339 XYL Empaque compuesto, recipiente de plástico en el tambor de plástico
|
||||
340 XYM Empaque compuesto, recipiente de plástico en caja de plástico sólido
|
||||
341 XYN Empaque compuesto, receptáculo de vidrio en tambor de acero
|
||||
342 XYP Empaque compuesto, receptáculo de vidrio en caja de cajas de acero
|
||||
343 XYQ Empaque compuesto, recipiente de vidrio en tambor de aluminio
|
||||
344 XYR Empaque compuesto, receptáculo de vidrio en caja de aluminio
|
||||
345 XYS Empaque compuesto, recipiente de vidrio en caja de madera
|
||||
346 XYT Empaque compuesto, recipiente de vidrio en tambor de madera contrachapada
|
||||
347 Xyv Empaque compuesto, recipiente de vidrio en el cesto de mimbre
|
||||
348 XYW Empaque compuesto, recipiente de vidrio en tambor de fibra
|
||||
349 XYX Empaque compuesto, recipiente de vidrio en caja de cartón
|
||||
350 XYY Empaque compuesto, recipiente de vidrio en paquete de plástico expandible
|
||||
351 XYZ Empaque compuesto, recipiente de vidrio en paquete de plástico sólido
|
||||
352 XZA Contenedor de granel intermedio, papel, multi-pared
|
||||
353 XZB Bolsa grande
|
||||
354 XZC Contenedor intermedio para gráneles de papel, multi-pared y resistente al agua
|
||||
355 XZD Contenedor intermedio para gráneles de plástico rígido, con equipo estructural para sólidos
|
||||
356 XZF Contenedor intermedio para gráneles de plástico rígido, autoportante para sólidos
|
||||
357 XZG Contenedor intermedio para gráneles de plástico rígido, con equipo estructural, presurizado
|
||||
358 XZH Contenedor intermedio para gráneles de plástico rígido, autoportante y presurizado
|
||||
359 XZJ Contenedor intermedio para gráneles de plástico rígido, con equipo estructural para líquidos
|
||||
360 XZK Contenedor intermedio para gráneles de plástico rígido, autoportante, líquidos
|
||||
361 XZL Contenedor intermedio para gráneles, compuesto y de plástico rígido, sólidos
|
||||
362 XZM Contenedor intermedio para gráneles, compuesto y de plástico flexible, sólidos
|
||||
363 XZN Contenedor intermedio para gráneles, compuesto y de plástico rígido, presurizado
|
||||
364 XZP Contenedor intermedio para gráneles, compuesto y de plástico flexible, presurizado
|
||||
365 XZQ Contenedor intermedio para gráneles, compuesto y de plástico rígido, líquidos
|
||||
366 XZR Contenedor intermedio para gráneles, compuesto y de plástico flexible para líquidos
|
||||
367 XZS Contenedor intermedio para gráneles, compuesto
|
||||
368 XZT Contenedor intermedio para gráneles con tablero de fibras
|
||||
369 XZU Contenedor intermedio para gráneles flexible
|
||||
370 XZV Contenedor intermedio para gráneles de metal, distinto del acero
|
||||
371 XZW Contenedor intermedio para gráneles, de madera natural
|
||||
372 XZX Contenedor intermedio para gráneles, de contrachapado
|
||||
373 XZY Contenedor intermedio para gráneles, de madera reconstituida
|
||||
374 KGM Kilogramo
|
||||
375 MC Microgramo
|
||||
376 DJ Decagramo
|
||||
377 DG Decigramo
|
||||
378 GRM Gramo
|
||||
379 CGM Centigramo
|
||||
380 TNE Tonelada (tonelada métrica)
|
||||
381 DTN Decitonelada métrica
|
||||
382 MGM Miligramo
|
||||
383 HGM Hectogramo
|
||||
384 KTN Kilotonelada Métrica
|
||||
385 2U Megagramo
|
||||
386 LBR Libra
|
||||
387 GRN Grano
|
||||
388 ONZ Onza (avoirdupois)
|
||||
389 CWI Hundredweight
|
||||
390 CWA Hundred pound
|
||||
391 LTN Tonelada (UK) o tonelada larga (estados unidos)
|
||||
392 STI Estone (UK)
|
||||
393 STN Tonelada (estados unidos) o tonelada corta (UK y estados unidos)
|
||||
394 APZ Onza troy u onza farmacéutica
|
||||
395 F13 Slug
|
||||
396 K64 Libra (avoirdupois) por grado fahrenheit
|
||||
397 L69 Tonelada por kelvin
|
||||
398 L87 Tonelada corta por grado fahrenheit
|
||||
399 M85 Tonelada, ensayo
|
||||
400 M86 Libra Alemana
|
||||
401 J33 Microgramo por kilogramo
|
||||
402 L32 Nanogramo por kilogramo
|
||||
403 NA Miligramo por kilogramo
|
||||
404 M29 Kilogramo por kilogramo
|
||||
405 M91 Libra por libra
|
||||
406 Q29 Microgramo por hectogramo
|
||||
407 MTQ Metro cúbico
|
||||
408 MAL Megalitro
|
||||
409 LTR Litro
|
||||
410 MMQ Milímetro cúbico
|
||||
411 CMQ Centímetro cúbico
|
||||
412 DMQ Decímetro cúbico
|
||||
413 MLT Mililitro
|
||||
414 HLT Hectolitro
|
||||
415 CLT Centilitro
|
||||
416 DMA Decámetro cúbico
|
||||
417 H19 Hectómetro cúbico
|
||||
418 H20 Kilómetro cúbico
|
||||
419 M71 Metro cúbico por pascal (joules)
|
||||
420 DLT Decilitro
|
||||
421 4G Microlitro
|
||||
422 K6 Kilolitro
|
||||
423 A44 Decalitro
|
||||
424 G94 Centímetro cúbico por bar
|
||||
425 G95 Litro por bar
|
||||
426 G96 Metro cúbico por bar
|
||||
427 G97 Mililitro por bar
|
||||
428 5I Pies cúbicos estándar
|
||||
429 INQ Pulgada cúbica
|
||||
430 FTQ Pie cúbico
|
||||
431 YDQ Yarda cúbica
|
||||
432 GLI Galón (UK)
|
||||
433 GLL Galón (EUA)
|
||||
434 PT Pinta (US)
|
||||
435 PTI Pint (uk)
|
||||
436 QTI Cuarto (UK)
|
||||
437 PTL Pinta líquida (estados unidos)
|
||||
438 QTL Cuarto de líquido (estadis unidos)
|
||||
439 PTD Pinta seca (estados unidos)
|
||||
440 OZI Onza líquida (UK)
|
||||
441 QT Cuarto (EUA)
|
||||
442 J57 Barril (uk petróleo)
|
||||
443 K21 Pie cúbico por grado fahrenheit
|
||||
444 K23 Pie cúbico por psi (libra por pulgada cuadrada)
|
||||
445 L43 Peck (UK)
|
||||
446 L61 Pinta (US seco)
|
||||
447 L62 Cuarto de galón (seco de los EUA)
|
||||
448 L84 Tonelada (flota UK)
|
||||
449 L86 Tonelada (flota estados unidos)
|
||||
450 M11 Yarda cúbica por grado fahrenheit
|
||||
451 M14 Yarda cúbica por psi (libra por pulgada cuadrada)
|
||||
452 OZA Onza líquida (estados unidos)
|
||||
453 BUI Bushel (UK)
|
||||
454 BUA Bushel (EUA)
|
||||
455 BLL Barril (EUA)
|
||||
456 BLD Barril seco (EUA)
|
||||
457 GLD Galón seco (EUA)
|
||||
458 QTD Cuarto seco (estados unidos)
|
||||
459 G26 Estere
|
||||
460 G21 Taza (unidad de volumen)
|
||||
461 G24 Cucharada (estados unidos)
|
||||
462 G25 Cucharilla (estados unidos)
|
||||
463 G23 Peck
|
||||
464 M67 Acre-pie
|
||||
465 M68 Cordón
|
||||
466 M69 Milla cúbica (reino unido)
|
||||
467 M70 Unidad tradicional de capacidad de carga
|
||||
468 Q32 Femtolitro
|
||||
469 Q33 Picolitro
|
||||
470 Q34 Nanolitro
|
||||
471 NM3 Metro cúbico normalizado
|
||||
472 SM3 Metro cúbico estándar
|
|
|
@ -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},
|
||||
|
@ -114,7 +114,9 @@
|
|||
{"key": "607", "name": "Régimen de Enajenación o Adquisición de Bienes", "moral": true, "activo": false},
|
||||
{"key": "629", "name": "De los Regímenes Fiscales Preferentes y de las Empresas Multinacionales", "fisica": true, "activo": false},
|
||||
{"key": "630", "name": "Enajenación de acciones en bolsa de valores", "fisica": true, "activo": false},
|
||||
{"key": "615", "name": "Régimen de los ingresos por obtención de premios", "fisica": true, "activo": false}
|
||||
{"key": "615", "name": "Régimen de los ingresos por obtención de premios", "fisica": true, "activo": false},
|
||||
{"key": "625", "name": "Régimen de las Actividades Empresariales con ingresos a través de Plataformas Tecnológicas", "fisica": true, "activo": true},
|
||||
{"key": "626", "name": "Régimen Simplificado de Confianza", "moral": true, "fisica": true, "activo": true}
|
||||
]
|
||||
},
|
||||
{
|
||||
|
@ -680,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}
|
||||
]
|
||||
},
|
||||
{
|
||||
|
@ -726,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 |
File diff suppressed because it is too large
Load Diff
|
@ -80,6 +80,8 @@ var bancos_controllers = {
|
|||
$$('filter_invoice_pay_month').attachEvent('onChange', filter_invoice_pay_change)
|
||||
$$('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()
|
||||
}
|
||||
|
@ -577,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){
|
||||
|
@ -952,6 +954,7 @@ function cmd_complemento_pago_click(){
|
|||
}
|
||||
|
||||
set_data_pay(row)
|
||||
$$('chk_pay_close_when_stamp').setValue(false)
|
||||
$$('multi_bancos').setValue('bank_pay')
|
||||
}
|
||||
|
||||
|
@ -992,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, {
|
||||
|
@ -1009,6 +1014,11 @@ function send_stamp_cfdi_pay(id_mov){
|
|||
}
|
||||
}
|
||||
})
|
||||
|
||||
if(close){
|
||||
$$('multi_bancos').setValue('banco_home')
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function save_cfdi_pay(form){
|
||||
|
@ -1062,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()
|
||||
|
@ -1073,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()
|
||||
}
|
||||
|
||||
|
||||
|
@ -1351,3 +1390,120 @@ function cmd_save_mov_description_click(){
|
|||
function cmd_close_mov_description_click(){
|
||||
$$('win_mov_description').close()
|
||||
}
|
||||
|
||||
|
||||
function cmd_invoice_pay_sat_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, solo es posible \
|
||||
consultar el estatus en el SAT de facturas timbradas')
|
||||
return
|
||||
}
|
||||
|
||||
var options = {opt: 'status_sat', id: row.id}
|
||||
webix.ajax().get('/cfdipay', options, function(text, data){
|
||||
var value = data.json()
|
||||
if(value == 'Vigente'){
|
||||
msg_ok(value)
|
||||
}else{
|
||||
msg_error(value)
|
||||
}
|
||||
})
|
||||
|
||||
}
|
||||
|
||||
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
|
@ -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()
|
||||
}
|
||||
|
|
|
@ -12,6 +12,7 @@ var nomina_controllers = {
|
|||
$$('cmd_nomina_without_stamp').attachEvent('onItemClick', cmd_nomina_without_stamp_click)
|
||||
$$('cmd_nomina_delete').attachEvent('onItemClick', cmd_nomina_delete_click)
|
||||
$$('cmd_nomina_timbrar').attachEvent('onItemClick', cmd_nomina_timbrar_click)
|
||||
$$('cmd_nomina_sat').attachEvent('onItemClick', cmd_nomina_sat_click)
|
||||
$$('cmd_nomina_log').attachEvent('onItemClick', cmd_nomina_log_click)
|
||||
$$('cmd_nomina_download').attachEvent('onItemClick', cmd_nomina_download_click)
|
||||
$$('cmd_nomina_cancel').attachEvent('onItemClick', cmd_nomina_cancel_click)
|
||||
|
@ -19,6 +20,7 @@ var nomina_controllers = {
|
|||
$$('filter_year_nomina').attachEvent('onChange', filter_year_nomina_change)
|
||||
$$('filter_month_nomina').attachEvent('onChange', filter_month_nomina_change)
|
||||
$$('filter_dates_nomina').attachEvent('onChange', filter_dates_nomina_change)
|
||||
$$('grid_nomina').attachEvent('onSelectChange', grid_nomina_on_select_change)
|
||||
webix.extend($$('grid_nomina'), webix.ProgressBar)
|
||||
}
|
||||
}
|
||||
|
@ -253,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)
|
||||
}
|
||||
|
@ -483,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){
|
||||
|
@ -515,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)
|
||||
|
@ -553,3 +569,59 @@ function cmd_nomina_download_click(){
|
|||
|
||||
}
|
||||
|
||||
|
||||
function grid_nomina_on_select_change(){
|
||||
var g = $$('grid_nomina')
|
||||
var rows = g.getSelectedItem(true)
|
||||
var total = 0
|
||||
|
||||
for (i = 0; i < rows.length; i++) {
|
||||
if(typeof(rows[i].total) == 'string'){
|
||||
total += rows[i].total.to_float()
|
||||
}else{
|
||||
total += rows[i].total
|
||||
}
|
||||
}
|
||||
g.getColumnConfig('empleado').footer[0].text = webix.i18n.priceFormat(total)
|
||||
g.refreshColumns()
|
||||
}
|
||||
|
||||
|
||||
function cmd_nomina_sat_click(){
|
||||
var g = $$('grid_nomina')
|
||||
|
||||
if(g.count() == 0){
|
||||
return
|
||||
}
|
||||
|
||||
var row = g.getSelectedItem()
|
||||
if (row == undefined){
|
||||
msg_error('Selecciona un recibo de nómina')
|
||||
return
|
||||
}
|
||||
if (row instanceof Array){
|
||||
msg_error('Selecciona solo un recibo de nómina')
|
||||
return
|
||||
}
|
||||
|
||||
if(!row.uuid){
|
||||
msg_error('La factura no esta timbrada, solo es posible consultar \
|
||||
el estatus en el SAT de facturas timbradas')
|
||||
return
|
||||
}
|
||||
|
||||
var options = {opt: 'status_sat', id: row.id}
|
||||
webix.ajax().get('/nomina', options, function(text, data){
|
||||
var value = data.json()
|
||||
if(value == 'Vigente'){
|
||||
msg_ok(value)
|
||||
}else if(value == 'uncancel'){
|
||||
ask_invoice_uncancel(row.id)
|
||||
}else{
|
||||
msg_error(value)
|
||||
}
|
||||
})
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -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)
|
||||
}
|
||||
})
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
var cfg_products = new Object()
|
||||
var gis_admin = false
|
||||
|
||||
|
||||
function products_default_config(){
|
||||
|
@ -18,9 +19,26 @@ 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)
|
||||
}
|
||||
})
|
||||
|
||||
webix.ajax().get('/users', {'opt': 'is_admin'}, {
|
||||
error: function(text, data, xhr) {
|
||||
msg = 'Error al consultar'
|
||||
msg_error(msg)
|
||||
},
|
||||
success: function(text, data, xhr) {
|
||||
var values = data.json()
|
||||
gis_admin = values.is_admin
|
||||
if(values.is_admin){
|
||||
$$('cmd_add_inventory').show()
|
||||
//~ $$('cmd_products_add').show()
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
@ -32,6 +50,12 @@ var products_controllers = {
|
|||
$$("cmd_save_product").attachEvent("onItemClick", cmd_save_product_click)
|
||||
$$("cmd_cancel_product").attachEvent("onItemClick", cmd_cancel_product_click)
|
||||
$$("cmd_import_products").attachEvent("onItemClick", cmd_import_products_click)
|
||||
$$("cmd_add_inventory").attachEvent("onItemClick", cmd_add_inventory_click)
|
||||
$$("cmd_products_add").attachEvent("onItemClick", cmd_products_add_click)
|
||||
$$('cmd_add_products_from_xml').attachEvent('onItemClick', cmd_add_products_from_xml_click)
|
||||
$$('cmd_show_exists').attachEvent('onItemClick', cmd_show_exists_click)
|
||||
$$('cmd_save_products_add').attachEvent('onItemClick', cmd_save_products_add_click)
|
||||
$$('cmd_close_products_add').attachEvent('onItemClick', cmd_close_products_add_click)
|
||||
$$("chk_automatica").attachEvent("onChange", chk_automatica_change)
|
||||
$$("valor_unitario").attachEvent("onChange", valor_unitario_change)
|
||||
$$('precio_con_impuestos').attachEvent('onChange', precio_con_impuestos_change)
|
||||
|
@ -99,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){
|
||||
|
@ -107,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()
|
||||
|
@ -206,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
|
||||
|
@ -228,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'
|
||||
|
@ -247,9 +276,7 @@ function cmd_save_product_click(id, e, node){
|
|||
|
||||
|
||||
function cmd_cancel_product_click(id, e, node){
|
||||
|
||||
$$("multi_products").setValue("products_home")
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
@ -429,3 +456,536 @@ function up_products_upload_complete(response){
|
|||
}
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
//~ Add inventory
|
||||
function cmd_add_inventory_click(id, e, node){
|
||||
var row = $$('grid_products').getSelectedItem()
|
||||
if (row == undefined){
|
||||
msg_error('Selecciona un Producto')
|
||||
return
|
||||
}
|
||||
|
||||
win_add_inventory.init()
|
||||
$$('txt_add_id').setValue(row.id)
|
||||
$$('txt_add_key').setValue(row.clave)
|
||||
$$('txt_add_unit').setValue(row.unidad)
|
||||
$$('txt_add_description').setValue(row.descripcion)
|
||||
$$('lst_warehouses').getList().load('/warehouse?opt=for_select')
|
||||
$$('win_add_inventory').show()
|
||||
}
|
||||
|
||||
|
||||
//~ Show details inventory
|
||||
function cmd_show_exists_click(id, e, node){
|
||||
var row = $$('grid_products').getSelectedItem()
|
||||
if (row == undefined){
|
||||
msg_error('Selecciona un Producto')
|
||||
return
|
||||
}
|
||||
win_show_exists.init()
|
||||
$$('txt_id_product').setValue(row.id)
|
||||
$$('grid_warehouse_exists').load('warehouseproduct?opt=by_product&id=' + row.id)
|
||||
|
||||
if(gis_admin){
|
||||
$$('lst_warehouse_target').getList().load('/warehouse?opt=for_select')
|
||||
}else{
|
||||
$$('lbl_title_move').hide()
|
||||
$$('txt_cant_to_move').hide()
|
||||
$$('lst_warehouse_target').hide()
|
||||
$$('cmd_warehouse_move').hide()
|
||||
}
|
||||
|
||||
$$('win_show_exists').show()
|
||||
}
|
||||
|
||||
|
||||
function cmd_warehouse_move_click(id, e, node){
|
||||
var id_product = $$('txt_id_product').getValue()
|
||||
var row = $$('grid_warehouse_exists').getSelectedItem()
|
||||
if (row == undefined){
|
||||
msg_error('Selecciona un Almacen origen')
|
||||
return
|
||||
}
|
||||
var warehouse_source = row.id
|
||||
var cant_to_move = $$('txt_cant_to_move').getValue()
|
||||
var warehouse_target = $$('lst_warehouse_target').getValue()
|
||||
|
||||
if(!cant_to_move){
|
||||
msg_error('La cantidad no puede ser cero')
|
||||
return
|
||||
}
|
||||
|
||||
if(cant_to_move > row.exists){
|
||||
msg_error('La cantidad a mover no puede ser mayor a la existencia')
|
||||
return
|
||||
}
|
||||
|
||||
if (warehouse_target == ''){
|
||||
msg_error('Selecciona un Almacen destino')
|
||||
return
|
||||
}
|
||||
|
||||
if (warehouse_source == warehouse_target){
|
||||
msg_error('Los almacenes origen y destino deben ser diferentes')
|
||||
return
|
||||
}
|
||||
|
||||
var values = {
|
||||
id_product: id_product,
|
||||
cant: cant_to_move,
|
||||
source: warehouse_source,
|
||||
target: warehouse_target
|
||||
}
|
||||
|
||||
msg = '¿Estás seguro de hacer este movimiento?'
|
||||
webix.confirm({
|
||||
title: 'Movimiento de Almacen',
|
||||
ok: 'Si',
|
||||
cancel: 'No',
|
||||
type: 'confirm-error',
|
||||
text: msg,
|
||||
callback:function(result){
|
||||
if(result){
|
||||
_warehouse_movement(values)
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
function _warehouse_movement(args){
|
||||
var values = {
|
||||
opt: 'warehouse_movement',
|
||||
values: args,
|
||||
}
|
||||
|
||||
webix.ajax().sync().post('inventoryentries', values, {
|
||||
error:function(text, data, XmlHttpRequest){
|
||||
msg = 'Ocurrio un error, consulta a soporte técnico'
|
||||
msg_error(msg)
|
||||
},
|
||||
success:function(text, data, XmlHttpRequest){
|
||||
var values = data.json();
|
||||
if (values.ok) {
|
||||
$$('txt_cant_to_move').setValue(0)
|
||||
$$('lst_warehouse_target').setValue('')
|
||||
$$('grid_warehouse_exists').load('warehouseproduct?opt=by_product&id=' + args.id_product)
|
||||
$$('grid_warehouse_exists').clearSelection()
|
||||
msg_ok('Movimiento realizado correctamente')
|
||||
}else{
|
||||
msg_error(values.msg)
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
function cmd_win_show_exists_close_click(id, e, node){
|
||||
$$('win_show_exists').close()
|
||||
}
|
||||
|
||||
|
||||
//~ Add products
|
||||
function cmd_products_add_click(id, e, node){
|
||||
$$("multi_products").setValue("product_add")
|
||||
cfg_products['partner_id'] = 0
|
||||
cfg_products['partner_rfc'] = ''
|
||||
}
|
||||
|
||||
//~ Close add products
|
||||
function cmd_close_products_add_click(id, e, node){
|
||||
var grid = $$('grid_partner_products')
|
||||
|
||||
$$('multi_invoices').setValue('products_home')
|
||||
$$('lbl_partner').setValue('')
|
||||
grid.clearAll()
|
||||
}
|
||||
|
||||
|
||||
function _add_entries_inventory(data){
|
||||
var grid = $$('grid_partner_products')
|
||||
var values = {
|
||||
opt: 'create',
|
||||
values: data,
|
||||
}
|
||||
|
||||
webix.ajax().sync().post('inventoryentries', values, {
|
||||
error:function(text, data, XmlHttpRequest){
|
||||
msg = 'Ocurrio un error, consulta a soporte técnico'
|
||||
msg_error(msg)
|
||||
},
|
||||
success:function(text, data, XmlHttpRequest){
|
||||
var values = data.json();
|
||||
if (values.ok) {
|
||||
get_products()
|
||||
$$('multi_invoices').setValue('products_home')
|
||||
$$('lbl_partner').setValue('')
|
||||
grid.clearAll()
|
||||
}else{
|
||||
msg_error(values.msg)
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
}
|
||||
|
||||
//~ Save add products
|
||||
function cmd_save_products_add_click(id, e, node){
|
||||
var grid = $$('grid_partner_products')
|
||||
var count = 0
|
||||
var products = []
|
||||
var validate_import = false
|
||||
var validate_cant = false
|
||||
|
||||
grid.eachRow(function(row){
|
||||
var r = grid.getItem(row)
|
||||
if(r.select){
|
||||
var p = {}
|
||||
count += 1
|
||||
p.id_product = r.id_product
|
||||
p.key = r.key
|
||||
p.key_sat = r.key_sat1
|
||||
p.description = r.description1
|
||||
p.unit = r.unit
|
||||
p.unit_value = r.unit_value1
|
||||
p.cant = r.cant1
|
||||
products.push(p)
|
||||
|
||||
if(p.unit_value < parseFloat(r.unit_value)){
|
||||
validate_import = true
|
||||
}
|
||||
if(p.cant > r.cant){
|
||||
validate_cant = true
|
||||
}
|
||||
|
||||
}
|
||||
})
|
||||
|
||||
if(!count){
|
||||
msg = 'Selecciona al menos un registro'
|
||||
msg_error(msg)
|
||||
return
|
||||
}
|
||||
|
||||
if(validate_import){
|
||||
msg = 'El Valor Unitario no puede ser menor al Valor Unitario del proveedor'
|
||||
msg_error(msg)
|
||||
return
|
||||
}
|
||||
|
||||
if(validate_cant){
|
||||
msg = 'La Cantidad no puede ser mayor a la Cantidad del proveedor'
|
||||
msg_error(msg)
|
||||
return
|
||||
}
|
||||
|
||||
var data = {
|
||||
partner: cfg_products['partner'],
|
||||
products: products,
|
||||
}
|
||||
|
||||
msg = '¿Estás seguro de ingresar estos productos? <br/><br/>\
|
||||
Esta acción no se puede deshacer.'
|
||||
webix.confirm({
|
||||
title: 'Agregar entrada',
|
||||
ok: 'Si',
|
||||
cancel: 'No',
|
||||
type: 'confirm-error',
|
||||
text: msg,
|
||||
callback:function(result){
|
||||
if(result){
|
||||
_add_entries_inventory(data)
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
//~ Import from xml
|
||||
function cmd_add_products_from_xml_click(){
|
||||
win_add_products_from_xml.init()
|
||||
$$('win_add_products_from_xml').show()
|
||||
}
|
||||
|
||||
//~ Upload XML
|
||||
function cmd_upload_products_from_xml_click(){
|
||||
var form = $$('form_upload_products_from_xml')
|
||||
var values = form.getValues()
|
||||
var list = $$('lst_up_products_from_xml')
|
||||
var upload = $$('up_products_from_xml')
|
||||
|
||||
if(!list.count()){
|
||||
$$('win_add_products_from_xml').close()
|
||||
return
|
||||
}
|
||||
|
||||
if(list.count() > 1){
|
||||
msg = 'Selecciona solo un archivo'
|
||||
msg_error(msg)
|
||||
return
|
||||
}
|
||||
|
||||
var template = upload.files.getItem(upload.files.getFirstId())
|
||||
|
||||
if(template.type.toLowerCase() != 'xml'){
|
||||
msg = 'Archivo inválido.\n\nSe requiere un archivo XML'
|
||||
msg_error(msg)
|
||||
return
|
||||
}
|
||||
|
||||
msg = '¿Estás seguro de importar este archivo? <br/><br/>\
|
||||
Si hay datos previos seran reemplazados.'
|
||||
webix.confirm({
|
||||
title: 'Importar Productos',
|
||||
ok: 'Si',
|
||||
cancel: 'No',
|
||||
type: 'confirm-error',
|
||||
text: msg,
|
||||
callback:function(result){
|
||||
if(result){
|
||||
upload.send()
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
function up_products_from_xml_upload_complete(response){
|
||||
if(response.status != 'server'){
|
||||
msg = 'Ocurrio un error al subir el archivo'
|
||||
msg_error(msg)
|
||||
return
|
||||
}
|
||||
|
||||
$$('win_add_products_from_xml').close()
|
||||
|
||||
if(response.error){
|
||||
msg_error(response.error)
|
||||
return
|
||||
}
|
||||
|
||||
var grid = $$('grid_partner_products')
|
||||
var data = response.data
|
||||
cfg_products['partner'] = data.emisor
|
||||
//~ cfg_products['xml'] = data.xml
|
||||
|
||||
var html = '<span class="webix_icon fa-user"></span><span class="lbl_partner">'
|
||||
html += data.emisor.nombre + ' (' + data.emisor.rfc + ')</span>'
|
||||
$$('lbl_partner').setValue(html)
|
||||
|
||||
grid.clearAll()
|
||||
grid.parse(data.conceptos, 'json')
|
||||
grid.refresh()
|
||||
|
||||
}
|
||||
|
||||
|
||||
function get_partner_product(grid, row){
|
||||
grid.refresh(row.id)
|
||||
|
||||
var partner_id = cfg_products['partner'].id
|
||||
var filters = {
|
||||
opt: 'product',
|
||||
partner: cfg_products['partner'],
|
||||
product_key: row.key,
|
||||
}
|
||||
|
||||
if(!partner_id){
|
||||
msg = 'El Proveedor no esta dado de alta'
|
||||
msg_ok(msg)
|
||||
return
|
||||
}
|
||||
|
||||
webix.ajax().get('/partnerproducts', filters, {
|
||||
error: function(text, data, xhr) {
|
||||
msg_error('Ocurrio un error, consulta a soporte técnico.')
|
||||
},
|
||||
success: function(text, data, xhr){
|
||||
var values = data.json()
|
||||
if(values.ok){
|
||||
row['id_product'] = values.row.id_product
|
||||
row['key_sat1'] = values.row.key_sat1
|
||||
row['description1'] = values.row.description1
|
||||
row['unit_value1'] = values.row.unit_value1
|
||||
grid.refresh(row.id)
|
||||
}else{
|
||||
msg_error(values.msg)
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
}
|
||||
|
||||
|
||||
function grid_partner_products_select(row_id, state){
|
||||
var grid = $$('grid_partner_products')
|
||||
var row = grid.getItem(row_id)
|
||||
|
||||
if(state){
|
||||
row['key_sat1'] = row.key_sat
|
||||
row['description1'] = row.description
|
||||
row['cant1'] = row.cant
|
||||
row['unit_value1'] = 0.0
|
||||
get_partner_product(grid, row)
|
||||
}else{
|
||||
row['key_sat1'] = ''
|
||||
row['description1'] = ''
|
||||
row['cant1'] = ''
|
||||
grid.refresh(row_id)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function cmd_add_inventory_cancel_click(id, e, node){
|
||||
$$('win_add_inventory').close()
|
||||
}
|
||||
|
||||
|
||||
function cmd_add_inventory_save_click(id, e, node){
|
||||
var product_id = $$('txt_add_id').getValue()
|
||||
//~ var product_key = $$('txt_add_key').getValue()
|
||||
var new_cant = $$('txt_new_cant').getValue()
|
||||
var warehouse = $$('lst_warehouses').getValue()
|
||||
|
||||
if(new_cant<=0) {
|
||||
msg = 'La cantidad no puede ser cero'
|
||||
msg_error(msg)
|
||||
return
|
||||
}
|
||||
|
||||
if($$('lst_warehouses').isVisible()){
|
||||
if(!warehouse){
|
||||
msg = 'Selecciona un almacen'
|
||||
msg_error(msg)
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
msg = '¿Estas seguro de guardar esta entrada? <br/><br/>\
|
||||
Esta acción no se puede deshacer'
|
||||
|
||||
webix.confirm({
|
||||
title: 'Agregar entrada',
|
||||
ok: 'Si',
|
||||
cancel: 'No',
|
||||
type: 'confirm-error',
|
||||
text: msg,
|
||||
callback:function(result){
|
||||
if(result){
|
||||
add_product_stock(product_id, new_cant, warehouse)
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
}
|
||||
|
||||
|
||||
function add_product_stock(product_id, new_cant, warehouse){
|
||||
var data = {
|
||||
product_id: product_id,
|
||||
cant: new_cant,
|
||||
warehouse: warehouse,
|
||||
}
|
||||
_add_entries_inventory_manual(product_id, data)
|
||||
$$('win_add_inventory').close()
|
||||
}
|
||||
|
||||
|
||||
function _add_entries_inventory_manual(row_id, data){
|
||||
var grid = $$('grid_products')
|
||||
var values = {
|
||||
opt: 'create_manual',
|
||||
values: data,
|
||||
}
|
||||
|
||||
webix.ajax().sync().post('inventoryentries', values, {
|
||||
error:function(text, data, XmlHttpRequest){
|
||||
msg = 'Ocurrio un error, consulta a soporte técnico'
|
||||
msg_error(msg)
|
||||
},
|
||||
success:function(text, data, XmlHttpRequest){
|
||||
var values = data.json();
|
||||
if (values.ok) {
|
||||
grid.updateItem(row_id, values.row)
|
||||
grid.refresh()
|
||||
}else{
|
||||
msg_error(values.msg)
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
function cmd_adjust_stock_click(id, e, node){
|
||||
var id_product = $$('txt_id_product').getValue()
|
||||
var row = $$('grid_warehouse_exists').getSelectedItem()
|
||||
if (row == undefined){
|
||||
msg_error('Selecciona un Almacen origen')
|
||||
return
|
||||
}
|
||||
var warehouse_source = row.id
|
||||
var cant_to_adjust = $$('txt_cant_to_adjust').getValue()
|
||||
|
||||
if(cant_to_adjust == 0){
|
||||
msg_error('La cantidad a ajustar no puede ser cero')
|
||||
return
|
||||
}
|
||||
|
||||
if(cant_to_adjust > row.exists){
|
||||
msg_error('La cantidad a ajustar no puede ser mayor a la existencia')
|
||||
return
|
||||
}
|
||||
|
||||
var values = {
|
||||
id_product: id_product,
|
||||
cant: cant_to_adjust,
|
||||
storage: warehouse_source,
|
||||
}
|
||||
|
||||
msg = '¿Estás seguro de hacer este ajuste?'
|
||||
webix.confirm({
|
||||
title: 'Ajuste de Almacen',
|
||||
ok: 'Si',
|
||||
cancel: 'No',
|
||||
type: 'confirm-error',
|
||||
text: msg,
|
||||
callback:function(result){
|
||||
if(result){
|
||||
_adjust_stock(values)
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
function _adjust_stock(args){
|
||||
var grid = $$('grid_products')
|
||||
var row = grid.getSelectedItem()
|
||||
|
||||
var values = {
|
||||
opt: 'adjust_stock',
|
||||
values: args,
|
||||
}
|
||||
|
||||
webix.ajax().sync().post('warehouseproduct', values, {
|
||||
error:function(text, data, XmlHttpRequest){
|
||||
msg = 'Ocurrio un error, consulta a soporte técnico'
|
||||
msg_error(msg)
|
||||
},
|
||||
success:function(text, data, XmlHttpRequest){
|
||||
var values = data.json();
|
||||
if (values.ok) {
|
||||
$$('txt_cant_to_adjust').setValue(0)
|
||||
$$('grid_warehouse_exists').load('warehouseproduct?opt=by_product&id=' + args.id_product)
|
||||
$$('grid_warehouse_exists').clearSelection()
|
||||
|
||||
grid.updateItem(row['id'], values.row)
|
||||
grid.refresh()
|
||||
|
||||
msg_ok('Ajuste realizado correctamente')
|
||||
}else{
|
||||
msg_error(values.msg)
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
|
|
|
@ -7,6 +7,7 @@ var last_forma_pago = ''
|
|||
var tickets_controllers = {
|
||||
init: function(){
|
||||
$$('cmd_nuevo_ticket').attachEvent('onItemClick', cmd_nuevo_ticket_click)
|
||||
$$('cmd_ticket_from_ticket').attachEvent('onItemClick', cmd_ticket_from_ticket_click)
|
||||
$$('cmd_ticket_to_invoice').attachEvent('onItemClick', cmd_ticket_to_invoice_click)
|
||||
$$('cmd_ticket_report_pdf').attachEvent('onItemClick', cmd_ticket_report_pdf_click)
|
||||
$$('cmd_ticket_report_xls').attachEvent('onItemClick', cmd_ticket_report_xls_click)
|
||||
|
@ -148,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){
|
||||
|
@ -183,6 +186,25 @@ function cmd_nuevo_ticket_click(){
|
|||
}
|
||||
|
||||
|
||||
function cmd_ticket_from_ticket_click(){
|
||||
var grid = $$('grid_tickets')
|
||||
|
||||
if(grid.count() == 0){
|
||||
return
|
||||
}
|
||||
|
||||
var row = grid.getSelectedItem()
|
||||
if (row == undefined){
|
||||
msg_error('Selecciona un ticket')
|
||||
return
|
||||
}
|
||||
|
||||
configuracion_inicial_nuevo_ticket()
|
||||
$$('multi_tickets').setValue('tickets_new')
|
||||
$$('grid_tdetails').load('ticketsdetails?opt=by_ticket_id&id=' + row.id)
|
||||
}
|
||||
|
||||
|
||||
function cmd_ticket_to_invoice_click(){
|
||||
configuracion_inicial_ticket_to_invoice()
|
||||
$$('multi_tickets').setValue('tickets_invoice')
|
||||
|
@ -342,22 +364,43 @@ function agregar_producto(values){
|
|||
producto['valor_unitario'] = calcular_precio_con_impuestos(
|
||||
parseFloat(producto['valor_unitario']), taxes)
|
||||
producto['importe'] = producto['valor_unitario']
|
||||
var id = grid.add(producto, 0)
|
||||
edit_cant(id)
|
||||
//~ var id = grid.add(producto, 0)
|
||||
//~ edit_cant(id)
|
||||
}else{
|
||||
producto['cantidad'] = parseFloat(row.cantidad) + 1
|
||||
producto['descuento'] = parseFloat(row.descuento)
|
||||
producto['valor_unitario'] = parseFloat(row.valor_unitario)
|
||||
precio_final = producto['valor_unitario'] - producto['descuento']
|
||||
producto['importe'] = (precio_final * producto['cantidad']).round(DECIMALES)
|
||||
grid.updateItem(row.id, producto)
|
||||
//~ grid.updateItem(row.id, producto)
|
||||
}
|
||||
form.setValues({tsearch_product_key: '', tsearch_product_name: ''}, true)
|
||||
|
||||
//~ Validate stock
|
||||
if(producto.inventario){
|
||||
if(producto.cantidad > producto.existencia){
|
||||
msg_error('No hay suficiente existencia de este producto')
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
if(row == undefined){
|
||||
var id = grid.add(producto, 0)
|
||||
edit_cant(id)
|
||||
}else{
|
||||
grid.updateItem(row.id, producto)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function buscar_producto_key(key){
|
||||
webix.ajax().get('/values/productokey', {'key': key}, {
|
||||
|
||||
var filters = {
|
||||
opt: 'by_key',
|
||||
key: key,
|
||||
}
|
||||
|
||||
webix.ajax().get('/products', filters, {
|
||||
error: function(text, data, xhr) {
|
||||
msg_error('Error al consultar')
|
||||
},
|
||||
|
@ -371,6 +414,20 @@ function buscar_producto_key(key){
|
|||
}
|
||||
}
|
||||
})
|
||||
//~ webix.ajax().get('/values/productokey', {'key': key}, {
|
||||
//~ error: function(text, data, xhr) {
|
||||
//~ msg_error('Error al consultar')
|
||||
//~ },
|
||||
//~ success: function(text, data, xhr){
|
||||
//~ var values = data.json()
|
||||
//~ if (values.ok){
|
||||
//~ agregar_producto(values)
|
||||
//~ } else {
|
||||
//~ msg = 'No se encontró la clave<BR><BR>' + key
|
||||
//~ msg_error(msg)
|
||||
//~ }
|
||||
//~ }
|
||||
//~ })
|
||||
|
||||
}
|
||||
|
||||
|
@ -417,6 +474,20 @@ function grid_tickets_details_before_edit_stop(state, editor){
|
|||
grid.unblockEvent()
|
||||
return true
|
||||
}
|
||||
|
||||
//~ Validate stock
|
||||
if(row['inventario']){
|
||||
if(cantidad > row['existencia']){
|
||||
msg = 'No hay suficiente existencia de este producto'
|
||||
msg_error(msg)
|
||||
grid.blockEvent()
|
||||
state.value = state.old
|
||||
grid.editCancel()
|
||||
grid.unblockEvent()
|
||||
return true
|
||||
}
|
||||
}
|
||||
|
||||
var valor_unitario = parseFloat(row['valor_unitario'])
|
||||
var descuento = parseFloat(row['descuento'])
|
||||
}
|
||||
|
@ -542,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){
|
||||
|
@ -575,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)
|
||||
|
@ -611,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',
|
||||
|
@ -643,22 +735,30 @@ function grid_tickets_invoice_double_click(id, e, node){
|
|||
|
||||
|
||||
function cmd_move_tickets_right_click(){
|
||||
$$('grid_tickets_active').eachRow(
|
||||
function(row){
|
||||
this.copy(row, -1, $$('grid_tickets_invoice'))
|
||||
}
|
||||
)
|
||||
$$('grid_tickets_active').clearAll()
|
||||
var source = $$('grid_tickets_active')
|
||||
var target = $$('grid_tickets_invoice')
|
||||
_move_tickets(source, target)
|
||||
}
|
||||
|
||||
|
||||
function cmd_move_tickets_left_click(){
|
||||
$$('grid_tickets_invoice').eachRow(
|
||||
function(row){
|
||||
this.copy(row, -1, $$('grid_tickets_active'))
|
||||
}
|
||||
)
|
||||
$$('grid_tickets_invoice').clearAll()
|
||||
var target = $$('grid_tickets_active')
|
||||
var source = $$('grid_tickets_invoice')
|
||||
_move_tickets(source, target)
|
||||
}
|
||||
|
||||
|
||||
function _move_tickets(source, target){
|
||||
var rows = source.getSelectedItem()
|
||||
|
||||
if(rows == undefined){
|
||||
source.eachRow(
|
||||
function(row){
|
||||
this.copy(row, -1, target)
|
||||
}
|
||||
)
|
||||
source.clearAll()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -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 = {
|
||||
|
@ -337,6 +374,28 @@ webix.ui.datafilter.summTimbrada = webix.extend({
|
|||
}, webix.ui.datafilter.summColumn);
|
||||
|
||||
|
||||
webix.ui.datafilter.summTimbradaN = webix.extend({
|
||||
refresh:function(master, node, value){
|
||||
node.firstChild.innerHTML = this.summGenerate(master);
|
||||
},
|
||||
summGenerate:function(master){
|
||||
var sum = 0
|
||||
master.eachRow(function(id){
|
||||
var row = master.getItem(id)
|
||||
if(row.estatus == 'Timbrado'){
|
||||
var importe = row.total
|
||||
if(typeof importe === 'string'){
|
||||
importe = row.total.to_float()
|
||||
}
|
||||
sum += importe
|
||||
}
|
||||
})
|
||||
return webix.i18n.priceFormat(sum)
|
||||
}
|
||||
}, webix.ui.datafilter.summColumn);
|
||||
|
||||
|
||||
|
||||
function validate_rfc(value){
|
||||
rfc = value.trim().toUpperCase();
|
||||
if ( rfc == ""){
|
||||
|
@ -581,6 +640,12 @@ function lst_parse(lst, values){
|
|||
}
|
||||
|
||||
|
||||
function lst_parse2(lst_name, values){
|
||||
obj = $$(lst_name)
|
||||
obj.getList().parse(values)
|
||||
}
|
||||
|
||||
|
||||
function set_value(control, value){
|
||||
obj = $$(control)
|
||||
obj.blockEvent()
|
||||
|
@ -588,3 +653,44 @@ function set_value(control, value){
|
|||
obj.unblockEvent()
|
||||
}
|
||||
|
||||
|
||||
function grid_parse(grid_name, values){
|
||||
obj = $$(grid_name)
|
||||
obj.clearAll()
|
||||
obj.parse(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'},
|
||||
]
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
//~ Empresa Libre
|
||||
//~ Copyright (C) 2016-2018 Mauricio Baeza Servin (web@correolibre.net)
|
||||
//~ Copyright (C) 2016-2021 Mauricio Baeza Servin (public@correolibre.net)
|
||||
//~
|
||||
//~ This program is free software: you can redistribute it and/or modify
|
||||
//~ it under the terms of the GNU General Public License as published by
|
||||
|
@ -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',
|
||||
|
@ -238,11 +240,11 @@ var emisor_otros_datos= [
|
|||
{cols: [{view: 'datepicker', id: 'ong_fecha_dof', name: 'ong_fecha_dof',
|
||||
label: 'Fecha de DOF: ', disabled: true, format: '%d-%M-%Y',
|
||||
placeholder: 'Fecha de publicación en el DOF'}, {}]},
|
||||
{template: 'Timbrado y Soporte', type: 'section'},
|
||||
{view: 'text', id: 'correo_timbrado',
|
||||
name: 'correo_timbrado', label: 'Usuario para Timbrado: '},
|
||||
{view: 'text', id: 'token_timbrado',
|
||||
name: 'token_timbrado', label: 'Token de Timbrado: '},
|
||||
{template: 'Soporte', type: 'section'},
|
||||
//~ {view: 'text', id: 'correo_timbrado',
|
||||
//~ name: 'correo_timbrado', label: 'Usuario para Timbrado: '},
|
||||
//~ {view: 'text', id: 'token_timbrado',
|
||||
//~ name: 'token_timbrado', label: 'Token de Timbrado: '},
|
||||
{view: 'text', id: 'token_soporte',
|
||||
name: 'token_soporte', label: 'Token de Soporte: '},
|
||||
]
|
||||
|
@ -278,13 +280,16 @@ var col_fiel = {rows: [
|
|||
]}
|
||||
|
||||
|
||||
//~ {view: 'uploader', id: 'up_cert', autosend: false, link: 'lst_cert',
|
||||
//~ value: 'Seleccionar certificado', upload: '/values/files'}, {}]},
|
||||
|
||||
var emisor_certificado = [
|
||||
{cols: [col_sello, col_fiel]},
|
||||
{template: 'Cargar Certificado', type: 'section'},
|
||||
{view: 'form', id: 'form_upload', rows: [
|
||||
{cols: [{},
|
||||
{view: 'uploader', id: 'up_cert', autosend: false, link: 'lst_cert',
|
||||
value: 'Seleccionar certificado', upload: '/values/files'}, {}]},
|
||||
value: 'Seleccionar certificado (CER y KEY)'}, {}]},
|
||||
{cols: [{},
|
||||
{view: 'list', id: 'lst_cert', name: 'certificado',
|
||||
type: 'uploader', autoheight:true, borderless: true}, {}]},
|
||||
|
@ -480,7 +485,9 @@ var emisor_correo = [
|
|||
{}]},
|
||||
{cols: [
|
||||
{view: 'checkbox', id: 'correo_ssl', name: 'correo_ssl',
|
||||
label: 'Usar TLS/SSL: '},
|
||||
label: 'Usar TLS/SSL: ', maxWidth: 210},
|
||||
{view: 'checkbox', id: 'correo_starttls', name: 'correo_starttls',
|
||||
label: 'Usar STARTTLS: '},
|
||||
{}]},
|
||||
{cols: [
|
||||
{view: 'text', id: 'correo_usuario', name: 'correo_usuario',
|
||||
|
@ -591,16 +598,34 @@ var type_make_pdf = [
|
|||
]
|
||||
|
||||
|
||||
//~ Templates
|
||||
var opt_templates_cfdi = [
|
||||
{id: '_4.0.ods', value: 'CFDI v4.0'},
|
||||
{id: '_4.0_cn_1.2.ods', value: 'CFDI v4.0 - Nómina v1.2'},
|
||||
{id: '_4.0_cp_2.0.ods', value: 'CFDI v4.0 - Pagos v2.0'},
|
||||
{id: '_4.0_ccp_2.0.ods', value: 'CFDI v4.0 - Carta Porte v2.0'},
|
||||
{id: '_4.0_ccp_3.0.ods', value: 'CFDI v4.0 - Carta Porte v3.0'},
|
||||
{id: '_4.0_cd_1.1.ods', value: 'CFDI v4.0 - Donativos v1.1'},
|
||||
{id: '_4.0_cce_2.0.ods', value: 'CFDI v4.0 - Comercio Exterior v2.0'},
|
||||
{id: '_4.0.json', value: 'CFDI v4.0 - JSON'},
|
||||
{id: '_3.3.ods', value: 'CFDI v3.3'},
|
||||
{id: '_3.3_cn_1.2.ods', value: 'CFDI v3.3 - Nómina v1.2'},
|
||||
{id: '_3.3_ccp_2.0.ods', value: 'CFDI v3.3 - Carta Porte v2.0'},
|
||||
{id: '_3.3_cp_1.0.ods', value: 'CFDI v3.3 - Pagos v1.0'},
|
||||
{id: '_3.3.json', value: 'CFDI v3.3 - JSON'},
|
||||
{id: '_3.2.ods', value: 'CFDI v3.2'}
|
||||
]
|
||||
|
||||
|
||||
var options_templates = [
|
||||
{maxHeight: 15},
|
||||
{maxHeight: 25},
|
||||
{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'},
|
||||
{view: 'richselect', id: 'lst_templates_cfdi', label: 'Plantillas CFDI: ', labelWidth: 100, options: opt_templates_cfdi},
|
||||
{maxWidth: 10},
|
||||
{view: 'button', id: 'cmd_template_upload', type: 'iconButton', icon: 'file', width: 35},
|
||||
{},
|
||||
{maxWidth: 20} ]},
|
||||
{maxHeight: 20},
|
||||
{maxHeight: 50},
|
||||
{cols: [{maxWidth: 20},
|
||||
{view: 'search', id: 'txt_plantilla_factura_html', name: 'plantilla_factura_html',
|
||||
label: 'Plantilla Factura v3.3 (HTML): ', labelPosition: 'top',
|
||||
|
@ -608,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},
|
||||
|
@ -644,7 +648,7 @@ var options_templates = [
|
|||
|
||||
|
||||
var options_pac = [
|
||||
{id: 'default', value: 'Predeterminado'},
|
||||
{id: 'finkok', value: 'Finkok'},
|
||||
{id: 'comercio', value: 'Comercio Digital'},
|
||||
]
|
||||
|
||||
|
@ -668,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,
|
||||
|
@ -685,15 +689,43 @@ var options_admin_otros = [
|
|||
{cols: [{maxWidth: 15},
|
||||
{view: 'checkbox', id: 'chk_config_invoice_by_ticket', labelWidth: 0,
|
||||
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},
|
||||
{view: 'checkbox', id: 'chk_cancel_invoices_by_admin', labelWidth: 0,
|
||||
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'},
|
||||
{cols: [{maxWidth: 15},
|
||||
{view: 'richselect', id: 'lst_pac', name: 'lst_pac', width: 300,
|
||||
label: 'PAC: ', value: 'default', required: false,
|
||||
options: options_pac}, {view: 'label', label: 'NO cambies este valor, a menos que se te haya indicado'},
|
||||
label: 'PAC: ', value: '', required: true,
|
||||
labelAlign: 'right', options: options_pac}, {view: 'label',
|
||||
label: ' NO cambies este valor, a menos que se te haya indicado'},
|
||||
]},
|
||||
{cols: [{maxWidth: 15},
|
||||
{view: 'text', id: 'user_timbrado', name: 'user_timbrado',
|
||||
label: 'Usuario: ', labelAlign: 'right', required: true},
|
||||
{view: 'text', id: 'token_timbrado', name: 'token_timbrado',
|
||||
label: 'Token: ', labelAlign: 'right', required: true},
|
||||
]},
|
||||
{cols: [{maxWidth: 15}, {},
|
||||
{view: 'button', id: 'cmd_save_pac', label: 'Guardar',
|
||||
autowidth: true, type: 'form'}, {},
|
||||
]},
|
||||
{maxHeight: 20},
|
||||
|
||||
{template: 'Ayudas varias', type: 'section'},
|
||||
{cols: [{maxWidth: 15},
|
||||
{view: 'checkbox', id: 'chk_config_anticipo', labelWidth: 0,
|
||||
|
@ -720,6 +752,11 @@ var options_admin_otros = [
|
|||
{view: 'checkbox', id: 'chk_ticket_user_show_doc', labelWidth: 0,
|
||||
labelRight: 'Usuarios pueden ver todos los documentos'}
|
||||
]},
|
||||
{cols: [{maxWidth: 15},
|
||||
{view: 'checkbox', id: 'chk_cancel_tickets_by_admin', labelWidth: 0,
|
||||
labelRight: 'Solo admins pueden cancelar'},
|
||||
{}
|
||||
]},
|
||||
{maxHeight: 20},
|
||||
{}]
|
||||
|
||||
|
@ -733,6 +770,31 @@ var options_admin_partners = [
|
|||
]
|
||||
|
||||
|
||||
var grid_warehouse_cols = [
|
||||
{id: 'id', header: 'ID', hidden: true},
|
||||
{id: 'delete', header: '', width: 30, css: 'delete'},
|
||||
{id: 'name', header: 'Nombre', fillspace: 1},
|
||||
]
|
||||
|
||||
|
||||
var grid_warehouse = {
|
||||
view: 'datatable',
|
||||
id: 'grid_warehouse',
|
||||
select: 'row',
|
||||
adjust: true,
|
||||
headermenu: true,
|
||||
footer: true,
|
||||
columns: grid_warehouse_cols,
|
||||
on:{
|
||||
'data->onStoreUpdated':function(){
|
||||
this.data.each(function(obj, i){
|
||||
obj.delete = '-'
|
||||
})
|
||||
}
|
||||
},
|
||||
}
|
||||
|
||||
|
||||
var options_admin_products = [
|
||||
{maxHeight: 20},
|
||||
{cols: [{view: 'checkbox', id: 'chk_config_cuenta_predial', labelWidth: 15,
|
||||
|
@ -743,13 +805,28 @@ var options_admin_products = [
|
|||
labelRight: 'Mostrar precio con impuestos'}]},
|
||||
{cols: [{view: 'checkbox', id: 'chk_llevar_inventario', labelWidth: 15,
|
||||
labelRight: 'Mostrar inventario'}]},
|
||||
{cols: [{view: 'checkbox', id: 'chk_use_packing', labelWidth: 15,
|
||||
labelRight: 'Usar empaques'}]},
|
||||
{cols: [{maxWidth: 30}, {view: 'checkbox', id: 'chk_multi_stock', labelWidth: 15,
|
||||
labelRight: 'Multialmacen', disabled: true}]},
|
||||
{cols: [{maxWidth: 30}, {rows: [
|
||||
{template: 'Agregar Almacen', type: 'section', id: 'template_add_warehouse'},
|
||||
{cols: [
|
||||
{view: 'text', id: 'txt_add_warehouse', label: 'Nombre: ',
|
||||
labelPosition: 'left', required: true},
|
||||
{view: 'button', id: 'cmd_add_warehouse', label: 'Agregar',
|
||||
autowidth: true, type: 'iconButton', icon: 'plus'},
|
||||
]},
|
||||
{template: 'Almacenes', type: 'section'},
|
||||
grid_warehouse,
|
||||
]}, {},
|
||||
]}
|
||||
|
||||
//~ {cols: [{view: 'checkbox', id: 'chk_use_packing', labelWidth: 15,
|
||||
//~ labelRight: 'Usar empaques', hidden: true}]},
|
||||
]
|
||||
|
||||
|
||||
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,
|
||||
|
@ -759,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,
|
||||
|
@ -771,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,
|
||||
|
@ -798,6 +875,71 @@ var options_admin_complements = [
|
|||
type: 'form', align: 'center', autowidth: true, disabled: true},
|
||||
{}, {maxWidth: 15}
|
||||
]},
|
||||
{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}]},
|
||||
]
|
||||
|
||||
|
||||
var controls_add_sucursal = [{cols: [
|
||||
{maxWidth: 20},
|
||||
{view: 'text', id: 'txt_sucursal_add_name', name: 'sucursal_add_name',
|
||||
label: 'Nombre: ', labelPosition: 'top', required: true},
|
||||
{view: 'richselect', id: 'lst_sucursal_add_invoice', name: 'sucursal_add_invoice',
|
||||
label: 'Serie Facturas: ', labelPosition: 'top', required: true, options: []},
|
||||
{view: 'text', id: 'txt_sucursal_add_ticket', name: 'sucursal_add_ticket',
|
||||
required: true, label: 'Serie Tickets: ', labelPosition: 'top'},
|
||||
{view: 'richselect', id: 'lst_sucursal_warehouse', name: 'sucursal_warehouse',
|
||||
label: 'Almacen: ', labelPosition: 'top', required: false, options: [], hidden: true},
|
||||
{view: 'button', id: 'cmd_add_sucursal', label: 'Agregar',
|
||||
autowidth: true, type: 'iconButton', icon: 'plus'},
|
||||
{maxWidth: 20},
|
||||
]}]
|
||||
|
||||
|
||||
var grid_sucursales_cols = [
|
||||
{id: 'id', header: 'ID', hidden: true},
|
||||
{id: 'delete', header: '', width: 30, css: 'delete'},
|
||||
{id: 'name', header: 'Nombre', fillspace: 1},
|
||||
{id: 'serie_invoice', header: 'Serie Facturas', fillspace: 1},
|
||||
{id: 'serie_tickets', header: 'Serie Tickets', fillspace: 1},
|
||||
{id: 'warehouse', header: 'Almacen', fillspace: 1, hidden: true},
|
||||
]
|
||||
|
||||
|
||||
var grid_sucursales = {
|
||||
view: 'datatable',
|
||||
id: 'grid_sucursales',
|
||||
select: 'row',
|
||||
adjust: true,
|
||||
headermenu: false,
|
||||
footer: true,
|
||||
columns: grid_sucursales_cols,
|
||||
on:{
|
||||
'data->onStoreUpdated':function(){
|
||||
this.data.each(function(obj, i){
|
||||
obj.delete = '-'
|
||||
})
|
||||
}
|
||||
},
|
||||
}
|
||||
|
||||
|
||||
var options_admin_sucursales = [
|
||||
{maxHeight: 10},
|
||||
{template: 'Agregar Sucursal', type: 'section'},
|
||||
{view: 'form', id: 'form_add_sucursal', rows: controls_add_sucursal},
|
||||
{template: 'Sucursales', type: 'section'},
|
||||
{cols: [{maxWidth: 10}, grid_sucursales, {maxWidth: 10}]},
|
||||
{maxHeight: 20},
|
||||
]
|
||||
|
||||
|
||||
|
@ -816,24 +958,14 @@ var tab_options = {
|
|||
view: 'scrollview', body: {rows: options_admin_complements}}},
|
||||
{header: 'Otros', body: {id: 'tab_admin_otros', view: 'scrollview',
|
||||
body: {rows: options_admin_otros}}},
|
||||
{header: 'Sucursales', body: {id: 'tab_admin_sucursales', view: 'scrollview',
|
||||
body: {rows: options_admin_sucursales}}},
|
||||
],
|
||||
}
|
||||
|
||||
|
||||
var utilidades_archivos = [
|
||||
{maxHeight: 15},
|
||||
{template: 'Cargar Base de Datos de Factura Libre', type: 'section'},
|
||||
{view: 'form', id: 'form_upload_bdfl', rows: [
|
||||
{cols: [{},
|
||||
{view: 'uploader', id: 'up_bdfl', autosend: false, link: 'lst_bdfl',
|
||||
value: 'Seleccionar base de datos', upload: '/files/bdfl'}, {}]},
|
||||
{cols: [{},
|
||||
{view: 'list', id: 'lst_bdfl', name: 'bdfl',
|
||||
type: 'uploader', autoheight: true, borderless: true}, {}]},
|
||||
{cols: [{}, {view: 'button', id: 'cmd_subir_bdfl',
|
||||
label: 'Subir base de datos de Factura Libre'}, {}]},
|
||||
]},
|
||||
{maxHeight: 15},
|
||||
{maxHeight: 5},
|
||||
{template: 'Importar archivo CFDI (XML)', type: 'section'},
|
||||
{view: 'form', id: 'form_upload_cfdixml', rows: [
|
||||
{cols: [{},
|
||||
|
@ -1002,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',
|
||||
|
@ -1014,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',
|
||||
|
@ -1036,6 +1193,7 @@ var admin_taxes = [
|
|||
'CEDULAR',
|
||||
'CMIC',
|
||||
'SUPERVISION',
|
||||
'MANO DE OBRA',
|
||||
]
|
||||
|
||||
var admin_sat_impuestos = {cols: [{maxWidth: 15},
|
||||
|
@ -1184,6 +1342,101 @@ 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',
|
||||
name: 'grid_unidadpeso_found',
|
||||
body: {
|
||||
autoConfig: false,
|
||||
scroll:true,
|
||||
autoheight:false,
|
||||
header: true,
|
||||
yCount: 10,
|
||||
columns: [
|
||||
{id: 'id', hidden: true},
|
||||
{id: 'key', adjust: 'data', header: 'Clave'},
|
||||
{id: 'name', adjust: 'data', header: 'Unidad'},
|
||||
],
|
||||
dataFeed:function(text){
|
||||
if (text.length > 1){
|
||||
this.load('/values/satunidadespeso?key=' + text)
|
||||
}else{
|
||||
this.hide()
|
||||
}
|
||||
}
|
||||
},
|
||||
}
|
||||
|
||||
|
||||
var buscar_carta_unidades_peso = {
|
||||
view: 'search',
|
||||
id: 'buscar_carta_unidades_peso',
|
||||
label: 'Buscar Unidad de Peso en el catálogo del SAT',
|
||||
labelPosition: 'top',
|
||||
suggest: suggest_sat_unidades_peso,
|
||||
placeholder: 'Por clave o descripción. Captura al menos tres letras',
|
||||
}
|
||||
|
||||
|
||||
var columns_carta_unidades_peso = [
|
||||
{id: 'id', header: 'ID', hidden: true},
|
||||
{id: 'delete', header: '', width: 30, css: 'delete'},
|
||||
{id: 'key', header: 'Clave'},
|
||||
{id: 'name', header: 'Nombre', adjust: 'data'},
|
||||
{id: 'activo', header: 'Activo', template: '{common.checkbox()}',
|
||||
editor: 'checkbox'},
|
||||
]
|
||||
|
||||
|
||||
var grid_carta_unidades_peso = {
|
||||
view: 'datatable',
|
||||
id: 'grid_carta_unidades_peso',
|
||||
url: 'satunidadespeso?opt=all',
|
||||
select: 'cell',
|
||||
adjust: true,
|
||||
autowidth: true,
|
||||
headermenu: true,
|
||||
columns: columns_carta_unidades_peso,
|
||||
on:{
|
||||
'data->onStoreUpdated':function(){
|
||||
this.data.each(function(obj, i){
|
||||
obj.delete = '-'
|
||||
})
|
||||
}
|
||||
},
|
||||
}
|
||||
|
||||
|
||||
var carta_porte_unidades_peso = [
|
||||
{maxHeight: 20},
|
||||
{cols: [{maxWidth: 15}, buscar_carta_unidades_peso, {}]},
|
||||
{maxHeight: 20},
|
||||
{cols: [{maxWidth: 15}, grid_carta_unidades_peso, {}]},
|
||||
{maxHeight: 20},
|
||||
]
|
||||
|
||||
|
||||
var tab_sat_carta_porte = [{
|
||||
view: 'tabview',
|
||||
id: 'tab_sat_carta_porte',
|
||||
multiview: true,
|
||||
animate: true,
|
||||
cells: [
|
||||
{id: 'Unidades de Peso', rows: carta_porte_unidades_peso},
|
||||
]
|
||||
}]
|
||||
|
||||
|
||||
var tab_sat = {
|
||||
view: 'tabview',
|
||||
id: 'tab_sat',
|
||||
|
@ -1196,6 +1449,8 @@ 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},
|
||||
],
|
||||
}
|
||||
|
||||
|
@ -1227,12 +1482,14 @@ var grid_usuarios_cols = [
|
|||
hidden: true},
|
||||
{id: 'ultimo_ingreso', header: 'Ultimo Ingreso', fillspace: 1,
|
||||
hidden: true},
|
||||
{id: 'in_branch', header: 'En Sucursal', template: '{common.checkbox()}',
|
||||
editor: 'checkbox', adjust: 'header', hidden: true},
|
||||
{id: 'es_activo', header: 'Activo', template: '{common.checkbox()}',
|
||||
editor: 'checkbox', adjust: 'header'},
|
||||
{id: 'es_admin', header: 'Es Admin', template: '{common.checkbox()}',
|
||||
editor: 'checkbox', adjust: 'header'},
|
||||
{id: 'es_superusuario', header: 'Es SU', template: '{common.checkbox()}',
|
||||
editor: 'checkbox', adjust: 'header'},
|
||||
editor: 'checkbox', adjust: 'header', hidden: true},
|
||||
]
|
||||
|
||||
|
||||
|
@ -1241,7 +1498,7 @@ var grid_usuarios = {
|
|||
id: 'grid_usuarios',
|
||||
select: 'row',
|
||||
adjust: true,
|
||||
headermenu: true,
|
||||
headermenu: false,
|
||||
footer: true,
|
||||
columns: grid_usuarios_cols,
|
||||
on:{
|
||||
|
@ -1499,3 +1756,35 @@ var admin_ui_leyendas_fiscales = {
|
|||
|
||||
},
|
||||
}
|
||||
|
||||
|
||||
|
||||
var body_set_branch_user = {rows: [{minHeight: 10},
|
||||
{view: 'text', id: 'txt_user_id', readonly: true, hidden: true},
|
||||
//~ {view: 'text', id: 'txt_user_name', label: 'Usuario', readonly: true},
|
||||
{view: 'richselect', id: 'lst_branchs', name: 'lst_branchs',
|
||||
label: 'Sucursales: ', required: true, options: []},
|
||||
{minHeight: 10},
|
||||
{cols: [{},
|
||||
{view: 'button', id: 'cmd_set_branch_user_save', label: 'Guardar'}, {},
|
||||
{view: 'button', id: 'cmd_set_branch_user_cancel', label: 'Cancelar', type: 'danger'}, {}
|
||||
]},
|
||||
{minHeight: 20},
|
||||
]}
|
||||
|
||||
|
||||
var win_set_branch_user = {
|
||||
init: function(){
|
||||
webix.ui({
|
||||
view: 'window',
|
||||
id: 'win_set_branch_user',
|
||||
width: 400,
|
||||
modal: true,
|
||||
position: 'center',
|
||||
head: 'Asignar Sucursal',
|
||||
body: body_set_branch_user,
|
||||
})
|
||||
$$('cmd_set_branch_user_save').attachEvent('onItemClick', cmd_set_branch_user_save_click)
|
||||
$$('cmd_set_branch_user_cancel').attachEvent('onItemClick', cmd_set_branch_user_cancel_click)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -147,7 +147,7 @@ var grid_cfdi_pay_cols = [
|
|||
{id: 'cliente', header: ['Razón Social'], fillspace: true},
|
||||
{id: 'xml', header: 'XML', adjust: 'data', template: get_icon('xml')},
|
||||
{id: 'pdf', header: 'PDF', adjust: 'data', template: get_icon('pdf')},
|
||||
{id: 'email', header: '', adjust: 'data', template: get_icon('email')}
|
||||
{id: 'email', header: '@', adjust: 'data', template: get_icon('email')}
|
||||
]
|
||||
|
||||
|
||||
|
@ -290,14 +290,13 @@ var grid_bank_invoice_pay_cols = [
|
|||
{id: 'pdf', header: 'PDF', adjust: 'data', template: get_icon('pdf')},
|
||||
//~ {id: 'ods', header: 'ODS', adjust: 'data', template: get_icon('table')},
|
||||
//~ {id: 'zip', header: 'ZIP', adjust: 'data', template: get_icon('zip')},
|
||||
{id: 'email', header: '', adjust: 'data', template: get_icon('email')}
|
||||
{id: 'email', header: '@', adjust: 'data', template: get_icon('email')}
|
||||
]
|
||||
|
||||
|
||||
var grid_bank_invoice_pay = {
|
||||
view: 'datatable',
|
||||
id: 'grid_bank_invoice_pay',
|
||||
//~ subview: sv_grid_invoices,
|
||||
select: 'row',
|
||||
adjust: true,
|
||||
footer: true,
|
||||
|
@ -348,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'}
|
||||
|
@ -366,9 +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'},
|
||||
{},
|
||||
]
|
||||
|
||||
|
@ -607,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)
|
||||
}
|
||||
}
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -59,9 +59,9 @@ var menu_user = {
|
|||
}
|
||||
|
||||
|
||||
var link_blog = "<a class='link_default' target='_blank' href='https://blog.empresalibre.mx'>Blog</a>";
|
||||
var link_forum = "<a class='link_default' target='_blank' href='https://gitlab.com/mauriciobaeza/empresa-libre/issues'>Foro</a>";
|
||||
var link_doc = "<a class='link_default' target='_blank' href='https://doc.empresalibre.mx'>Doc</a>";
|
||||
var link_blog = "<a class='link_default' target='_blank' href='https://empresalibre.net/blog'>Blog</a>";
|
||||
var link_forum = "<a class='link_default' target='_blank' href='https://git.cuates.net/elmau/empresa-libre/issues'>Foro</a>";
|
||||
var link_doc = "<a class='link_default' target='_blank' href='https://empresalibre.net/docs'>Doc</a>";
|
||||
|
||||
|
||||
var ui_main = {
|
||||
|
|
|
@ -57,9 +57,9 @@ var grid_cols_nomina = [
|
|||
adjust: 'data', sort: 'string'},
|
||||
{id: 'total', header: ['Total', {content: 'numberFilter'}], width: 150,
|
||||
sort: 'int', format: webix.i18n.priceFormat, css: 'right',
|
||||
footer: {content: 'summActive', css: 'right'}},
|
||||
footer: {content: 'summTimbradaN', css: 'right'}},
|
||||
{id: "empleado", header: ["Empleado", {content: "selectFilter"}],
|
||||
fillspace:true, sort:"string"},
|
||||
fillspace:true, sort:"string", footer: {text: '$ 0.00'}},
|
||||
{id: 'xml', header: 'XML', adjust: 'data', template: get_icon('xml')},
|
||||
{id: 'pdf', header: 'PDF', adjust: 'data', template: get_icon('pdf')},
|
||||
{id: 'email', header: '@', adjust: 'data', template: get_icon('email')}
|
||||
|
@ -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)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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'},
|
||||
]
|
||||
|
|
|
@ -10,6 +10,12 @@ var toolbar_products = [
|
|||
{},
|
||||
{view: 'button', id: 'cmd_import_products', label: 'Importar',
|
||||
type: 'iconButton', autowidth: true, icon: 'upload'},
|
||||
{view: "button", id: "cmd_add_inventory", label: "Altas", hidden: true,
|
||||
type: "iconButton", autowidth: true, icon: "plus"},
|
||||
{view: "button", id: "cmd_products_add", label: "Altas CFDI", hidden: true,
|
||||
type: "iconButton", autowidth: true, icon: "plus"},
|
||||
{view: 'button', id: 'cmd_show_exists', label: 'Existencias', hidden: true,
|
||||
type: 'iconButton', autowidth: true, icon: 'table'},
|
||||
]
|
||||
|
||||
|
||||
|
@ -105,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,
|
||||
|
@ -135,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",
|
||||
|
@ -158,7 +170,7 @@ var controls_generals = [
|
|||
label: 'Inventario', labelAlign: 'right', labelWidth: 130},
|
||||
{view: 'counter', id: 'txt_existencia', name: 'existencia',
|
||||
hidden: true, label: 'Existencia', step: 5, value: 0, min: 0,
|
||||
disabled: true},
|
||||
disabled: true, readonly: true},
|
||||
{view: 'counter', id: 'txt_minimo', name: 'minimo', hidden: true,
|
||||
label: 'Mínimo', step: 5, value: 0, min: 0, disabled: true},
|
||||
{},]},
|
||||
|
@ -176,8 +188,8 @@ var controls_products = [
|
|||
],
|
||||
},
|
||||
{rows: [
|
||||
{ template:"", type: "section" },
|
||||
{ margin: 10, cols: [{},
|
||||
{template: "", type: "section"},
|
||||
{margin: 10, cols: [{},
|
||||
{view: "button", id: "cmd_save_product", label: "Guardar" , type: "form", autowidth: true, align:"center"},
|
||||
{view: "button", id: "cmd_cancel_product", label: "Cancelar" , type: "danger", autowidth: true, align:"center"},
|
||||
{}]
|
||||
|
@ -202,6 +214,129 @@ var form_product = {
|
|||
}
|
||||
|
||||
|
||||
var toolbar_products_add = {view: 'toolbar', elements: [{},
|
||||
{view: 'button', id: 'cmd_add_products_from_xml', label: 'Desde XML',
|
||||
type: 'iconButton', autowidth: true, icon: 'upload'},
|
||||
{}]}
|
||||
|
||||
|
||||
var rows_pro_add_partner = [
|
||||
{view: 'fieldset', label: 'Buscar Proveedor', body: {rows: [
|
||||
{cols: [
|
||||
{view: 'search', id: 'search_partner_id', label: 'por Clave',
|
||||
labelPosition: 'top', maxWidth: 200, placeholder: 'Captura la clave'},
|
||||
{view: 'search', id: 'search_partner_name', label: 'por Nombre o RFC',
|
||||
labelPosition: 'top', placeholder: 'Captura al menos tres letras'},
|
||||
]},
|
||||
{cols: [
|
||||
{view: 'label', id: 'lbl_partner_title', label: 'Seleccionado: ', autowidth: true},
|
||||
{view: 'label', id: 'lbl_partner', label: 'Ninguno'},
|
||||
]}
|
||||
]}},
|
||||
]
|
||||
|
||||
|
||||
var grid_partner_products_cols = [
|
||||
{id: 'select', header: '', template:'{common.checkbox()}', width:35},
|
||||
{id: 'key', header: {text: 'Clave', css: 'center'}, width: 100,
|
||||
adjust: 'data'},
|
||||
{id: 'key_sat', header:{text: 'Clave SAT', css: 'center'}, width: 100,
|
||||
adjust: 'data'},
|
||||
{id: 'description', header:{text: 'Descripción', css: 'center'},
|
||||
fillspace: true},
|
||||
{id: "pedimento", header: 'Pedimento', editor: 'text', hidden: true},
|
||||
{id: 'unit', header:{text: 'Unidad', css: 'center'}, width: 100,
|
||||
adjust: 'data'},
|
||||
{id: 'unit_value', header:{text: 'Valor Unitario', css: 'center'},
|
||||
width: 100, format: format_currency, css: 'right'},
|
||||
{id: 'cant', header: {text: 'Cantidad', css: 'center'}, width: 50,
|
||||
format: webix.i18n.numberFormat, css: 'right'},
|
||||
{id: 'separate', header: '', width: 25},
|
||||
{id: 'id_product', header: '', hidden: true},
|
||||
{id: 'key1', header:{text: 'Clave', css: 'center'}, width: 100,
|
||||
adjust: true, editor: 'text', hidden: true},
|
||||
{id: 'key_sat1', header:{text: 'Clave SAT', css: 'center'}, width: 100,
|
||||
adjust: true, editor: 'text'},
|
||||
{id: 'description1', header:{text: 'Descripción', css: 'center'},
|
||||
fillspace: true, editor: 'popup'},
|
||||
{id: 'unit_value1', header:{text: 'Valor Unitario', css: 'center'},
|
||||
width: 100, format: format_currency, css: 'right', editor: 'text'},
|
||||
{id: 'cant1', header: {text: 'Cantidad', css: 'center'}, width: 50,
|
||||
format: webix.i18n.numberFormat, css: 'right', editor: 'text'},
|
||||
]
|
||||
|
||||
|
||||
var grid_partner_products = {
|
||||
view: 'datatable',
|
||||
id: 'grid_partner_products',
|
||||
select: 'row',
|
||||
adjust: true,
|
||||
autoheight: true,
|
||||
editable: true,
|
||||
columns: grid_partner_products_cols,
|
||||
data: [],
|
||||
fixedRowHeight: false,
|
||||
on:{
|
||||
onCheck:function(rowId, colId, state){
|
||||
grid_partner_products_select(rowId, state);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
var controls_products_add = [
|
||||
{minHeight: 10, maxHeight: 10},
|
||||
toolbar_products_add,
|
||||
{minHeight: 10, maxHeight: 10},
|
||||
{cols: [
|
||||
{rows: rows_pro_add_partner},
|
||||
{maxWidth: 10},
|
||||
{},
|
||||
]},
|
||||
{view: 'label', label: 'Detalle', height: 30, align: 'left'},
|
||||
{cols: [
|
||||
grid_partner_products,
|
||||
//~ grid_products_add,
|
||||
]},
|
||||
{rows: [
|
||||
{template:"", type: "section" },
|
||||
{margin: 10, cols: [{},
|
||||
{view: 'button', id: 'cmd_save_products_add', label: 'Guardar',
|
||||
autowidth: true, align: 'center'},
|
||||
{},
|
||||
{view: 'button', id: 'cmd_close_products_add', label: 'Cancelar',
|
||||
type: 'danger', autowidth: true, align: 'center'}
|
||||
]
|
||||
},
|
||||
]}
|
||||
]
|
||||
|
||||
|
||||
var controls_form_products_add = [
|
||||
{
|
||||
view: 'tabview',
|
||||
id: 'tv_invoice',
|
||||
animate: true,
|
||||
cells: [
|
||||
{id: 'Altas a inventario', rows: controls_products_add},
|
||||
]
|
||||
},
|
||||
]
|
||||
|
||||
|
||||
var form_products_add = {
|
||||
type: 'space',
|
||||
responsive: true,
|
||||
cols: [{
|
||||
view: 'form',
|
||||
id: 'form_products_add',
|
||||
complexData: true,
|
||||
scroll: true,
|
||||
elements: controls_form_products_add,
|
||||
}]
|
||||
}
|
||||
|
||||
|
||||
var multi_products = {
|
||||
id: "multi_products",
|
||||
animate: true,
|
||||
|
@ -210,7 +345,8 @@ var multi_products = {
|
|||
{view:"toolbar", elements: toolbar_products},
|
||||
grid_products,
|
||||
]},
|
||||
{id: "product_new", rows:[form_product]}
|
||||
{id: "product_new", rows:[form_product]},
|
||||
{id: "product_add", rows:[form_products_add]}
|
||||
],
|
||||
}
|
||||
|
||||
|
@ -255,3 +391,151 @@ var win_import_products = {
|
|||
$$('up_products').attachEvent('onUploadComplete', up_products_upload_complete)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
var body_add_products_from_xml = {rows: [
|
||||
{view: 'form', id: 'form_upload_products_from_xml', rows: [
|
||||
{cols: [{},
|
||||
{view: 'uploader', id: 'up_products_from_xml', autosend: false,
|
||||
link: 'lst_up_products_from_xml', value: 'Seleccionar Archivo',
|
||||
upload: '/files/productsadd'}, {}]},
|
||||
{cols: [
|
||||
{view: 'list', id: 'lst_up_products_from_xml', type: 'uploader',
|
||||
autoheight: true, borderless: true}]},
|
||||
{cols: [{}, {view: 'button', id: 'cmd_upload_products_from_xml',
|
||||
label: 'Cargar Productos'}, {}]},
|
||||
]},
|
||||
]}
|
||||
|
||||
|
||||
var win_add_products_from_xml = {
|
||||
init: function(){
|
||||
webix.ui({
|
||||
view: 'window',
|
||||
id: 'win_add_products_from_xml',
|
||||
width: 400,
|
||||
modal: true,
|
||||
position: 'center',
|
||||
head: 'Agregar Productos desde XML',
|
||||
body: body_add_products_from_xml,
|
||||
})
|
||||
$$('cmd_upload_products_from_xml').attachEvent('onItemClick', cmd_upload_products_from_xml_click)
|
||||
$$('up_products_from_xml').attachEvent('onUploadComplete', up_products_from_xml_upload_complete)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
var body_add_inventory = {rows: [{minHeight: 10},
|
||||
{view: 'text', id: 'txt_add_id', readonly: true, hidden: true},
|
||||
{cols: [
|
||||
{view: 'text', id: 'txt_add_key', label: 'Clave',
|
||||
labelPosition: 'top', readonly: true},
|
||||
{view: 'text', id: 'txt_add_unit', label: 'Unidad',
|
||||
labelPosition: 'top', readonly: true},
|
||||
]},
|
||||
{view: 'textarea', id: 'txt_add_description', height: 100,
|
||||
label: 'Descripción', readonly: true, labelPosition: 'top'},
|
||||
{minHeight: 10},
|
||||
{cols: [
|
||||
{view: 'counter', id: 'txt_new_cant', label: 'Cantidad a agregar',
|
||||
labelWidth: 'auto', step: 1, value: 0, min: 0.01},
|
||||
{view: 'richselect', id: 'lst_warehouses', label: 'Almacen: ',
|
||||
labelPosition: 'left', required: false, options: [], hidden: false},
|
||||
]},
|
||||
{minHeight: 20},
|
||||
{cols: [{},
|
||||
{view: 'button', id: 'cmd_add_inventory_save', label: 'Guardar'}, {},
|
||||
{view: 'button', id: 'cmd_add_inventory_cancel', label: 'Cancelar', type: 'danger'}, {}
|
||||
]},
|
||||
{minHeight: 20},
|
||||
]}
|
||||
|
||||
|
||||
var win_add_inventory = {
|
||||
init: function(){
|
||||
webix.ui({
|
||||
view: 'window',
|
||||
id: 'win_add_inventory',
|
||||
width: 600,
|
||||
modal: true,
|
||||
position: 'center',
|
||||
head: 'Agregar entrada manualmente',
|
||||
body: body_add_inventory,
|
||||
})
|
||||
$$('cmd_add_inventory_save').attachEvent('onItemClick', cmd_add_inventory_save_click)
|
||||
$$('cmd_add_inventory_cancel').attachEvent('onItemClick', cmd_add_inventory_cancel_click)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
var grid_warehouse_exists_cols = [
|
||||
{ id: 'id', header: 'ID', width: 75, hidden: true},
|
||||
{ id: 'warehouse', header: ['Almacen'], fillspace:true,
|
||||
footer: {text: 'Total', css: 'right'}},
|
||||
{ id: 'exists', header: ['Existencia'], width: 100, sort: 'int',
|
||||
format: webix.i18n.numberFormat, css: 'right',
|
||||
footer: {content: 'summColumn', css: 'right'} },
|
||||
]
|
||||
|
||||
|
||||
var grid_warehouse_exists = {
|
||||
view: 'datatable',
|
||||
id: 'grid_warehouse_exists',
|
||||
adjust: true,
|
||||
autoheight: true,
|
||||
select: 'row',
|
||||
footer: true,
|
||||
columns: grid_warehouse_exists_cols,
|
||||
}
|
||||
|
||||
|
||||
var body_win_show_exists = {rows: [{maxHeight: 10, minHeight: 10},
|
||||
{minWidth: 500},
|
||||
{cols: [
|
||||
{maxWidth: 10},
|
||||
{view: 'text', id: 'txt_id_product', readonly: true, hidden: true},
|
||||
grid_warehouse_exists,
|
||||
{maxWidth: 10}
|
||||
]},
|
||||
{maxHeight: 10},
|
||||
{cols: [{maxWidth: 10},
|
||||
{view: 'label', id: 'lbl_title_move', label: 'Primero, selecciona el almacen origen en la tabla superior.'},
|
||||
]},
|
||||
{cols: [{maxWidth: 10},
|
||||
{view: 'counter', id: 'txt_cant_to_move', label: 'Cantidad a mover:',
|
||||
labelPosition: 'top', step: 1, value: 0, min: 0.01},
|
||||
{view: 'richselect', id: 'lst_warehouse_target', label: 'Almacen destino: ',
|
||||
labelPosition: 'top', required: false, options: []}, {maxWidth: 10},
|
||||
{view: 'button', id: 'cmd_warehouse_move', label: 'Mover', maxWidth: 100},
|
||||
{maxWidth: 10}]},
|
||||
{minHeight: 25, maxHeight: 25},
|
||||
{template: 'Ajuste de almacen', type: 'section'},
|
||||
{cols: [{maxWidth: 10},
|
||||
{view: 'counter', id: 'txt_cant_to_adjust', label: 'Cantidad a ajustar:',
|
||||
labelPosition: 'top', step: 1, value: 0, min: -1000000},
|
||||
{view: 'button', id: 'cmd_adjust_stock', label: 'Ajustar', maxWidth: 100},
|
||||
{maxWidth: 10}]},
|
||||
{maxHeight: 20, minHeight: 20},
|
||||
{cols: [{},
|
||||
{view: 'button', id: 'cmd_win_show_exists_close', label: 'Cerrar', type: 'danger'},
|
||||
{}]},
|
||||
{maxHeight: 20, minHeight: 20},
|
||||
]}
|
||||
|
||||
|
||||
var win_show_exists = {
|
||||
init: function(){
|
||||
webix.ui({
|
||||
view: 'window',
|
||||
id: 'win_show_exists',
|
||||
width: 500,
|
||||
modal: true,
|
||||
position: 'center',
|
||||
head: 'Existencia por Almacen',
|
||||
body: body_win_show_exists,
|
||||
})
|
||||
$$('cmd_win_show_exists_close').attachEvent('onItemClick', cmd_win_show_exists_close_click)
|
||||
$$('cmd_warehouse_move').attachEvent('onItemClick', cmd_warehouse_move_click)
|
||||
$$('cmd_adjust_stock').attachEvent('onItemClick', cmd_adjust_stock_click)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,6 +3,8 @@
|
|||
var toolbar_tickets = [
|
||||
{view: 'button', id: 'cmd_nuevo_ticket', label: 'Nuevo', type: 'iconButton',
|
||||
autowidth: true, icon: 'plus'},
|
||||
{view: 'button', id: 'cmd_ticket_from_ticket', label: 'Regenerar',
|
||||
type: 'iconButton', autowidth: true, icon: 'pencil'},
|
||||
{view: 'button', id: 'cmd_ticket_to_invoice', label: 'Facturar',
|
||||
type: 'iconButton', autowidth: true, icon: 'file-code-o'},
|
||||
{},
|
||||
|
@ -145,6 +147,8 @@ var grid_tdetails_cols = [
|
|||
{id: "importe", header:{text: 'Importe', css: 'center'}, width: 150,
|
||||
format: webix.i18n.priceFormat, css: 'right',
|
||||
footer: {content: 'summColumn', css: 'right_footer2'}},
|
||||
{id: "inventario", hidden: true},
|
||||
{id: "existencia", hidden: true},
|
||||
]
|
||||
|
||||
|
||||
|
@ -231,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'}
|
||||
]}
|
||||
|
@ -302,6 +311,7 @@ var grid_tickets_active = {
|
|||
view: 'datatable',
|
||||
id: 'grid_tickets_active',
|
||||
select: 'row',
|
||||
multiselect: true,
|
||||
adjust: true,
|
||||
footer: true,
|
||||
drag: true,
|
||||
|
@ -337,6 +347,7 @@ var grid_tickets_invoice = {
|
|||
view: 'datatable',
|
||||
id: 'grid_tickets_invoice',
|
||||
select: 'row',
|
||||
multiselect: true,
|
||||
adjust: true,
|
||||
footer: true,
|
||||
drag: true,
|
||||
|
@ -478,4 +489,4 @@ var win_ticket_notes = {
|
|||
})
|
||||
$$('cmd_ticket_save_note').attachEvent('onItemClick', cmd_ticket_save_note_click)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -40,6 +40,7 @@ webix.ready(function(){
|
|||
var value = data.json();
|
||||
$$("title_login").setHTML(value);
|
||||
})
|
||||
$$("txt_rfc").focus();
|
||||
});
|
||||
|
||||
</script>
|
||||
|
|
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.
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -1,346 +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="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>
|
||||
|
|
|
@ -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>
|
|
@ -0,0 +1,615 @@
|
|||
<?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:cartaporte20="http://www.sat.gob.mx/CartaPorte20">
|
||||
<xsl:template match="cartaporte20: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="./@TranspInternac"/>
|
||||
</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>
|
||||
<!-- Iniciamos el manejo de los elementos hijo en la secuencia -->
|
||||
<xsl:for-each select="./cartaporte20:Ubicaciones">
|
||||
<xsl:apply-templates select="."/>
|
||||
</xsl:for-each>
|
||||
<xsl:for-each select="./cartaporte20:Mercancias">
|
||||
<xsl:apply-templates select="."/>
|
||||
</xsl:for-each>
|
||||
<xsl:for-each select="./cartaporte20:FiguraTransporte">
|
||||
<xsl:apply-templates select="."/>
|
||||
</xsl:for-each>
|
||||
</xsl:template>
|
||||
<!-- Iniciamos el manejo de los elementos hijo en la secuencia Ubicaciones-->
|
||||
<xsl:template match="cartaporte20:Ubicaciones">
|
||||
<!-- Iniciamos el tratamiento de los atributos de Ubicacion-->
|
||||
<xsl:for-each select="./cartaporte20:Ubicacion">
|
||||
<xsl:apply-templates select="."/>
|
||||
</xsl:for-each>
|
||||
</xsl:template>
|
||||
<!-- Iniciamos el manejo de los elementos hijo en la secuencia Ubicacion-->
|
||||
<xsl:template match="cartaporte20: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 cartaporte20:Domicilio-->
|
||||
<xsl:for-each select="./cartaporte20: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="cartaporte20:Mercancias">
|
||||
<!--Manejador de nodos tipo cartaporte20: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>
|
||||
<!-- Iniciamos el tratamiento de los atributos de cartaporte20:Mercancia-->
|
||||
<xsl:for-each select="./cartaporte20:Mercancia">
|
||||
<xsl:apply-templates select="."/>
|
||||
</xsl:for-each>
|
||||
<!-- Iniciamos el tratamiento de los atributos de cartaporte20:Autotransporte-->
|
||||
<xsl:for-each select="./cartaporte20:Autotransporte">
|
||||
<xsl:apply-templates select="."/>
|
||||
</xsl:for-each>
|
||||
<!-- Iniciamos el tratamiento de los atributos de cartaporte20:TransporteMaritimo-->
|
||||
<xsl:for-each select="./cartaporte20:TransporteMaritimo">
|
||||
<xsl:apply-templates select="."/>
|
||||
</xsl:for-each>
|
||||
<!-- Iniciamos el tratamiento de los atributos de cartaporte20:TransporteAereo-->
|
||||
<xsl:for-each select="./cartaporte20:TransporteAereo">
|
||||
<xsl:apply-templates select="."/>
|
||||
</xsl:for-each>
|
||||
<!-- Iniciamos el tratamiento de los atributos de cartaporte20:TransporteFerroviario-->
|
||||
<xsl:for-each select="./cartaporte20:TransporteFerroviario">
|
||||
<xsl:apply-templates select="."/>
|
||||
</xsl:for-each>
|
||||
</xsl:template>
|
||||
<!-- Iniciamos el manejo de los elementos hijo en la secuencia Mercancia-->
|
||||
<xsl:template match="cartaporte20:Mercancia">
|
||||
<!--Manejador de nodos tipo cartaporte20: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="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>
|
||||
<!-- Iniciamos el tratamiento de los atributos de cartaporte20:Pedimentos-->
|
||||
<xsl:for-each select="./cartaporte20:Pedimentos">
|
||||
<xsl:apply-templates select="."/>
|
||||
</xsl:for-each>
|
||||
<!-- Iniciamos el tratamiento de los atributos de cartaporte20:GuiasIdentificacion-->
|
||||
<xsl:for-each select="./cartaporte20:GuiasIdentificacion">
|
||||
<xsl:apply-templates select="."/>
|
||||
</xsl:for-each>
|
||||
<!-- Iniciamos el tratamiento de los atributos de cartaporte20:CantidadTransporta-->
|
||||
<xsl:for-each select="./cartaporte20:CantidadTransporta">
|
||||
<xsl:apply-templates select="."/>
|
||||
</xsl:for-each>
|
||||
<!-- Iniciamos el tratamiento de los atributos de cartaporte20:DetalleMercancia-->
|
||||
<xsl:for-each select="./cartaporte20:DetalleMercancia">
|
||||
<xsl:apply-templates select="."/>
|
||||
</xsl:for-each>
|
||||
</xsl:template>
|
||||
<!-- Iniciamos el manejo de los elementos hijo en la secuencia Pedimentos-->
|
||||
<xsl:template match="cartaporte20:Pedimentos">
|
||||
<!-- Iniciamos el manejo de los nodos dependientes -->
|
||||
<xsl:call-template name="Requerido">
|
||||
<xsl:with-param name="valor" select="./@Pedimento"/>
|
||||
</xsl:call-template>
|
||||
</xsl:template>
|
||||
<!-- Iniciamos el manejo de los elementos hijo en la secuencia GuiasIdentificacion-->
|
||||
<xsl:template match="cartaporte20: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="cartaporte20: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="cartaporte20: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="cartaporte20:Autotransporte">
|
||||
<!--Manejador de nodos tipo cartaporte20: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 cartaporte20:IdentificacionVehicular-->
|
||||
<xsl:for-each select="./cartaporte20:IdentificacionVehicular">
|
||||
<xsl:apply-templates select="."/>
|
||||
</xsl:for-each>
|
||||
<!-- Iniciamos el tratamiento de los atributos de cartaporte20:Seguros-->
|
||||
<xsl:for-each select="./cartaporte20:Seguros">
|
||||
<xsl:apply-templates select="."/>
|
||||
</xsl:for-each>
|
||||
<!-- Iniciamos el tratamiento de los atributos de cartaporte20:Remolques-->
|
||||
<xsl:for-each select="./cartaporte20:Remolques">
|
||||
<xsl:apply-templates select="."/>
|
||||
</xsl:for-each>
|
||||
</xsl:template>
|
||||
<!-- Iniciamos el manejo de los elementos hijo en la secuencia IdentificacionVehicular-->
|
||||
<xsl:template match="cartaporte20: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="./@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="cartaporte20: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="cartaporte20:Remolques">
|
||||
<!-- Iniciamos el tratamiento de los atributos de cartaporte20:Remolque-->
|
||||
<xsl:for-each select="./cartaporte20:Remolque">
|
||||
<xsl:apply-templates select="."/>
|
||||
</xsl:for-each>
|
||||
</xsl:template>
|
||||
<!-- Iniciamos el manejo de los elementos hijo en la secuencia Remolque-->
|
||||
<xsl:template match="cartaporte20: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="cartaporte20:TransporteMaritimo">
|
||||
<!--Manejador de nodos tipo cartaporte20: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="Requerido">
|
||||
<xsl:with-param name="valor" select="./@NumCertITC"/>
|
||||
</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="./@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>
|
||||
<!-- Iniciamos el tratamiento de los atributos de cartaporte20:Contenedor-->
|
||||
<xsl:for-each select="./cartaporte20: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="./@MatriculaContenedor"/>
|
||||
</xsl:call-template>
|
||||
<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="./@NumPrecinto"/>
|
||||
</xsl:call-template>
|
||||
</xsl:for-each>
|
||||
</xsl:template>
|
||||
<!-- Iniciamos el manejo de los elementos hijo en la secuencia TransporteAereo-->
|
||||
<xsl:template match="cartaporte20:TransporteAereo">
|
||||
<!--Manejador de nodos tipo cartaporte20: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="cartaporte20:TransporteFerroviario">
|
||||
<!--Manejador de nodos tipo cartaporte20: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 cartaporte20:DerechosDePaso-->
|
||||
<xsl:for-each select="./cartaporte20:DerechosDePaso">
|
||||
<xsl:apply-templates select="."/>
|
||||
</xsl:for-each>
|
||||
<!-- Iniciamos el tratamiento de los atributos de cartaporte20:Carro-->
|
||||
<xsl:for-each select="./cartaporte20:Carro">
|
||||
<xsl:apply-templates select="."/>
|
||||
</xsl:for-each>
|
||||
</xsl:template>
|
||||
<!-- Iniciamos el manejo de los elementos hijo en la secuencia DerechosDePaso-->
|
||||
<xsl:template match="cartaporte20: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="cartaporte20:Carro">
|
||||
<!--Manejador de nodos tipo cartaporte20: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 cartaporte20:Contenedor -->
|
||||
<xsl:for-each select="./cartaporte20: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="cartaporte20:FiguraTransporte">
|
||||
<!--Manejador de nodos tipo cartaporte20:FiguraTransporte-->
|
||||
<!-- Iniciamos el tratamiento de los atributos de cartaporte20:TiposFigura-->
|
||||
<xsl:for-each select="./cartaporte20:TiposFigura ">
|
||||
<xsl:apply-templates select="."/>
|
||||
</xsl:for-each>
|
||||
</xsl:template>
|
||||
<!-- Iniciamos el manejo de los elementos hijo en la secuencia TiposFigura-->
|
||||
<xsl:template match="cartaporte20:TiposFigura">
|
||||
<!-- Iniciamos el tratamiento de los atributos de cartaporte20: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="Opcional">
|
||||
<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="./cartaporte20:PartesTransporte">
|
||||
<xsl:apply-templates select="."/>
|
||||
</xsl:for-each>
|
||||
<!-- Iniciamos el tratamiento de los atributos de cartaporte20:Domicilio -->
|
||||
<xsl:for-each select="./cartaporte20: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="cartaporte20:PartesTransporte">
|
||||
<!--Manejador de nodos tipo cartaporte20:PartesTransporte-->
|
||||
<xsl:call-template name="Requerido">
|
||||
<xsl:with-param name="valor" select="./@ParteTransporte"/>
|
||||
</xsl:call-template>
|
||||
</xsl:template>
|
||||
</xsl:stylesheet>
|
|
@ -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>
|
|
@ -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>
|
|
@ -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>
|
|
@ -1,5 +1,5 @@
|
|||
<?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:servicioparcial="http://www.sat.gob.mx/servicioparcialconstruccion">
|
||||
<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" xmlns:servicioparcial="http://www.sat.gob.mx/servicioparcialconstruccion">
|
||||
<xsl:template match="servicioparcial:parcialesconstruccion">
|
||||
<!--Manejador de nodos tipo parcialesconstruccion-->
|
||||
<xsl:call-template name="Requerido">
|
||||
|
|
|
@ -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>
|
||||
|
|
|
@ -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>
|
Loading…
Reference in New Issue