Tfacturacionecotronica v4.0
This is a bookstore that serves to generate an electronic invoice (CFDI) according to the articles and laws established in the Law of Mexico and defined by the SAT.
The purpose is to serve as a free library, open source, easy to use in which with the community's effort is always updated and functional.
Some aspects that this library seeks to have:
- Be in force (updated)
- Do not depend on commercial libraries.
- Be easy to use.
- That can be easily integrated into any existing project.
- Have automated unit tests to corroborate the proper functioning of each function and class.
- Be implemented in classes (follow object -oriented programming rules).
- Hide the implementation details/technicians to the end user (the programmer who uses the class).
Technical requirements
- Have some edition of Delphi (at the moment only operation is guaranteed in Delphi Seattle)
- Have libaay32.dll libraries, ssleay32.dll and the executable opensssl.exe (only for automated tests) which are in the following league: http://www.opessl.org/related/binin.html
Limitations
From version 2.0 of the bookstore, which implements the support for CFDI V3.3 (July 2017), the use of the auto classes generated by Delphi is standardized for the management of the XML of the vouchers allowing the use of all the nodes, attributes and properties of each version as defined by the SAT, however the validations of the fields are omitted and now this responsibility will be in charge of the programmer of the programmer. Bookstore
For example, the bookstore will allow you to fill the Total attribute of the invoice with a chain, which is not correct but at the XML level is valid.
Authorized certification suppliers (PAC) supported by V2.0
- Ecodex - http://www.ecodex.com.mx
- Finkok - Collaboration of @PTORRES
- Merciodigital - collaboration of @ptorres
- Feasible Solution - Collaboration of @FFACCINETTO
- Multifacturas - http://www.multifacturas.com - Collaboration of @fdueas
Invoice accessories supported
For CFDI 4.0
- Vía Oop, using self -generated classes through XML Databinding of Delphi (IxmLDOCument, Ixmlnode, etc.)
- Digital Fiscal Timbre 1.1
- Payment Complement 2.0
- Local taxes 1.0
- Foreign Trade 1.1 - Collaboration of @fdueas
- Payroll 1.2 - Collaboration of @fdueas
- Public Notaries 1.0 - Collaboration of @fdueas
For CFDI 3.3
- Vía Oop, using self -generated classes through XML Databinding of Delphi (IxmLDOCument, IXMLNODE, etc.):
- Digital Fiscal Timbre 1.1
- Local taxes 1.0
- Payment complement 1.0
- Foreign Trade 1.1 - Collaboration of @fdueas
- Payroll 1.2 - Collaboration of @fdueas
- Public Notaries 1.0 - Collaboration of @fdueas
- Manual:
- All: The chain chain_3_3.xSlt has been modified so that any of the complements implemented by the SAT to date (2018-09-28) is taken into account when the original chain is generated, with this, although there is no specific class for a complement (eg: tcomercioexteriorv11), this can be added to the node <cfdi: complement
- Icomprobantefiscalv33.complement.addnode (<complement>) -> New instance IXMLNODE
- Ixmlnode.addnode (<name_nodohijo>)
- IXMLNODE.FINDNODE (<name_nodohix>)
- IXMLNODE.Attributenodes [<name_name>]. Text
- For more information about how to work with XML nodes in Delphi, consult: http://docwiki.embarcadero.com/radstudio/tokyo/en/working_with_xml_nodes
- The complement that is added manually must comply with the specifications established by the SAT for said complement. For more information consult the technical documentation of the complement to be added.
Technical documentation
From the V2.0 of the bookstore, the project, structure, its operation, etc. has been extensively documented. To do this we invite you to consult https://github.com/bambucode/tfacturaelectronica/wiki
Missing?
As of January 2022, there is a lack of implementing the following (in order of importance):
CFDI 4.0 generation Integrate Payment Complement 2.0 CFDI reading 3.3 CBB generation with changes for CFDI 3.3 . GENERATION FOR GENERATION/READING OF CFDI 3.2 (for compatibility and migration purposes) Launch exceptions based on the CFDI Errors Catalog 3.3 (Partial) To be able to include local taxes (3.2 and 3.3) . Payment complement With the help of @ffaccinetto- Other accessories (donutatories, hydrocarbons, etc.)
- Unity tests
- Validations of fields based on the multiple catalogs published by the SAT.
Support for previous editions of Delphi 7, Delphi 2007, 2010, XE1 etc. With the help of @fdueas- Perform tests in Delphi 2007, Delphi 2009 and Delphi 2010
Compatibility notes with other versions of Delphi
The support with Delphi 10.3 was added and tested successfully, so there should be no problems with Delphi 2009 and 2010 and other intermediate versions.
For support with Delphi 7, Delphi 2007, Delphi 2009 and Delphi 2010 it is necessary to use the Tperlregexp bookstore for the use of regular expressions, because the native support for the latter was added from Delphi XE1.
- This is found in the folder: LIB/EXTERNAL/LEGACY/TPERLREGEX (added 2018-09-25)
- It can also be downloaded from the page: https://www.regular-expressions.info/delphi.html or directly from: https://www.regular-expressions.info/download/tperlregex.zip
- In addition a copy of said bookstore is preserved from the repository: https://github.com/fdueas/tperlregex
- Once the file is downloaded, extract it in the folder from its convenience
- Add the folder that contains the files to the project Library Path (Project/Options/Delphi Compiler/Search Path) or Delphi IDE (Tools/Environment Options/Library/Library Path)
- For more information about the use of this bookstore consult: https://www.regular-expressions.info/delphi.html
- In order for the PAC Digital Trade to work, the Synacode Library is necessary, it is located in the Board of Directors of Lib Synapse
How can I help?
The bookstore has been released to the public for more than 8 years, however there is still a lot of work to do. You can start checking the "ISSUES" section of the project to see that you can collaborate, once you do you can send a Pull-Request to implement your changes.
If you are interested in improving, extending or correcting this bookstore for the benefit of the community and credit for you, get in touch through the official bookstore forum at https://github.com/bambucode/tfacturaelectronica/discussions
Technical support
The technical support is done through the community in the official forum of the bookstore which can be accessed at: https://github.com/bambucode/tfacturaelectronica/discussions. In addition, if you find any fault or would like some functionality, please report it on this page in the "ISSUES" section so that other users can collaborate and find a solution as a community, we thank you trying to correct any problem first before reporting it to at least know that you have tried to solve it on your account.
Additional notes
The executable that this library uses must have the OpenSSL DLL files in the same application of the application so that it can work. Consider this when generating an installer or will distribute its final application.
Icon provided by: http://pc.de/icons/
Compatibility with versions
The library has been tested only with Delphi 10.3, so there should be no problem with intermediate versions and although it has tried to maintain compatibility with versions since Delphi 7, if any error is found, favor of reporting it as soon as possible. Especially CFDI generation routines V3.2 have not been tested in versions prior to Delphi XE2. Before performing tests with previous versions of Rad Studio XE1, it is important to read the section "Compatibility notes with other versions of Delphi".
Current collaborators.
- Ing. Luis Carrasco - Bambú Code SA de CV - http://github.com/lcarrasco
- Ing. Eduardo Padilla - Bambú code sa de cv - https://github.com/epadillac
- Ing. Pablo Torres - http://www.tecsis.mx
- Felipe Faccinetto - https://github.com/ffaccinetto
- Mr. Francisco Armando Dueñas Rodriguez - https://github.com/fdueas