Ejemplo mínimo
This commit is contained in:
commit
725369445a
|
@ -0,0 +1,3 @@
|
||||||
|
conf.py
|
||||||
|
.envi/
|
||||||
|
__pycache__/
|
|
@ -0,0 +1,674 @@
|
||||||
|
GNU GENERAL PUBLIC LICENSE
|
||||||
|
Version 3, 29 June 2007
|
||||||
|
|
||||||
|
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
|
||||||
|
Everyone is permitted to copy and distribute verbatim copies
|
||||||
|
of this license document, but changing it is not allowed.
|
||||||
|
|
||||||
|
Preamble
|
||||||
|
|
||||||
|
The GNU General Public License is a free, copyleft license for
|
||||||
|
software and other kinds of works.
|
||||||
|
|
||||||
|
The licenses for most software and other practical works are designed
|
||||||
|
to take away your freedom to share and change the works. By contrast,
|
||||||
|
the GNU General Public License is intended to guarantee your freedom to
|
||||||
|
share and change all versions of a program--to make sure it remains free
|
||||||
|
software for all its users. We, the Free Software Foundation, use the
|
||||||
|
GNU General Public License for most of our software; it applies also to
|
||||||
|
any other work released this way by its authors. You can apply it to
|
||||||
|
your programs, too.
|
||||||
|
|
||||||
|
When we speak of free software, we are referring to freedom, not
|
||||||
|
price. Our General Public Licenses are designed to make sure that you
|
||||||
|
have the freedom to distribute copies of free software (and charge for
|
||||||
|
them if you wish), that you receive source code or can get it if you
|
||||||
|
want it, that you can change the software or use pieces of it in new
|
||||||
|
free programs, and that you know you can do these things.
|
||||||
|
|
||||||
|
To protect your rights, we need to prevent others from denying you
|
||||||
|
these rights or asking you to surrender the rights. Therefore, you have
|
||||||
|
certain responsibilities if you distribute copies of the software, or if
|
||||||
|
you modify it: responsibilities to respect the freedom of others.
|
||||||
|
|
||||||
|
For example, if you distribute copies of such a program, whether
|
||||||
|
gratis or for a fee, you must pass on to the recipients the same
|
||||||
|
freedoms that you received. You must make sure that they, too, receive
|
||||||
|
or can get the source code. And you must show them these terms so they
|
||||||
|
know their rights.
|
||||||
|
|
||||||
|
Developers that use the GNU GPL protect your rights with two steps:
|
||||||
|
(1) assert copyright on the software, and (2) offer you this License
|
||||||
|
giving you legal permission to copy, distribute and/or modify it.
|
||||||
|
|
||||||
|
For the developers' and authors' protection, the GPL clearly explains
|
||||||
|
that there is no warranty for this free software. For both users' and
|
||||||
|
authors' sake, the GPL requires that modified versions be marked as
|
||||||
|
changed, so that their problems will not be attributed erroneously to
|
||||||
|
authors of previous versions.
|
||||||
|
|
||||||
|
Some devices are designed to deny users access to install or run
|
||||||
|
modified versions of the software inside them, although the manufacturer
|
||||||
|
can do so. This is fundamentally incompatible with the aim of
|
||||||
|
protecting users' freedom to change the software. The systematic
|
||||||
|
pattern of such abuse occurs in the area of products for individuals to
|
||||||
|
use, which is precisely where it is most unacceptable. Therefore, we
|
||||||
|
have designed this version of the GPL to prohibit the practice for those
|
||||||
|
products. If such problems arise substantially in other domains, we
|
||||||
|
stand ready to extend this provision to those domains in future versions
|
||||||
|
of the GPL, as needed to protect the freedom of users.
|
||||||
|
|
||||||
|
Finally, every program is threatened constantly by software patents.
|
||||||
|
States should not allow patents to restrict development and use of
|
||||||
|
software on general-purpose computers, but in those that do, we wish to
|
||||||
|
avoid the special danger that patents applied to a free program could
|
||||||
|
make it effectively proprietary. To prevent this, the GPL assures that
|
||||||
|
patents cannot be used to render the program non-free.
|
||||||
|
|
||||||
|
The precise terms and conditions for copying, distribution and
|
||||||
|
modification follow.
|
||||||
|
|
||||||
|
TERMS AND CONDITIONS
|
||||||
|
|
||||||
|
0. Definitions.
|
||||||
|
|
||||||
|
"This License" refers to version 3 of the GNU General Public License.
|
||||||
|
|
||||||
|
"Copyright" also means copyright-like laws that apply to other kinds of
|
||||||
|
works, such as semiconductor masks.
|
||||||
|
|
||||||
|
"The Program" refers to any copyrightable work licensed under this
|
||||||
|
License. Each licensee is addressed as "you". "Licensees" and
|
||||||
|
"recipients" may be individuals or organizations.
|
||||||
|
|
||||||
|
To "modify" a work means to copy from or adapt all or part of the work
|
||||||
|
in a fashion requiring copyright permission, other than the making of an
|
||||||
|
exact copy. The resulting work is called a "modified version" of the
|
||||||
|
earlier work or a work "based on" the earlier work.
|
||||||
|
|
||||||
|
A "covered work" means either the unmodified Program or a work based
|
||||||
|
on the Program.
|
||||||
|
|
||||||
|
To "propagate" a work means to do anything with it that, without
|
||||||
|
permission, would make you directly or secondarily liable for
|
||||||
|
infringement under applicable copyright law, except executing it on a
|
||||||
|
computer or modifying a private copy. Propagation includes copying,
|
||||||
|
distribution (with or without modification), making available to the
|
||||||
|
public, and in some countries other activities as well.
|
||||||
|
|
||||||
|
To "convey" a work means any kind of propagation that enables other
|
||||||
|
parties to make or receive copies. Mere interaction with a user through
|
||||||
|
a computer network, with no transfer of a copy, is not conveying.
|
||||||
|
|
||||||
|
An interactive user interface displays "Appropriate Legal Notices"
|
||||||
|
to the extent that it includes a convenient and prominently visible
|
||||||
|
feature that (1) displays an appropriate copyright notice, and (2)
|
||||||
|
tells the user that there is no warranty for the work (except to the
|
||||||
|
extent that warranties are provided), that licensees may convey the
|
||||||
|
work under this License, and how to view a copy of this License. If
|
||||||
|
the interface presents a list of user commands or options, such as a
|
||||||
|
menu, a prominent item in the list meets this criterion.
|
||||||
|
|
||||||
|
1. Source Code.
|
||||||
|
|
||||||
|
The "source code" for a work means the preferred form of the work
|
||||||
|
for making modifications to it. "Object code" means any non-source
|
||||||
|
form of a work.
|
||||||
|
|
||||||
|
A "Standard Interface" means an interface that either is an official
|
||||||
|
standard defined by a recognized standards body, or, in the case of
|
||||||
|
interfaces specified for a particular programming language, one that
|
||||||
|
is widely used among developers working in that language.
|
||||||
|
|
||||||
|
The "System Libraries" of an executable work include anything, other
|
||||||
|
than the work as a whole, that (a) is included in the normal form of
|
||||||
|
packaging a Major Component, but which is not part of that Major
|
||||||
|
Component, and (b) serves only to enable use of the work with that
|
||||||
|
Major Component, or to implement a Standard Interface for which an
|
||||||
|
implementation is available to the public in source code form. A
|
||||||
|
"Major Component", in this context, means a major essential component
|
||||||
|
(kernel, window system, and so on) of the specific operating system
|
||||||
|
(if any) on which the executable work runs, or a compiler used to
|
||||||
|
produce the work, or an object code interpreter used to run it.
|
||||||
|
|
||||||
|
The "Corresponding Source" for a work in object code form means all
|
||||||
|
the source code needed to generate, install, and (for an executable
|
||||||
|
work) run the object code and to modify the work, including scripts to
|
||||||
|
control those activities. However, it does not include the work's
|
||||||
|
System Libraries, or general-purpose tools or generally available free
|
||||||
|
programs which are used unmodified in performing those activities but
|
||||||
|
which are not part of the work. For example, Corresponding Source
|
||||||
|
includes interface definition files associated with source files for
|
||||||
|
the work, and the source code for shared libraries and dynamically
|
||||||
|
linked subprograms that the work is specifically designed to require,
|
||||||
|
such as by intimate data communication or control flow between those
|
||||||
|
subprograms and other parts of the work.
|
||||||
|
|
||||||
|
The Corresponding Source need not include anything that users
|
||||||
|
can regenerate automatically from other parts of the Corresponding
|
||||||
|
Source.
|
||||||
|
|
||||||
|
The Corresponding Source for a work in source code form is that
|
||||||
|
same work.
|
||||||
|
|
||||||
|
2. Basic Permissions.
|
||||||
|
|
||||||
|
All rights granted under this License are granted for the term of
|
||||||
|
copyright on the Program, and are irrevocable provided the stated
|
||||||
|
conditions are met. This License explicitly affirms your unlimited
|
||||||
|
permission to run the unmodified Program. The output from running a
|
||||||
|
covered work is covered by this License only if the output, given its
|
||||||
|
content, constitutes a covered work. This License acknowledges your
|
||||||
|
rights of fair use or other equivalent, as provided by copyright law.
|
||||||
|
|
||||||
|
You may make, run and propagate covered works that you do not
|
||||||
|
convey, without conditions so long as your license otherwise remains
|
||||||
|
in force. You may convey covered works to others for the sole purpose
|
||||||
|
of having them make modifications exclusively for you, or provide you
|
||||||
|
with facilities for running those works, provided that you comply with
|
||||||
|
the terms of this License in conveying all material for which you do
|
||||||
|
not control copyright. Those thus making or running the covered works
|
||||||
|
for you must do so exclusively on your behalf, under your direction
|
||||||
|
and control, on terms that prohibit them from making any copies of
|
||||||
|
your copyrighted material outside their relationship with you.
|
||||||
|
|
||||||
|
Conveying under any other circumstances is permitted solely under
|
||||||
|
the conditions stated below. Sublicensing is not allowed; section 10
|
||||||
|
makes it unnecessary.
|
||||||
|
|
||||||
|
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
|
||||||
|
|
||||||
|
No covered work shall be deemed part of an effective technological
|
||||||
|
measure under any applicable law fulfilling obligations under article
|
||||||
|
11 of the WIPO copyright treaty adopted on 20 December 1996, or
|
||||||
|
similar laws prohibiting or restricting circumvention of such
|
||||||
|
measures.
|
||||||
|
|
||||||
|
When you convey a covered work, you waive any legal power to forbid
|
||||||
|
circumvention of technological measures to the extent such circumvention
|
||||||
|
is effected by exercising rights under this License with respect to
|
||||||
|
the covered work, and you disclaim any intention to limit operation or
|
||||||
|
modification of the work as a means of enforcing, against the work's
|
||||||
|
users, your or third parties' legal rights to forbid circumvention of
|
||||||
|
technological measures.
|
||||||
|
|
||||||
|
4. Conveying Verbatim Copies.
|
||||||
|
|
||||||
|
You may convey verbatim copies of the Program's source code as you
|
||||||
|
receive it, in any medium, provided that you conspicuously and
|
||||||
|
appropriately publish on each copy an appropriate copyright notice;
|
||||||
|
keep intact all notices stating that this License and any
|
||||||
|
non-permissive terms added in accord with section 7 apply to the code;
|
||||||
|
keep intact all notices of the absence of any warranty; and give all
|
||||||
|
recipients a copy of this License along with the Program.
|
||||||
|
|
||||||
|
You may charge any price or no price for each copy that you convey,
|
||||||
|
and you may offer support or warranty protection for a fee.
|
||||||
|
|
||||||
|
5. Conveying Modified Source Versions.
|
||||||
|
|
||||||
|
You may convey a work based on the Program, or the modifications to
|
||||||
|
produce it from the Program, in the form of source code under the
|
||||||
|
terms of section 4, provided that you also meet all of these conditions:
|
||||||
|
|
||||||
|
a) The work must carry prominent notices stating that you modified
|
||||||
|
it, and giving a relevant date.
|
||||||
|
|
||||||
|
b) The work must carry prominent notices stating that it is
|
||||||
|
released under this License and any conditions added under section
|
||||||
|
7. This requirement modifies the requirement in section 4 to
|
||||||
|
"keep intact all notices".
|
||||||
|
|
||||||
|
c) You must license the entire work, as a whole, under this
|
||||||
|
License to anyone who comes into possession of a copy. This
|
||||||
|
License will therefore apply, along with any applicable section 7
|
||||||
|
additional terms, to the whole of the work, and all its parts,
|
||||||
|
regardless of how they are packaged. This License gives no
|
||||||
|
permission to license the work in any other way, but it does not
|
||||||
|
invalidate such permission if you have separately received it.
|
||||||
|
|
||||||
|
d) If the work has interactive user interfaces, each must display
|
||||||
|
Appropriate Legal Notices; however, if the Program has interactive
|
||||||
|
interfaces that do not display Appropriate Legal Notices, your
|
||||||
|
work need not make them do so.
|
||||||
|
|
||||||
|
A compilation of a covered work with other separate and independent
|
||||||
|
works, which are not by their nature extensions of the covered work,
|
||||||
|
and which are not combined with it such as to form a larger program,
|
||||||
|
in or on a volume of a storage or distribution medium, is called an
|
||||||
|
"aggregate" if the compilation and its resulting copyright are not
|
||||||
|
used to limit the access or legal rights of the compilation's users
|
||||||
|
beyond what the individual works permit. Inclusion of a covered work
|
||||||
|
in an aggregate does not cause this License to apply to the other
|
||||||
|
parts of the aggregate.
|
||||||
|
|
||||||
|
6. Conveying Non-Source Forms.
|
||||||
|
|
||||||
|
You may convey a covered work in object code form under the terms
|
||||||
|
of sections 4 and 5, provided that you also convey the
|
||||||
|
machine-readable Corresponding Source under the terms of this License,
|
||||||
|
in one of these ways:
|
||||||
|
|
||||||
|
a) Convey the object code in, or embodied in, a physical product
|
||||||
|
(including a physical distribution medium), accompanied by the
|
||||||
|
Corresponding Source fixed on a durable physical medium
|
||||||
|
customarily used for software interchange.
|
||||||
|
|
||||||
|
b) Convey the object code in, or embodied in, a physical product
|
||||||
|
(including a physical distribution medium), accompanied by a
|
||||||
|
written offer, valid for at least three years and valid for as
|
||||||
|
long as you offer spare parts or customer support for that product
|
||||||
|
model, to give anyone who possesses the object code either (1) a
|
||||||
|
copy of the Corresponding Source for all the software in the
|
||||||
|
product that is covered by this License, on a durable physical
|
||||||
|
medium customarily used for software interchange, for a price no
|
||||||
|
more than your reasonable cost of physically performing this
|
||||||
|
conveying of source, or (2) access to copy the
|
||||||
|
Corresponding Source from a network server at no charge.
|
||||||
|
|
||||||
|
c) Convey individual copies of the object code with a copy of the
|
||||||
|
written offer to provide the Corresponding Source. This
|
||||||
|
alternative is allowed only occasionally and noncommercially, and
|
||||||
|
only if you received the object code with such an offer, in accord
|
||||||
|
with subsection 6b.
|
||||||
|
|
||||||
|
d) Convey the object code by offering access from a designated
|
||||||
|
place (gratis or for a charge), and offer equivalent access to the
|
||||||
|
Corresponding Source in the same way through the same place at no
|
||||||
|
further charge. You need not require recipients to copy the
|
||||||
|
Corresponding Source along with the object code. If the place to
|
||||||
|
copy the object code is a network server, the Corresponding Source
|
||||||
|
may be on a different server (operated by you or a third party)
|
||||||
|
that supports equivalent copying facilities, provided you maintain
|
||||||
|
clear directions next to the object code saying where to find the
|
||||||
|
Corresponding Source. Regardless of what server hosts the
|
||||||
|
Corresponding Source, you remain obligated to ensure that it is
|
||||||
|
available for as long as needed to satisfy these requirements.
|
||||||
|
|
||||||
|
e) Convey the object code using peer-to-peer transmission, provided
|
||||||
|
you inform other peers where the object code and Corresponding
|
||||||
|
Source of the work are being offered to the general public at no
|
||||||
|
charge under subsection 6d.
|
||||||
|
|
||||||
|
A separable portion of the object code, whose source code is excluded
|
||||||
|
from the Corresponding Source as a System Library, need not be
|
||||||
|
included in conveying the object code work.
|
||||||
|
|
||||||
|
A "User Product" is either (1) a "consumer product", which means any
|
||||||
|
tangible personal property which is normally used for personal, family,
|
||||||
|
or household purposes, or (2) anything designed or sold for incorporation
|
||||||
|
into a dwelling. In determining whether a product is a consumer product,
|
||||||
|
doubtful cases shall be resolved in favor of coverage. For a particular
|
||||||
|
product received by a particular user, "normally used" refers to a
|
||||||
|
typical or common use of that class of product, regardless of the status
|
||||||
|
of the particular user or of the way in which the particular user
|
||||||
|
actually uses, or expects or is expected to use, the product. A product
|
||||||
|
is a consumer product regardless of whether the product has substantial
|
||||||
|
commercial, industrial or non-consumer uses, unless such uses represent
|
||||||
|
the only significant mode of use of the product.
|
||||||
|
|
||||||
|
"Installation Information" for a User Product means any methods,
|
||||||
|
procedures, authorization keys, or other information required to install
|
||||||
|
and execute modified versions of a covered work in that User Product from
|
||||||
|
a modified version of its Corresponding Source. The information must
|
||||||
|
suffice to ensure that the continued functioning of the modified object
|
||||||
|
code is in no case prevented or interfered with solely because
|
||||||
|
modification has been made.
|
||||||
|
|
||||||
|
If you convey an object code work under this section in, or with, or
|
||||||
|
specifically for use in, a User Product, and the conveying occurs as
|
||||||
|
part of a transaction in which the right of possession and use of the
|
||||||
|
User Product is transferred to the recipient in perpetuity or for a
|
||||||
|
fixed term (regardless of how the transaction is characterized), the
|
||||||
|
Corresponding Source conveyed under this section must be accompanied
|
||||||
|
by the Installation Information. But this requirement does not apply
|
||||||
|
if neither you nor any third party retains the ability to install
|
||||||
|
modified object code on the User Product (for example, the work has
|
||||||
|
been installed in ROM).
|
||||||
|
|
||||||
|
The requirement to provide Installation Information does not include a
|
||||||
|
requirement to continue to provide support service, warranty, or updates
|
||||||
|
for a work that has been modified or installed by the recipient, or for
|
||||||
|
the User Product in which it has been modified or installed. Access to a
|
||||||
|
network may be denied when the modification itself materially and
|
||||||
|
adversely affects the operation of the network or violates the rules and
|
||||||
|
protocols for communication across the network.
|
||||||
|
|
||||||
|
Corresponding Source conveyed, and Installation Information provided,
|
||||||
|
in accord with this section must be in a format that is publicly
|
||||||
|
documented (and with an implementation available to the public in
|
||||||
|
source code form), and must require no special password or key for
|
||||||
|
unpacking, reading or copying.
|
||||||
|
|
||||||
|
7. Additional Terms.
|
||||||
|
|
||||||
|
"Additional permissions" are terms that supplement the terms of this
|
||||||
|
License by making exceptions from one or more of its conditions.
|
||||||
|
Additional permissions that are applicable to the entire Program shall
|
||||||
|
be treated as though they were included in this License, to the extent
|
||||||
|
that they are valid under applicable law. If additional permissions
|
||||||
|
apply only to part of the Program, that part may be used separately
|
||||||
|
under those permissions, but the entire Program remains governed by
|
||||||
|
this License without regard to the additional permissions.
|
||||||
|
|
||||||
|
When you convey a copy of a covered work, you may at your option
|
||||||
|
remove any additional permissions from that copy, or from any part of
|
||||||
|
it. (Additional permissions may be written to require their own
|
||||||
|
removal in certain cases when you modify the work.) You may place
|
||||||
|
additional permissions on material, added by you to a covered work,
|
||||||
|
for which you have or can give appropriate copyright permission.
|
||||||
|
|
||||||
|
Notwithstanding any other provision of this License, for material you
|
||||||
|
add to a covered work, you may (if authorized by the copyright holders of
|
||||||
|
that material) supplement the terms of this License with terms:
|
||||||
|
|
||||||
|
a) Disclaiming warranty or limiting liability differently from the
|
||||||
|
terms of sections 15 and 16 of this License; or
|
||||||
|
|
||||||
|
b) Requiring preservation of specified reasonable legal notices or
|
||||||
|
author attributions in that material or in the Appropriate Legal
|
||||||
|
Notices displayed by works containing it; or
|
||||||
|
|
||||||
|
c) Prohibiting misrepresentation of the origin of that material, or
|
||||||
|
requiring that modified versions of such material be marked in
|
||||||
|
reasonable ways as different from the original version; or
|
||||||
|
|
||||||
|
d) Limiting the use for publicity purposes of names of licensors or
|
||||||
|
authors of the material; or
|
||||||
|
|
||||||
|
e) Declining to grant rights under trademark law for use of some
|
||||||
|
trade names, trademarks, or service marks; or
|
||||||
|
|
||||||
|
f) Requiring indemnification of licensors and authors of that
|
||||||
|
material by anyone who conveys the material (or modified versions of
|
||||||
|
it) with contractual assumptions of liability to the recipient, for
|
||||||
|
any liability that these contractual assumptions directly impose on
|
||||||
|
those licensors and authors.
|
||||||
|
|
||||||
|
All other non-permissive additional terms are considered "further
|
||||||
|
restrictions" within the meaning of section 10. If the Program as you
|
||||||
|
received it, or any part of it, contains a notice stating that it is
|
||||||
|
governed by this License along with a term that is a further
|
||||||
|
restriction, you may remove that term. If a license document contains
|
||||||
|
a further restriction but permits relicensing or conveying under this
|
||||||
|
License, you may add to a covered work material governed by the terms
|
||||||
|
of that license document, provided that the further restriction does
|
||||||
|
not survive such relicensing or conveying.
|
||||||
|
|
||||||
|
If you add terms to a covered work in accord with this section, you
|
||||||
|
must place, in the relevant source files, a statement of the
|
||||||
|
additional terms that apply to those files, or a notice indicating
|
||||||
|
where to find the applicable terms.
|
||||||
|
|
||||||
|
Additional terms, permissive or non-permissive, may be stated in the
|
||||||
|
form of a separately written license, or stated as exceptions;
|
||||||
|
the above requirements apply either way.
|
||||||
|
|
||||||
|
8. Termination.
|
||||||
|
|
||||||
|
You may not propagate or modify a covered work except as expressly
|
||||||
|
provided under this License. Any attempt otherwise to propagate or
|
||||||
|
modify it is void, and will automatically terminate your rights under
|
||||||
|
this License (including any patent licenses granted under the third
|
||||||
|
paragraph of section 11).
|
||||||
|
|
||||||
|
However, if you cease all violation of this License, then your
|
||||||
|
license from a particular copyright holder is reinstated (a)
|
||||||
|
provisionally, unless and until the copyright holder explicitly and
|
||||||
|
finally terminates your license, and (b) permanently, if the copyright
|
||||||
|
holder fails to notify you of the violation by some reasonable means
|
||||||
|
prior to 60 days after the cessation.
|
||||||
|
|
||||||
|
Moreover, your license from a particular copyright holder is
|
||||||
|
reinstated permanently if the copyright holder notifies you of the
|
||||||
|
violation by some reasonable means, this is the first time you have
|
||||||
|
received notice of violation of this License (for any work) from that
|
||||||
|
copyright holder, and you cure the violation prior to 30 days after
|
||||||
|
your receipt of the notice.
|
||||||
|
|
||||||
|
Termination of your rights under this section does not terminate the
|
||||||
|
licenses of parties who have received copies or rights from you under
|
||||||
|
this License. If your rights have been terminated and not permanently
|
||||||
|
reinstated, you do not qualify to receive new licenses for the same
|
||||||
|
material under section 10.
|
||||||
|
|
||||||
|
9. Acceptance Not Required for Having Copies.
|
||||||
|
|
||||||
|
You are not required to accept this License in order to receive or
|
||||||
|
run a copy of the Program. Ancillary propagation of a covered work
|
||||||
|
occurring solely as a consequence of using peer-to-peer transmission
|
||||||
|
to receive a copy likewise does not require acceptance. However,
|
||||||
|
nothing other than this License grants you permission to propagate or
|
||||||
|
modify any covered work. These actions infringe copyright if you do
|
||||||
|
not accept this License. Therefore, by modifying or propagating a
|
||||||
|
covered work, you indicate your acceptance of this License to do so.
|
||||||
|
|
||||||
|
10. Automatic Licensing of Downstream Recipients.
|
||||||
|
|
||||||
|
Each time you convey a covered work, the recipient automatically
|
||||||
|
receives a license from the original licensors, to run, modify and
|
||||||
|
propagate that work, subject to this License. You are not responsible
|
||||||
|
for enforcing compliance by third parties with this License.
|
||||||
|
|
||||||
|
An "entity transaction" is a transaction transferring control of an
|
||||||
|
organization, or substantially all assets of one, or subdividing an
|
||||||
|
organization, or merging organizations. If propagation of a covered
|
||||||
|
work results from an entity transaction, each party to that
|
||||||
|
transaction who receives a copy of the work also receives whatever
|
||||||
|
licenses to the work the party's predecessor in interest had or could
|
||||||
|
give under the previous paragraph, plus a right to possession of the
|
||||||
|
Corresponding Source of the work from the predecessor in interest, if
|
||||||
|
the predecessor has it or can get it with reasonable efforts.
|
||||||
|
|
||||||
|
You may not impose any further restrictions on the exercise of the
|
||||||
|
rights granted or affirmed under this License. For example, you may
|
||||||
|
not impose a license fee, royalty, or other charge for exercise of
|
||||||
|
rights granted under this License, and you may not initiate litigation
|
||||||
|
(including a cross-claim or counterclaim in a lawsuit) alleging that
|
||||||
|
any patent claim is infringed by making, using, selling, offering for
|
||||||
|
sale, or importing the Program or any portion of it.
|
||||||
|
|
||||||
|
11. Patents.
|
||||||
|
|
||||||
|
A "contributor" is a copyright holder who authorizes use under this
|
||||||
|
License of the Program or a work on which the Program is based. The
|
||||||
|
work thus licensed is called the contributor's "contributor version".
|
||||||
|
|
||||||
|
A contributor's "essential patent claims" are all patent claims
|
||||||
|
owned or controlled by the contributor, whether already acquired or
|
||||||
|
hereafter acquired, that would be infringed by some manner, permitted
|
||||||
|
by this License, of making, using, or selling its contributor version,
|
||||||
|
but do not include claims that would be infringed only as a
|
||||||
|
consequence of further modification of the contributor version. For
|
||||||
|
purposes of this definition, "control" includes the right to grant
|
||||||
|
patent sublicenses in a manner consistent with the requirements of
|
||||||
|
this License.
|
||||||
|
|
||||||
|
Each contributor grants you a non-exclusive, worldwide, royalty-free
|
||||||
|
patent license under the contributor's essential patent claims, to
|
||||||
|
make, use, sell, offer for sale, import and otherwise run, modify and
|
||||||
|
propagate the contents of its contributor version.
|
||||||
|
|
||||||
|
In the following three paragraphs, a "patent license" is any express
|
||||||
|
agreement or commitment, however denominated, not to enforce a patent
|
||||||
|
(such as an express permission to practice a patent or covenant not to
|
||||||
|
sue for patent infringement). To "grant" such a patent license to a
|
||||||
|
party means to make such an agreement or commitment not to enforce a
|
||||||
|
patent against the party.
|
||||||
|
|
||||||
|
If you convey a covered work, knowingly relying on a patent license,
|
||||||
|
and the Corresponding Source of the work is not available for anyone
|
||||||
|
to copy, free of charge and under the terms of this License, through a
|
||||||
|
publicly available network server or other readily accessible means,
|
||||||
|
then you must either (1) cause the Corresponding Source to be so
|
||||||
|
available, or (2) arrange to deprive yourself of the benefit of the
|
||||||
|
patent license for this particular work, or (3) arrange, in a manner
|
||||||
|
consistent with the requirements of this License, to extend the patent
|
||||||
|
license to downstream recipients. "Knowingly relying" means you have
|
||||||
|
actual knowledge that, but for the patent license, your conveying the
|
||||||
|
covered work in a country, or your recipient's use of the covered work
|
||||||
|
in a country, would infringe one or more identifiable patents in that
|
||||||
|
country that you have reason to believe are valid.
|
||||||
|
|
||||||
|
If, pursuant to or in connection with a single transaction or
|
||||||
|
arrangement, you convey, or propagate by procuring conveyance of, a
|
||||||
|
covered work, and grant a patent license to some of the parties
|
||||||
|
receiving the covered work authorizing them to use, propagate, modify
|
||||||
|
or convey a specific copy of the covered work, then the patent license
|
||||||
|
you grant is automatically extended to all recipients of the covered
|
||||||
|
work and works based on it.
|
||||||
|
|
||||||
|
A patent license is "discriminatory" if it does not include within
|
||||||
|
the scope of its coverage, prohibits the exercise of, or is
|
||||||
|
conditioned on the non-exercise of one or more of the rights that are
|
||||||
|
specifically granted under this License. You may not convey a covered
|
||||||
|
work if you are a party to an arrangement with a third party that is
|
||||||
|
in the business of distributing software, under which you make payment
|
||||||
|
to the third party based on the extent of your activity of conveying
|
||||||
|
the work, and under which the third party grants, to any of the
|
||||||
|
parties who would receive the covered work from you, a discriminatory
|
||||||
|
patent license (a) in connection with copies of the covered work
|
||||||
|
conveyed by you (or copies made from those copies), or (b) primarily
|
||||||
|
for and in connection with specific products or compilations that
|
||||||
|
contain the covered work, unless you entered into that arrangement,
|
||||||
|
or that patent license was granted, prior to 28 March 2007.
|
||||||
|
|
||||||
|
Nothing in this License shall be construed as excluding or limiting
|
||||||
|
any implied license or other defenses to infringement that may
|
||||||
|
otherwise be available to you under applicable patent law.
|
||||||
|
|
||||||
|
12. No Surrender of Others' Freedom.
|
||||||
|
|
||||||
|
If conditions are imposed on you (whether by court order, agreement or
|
||||||
|
otherwise) that contradict the conditions of this License, they do not
|
||||||
|
excuse you from the conditions of this License. If you cannot convey a
|
||||||
|
covered work so as to satisfy simultaneously your obligations under this
|
||||||
|
License and any other pertinent obligations, then as a consequence you may
|
||||||
|
not convey it at all. For example, if you agree to terms that obligate you
|
||||||
|
to collect a royalty for further conveying from those to whom you convey
|
||||||
|
the Program, the only way you could satisfy both those terms and this
|
||||||
|
License would be to refrain entirely from conveying the Program.
|
||||||
|
|
||||||
|
13. Use with the GNU Affero General Public License.
|
||||||
|
|
||||||
|
Notwithstanding any other provision of this License, you have
|
||||||
|
permission to link or combine any covered work with a work licensed
|
||||||
|
under version 3 of the GNU Affero General Public License into a single
|
||||||
|
combined work, and to convey the resulting work. The terms of this
|
||||||
|
License will continue to apply to the part which is the covered work,
|
||||||
|
but the special requirements of the GNU Affero General Public License,
|
||||||
|
section 13, concerning interaction through a network will apply to the
|
||||||
|
combination as such.
|
||||||
|
|
||||||
|
14. Revised Versions of this License.
|
||||||
|
|
||||||
|
The Free Software Foundation may publish revised and/or new versions of
|
||||||
|
the GNU General Public License from time to time. Such new versions will
|
||||||
|
be similar in spirit to the present version, but may differ in detail to
|
||||||
|
address new problems or concerns.
|
||||||
|
|
||||||
|
Each version is given a distinguishing version number. If the
|
||||||
|
Program specifies that a certain numbered version of the GNU General
|
||||||
|
Public License "or any later version" applies to it, you have the
|
||||||
|
option of following the terms and conditions either of that numbered
|
||||||
|
version or of any later version published by the Free Software
|
||||||
|
Foundation. If the Program does not specify a version number of the
|
||||||
|
GNU General Public License, you may choose any version ever published
|
||||||
|
by the Free Software Foundation.
|
||||||
|
|
||||||
|
If the Program specifies that a proxy can decide which future
|
||||||
|
versions of the GNU General Public License can be used, that proxy's
|
||||||
|
public statement of acceptance of a version permanently authorizes you
|
||||||
|
to choose that version for the Program.
|
||||||
|
|
||||||
|
Later license versions may give you additional or different
|
||||||
|
permissions. However, no additional obligations are imposed on any
|
||||||
|
author or copyright holder as a result of your choosing to follow a
|
||||||
|
later version.
|
||||||
|
|
||||||
|
15. Disclaimer of Warranty.
|
||||||
|
|
||||||
|
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
|
||||||
|
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
|
||||||
|
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
|
||||||
|
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
|
||||||
|
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||||
|
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
|
||||||
|
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
|
||||||
|
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
|
||||||
|
|
||||||
|
16. Limitation of Liability.
|
||||||
|
|
||||||
|
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
||||||
|
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
|
||||||
|
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
|
||||||
|
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
|
||||||
|
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
|
||||||
|
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
|
||||||
|
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
|
||||||
|
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
|
||||||
|
SUCH DAMAGES.
|
||||||
|
|
||||||
|
17. Interpretation of Sections 15 and 16.
|
||||||
|
|
||||||
|
If the disclaimer of warranty and limitation of liability provided
|
||||||
|
above cannot be given local legal effect according to their terms,
|
||||||
|
reviewing courts shall apply local law that most closely approximates
|
||||||
|
an absolute waiver of all civil liability in connection with the
|
||||||
|
Program, unless a warranty or assumption of liability accompanies a
|
||||||
|
copy of the Program in return for a fee.
|
||||||
|
|
||||||
|
END OF TERMS AND CONDITIONS
|
||||||
|
|
||||||
|
How to Apply These Terms to Your New Programs
|
||||||
|
|
||||||
|
If you develop a new program, and you want it to be of the greatest
|
||||||
|
possible use to the public, the best way to achieve this is to make it
|
||||||
|
free software which everyone can redistribute and change under these terms.
|
||||||
|
|
||||||
|
To do so, attach the following notices to the program. It is safest
|
||||||
|
to attach them to the start of each source file to most effectively
|
||||||
|
state the exclusion of warranty; and each file should have at least
|
||||||
|
the "copyright" line and a pointer to where the full notice is found.
|
||||||
|
|
||||||
|
admin-cfdi
|
||||||
|
Copyright (C) 2016 Mauricio Baeza
|
||||||
|
|
||||||
|
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/>.
|
||||||
|
|
||||||
|
Also add information on how to contact you by electronic and paper mail.
|
||||||
|
|
||||||
|
If the program does terminal interaction, make it output a short
|
||||||
|
notice like this when it starts in an interactive mode:
|
||||||
|
|
||||||
|
admin-cfdi Copyright (C) 2016 Mauricio Baeza
|
||||||
|
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
|
||||||
|
This is free software, and you are welcome to redistribute it
|
||||||
|
under certain conditions; type `show c' for details.
|
||||||
|
|
||||||
|
The hypothetical commands `show w' and `show c' should show the appropriate
|
||||||
|
parts of the General Public License. Of course, your program's commands
|
||||||
|
might be different; for a GUI interface, you would use an "about box".
|
||||||
|
|
||||||
|
You should also get your employer (if you work as a programmer) or school,
|
||||||
|
if any, to sign a "copyright disclaimer" for the program, if necessary.
|
||||||
|
For more information on this, and how to apply and follow the GNU GPL, see
|
||||||
|
<http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
The GNU General Public License does not permit incorporating your program
|
||||||
|
into proprietary programs. If your program is a subroutine library, you
|
||||||
|
may consider it more useful to permit linking proprietary applications with
|
||||||
|
the library. If this is what you want to do, use the GNU Lesser General
|
||||||
|
Public License instead of this License. But first, please read
|
||||||
|
<http://www.gnu.org/philosophy/why-not-lgpl.html>.
|
|
@ -0,0 +1,55 @@
|
||||||
|
{
|
||||||
|
"comprobante" : {
|
||||||
|
"NoCertificado": "20001000000300022815",
|
||||||
|
"TipoCambio": "1",
|
||||||
|
"Moneda": "MXN",
|
||||||
|
"TipoDeComprobante": "I",
|
||||||
|
"LugarExpedicion": "06850",
|
||||||
|
"SubTotal": "1000.00",
|
||||||
|
"Total": "1160.00",
|
||||||
|
"FormaPago": "03",
|
||||||
|
"MetodoPago": "PUE"
|
||||||
|
},
|
||||||
|
"emisor": {
|
||||||
|
"Rfc": "LAN7008173R5",
|
||||||
|
"RegimenFiscal": "601"
|
||||||
|
},
|
||||||
|
"receptor": {
|
||||||
|
"Rfc": "XEXX010101000",
|
||||||
|
"UsoCFDI": "G01",
|
||||||
|
"ResidenciaFiscal": "FRA",
|
||||||
|
"NumRegIdTrib": "1234567890"
|
||||||
|
},
|
||||||
|
"conceptos": [
|
||||||
|
{
|
||||||
|
"ClaveProdServ": "60121001",
|
||||||
|
"Cantidad": "1.0",
|
||||||
|
"ClaveUnidad": "KGM",
|
||||||
|
"Descripcion": "Asesoría en desarrollo",
|
||||||
|
"ValorUnitario": "1000.00",
|
||||||
|
"Importe": "1000.00",
|
||||||
|
"impuestos": {
|
||||||
|
"traslados": [
|
||||||
|
{
|
||||||
|
"Base": "1000.00",
|
||||||
|
"Impuesto": "002",
|
||||||
|
"TipoFactor": "Tasa",
|
||||||
|
"TasaOCuota": "0.160000",
|
||||||
|
"Importe": "160.00"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"impuestos": {
|
||||||
|
"TotalImpuestosTrasladados": "160.00",
|
||||||
|
"traslados": [
|
||||||
|
{
|
||||||
|
"Impuesto": "002",
|
||||||
|
"TipoFactor": "Tasa",
|
||||||
|
"TasaOCuota": "0.160000",
|
||||||
|
"Importe": "160.00"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,53 @@
|
||||||
|
{
|
||||||
|
"comprobante" : {
|
||||||
|
"NoCertificado": "20001000000300022815",
|
||||||
|
"TipoCambio": "1",
|
||||||
|
"Moneda": "MXN",
|
||||||
|
"TipoDeComprobante": "I",
|
||||||
|
"LugarExpedicion": "06850",
|
||||||
|
"SubTotal": "1000.00",
|
||||||
|
"Total": "1160.00",
|
||||||
|
"FormaPago": "03",
|
||||||
|
"MetodoPago": "PUE"
|
||||||
|
},
|
||||||
|
"emisor": {
|
||||||
|
"Rfc": "LAN7008173R5",
|
||||||
|
"RegimenFiscal": "601"
|
||||||
|
},
|
||||||
|
"receptor": {
|
||||||
|
"Rfc": "BASM740115RW0",
|
||||||
|
"UsoCFDI": "G01"
|
||||||
|
},
|
||||||
|
"conceptos": [
|
||||||
|
{
|
||||||
|
"ClaveProdServ": "60121001",
|
||||||
|
"Cantidad": "1.0",
|
||||||
|
"ClaveUnidad": "KGM",
|
||||||
|
"Descripcion": "Asesoría en desarrollo",
|
||||||
|
"ValorUnitario": "1000.00",
|
||||||
|
"Importe": "1000.00",
|
||||||
|
"impuestos": {
|
||||||
|
"traslados": [
|
||||||
|
{
|
||||||
|
"Base": "1000.00",
|
||||||
|
"Impuesto": "002",
|
||||||
|
"TipoFactor": "Tasa",
|
||||||
|
"TasaOCuota": "0.160000",
|
||||||
|
"Importe": "160.00"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"impuestos": {
|
||||||
|
"TotalImpuestosTrasladados": "160.00",
|
||||||
|
"traslados": [
|
||||||
|
{
|
||||||
|
"Impuesto": "002",
|
||||||
|
"TipoFactor": "Tasa",
|
||||||
|
"TasaOCuota": "0.160000",
|
||||||
|
"Importe": "160.00"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,109 @@
|
||||||
|
{
|
||||||
|
"comprobante" : {
|
||||||
|
"NoCertificado": "20001000000300022815",
|
||||||
|
"Moneda": "MXN",
|
||||||
|
"TipoDeComprobante": "N",
|
||||||
|
"LugarExpedicion": "06850",
|
||||||
|
"SubTotal": "3616.28",
|
||||||
|
"Descuento": "365.28",
|
||||||
|
"Total": "3251.00",
|
||||||
|
"FormaPago": "99",
|
||||||
|
"MetodoPago": "PUE"
|
||||||
|
},
|
||||||
|
"emisor": {
|
||||||
|
"Rfc": "LAN7008173R5",
|
||||||
|
"RegimenFiscal": "603"
|
||||||
|
},
|
||||||
|
"receptor": {
|
||||||
|
"Rfc": "BASM740115RW0",
|
||||||
|
"UsoCFDI": "P01"
|
||||||
|
},
|
||||||
|
"conceptos": [
|
||||||
|
{
|
||||||
|
"ClaveProdServ": "84111505",
|
||||||
|
"Cantidad": "1",
|
||||||
|
"ClaveUnidad": "ACT",
|
||||||
|
"Descripcion": "Pago de nómina",
|
||||||
|
"ValorUnitario": "3616.28",
|
||||||
|
"Importe": "3616.28",
|
||||||
|
"Descuento": "365.28"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"nomina": {
|
||||||
|
"TipoNomina": "O",
|
||||||
|
"FechaPago": "2020-01-15",
|
||||||
|
"FechaInicialPago": "2020-01-01",
|
||||||
|
"FechaFinalPago": "2020-01-15",
|
||||||
|
"NumDiasPagados": "15.000",
|
||||||
|
"TotalPercepciones": "3491.18",
|
||||||
|
"TotalDeducciones": "365.28",
|
||||||
|
"TotalOtrosPagos": "125.10",
|
||||||
|
"emisor": {"RegistroPatronal": "1234567890"},
|
||||||
|
"receptor": {
|
||||||
|
"Curp": "BASM740115HDFZRR09",
|
||||||
|
"TipoContrato": "01",
|
||||||
|
"Sindicalizado": "No",
|
||||||
|
"TipoJornada": "01",
|
||||||
|
"TipoRegimen": "02",
|
||||||
|
"NumEmpleado": "1",
|
||||||
|
"PeriodicidadPago": "02",
|
||||||
|
"ClaveEntFed": "DIF",
|
||||||
|
"RiesgoPuesto": "1",
|
||||||
|
"NumSeguridadSocial": "1234567890",
|
||||||
|
"FechaInicioRelLaboral": "2018-01-01",
|
||||||
|
"Antigüedad": "P106W",
|
||||||
|
"Departamento": "Técnico",
|
||||||
|
"Puesto": "Desarrollador",
|
||||||
|
"SalarioBaseCotApor": "100.00",
|
||||||
|
"SalarioDiarioIntegrado": "150.00"
|
||||||
|
},
|
||||||
|
"percepciones": {
|
||||||
|
"TotalSueldos": "3491.18",
|
||||||
|
"TotalGravado": "3491.18",
|
||||||
|
"TotalExento": "0.00",
|
||||||
|
"percepciones": [
|
||||||
|
{
|
||||||
|
"TipoPercepcion": "001",
|
||||||
|
"Clave": "001",
|
||||||
|
"Concepto": "Sueldos, Salarios Rayas y Jornales",
|
||||||
|
"ImporteGravado": "3491.00",
|
||||||
|
"ImporteExento": "0.00"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"TipoPercepcion": "038",
|
||||||
|
"Clave": "038",
|
||||||
|
"Concepto": "Otros ingresos por salarios",
|
||||||
|
"ImporteGravado": "0.18",
|
||||||
|
"ImporteExento": "0.0"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"deducciones": {
|
||||||
|
"TotalOtrasDeducciones": "89.54",
|
||||||
|
"TotalImpuestosRetenidos": "275.74",
|
||||||
|
"deducciones": [
|
||||||
|
{
|
||||||
|
"TipoDeduccion": "001",
|
||||||
|
"Clave": "001",
|
||||||
|
"Concepto": "Seguridad social",
|
||||||
|
"Importe": "89.54"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"TipoDeduccion": "002",
|
||||||
|
"Clave": "002",
|
||||||
|
"Concepto": "ISR",
|
||||||
|
"Importe": "275.74"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"otros": [
|
||||||
|
{
|
||||||
|
"TipoOtroPago": "002",
|
||||||
|
"Clave": "002",
|
||||||
|
"Concepto": "Subsidio para el empleo (efectivamente entregado al trabajador).",
|
||||||
|
"Importe": "125.10",
|
||||||
|
"subsidio": {"SubsidioCausado": "125.10"}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,47 @@
|
||||||
|
{
|
||||||
|
"comprobante" : {
|
||||||
|
"NoCertificado": "20001000000300022815",
|
||||||
|
"Moneda": "XXX",
|
||||||
|
"TipoDeComprobante": "P",
|
||||||
|
"LugarExpedicion": "06850",
|
||||||
|
"SubTotal": "0",
|
||||||
|
"Total": "0"
|
||||||
|
},
|
||||||
|
"emisor": {
|
||||||
|
"Rfc": "LAN7008173R5",
|
||||||
|
"RegimenFiscal": "601"
|
||||||
|
},
|
||||||
|
"receptor": {
|
||||||
|
"Rfc": "BASM740115RW0",
|
||||||
|
"UsoCFDI": "P01"
|
||||||
|
},
|
||||||
|
"conceptos": [
|
||||||
|
{
|
||||||
|
"ClaveProdServ": "84111506",
|
||||||
|
"Cantidad": "1",
|
||||||
|
"ClaveUnidad": "ACT",
|
||||||
|
"Descripcion": "Pago",
|
||||||
|
"ValorUnitario": "0",
|
||||||
|
"Importe": "0"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"pagos": [
|
||||||
|
{
|
||||||
|
"FechaPago": "2020-08-07T12:00:00",
|
||||||
|
"FormaDePagoP": "03",
|
||||||
|
"MonedaP": "MXN",
|
||||||
|
"Monto": "6073.60",
|
||||||
|
"documentos": [
|
||||||
|
{
|
||||||
|
"IdDocumento": "5243138D-EE4B-4B1B-A648-320DCC4E3BD2",
|
||||||
|
"ImpPagado": "6073.60",
|
||||||
|
"ImpSaldoAnt": "6073.60",
|
||||||
|
"ImpSaldoInsoluto": "0.00",
|
||||||
|
"MetodoDePagoDR": "PPD",
|
||||||
|
"MonedaDR": "MXN",
|
||||||
|
"NumParcialidad": "1"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
|
@ -0,0 +1,5 @@
|
||||||
|
zeep
|
||||||
|
cryptography==3.4.8
|
||||||
|
xmlsec
|
||||||
|
requests
|
||||||
|
lxml
|
Binary file not shown.
|
@ -0,0 +1,30 @@
|
||||||
|
-----BEGIN ENCRYPTED PRIVATE KEY-----
|
||||||
|
MIIFLTBXBgkqhkiG9w0BBQ0wSjApBgkqhkiG9w0BBQwwHAQIbcmTswxglkkCAggA
|
||||||
|
MAwGCCqGSIb3DQIJBQAwHQYJYIZIAWUDBAEqBBCB2rK1c+Dg9ExJwpnxk+1ABIIE
|
||||||
|
0FOXSreqq2Ol13qnqN7J1b6Sd9cb8SAynK9qTJLt3GtXLJOeehMg6npEcTNrlvsP
|
||||||
|
k/Xxyv+thiwgJmsajWQp9ujoyrx/4T5Gsd3MjAxUa6uvJt2sdYWl5fGEbgNqwM9S
|
||||||
|
0CwydTNaEJhkkhUrUF+FAMD4Cjmb1b+gUpfr9QkJoHvkPcz7zuOkBp8Fjecfkm9a
|
||||||
|
F6YuuvR3ClXDu2i7b2nobdMA5Z50Msy8vOZwYzI28sxfzgyw/K7T8IXc8pSyMphE
|
||||||
|
N8aGGKfMBEY/QS5a2nukIGxeP0fkZPjfQUUflchIEqvAD9fvrOMco7pLmHJpWXRh
|
||||||
|
4F2yZhNzyfY1mzYLpaAEf9LQy4MCV4GW0AFTAGZaeSNTAHQgdQllaHf/TPVJDmQL
|
||||||
|
09cPDb3ptbqSxIIB6MTi+RdUMt3eo0PwKJc5PnilV5VjR0hSTQLib8u7Yirzhf/6
|
||||||
|
kYo4MQ3iHhgaV59HWm8BIhUzZbxOnKo7rutEul0iRoudNU7x4N2UZZM3eY/RukjL
|
||||||
|
Z9wQY1nT31GYwFqU5yv4M8mlgZUX0byyOS29hBbXNztADYIHKj/Fuwrtz+XWmAZu
|
||||||
|
B+aDsDNKTs7vH3t2Ucz63jpH+cOoq5bOj7DfAwmKaD4AKM+msKx7GiC7bxXFLz03
|
||||||
|
9l/DQ4lGRWhOxpVXtR3G0exhJhoSk4KsTxhEVrSEuXn/NUmbUDlwA5fwSmZOVb/+
|
||||||
|
Gzs8IO1agXm1tIDS4xChZAtfDIsp/LP0D9z7rsYg3gVqxV7Yij+141fwSk1j35ZS
|
||||||
|
pIRpTztYUpQ2AqVkhdrQN+Ko01q5tP8uc5vX+k7xg2Bkwc8wYqcjbZ5w4claGTVY
|
||||||
|
/7rSwyDr6DYHlzYxeu7hpJGdZRZ4JnHieduU8AoTY0AYDAAL87c9zsWJhY2ia9AJ
|
||||||
|
zSUScTAf1asckGOI5uYzMpr3xCAm2a2/EEfXYLEVkn0nJI5ix9weSaSxkxgwfhKG
|
||||||
|
mtBy1ILIE4E3Z35YcjxBssmDY44JZvBgS6U+a1gu7bpyrKe+ywzFlrEPiH+hKiQc
|
||||||
|
grUH+OGyw0eko7EoY3gkVxUclRVJog20n4UXBEgKS4UGsmV/ShRF7Zy/ifjWI7MI
|
||||||
|
EZhYKnNTUKoWHyYyBSXf+jaoRDBuJzrFiOllYH/vrIrDJgmTSN02E20wJXIq0/Pb
|
||||||
|
VmXLpBUx8R9onDX/aulmVhV91ZOweu24S9vxgOcgEqxxP09l+AN6KHTw7vQj978q
|
||||||
|
eZYfgHa037lymYO+cWYSGVmEt4KiCU77GHwLkyMKtzozylndKdlILVGuvgisfFs7
|
||||||
|
ytpc8wXT1NBApuMeQLysluBQiwO7bbKbNshIq4hoa6XH4UhIcouTieI0Gu9tNzRJ
|
||||||
|
ellccNg8tO2rgrPvgqeeq4S/WRDexc42LMbuY+CClt+RG34Il5g+SWPrF41n2qRT
|
||||||
|
F3dbXJJHC7jyHyXhSGMRfXLFDCu/s9WIaWjOA9mIdhmOsB+Ts7I1T7AaUNPRgj3L
|
||||||
|
QtmIx9Xh9Sii8+JXmquOlwbTOtGDcYU0u305gIDVsrXrQyT3NiQrtc4bgE0tGvXo
|
||||||
|
iVYUj1HQVUsVx5Ogflu4680rYyq3Dmtc8TNZB0CGeWdzFGVe6+n3XFXnH7G2Q+vu
|
||||||
|
0zbzzmlkRZ8zFSt5aILsm1vZjmhDYDUR20/+gBpnPNjS
|
||||||
|
-----END ENCRYPTED PRIVATE KEY-----
|
Binary file not shown.
Binary file not shown.
|
@ -0,0 +1,30 @@
|
||||||
|
-----BEGIN ENCRYPTED PRIVATE KEY-----
|
||||||
|
MIIFLTBXBgkqhkiG9w0BBQ0wSjApBgkqhkiG9w0BBQwwHAQIrlbRujfEk6cCAggA
|
||||||
|
MAwGCCqGSIb3DQIJBQAwHQYJYIZIAWUDBAEqBBBGVYS+f71qX9HpJJCBV3RsBIIE
|
||||||
|
0LqIbfl5PJl0a37w4bhUg+/fUnGYnx2SjzXKEO1ZyoA6oLDQk6BYLNuHEH7KCtt0
|
||||||
|
BP511gosU+kZJ6obX/AUkxVcmdDHj7r9AXazn9qdq1HfoGRTXMDFTFo3vfnZiJcJ
|
||||||
|
/6gAatK1+dTrlNpR3mEhW9Dv5YAgB7DTJHDW0dfuVcTI/32RaEBSzj2LJ0nrMmfs
|
||||||
|
W58F6ViJzz4owfRXH2DdnWjMCpGJCGBOnvUHXUPqQFIQWYH82e1PkltZgJYuB+GJ
|
||||||
|
knHR8DZFpyI3uWM0IqBCFhEM7/1fUmUQWHWtBHNXOcvEQrtqbZ24eL9wSRgkTux9
|
||||||
|
MGVqF5E5Ity2P0WlmDRtKbUitet/lp8zBkRIwM42oB5pRxAcifNQ8vxNNNVXPfSa
|
||||||
|
UXiKSioXKF4SD7G5B8B2kpgEe1c4xuxgFPNFnsV+Wb8eO5Up+ZCUOeHM36TnYUv0
|
||||||
|
obkiu/roUJmDdZs7+OSla6FrdgQZvYWeZ91A+nkSMDXJgBd+H6erqEGsPguhNzCt
|
||||||
|
knO8VVw7LUIsvq9IliVqRh/yMAVg68DMCd11HGT7KGZTQ+wpmxgkoM7SVampLyMA
|
||||||
|
QbP8CmwCVsNy1R3ycayEHhqvYfO32f3BQq251dR8VUBFYACUrS0RO8z3V5aOGcQ0
|
||||||
|
n/HkYm2WYgqcSBayqzXGsX9pzV+zUmxGRzGkuucRkHccIMsjDrjnwjdCtQ0YOEeF
|
||||||
|
sGLaZM3f4ZOa8O8Namdv4u8Rl+ZE0mhzUHiNmahIt2sBVaxTT0plvngGfZy/Rtlv
|
||||||
|
lquGaSDHEtzSNAI3iuI7/D8LlBmTn5zIPiNKGlBJ3Qjll2DPPlkX8ts6UpJmiyKX
|
||||||
|
TPKyx2dJ6DFfvEkQRBt7MRUsvEdX+ecEEtznG7dlf0A1BPoaOG5TTDRfu+wE0uVP
|
||||||
|
1fT0+ubW6fGWNjr5F0gvOgfrEvohoP0kbhchHC6TWOpMqBbCl39/Sn89hlNL/G2q
|
||||||
|
uJdTeiAylN1jrEw6bR8FIzmd47dSsqirT/LEy7meuFH8oBBp8CZ+IF3wNZvkaczf
|
||||||
|
JU2F4/h/QeCUYyJOQuq2QUNv52xtK5JvVLlXPlk1Bpll56ZbDOui6g0f4GVYy9zk
|
||||||
|
gqzpTndaER7OBrsdizKZ9Z2z7gjLCD3ayEoAis1Yj9xBhcJ2Hl24Jln3/M/fgT6U
|
||||||
|
CbBCcDEwSTCkU26Iyvgg9KQ/X4LmhnnjBZTCG57aJnBZlAqo8/LIe0LYSp0FGd5m
|
||||||
|
nVgx9cAnr+dcUh+/ubLiWGrXCM1B3V4F0FYnfxsf2F021iCZ2eoI8upzhwaUx4PX
|
||||||
|
OLB8vx68KVZqJcFPYNVlHoIR+yc47pDdlDygALPJkbeMJV9buWjsXaqeu6AbCJQm
|
||||||
|
ikQ8W50qHqHj07oBBMhY9I/XbeYRbzURsiJ38vK4rJyHrI25hGDm6W/+l2nAF/aX
|
||||||
|
5TO3I4588qMCkbAikPl84AI/6x+glehyjHMeJdw3+Gqk4oAWMRiOP/+KHPl7BDYk
|
||||||
|
Cca2B7qJ04jr3qR9y1Y+iz+3KSGg4iTnr22UkIyYZcVYJ+GZVlUNXpJpoqZwGOQe
|
||||||
|
BhX5zHpADsCOp4qpsoPSB/nfLtvhc25g6V/RVqg4qr6dkQLxoyyH3UidS35FLghk
|
||||||
|
xcEMG7slpBEbeC80fSr4bicpdYVh9uAjMIcUHukyIUCY
|
||||||
|
-----END ENCRYPTED PRIVATE KEY-----
|
Binary file not shown.
|
@ -0,0 +1 @@
|
||||||
|
12345678a
|
|
@ -0,0 +1,65 @@
|
||||||
|
#!/usr/bin/env python3
|
||||||
|
|
||||||
|
import argparse
|
||||||
|
import util
|
||||||
|
|
||||||
|
|
||||||
|
def main(args):
|
||||||
|
if args.validar_cert:
|
||||||
|
util.validar_cert(args)
|
||||||
|
return
|
||||||
|
|
||||||
|
if args.dir_trabajo:
|
||||||
|
entrada = util.join(args.dir_trabajo, 'entrada')
|
||||||
|
generados = util.join(args.dir_trabajo, 'generados')
|
||||||
|
por_timbrar = util.join(args.dir_trabajo, 'por_timbrar')
|
||||||
|
timbrados = util.join(args.dir_trabajo, 'timbrados')
|
||||||
|
else:
|
||||||
|
entrada = args.dir_entrada
|
||||||
|
generados = args.dir_generados
|
||||||
|
por_timbrar = args.dir_por_timbrar
|
||||||
|
timbrados = args.dir_timbrados
|
||||||
|
|
||||||
|
if args.generar:
|
||||||
|
util.make(entrada, generados)
|
||||||
|
|
||||||
|
if args.sellar:
|
||||||
|
util.stamp(generados, por_timbrar)
|
||||||
|
|
||||||
|
if args.timbrar:
|
||||||
|
util.stamp_pac(por_timbrar, timbrados)
|
||||||
|
|
||||||
|
return
|
||||||
|
|
||||||
|
|
||||||
|
def _process_command_line_arguments():
|
||||||
|
parser = argparse.ArgumentParser(
|
||||||
|
description='CFDI Test')
|
||||||
|
|
||||||
|
help = 'Validar certificados'
|
||||||
|
parser.add_argument('-vc', '--validar-cert', help=help,
|
||||||
|
action='store_true', default=False, required=False)
|
||||||
|
parser.add_argument('-dc', '--dir-cert', default='')
|
||||||
|
help = "Nombre de los certificados, el predeterminado es 'cert'"
|
||||||
|
parser.add_argument('-n', '--nombre', help=help, default='cert')
|
||||||
|
|
||||||
|
parser.add_argument('-d', '--dir-trabajo', dest='dir_trabajo', default='')
|
||||||
|
parser.add_argument('-de', '--dir-entrada', dest='dir_entrada', default='')
|
||||||
|
parser.add_argument('-dg', '--dir-generados', dest='dir_generados', default='')
|
||||||
|
parser.add_argument('-dp', '--dir-por-timbrar', dest='dir_por_timbrar', default='')
|
||||||
|
parser.add_argument('-dt', '--dir-timbrados', dest='dir_timbrados', default='')
|
||||||
|
|
||||||
|
parser.add_argument('-g', '--generar', dest='generar',
|
||||||
|
action='store_true', default=False, required=False)
|
||||||
|
parser.add_argument('-s', '--sellar', dest='sellar',
|
||||||
|
action='store_true', default=False, required=False)
|
||||||
|
parser.add_argument('-t', '--timbrar', dest='timbrar',
|
||||||
|
action='store_true', default=False, required=False)
|
||||||
|
parser.add_argument('-c', '--cancelar', dest='cancelar',
|
||||||
|
action='store_true', default=False, required=False)
|
||||||
|
return parser.parse_args()
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
args = _process_command_line_arguments()
|
||||||
|
main(args)
|
|
@ -0,0 +1,3 @@
|
||||||
|
#!/usr/bin/env python3
|
||||||
|
|
||||||
|
from .comercio import PACComercioDigital
|
|
@ -0,0 +1,187 @@
|
||||||
|
#!/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 logging
|
||||||
|
|
||||||
|
import lxml.etree as ET
|
||||||
|
import requests
|
||||||
|
from requests.exceptions import ConnectionError
|
||||||
|
|
||||||
|
from .conf import DEBUG, DEBUG_SOAP, AUTH
|
||||||
|
|
||||||
|
|
||||||
|
logging.getLogger('requests').setLevel(logging.ERROR)
|
||||||
|
|
||||||
|
|
||||||
|
TIMEOUT = 10
|
||||||
|
|
||||||
|
|
||||||
|
class PACComercioDigital(object):
|
||||||
|
ws = 'https://{}.comercio-digital.mx/{}'
|
||||||
|
URL = {
|
||||||
|
'timbra': ws.format('ws', 'timbre/timbrarV5.aspx'),
|
||||||
|
'cancel': ws.format('cancela', 'cancela3/cancelarUuid'),
|
||||||
|
'cancelxml': ws.format('cancela', 'cancela3/cancelarXml'),
|
||||||
|
}
|
||||||
|
if DEBUG:
|
||||||
|
ws = 'https://pruebas.comercio-digital.mx/{}'
|
||||||
|
URL = {
|
||||||
|
'timbra': ws.format('timbre/timbrarV5.aspx'),
|
||||||
|
'cancel': ws.format('cancela3/cancelarUuid'),
|
||||||
|
'cancelxml': ws.format('cancela3/cancelarXml'),
|
||||||
|
}
|
||||||
|
|
||||||
|
def __init__(self):
|
||||||
|
self.error = ''
|
||||||
|
|
||||||
|
def stamp(self, cfdi):
|
||||||
|
auth = AUTH
|
||||||
|
|
||||||
|
host = self.URL['timbra'].split('/')[2]
|
||||||
|
headers = {
|
||||||
|
'Content-type': 'text/plain',
|
||||||
|
'usrws': auth['user'],
|
||||||
|
'pwdws': auth['pass'],
|
||||||
|
'tipo': 'XML',
|
||||||
|
'Host': host,
|
||||||
|
'Expect' : '100-continue',
|
||||||
|
'Connection' : 'Keep-Alive',
|
||||||
|
}
|
||||||
|
result = requests.post(self.URL['timbra'],
|
||||||
|
data=cfdi, headers=headers, timeout=TIMEOUT)
|
||||||
|
|
||||||
|
if result.status_code != 200:
|
||||||
|
return ''
|
||||||
|
|
||||||
|
if 'errmsg' in result.headers:
|
||||||
|
self.error = result.headers['errmsg']
|
||||||
|
print(self.error)
|
||||||
|
return ''
|
||||||
|
|
||||||
|
return result.text
|
||||||
|
|
||||||
|
def _get_data_cancel(self, cfdi, info):
|
||||||
|
NS_CFDI = {
|
||||||
|
'cfdi': 'http://www.sat.gob.mx/cfd/3',
|
||||||
|
'tdf': 'http://www.sat.gob.mx/TimbreFiscalDigital',
|
||||||
|
}
|
||||||
|
tree = ET.fromstring(cfdi)
|
||||||
|
tipo = tree.xpath(
|
||||||
|
'string(//cfdi:Comprobante/@TipoDeComprobante)',
|
||||||
|
namespaces=NS_CFDI)
|
||||||
|
total = tree.xpath(
|
||||||
|
'string(//cfdi:Comprobante/@Total)',
|
||||||
|
namespaces=NS_CFDI)
|
||||||
|
rfc_emisor = tree.xpath(
|
||||||
|
'string(//cfdi:Comprobante/cfdi:Emisor/@Rfc)',
|
||||||
|
namespaces=NS_CFDI)
|
||||||
|
rfc_receptor = tree.xpath(
|
||||||
|
'string(//cfdi:Comprobante/cfdi:Receptor/@Rfc)',
|
||||||
|
namespaces=NS_CFDI)
|
||||||
|
uid = tree.xpath(
|
||||||
|
'string(//cfdi:Complemento/tdf:TimbreFiscalDigital/@UUID)',
|
||||||
|
namespaces=NS_CFDI)
|
||||||
|
data = (
|
||||||
|
f"USER={AUTH['user']}",
|
||||||
|
f"PWDW={AUTH['pass']}",
|
||||||
|
f"RFCE={rfc_emisor}",
|
||||||
|
f"UUID={uid}",
|
||||||
|
f"PWDK={info['pass']}",
|
||||||
|
f"KEYF={info['key']}",
|
||||||
|
f"CERT={info['cer']}",
|
||||||
|
f"TIPO={info['tipo']}",
|
||||||
|
f"ACUS=SI",
|
||||||
|
f"RFCR={rfc_receptor}",
|
||||||
|
f"TIPOC={tipo}",
|
||||||
|
f"TOTAL={total}",
|
||||||
|
)
|
||||||
|
return '\n'.join(data)
|
||||||
|
|
||||||
|
def cancel(self, cfdi, info):
|
||||||
|
url = self.URL['cancel']
|
||||||
|
host = url.split('/')[2]
|
||||||
|
headers = {
|
||||||
|
'Content-type': 'text/plain',
|
||||||
|
'Host': host,
|
||||||
|
'Expect' : '100-continue',
|
||||||
|
'Connection' : 'Keep-Alive',
|
||||||
|
}
|
||||||
|
data = self._get_data_cancel(cfdi, info)
|
||||||
|
result = requests.post(url, data=data, headers=headers, timeout=TIMEOUT)
|
||||||
|
|
||||||
|
if result.status_code != 200:
|
||||||
|
return ''
|
||||||
|
|
||||||
|
if result.headers['codigo'] != '000':
|
||||||
|
self.error = result.headers['errmsg']
|
||||||
|
print(self.error)
|
||||||
|
return ''
|
||||||
|
|
||||||
|
return result.content
|
||||||
|
|
||||||
|
def _get_headers_cancel_xml(self, cfdi, info):
|
||||||
|
auth = AUTH
|
||||||
|
host = self.URL['cancelxml'].split('/')[2]
|
||||||
|
|
||||||
|
NS_CFDI = {
|
||||||
|
'cfdi': 'http://www.sat.gob.mx/cfd/3',
|
||||||
|
'tdf': 'http://www.sat.gob.mx/TimbreFiscalDigital',
|
||||||
|
}
|
||||||
|
tree = ET.fromstring(cfdi)
|
||||||
|
tipo = tree.xpath(
|
||||||
|
'string(//cfdi:Comprobante/@TipoDeComprobante)',
|
||||||
|
namespaces=NS_CFDI)
|
||||||
|
total = tree.xpath(
|
||||||
|
'string(//cfdi:Comprobante/@Total)',
|
||||||
|
namespaces=NS_CFDI)
|
||||||
|
rfc_receptor = tree.xpath(
|
||||||
|
'string(//cfdi:Comprobante/cfdi:Receptor/@Rfc)',
|
||||||
|
namespaces=NS_CFDI)
|
||||||
|
|
||||||
|
headers = {
|
||||||
|
'usrws': auth['user'],
|
||||||
|
'pwdws': auth['pass'],
|
||||||
|
'rfcr': rfc_receptor,
|
||||||
|
'total': total,
|
||||||
|
'tipocfdi': tipo,
|
||||||
|
'Content-type': 'text/plain',
|
||||||
|
'Host': host,
|
||||||
|
'Expect' : '100-continue',
|
||||||
|
'Connection' : 'Keep-Alive',
|
||||||
|
}
|
||||||
|
headers.update(info)
|
||||||
|
|
||||||
|
return headers
|
||||||
|
|
||||||
|
def cancel_xml(self, cfdi, xml, info):
|
||||||
|
url = self.URL['cancelxml']
|
||||||
|
headers = self._get_headers_cancel_xml(cfdi, info)
|
||||||
|
result = requests.post(url, data=xml, headers=headers, timeout=TIMEOUT)
|
||||||
|
|
||||||
|
if result.status_code != 200:
|
||||||
|
return ''
|
||||||
|
|
||||||
|
if result.headers['codigo'] != '000':
|
||||||
|
self.error = result.headers['errmsg']
|
||||||
|
print(self.error)
|
||||||
|
return ''
|
||||||
|
|
||||||
|
return result.content
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,4 @@
|
||||||
|
#!/usr/bin/env python3
|
||||||
|
|
||||||
|
|
||||||
|
TOKEN = ''
|
|
@ -0,0 +1,3 @@
|
||||||
|
#!/usr/bin/env python3
|
||||||
|
|
||||||
|
from .finkok import PACFinkok
|
|
@ -0,0 +1,837 @@
|
||||||
|
#!/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 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, DEBUG_SOAP, AUTH
|
||||||
|
|
||||||
|
|
||||||
|
logging.getLogger('zeep').setLevel(logging.ERROR)
|
||||||
|
logging.getLogger('requests').setLevel(logging.ERROR)
|
||||||
|
|
||||||
|
|
||||||
|
TIMEOUT = 10
|
||||||
|
|
||||||
|
|
||||||
|
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)
|
||||||
|
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'
|
||||||
|
if DEBUG:
|
||||||
|
ws = 'http://demo-facturacion.finkok.com/servicios/soap/{}.wsdl'
|
||||||
|
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',
|
||||||
|
'1000': 'Comprobante recibido satisfactoriamente',
|
||||||
|
}
|
||||||
|
|
||||||
|
def __init__(self):
|
||||||
|
self.error = ''
|
||||||
|
self._transport = Transport(cache=SqliteCache(), timeout=TIMEOUT)
|
||||||
|
self._plugins = [DebugPlugin()]
|
||||||
|
|
||||||
|
def _validate_result(self, result):
|
||||||
|
# ~ print('RESULT\r', result)
|
||||||
|
if hasattr(result, 'CodEstatus'):
|
||||||
|
ce = result.CodEstatus
|
||||||
|
if not ce is None:
|
||||||
|
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 == self.CODE['1000']:
|
||||||
|
return result
|
||||||
|
|
||||||
|
if self.CODE['200'] != ce:
|
||||||
|
print('CodEstatus', type(ce), ce)
|
||||||
|
return result
|
||||||
|
|
||||||
|
if hasattr(result, 'Incidencias'):
|
||||||
|
fault = result.Incidencias.Incidencia[0]
|
||||||
|
cod_error = fault.CodigoError
|
||||||
|
msg_error = fault.MensajeIncidencia
|
||||||
|
error = 'Error: {}\n{}'.format(cod_error, msg_error)
|
||||||
|
self.error = self.CODE.get(cod_error, error)
|
||||||
|
return {}
|
||||||
|
|
||||||
|
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 stamp(self, cfdi, auth={}):
|
||||||
|
if 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,
|
||||||
|
}
|
||||||
|
|
||||||
|
result = self._get_result(client, 'stamp', args)
|
||||||
|
if self.error:
|
||||||
|
return ''
|
||||||
|
|
||||||
|
# ~ data = {
|
||||||
|
# ~ 'xml': self._to_string(result.xml),
|
||||||
|
# ~ 'uuid': result.UUID,
|
||||||
|
# ~ 'fecha': result.Fecha,
|
||||||
|
# ~ }
|
||||||
|
return result.xml
|
||||||
|
|
||||||
|
def cfdi_quick_stamp(self, cfdi, auth={}):
|
||||||
|
if not auth:
|
||||||
|
auth = FINKOK['AUTH']
|
||||||
|
|
||||||
|
method = 'timbra'
|
||||||
|
client = Client(
|
||||||
|
self.URL[method], transport=self._transport, plugins=self._plugins)
|
||||||
|
args = {
|
||||||
|
'username': auth['USER'],
|
||||||
|
'password': auth['PASS'],
|
||||||
|
'xml': cfdi,
|
||||||
|
}
|
||||||
|
|
||||||
|
result = self._get_result(client, 'quick_stamp', args)
|
||||||
|
if self.error:
|
||||||
|
return {}
|
||||||
|
|
||||||
|
data = {
|
||||||
|
'xml': self._to_string(result.xml),
|
||||||
|
'uuid': result.UUID,
|
||||||
|
'fecha': result.Fecha,
|
||||||
|
}
|
||||||
|
return data
|
||||||
|
|
||||||
|
def cfdi_stamped(self, cfdi, auth={}):
|
||||||
|
if not auth:
|
||||||
|
auth = FINKOK['AUTH']
|
||||||
|
|
||||||
|
method = 'timbra'
|
||||||
|
client = Client(
|
||||||
|
self.URL[method], transport=self._transport, plugins=self._plugins)
|
||||||
|
args = {
|
||||||
|
'username': auth['USER'],
|
||||||
|
'password': auth['PASS'],
|
||||||
|
'xml': cfdi,
|
||||||
|
}
|
||||||
|
|
||||||
|
result = self._get_result(client, 'stamped', args)
|
||||||
|
if self.error:
|
||||||
|
return {}
|
||||||
|
|
||||||
|
data = {
|
||||||
|
'xml': self._to_string(result.xml),
|
||||||
|
'uuid': result.UUID,
|
||||||
|
'fecha': result.Fecha,
|
||||||
|
}
|
||||||
|
return data
|
||||||
|
|
||||||
|
def cfdi_query_pending(self, uuid, auth={}):
|
||||||
|
if not auth:
|
||||||
|
auth = FINKOK['AUTH']
|
||||||
|
|
||||||
|
method = 'timbra'
|
||||||
|
client = Client(
|
||||||
|
self.URL[method], transport=self._transport, plugins=self._plugins)
|
||||||
|
args = {
|
||||||
|
'username': auth['USER'],
|
||||||
|
'password': auth['PASS'],
|
||||||
|
'uuid': uuid,
|
||||||
|
}
|
||||||
|
|
||||||
|
result = self._get_result(client, 'query_pending', args)
|
||||||
|
if self.error:
|
||||||
|
return {}
|
||||||
|
|
||||||
|
STATUS = {
|
||||||
|
'S': 'Timbrado, aún no eviado al SAT',
|
||||||
|
'F': 'Timbrado y enviado al SAT',
|
||||||
|
}
|
||||||
|
|
||||||
|
data = {
|
||||||
|
'status': STATUS[result.status],
|
||||||
|
'xml': self._to_string(unescape(result.xml)),
|
||||||
|
}
|
||||||
|
|
||||||
|
return data
|
||||||
|
|
||||||
|
def cfdi_sign_stamp(self, cfdi, auth={}):
|
||||||
|
if not auth:
|
||||||
|
auth = FINKOK['AUTH']
|
||||||
|
|
||||||
|
method = 'timbra'
|
||||||
|
client = Client(
|
||||||
|
self.URL[method], transport=self._transport, plugins=self._plugins)
|
||||||
|
args = {
|
||||||
|
'username': auth['USER'],
|
||||||
|
'password': auth['PASS'],
|
||||||
|
'xml': cfdi,
|
||||||
|
}
|
||||||
|
|
||||||
|
result = self._get_result(client, 'sign_stamp', args)
|
||||||
|
if self.error:
|
||||||
|
return {}
|
||||||
|
|
||||||
|
data = {
|
||||||
|
'xml': self._to_string(result.xml),
|
||||||
|
'uuid': result.UUID,
|
||||||
|
'fecha': result.Fecha,
|
||||||
|
}
|
||||||
|
return data
|
||||||
|
|
||||||
|
# For test
|
||||||
|
def cfdi_cancel(self, rfc, uuid, cer, key, auth={}):
|
||||||
|
if not auth:
|
||||||
|
auth = FINKOK['AUTH']
|
||||||
|
|
||||||
|
method = 'cancel'
|
||||||
|
client = Client(
|
||||||
|
self.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': auth['USER'],
|
||||||
|
'password': auth['PASS'],
|
||||||
|
'taxpayer_id': rfc,
|
||||||
|
'cer': cer,
|
||||||
|
'key': key,
|
||||||
|
'store_pending': False,
|
||||||
|
}
|
||||||
|
|
||||||
|
result = self._get_result(client, 'cancel', args)
|
||||||
|
if self.error:
|
||||||
|
return {}
|
||||||
|
|
||||||
|
return result
|
||||||
|
|
||||||
|
def cfdi_status(self, uuid, auth={}):
|
||||||
|
if not auth:
|
||||||
|
auth = FINKOK['AUTH']
|
||||||
|
|
||||||
|
method = 'timbra'
|
||||||
|
client = Client(
|
||||||
|
self.URL[method], transport=self._transport, plugins=self._plugins)
|
||||||
|
args = {
|
||||||
|
'username': auth['USER'],
|
||||||
|
'password': auth['PASS'],
|
||||||
|
'uuid': uuid,
|
||||||
|
}
|
||||||
|
|
||||||
|
result = self._get_result(client, 'query_pending', args)
|
||||||
|
if self.error:
|
||||||
|
return {}
|
||||||
|
|
||||||
|
STATUS = {
|
||||||
|
'C': 'Cancelado',
|
||||||
|
'S': 'Timbrado, aún no eviado al SAT',
|
||||||
|
'F': 'Timbrado y enviado al SAT',
|
||||||
|
}
|
||||||
|
|
||||||
|
data = {
|
||||||
|
'estatus': STATUS[result.status],
|
||||||
|
'xml': self._to_string(unescape(result.xml)),
|
||||||
|
'fecha': result.date,
|
||||||
|
}
|
||||||
|
|
||||||
|
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 or True == 'O' == On demand
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
True or False
|
||||||
|
|
||||||
|
origin PAC
|
||||||
|
'message':
|
||||||
|
'Account Created successfully'
|
||||||
|
'Account Already exists'
|
||||||
|
'success': True or False
|
||||||
|
"""
|
||||||
|
auth = FINKOK['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_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:
|
||||||
|
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 = FINKOK['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:
|
||||||
|
return ''
|
||||||
|
|
||||||
|
if not result.success:
|
||||||
|
self.error = result.message
|
||||||
|
return ''
|
||||||
|
|
||||||
|
return result.token
|
||||||
|
|
||||||
|
# ~ Send issue to PAC
|
||||||
|
def client_reset_token(self, email):
|
||||||
|
auth = FINKOK['RESELLER']
|
||||||
|
method = 'util'
|
||||||
|
client = Client(
|
||||||
|
self.URL[method], transport=self._transport, plugins=self._plugins)
|
||||||
|
args = {
|
||||||
|
'username': auth['USER'],
|
||||||
|
'password': auth['PASS'],
|
||||||
|
'token': email,
|
||||||
|
}
|
||||||
|
|
||||||
|
result = self._get_result(client, 'reset_token', args)
|
||||||
|
if self.error:
|
||||||
|
return ''
|
||||||
|
|
||||||
|
if not result.success:
|
||||||
|
self.error = result.message
|
||||||
|
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 = FINKOK['RESELLER']
|
||||||
|
|
||||||
|
if not isinstance(credit, int):
|
||||||
|
self.error = 'El credito debe ser un entero'
|
||||||
|
return 0
|
||||||
|
|
||||||
|
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:
|
||||||
|
return ''
|
||||||
|
|
||||||
|
if not result.success:
|
||||||
|
self.error = result.message
|
||||||
|
return 0
|
||||||
|
|
||||||
|
return result.credit
|
||||||
|
|
||||||
|
def client_edit(self, rfc, status=True):
|
||||||
|
"""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 or False == 'S' == Suspendido
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
dict
|
||||||
|
'message':
|
||||||
|
'Account Created successfully'
|
||||||
|
'Account Already exists'
|
||||||
|
'success': True or False
|
||||||
|
"""
|
||||||
|
auth = FINKOK['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_get(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 = FINKOK['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,
|
||||||
|
}
|
||||||
|
|
||||||
|
try:
|
||||||
|
self.result = client.service.get(**args)
|
||||||
|
except Fault as e:
|
||||||
|
self.error = str(e)
|
||||||
|
return {}
|
||||||
|
except TransportError as e:
|
||||||
|
self.error = str(e)
|
||||||
|
return {}
|
||||||
|
except ConnectionError:
|
||||||
|
self.error = 'Verifica la conexión a internet'
|
||||||
|
return {}
|
||||||
|
|
||||||
|
success = bool(self.result.users)
|
||||||
|
if not success:
|
||||||
|
self.error = self.result.message or 'RFC no existe'
|
||||||
|
return {}
|
||||||
|
|
||||||
|
data = self.result.users.ResellerUser[0]
|
||||||
|
client = {
|
||||||
|
'status': data.status,
|
||||||
|
'counter': data.counter,
|
||||||
|
'credit': data.credit,
|
||||||
|
}
|
||||||
|
return client
|
||||||
|
|
||||||
|
def client_get_timbres(self, rfc, auth={}):
|
||||||
|
"""Regresa los timbres restantes del cliente
|
||||||
|
Se pueden usar las credenciales de relleser o las credenciales del emisor
|
||||||
|
|
||||||
|
Args:
|
||||||
|
rfc (str): El RFC del emisor
|
||||||
|
|
||||||
|
Kwargs:
|
||||||
|
auth (dict): Credenciales del emisor
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
int Cantidad de timbres restantes
|
||||||
|
"""
|
||||||
|
|
||||||
|
if not auth:
|
||||||
|
auth = FINKOK['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,
|
||||||
|
}
|
||||||
|
|
||||||
|
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_server_datetime(self):
|
||||||
|
"""Regresa la fecha y hora del servidor de timbrado del PAC
|
||||||
|
"""
|
||||||
|
auth = FINKOK['RESELLER']
|
||||||
|
|
||||||
|
method = 'util'
|
||||||
|
client = Client(
|
||||||
|
self.URL[method], transport=self._transport, plugins=self._plugins)
|
||||||
|
try:
|
||||||
|
self.result = client.service.datetime(auth['USER'], auth['PASS'])
|
||||||
|
except Fault as e:
|
||||||
|
self.error = str(e)
|
||||||
|
return None
|
||||||
|
except TransportError as e:
|
||||||
|
self.error = str(e)
|
||||||
|
return None
|
||||||
|
except ConnectionError:
|
||||||
|
self.error = 'Verifica la conexión a internet'
|
||||||
|
return None
|
||||||
|
|
||||||
|
try:
|
||||||
|
dt = datetime.datetime.strptime(
|
||||||
|
self.result.datetime, '%Y-%m-%dT%H:%M:%S')
|
||||||
|
except ValueError:
|
||||||
|
self.error = 'Error al obtener la fecha'
|
||||||
|
return None
|
||||||
|
|
||||||
|
return dt
|
||||||
|
|
||||||
|
def get_report_credit(self, rfc):
|
||||||
|
"""Obtiene un reporte de los timbres agregados
|
||||||
|
"""
|
||||||
|
auth = FINKOK['RESELLER']
|
||||||
|
|
||||||
|
args = {
|
||||||
|
'username': auth['USER'],
|
||||||
|
'password': auth['PASS'],
|
||||||
|
'taxpayer_id': rfc,
|
||||||
|
}
|
||||||
|
|
||||||
|
method = 'util'
|
||||||
|
client = Client(
|
||||||
|
self.URL[method], transport=self._transport, plugins=self._plugins)
|
||||||
|
try:
|
||||||
|
self.result = client.service.report_credit(**args)
|
||||||
|
except Fault as e:
|
||||||
|
self.error = str(e)
|
||||||
|
return []
|
||||||
|
except TransportError as e:
|
||||||
|
self.error = str(e)
|
||||||
|
return []
|
||||||
|
except ConnectionError:
|
||||||
|
self.error = 'Verifica la conexión a internet'
|
||||||
|
return []
|
||||||
|
|
||||||
|
if self.result.result is None:
|
||||||
|
# ~ PAC - Debería regresar RFC inexistente o sin registros
|
||||||
|
self.error = 'RFC no existe o no tiene registros'
|
||||||
|
return []
|
||||||
|
|
||||||
|
return self.result.result.ReportTotalCredit
|
||||||
|
|
||||||
|
def _get_dates(self, year, month):
|
||||||
|
y = year
|
||||||
|
n = datetime.datetime.now()
|
||||||
|
if not year:
|
||||||
|
y = n.year
|
||||||
|
|
||||||
|
return
|
||||||
|
|
||||||
|
def get_report_total(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)
|
||||||
|
try:
|
||||||
|
result = client.service.report_total(**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
|
||||||
|
|
||||||
|
if result.result is None:
|
||||||
|
# ~ PAC - Debería regresar RFC inexistente o sin registros
|
||||||
|
# ~ self.error = 'RFC no existe o no tiene registros'
|
||||||
|
self.error = result.error
|
||||||
|
return 0
|
||||||
|
|
||||||
|
return result.result.ReportTotal[0].total or 0
|
||||||
|
|
||||||
|
def get_report_uuid(self, rfc, date_from, date_to, invoice_type='I'):
|
||||||
|
"""Obtiene un reporte de los CFDI timbrados
|
||||||
|
"""
|
||||||
|
auth = FINKOK['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)
|
||||||
|
try:
|
||||||
|
self.result = client.service.report_uuid(**args)
|
||||||
|
except Fault as e:
|
||||||
|
self.error = str(e)
|
||||||
|
return []
|
||||||
|
except TransportError as e:
|
||||||
|
self.error = str(e)
|
||||||
|
return []
|
||||||
|
except ConnectionError:
|
||||||
|
self.error = 'Verifica la conexión a internet'
|
||||||
|
return []
|
||||||
|
|
||||||
|
if self.result.invoices is None:
|
||||||
|
# ~ PAC - Debería regresar RFC inexistente o sin registros
|
||||||
|
self.error = 'RFC no existe o no tiene registros'
|
||||||
|
return []
|
||||||
|
|
||||||
|
return self.result.invoices.ReportUUID
|
||||||
|
|
||||||
|
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 cfdi_get_by_xml(self, xml, auth):
|
||||||
|
if not auth:
|
||||||
|
auth = FINKOK['AUTH']
|
||||||
|
|
||||||
|
method = 'timbra'
|
||||||
|
client = Client(
|
||||||
|
self.URL[method], transport=self._transport, plugins=self._plugins)
|
||||||
|
args = {
|
||||||
|
'username': auth['USER'],
|
||||||
|
'password': auth['PASS'],
|
||||||
|
'xml': xml,
|
||||||
|
}
|
||||||
|
|
||||||
|
try:
|
||||||
|
result = client.service.stamped(**args)
|
||||||
|
except Fault as e:
|
||||||
|
self.error = str(e)
|
||||||
|
return {}
|
||||||
|
except TransportError as e:
|
||||||
|
self.error = str(e)
|
||||||
|
return {}
|
||||||
|
except ConnectionError as e:
|
||||||
|
msg = '502 - Error de conexión'
|
||||||
|
self.error = msg
|
||||||
|
return {}
|
||||||
|
|
||||||
|
print(result)
|
||||||
|
|
||||||
|
error = 'Error: {}\n{}'.format(code_error, msg_error)
|
||||||
|
self.error = self.CODE.get(code_error, error)
|
||||||
|
return {}
|
||||||
|
|
||||||
|
def cfdi_get_by_uuid(self, uuid, rfc, invoice_type='I', auth={}):
|
||||||
|
if not auth:
|
||||||
|
auth = FINKOK['AUTH']
|
||||||
|
|
||||||
|
method = 'util'
|
||||||
|
client = Client(
|
||||||
|
URL[method], transport=self._transport, plugins=self._plugins)
|
||||||
|
|
||||||
|
args = {
|
||||||
|
'username': auth['USER'],
|
||||||
|
'password': auth['PASS'],
|
||||||
|
'uuid': uuid,
|
||||||
|
'taxpayer_id': rfc,
|
||||||
|
'invoice_type': invoice_type,
|
||||||
|
}
|
||||||
|
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 {}
|
||||||
|
except ConnectionError as e:
|
||||||
|
msg = '502 - Error de conexión'
|
||||||
|
self.error = msg
|
||||||
|
return {}
|
||||||
|
|
||||||
|
print(result)
|
||||||
|
|
||||||
|
error = 'Error: {}\n{}'.format(code_error, msg_error)
|
||||||
|
self.error = self.CODE.get(code_error, error)
|
||||||
|
return {}
|
||||||
|
|
|
@ -0,0 +1,3 @@
|
||||||
|
#!/usr/bin/env python3
|
||||||
|
|
||||||
|
from .cfdi_cert import SATCertificate
|
|
@ -0,0 +1,248 @@
|
||||||
|
#!/usr/bin/env python3
|
||||||
|
|
||||||
|
import argparse
|
||||||
|
import base64
|
||||||
|
import datetime
|
||||||
|
import getpass
|
||||||
|
from pathlib import Path
|
||||||
|
|
||||||
|
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'', pem=b'', password=''):
|
||||||
|
self._error = ''
|
||||||
|
self._init_values()
|
||||||
|
self._get_data_cer(cer)
|
||||||
|
self._get_data_key(key, password)
|
||||||
|
self._get_data_pem(pem)
|
||||||
|
|
||||||
|
def _init_values(self):
|
||||||
|
self._rfc = ''
|
||||||
|
self._serial_number = ''
|
||||||
|
self._serial_number2 = ''
|
||||||
|
self._not_before = None
|
||||||
|
self._not_after = None
|
||||||
|
self._is_fiel = False
|
||||||
|
self._are_couple = False
|
||||||
|
self._is_valid_time = False
|
||||||
|
self._cer_pem = ''
|
||||||
|
self._cer_txt = ''
|
||||||
|
self._key_enc = b''
|
||||||
|
self._key_pem = b''
|
||||||
|
self._p12 = b''
|
||||||
|
self._cer_modulus = 0
|
||||||
|
self._key_modulus = 0
|
||||||
|
self._issuer = ''
|
||||||
|
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):
|
||||||
|
obj = x509.load_der_x509_certificate(cer, default_backend())
|
||||||
|
self._rfc = obj.subject.get_attributes_for_oid(
|
||||||
|
NameOID.X500_UNIQUE_IDENTIFIER)[0].value.split(' ')[0]
|
||||||
|
self._serial_number2 = obj.serial_number
|
||||||
|
self._serial_number = '{0:x}'.format(obj.serial_number)[1::2]
|
||||||
|
self._not_before = obj.not_valid_before
|
||||||
|
self._not_after = obj.not_valid_after
|
||||||
|
self._issuer = ','.join([i.rfc4514_string() for i in obj.issuer])
|
||||||
|
|
||||||
|
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_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
|
||||||
|
|
||||||
|
def _get_data_pem(self, pem):
|
||||||
|
if not pem:
|
||||||
|
return
|
||||||
|
|
||||||
|
self._key_pem = serialization.load_pem_private_key(
|
||||||
|
pem, None, backend=default_backend())
|
||||||
|
return
|
||||||
|
|
||||||
|
# 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_with_pem(self, data, name_hash):
|
||||||
|
if name_hash == 'sha256':
|
||||||
|
type_hash = hashes.SHA256()
|
||||||
|
elif name_hash == 'sha1':
|
||||||
|
type_hash = hashes.SHA1()
|
||||||
|
|
||||||
|
firma = self._key_pem.sign(data, padding.PKCS1v15(), type_hash)
|
||||||
|
return base64.b64encode(firma).decode()
|
||||||
|
|
||||||
|
def sign_sha1(self, data, password=''):
|
||||||
|
if self._key_pem:
|
||||||
|
return self._sign_with_pem(data, 'sha1')
|
||||||
|
|
||||||
|
private_key = self._get_key(password)
|
||||||
|
firma = private_key.sign(data, padding.PKCS1v15(), hashes.SHA1())
|
||||||
|
return base64.b64encode(firma).decode()
|
||||||
|
|
||||||
|
def sign_xml(self, tree):
|
||||||
|
import xmlsec
|
||||||
|
|
||||||
|
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
|
||||||
|
return tree
|
||||||
|
|
||||||
|
@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 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_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 issuer(self):
|
||||||
|
return self._issuer
|
||||||
|
|
||||||
|
@property
|
||||||
|
def p12(self):
|
||||||
|
return self._get_p12()
|
||||||
|
|
||||||
|
@property
|
||||||
|
def error(self):
|
||||||
|
return self._error
|
|
@ -0,0 +1,463 @@
|
||||||
|
#!/usr/bin/env python3
|
||||||
|
|
||||||
|
import datetime
|
||||||
|
import getpass
|
||||||
|
import json
|
||||||
|
import logging
|
||||||
|
import os
|
||||||
|
import re
|
||||||
|
from io import BytesIO
|
||||||
|
from pathlib import Path
|
||||||
|
|
||||||
|
import lxml.etree as ET
|
||||||
|
|
||||||
|
from finkok import PACFinkok
|
||||||
|
from comercio import PACComercioDigital
|
||||||
|
from pycert import SATCertificate
|
||||||
|
|
||||||
|
|
||||||
|
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__)
|
||||||
|
|
||||||
|
|
||||||
|
PACs = {
|
||||||
|
'finkok': PACFinkok,
|
||||||
|
'comercio': PACComercioDigital,
|
||||||
|
}
|
||||||
|
NS_CFDI = {
|
||||||
|
'cfdi': 'http://www.sat.gob.mx/cfd/3',
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
def _exists(path):
|
||||||
|
if not path:
|
||||||
|
return False
|
||||||
|
return Path(path).exists()
|
||||||
|
|
||||||
|
|
||||||
|
def _join(*paths):
|
||||||
|
return str(Path(paths[0]).joinpath(*paths[1:]))
|
||||||
|
|
||||||
|
|
||||||
|
class CFDI(object):
|
||||||
|
_version = '3.3'
|
||||||
|
_prefix = 'cfdi'
|
||||||
|
_xmlns = 'http://www.sat.gob.mx/cfd/3'
|
||||||
|
schema = f'{_xmlns} http://www.sat.gob.mx/sitio_internet/cfd/3/cfdv33.xsd'
|
||||||
|
_pagos = 'http://www.sat.gob.mx/Pagos'
|
||||||
|
PAGOS = {
|
||||||
|
'version': '1.0',
|
||||||
|
'prefix': _pagos,
|
||||||
|
'ns': {'pago10': _pagos},
|
||||||
|
'schema': f' {_pagos} http://www.sat.gob.mx/sitio_internet/cfd/Pagos/Pagos10.xsd',
|
||||||
|
}
|
||||||
|
_nomina = 'http://www.sat.gob.mx/nomina12'
|
||||||
|
NOMINA = {
|
||||||
|
'version': '1.2',
|
||||||
|
'prefix': _nomina,
|
||||||
|
'ns': {'nomina12': _nomina},
|
||||||
|
'schema': f' {_nomina} http://www.sat.gob.mx/sitio_internet/cfd/nomina/nomina12.xsd',
|
||||||
|
}
|
||||||
|
|
||||||
|
def __init__(self, data):
|
||||||
|
self.error = ''
|
||||||
|
self._root = None
|
||||||
|
self._cfdi = self._make_cfdi(data)
|
||||||
|
|
||||||
|
@property
|
||||||
|
def xml(self):
|
||||||
|
return self._cfdi
|
||||||
|
|
||||||
|
def save(self, path):
|
||||||
|
doc = ET.ElementTree(self._root)
|
||||||
|
doc.write(path, pretty_print=True, encoding='utf-8',
|
||||||
|
doctype='<?xml version="1.0" encoding="utf-8"?>')
|
||||||
|
return
|
||||||
|
|
||||||
|
def _make_cfdi(self, data):
|
||||||
|
self._validate_data(data)
|
||||||
|
self._comprobante(data['comprobante'])
|
||||||
|
self._relacionados(data.get('relacionados', {}))
|
||||||
|
self._emisor(data['emisor'])
|
||||||
|
self._receptor(data['receptor'])
|
||||||
|
self._conceptos(data['conceptos'])
|
||||||
|
self._impuestos(data.get('impuestos', {}))
|
||||||
|
self._complementos(data)
|
||||||
|
|
||||||
|
xml = ET.tostring(self._root,
|
||||||
|
pretty_print=True, xml_declaration=True, encoding='utf-8')
|
||||||
|
return xml.decode()
|
||||||
|
|
||||||
|
def _validate_data(self, data):
|
||||||
|
self._schema = self.schema
|
||||||
|
self._exists_pagos = 'pagos' in data
|
||||||
|
self._exists_nomina = 'nomina' in data
|
||||||
|
self._node_complement = False
|
||||||
|
|
||||||
|
if self._exists_pagos:
|
||||||
|
self._node_complement = True
|
||||||
|
self._schema += self.PAGOS['schema']
|
||||||
|
if self._exists_nomina:
|
||||||
|
self._node_complement = True
|
||||||
|
self._schema += self.NOMINA['schema']
|
||||||
|
return
|
||||||
|
|
||||||
|
def _comprobante(self, attr):
|
||||||
|
NSMAP = {
|
||||||
|
self._prefix: self._xmlns,
|
||||||
|
'xsi': 'http://www.w3.org/2001/XMLSchema-instance',
|
||||||
|
}
|
||||||
|
if self._exists_pagos:
|
||||||
|
NSMAP.update(self.PAGOS['ns'])
|
||||||
|
if self._exists_nomina:
|
||||||
|
NSMAP.update(self.NOMINA['ns'])
|
||||||
|
|
||||||
|
attr_qname = ET.QName(
|
||||||
|
'http://www.w3.org/2001/XMLSchema-instance', 'schemaLocation')
|
||||||
|
schema = {attr_qname: self._schema}
|
||||||
|
|
||||||
|
if not 'Version' in attr:
|
||||||
|
attr['Version'] = self._version
|
||||||
|
|
||||||
|
node_name = f'{{{self._xmlns}}}Comprobante'
|
||||||
|
self._root = ET.Element(node_name, schema, **attr, nsmap=NSMAP)
|
||||||
|
return
|
||||||
|
|
||||||
|
def _relacionados(self, attr):
|
||||||
|
|
||||||
|
return
|
||||||
|
|
||||||
|
def _emisor(self, attr):
|
||||||
|
node_name = f'{{{self._xmlns}}}Emisor'
|
||||||
|
emisor = ET.SubElement(self._root, node_name, attr)
|
||||||
|
return
|
||||||
|
|
||||||
|
def _receptor(self, attr):
|
||||||
|
node_name = f'{{{self._xmlns}}}Receptor'
|
||||||
|
emisor = ET.SubElement(self._root, node_name, attr)
|
||||||
|
return
|
||||||
|
|
||||||
|
def _conceptos(self, data):
|
||||||
|
node_name = f'{{{self._xmlns}}}Conceptos'
|
||||||
|
conceptos = ET.SubElement(self._root, node_name)
|
||||||
|
for row in data:
|
||||||
|
complemento = row.pop('complemento', {})
|
||||||
|
taxes = row.pop('impuestos', {})
|
||||||
|
|
||||||
|
node_name = f'{{{self._xmlns}}}Concepto'
|
||||||
|
concepto = ET.SubElement(conceptos, node_name, row)
|
||||||
|
|
||||||
|
if not taxes:
|
||||||
|
continue
|
||||||
|
|
||||||
|
if taxes['traslados'] or taxes['retenciones']:
|
||||||
|
node_name = f'{{{self._xmlns}}}Impuestos'
|
||||||
|
impuestos = ET.SubElement(concepto, node_name)
|
||||||
|
if 'traslados' in taxes and taxes['traslados']:
|
||||||
|
node_name = f'{{{self._xmlns}}}Traslados'
|
||||||
|
traslados = ET.SubElement(impuestos, node_name)
|
||||||
|
node_name = f'{{{self._xmlns}}}Traslado'
|
||||||
|
for traslado in taxes['traslados']:
|
||||||
|
ET.SubElement(traslados, node_name, traslado)
|
||||||
|
if 'retenciones' in taxes and taxes['retenciones']:
|
||||||
|
node_name = f'{{{self._xmlns}}}Retenciones'
|
||||||
|
retenciones = ET.SubElement(impuestos, node_name)
|
||||||
|
node_name = f'{{{self._xmlns}}}Retencion'
|
||||||
|
for retencion in taxes['retenciones']:
|
||||||
|
ET.SubElement(retenciones, node_name, retencion)
|
||||||
|
return
|
||||||
|
|
||||||
|
def _impuestos(self, data):
|
||||||
|
if not data:
|
||||||
|
return
|
||||||
|
|
||||||
|
node_name = f'{{{self._xmlns}}}Impuestos'
|
||||||
|
# ~ ET.SubElement(self._root, node_name)
|
||||||
|
|
||||||
|
retenciones = data.pop('retenciones', ())
|
||||||
|
traslados = data.pop('traslados', ())
|
||||||
|
taxes = ET.SubElement(self._root, node_name, data)
|
||||||
|
|
||||||
|
if retenciones:
|
||||||
|
node_name = f'{{{self._xmlns}}}Retenciones'
|
||||||
|
subnode = ET.SubElement(taxes, node_name)
|
||||||
|
node_name = f'{{{self._xmlns}}}Retencion'
|
||||||
|
for row in retenciones:
|
||||||
|
ET.SubElement(subnode, node_name, row)
|
||||||
|
|
||||||
|
if traslados:
|
||||||
|
node_name = f'{{{self._xmlns}}}Traslados'
|
||||||
|
subnode = ET.SubElement(taxes, node_name)
|
||||||
|
node_name = f'{{{self._xmlns}}}Traslado'
|
||||||
|
for row in traslados:
|
||||||
|
ET.SubElement(subnode, node_name, row)
|
||||||
|
|
||||||
|
return
|
||||||
|
|
||||||
|
def _complementos(self, data):
|
||||||
|
if not self._node_complement:
|
||||||
|
return
|
||||||
|
|
||||||
|
node_name = f'{{{self._xmlns}}}Complemento'
|
||||||
|
complemento = ET.SubElement(self._root, node_name)
|
||||||
|
|
||||||
|
if self._exists_pagos:
|
||||||
|
self._pagos(complemento, data['pagos'])
|
||||||
|
|
||||||
|
if self._exists_nomina:
|
||||||
|
self._nomina(complemento, data['nomina'])
|
||||||
|
return
|
||||||
|
|
||||||
|
def _pagos(self, complemento, data):
|
||||||
|
node_name = f"{{{self.PAGOS['prefix']}}}Pagos"
|
||||||
|
attr = {'Version': self.PAGOS['version']}
|
||||||
|
node_pagos = ET.SubElement(complemento, node_name, attr)
|
||||||
|
for pago in data:
|
||||||
|
documentos = pago.pop('documentos')
|
||||||
|
node_name = f"{{{self.PAGOS['prefix']}}}Pago"
|
||||||
|
node_pago = ET.SubElement(node_pagos, node_name, pago)
|
||||||
|
node_name = f"{{{self.PAGOS['prefix']}}}DoctoRelacionado"
|
||||||
|
for doc in documentos:
|
||||||
|
ET.SubElement(node_pago, node_name, doc)
|
||||||
|
return
|
||||||
|
|
||||||
|
def _nomina(self, complemento, data):
|
||||||
|
emisor = data.pop('emisor')
|
||||||
|
receptor = data.pop('receptor')
|
||||||
|
percepciones = data.pop('percepciones', {})
|
||||||
|
deducciones = data.pop('deducciones', {})
|
||||||
|
otros = data.pop('otros', ())
|
||||||
|
|
||||||
|
if not 'Version' in data:
|
||||||
|
data['Version'] = self.NOMINA['version']
|
||||||
|
|
||||||
|
node_name = f"{{{self.NOMINA['prefix']}}}Nomina"
|
||||||
|
node_nomina = ET.SubElement(complemento, node_name, data)
|
||||||
|
node_name = f"{{{self.NOMINA['prefix']}}}Emisor"
|
||||||
|
ET.SubElement(node_nomina, node_name, emisor)
|
||||||
|
node_name = f"{{{self.NOMINA['prefix']}}}Receptor"
|
||||||
|
ET.SubElement(node_nomina, node_name, receptor)
|
||||||
|
|
||||||
|
if percepciones:
|
||||||
|
attr = percepciones
|
||||||
|
percepciones = attr.pop('percepciones')
|
||||||
|
node_name = f"{{{self.NOMINA['prefix']}}}Percepciones"
|
||||||
|
node = ET.SubElement(node_nomina, node_name, attr)
|
||||||
|
node_name = f"{{{self.NOMINA['prefix']}}}Percepcion"
|
||||||
|
for percepcion in percepciones:
|
||||||
|
ET.SubElement(node, node_name, percepcion)
|
||||||
|
|
||||||
|
if deducciones:
|
||||||
|
attr = deducciones
|
||||||
|
deducciones = attr.pop('deducciones')
|
||||||
|
node_name = f"{{{self.NOMINA['prefix']}}}Deducciones"
|
||||||
|
node = ET.SubElement(node_nomina, node_name, attr)
|
||||||
|
node_name = f"{{{self.NOMINA['prefix']}}}Deduccion"
|
||||||
|
for deduccion in deducciones:
|
||||||
|
ET.SubElement(node, node_name, deduccion)
|
||||||
|
|
||||||
|
if otros:
|
||||||
|
node_name = f"{{{self.NOMINA['prefix']}}}OtrosPagos"
|
||||||
|
node = ET.SubElement(node_nomina, node_name)
|
||||||
|
node_name = f"{{{self.NOMINA['prefix']}}}OtroPago"
|
||||||
|
for otro in otros:
|
||||||
|
subsidio = otro.pop('subsidio', {})
|
||||||
|
sub_node = ET.SubElement(node, node_name, otro)
|
||||||
|
if subsidio:
|
||||||
|
sub_name = f"{{{self.NOMINA['prefix']}}}SubsidioAlEmpleo"
|
||||||
|
ET.SubElement(sub_node, sub_name, subsidio)
|
||||||
|
return
|
||||||
|
|
||||||
|
|
||||||
|
def _validate_args_validar_cert(args):
|
||||||
|
data = {}
|
||||||
|
path_cert = args.dir_cert
|
||||||
|
name = args.nombre
|
||||||
|
|
||||||
|
if not _exists(path_cert):
|
||||||
|
msg = 'La ruta con los certificados es requerida'
|
||||||
|
log.error(msg)
|
||||||
|
return False, data
|
||||||
|
|
||||||
|
path_cer = _join(path_cert, f'{name}.cer')
|
||||||
|
path_key = _join(path_cert, f'{name}.key')
|
||||||
|
path_enc = _join(path_cert, f'{name}.enc')
|
||||||
|
|
||||||
|
if not _exists(path_cer):
|
||||||
|
msg = f'No se encontró el archivo CER en: {path_cer}'
|
||||||
|
log.error(msg)
|
||||||
|
return False, data
|
||||||
|
|
||||||
|
if not _exists(path_key):
|
||||||
|
msg = f'No se encontró el archivo KEY en: {path_key}'
|
||||||
|
log.error(msg)
|
||||||
|
return False, data
|
||||||
|
|
||||||
|
password = getpass.getpass('Introduce tu clave del archivo KEY: ')
|
||||||
|
if not password.strip():
|
||||||
|
msg = 'La clave es requerida'
|
||||||
|
log.error(msg)
|
||||||
|
return False, data
|
||||||
|
|
||||||
|
data['cer'] = path_cer
|
||||||
|
data['key'] = path_key
|
||||||
|
data['pass'] = password
|
||||||
|
data['enc'] = path_enc
|
||||||
|
|
||||||
|
return True, data
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
def validar_cert(args):
|
||||||
|
result, data = _validate_args_validar_cert(args)
|
||||||
|
if not result:
|
||||||
|
return
|
||||||
|
|
||||||
|
cer = open(data['cer'], 'rb').read()
|
||||||
|
key = open(data['key'], 'rb').read()
|
||||||
|
cert = SATCertificate(cer, key, password=data['pass'])
|
||||||
|
|
||||||
|
if cert.error:
|
||||||
|
log.error(cert.error)
|
||||||
|
return
|
||||||
|
|
||||||
|
if cert.is_fiel:
|
||||||
|
msg = 'El certificado es FIEL, no podrás timbrar.'
|
||||||
|
log.error(msg)
|
||||||
|
return
|
||||||
|
|
||||||
|
Path(data['enc']).write_bytes(cert.key_enc)
|
||||||
|
|
||||||
|
msg = 'Los datos del certificado son:'
|
||||||
|
log.info(msg)
|
||||||
|
log.info(f'\n{cert}')
|
||||||
|
msg = 'Puedes timbrar con estos certificados'
|
||||||
|
log.info(msg)
|
||||||
|
return
|
||||||
|
|
||||||
|
|
||||||
|
def _make(path, target):
|
||||||
|
with open(path, 'r', encoding='utf-8') as f:
|
||||||
|
data = json.loads(f.read())
|
||||||
|
|
||||||
|
cfdi = CFDI(data)
|
||||||
|
p = Path(path)
|
||||||
|
new_path = f'{target}/{p.stem}.xml'
|
||||||
|
cfdi.save(new_path)
|
||||||
|
log.info(f'\tGenerado: {new_path}')
|
||||||
|
return
|
||||||
|
|
||||||
|
|
||||||
|
def make(source, target):
|
||||||
|
docs = get_files(source, 'json')
|
||||||
|
for doc in docs:
|
||||||
|
log.info(f'Generando: {doc}')
|
||||||
|
_make(doc, target)
|
||||||
|
return
|
||||||
|
|
||||||
|
|
||||||
|
def _stamp(path, target):
|
||||||
|
current_path = os.path.dirname(__file__)
|
||||||
|
path_cer = join(current_path, 'certificados')
|
||||||
|
path_xslt = join(current_path, 'xslt', 'cadena.xslt')
|
||||||
|
doc = ET.parse(path)
|
||||||
|
|
||||||
|
for pac in PACs.keys():
|
||||||
|
xslt = open(path_xslt, 'rb')
|
||||||
|
cer = read_file(join(path_cer, f'{pac}.cer'))
|
||||||
|
key = read_file(join(path_cer, f'{pac}.enc'))
|
||||||
|
cert = SATCertificate(cer, key)
|
||||||
|
# ~ print(cert)
|
||||||
|
|
||||||
|
root = doc.getroot()
|
||||||
|
root.attrib['Fecha'] = datetime.datetime.now().isoformat()[:19]
|
||||||
|
root.attrib['NoCertificado'] = cert.serial_number
|
||||||
|
root.attrib['Certificado'] = cert.cer_txt
|
||||||
|
emisor = root.xpath('//cfdi:Emisor', namespaces=NS_CFDI)[0]
|
||||||
|
emisor.attrib['Rfc'] = cert.rfc
|
||||||
|
emisor.attrib['RegimenFiscal'] = '601'
|
||||||
|
|
||||||
|
transfor = ET.XSLT(ET.parse(xslt))
|
||||||
|
cadena = str(transfor(doc)).encode()
|
||||||
|
stamp = cert.sign(cadena)
|
||||||
|
root.attrib['Sello'] = stamp
|
||||||
|
xslt.close()
|
||||||
|
|
||||||
|
p = Path(path)
|
||||||
|
new_path = f'{target}/{p.stem}_{pac}.xml'
|
||||||
|
doc.write(new_path, pretty_print=True, encoding='utf-8',
|
||||||
|
doctype='<?xml version="1.0" encoding="utf-8"?>')
|
||||||
|
log.info(f'\tSellado: {new_path}')
|
||||||
|
|
||||||
|
return
|
||||||
|
|
||||||
|
|
||||||
|
def stamp(source, target):
|
||||||
|
docs = get_files(source)
|
||||||
|
for doc in docs:
|
||||||
|
log.info(f'Sellando: {doc}')
|
||||||
|
_stamp(doc, target)
|
||||||
|
return
|
||||||
|
|
||||||
|
|
||||||
|
def _stamp_pac(path, target):
|
||||||
|
pac = None
|
||||||
|
for key in PACs.keys():
|
||||||
|
if key in path:
|
||||||
|
pac = PACs[key]()
|
||||||
|
break
|
||||||
|
|
||||||
|
if pac is None:
|
||||||
|
msg = 'Diferente PAC en documento'
|
||||||
|
log.debug(msg)
|
||||||
|
return
|
||||||
|
|
||||||
|
data = open(path, 'rb').read()
|
||||||
|
xml = pac.stamp(data)
|
||||||
|
|
||||||
|
if pac.error:
|
||||||
|
log.error(pac.error)
|
||||||
|
return
|
||||||
|
|
||||||
|
p = Path(path)
|
||||||
|
new_path = f'{target}/{p.stem}_timbrada.xml'
|
||||||
|
|
||||||
|
with open(new_path, 'w') as f:
|
||||||
|
f.write(xml)
|
||||||
|
log.info(f'\tTimbrada: {new_path}')
|
||||||
|
return
|
||||||
|
|
||||||
|
|
||||||
|
def stamp_pac(source, target):
|
||||||
|
docs = get_files(source)
|
||||||
|
for doc in docs:
|
||||||
|
log.info(f'Enviando: {doc}')
|
||||||
|
_stamp_pac(doc, target)
|
||||||
|
return
|
||||||
|
|
||||||
|
|
||||||
|
def read_file(path):
|
||||||
|
with open(path, 'rb') as f:
|
||||||
|
data = f.read()
|
||||||
|
return data
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
def get_files(path, ext='xml'):
|
||||||
|
docs = []
|
||||||
|
for folder, _, files in os.walk(path):
|
||||||
|
pattern = re.compile('\.{}'.format(ext), re.IGNORECASE)
|
||||||
|
docs += [join(folder,f) for f in files if pattern.search(f)]
|
||||||
|
return tuple(docs)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
def _replace_ext(path, ext):
|
||||||
|
return str(Path(path).with_suffix(ext))
|
|
@ -0,0 +1,345 @@
|
||||||
|
<?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="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,181 @@
|
||||||
|
<?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:cce11="http://www.sat.gob.mx/ComercioExterior11">
|
||||||
|
|
||||||
|
<xsl:template match="cce11: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="./@TipoOperacion" />
|
||||||
|
</xsl:call-template>
|
||||||
|
<xsl:call-template name="Opcional">
|
||||||
|
<xsl:with-param name="valor" select="./@ClaveDePedimento" />
|
||||||
|
</xsl:call-template>
|
||||||
|
<xsl:call-template name="Opcional">
|
||||||
|
<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="./@Subdivision" />
|
||||||
|
</xsl:call-template>
|
||||||
|
<xsl:call-template name="Opcional">
|
||||||
|
<xsl:with-param name="valor" select="./@Observaciones" />
|
||||||
|
</xsl:call-template>
|
||||||
|
<xsl:call-template name="Opcional">
|
||||||
|
<xsl:with-param name="valor" select="./@TipoCambioUSD" />
|
||||||
|
</xsl:call-template>
|
||||||
|
<xsl:call-template name="Opcional">
|
||||||
|
<xsl:with-param name="valor" select="./@TotalUSD" />
|
||||||
|
</xsl:call-template>
|
||||||
|
|
||||||
|
<!-- Iniciamos el manejo de los elementos hijo en la secuencia -->
|
||||||
|
<xsl:apply-templates select="./cce11:Emisor" />
|
||||||
|
<xsl:for-each select="./cce11:Propietario">
|
||||||
|
<xsl:apply-templates select="."/>
|
||||||
|
</xsl:for-each>
|
||||||
|
<xsl:apply-templates select="./cce11:Receptor" />
|
||||||
|
<xsl:for-each select="./cce11:Destinatario">
|
||||||
|
<xsl:apply-templates select="."/>
|
||||||
|
</xsl:for-each>
|
||||||
|
<xsl:apply-templates select="./cce11:Mercancias" />
|
||||||
|
</xsl:template>
|
||||||
|
|
||||||
|
<xsl:template match="cce11:Emisor">
|
||||||
|
<!-- Iniciamos el tratamiento de los atributos de cce11:Emisor-->
|
||||||
|
<xsl:call-template name="Opcional">
|
||||||
|
<xsl:with-param name="valor" select="./@Curp" />
|
||||||
|
</xsl:call-template>
|
||||||
|
|
||||||
|
<xsl:apply-templates select="./cce11:Domicilio" />
|
||||||
|
|
||||||
|
</xsl:template>
|
||||||
|
|
||||||
|
<xsl:template match="cce11:Propietario">
|
||||||
|
<!-- Tratamiento de los atributos de cce11: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="cce11:Receptor">
|
||||||
|
<!-- Tratamiento de los atributos de cce11:Receptor-->
|
||||||
|
|
||||||
|
<xsl:call-template name="Opcional">
|
||||||
|
<xsl:with-param name="valor" select="./@NumRegIdTrib" />
|
||||||
|
</xsl:call-template>
|
||||||
|
<xsl:apply-templates select="./cce11:Domicilio" />
|
||||||
|
|
||||||
|
</xsl:template>
|
||||||
|
|
||||||
|
<xsl:template match="cce11:Destinatario">
|
||||||
|
<!-- Tratamiento de los atributos de cce11: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="./cce11:Domicilio">
|
||||||
|
<xsl:apply-templates select="."/>
|
||||||
|
</xsl:for-each>
|
||||||
|
</xsl:template>
|
||||||
|
|
||||||
|
<xsl:template match="cce11:Mercancias">
|
||||||
|
<!-- Iniciamos el manejo de los nodos dependientes -->
|
||||||
|
<xsl:for-each select="./cce11:Mercancia">
|
||||||
|
<xsl:apply-templates select="."/>
|
||||||
|
</xsl:for-each>
|
||||||
|
</xsl:template>
|
||||||
|
|
||||||
|
<xsl:template match="cce11:Domicilio">
|
||||||
|
<!-- Iniciamos el tratamiento de los atributos de cce11: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="cce11: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="./cce11:DescripcionesEspecificas">
|
||||||
|
<xsl:apply-templates select="."/>
|
||||||
|
</xsl:for-each>
|
||||||
|
</xsl:template>
|
||||||
|
|
||||||
|
<xsl:template match="cce11: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,13 @@
|
||||||
|
<?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:divisas="http://www.sat.gob.mx/divisas">
|
||||||
|
<!-- Manejador de nodos tipo divisas:Divisas -->
|
||||||
|
<xsl:template match="divisas:Divisas">
|
||||||
|
<!-- Iniciamos el tratamiento de los atributos de divisas:Divisas -->
|
||||||
|
<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="./@tipoOperacion"/>
|
||||||
|
</xsl:call-template>
|
||||||
|
</xsl:template>
|
||||||
|
</xsl:stylesheet>
|
|
@ -0,0 +1,13 @@
|
||||||
|
<?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:donat="http://www.sat.gob.mx/donat">
|
||||||
|
<xsl:output method="text" version="1.0" encoding="UTF-8" indent="no"/>
|
||||||
|
<!-- Manejador de nodos tipo donat:Donatarias -->
|
||||||
|
<xsl:template match="donat:Donatarias">
|
||||||
|
<!-- Iniciamos el tratamiento de los atributos de donat:Donatarias -->
|
||||||
|
<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="./@noAutorizacion"/></xsl:call-template>
|
||||||
|
<xsl:call-template name="Requerido"><xsl:with-param name="valor" select="./@fechaAutorizacion"/></xsl:call-template>
|
||||||
|
<xsl:call-template name="Requerido"><xsl:with-param name="valor" select="./@leyenda"/></xsl:call-template>
|
||||||
|
</xsl:template>
|
||||||
|
|
||||||
|
</xsl:stylesheet>
|
|
@ -0,0 +1,26 @@
|
||||||
|
<?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:iedu="http://www.sat.gob.mx/iedu">
|
||||||
|
<xsl:output method="text" version="1.0" encoding="UTF-8" indent="no"/>
|
||||||
|
<!-- Manejador de nodos tipo iedu -->
|
||||||
|
<xsl:template match="iedu:instEducativas">
|
||||||
|
<!--Iniciamos el tratamiento de los atributos de instEducativas -->
|
||||||
|
<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="./@nombreAlumno"/>
|
||||||
|
</xsl:call-template>
|
||||||
|
<xsl:call-template name="Requerido">
|
||||||
|
<xsl:with-param name="valor" select="./@CURP"/>
|
||||||
|
</xsl:call-template>
|
||||||
|
<xsl:call-template name="Requerido">
|
||||||
|
<xsl:with-param name="valor" select="./@nivelEducativo"/>
|
||||||
|
</xsl:call-template>
|
||||||
|
<xsl:call-template name="Requerido">
|
||||||
|
<xsl:with-param name="valor" select="./@autRVOE"/>
|
||||||
|
</xsl:call-template>
|
||||||
|
<xsl:call-template name="Opcional">
|
||||||
|
<xsl:with-param name="valor" select="./@rfcPago"/>
|
||||||
|
</xsl:call-template>
|
||||||
|
</xsl:template>
|
||||||
|
</xsl:stylesheet>
|
|
@ -0,0 +1,39 @@
|
||||||
|
<?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:implocal="http://www.sat.gob.mx/implocal">
|
||||||
|
<xsl:output method="text" version="1.0" encoding="UTF-8" indent="no"/>
|
||||||
|
<!-- Manejador de nodos tipo implocal -->
|
||||||
|
<xsl:template match="implocal:ImpuestosLocales">
|
||||||
|
<!--Iniciamos el tratamiento de los atributos de ImpuestosLocales -->
|
||||||
|
<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="./@TotaldeRetenciones"/>
|
||||||
|
</xsl:call-template>
|
||||||
|
<xsl:call-template name="Requerido">
|
||||||
|
<xsl:with-param name="valor" select="./@TotaldeTraslados"/>
|
||||||
|
</xsl:call-template>
|
||||||
|
<xsl:for-each select="implocal:RetencionesLocales">
|
||||||
|
<xsl:call-template name="Requerido">
|
||||||
|
<xsl:with-param name="valor" select="./@ImpLocRetenido"/>
|
||||||
|
</xsl:call-template>
|
||||||
|
<xsl:call-template name="Requerido">
|
||||||
|
<xsl:with-param name="valor" select="./@TasadeRetencion"/>
|
||||||
|
</xsl:call-template>
|
||||||
|
<xsl:call-template name="Requerido">
|
||||||
|
<xsl:with-param name="valor" select="./@Importe"/>
|
||||||
|
</xsl:call-template>
|
||||||
|
</xsl:for-each>
|
||||||
|
<xsl:for-each select="implocal:TrasladosLocales">
|
||||||
|
<xsl:call-template name="Requerido">
|
||||||
|
<xsl:with-param name="valor" select="./@ImpLocTrasladado"/>
|
||||||
|
</xsl:call-template>
|
||||||
|
<xsl:call-template name="Requerido">
|
||||||
|
<xsl:with-param name="valor" select="./@TasadeTraslado"/>
|
||||||
|
</xsl:call-template>
|
||||||
|
<xsl:call-template name="Requerido">
|
||||||
|
<xsl:with-param name="valor" select="./@Importe"/>
|
||||||
|
</xsl:call-template>
|
||||||
|
</xsl:for-each>
|
||||||
|
</xsl:template>
|
||||||
|
</xsl:stylesheet>
|
|
@ -0,0 +1,51 @@
|
||||||
|
<?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:ine="http://www.sat.gob.mx/ine">
|
||||||
|
|
||||||
|
<xsl:template match="ine:INE">
|
||||||
|
<!--Manejador de nodos tipo INE-->
|
||||||
|
<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="./@TipoProceso" />
|
||||||
|
</xsl:call-template>
|
||||||
|
<xsl:call-template name="Opcional">
|
||||||
|
<xsl:with-param name="valor" select="./@TipoComite" />
|
||||||
|
</xsl:call-template>
|
||||||
|
<xsl:call-template name="Opcional">
|
||||||
|
<xsl:with-param name="valor" select="./@IdContabilidad" />
|
||||||
|
</xsl:call-template>
|
||||||
|
|
||||||
|
<!-- Iniciamos el manejo de los elementos hijo en la secuencia -->
|
||||||
|
<xsl:for-each select="./ine:Entidad">
|
||||||
|
<xsl:apply-templates select="."/>
|
||||||
|
</xsl:for-each>
|
||||||
|
</xsl:template>
|
||||||
|
|
||||||
|
<xsl:template match="ine:Entidad">
|
||||||
|
<!--Manejador de nodos tipo Entidad-->
|
||||||
|
<xsl:call-template name="Requerido">
|
||||||
|
<xsl:with-param name="valor" select="./@ClaveEntidad" />
|
||||||
|
</xsl:call-template>
|
||||||
|
<xsl:call-template name="Opcional">
|
||||||
|
<xsl:with-param name="valor" select="./@Ambito" />
|
||||||
|
</xsl:call-template>
|
||||||
|
|
||||||
|
<!-- Iniciamos el tratamiento de los atributos de ine:Contabilidad-->
|
||||||
|
<xsl:for-each select="./ine:Contabilidad">
|
||||||
|
<xsl:apply-templates select="."/>
|
||||||
|
</xsl:for-each>
|
||||||
|
|
||||||
|
</xsl:template>
|
||||||
|
|
||||||
|
<!-- Iniciamos el manejo de los elementos hijo en la secuencia Contabilidad-->
|
||||||
|
<xsl:template match="ine:Contabilidad">
|
||||||
|
<!-- Iniciamos el manejo de los nodos dependientes -->
|
||||||
|
<xsl:call-template name="Requerido">
|
||||||
|
<xsl:with-param name="valor" select="./@IdContabilidad" />
|
||||||
|
</xsl:call-template>
|
||||||
|
</xsl:template>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
</xsl:stylesheet>
|
|
@ -0,0 +1,28 @@
|
||||||
|
<?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" xmlns:leyendasFisc="http://www.sat.gob.mx/leyendasFiscales">
|
||||||
|
<xsl:output method="text" version="1.0" encoding="UTF-8" indent="no"/>
|
||||||
|
<!-- Manejador de nodos tipo leyendasFiscales -->
|
||||||
|
<xsl:template match="leyendasFisc:LeyendasFiscales">
|
||||||
|
<!--Iniciamos el tratamiento de los atributos del complemento LeyendasFiscales -->
|
||||||
|
<xsl:call-template name="Requerido">
|
||||||
|
<xsl:with-param name="valor" select="./@version"/>
|
||||||
|
</xsl:call-template>
|
||||||
|
<!-- Manejo de los atributos de las leyendas Fiscales-->
|
||||||
|
<xsl:for-each select="./leyendasFisc:Leyenda">
|
||||||
|
<xsl:apply-templates select="."/>
|
||||||
|
</xsl:for-each>
|
||||||
|
</xsl:template>
|
||||||
|
<!-- Manejador de nodos tipo Información de las leyendas -->
|
||||||
|
<xsl:template match="leyendasFisc:Leyenda">
|
||||||
|
<!-- Manejo de los atributos de la leyenda -->
|
||||||
|
<xsl:call-template name="Opcional">
|
||||||
|
<xsl:with-param name="valor" select="./@disposicionFiscal"/>
|
||||||
|
</xsl:call-template>
|
||||||
|
<xsl:call-template name="Opcional">
|
||||||
|
<xsl:with-param name="valor" select="./@norma"/>
|
||||||
|
</xsl:call-template>
|
||||||
|
<xsl:call-template name="Requerido">
|
||||||
|
<xsl:with-param name="valor" select="./@textoLeyenda"/>
|
||||||
|
</xsl:call-template>
|
||||||
|
</xsl:template>
|
||||||
|
</xsl:stylesheet>
|
|
@ -0,0 +1,412 @@
|
||||||
|
<?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:nomina12="http://www.sat.gob.mx/nomina12">
|
||||||
|
|
||||||
|
<xsl:template match="nomina12:Nomina">
|
||||||
|
<!--Manejador de nodos tipo Nomina-->
|
||||||
|
<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="./@TipoNomina" />
|
||||||
|
</xsl:call-template>
|
||||||
|
<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="./@FechaInicialPago" />
|
||||||
|
</xsl:call-template>
|
||||||
|
<xsl:call-template name="Requerido">
|
||||||
|
<xsl:with-param name="valor" select="./@FechaFinalPago" />
|
||||||
|
</xsl:call-template>
|
||||||
|
<xsl:call-template name="Requerido">
|
||||||
|
<xsl:with-param name="valor" select="./@NumDiasPagados" />
|
||||||
|
</xsl:call-template>
|
||||||
|
<xsl:call-template name="Opcional">
|
||||||
|
<xsl:with-param name="valor" select="./@TotalPercepciones" />
|
||||||
|
</xsl:call-template>
|
||||||
|
<xsl:call-template name="Opcional">
|
||||||
|
<xsl:with-param name="valor" select="./@TotalDeducciones" />
|
||||||
|
</xsl:call-template>
|
||||||
|
<xsl:call-template name="Opcional">
|
||||||
|
<xsl:with-param name="valor" select="./@TotalOtrosPagos" />
|
||||||
|
</xsl:call-template>
|
||||||
|
|
||||||
|
<!-- Iniciamos el manejo de los elementos hijo en la secuencia -->
|
||||||
|
<xsl:for-each select="./nomina12:Emisor">
|
||||||
|
<xsl:apply-templates select="."/>
|
||||||
|
</xsl:for-each>
|
||||||
|
|
||||||
|
<xsl:for-each select="./nomina12:Receptor">
|
||||||
|
<xsl:apply-templates select="."/>
|
||||||
|
</xsl:for-each>
|
||||||
|
|
||||||
|
<xsl:for-each select="./nomina12:Percepciones">
|
||||||
|
<xsl:apply-templates select="."/>
|
||||||
|
</xsl:for-each>
|
||||||
|
|
||||||
|
<xsl:for-each select="./nomina12:Deducciones">
|
||||||
|
<xsl:apply-templates select="."/>
|
||||||
|
</xsl:for-each>
|
||||||
|
|
||||||
|
<xsl:for-each select="./nomina12:OtrosPagos">
|
||||||
|
<xsl:apply-templates select="."/>
|
||||||
|
</xsl:for-each>
|
||||||
|
|
||||||
|
<xsl:for-each select="./nomina12:Incapacidades">
|
||||||
|
<xsl:apply-templates select="."/>
|
||||||
|
</xsl:for-each>
|
||||||
|
|
||||||
|
</xsl:template>
|
||||||
|
|
||||||
|
<xsl:template match="nomina12:Emisor">
|
||||||
|
<!--Manejador de nodos tipo nomina12:Emisor-->
|
||||||
|
<xsl:call-template name="Opcional">
|
||||||
|
<xsl:with-param name="valor" select="./@Curp" />
|
||||||
|
</xsl:call-template>
|
||||||
|
<xsl:call-template name="Opcional">
|
||||||
|
<xsl:with-param name="valor" select="./@RegistroPatronal" />
|
||||||
|
</xsl:call-template>
|
||||||
|
<xsl:call-template name="Opcional">
|
||||||
|
<xsl:with-param name="valor" select="./@RfcPatronOrigen" />
|
||||||
|
</xsl:call-template>
|
||||||
|
|
||||||
|
<!-- Iniciamos el tratamiento de los atributos de nomina12:EntidadSNCF-->
|
||||||
|
<xsl:for-each select="./nomina12:EntidadSNCF">
|
||||||
|
<xsl:apply-templates select="."/>
|
||||||
|
</xsl:for-each>
|
||||||
|
|
||||||
|
</xsl:template>
|
||||||
|
|
||||||
|
<!-- Iniciamos el manejo de los elementos hijo en la secuencia EntidadSNCF-->
|
||||||
|
<xsl:template match="nomina12:EntidadSNCF">
|
||||||
|
<!-- Iniciamos el manejo de los nodos dependientes -->
|
||||||
|
<xsl:call-template name="Requerido">
|
||||||
|
<xsl:with-param name="valor" select="./@OrigenRecurso" />
|
||||||
|
</xsl:call-template>
|
||||||
|
<xsl:call-template name="Opcional">
|
||||||
|
<xsl:with-param name="valor" select="./@MontoRecursoPropio" />
|
||||||
|
</xsl:call-template>
|
||||||
|
|
||||||
|
</xsl:template>
|
||||||
|
|
||||||
|
<xsl:template match="nomina12:Receptor">
|
||||||
|
<!--Manejador de nodos tipo nomina12:Receptor-->
|
||||||
|
<xsl:call-template name="Requerido">
|
||||||
|
<xsl:with-param name="valor" select="./@Curp" />
|
||||||
|
</xsl:call-template>
|
||||||
|
<xsl:call-template name="Opcional">
|
||||||
|
<xsl:with-param name="valor" select="./@NumSeguridadSocial" />
|
||||||
|
</xsl:call-template>
|
||||||
|
<xsl:call-template name="Opcional">
|
||||||
|
<xsl:with-param name="valor" select="./@FechaInicioRelLaboral" />
|
||||||
|
</xsl:call-template>
|
||||||
|
<xsl:call-template name="Opcional">
|
||||||
|
<xsl:with-param name="valor" select="./@Antigüedad" />
|
||||||
|
</xsl:call-template>
|
||||||
|
<xsl:call-template name="Requerido">
|
||||||
|
<xsl:with-param name="valor" select="./@TipoContrato" />
|
||||||
|
</xsl:call-template>
|
||||||
|
<xsl:call-template name="Opcional">
|
||||||
|
<xsl:with-param name="valor" select="./@Sindicalizado" />
|
||||||
|
</xsl:call-template>
|
||||||
|
<xsl:call-template name="Opcional">
|
||||||
|
<xsl:with-param name="valor" select="./@TipoJornada" />
|
||||||
|
</xsl:call-template>
|
||||||
|
<xsl:call-template name="Requerido">
|
||||||
|
<xsl:with-param name="valor" select="./@TipoRegimen" />
|
||||||
|
</xsl:call-template>
|
||||||
|
<xsl:call-template name="Requerido">
|
||||||
|
<xsl:with-param name="valor" select="./@NumEmpleado" />
|
||||||
|
</xsl:call-template>
|
||||||
|
<xsl:call-template name="Opcional">
|
||||||
|
<xsl:with-param name="valor" select="./@Departamento" />
|
||||||
|
</xsl:call-template>
|
||||||
|
<xsl:call-template name="Opcional">
|
||||||
|
<xsl:with-param name="valor" select="./@Puesto" />
|
||||||
|
</xsl:call-template>
|
||||||
|
<xsl:call-template name="Opcional">
|
||||||
|
<xsl:with-param name="valor" select="./@RiesgoPuesto" />
|
||||||
|
</xsl:call-template>
|
||||||
|
<xsl:call-template name="Requerido">
|
||||||
|
<xsl:with-param name="valor" select="./@PeriodicidadPago" />
|
||||||
|
</xsl:call-template>
|
||||||
|
<xsl:call-template name="Opcional">
|
||||||
|
<xsl:with-param name="valor" select="./@Banco" />
|
||||||
|
</xsl:call-template>
|
||||||
|
<xsl:call-template name="Opcional">
|
||||||
|
<xsl:with-param name="valor" select="./@CuentaBancaria" />
|
||||||
|
</xsl:call-template>
|
||||||
|
<xsl:call-template name="Opcional">
|
||||||
|
<xsl:with-param name="valor" select="./@SalarioBaseCotApor" />
|
||||||
|
</xsl:call-template>
|
||||||
|
<xsl:call-template name="Opcional">
|
||||||
|
<xsl:with-param name="valor" select="./@SalarioDiarioIntegrado" />
|
||||||
|
</xsl:call-template>
|
||||||
|
<xsl:call-template name="Requerido">
|
||||||
|
<xsl:with-param name="valor" select="./@ClaveEntFed" />
|
||||||
|
</xsl:call-template>
|
||||||
|
|
||||||
|
<!-- Iniciamos el tratamiento de los atributos de nomina12:SubContratacion-->
|
||||||
|
<xsl:for-each select="./nomina12:SubContratacion">
|
||||||
|
<xsl:apply-templates select="."/>
|
||||||
|
</xsl:for-each>
|
||||||
|
|
||||||
|
</xsl:template>
|
||||||
|
|
||||||
|
<!-- Iniciamos el manejo de los elementos hijo en la secuencia SubContratacion-->
|
||||||
|
<xsl:template match="nomina12:SubContratacion">
|
||||||
|
<!-- Iniciamos el manejo de los nodos dependientes -->
|
||||||
|
<xsl:call-template name="Requerido">
|
||||||
|
<xsl:with-param name="valor" select="./@RfcLabora" />
|
||||||
|
</xsl:call-template>
|
||||||
|
<xsl:call-template name="Requerido">
|
||||||
|
<xsl:with-param name="valor" select="./@PorcentajeTiempo" />
|
||||||
|
</xsl:call-template>
|
||||||
|
|
||||||
|
</xsl:template>
|
||||||
|
|
||||||
|
<xsl:template match="nomina12:Percepciones">
|
||||||
|
<!--Manejador de nodos tipo nomina12:Percepciones-->
|
||||||
|
<xsl:call-template name="Opcional">
|
||||||
|
<xsl:with-param name="valor" select="./@TotalSueldos" />
|
||||||
|
</xsl:call-template>
|
||||||
|
<xsl:call-template name="Opcional">
|
||||||
|
<xsl:with-param name="valor" select="./@TotalSeparacionIndemnizacion" />
|
||||||
|
</xsl:call-template>
|
||||||
|
<xsl:call-template name="Opcional">
|
||||||
|
<xsl:with-param name="valor" select="./@TotalJubilacionPensionRetiro" />
|
||||||
|
</xsl:call-template>
|
||||||
|
<xsl:call-template name="Requerido">
|
||||||
|
<xsl:with-param name="valor" select="./@TotalGravado" />
|
||||||
|
</xsl:call-template>
|
||||||
|
<xsl:call-template name="Requerido">
|
||||||
|
<xsl:with-param name="valor" select="./@TotalExento" />
|
||||||
|
</xsl:call-template>
|
||||||
|
|
||||||
|
<!-- Iniciamos el tratamiento de los atributos de nomina12:Percepcion-->
|
||||||
|
<xsl:for-each select="./nomina12:Percepcion">
|
||||||
|
<xsl:apply-templates select="."/>
|
||||||
|
</xsl:for-each>
|
||||||
|
|
||||||
|
<!-- Iniciamos el tratamiento de los atributos de nomina12:JubilacionPensionRetiro-->
|
||||||
|
<xsl:for-each select="./nomina12:JubilacionPensionRetiro">
|
||||||
|
<xsl:apply-templates select="."/>
|
||||||
|
</xsl:for-each>
|
||||||
|
|
||||||
|
<!-- Iniciamos el tratamiento de los atributos de nomina12:SeparacionIndemnizacion-->
|
||||||
|
<xsl:for-each select="./nomina12:SeparacionIndemnizacion">
|
||||||
|
<xsl:apply-templates select="."/>
|
||||||
|
</xsl:for-each>
|
||||||
|
|
||||||
|
</xsl:template>
|
||||||
|
<!-- Iniciamos el manejo de los elementos hijo en la secuencia Percepcion-->
|
||||||
|
<xsl:template match="nomina12:Percepcion">
|
||||||
|
<!--Manejador de nodos tipo nomina12:Percepcion-->
|
||||||
|
<xsl:call-template name="Requerido">
|
||||||
|
<xsl:with-param name="valor" select="./@TipoPercepcion" />
|
||||||
|
</xsl:call-template>
|
||||||
|
<xsl:call-template name="Requerido">
|
||||||
|
<xsl:with-param name="valor" select="./@Clave" />
|
||||||
|
</xsl:call-template>
|
||||||
|
<xsl:call-template name="Requerido">
|
||||||
|
<xsl:with-param name="valor" select="./@Concepto" />
|
||||||
|
</xsl:call-template>
|
||||||
|
<xsl:call-template name="Requerido">
|
||||||
|
<xsl:with-param name="valor" select="./@ImporteGravado" />
|
||||||
|
</xsl:call-template>
|
||||||
|
<xsl:call-template name="Requerido">
|
||||||
|
<xsl:with-param name="valor" select="./@ImporteExento" />
|
||||||
|
</xsl:call-template>
|
||||||
|
|
||||||
|
<!-- Iniciamos el tratamiento de los atributos de nomina12:AccionesOTitulos-->
|
||||||
|
<xsl:for-each select="./nomina12:AccionesOTitulos">
|
||||||
|
<xsl:apply-templates select="."/>
|
||||||
|
</xsl:for-each>
|
||||||
|
<!-- Iniciamos el tratamiento de los atributos de nomina12:HorasExtra-->
|
||||||
|
<xsl:for-each select="./nomina12:HorasExtra">
|
||||||
|
<xsl:apply-templates select="."/>
|
||||||
|
</xsl:for-each>
|
||||||
|
|
||||||
|
</xsl:template>
|
||||||
|
|
||||||
|
<!-- Iniciamos el manejo de los elementos hijo en la secuencia AccionesOTitulos-->
|
||||||
|
<xsl:template match="nomina12:AccionesOTitulos">
|
||||||
|
<!-- Iniciamos el manejo de los nodos dependientes -->
|
||||||
|
<xsl:call-template name="Requerido">
|
||||||
|
<xsl:with-param name="valor" select="./@ValorMercado" />
|
||||||
|
</xsl:call-template>
|
||||||
|
<xsl:call-template name="Requerido">
|
||||||
|
<xsl:with-param name="valor" select="./@PrecioAlOtorgarse" />
|
||||||
|
</xsl:call-template>
|
||||||
|
</xsl:template>
|
||||||
|
|
||||||
|
<!-- Iniciamos el manejo de los elementos hijo en la secuencia HorasExtra-->
|
||||||
|
<xsl:template match="nomina12:HorasExtra">
|
||||||
|
<!-- Iniciamos el manejo de los nodos dependientes -->
|
||||||
|
<xsl:call-template name="Requerido">
|
||||||
|
<xsl:with-param name="valor" select="./@Dias" />
|
||||||
|
</xsl:call-template>
|
||||||
|
<xsl:call-template name="Requerido">
|
||||||
|
<xsl:with-param name="valor" select="./@TipoHoras" />
|
||||||
|
</xsl:call-template>
|
||||||
|
<xsl:call-template name="Requerido">
|
||||||
|
<xsl:with-param name="valor" select="./@HorasExtra" />
|
||||||
|
</xsl:call-template>
|
||||||
|
<xsl:call-template name="Requerido">
|
||||||
|
<xsl:with-param name="valor" select="./@ImportePagado" />
|
||||||
|
</xsl:call-template>
|
||||||
|
</xsl:template>
|
||||||
|
|
||||||
|
<!-- Iniciamos el manejo de los elementos hijo en la secuencia JubilacionPensionRetiro-->
|
||||||
|
<xsl:template match="nomina12:JubilacionPensionRetiro">
|
||||||
|
<!--Manejador de nodos tipo nomina12:JubilacionPensionRetiro-->
|
||||||
|
<xsl:call-template name="Opcional">
|
||||||
|
<xsl:with-param name="valor" select="./@TotalUnaExhibicion" />
|
||||||
|
</xsl:call-template>
|
||||||
|
<xsl:call-template name="Opcional">
|
||||||
|
<xsl:with-param name="valor" select="./@TotalParcialidad" />
|
||||||
|
</xsl:call-template>
|
||||||
|
<xsl:call-template name="Opcional">
|
||||||
|
<xsl:with-param name="valor" select="./@MontoDiario" />
|
||||||
|
</xsl:call-template>
|
||||||
|
<xsl:call-template name="Requerido">
|
||||||
|
<xsl:with-param name="valor" select="./@IngresoAcumulable" />
|
||||||
|
</xsl:call-template>
|
||||||
|
<xsl:call-template name="Requerido">
|
||||||
|
<xsl:with-param name="valor" select="./@IngresoNoAcumulable" />
|
||||||
|
</xsl:call-template>
|
||||||
|
</xsl:template>
|
||||||
|
|
||||||
|
<!-- Iniciamos el manejo de los elementos hijo en la secuencia SeparacionIndemnizacion-->
|
||||||
|
<xsl:template match="nomina12:SeparacionIndemnizacion">
|
||||||
|
<!--Manejador de nodos tipo nomina12:JubilacionPensionRetiro-->
|
||||||
|
<xsl:call-template name="Requerido">
|
||||||
|
<xsl:with-param name="valor" select="./@TotalPagado" />
|
||||||
|
</xsl:call-template>
|
||||||
|
<xsl:call-template name="Requerido">
|
||||||
|
<xsl:with-param name="valor" select="./@NumAñosServicio" />
|
||||||
|
</xsl:call-template>
|
||||||
|
<xsl:call-template name="Requerido">
|
||||||
|
<xsl:with-param name="valor" select="./@UltimoSueldoMensOrd" />
|
||||||
|
</xsl:call-template>
|
||||||
|
<xsl:call-template name="Requerido">
|
||||||
|
<xsl:with-param name="valor" select="./@IngresoAcumulable" />
|
||||||
|
</xsl:call-template>
|
||||||
|
<xsl:call-template name="Requerido">
|
||||||
|
<xsl:with-param name="valor" select="./@IngresoNoAcumulable" />
|
||||||
|
</xsl:call-template>
|
||||||
|
</xsl:template>
|
||||||
|
|
||||||
|
<xsl:template match="nomina12:Deducciones">
|
||||||
|
<!--Manejador de nodos tipo nomina12:Deducciones-->
|
||||||
|
<xsl:call-template name="Opcional">
|
||||||
|
<xsl:with-param name="valor" select="./@TotalOtrasDeducciones" />
|
||||||
|
</xsl:call-template>
|
||||||
|
<xsl:call-template name="Opcional">
|
||||||
|
<xsl:with-param name="valor" select="./@TotalImpuestosRetenidos" />
|
||||||
|
</xsl:call-template>
|
||||||
|
|
||||||
|
<!-- Iniciamos el tratamiento de los atributos de nomina12:Deduccion-->
|
||||||
|
<xsl:for-each select="./nomina12:Deduccion">
|
||||||
|
<xsl:apply-templates select="."/>
|
||||||
|
</xsl:for-each>
|
||||||
|
|
||||||
|
</xsl:template>
|
||||||
|
|
||||||
|
<!-- Iniciamos el manejo de los elementos hijo en la secuencia Deduccion-->
|
||||||
|
<xsl:template match="nomina12:Deduccion">
|
||||||
|
<!--Manejador de nodos tipo nomina12:Deduccion-->
|
||||||
|
<xsl:call-template name="Requerido">
|
||||||
|
<xsl:with-param name="valor" select="./@TipoDeduccion" />
|
||||||
|
</xsl:call-template>
|
||||||
|
<xsl:call-template name="Requerido">
|
||||||
|
<xsl:with-param name="valor" select="./@Clave" />
|
||||||
|
</xsl:call-template>
|
||||||
|
<xsl:call-template name="Requerido">
|
||||||
|
<xsl:with-param name="valor" select="./@Concepto" />
|
||||||
|
</xsl:call-template>
|
||||||
|
<xsl:call-template name="Requerido">
|
||||||
|
<xsl:with-param name="valor" select="./@Importe" />
|
||||||
|
</xsl:call-template>
|
||||||
|
</xsl:template>
|
||||||
|
|
||||||
|
<xsl:template match="nomina12:OtrosPagos">
|
||||||
|
|
||||||
|
<!-- Iniciamos el tratamiento de los atributos de nomina12:OtroPago-->
|
||||||
|
<xsl:for-each select="./nomina12:OtroPago">
|
||||||
|
<xsl:apply-templates select="."/>
|
||||||
|
</xsl:for-each>
|
||||||
|
|
||||||
|
</xsl:template>
|
||||||
|
|
||||||
|
<!-- Iniciamos el manejo de los elementos hijo en la secuencia OtroPago-->
|
||||||
|
<xsl:template match="nomina12:OtroPago">
|
||||||
|
<!--Manejador de nodos tipo nomina12:OtroPago-->
|
||||||
|
<xsl:call-template name="Requerido">
|
||||||
|
<xsl:with-param name="valor" select="./@TipoOtroPago" />
|
||||||
|
</xsl:call-template>
|
||||||
|
<xsl:call-template name="Requerido">
|
||||||
|
<xsl:with-param name="valor" select="./@Clave" />
|
||||||
|
</xsl:call-template>
|
||||||
|
<xsl:call-template name="Requerido">
|
||||||
|
<xsl:with-param name="valor" select="./@Concepto" />
|
||||||
|
</xsl:call-template>
|
||||||
|
<xsl:call-template name="Requerido">
|
||||||
|
<xsl:with-param name="valor" select="./@Importe" />
|
||||||
|
</xsl:call-template>
|
||||||
|
|
||||||
|
<!-- Iniciamos el tratamiento de los atributos de nomina12:SubsidioAlEmpleo-->
|
||||||
|
<xsl:for-each select="./nomina12:SubsidioAlEmpleo">
|
||||||
|
<xsl:apply-templates select="."/>
|
||||||
|
</xsl:for-each>
|
||||||
|
<!-- Iniciamos el tratamiento de los atributos de nomina12:CompensacionSaldosAFavor-->
|
||||||
|
<xsl:for-each select="./nomina12:CompensacionSaldosAFavor">
|
||||||
|
<xsl:apply-templates select="."/>
|
||||||
|
</xsl:for-each>
|
||||||
|
|
||||||
|
</xsl:template>
|
||||||
|
|
||||||
|
<!-- Iniciamos el manejo de los elementos hijo en la secuencia SubsidioAlEmpleo-->
|
||||||
|
<xsl:template match="nomina12:SubsidioAlEmpleo">
|
||||||
|
<!--Manejador de nodos tipo nomina12:SubsidioAlEmpleo-->
|
||||||
|
<xsl:call-template name="Requerido">
|
||||||
|
<xsl:with-param name="valor" select="./@SubsidioCausado" />
|
||||||
|
</xsl:call-template>
|
||||||
|
</xsl:template>
|
||||||
|
|
||||||
|
<!-- Iniciamos el manejo de los elementos hijo en la secuencia CompensacionSaldosAFavor-->
|
||||||
|
<xsl:template match="nomina12:CompensacionSaldosAFavor">
|
||||||
|
<!--Manejador de nodos tipo nomina12:CompensacionSaldosAFavor-->
|
||||||
|
<xsl:call-template name="Requerido">
|
||||||
|
<xsl:with-param name="valor" select="./@SaldoAFavor" />
|
||||||
|
</xsl:call-template>
|
||||||
|
<xsl:call-template name="Requerido">
|
||||||
|
<xsl:with-param name="valor" select="./@Año" />
|
||||||
|
</xsl:call-template>
|
||||||
|
<xsl:call-template name="Requerido">
|
||||||
|
<xsl:with-param name="valor" select="./@RemanenteSalFav" />
|
||||||
|
</xsl:call-template>
|
||||||
|
</xsl:template>
|
||||||
|
|
||||||
|
<xsl:template match="nomina12:Incapacidades">
|
||||||
|
<!-- Iniciamos el tratamiento de los atributos de nomina12:Incapacidades-->
|
||||||
|
<xsl:for-each select="./nomina12:Incapacidad">
|
||||||
|
<xsl:apply-templates select="."/>
|
||||||
|
</xsl:for-each>
|
||||||
|
</xsl:template>
|
||||||
|
|
||||||
|
<!-- Iniciamos el manejo de los elementos hijo en la secuencia Incapacidad-->
|
||||||
|
<xsl:template match="nomina12:Incapacidad">
|
||||||
|
<!--Manejador de nodos tipo nomina12:Incapacidad-->
|
||||||
|
<xsl:call-template name="Requerido">
|
||||||
|
<xsl:with-param name="valor" select="./@DiasIncapacidad" />
|
||||||
|
</xsl:call-template>
|
||||||
|
<xsl:call-template name="Requerido">
|
||||||
|
<xsl:with-param name="valor" select="./@TipoIncapacidad" />
|
||||||
|
</xsl:call-template>
|
||||||
|
<xsl:call-template name="Opcional">
|
||||||
|
<xsl:with-param name="valor" select="./@ImporteMonetario" />
|
||||||
|
</xsl:call-template>
|
||||||
|
|
||||||
|
</xsl:template>
|
||||||
|
</xsl:stylesheet>
|
|
@ -0,0 +1,165 @@
|
||||||
|
<?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:pago10="http://www.sat.gob.mx/Pagos">
|
||||||
|
|
||||||
|
<xsl:template match="pago10: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 hijo en la secuencia -->
|
||||||
|
<xsl:for-each select="./pago10:Pago">
|
||||||
|
<xsl:apply-templates select="."/>
|
||||||
|
</xsl:for-each>
|
||||||
|
</xsl:template>
|
||||||
|
|
||||||
|
<xsl:template match="pago10: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 pago10:DocumentoRelacionado-->
|
||||||
|
<xsl:for-each select="./pago10:DoctoRelacionado">
|
||||||
|
<xsl:apply-templates select="."/>
|
||||||
|
</xsl:for-each>
|
||||||
|
<xsl:for-each select="./pago10:Impuestos">
|
||||||
|
<xsl:apply-templates select="."/>
|
||||||
|
</xsl:for-each>
|
||||||
|
</xsl:template>
|
||||||
|
|
||||||
|
<xsl:template match="pago10: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="./@TipoCambioDR" />
|
||||||
|
</xsl:call-template>
|
||||||
|
|
||||||
|
<xsl:call-template name="Requerido">
|
||||||
|
<xsl:with-param name="valor" select="./@MetodoDePagoDR" />
|
||||||
|
</xsl:call-template>
|
||||||
|
|
||||||
|
<xsl:call-template name="Opcional">
|
||||||
|
<xsl:with-param name="valor" select="./@NumParcialidad" />
|
||||||
|
</xsl:call-template>
|
||||||
|
|
||||||
|
<xsl:call-template name="Opcional">
|
||||||
|
<xsl:with-param name="valor" select="./@ImpSaldoAnt" />
|
||||||
|
</xsl:call-template>
|
||||||
|
|
||||||
|
<xsl:call-template name="Opcional">
|
||||||
|
<xsl:with-param name="valor" select="./@ImpPagado" />
|
||||||
|
</xsl:call-template>
|
||||||
|
|
||||||
|
<xsl:call-template name="Opcional">
|
||||||
|
<xsl:with-param name="valor" select="./@ImpSaldoInsoluto" />
|
||||||
|
</xsl:call-template>
|
||||||
|
|
||||||
|
</xsl:template>
|
||||||
|
|
||||||
|
<xsl:template match="pago10:Impuestos">
|
||||||
|
<xsl:call-template name="Opcional">
|
||||||
|
<xsl:with-param name="valor" select="./@TotalImpuestosRetenidos" />
|
||||||
|
</xsl:call-template>
|
||||||
|
<xsl:call-template name="Opcional">
|
||||||
|
<xsl:with-param name="valor" select="./@TotalImpuestosTrasladados" />
|
||||||
|
</xsl:call-template>
|
||||||
|
|
||||||
|
<xsl:apply-templates select="./pago10:Retenciones"/>
|
||||||
|
<xsl:apply-templates select="./pago10:Traslados"/>
|
||||||
|
|
||||||
|
</xsl:template>
|
||||||
|
|
||||||
|
<xsl:template match="pago10:Retenciones">
|
||||||
|
<xsl:for-each select="./pago10:Retencion">
|
||||||
|
<xsl:apply-templates select="."/>
|
||||||
|
</xsl:for-each>
|
||||||
|
</xsl:template>
|
||||||
|
|
||||||
|
<xsl:template match="pago10:Traslados">
|
||||||
|
<xsl:for-each select="./pago10:Traslado">
|
||||||
|
<xsl:apply-templates select="."/>
|
||||||
|
</xsl:for-each>
|
||||||
|
|
||||||
|
</xsl:template>
|
||||||
|
|
||||||
|
<xsl:template match="pago10: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:template>
|
||||||
|
|
||||||
|
<xsl:template match="pago10: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: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