commit c961bc8c137d339c01b2c536dbc7992f6bbd00fd Author: Juan Ferrer Toribio Date: Mon Mar 14 09:23:40 2016 +0100 Initial commit diff --git a/setup.iss b/setup.iss new file mode 100755 index 0000000..a1f8869 --- /dev/null +++ b/setup.iss @@ -0,0 +1,125 @@ + +#define MyAppName "Verdnatura" +#define MyAppVersion "1.0" +#define MyAppPublisher "Verdnatura" +#define MyAppURL "http://www.verdnatura.es/" +#define MyAppExeName "setup.exe" + +[Setup] +; NOTE: The value of AppId uniquely identifies this application. +AppId={{7615F2D0-AB26-4EB0-948C-BBB2CE1151D7} +AppName={#MyAppName} +AppVersion={#MyAppVersion} +AppVerName={#MyAppName} {#MyAppVersion} +AppPublisher={#MyAppPublisher} +AppPublisherURL={#MyAppURL} +AppSupportURL={#MyAppURL} +AppUpdatesURL={#MyAppURL} +CreateAppDir=yes +DefaultDirName={pf}\{#MyAppName} +DefaultGroupName={#MyAppName} +LicenseFile=src\LICENSE.txt +SetupIconFile=src\icon.ico +Compression=lzma +SolidCompression=yes +PrivilegesRequired=admin +DisableStartupPrompt=yes +OutputDir=.. +OutputBaseFilename=vn-access +SignTool=signtool.exe sign \ + /a /f $qC:\cert.pfx$q /n $q{#MyAppPublisher}$q /t http://timestamp.comodoca.com/authenticode /d $q{#MyAppName}$q $f + +[Languages] +Name: "es"; MessagesFile: "compiler:Languages\Spanish.isl" + +[Dirs] +Name: "{app}"; \ + Flags: uninsalwaysuninstall +Name: "{sd}\fotos"; \ + Flags: uninsalwaysuninstall; \ + Permissions: users-modify + +[Files] +Source: "src\*"; \ + DestDir: "{app}"; Flags: ignoreversion +Source: "src\icons\*"; \ + DestDir: "{app}\icons"; Flags: ignoreversion +Source: "src\barcodex.ocx"; \ + DestDir: {sys}; Flags: onlyifdoesntexist regserver 32bit + +[Tasks] +Name: "desktopicon"; \ + Description: "{cm:CreateDesktopIcon}"; \ + GroupDescription: "{cm:AdditionalIcons}"; \ + Flags: unchecked + +[Icons] +Name: "{group}\Terminal Punto Venta"; \ + Parameters: "tpv"; \ + IconFileName: "{app}\icons\tpv.ico"; \ + FileName: "{app}\vn-access.hta"; \ + WorkingDir: "{app}" +Name: "{group}\Entradas"; \ + Parameters: "ent"; \ + IconFileName: "{app}\icons\ent.ico"; \ + FileName: "{app}\vn-access.hta"; \ + WorkingDir: "{app}" +Name: "{group}\Comparativa"; \ + Parameters: "com"; \ + IconFileName: "{app}\icons\com.ico"; \ + FileName: "{app}\vn-access.hta"; \ + WorkingDir: "{app}" +Name: "{group}\Encajado"; \ + Parameters: "enc"; \ + IconFileName: "{app}\icons\enc.ico"; \ + FileName: "{app}\vn-access.hta"; \ + WorkingDir: "{app}" +Name: "{group}\Etiquetas"; \ + Parameters: "eti"; \ + IconFileName: "{app}\icons\eti.ico"; \ + FileName: "{app}\vn-access.hta"; \ + WorkingDir: "{app}" +Name: "{group}\Lab"; \ + Parameters: "lab"; \ + IconFileName: "{app}\icons\lab.ico"; \ + FileName: "{app}\vn-access.hta"; \ + WorkingDir: "{app}" + +;Desktop icons + +Name: "{commondesktop}\Terminal Punto Venta"; \ + Parameters: "tpv"; \ + IconFileName: "{app}\icons\tpv.ico"; \ + FileName: "{app}\vn-access.hta"; \ + WorkingDir: "{app}"; \ + Tasks: desktopicon +Name: "{commondesktop}\Entradas"; \ + Parameters: "ent"; \ + IconFileName: "{app}\icons\ent.ico"; \ + FileName: "{app}\vn-access.hta"; \ + WorkingDir: "{app}"; \ + Tasks: desktopicon +Name: "{commondesktop}\Comparativa"; \ + Parameters: "com"; \ + IconFileName: "{app}\icons\com.ico"; \ + FileName: "{app}\vn-access.hta"; \ + WorkingDir: "{app}"; \ + Tasks: desktopicon +Name: "{commondesktop}\Encajado"; \ + Parameters: "enc"; \ + IconFileName: "{app}\icons\enc.ico"; \ + FileName: "{app}\vn-access.hta"; \ + WorkingDir: "{app}"; \ + Tasks: desktopicon +Name: "{commondesktop}\Etiquetas"; \ + Parameters: "eti"; \ + IconFileName: "{app}\icons\eti.ico"; \ + FileName: "{app}\vn-access.hta"; \ + WorkingDir: "{app}"; \ + Tasks: desktopicon +Name: "{commondesktop}\Lab"; \ + Parameters: "lab"; \ + IconFileName: "{app}\icons\lab.ico"; \ + FileName: "{app}\vn-access.hta"; \ + WorkingDir: "{app}"; \ + Tasks: desktopicon diff --git a/src/7za.exe b/src/7za.exe new file mode 100755 index 0000000..12b9499 Binary files /dev/null and b/src/7za.exe differ diff --git a/src/LICENSE.txt b/src/LICENSE.txt new file mode 100755 index 0000000..89e08fb --- /dev/null +++ b/src/LICENSE.txt @@ -0,0 +1,339 @@ + GNU GENERAL PUBLIC LICENSE + Version 2, June 1991 + + Copyright (C) 1989, 1991 Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +License is intended to guarantee your freedom to share and change free +software--to make sure the software is free for all its users. This +General Public License applies to most of the Free Software +Foundation's software and to any other program whose authors commit to +using it. (Some other Free Software Foundation software is covered by +the GNU Lesser General Public License instead.) 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 +this service 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 make restrictions that forbid +anyone to deny you these rights or to ask you to surrender the rights. +These restrictions translate to certain responsibilities for you if you +distribute copies of the software, or if you modify it. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must give the recipients all the rights that +you have. 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. + + We protect your rights with two steps: (1) copyright the software, and +(2) offer you this license which gives you legal permission to copy, +distribute and/or modify the software. + + Also, for each author's protection and ours, we want to make certain +that everyone understands that there is no warranty for this free +software. If the software is modified by someone else and passed on, we +want its recipients to know that what they have is not the original, so +that any problems introduced by others will not reflect on the original +authors' reputations. + + Finally, any free program is threatened constantly by software +patents. We wish to avoid the danger that redistributors of a free +program will individually obtain patent licenses, in effect making the +program proprietary. To prevent this, we have made it clear that any +patent must be licensed for everyone's free use or not licensed at all. + + The precise terms and conditions for copying, distribution and +modification follow. + + GNU GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License applies to any program or other work which contains +a notice placed by the copyright holder saying it may be distributed +under the terms of this General Public License. The "Program", below, +refers to any such program or work, and a "work based on the Program" +means either the Program or any derivative work under copyright law: +that is to say, a work containing the Program or a portion of it, +either verbatim or with modifications and/or translated into another +language. (Hereinafter, translation is included without limitation in +the term "modification".) Each licensee is addressed as "you". + +Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running the Program is not restricted, and the output from the Program +is covered only if its contents constitute a work based on the +Program (independent of having been made by running the Program). +Whether that is true depends on what the Program does. + + 1. You may copy and distribute 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 and disclaimer of warranty; keep intact all the +notices that refer to this License and to the absence of any warranty; +and give any other recipients of the Program a copy of this License +along with the Program. + +You may charge a fee for the physical act of transferring a copy, and +you may at your option offer warranty protection in exchange for a fee. + + 2. You may modify your copy or copies of the Program or any portion +of it, thus forming a work based on the Program, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + + a) You must cause the modified files to carry prominent notices + stating that you changed the files and the date of any change. + + b) You must cause any work that you distribute or publish, that in + whole or in part contains or is derived from the Program or any + part thereof, to be licensed as a whole at no charge to all third + parties under the terms of this License. + + c) If the modified program normally reads commands interactively + when run, you must cause it, when started running for such + interactive use in the most ordinary way, to print or display an + announcement including an appropriate copyright notice and a + notice that there is no warranty (or else, saying that you provide + a warranty) and that users may redistribute the program under + these conditions, and telling the user how to view a copy of this + License. (Exception: if the Program itself is interactive but + does not normally print such an announcement, your work based on + the Program is not required to print an announcement.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Program, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Program, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Program. + +In addition, mere aggregation of another work not based on the Program +with the Program (or with a work based on the Program) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may copy and distribute the Program (or a work based on it, +under Section 2) in object code or executable form under the terms of +Sections 1 and 2 above provided that you also do one of the following: + + a) Accompany it with the complete corresponding machine-readable + source code, which must be distributed under the terms of Sections + 1 and 2 above on a medium customarily used for software interchange; or, + + b) Accompany it with a written offer, valid for at least three + years, to give any third party, for a charge no more than your + cost of physically performing source distribution, a complete + machine-readable copy of the corresponding source code, to be + distributed under the terms of Sections 1 and 2 above on a medium + customarily used for software interchange; or, + + c) Accompany it with the information you received as to the offer + to distribute corresponding source code. (This alternative is + allowed only for noncommercial distribution and only if you + received the program in object code or executable form with such + an offer, in accord with Subsection b above.) + +The source code for a work means the preferred form of the work for +making modifications to it. For an executable work, complete source +code means all the source code for all modules it contains, plus any +associated interface definition files, plus the scripts used to +control compilation and installation of the executable. However, as a +special exception, the source code distributed need not include +anything that is normally distributed (in either source or binary +form) with the major components (compiler, kernel, and so on) of the +operating system on which the executable runs, unless that component +itself accompanies the executable. + +If distribution of executable or object code is made by offering +access to copy from a designated place, then offering equivalent +access to copy the source code from the same place counts as +distribution of the source code, even though third parties are not +compelled to copy the source along with the object code. + + 4. You may not copy, modify, sublicense, or distribute the Program +except as expressly provided under this License. Any attempt +otherwise to copy, modify, sublicense or distribute the Program is +void, and will automatically terminate your rights under this License. +However, parties who have received copies, or rights, from you under +this License will not have their licenses terminated so long as such +parties remain in full compliance. + + 5. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Program or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Program (or any work based on the +Program), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Program or works based on it. + + 6. Each time you redistribute the Program (or any work based on the +Program), the recipient automatically receives a license from the +original licensor to copy, distribute or modify the Program subject to +these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties to +this License. + + 7. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +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 +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Program at all. For example, if a patent +license would not permit royalty-free redistribution of the Program by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Program. + +If any portion of this section is held invalid or unenforceable under +any particular circumstance, the balance of the section is intended to +apply and the section as a whole is intended to apply in other +circumstances. + +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system, which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. + +This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License. + + 8. If the distribution and/or use of the Program is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Program under this License +may add an explicit geographical distribution limitation excluding +those countries, so that distribution is permitted only in or among +countries not thus excluded. In such case, this License incorporates +the limitation as if written in the body of this License. + + 9. The Free Software Foundation may publish revised and/or new versions +of the 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 a version number of this License which applies to it and "any +later version", you have the option of following the terms and conditions +either of that version or of any later version published by the Free +Software Foundation. If the Program does not specify a version number of +this License, you may choose any version ever published by the Free Software +Foundation. + + 10. If you wish to incorporate parts of the Program into other free +programs whose distribution conditions are different, write to the author +to ask for permission. For software which is copyrighted by the Free +Software Foundation, write to the Free Software Foundation; we sometimes +make exceptions for this. Our decision will be guided by the two goals +of preserving the free status of all derivatives of our free software and +of promoting the sharing and reuse of software generally. + + NO WARRANTY + + 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, 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. + + 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR +REDISTRIBUTE 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. + + 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 +convey the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + 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 2 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, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + +Also add information on how to contact you by electronic and paper mail. + +If the program is interactive, make it output a short notice like this +when it starts in an interactive mode: + + Gnomovision version 69, Copyright (C) year name of author + Gnomovision 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, the commands you use may +be called something other than `show w' and `show c'; they could even be +mouse-clicks or menu items--whatever suits your program. + +You should also get your employer (if you work as a programmer) or your +school, if any, to sign a "copyright disclaimer" for the program, if +necessary. Here is a sample; alter the names: + + Yoyodyne, Inc., hereby disclaims all copyright interest in the program + `Gnomovision' (which makes passes at compilers) written by James Hacker. + + , 1 April 1989 + Ty Coon, President of Vice + +This 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. diff --git a/src/barcodex.ocx b/src/barcodex.ocx new file mode 100755 index 0000000..8325194 Binary files /dev/null and b/src/barcodex.ocx differ diff --git a/src/cacert.pem b/src/cacert.pem new file mode 100755 index 0000000..f7bd939 --- /dev/null +++ b/src/cacert.pem @@ -0,0 +1,25 @@ +-----BEGIN CERTIFICATE----- +MIIEQzCCAyugAwIBAgIJAJimL+J4jUaQMA0GCSqGSIb3DQEBBQUAMIG2MQswCQYD +VQQGEwJFUzEdMBsGA1UECAwUQ29tdW5pZGFkIFZhbGVuY2lhbmExETAPBgNVBAcM +CFZhbGVuY2lhMR4wHAYDVQQKDBVWZXJkbmF0dXJhIExldmFudGUgU0wxFDASBgNV +BAsMC0luZm9ybWF0aWNhMRYwFAYDVQQDDA12ZXJkbmF0dXJhLmVzMScwJQYJKoZI +hvcNAQkBFhhob3N0bWFzdGVyQHZlcmRuYXR1cmEuZXMwIBcNMTMwNjExMTE1MjQ1 +WhgPMjA2MzA1MzAxMTUyNDVaMIG2MQswCQYDVQQGEwJFUzEdMBsGA1UECAwUQ29t +dW5pZGFkIFZhbGVuY2lhbmExETAPBgNVBAcMCFZhbGVuY2lhMR4wHAYDVQQKDBVW +ZXJkbmF0dXJhIExldmFudGUgU0wxFDASBgNVBAsMC0luZm9ybWF0aWNhMRYwFAYD +VQQDDA12ZXJkbmF0dXJhLmVzMScwJQYJKoZIhvcNAQkBFhhob3N0bWFzdGVyQHZl +cmRuYXR1cmEuZXMwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCsqq+h +1kUfZE19Inm3M2XF1ytIqXeIsXsiZ5T9aVdedQrF2xcVOr4dvJyE5zp9g7NNxy9T +FyAHPXiPWKSoX3w0uoQfLW9Hm19QZYu40hBD5oRrJy5m6l4JU3Gj0tnkvYc4m8Fl +2uEUT3ain0FE2I1XjKpL6eQi9TKjhgmWNRgDJUbllAB3lsQLkNfB6EFo2QJykiKl +aRi4UaHdSkd3zkUJyYRdcG7IxCFvsViKpwr3JF+TLXSN/oronLFgG8cKedrn+sMW +pBm2FZQKAh8hLT3QQQqQgGpQ2y4t2EVJkYVdcGBXCyWYDKegMXgJR10WunICFCaD +kM0P3pYQdtbgr7e9AgMBAAGjUDBOMB0GA1UdDgQWBBQ9+iZdf7pLNQItxs4o43dN +FZD0CTAfBgNVHSMEGDAWgBQ9+iZdf7pLNQItxs4o43dNFZD0CTAMBgNVHRMEBTAD +AQH/MA0GCSqGSIb3DQEBBQUAA4IBAQAcFzJhm3jjuexZf9tTgQfzwtsafLLsYkrm +EZOTkhvZFJYbBd8UngL5UPF1M3buSEV1VqsWCALLrFkxzbmjk5uM8cswZR/3J6un +7GFYWTEllVgkD8KmNA2b6j5uSuGCQmOccsR4069vwNjrvTbtQpEpEAAnDf6d5/N4 +MXuDozHq3iEYi7qyGf++5mp4D+82y2ONSUsiLgxqnMT5JX/yhDKI1IiX1ndyt+6r +ie2i2fzdOgovlAILuTM4hoUjPYFOxwmUwpxU2EAjPqo9Bi7bQiH+fv0QBzbpQ9on +DRHo7NuXaDG49nvatJjuf4DiDELBCTMeKBOk5hG7kyWCIwp5wr+w +-----END CERTIFICATE----- diff --git a/src/icon.ico b/src/icon.ico new file mode 100755 index 0000000..db00750 Binary files /dev/null and b/src/icon.ico differ diff --git a/src/icons/Thumbs.db b/src/icons/Thumbs.db new file mode 100755 index 0000000..e9c0df3 Binary files /dev/null and b/src/icons/Thumbs.db differ diff --git a/src/icons/com.ico b/src/icons/com.ico new file mode 100755 index 0000000..601ca50 Binary files /dev/null and b/src/icons/com.ico differ diff --git a/src/icons/enc.ico b/src/icons/enc.ico new file mode 100755 index 0000000..0dc90e8 Binary files /dev/null and b/src/icons/enc.ico differ diff --git a/src/icons/ent.ico b/src/icons/ent.ico new file mode 100755 index 0000000..e7c18e6 Binary files /dev/null and b/src/icons/ent.ico differ diff --git a/src/icons/eti.ico b/src/icons/eti.ico new file mode 100755 index 0000000..d8b7ffa Binary files /dev/null and b/src/icons/eti.ico differ diff --git a/src/icons/lab.ico b/src/icons/lab.ico new file mode 100755 index 0000000..db00750 Binary files /dev/null and b/src/icons/lab.ico differ diff --git a/src/icons/tpv.ico b/src/icons/tpv.ico new file mode 100755 index 0000000..cc1aeea Binary files /dev/null and b/src/icons/tpv.ico differ diff --git a/src/main.js b/src/main.js new file mode 100755 index 0000000..8cc510b --- /dev/null +++ b/src/main.js @@ -0,0 +1,342 @@ + +var Modules = +{ + 'tpv': 'TPV_MySQL2', + 'ent': 'ENT_MySQL', + 'com': 'COM_MySQL', + 'enc': 'ENC_MySQL', + 'eti': 'ETI', + 'lab': 'LAB_MySQL' +}; + +var App = +{ + appName: 'Verdnatura', + dsName: 'verdnatura', + regPath: 'HKCU\\Software\\Verdnatura', + odbcPath: 'HKCU\\Software\\ODBC\\ODBC.INI\\verdnatura', + remoteUrl: 'https://www.verdnatura.es/download', + + shell: new ActiveXObject ('WScript.Shell'), + fso: new ActiveXObject ('scripting.filesystemobject'), + + init: function () + { + var width = 420; + var height = 360; + + window.resizeTo (width, height); + window.moveTo ((screen.width - width) / 2, (screen.height - height) / 2); + }, + + _onLoad: function () + { + // Inicializa variables globales + + var split = Verdnatura.commandLine.match(/(?:[^\s"]+|"[^"]*")+/g); + + if (split.length > 1) + this.module = split[1].replace (/^"+|"+$/g, ''); + if (!this.module || Modules[this.module] === undefined) + this.module = 'tpv'; + + this.fileName = Modules[this.module]; + this.appDir = this.getEnv ('ProgramFiles') +'\\'+ this.appName; + this.moduleDir = this.shell.SpecialFolders ('AppData') +'\\'+ this.appName; + this.remoteFile = this.remoteUrl +'/'+ this.fileName +'.7z'; + this.compressFile = this.getEnv ('TEMP') +'\\'+ this.fileName +'.7z'; + this.mdbFile = this.moduleDir +'\\'+ this.fileName +'.mdb'; + + // Crea las entradas necesarias en el registro + + var configured = this.regRead (this.regPath, 'configured'); + + if (!configured) + { + var path; + + // Crea las entradas de configuración de Access + + path = 'HKCU\\Software\\Microsoft\\Office\\11.0\\Access\\Settings'; + this.regWrites (path, 'REG_DWORD', { + 'Level' : 1, + 'Confirm Document Deletions' : 0, + 'Confirm Action Queries' : 0, + 'Confirm Record Changes' : 0 + }); + + // Crea el ODBC de MySQL + + var dsDriverPath = this.getEnv ('ProgramFiles') + +'\\MySQL\\Connector ODBC 5.1\\myodbc5.dll'; + + this.regWrites (this.odbcPath, 'REG_SZ', { + 'Driver' : dsDriverPath, + 'DESCRIPTION' : this.appName, + 'SERVER' : 'db.verdnatura.es', + 'DATABASE' : 'vn2008', + 'SSLCA' : this.appDir +'\\cacert.pem', + 'SSLVERIFY' : 1, + 'AUTO_RECONNECT' : 1 + }); + + path = 'HKCU\\Software\\ODBC\\ODBC.INI\\ODBC Data Sources'; + this.regWrite (path, this.dsName, 'Mysql ODBC 5.1 Driver', 'REG_SZ'); + + this.regWrite (this.regPath, 'configured', 1, 'REG_DWORD'); + } + + // Carga los datos del formulario + + var user = this.regRead (this.odbcPath, 'UID'); + var password = this.regRead (this.odbcPath, 'PWD'); + var remember = this.regRead (this.regPath, 'remember'); + + if (user) + this.$('user').value = user; + + if (remember && password) + { + this.$('password').value = password; + this.$('remember').checked = true; + this._onEnterClick (); + } + else + this.reset (); + }, + + reset: function () + { + this.$('user').focus (); + this.$('user').select (); + this.$('password').value = ''; + }, + + _disableUi: function (disabled, loadMessage) + { + if (disabled) + this._hideMessage (); + else + loadMessage = ''; + + this.$('loading-message').innerHTML = loadMessage; + + this.$('user').disabled = disabled; + this.$('password').disabled = disabled; + this.$('remember').disabled = disabled; + this.$('enter').disabled = disabled; + + var display = disabled ? 'block' : 'none'; + this.$('background').style.display = display; + this.$('spinner').style.display = display; + }, + + _onKeyPress: function (e) + { + switch (e.keyCode) + { + case 13: // Enter + this._onEnterClick (); + break; + case 27: // Esc + window.close (); + break; + } + }, + + _onEnterClick: function () + { + this._disableUi (true, 'Cargando'); + setTimeout (function () {App.login();}, 0); + }, + + login: function () + { + var user = this.$('user').value; + var password = this.$('password').value; + + try { + if (!user || user === '') + throw new Error ('Introduce un nombre de usuario'); + if (!password || password === '') + throw new Error ('Introduce una contraseña'); + + this.regWrite (this.odbcPath, 'UID', user, 'REG_SZ'); + this.regWrite (this.odbcPath, 'PWD', password, 'REG_SZ'); + + // Obtiene la última versión usando la conexión ODBC de MySQL + + var mysqlConn = new ActiveXObject ('ADODB.Connection'); + + try { + mysqlConn.Open (this.dsName); + } + catch (e) { + throw new Error ('Usuario o contraseña incorrectos'); + } + + var sql = 'SELECT version FROM vn2008.versiones WHERE programa = \''+ this.module +'\''; + var rs = mysqlConn.execute (sql); + var lastVersion = parseInt (rs.fields(0).value); + + rs.close (); + mysqlConn.close (); + + // Obtiene el número de versión local del archivo MDB + + var localVersion = -1; + + if (this.fso.FileExists (this.mdbFile)) + { + var mdbConn = new ActiveXObject ('ADODB.Connection'); + mdbConn.open ('Provider=Microsoft.Jet.OLEDB.4.0; Data Source='+ this.mdbFile +';'); + + var oRs = new ActiveXObject ('ADODB.Recordset'); + oRs.Open ('SELECT Version FROM tblVariables', mdbConn); + localVersion = oRs.EOF ? -1 : parseInt (oRs('Version')); + + oRs.close (); + mdbConn.close (); + } + + // Compara la versión local con la última versión + + if (localVersion < lastVersion) + { + this._disableUi (true, 'Actualizando'); + var request = new ActiveXObject ('MSXML2.XMLHTTP'); + request.open ('GET', this.remoteFile, true); + request.onreadystatechange = function () {App._onRequestReady (request);}; + request.send (); + } + else + this.openMdb (); + } + catch (e) + { + //this.regWrite (this.odbcPath, 'PWD', '', 'REG_SZ'); + this._disableUi (false); + this.reset (); + this.showMessage (e.message); + } + }, + + _onRequestReady: function (request) + { + if (request.readyState !== 4) + return; + + try { + if (request.status !== 200) + throw new Error ('Error al actualizar: '+ request.statusText); + + if (this.fso.FileExists (this.compressFile)) + this.fso.DeleteFile (this.compressFile); + + var stream = new ActiveXObject ('ADODB.Stream'); + stream.Open (); + stream.Type = 1; //adTypeBinary + stream.Write (request.responseBody); + stream.Position = 0; + stream.SaveToFile (this.compressFile, 2); + stream.Close (); + + if (this.fso.FileExists (this.mdbFile)) + this.fso.DeleteFile (this.mdbFile); + + this.run ('7za e "'+ this.compressFile +'" -o"'+ this.moduleDir +'"', true); + this.fso.DeleteFile (this.compressFile); + this.openMdb (); + } + catch (e) + { + this.showMessage (e.message); + } + + this._disableUi (false); + }, + + openMdb: function () + { + var remember = this.$('remember').checked ? 1 : 0; + this.regWrite (this.regPath, 'remember', remember, 'REG_DWORD'); + + this.shell.exec ('"%ProgramFiles%\\Microsoft Office\\OFFICE11\\MSACCESS.EXE" "'+ + this.mdbFile +'" /cmd "'+ this.$('user').value +'"'); + window.close (); + }, + + showMessage: function (message) + { + if (this.messageTimeout) + clearTimeout (this.messageTimeout); + + var messageDiv = this.$('message'); + messageDiv.innerHTML = message; + messageDiv.style.display = 'block'; + this.messageTimeout = setTimeout (function () {App._hideMessage();}, 10000); + }, + + _onBodyClick: function () + { + this._hideMessage (); + }, + + _hideMessage: function () + { + if (this.messageTimeout) + { + this.$('message').style.display = 'none'; + clearTimeout (this.messageTimeout); + this.messageTimeout = null; + } + }, + + _onUnload: function () + { + this._disableUi (false); + }, + + $: function (id) + { + return document.getElementById (id); + }, + + run: function (command, wait) + { + if (!wait) + wait = false; + + this.shell.run (command, 0, wait); + }, + + getEnv: function (varName) + { + return this.shell.ExpandEnvironmentStrings ('%'+ varName +'%'); + }, + + regRead: function (path, key) + { + try { + var value = this.shell.RegRead (path +'\\'+ key); + } + catch (e) { + var value = null; + } + + return value; + }, + + regWrite: function (path, key, value, type) + { + this.shell.RegWrite (path +'\\'+ key, value, type); + }, + + regWrites: function (path, type, values) + { + for (var key in values) + this.regWrite (path, key, values[key], type); + } +}; + +App.init (); diff --git a/src/spinner.gif b/src/spinner.gif new file mode 100755 index 0000000..1432694 Binary files /dev/null and b/src/spinner.gif differ diff --git a/src/style.css b/src/style.css new file mode 100755 index 0000000..355f2e9 --- /dev/null +++ b/src/style.css @@ -0,0 +1,140 @@ +body +{ + font-size: 18px; + padding: .8em; + overflow: hidden; + color: #222; + font-family: Tahoma; +} + +/* Login form */ + +#logo +{ + margin-bottom: .5em; +} +button, +input, +select +{ + font-size: 1em; +} +#fields +{ + max-width: 10em; + margin: 0 auto; +} +#fields > div +{ + margin-top: .5em; +} +#fields > div > * +{ + display: block; +} +label +{ + font-weight: normal; + font-size: .9em; +} +input[type='text'], +input[type='password'] +{ + width: 100%; + border: none; + border-bottom: 1px solid #888; + font-size: .9em; + color: #666; + padding: .3em; +} +#checkbox +{ + margin-top: .8em; +} +#submit +{ + margin-top: .5em; +} +#checkbox, +#submit +{ + text-align: center; +} +button +{ + border: none; + color: #008D77; + background-color: transparent; + padding: .4em; + text-transform: uppercase; +} +button:hover +{ + background-color: #EEE; + cursor: pointer; +} + +/* Message */ + +#message +{ + z-index: 2; + position: absolute; + top: 2em; + left: 50%; + width: 16em; + padding: .5em; + margin-left: -8.25em; + border: 1px solid #644; + background-color: #EBB; + color: #644; + text-align: center; + font-size: .9em; + display: none; +} + +/* Spinner */ + +#background +{ + z-index: 1; + position: absolute; + width: 100%; + height: 100%; + background-color: black; + opacity: 0.7; + filter: alpha(opacity=70); + top: 0; + left: 0; + display: none; +} +#spinner +{ + z-index: 2; + position: absolute; + padding: .8em; + width: 10em; + height: 2em; + margin-top: -1.4em; + margin-left: -5.4em; + top: 50%; + left: 50%; + background-color: white; + display: none; + text-align: center; + border: 1px solid black; +} +#spinner * +{ + vertical-align: middle; +} +#spinner img +{ + width: 1.8em; + height: 1.8em; + margin-right: .5em; +} +#loading-message +{ + font-size: .9em; +} diff --git a/src/verdnatura.png b/src/verdnatura.png new file mode 100755 index 0000000..2b238b2 Binary files /dev/null and b/src/verdnatura.png differ diff --git a/src/vn-access.hta b/src/vn-access.hta new file mode 100755 index 0000000..975a7c1 --- /dev/null +++ b/src/vn-access.hta @@ -0,0 +1,66 @@ + + + + + Verdnatura + + + + + + +
+
+ + +
+
+ + +
+
+
+ + +
+
+ +
+
+
+
+ Cargando... + +
+
+
+ + +