├── .gitignore ├── LICENSE ├── README.md ├── docker-compose.yml ├── docker ├── 01_schema.sql ├── 99_sample-data.sql ├── README.md └── docker.env ├── jsfinance ├── __init__.py ├── __main__.py ├── assets │ ├── exit.gif │ └── logo.gif ├── core.py ├── db.py ├── tktools │ ├── __init__.py │ └── widgets.py ├── ui_categoria.py └── ui_main.py └── requirements.txt /.gitignore: -------------------------------------------------------------------------------- 1 | # Created by .ignore support plugin (hsz.mobi) 2 | 3 | .idea/ 4 | 5 | ### Python template 6 | # Byte-compiled / optimized / DLL files 7 | __pycache__/ 8 | *.py[cod] 9 | *$py.class 10 | 11 | # C extensions 12 | *.so 13 | 14 | # Distribution / packaging 15 | .Python 16 | build/ 17 | develop-eggs/ 18 | dist/ 19 | downloads/ 20 | eggs/ 21 | .eggs/ 22 | lib/ 23 | lib64/ 24 | parts/ 25 | sdist/ 26 | var/ 27 | wheels/ 28 | pip-wheel-metadata/ 29 | share/python-wheels/ 30 | *.egg-info/ 31 | .installed.cfg 32 | *.egg 33 | MANIFEST 34 | 35 | # PyInstaller 36 | # Usually these files are written by a python script from a template 37 | # before PyInstaller builds the exe, so as to inject date/other infos into it. 38 | *.manifest 39 | *.spec 40 | 41 | # Installer logs 42 | pip-log.txt 43 | pip-delete-this-directory.txt 44 | 45 | # Unit test / coverage reports 46 | htmlcov/ 47 | .tox/ 48 | .nox/ 49 | .coverage 50 | .coverage.* 51 | .cache 52 | nosetests.xml 53 | coverage.xml 54 | *.cover 55 | .hypothesis/ 56 | .pytest_cache/ 57 | 58 | # Translations 59 | *.mo 60 | *.pot 61 | 62 | # Django stuff: 63 | *.log 64 | local_settings.py 65 | db.sqlite3 66 | 67 | # Flask stuff: 68 | instance/ 69 | .webassets-cache 70 | 71 | # Scrapy stuff: 72 | .scrapy 73 | 74 | # Sphinx documentation 75 | docs/_build/ 76 | 77 | # PyBuilder 78 | target/ 79 | 80 | # Jupyter Notebook 81 | .ipynb_checkpoints 82 | 83 | # IPython 84 | profile_default/ 85 | ipython_config.py 86 | 87 | # pyenv 88 | .python-version 89 | 90 | # pipenv 91 | # According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control. 92 | # However, in case of collaboration, if having platform-specific dependencies or dependencies 93 | # having no cross-platform support, pipenv may install dependencies that don't work, or not 94 | # install all needed dependencies. 95 | #Pipfile.lock 96 | 97 | # celery beat schedule file 98 | celerybeat-schedule 99 | 100 | # SageMath parsed files 101 | *.sage.py 102 | 103 | # Environments 104 | .env 105 | .venv 106 | env/ 107 | venv/ 108 | ENV/ 109 | env.bak/ 110 | venv.bak/ 111 | 112 | # Spyder project settings 113 | .spyderproject 114 | .spyproject 115 | 116 | # Rope project settings 117 | .ropeproject 118 | 119 | # mkdocs documentation 120 | /site 121 | 122 | # mypy 123 | .mypy_cache/ 124 | .dmypy.json 125 | dmypy.json 126 | 127 | # Pyre type checker 128 | .pyre/ 129 | 130 | ### VirtualEnv template 131 | # Virtualenv 132 | # http://iamzed.com/2009/05/07/a-primer-on-virtualenv/ 133 | .Python 134 | [Bb]in 135 | [Ii]nclude 136 | [Ll]ib 137 | [Ll]ib64 138 | [Ll]ocal 139 | [Ss]cripts 140 | pyvenv.cfg 141 | .venv 142 | pip-selfcheck.json 143 | 144 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | GNU GENERAL PUBLIC LICENSE 2 | Version 2, June 1991 3 | 4 | Copyright (C) 1989, 1991 Free Software Foundation, Inc., 5 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 6 | Everyone is permitted to copy and distribute verbatim copies 7 | of this license document, but changing it is not allowed. 8 | 9 | Preamble 10 | 11 | The licenses for most software are designed to take away your 12 | freedom to share and change it. By contrast, the GNU General Public 13 | License is intended to guarantee your freedom to share and change free 14 | software--to make sure the software is free for all its users. This 15 | General Public License applies to most of the Free Software 16 | Foundation's software and to any other program whose authors commit to 17 | using it. (Some other Free Software Foundation software is covered by 18 | the GNU Lesser General Public License instead.) You can apply it to 19 | your programs, too. 20 | 21 | When we speak of free software, we are referring to freedom, not 22 | price. Our General Public Licenses are designed to make sure that you 23 | have the freedom to distribute copies of free software (and charge for 24 | this service if you wish), that you receive source code or can get it 25 | if you want it, that you can change the software or use pieces of it 26 | in new free programs; and that you know you can do these things. 27 | 28 | To protect your rights, we need to make restrictions that forbid 29 | anyone to deny you these rights or to ask you to surrender the rights. 30 | These restrictions translate to certain responsibilities for you if you 31 | distribute copies of the software, or if you modify it. 32 | 33 | For example, if you distribute copies of such a program, whether 34 | gratis or for a fee, you must give the recipients all the rights that 35 | you have. You must make sure that they, too, receive or can get the 36 | source code. And you must show them these terms so they know their 37 | rights. 38 | 39 | We protect your rights with two steps: (1) copyright the software, and 40 | (2) offer you this license which gives you legal permission to copy, 41 | distribute and/or modify the software. 42 | 43 | Also, for each author's protection and ours, we want to make certain 44 | that everyone understands that there is no warranty for this free 45 | software. If the software is modified by someone else and passed on, we 46 | want its recipients to know that what they have is not the original, so 47 | that any problems introduced by others will not reflect on the original 48 | authors' reputations. 49 | 50 | Finally, any free program is threatened constantly by software 51 | patents. We wish to avoid the danger that redistributors of a free 52 | program will individually obtain patent licenses, in effect making the 53 | program proprietary. To prevent this, we have made it clear that any 54 | patent must be licensed for everyone's free use or not licensed at all. 55 | 56 | The precise terms and conditions for copying, distribution and 57 | modification follow. 58 | 59 | GNU GENERAL PUBLIC LICENSE 60 | TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 61 | 62 | 0. This License applies to any program or other work which contains 63 | a notice placed by the copyright holder saying it may be distributed 64 | under the terms of this General Public License. The "Program", below, 65 | refers to any such program or work, and a "work based on the Program" 66 | means either the Program or any derivative work under copyright law: 67 | that is to say, a work containing the Program or a portion of it, 68 | either verbatim or with modifications and/or translated into another 69 | language. (Hereinafter, translation is included without limitation in 70 | the term "modification".) Each licensee is addressed as "you". 71 | 72 | Activities other than copying, distribution and modification are not 73 | covered by this License; they are outside its scope. The act of 74 | running the Program is not restricted, and the output from the Program 75 | is covered only if its contents constitute a work based on the 76 | Program (independent of having been made by running the Program). 77 | Whether that is true depends on what the Program does. 78 | 79 | 1. You may copy and distribute verbatim copies of the Program's 80 | source code as you receive it, in any medium, provided that you 81 | conspicuously and appropriately publish on each copy an appropriate 82 | copyright notice and disclaimer of warranty; keep intact all the 83 | notices that refer to this License and to the absence of any warranty; 84 | and give any other recipients of the Program a copy of this License 85 | along with the Program. 86 | 87 | You may charge a fee for the physical act of transferring a copy, and 88 | you may at your option offer warranty protection in exchange for a fee. 89 | 90 | 2. You may modify your copy or copies of the Program or any portion 91 | of it, thus forming a work based on the Program, and copy and 92 | distribute such modifications or work under the terms of Section 1 93 | above, provided that you also meet all of these conditions: 94 | 95 | a) You must cause the modified files to carry prominent notices 96 | stating that you changed the files and the date of any change. 97 | 98 | b) You must cause any work that you distribute or publish, that in 99 | whole or in part contains or is derived from the Program or any 100 | part thereof, to be licensed as a whole at no charge to all third 101 | parties under the terms of this License. 102 | 103 | c) If the modified program normally reads commands interactively 104 | when run, you must cause it, when started running for such 105 | interactive use in the most ordinary way, to print or display an 106 | announcement including an appropriate copyright notice and a 107 | notice that there is no warranty (or else, saying that you provide 108 | a warranty) and that users may redistribute the program under 109 | these conditions, and telling the user how to view a copy of this 110 | License. (Exception: if the Program itself is interactive but 111 | does not normally print such an announcement, your work based on 112 | the Program is not required to print an announcement.) 113 | 114 | These requirements apply to the modified work as a whole. If 115 | identifiable sections of that work are not derived from the Program, 116 | and can be reasonably considered independent and separate works in 117 | themselves, then this License, and its terms, do not apply to those 118 | sections when you distribute them as separate works. But when you 119 | distribute the same sections as part of a whole which is a work based 120 | on the Program, the distribution of the whole must be on the terms of 121 | this License, whose permissions for other licensees extend to the 122 | entire whole, and thus to each and every part regardless of who wrote it. 123 | 124 | Thus, it is not the intent of this section to claim rights or contest 125 | your rights to work written entirely by you; rather, the intent is to 126 | exercise the right to control the distribution of derivative or 127 | collective works based on the Program. 128 | 129 | In addition, mere aggregation of another work not based on the Program 130 | with the Program (or with a work based on the Program) on a volume of 131 | a storage or distribution medium does not bring the other work under 132 | the scope of this License. 133 | 134 | 3. You may copy and distribute the Program (or a work based on it, 135 | under Section 2) in object code or executable form under the terms of 136 | Sections 1 and 2 above provided that you also do one of the following: 137 | 138 | a) Accompany it with the complete corresponding machine-readable 139 | source code, which must be distributed under the terms of Sections 140 | 1 and 2 above on a medium customarily used for software interchange; or, 141 | 142 | b) Accompany it with a written offer, valid for at least three 143 | years, to give any third party, for a charge no more than your 144 | cost of physically performing source distribution, a complete 145 | machine-readable copy of the corresponding source code, to be 146 | distributed under the terms of Sections 1 and 2 above on a medium 147 | customarily used for software interchange; or, 148 | 149 | c) Accompany it with the information you received as to the offer 150 | to distribute corresponding source code. (This alternative is 151 | allowed only for noncommercial distribution and only if you 152 | received the program in object code or executable form with such 153 | an offer, in accord with Subsection b above.) 154 | 155 | The source code for a work means the preferred form of the work for 156 | making modifications to it. For an executable work, complete source 157 | code means all the source code for all modules it contains, plus any 158 | associated interface definition files, plus the scripts used to 159 | control compilation and installation of the executable. However, as a 160 | special exception, the source code distributed need not include 161 | anything that is normally distributed (in either source or binary 162 | form) with the major components (compiler, kernel, and so on) of the 163 | operating system on which the executable runs, unless that component 164 | itself accompanies the executable. 165 | 166 | If distribution of executable or object code is made by offering 167 | access to copy from a designated place, then offering equivalent 168 | access to copy the source code from the same place counts as 169 | distribution of the source code, even though third parties are not 170 | compelled to copy the source along with the object code. 171 | 172 | 4. You may not copy, modify, sublicense, or distribute the Program 173 | except as expressly provided under this License. Any attempt 174 | otherwise to copy, modify, sublicense or distribute the Program is 175 | void, and will automatically terminate your rights under this License. 176 | However, parties who have received copies, or rights, from you under 177 | this License will not have their licenses terminated so long as such 178 | parties remain in full compliance. 179 | 180 | 5. You are not required to accept this License, since you have not 181 | signed it. However, nothing else grants you permission to modify or 182 | distribute the Program or its derivative works. These actions are 183 | prohibited by law if you do not accept this License. Therefore, by 184 | modifying or distributing the Program (or any work based on the 185 | Program), you indicate your acceptance of this License to do so, and 186 | all its terms and conditions for copying, distributing or modifying 187 | the Program or works based on it. 188 | 189 | 6. Each time you redistribute the Program (or any work based on the 190 | Program), the recipient automatically receives a license from the 191 | original licensor to copy, distribute or modify the Program subject to 192 | these terms and conditions. You may not impose any further 193 | restrictions on the recipients' exercise of the rights granted herein. 194 | You are not responsible for enforcing compliance by third parties to 195 | this License. 196 | 197 | 7. If, as a consequence of a court judgment or allegation of patent 198 | infringement or for any other reason (not limited to patent issues), 199 | conditions are imposed on you (whether by court order, agreement or 200 | otherwise) that contradict the conditions of this License, they do not 201 | excuse you from the conditions of this License. If you cannot 202 | distribute so as to satisfy simultaneously your obligations under this 203 | License and any other pertinent obligations, then as a consequence you 204 | may not distribute the Program at all. For example, if a patent 205 | license would not permit royalty-free redistribution of the Program by 206 | all those who receive copies directly or indirectly through you, then 207 | the only way you could satisfy both it and this License would be to 208 | refrain entirely from distribution of the Program. 209 | 210 | If any portion of this section is held invalid or unenforceable under 211 | any particular circumstance, the balance of the section is intended to 212 | apply and the section as a whole is intended to apply in other 213 | circumstances. 214 | 215 | It is not the purpose of this section to induce you to infringe any 216 | patents or other property right claims or to contest validity of any 217 | such claims; this section has the sole purpose of protecting the 218 | integrity of the free software distribution system, which is 219 | implemented by public license practices. Many people have made 220 | generous contributions to the wide range of software distributed 221 | through that system in reliance on consistent application of that 222 | system; it is up to the author/donor to decide if he or she is willing 223 | to distribute software through any other system and a licensee cannot 224 | impose that choice. 225 | 226 | This section is intended to make thoroughly clear what is believed to 227 | be a consequence of the rest of this License. 228 | 229 | 8. If the distribution and/or use of the Program is restricted in 230 | certain countries either by patents or by copyrighted interfaces, the 231 | original copyright holder who places the Program under this License 232 | may add an explicit geographical distribution limitation excluding 233 | those countries, so that distribution is permitted only in or among 234 | countries not thus excluded. In such case, this License incorporates 235 | the limitation as if written in the body of this License. 236 | 237 | 9. The Free Software Foundation may publish revised and/or new versions 238 | of the General Public License from time to time. Such new versions will 239 | be similar in spirit to the present version, but may differ in detail to 240 | address new problems or concerns. 241 | 242 | Each version is given a distinguishing version number. If the Program 243 | specifies a version number of this License which applies to it and "any 244 | later version", you have the option of following the terms and conditions 245 | either of that version or of any later version published by the Free 246 | Software Foundation. If the Program does not specify a version number of 247 | this License, you may choose any version ever published by the Free Software 248 | Foundation. 249 | 250 | 10. If you wish to incorporate parts of the Program into other free 251 | programs whose distribution conditions are different, write to the author 252 | to ask for permission. For software which is copyrighted by the Free 253 | Software Foundation, write to the Free Software Foundation; we sometimes 254 | make exceptions for this. Our decision will be guided by the two goals 255 | of preserving the free status of all derivatives of our free software and 256 | of promoting the sharing and reuse of software generally. 257 | 258 | NO WARRANTY 259 | 260 | 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY 261 | FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN 262 | OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES 263 | PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED 264 | OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 265 | MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS 266 | TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE 267 | PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, 268 | REPAIR OR CORRECTION. 269 | 270 | 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING 271 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR 272 | REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, 273 | INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING 274 | OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED 275 | TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY 276 | YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER 277 | PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE 278 | POSSIBILITY OF SUCH DAMAGES. 279 | 280 | END OF TERMS AND CONDITIONS 281 | 282 | How to Apply These Terms to Your New Programs 283 | 284 | If you develop a new program, and you want it to be of the greatest 285 | possible use to the public, the best way to achieve this is to make it 286 | free software which everyone can redistribute and change under these terms. 287 | 288 | To do so, attach the following notices to the program. It is safest 289 | to attach them to the start of each source file to most effectively 290 | convey the exclusion of warranty; and each file should have at least 291 | the "copyright" line and a pointer to where the full notice is found. 292 | 293 | 294 | Copyright (C) 295 | 296 | This program is free software; you can redistribute it and/or modify 297 | it under the terms of the GNU General Public License as published by 298 | the Free Software Foundation; either version 2 of the License, or 299 | (at your option) any later version. 300 | 301 | This program is distributed in the hope that it will be useful, 302 | but WITHOUT ANY WARRANTY; without even the implied warranty of 303 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 304 | GNU General Public License for more details. 305 | 306 | You should have received a copy of the GNU General Public License along 307 | with this program; if not, write to the Free Software Foundation, Inc., 308 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 309 | 310 | Also add information on how to contact you by electronic and paper mail. 311 | 312 | If the program is interactive, make it output a short notice like this 313 | when it starts in an interactive mode: 314 | 315 | Gnomovision version 69, Copyright (C) year name of author 316 | Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. 317 | This is free software, and you are welcome to redistribute it 318 | under certain conditions; type `show c' for details. 319 | 320 | The hypothetical commands `show w' and `show c' should show the appropriate 321 | parts of the General Public License. Of course, the commands you use may 322 | be called something other than `show w' and `show c'; they could even be 323 | mouse-clicks or menu items--whatever suits your program. 324 | 325 | You should also get your employer (if you work as a programmer) or your 326 | school, if any, to sign a "copyright disclaimer" for the program, if 327 | necessary. Here is a sample; alter the names: 328 | 329 | Yoyodyne, Inc., hereby disclaims all copyright interest in the program 330 | `Gnomovision' (which makes passes at compilers) written by James Hacker. 331 | 332 | , 1 April 1989 333 | Ty Coon, President of Vice 334 | 335 | This General Public License does not permit incorporating your program into 336 | proprietary programs. If your program is a subroutine library, you may 337 | consider it more useful to permit linking proprietary applications with the 338 | library. If this is what you want to do, use the GNU Lesser General 339 | Public License instead of this License. 340 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # JS Finance 2 | O seu sistema de gestão financeira. 3 | 4 | ## Funcionalidades 5 | 6 | O _JS Finance_ tem tudo o que você precisa para manter seu dinheiro no bolso. 7 | 8 | Se maravilhe com esses recursos sensacionais de última geração: 9 | 10 | - Contas a pagar; 11 | - Contas a receber; 12 | 13 | ## Como contribuir 14 | 15 | - Clone o repositório. 16 | 17 | `git clone https://github.com/juliomsouza/jsfinance.git` 18 | 19 | - Crie um virtualenv. 20 | 21 | ``` 22 | cd jsfinance 23 | python -m venv .venv 24 | source .venv/bin/activate 25 | ``` 26 | 27 | - Crie um virtualenv (WINDOWS). 28 | 29 | ``` 30 | cd jsfinance 31 | virtualenv .venv 32 | .venv/Scripts/activate 33 | ``` 34 | 35 | - Instale as dependências. 36 | 37 | `pip install -r requirements.txt` 38 | 39 | - Crie o banco MySQL. 40 | 41 | ``` 42 | mysql -e 'create database JSFINANCE;' 43 | ``` 44 | 45 | - Crie as tabelas do banco. 46 | 47 | ``` 48 | mysql -e 'source contrib/schema.sql;' JSFINANCE 49 | ``` 50 | 51 | - Popule o banco com dados de exemplo: 52 | 53 | ``` 54 | mysql -e 'source contrib/sample-data.sql;' JSFINANCE 55 | ``` 56 | 57 | ou se preferir utilize o [Docker](docker/README.md) para subir a base de dados. 58 | 59 | - Crie um arquivo .env com a url de conexão do banco. 60 | 61 | ``` 62 | cat <> .env 63 | DATABASE_URL=mysql://root@127.0.0.1:3306/JSFINANCE 64 | HELPDESK_URL=http://stackoverflow.com/ 65 | EOT 66 | ``` 67 | 68 | - Rode o programa: 69 | 70 | `python -m jsfinance` 71 | 72 | ## Autor 73 | 74 | - Julio M. Souza 75 | 76 | ## Colaboradores 77 | 78 | - Henrique Bastos 79 | 80 | ## Licença 81 | 82 | GPL 2.0 83 | -------------------------------------------------------------------------------- /docker-compose.yml: -------------------------------------------------------------------------------- 1 | version: '3.0' 2 | services: 3 | mysql: 4 | container_name: mysql 5 | image: mysql:8.0.16 6 | env_file: 7 | - docker/docker.env 8 | volumes: 9 | - ./docker/:/docker-entrypoint-initdb.d/ 10 | # - ./data:/var/lib/mysql 11 | ports: 12 | - 3306:3306 13 | -------------------------------------------------------------------------------- /docker/01_schema.sql: -------------------------------------------------------------------------------- 1 | -- MySQL dump 10.13 Distrib 5.7.26, for Linux (x86_64) 2 | -- 3 | -- Host: localhost Database: FINANCAS 4 | -- ------------------------------------------------------ 5 | -- Server version 5.7.26 6 | 7 | /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; 8 | /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; 9 | /*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; 10 | /*!40101 SET NAMES utf8 */; 11 | /*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */; 12 | /*!40103 SET TIME_ZONE='+00:00' */; 13 | /*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */; 14 | /*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */; 15 | /*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */; 16 | /*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */; 17 | 18 | -- 19 | -- Table structure for table `CATEGORIAS` 20 | -- 21 | 22 | DROP TABLE IF EXISTS `CATEGORIAS`; 23 | /*!40101 SET @saved_cs_client = @@character_set_client */; 24 | /*!40101 SET character_set_client = utf8 */; 25 | CREATE TABLE `CATEGORIAS` ( 26 | `ID_CAT` int(11) NOT NULL AUTO_INCREMENT, 27 | `DESC_CAT` varchar(100) DEFAULT NULL, 28 | `OBS_CAT` varchar(120) DEFAULT NULL, 29 | PRIMARY KEY (`ID_CAT`) 30 | ) ENGINE=InnoDB AUTO_INCREMENT=8 DEFAULT CHARSET=latin1; 31 | /*!40101 SET character_set_client = @saved_cs_client */; 32 | 33 | -- 34 | -- Table structure for table `CONTAS_PAGAR` 35 | -- 36 | 37 | DROP TABLE IF EXISTS `CONTAS_PAGAR`; 38 | /*!40101 SET @saved_cs_client = @@character_set_client */; 39 | /*!40101 SET character_set_client = utf8 */; 40 | CREATE TABLE `CONTAS_PAGAR` ( 41 | `IDCONTA` int(11) NOT NULL AUTO_INCREMENT, 42 | `ID_CAT` int(11) DEFAULT NULL, 43 | `VALOR` double(10,2) DEFAULT NULL, 44 | `DATA_COMPRA` date DEFAULT NULL, 45 | `DATA_VENCIMENTO` date DEFAULT NULL, 46 | `PAGO` enum('SIM','NAO') DEFAULT NULL, 47 | `DATA_PGTO` date DEFAULT NULL, 48 | `TIPO_PGTO` varchar(40) DEFAULT NULL, 49 | `OBS` varchar(50) DEFAULT NULL, 50 | PRIMARY KEY (`IDCONTA`) 51 | ) ENGINE=InnoDB AUTO_INCREMENT=259 DEFAULT CHARSET=latin1; 52 | /*!40101 SET character_set_client = @saved_cs_client */; 53 | 54 | -- 55 | -- Table structure for table `ENTRADAS` 56 | -- 57 | 58 | DROP TABLE IF EXISTS `ENTRADAS`; 59 | /*!40101 SET @saved_cs_client = @@character_set_client */; 60 | /*!40101 SET character_set_client = utf8 */; 61 | CREATE TABLE `ENTRADAS` ( 62 | `ID` int(11) NOT NULL AUTO_INCREMENT, 63 | `FONTE_PGTO` varchar(100) DEFAULT NULL, 64 | `VALOR` decimal(10,2) DEFAULT NULL, 65 | `DATA_PGTO` date DEFAULT NULL, 66 | `OBSERVACOES` varchar(200) DEFAULT NULL, 67 | PRIMARY KEY (`ID`) 68 | ) ENGINE=InnoDB AUTO_INCREMENT=9 DEFAULT CHARSET=latin1; 69 | /*!40101 SET character_set_client = @saved_cs_client */; 70 | 71 | -- 72 | -- Table structure for table `FATURAS` 73 | -- 74 | 75 | DROP TABLE IF EXISTS `FATURAS`; 76 | /*!40101 SET @saved_cs_client = @@character_set_client */; 77 | /*!40101 SET character_set_client = utf8 */; 78 | CREATE TABLE `FATURAS` ( 79 | `IDFATURA` int(11) NOT NULL AUTO_INCREMENT, 80 | `DESC_CARTAO` varchar(50) NOT NULL, 81 | `VALOR_CARTAO` decimal(10,2) DEFAULT NULL, 82 | `DATA_VENCIMENTO` date DEFAULT NULL, 83 | `PAGO` varchar(3) DEFAULT NULL, 84 | `DATA_PAGAMENTO` date DEFAULT NULL, 85 | `VALOR_PAGAMENTO` decimal(10,2) DEFAULT NULL, 86 | PRIMARY KEY (`IDFATURA`) 87 | ) ENGINE=InnoDB AUTO_INCREMENT=14 DEFAULT CHARSET=latin1; 88 | /*!40101 SET character_set_client = @saved_cs_client */; 89 | 90 | -- 91 | -- Table structure for table `TIPO_PAGTO` 92 | -- 93 | 94 | DROP TABLE IF EXISTS `TIPO_PAGTO`; 95 | /*!40101 SET @saved_cs_client = @@character_set_client */; 96 | /*!40101 SET character_set_client = utf8 */; 97 | CREATE TABLE `TIPO_PAGTO` ( 98 | `IDPGTO` int(11) NOT NULL AUTO_INCREMENT, 99 | `DESC_PGTO` varchar(50) NOT NULL, 100 | `OBS` varchar(60) DEFAULT NULL, 101 | PRIMARY KEY (`IDPGTO`) 102 | ) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=latin1; 103 | /*!40101 SET character_set_client = @saved_cs_client */; 104 | 105 | /*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */; 106 | 107 | /*!40101 SET SQL_MODE=@OLD_SQL_MODE */; 108 | /*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */; 109 | /*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */; 110 | /*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; 111 | /*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */; 112 | /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; 113 | /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; 114 | 115 | -- Dump completed on 2019-07-03 21:27:18 116 | -------------------------------------------------------------------------------- /docker/99_sample-data.sql: -------------------------------------------------------------------------------- 1 | -- MySQL dump 10.13 Distrib 5.7.26, for Linux (x86_64) 2 | -- 3 | -- Host: localhost Database: FINANCAS 4 | -- ------------------------------------------------------ 5 | -- Server version 5.7.26 6 | 7 | /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; 8 | /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; 9 | /*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; 10 | /*!40101 SET NAMES utf8 */; 11 | /*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */; 12 | /*!40103 SET TIME_ZONE='+00:00' */; 13 | /*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */; 14 | /*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */; 15 | /*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */; 16 | /*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */; 17 | 18 | -- 19 | -- Dumping data for table `CATEGORIAS` 20 | -- 21 | 22 | LOCK TABLES `CATEGORIAS` WRITE; 23 | /*!40000 ALTER TABLE `CATEGORIAS` DISABLE KEYS */; 24 | INSERT INTO `CATEGORIAS` VALUES (1,'ALIMENTACAO','BARES,LANCHONETES,RESTAURANTES,SUPERMERCADOS'),(2,'CONTAS DE CONSUMO','AGUA,LUZ,TELEFONE,INTERNET'),(3,'SAUDE','CONVENIOS,MEDICAMENTOS,CONSULTAS ETC.'),(4,'EXTRAS','GASTOS NAO COMUNS'),(5,'EDUCACAO','MENSALIDADE COLEGIO, CURSOS,LIVROS'),(6,'TRANSPORTE','MENSALIDADE PERUA ESCOLAR,FINANCIAMENTO AUTO,ESTACIONAMENTOS,MANUTENCAO AUTO'),(7,'EMPRESA MEI','DAS SIMPLES NACIONAL,TAXAS DO GOVERNO ,ETC.'); 25 | /*!40000 ALTER TABLE `CATEGORIAS` ENABLE KEYS */; 26 | UNLOCK TABLES; 27 | 28 | -- 29 | -- Dumping data for table `CONTAS_PAGAR` 30 | -- 31 | 32 | LOCK TABLES `CONTAS_PAGAR` WRITE; 33 | /*!40000 ALTER TABLE `CONTAS_PAGAR` DISABLE KEYS */; 34 | INSERT INTO `CONTAS_PAGAR` VALUES (2,7,54.90,'2019-03-20','2019-03-20','SIM','2019-03-22','DEBITO EM CONTA','DAS SIMPLES NACIONAL'),(3,NULL,73.82,'2019-03-10','2019-03-10','SIM','2019-03-10','DEBITO EM CONTA','\n'),(4,6,670.85,'2019-03-15','2019-03-15','SIM','2019-03-15','DEBITO EM CONTA','PARCELA CARRO\n'),(5,NULL,180.00,'2019-03-10','2019-03-10','SIM','2019-03-10','DEBITO SANTANDER 3567','\n'),(6,6,190.00,'2019-03-10','2019-03-10','SIM','2019-03-10','DINHEIRO','TRANSPORTE ESCOLAR'),(7,4,500.00,'2019-03-10','2019-03-10','SIM','2019-03-10','DINHEIRO','PEDREIRO\n\n'),(8,NULL,19.90,'2019-03-01','2019-03-01','SIM','2019-03-01','DEBITO SANTANDER 3567','PLANO MENSAL \n\n\n\n'),(9,1,39.00,'2019-03-01','2019-03-01','SIM','2019-03-01','DEBITO SANTANDER 3567','ALMOCO\n'),(10,NULL,14.39,'2019-03-02','2019-03-25','SIM','2019-03-25','DEBITO SANTANDER 3567','COMPRA 02/03/2019 CREDITO\n'),(11,4,33.40,'2019-03-02','2019-03-02','SIM','2019-03-02','DEBITO SANTANDER 3567','BURGER KING BERGAMINI\n\n'),(12,1,43.08,'2019-03-03','2019-03-03','SIM','2019-03-03','DEBITO SANTANDER 3567','SUPERMERCADO MARIA DE LOURDES \n'),(13,1,50.56,'2019-03-03','2019-03-25','SIM','2019-03-25','DEBITO SANTANDER 3567','BERGAMINI DIA 03/03/2019 CREDITO\n'),(14,1,12.97,'2019-03-03','2019-03-03','SIM','2019-03-03','DEBITO SANTANDER 3567','BERGAMINI 03-032019 DEBITO\n'),(15,1,19.43,'2019-03-04','2019-03-04','SIM','2019-03-04','DEBITO SANTANDER 3567','BERGAMINI 04-03-2019 DEBITO\n'),(16,4,37.49,'2019-03-05','2019-03-05','SIM','2019-03-05','DEBITO SANTANDER 3567','RAINHA DO PARQUE CAFÉ DA MANHA\n'),(20,4,182.47,'2019-03-06','2019-03-06','SIM','2019-03-06','DEBITO EM CONTA','FINANCIAMENTO ITAU\r\n\r\n'),(21,NULL,60.00,'2019-03-07','2019-03-25','SIM','2019-03-07','CREDITO SANTANDER 3567','\n\n'),(22,NULL,360.00,'2019-03-10','2019-03-15','SIM','2019-03-10','DEBITO EM CONTA','\n'),(23,4,45.00,'2019-03-09','2019-03-09','SIM','2019-03-09','DINHEIRO','CASAMENTO JUNIOR - ESTACIONAMENTO\n'),(24,2,21.16,'2019-03-10','2019-03-10','SIM','2019-03-10','DEBITO EM CONTA','TERRA NETWORKS'),(25,1,87.34,'2019-03-10','2019-03-25','SIM','2019-03-10','CREDITO SANTANDER 3567','BERGAMINI\n'),(26,1,11.00,'2019-03-10','2019-03-10','SIM','2019-03-10','DEBITO SANTANDER 3567','BERGAMINI MARYPAPER \n'),(27,6,60.00,'2019-03-12','2019-03-12','SIM','2019-03-25','CREDITO SANTANDER 3567','ABASTECIMENTO\n'),(28,1,16.50,'2019-03-13','2019-03-13','SIM','2019-03-13','DEBITO SANTANDER 3567','LANCHONETE DO TONINHO\n'),(29,1,10.00,'2019-03-14','2019-03-14','SIM','2019-03-14','DEBITO SANTANDER 3567','CAFÉ DA MANHÃ \n'),(30,NULL,53.42,'2019-03-12','2019-03-25','SIM','2019-03-25','CREDITO SANTANDER 3567','\n\n'),(31,NULL,70.02,'2019-03-16','2019-04-10','SIM','2019-04-10','CREDITO SANTANDER 7132','\n'),(32,1,35.10,'2019-03-17','2019-04-10','SIM','2019-04-10','CREDITO SANTANDER 7132','BERGAMINI'),(33,NULL,16.00,'2019-03-14','2019-03-14','SIM','2019-03-14','DEBITO SANTANDER 3567','\n'),(34,1,15.00,'2019-03-15','2019-03-15','SIM','2019-03-15','DEBITO SANTANDER 3567','S. JOAQUIM\n'),(35,6,80.00,'2019-03-21','2019-04-25','SIM','2019-04-25','CREDITO SANTANDER 3567','ABASTECIMENTO\n'),(36,NULL,24.06,'2019-03-10','2019-03-10','SIM','2019-03-18','DEBITO SANTANDER 3567','ATRASEI\n'),(38,NULL,22.60,'2019-03-18','2019-03-18','SIM','2019-03-18','DEBITO SANTANDER 3567','\n'),(39,1,28.00,'2019-03-19','2019-04-25','SIM','2019-03-25','CREDITO SANTANDER 3567','ALMOCO KILO ANHAIA ,631'),(40,6,120.00,'2019-03-20','2019-04-10','SIM','2019-04-10','CREDITO SANTANDER 7132','VIDRO ELETRICO VOYAGE'),(41,3,403.85,'2019-03-20','2019-03-20','SIM','2019-03-20','DEBITO EM CONTA','CONVENIO GREENLINE AFFIX\n'),(42,4,20.00,'2019-03-20','2019-03-20','SIM','2019-03-20','DINHEIRO','GUARDA NOTURNO\n'),(43,4,12.00,'2019-03-21','2019-04-25','SIM','2019-04-25','CREDITO SANTANDER 3567','UBER PARA SANTA EFIGENIA COM O RENATO'),(44,4,10.00,'2019-03-21','2019-03-21','SIM','2019-03-21','DINHEIRO','MONTAGEM NOTEBOOK RENATO\n\n'),(46,1,13.00,'2019-03-22','2019-03-22','SIM','2019-03-22','DEBITO SANTANDER 3567','ALMOÇO S. JOAQUIM\n'),(47,1,10.50,'2019-03-22','2019-03-22','SIM','2019-03-22','DEBITO SANTANDER 3567','CAFÉ DA MANHÃ S. JOAQUIM\n'),(48,NULL,55.26,'2019-03-20','2019-03-20','SIM','2019-03-22','DEBITO EM CONTA','PAGO ATRASADO\n'),(49,4,17.70,'2019-03-23','2019-04-25','SIM','2019-04-25','CREDITO SANTANDER 3567','CAFE DA MANHA EM CASA RAINHA DO PARQUE'),(50,4,30.00,'2019-03-23','2019-03-23','SIM','2019-03-23','DEBITO SANTANDER 3567','CIDS CABELEREIRO'),(53,4,80.19,'2019-03-22','2019-04-25','SIM','2019-04-25','CREDITO SANTANDER 3567','PIZZA HUT SHOPPING TUCURUVI'),(54,1,72.42,'2019-03-24','2019-04-25','SIM','2019-04-25','CREDITO SANTANDER 3567','COMPRA ASSAI FERNAO DIAS'),(55,1,6.00,'2019-03-24','2019-03-24','SIM','2019-03-24','DINHEIRO','BERGAMINI DANONE'),(56,5,480.00,'2019-03-25','2019-03-25','SIM','2019-03-25','DEBITO EM CONTA','MENSALIDADE ESCOLA MARI'),(58,1,26.62,'2019-03-27','2019-03-27','SIM','2019-03-27','DEBITO SANTANDER 3567','BERGAMINI'),(59,6,60.00,'2019-03-28','2019-04-25','SIM','2019-04-25','CREDITO SANTANDER 3567','ABASTECIMENTO'),(60,1,21.00,'2019-03-29','2019-03-29','SIM','2019-03-29','DEBITO SANTANDER 3567','ALMOCO S. JOAQUIM'),(61,4,14.80,'2019-03-29','2019-03-29','SIM','2019-03-29','DEBITO SANTANDER 3567','MAC DONALDS'),(62,4,66.40,'2019-03-29','2019-04-25','SIM','2019-04-25','CREDITO SANTANDER 3567','MC DONALDS'),(63,1,50.63,'2019-03-31','2019-04-25','SIM','2019-04-25','CREDITO SANTANDER 3567','BERGAMINI'),(64,3,84.00,'2019-03-28','2019-03-28','SIM','2019-03-28','DEBITO EM CONTA','PLANO ODONTOLOGICO JULIO E MARI'),(65,6,248.90,'2019-04-01','2019-04-01','SIM','2019-04-01','DEBITO EM CONTA','ITURAN E HDI SEGUROS'),(66,1,13.00,'2019-04-01','2019-04-01','SIM','2019-04-01','DEBITO SANTANDER 3567','ALMOCO S. JOAQUIM'),(68,1,15.00,'2019-04-02','2019-04-02','SIM','2019-04-02','DEBITO SANTANDER 3567','ALMOCO S. JOAQUIM'),(69,6,70.00,'2019-04-03','2019-04-25','SIM','2019-04-25','CREDITO SANTANDER 3567','ABASTECIMENTO'),(70,4,3.00,'2019-04-03','2019-04-25','SIM','2019-04-25','CREDITO SANTANDER 3567','SERVIDOR TESTE AMAZON VALORES EM DOLAR CONVERTER'),(72,1,48.00,'2019-04-04','2019-04-04','SIM','2019-04-04','DEBITO SANTANDER 3567','ALMOCO S. JOAQUIM ROSE JULIO REINALDO'),(75,1,15.00,'2019-04-05','2019-04-05','SIM','2019-04-05','DEBITO SANTANDER 3567','ALMOCO S. JOAQUIM'),(76,6,670.85,'2019-04-15','2019-04-15','SIM','2019-04-15','DEBITO EM CONTA','FINANCIAMENTO BRADESCO'),(77,2,49.90,'2019-04-10','2019-04-10','SIM','2019-04-10','DEBITO EM CONTA','FATURA VIVO CELULAR'),(79,2,50.25,'2019-04-10','2019-04-10','SIM','2019-04-10','DEBITO EM CONTA','SABESP'),(80,1,14.66,'2019-04-07','2019-05-10','SIM','2019-05-10','CREDITO SANTANDER 7132','BERGAMINI'),(81,4,45.28,'2019-04-07','2019-05-10','SIM','2019-05-10','CREDITO SANTANDER 7132','MAGAZINE LUIZA VENTILADOR 1-4'),(82,4,45.28,'2019-04-07','2019-06-10','SIM','2019-06-10','CREDITO SANTANDER 7132','MAGAZINE LUIZA VENTILADOR 2-4'),(83,4,45.28,'2019-04-07','2019-07-10','NAO','2019-07-10','CREDITO SANTANDER 7132','MAGAZINE LUIZA VENTILADOR 3-4'),(84,4,45.28,'2019-04-07','2019-08-10','NAO','2019-08-10','CREDITO SANTANDER 7132','MAGAZINE LUIZA VENTILADOR 4-4'),(85,4,39.90,'2019-04-07','2019-05-10','SIM','2019-05-10','CREDITO SANTANDER 7132','SHOPPING REFEICAO'),(86,3,112.50,'2019-03-18','2019-04-25','SIM','2019-04-25','CREDITO SANTANDER 3567','APARELHO MARI 1-2'),(87,3,112.50,'2019-03-18','2019-05-25','SIM','2019-05-25','CREDITO SANTANDER 3567','APARELHO MARI ORTODONT. 2-2'),(89,6,200.00,'2019-04-05','2019-04-10','SIM','2019-04-10','DEBITO SANTANDER 3567','VENCTO DE 01 A 10 ESTACIONAMENTO'),(90,6,70.00,'2019-04-08','2019-05-10','SIM','2019-05-10','CREDITO SANTANDER 7132','ABASTECIMENTO'),(91,1,13.00,'2019-04-09','2019-05-10','SIM','2019-05-10','CREDITO SANTANDER 7132','ALMOCO'),(92,6,190.00,'2019-04-10','2019-04-10','SIM','2019-04-10','DINHEIRO','TRANSPORTE ESCOLAR'),(93,2,21.16,'2019-04-10','2019-04-10','SIM','2019-04-10','DEBITO EM CONTA','DEBITO AUTOMATICO TERRA NETWORKS'),(102,1,17.00,'2019-04-10','2019-04-10','SIM','2019-04-10','DEBITO SANTANDER 3567','ALMOCO S. JOAQUIM'),(103,4,186.62,'2019-04-06','2019-04-11','SIM','2019-04-11','DEBITO EM CONTA','FINANCIAMENTO ITAU ATRASADO'),(104,1,18.00,'2019-04-11','2019-04-25','SIM','2019-04-25','CREDITO SANTANDER 3567','ALMOCO S. JOAQUIM'),(105,1,36.10,'2019-04-13','2019-04-25','SIM','2019-04-25','CREDITO SANTANDER 3567','BERGAMINI'),(106,1,48.84,'2019-04-13','2019-05-10','SIM','2019-05-10','CREDITO SANTANDER 7132','BERGAMINI'),(107,1,57.39,'2019-04-14','2019-05-10','SIM','2019-05-10','CREDITO SANTANDER 7132','BERGAMINI'),(108,6,42.79,'2019-04-10','2019-04-10','SIM','2019-04-12','DEBITO EM CONTA','SEM PARAR'),(109,3,75.00,'2019-04-15','2019-05-10','SIM','2019-05-10','CREDITO SANTANDER 7132','MANUTENCAO APARELHO MARI'),(110,6,80.00,'2019-04-16','2019-05-10','SIM','2019-05-10','CREDITO SANTANDER 7132','ABASTECIMENTO'),(111,4,60.70,'2019-04-18','2019-05-25','SIM','2019-05-25','CREDITO SANTANDER 3567','MAC DONALDS TUCURUVI'),(112,1,17.46,'2019-04-20','2019-04-20','SIM','2019-04-20','DEBITO SANTANDER 3567','BERGAMINI'),(113,1,90.53,'2019-04-21','2019-04-21','SIM','2019-04-21','DEBITO SANTANDER 3567','BERGAMINI'),(114,6,80.00,'2019-04-24','2019-05-25','SIM','2019-05-25','CREDITO SANTANDER 3567','ABASTECIMENTO'),(115,4,39.90,'2019-04-07','2019-05-10','SIM','2019-05-10','CREDITO SANTANDER 7132','JKFC TUCURUVI'),(117,1,90.53,'2019-04-21','2019-04-21','SIM','2019-04-21','DEBITO SANTANDER 3567','BERGAMINI'),(118,1,13.00,'2019-04-24','2019-04-22','SIM','2019-04-24','DEBITO SANTANDER 3567','ALMOCO S. JOAQUIM'),(119,5,480.00,'2019-04-25','2019-04-25','SIM','2019-04-25','DEBITO EM CONTA','MENSALIDADE ESCOLA MARI'),(120,1,13.00,'2019-04-26','2019-04-26','SIM','2019-04-26','DEBITO SANTANDER 3567','S. JOAQUIM'),(121,1,66.53,'2019-04-26','2019-05-25','SIM','2019-05-25','CREDITO SANTANDER 3567','BERGAMINI'),(122,4,20.00,'2019-04-22','2019-04-22','SIM','2019-04-22','DINHEIRO','GUARDA NOTURNO'),(123,1,39.43,'2019-04-27','2019-04-27','SIM','2019-04-27','DEBITO SANTANDER 3567','CAFE DA MANHA EM FAMILIA'),(127,1,12.00,'2019-04-29','2019-04-29','SIM','2019-04-29','DEBITO SANTANDER 3567','S. JOAQUIM ALMOCO'),(128,6,80.00,'2019-04-29','2019-05-25','SIM','2019-05-25','CREDITO SANTANDER 3567','ABASTECIMENTO'),(129,1,15.00,'2019-04-30','2019-04-30','SIM','2019-04-30','DEBITO SANTANDER 3567','S. JOAQUIM'),(130,1,15.00,'2019-04-30','2019-04-30','SIM','2019-04-30','DEBITO SANTANDER 3567','S. JOAQUIM DUPLICIDADE'),(131,1,19.97,'2019-05-01','2019-05-01','SIM','2019-05-01','DEBITO SANTANDER 3567','BERGAMINI'),(132,5,11.40,'2019-05-02','2019-05-02','SIM','2019-05-02','DINHEIRO','TRABALHO ESCOLAR MARI'),(133,1,3.50,'2019-05-04','2019-05-04','SIM','2019-05-04','DINHEIRO','PAO NO JAPONES'),(134,4,30.00,'2019-05-04','2019-05-04','SIM','2019-05-04','DEBITO SANTANDER 3567','CABELEREIRO ERALDO'),(135,1,91.38,'2019-05-05','2019-05-25','SIM','2019-05-25','CREDITO SANTANDER 3567','BERGAMINI'),(136,1,3.00,'2019-05-03','2019-05-03','SIM','2019-05-03','DINHEIRO','PAO PREDIO_SORAYA'),(137,6,248.90,'2019-05-02','2019-05-02','SIM','2019-05-02','DEBITO EM CONTA','ITURAN-HDI SEGUROS'),(138,4,10.00,'2019-05-06','2019-05-06','SIM','2019-05-06','DINHEIRO','DOCES_MARI'),(139,6,80.00,'2019-05-07','2019-06-10','SIM','2019-06-10','CREDITO SANTANDER 7132','ABASTECIMENTO'),(140,4,120.00,'2019-05-07','2019-06-10','SIM','2019-06-10','CREDITO SANTANDER 7132','BERGAMINI NIVER MARI'),(141,5,157.00,'2019-05-07','2019-06-10','SIM','2019-06-10','CREDITO SANTANDER 7132','CURSO WTTD'),(142,4,182.47,'2019-05-06','2019-05-06','SIM','2019-05-06','DEBITO EM CONTA','FINANCIAMENTO'),(143,4,75.00,'2019-05-08','2019-05-08','SIM','2019-05-08','DEBITO EM CONTA','PASSEIO MARI TRANSF. BRADESCO LILIENTAL'),(144,1,16.00,'2019-05-09','2019-05-09','SIM','2019-05-09','DEBITO SANTANDER 3567','ALMOCO S. JOAQUIM'),(145,6,47.09,'2019-05-10','2019-05-10','SIM','2019-05-10','DEBITO EM CONTA','SEM PARAR'),(146,6,200.00,'2019-05-10','2019-05-10','SIM','2019-05-10','DEBITO EM CONTA','ESTACIONAMENTO'),(147,1,9.50,'2019-05-10','2019-05-10','SIM','2019-05-10','DINHEIRO','CAFE DA MANHA S. JOAQUIM'),(148,6,10.00,'2019-05-10','2019-05-10','SIM','2019-05-10','DINHEIRO','DUCHA ESTACIONAMENTO'),(149,2,21.16,'2019-05-10','2019-05-25','SIM','2019-05-25','CREDITO SANTANDER 3567','TERRA NETWORKS BANDA LARGA'),(150,1,15.00,'2019-05-10','2019-05-10','SIM','2019-05-10','DEBITO SANTANDER 3567','ALMOCO S. JOAQUIM'),(151,4,99.80,'2019-05-10','2019-10-10','SIM','2019-05-10','DEBITO SANTANDER 3567','FESTA MARI BERGAMINI PAO DE METRO'),(152,4,69.95,'2019-05-10','2019-05-25','SIM','2019-05-25','CREDITO SANTANDER 3567','PRESENTE AMORE 1-2'),(153,4,69.90,'2019-05-10','2019-06-25','SIM','2019-06-25','CREDITO SANTANDER 3567','PRESENTE AMORE 2-2'),(154,4,44.20,'2019-05-11','2019-05-25','SIM','2019-05-25','CREDITO SANTANDER 3567','FUNCHAL NIVER MARI'),(155,6,50.00,'2019-05-11','2019-05-11','SIM','2019-05-11','DEBITO SANTANDER 3567','ABASTECIMENTO'),(156,4,53.70,'2019-05-11','2019-05-25','SIM','2019-05-25','CREDITO SANTANDER 3567','GELO NIVER MARI BERGAMINI'),(157,4,99.80,'2019-05-10','2019-05-10','SIM','2019-05-10','DEBITO SANTANDER 3567','NIVER MARI BERGAMINI LANCHE-METRO'),(158,4,15.90,'2019-05-10','2019-05-10','SIM','2019-05-10','DEBITO SANTANDER 3567','SHOPPING JANTA DIVINO FOGAO'),(159,1,34.42,'2019-05-12','2019-05-12','SIM','2019-05-12','DEBITO SANTANDER 3567','CAFE DA MANHA BERGAMINI'),(160,4,200.00,'2019-05-12','2019-06-10','SIM','2019-06-10','CREDITO SANTANDER 7132','DECORACAO NIVER MARI'),(161,1,58.41,'2019-05-12','2019-06-10','SIM','2019-06-10','CREDITO SANTANDER 7132','PARA ALMOCO - BERGAMINI'),(162,4,216.72,'2019-05-09','2019-06-10','SIM','2019-06-10','CREDITO SANTANDER 7132','BEBIDAS NIVER MARI'),(163,4,120.00,'2019-05-07','2019-06-10','SIM','2019-06-10','CREDITO SANTANDER 7132','NIVER MARI BERGAMINI'),(164,5,149.70,'2019-05-07','2019-06-10','SIM','2019-06-10','CREDITO SANTANDER 7132','CURSO WTTD 1-12'),(165,1,14.00,'2019-05-13','2019-05-13','SIM','2019-05-13','DEBITO SANTANDER 3567','ALMOCO S. JOAQUIM'),(166,1,29.87,'2019-05-14','2019-05-14','SIM','2019-05-14','DINHEIRO','BERGAMINI'),(167,6,670.85,'2019-05-15','2019-05-15','SIM','2019-05-15','DEBITO EM CONTA','FINANCIAMENTO BRADESCO'),(170,5,480.00,'2019-05-20','2019-05-25','SIM','2019-05-24','DEBITO EM CONTA','MENSALIDADE COLEGIO'),(171,6,50.00,'2019-05-17','2019-05-17','SIM','2019-05-17','DEBITO SANTANDER 3567','ABASTECIMENTO'),(172,3,75.00,'2019-05-18','2019-05-18','SIM','2019-05-18','DEBITO SANTANDER 3567','DENTISTA MARI (MANUTENCAO)'),(173,1,19.76,'2019-05-18','2019-05-18','SIM','2019-05-18','DEBITO SANTANDER 3567','CAFE DA MANHA BERGAMINI'),(174,6,190.00,'2019-06-05','2019-06-10','SIM','2019-06-10','DINHEIRO','TRANSPORTE ESCOLAR'),(175,7,54.90,'2019-04-22','2019-04-22','SIM','2019-04-22','DEBITO EM CONTA','DAS SIMPLES NACIONAL'),(176,7,54.90,'2019-05-20','2019-05-20','SIM','2019-05-20','DEBITO EM CONTA','DAS SIMPLES NACIONAL'),(177,1,22.50,'2019-05-20','2019-05-20','SIM','2019-05-20','DINHEIRO','BERGAMINI'),(178,3,403.85,'2019-05-20','2019-05-20','SIM','2019-05-20','DEBITO EM CONTA','CONVENIO GREENLINE'),(179,4,32.00,'2019-05-21','2019-05-21','SIM','2019-05-21','DINHEIRO','MARI PRENDAS LILIENTAL'),(180,6,80.00,'2019-05-22','2019-06-25','SIM','2019-06-25','CREDITO SANTANDER 3567','ABASTECIMENTO'),(181,6,269.51,'2019-06-02','2019-06-01','SIM','2019-06-01','DEBITO EM CONTA','ITURAN HDI SEGUROS'),(182,1,10.00,'2019-05-23','2019-05-23','SIM','2019-05-23','DEBITO SANTANDER 3567','LANCHONETE MARIA CAFE DA MANHA'),(183,1,32.00,'2019-05-24','2019-05-24','SIM','2019-05-24','DEBITO SANTANDER 3567','ALMOCO S. JOAQUIM'),(184,1,24.00,'2019-05-26','2019-05-26','SIM','2019-05-26','DEBITO SANTANDER 3567','SEVILHA FRANGO ALMOCO'),(185,1,29.00,'2019-05-26','2019-05-26','SIM','2019-05-26','DEBITO SANTANDER 3567','ASSAI TREMEMBE'),(186,3,10.50,'2019-05-27','2019-05-27','SIM','2019-05-27','DINHEIRO','CAFE DA MANHA S. JOAQUIM'),(187,4,60.00,'2019-05-28','2019-06-10','SIM','2019-06-10','CREDITO SANTANDER 7132','CHURRAS WTTD'),(188,1,15.00,'2019-05-28','2019-05-28','SIM','2019-05-28','DEBITO SANTANDER 3567','ALMOCO S. JOAQUIM'),(189,6,60.00,'2019-05-29','2019-06-25','SIM','2019-05-25','CREDITO SANTANDER 3567','ABASTECIMENTO'),(190,4,30.80,'2019-05-29','2019-06-25','SIM','2019-06-25','CREDITO SANTANDER 3567','LANCHE PASSEIO MARI '),(191,1,22.47,'2019-05-31','2019-05-31','SIM','2019-05-31','DEBITO SANTANDER 3567','MINEIRO ALMOCO'),(192,1,51.72,'2019-06-02','2019-06-25','SIM','2019-06-25','CREDITO SANTANDER 3567','CAFE - ALMOCO BERGAMINI '),(193,4,11.86,'2019-06-03','2019-06-25','SIM','2019-06-25','CREDITO SANTANDER 3567','AMAZON AWS'),(194,6,70.00,'2019-06-04','2019-06-25','SIM','2019-06-25','CREDITO SANTANDER 3567','ABASTECIMENTO SHELL LOPES DA COSTA'),(195,3,403.85,'2019-06-20','2019-06-20','SIM','2019-06-20','DEBITO EM CONTA','CONVENIO GREENLINE'),(196,6,670.85,'2019-06-15','2019-06-15','SIM','2019-06-14','DEBITO EM CONTA','FINANCIAMENTO BRADESCO'),(197,4,182.47,'2019-06-06','2019-06-06','SIM','2019-06-06','DEBITO EM CONTA','FINANCIAMENTO ITAU'),(198,5,480.00,'2019-06-25','2019-06-25','SIM','2019-06-25','DEBITO EM CONTA','COLEGIO LILIENTAL '),(199,6,200.00,'2019-06-10','2019-06-10','SIM','2019-06-10','DEBITO SANTANDER 3567','ESTACIONAMENTO'),(200,7,54.90,'2019-06-20','2019-06-20','SIM','2019-06-20','DEBITO EM CONTA','DAS SIMPLES NACIONAL'),(201,1,44.74,'2019-06-05','2019-06-05','SIM','2019-06-05','DEBITO SANTANDER 3567','BERGAMINI'),(202,1,14.66,'2019-04-07','2019-05-10','SIM','2019-05-10','CREDITO SANTANDER 7132','BERGAMINI'),(203,4,30.00,'2019-06-08','2019-06-08','SIM','2019-06-08','DEBITO SANTANDER 3567','CORTE DE CABELO JULIO'),(204,1,78.83,'2019-06-08','2019-07-10','SIM','2019-07-10','CREDITO SANTANDER 7132','BERGAMINI'),(205,4,52.00,'2019-06-08','2019-06-08','SIM','2019-06-08','DEBITO SANTANDER 3567','FLORES FÊ SOBRINHA FORMATURA'),(206,4,29.90,'2019-06-07','2019-06-07','SIM','2019-06-07','DEBITO SANTANDER 3567','PRESENTE NIVER NICOLAS '),(207,1,59.49,'2019-06-09','2019-06-25','SIM','2019-06-25','CREDITO SANTANDER 3567','BERGAMINI'),(208,4,30.00,'2019-06-08','2019-06-08','SIM','2019-06-08','DINHEIRO','UBER AMORE TEATRO FÊ'),(209,4,35.53,'2019-06-10','2019-06-10','SIM','2019-06-10','DEBITO EM CONTA','SEM PARAR'),(210,2,82.05,'2019-06-10','2019-06-10','SIM','2019-06-10','DEBITO EM CONTA','AGUA SABESP'),(211,2,29.99,'2019-06-06','2019-06-06','SIM','2019-06-10','DEBITO EM CONTA','FATURA PLANO CELULAR MARI'),(212,2,49.99,'2019-06-10','2019-06-10','SIM','2019-06-10','DEBITO EM CONTA','FATURA CELULAR JULIO'),(213,4,55.40,'2019-06-14','2019-06-14','SIM','2019-06-14','DEBITO SANTANDER 3567','MAC DONALDS'),(214,6,100.00,'2019-06-15','2019-07-25','NAO','2019-07-25','CREDITO SANTANDER 3567','ABASTECIMENTO POSTO BRASAO'),(215,1,53.11,'2019-06-15','2019-07-25','NAO','2019-07-25','CREDITO SANTANDER 3567','BERGAMINI'),(216,4,32.50,'2019-06-15','2019-06-15','SIM','2019-06-15','DEBITO SANTANDER 3567','SORVETES OGGI'),(217,3,75.00,'2019-06-15','2019-06-15','SIM','2019-06-15','DINHEIRO','MANUTENCAO APARELHO MARI'),(218,1,60.00,'2019-06-15','2019-06-15','SIM','2019-06-15','DINHEIRO','GAS DE COZINHA'),(219,4,16.00,'2019-06-18','2019-06-18','SIM','2019-06-18','DINHEIRO','IMPRESSOES TRABALHO MARI'),(220,1,24.00,'2019-06-20','2019-06-20','SIM','2019-06-20','DINHEIRO','CAFE DA MANHA'),(221,3,7.00,'2019-06-20','2019-06-20','SIM','2019-06-20','DINHEIRO','REMEDIO JULIO DROGARIA SP'),(222,1,22.31,'2019-06-21','2019-06-21','SIM','2019-06-21','DEBITO SANTANDER 3567','CAFE DA MANHA'),(223,3,5.00,'2019-06-21','2019-06-21','SIM','2019-06-21','DINHEIRO','REMEDIO JULIO FARMAIS BERGAMINI'),(224,4,50.00,'2019-06-22','2019-06-22','SIM','2019-06-22','DEBITO SANTANDER 3567','FESTA JUNINA NSA APARECIDA'),(225,4,18.50,'2019-06-22','2019-07-25','SIM','2019-07-25','CREDITO SANTANDER 3567','FESTA JUNINA NSA APARECIDA '),(226,4,21.00,'2019-06-22','2019-06-22','SIM','2019-06-22','DINHEIRO','UBER PARA FESTA JUNINA NSA AP. EDU. CHAVES'),(227,3,58.82,'2019-06-23','2019-07-25','NAO','2019-07-25','CREDITO SANTANDER 3567','DROGARIA SP 1-3'),(228,3,58.82,'2019-06-23','2019-08-25','NAO','2019-08-25','CREDITO SANTANDER 3567','DOGARIA SP 2-3'),(229,3,58.83,'2019-06-23','2019-09-25','NAO','2019-08-25','CREDITO SANTANDER 3567','DROGARIA SP 3-3'),(230,6,215.00,'2019-06-24','2019-07-25','NAO','2019-07-25','CREDITO SANTANDER 3567','DEDE OFICINA MECANICA 1-3'),(231,4,214.00,'2019-06-24','2019-08-25','NAO','2019-08-25','CREDITO SANTANDER 3567','DEDE OFICINA MECANICA 2-3'),(232,6,214.00,'2019-06-24','2019-09-25','NAO','2019-09-25','CREDITO SANTANDER 3567','DEDE OFICINA MECANICA 3-3'),(233,4,19.00,'2019-06-24','2019-07-25','NAO','2019-07-25','CREDITO SANTANDER 3567','CAPA PELICULA CELULAR MARI'),(234,4,29.90,'2019-06-24','2019-07-25','NAO','2019-07-25','CREDITO SANTANDER 3567','FERRAMENTAS PARA USO PROPRIO - CASA'),(235,4,58.18,'2019-06-28','2019-08-10','NAO','2019-08-10','CREDITO SANTANDER 7132','CALCAS LOJA ATACADO JULIO'),(236,4,58.18,'2019-06-28','2019-09-10','NAO','2019-09-10','CREDITO SANTANDER 7132','CALCAS LOJA ATACADO JULIO'),(237,6,100.00,'2019-06-28','2019-07-10','NAO','2019-07-10','CREDITO SANTANDER 7132','ABASTECIMENTO'),(238,4,56.58,'2019-06-29','2019-07-25','NAO','2019-06-25','CREDITO SANTANDER 3567','ALMOCO FAMILIA SHOPPING TUCURUVI'),(242,1,30.96,'2019-06-30','2019-07-25','NAO','2019-06-25','CREDITO SANTANDER 3567','BERGAMINI'),(243,5,112.10,'2019-07-10','2019-07-10','NAO','2019-07-10','CREDITO SANTANDER 7132','FTD LIVROS MARI 06-09'),(244,5,112.10,'2019-08-10','2019-08-10','NAO','2019-08-10','CREDITO SANTANDER 7132','FTD LIVROS 7-9'),(245,5,112.10,'2019-09-10','2019-09-10','NAO','2019-09-10','CREDITO SANTANDER 7132','FTD LIVROS 8-9'),(246,5,112.10,'2019-10-10','2019-10-10','NAO','2019-10-10','CREDITO SANTANDER 7132','FTD LIVROS 9-9'),(247,5,157.00,'2019-05-07','2019-07-10','NAO','2019-07-10','CREDITO SANTANDER 7132','CURSO WTTD'),(248,5,157.00,'2019-05-07','2019-08-10','NAO','2019-08-10','CREDITO SANTANDER 7132','CURSO WTTD 4-12'),(249,5,157.00,'2019-05-07','2019-09-10','NAO','2019-09-10','CREDITO SANTANDER 7132','CURSO WTTD 5-12'),(250,5,157.00,'2019-05-07','2019-10-10','NAO','2019-10-10','CREDITO SANTANDER 7132','CURSO WTTD 6-12'),(251,5,157.00,'2019-05-07','2019-11-10','NAO','2019-11-10','CREDITO SANTANDER 7132','CURSO WTTD 7-12'),(252,5,157.00,'2019-05-07','2019-12-10','NAO','2019-12-10','CREDITO SANTANDER 7132','CURSO WTTD 8-12'),(253,5,157.00,'2019-05-07','2020-01-10','NAO','2020-01-10','CREDITO SANTANDER 7132','CURSO WTTD 9-12'),(254,5,157.00,'2019-05-07','2020-02-10','NAO','2020-02-10','CREDITO SANTANDER 7132','CURSO WTTD 10-12'),(255,5,157.00,'2019-05-07','2020-03-10','NAO','2020-03-10','CREDITO SANTANDER 7132','CURSO WTTD 11-12'),(256,5,157.00,'2019-05-07','2020-04-10','NAO','2020-04-10','CREDITO SANTANDER 7132','CURSO WTTD 12-12 FINAL'),(257,2,49.99,'2019-07-10','2019-07-10','NAO','2019-07-10','DEBITO EM CONTA','VIVO CONTROLE MOVEL JULIO'),(258,1,23.51,'2019-07-02','2019-07-25','NAO','2019-07-25','CREDITO SANTANDER 3567','BERGAMINI'); 35 | /*!40000 ALTER TABLE `CONTAS_PAGAR` ENABLE KEYS */; 36 | UNLOCK TABLES; 37 | 38 | -- 39 | -- Dumping data for table `ENTRADAS` 40 | -- 41 | 42 | LOCK TABLES `ENTRADAS` WRITE; 43 | /*!40000 ALTER TABLE `ENTRADAS` DISABLE KEYS */; 44 | INSERT INTO `ENTRADAS` VALUES (1,'ANTIX CONFECCOES LTDA EPP',2500.00,'2019-02-20','PGTO DE 01 A 15-02-2019 '),(2,'ANTIX CONFECCOES LTDA EPP',2500.00,'2019-03-10','PGTO DE 15 A 28-02-2019 '),(3,'ANTIX CONFECCOES LTDA EPP',2500.00,'2019-03-20','PGTO DE 01 A 15-03-2019'),(4,'ANTIX CONFECCOES LTDA EPP',2500.00,'2019-04-10','PGTO DE 15 A 31-03-2019'),(5,'ANTIX CONFECCOES LTDA EPP',2500.00,'2019-04-20','PGTO DE 01 A 15-04-2019'),(6,'ANTIX CONFECCOES LTDA EPP',2500.00,'2019-05-10','PGTO DE 15 A 30-04-2019'),(7,'ANTIX CONFECCOES LTDA EPP',2500.00,'2019-05-20','PGTO DE 01 A 15-05-2019'),(8,'ANTIX CONFECCOES LTDA EPP',2500.00,'2019-06-10','PGTO DE 15 A 31-05-2019'); 45 | /*!40000 ALTER TABLE `ENTRADAS` ENABLE KEYS */; 46 | UNLOCK TABLES; 47 | 48 | -- 49 | -- Dumping data for table `FATURAS` 50 | -- 51 | 52 | LOCK TABLES `FATURAS` WRITE; 53 | /*!40000 ALTER TABLE `FATURAS` DISABLE KEYS */; 54 | INSERT INTO `FATURAS` VALUES (9,'CREDITO SANTANDER 7132',651.79,'2019-04-10','SIM','2019-04-10',651.79),(10,'CREDITO SANTANDER 3567',1094.27,'2019-04-25','SIM','2019-04-25',1094.27),(11,'CREDITO SANTANDER 7132',577.53,'2019-05-10','SIM','2019-05-10',577.53),(12,'CREDITO SANTANDER 7132',1224.68,'2019-06-10','NAO','2019-06-10',1224.68),(13,'CREDITO SANTANDER 3567',456.02,'2019-06-25','NAO','2019-06-25',456.02); 55 | /*!40000 ALTER TABLE `FATURAS` ENABLE KEYS */; 56 | UNLOCK TABLES; 57 | 58 | -- 59 | -- Dumping data for table `TIPO_PAGTO` 60 | -- 61 | 62 | LOCK TABLES `TIPO_PAGTO` WRITE; 63 | /*!40000 ALTER TABLE `TIPO_PAGTO` DISABLE KEYS */; 64 | INSERT INTO `TIPO_PAGTO` VALUES (1,'DEBITO SANTANDER 3567','DEBITO NO CARTAO'),(2,'CREDITO SANTANDER 3567','VENCIMENTO DIA 25'),(3,'CREDITO SANTANDER 7132','VENCIMENTO DIA 10'),(4,'DINHEIRO','A VISTA'),(5,'DEBITO EM CONTA','BRADESCO - SANTANDER'); 65 | /*!40000 ALTER TABLE `TIPO_PAGTO` ENABLE KEYS */; 66 | UNLOCK TABLES; 67 | /*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */; 68 | 69 | /*!40101 SET SQL_MODE=@OLD_SQL_MODE */; 70 | /*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */; 71 | /*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */; 72 | /*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; 73 | /*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */; 74 | /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; 75 | /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; 76 | 77 | -- Dump completed on 2019-07-03 21:27:18 78 | -------------------------------------------------------------------------------- /docker/README.md: -------------------------------------------------------------------------------- 1 | # Utilização do Docker para subir base de dados 2 | 3 | ## Dependências 4 | * [docker](https://download.docker.com/) 5 | * [docker-compose](https://pypi.org/project/docker-compose/) 6 | 7 | ## Provisionar ambiente 8 | 9 | 1. Copie o arquivo `contrib/.env` para a raiz do projeto ou crie um com as variáveis definidas no arquivo de exemplo. 10 | 11 | 2. Execute: 12 | 13 | ```bash 14 | docker-compose up -d 15 | ``` 16 | 17 | > para testar execute: 18 | 19 | ```bash 20 | source .env 21 | 22 | docker-compose exec mysql mysql -u $MYSQL_USER -p$MYSQL_PASSWORD $MYSQL_DATABASE 23 | ``` 24 | Para que os dados do banco de desenvolvimento não sejam perdidos descomente a **linha 14** do arquivo docker-compose.yml e crie um diretório **data** na raiz do projeto. 25 | -------------------------------------------------------------------------------- /docker/docker.env: -------------------------------------------------------------------------------- 1 | MYSQL_USER=usuario 2 | MYSQL_PASSWORD=123456789 3 | MYSQL_ROOT_PASSWORD=root123456789 4 | MYSQL_ALLOW_EMPTY_PASSWORD=no 5 | MYSQL_DATABASE=FINANCAS 6 | -------------------------------------------------------------------------------- /jsfinance/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/juliomsouza/jsfinance/f2636449eb2446e3cf74c2a946f29a22a253b07e/jsfinance/__init__.py -------------------------------------------------------------------------------- /jsfinance/__main__.py: -------------------------------------------------------------------------------- 1 | import time 2 | from tkinter import Tk 3 | from tkinter import ttk 4 | #from jsfinance.core import Sistema 5 | from jsfinance.ui_main import Sistema as MainWindow 6 | 7 | root = Tk() 8 | MainWindow(root) 9 | root.title("JS Financas - " + time.strftime("%d/%m/%Y")) 10 | s = ttk.Style() 11 | s.theme_use('default') 12 | root.mainloop() 13 | -------------------------------------------------------------------------------- /jsfinance/assets/exit.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/juliomsouza/jsfinance/f2636449eb2446e3cf74c2a946f29a22a253b07e/jsfinance/assets/exit.gif -------------------------------------------------------------------------------- /jsfinance/assets/logo.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/juliomsouza/jsfinance/f2636449eb2446e3cf74c2a946f29a22a253b07e/jsfinance/assets/logo.gif -------------------------------------------------------------------------------- /jsfinance/core.py: -------------------------------------------------------------------------------- 1 | # encoding: utf-8 2 | from jsfinance.db import connect 3 | from mysql.connector import errorcode 4 | from tkinter import * 5 | from tkinter import ttk 6 | from tkinter import messagebox 7 | from PIL import Image, ImageTk 8 | import webbrowser 9 | import datetime 10 | import os 11 | import sys 12 | import time; 13 | import xlwt 14 | #import csv 15 | from decouple import config 16 | 17 | 18 | def load_image(filename): 19 | image = Image.open(filename) 20 | photo = ImageTk.PhotoImage(image) 21 | return photo 22 | 23 | 24 | class Sistema: 25 | def __init__(self, master): 26 | self.master = master 27 | self.Date1 = StringVar() 28 | self.Date1.set(time.strftime("%d/%m/%Y")) 29 | 30 | self.create_widgets(master) 31 | 32 | def create_widgets(self, master): 33 | self.frame = Frame(master) 34 | self.frame.pack() 35 | self.menu = Menu(master) 36 | self.menuCadastro = Menu(self.menu) 37 | self.menuCadastro.add_command(label="CATEGORIAS", command=self.cad_Cat) 38 | self.menuCadastro.add_command(label="LANCAMENTOS", command=self.cadastraContas) 39 | self.menuCadastro.add_command(label="FATURAS CARTOES", command=self.cad_Faturas) 40 | self.menuCadastro.add_command(label="TIPOS PAGAMENTOS", command=self.cad_Tipos_Pgto) 41 | self.menuCadastro.add_command(label="Sair", command=master.destroy) 42 | self.menu.add_cascade(label='CADASTRAR', menu=self.menuCadastro) 43 | 44 | self.menuConsulta = Menu(self.menu) 45 | self.menuConsulta.add_command(label="TODAS AS CONTAS", command=self.pesquisa_Contas) 46 | self.menuConsulta.add_command(label="FATURAS CARTÕES") # , command = self.cad_Faturas) 47 | self.menuConsulta.add_command(label="TODAS AS CATEGORIAS", command=self.pesquisa_Cat) 48 | self.menuConsulta.add_command(label="CONTAS/FILTRO", command=self.lista_Personalizada) 49 | self.menuConsulta.add_command(label="CATEGORIAS/FILTRO", command=self.lista_PersonaCat) 50 | self.menuConsulta.add_command(label="TIPOS DE PAGAMENTOS", command=self.lista_tipos_pgto) 51 | self.menu.add_cascade(label='CONSULTAR', menu=self.menuConsulta) 52 | 53 | self.menuSaida = Menu(self.menu) 54 | self.menuSaida.add_command(label="EXCEL MES ATUAL", command=self.gera_planilha) 55 | self.menu.add_cascade(label='RELATORIOS', menu=self.menuSaida) 56 | 57 | self.menuEdita = Menu(self.menu) 58 | self.menuEdita.add_command(label="VERSAO 1.1") 59 | self.menuEdita.add_command(label="HELPDESK", command=self.help_Desk) 60 | self.menuEdita.add_command(label="MANUAL") 61 | self.menu.add_cascade(label='AJUDA', menu=self.menuEdita) 62 | 63 | master.config(menu=self.menu) 64 | 65 | self.lblDate = Label(master, textvariable=self.Date1, font=('arial', 18, 'bold'), padx=1, pady=1, 66 | bd=10, bg="#004400", fg="Cornsilk", justify=LEFT, width=20) 67 | self.lblDate.pack() 68 | 69 | self.imagem1 = load_image('Button-exit-icon.png') 70 | self.imagem3 = load_image('logo.png') 71 | 72 | self.frame1 = Frame(master, width=450, height=600, bd=8, relief="raise") 73 | self.frame1.pack(side=LEFT) 74 | 75 | self.frame2 = Frame(master, width=300, height=600, bd=8, relief="raise") 76 | self.frame2.pack(side=RIGHT) 77 | 78 | self.busca_persomes = Button(self.frame2, text='LISTAR CONTAS MES ATUAL ', pady=1, bg='RoyalBlue1', padx=1, 79 | bd=2, width=30, height=2, 80 | font=('Arial', 12, 'bold'), fg='black', command=self.pesquisa_Contas_mes) 81 | self.busca_persomes.place(x=0, y=0) 82 | 83 | self.busca_persomes_paga = Button(self.frame2, text='CONTAS MES ATUAL PAGAS ', pady=1, bg='RoyalBlue1', padx=1, 84 | bd=2, width=30, height=2, 85 | font=('Arial', 12, 'bold'), fg='black', 86 | command=self.pesquisa_Contas_mes_pagas) 87 | self.busca_persomes_paga.place(x=0, y=60) 88 | 89 | self.busca_persomes_aberto = Button(self.frame2, text='CONTAS MES ATUAL ABERTO ', pady=1, bg='RoyalBlue1', 90 | padx=1, bd=2, width=30, height=2, 91 | font=('Arial', 12, 'bold'), fg='black', 92 | command=self.pesquisa_Contas_mes_Aberto) 93 | self.busca_persomes_aberto.place(x=0, y=120) 94 | 95 | self.btn_contas = Button(self.frame1, text='LANÇAMENTOS-DÉBITOS', pady=1, bg='RoyalBlue1', padx=1, bd=2, 96 | width=30, height=2, 97 | font=('Arial', 12, 'bold'), fg='black', command=self.cadastraContas) 98 | self.btn_contas.place(x=0, y=0) 99 | 100 | self.btn_creditos = Button(self.frame1, text='LANÇAMENTOS-CRÉDITOS', pady=1, bg='RoyalBlue1', padx=1, bd=2, 101 | width=30, height=2, 102 | font=('Arial', 12, 'bold'), fg='black', command=self.add_entradas) 103 | self.btn_creditos.place(x=0, y=50) 104 | 105 | self.btn_sair = Button(self.frame1, pady=1, bg='light blue', padx=1, bd=2, width=120, height=120, 106 | command=self.master.destroy, image=self.imagem1) 107 | self.btn_sair.place(x=305, y=0) 108 | 109 | self.texto_logo = Label(self.frame1, text='DESENVOLVIDO POR JS INFORMÁTICA ', pady=2, bg='RoyalBlue1', padx=2, 110 | bd=2, width=47, height=2, 111 | font=('Arial', 12, 'bold'), fg='black') 112 | self.texto_logo.place(x=0, y=270) 113 | self.btn_logo = Label(self.frame1, text='', pady=1, bg='light blue', padx=1, bd=2, width=427, height=250, 114 | image=self.imagem3) 115 | self.btn_logo.place(x=0, y=317) 116 | 117 | self.btn_busca_Totais = Button(self.frame2, text='TOTAIS POR TIPO DE PGTO', bg='RoyalBlue1', pady=1, padx=1, 118 | bd=2, width=30, height=2, 119 | font=('Arial', 12, 'bold'), fg='black', command=self.lista_Totais_pgto) 120 | self.btn_busca_Totais.place(x=0, y=180) 121 | 122 | self.btn_busca_conta = Button(self.frame2, text='LISTAR POR CATEGORIAS', bg='RoyalBlue1', pady=1, padx=1, bd=2, 123 | width=30, height=2, 124 | font=('Arial', 12, 'bold'), fg='black', command=self.lista_Personalizada_Cat) 125 | self.btn_busca_conta.place(x=0, y=240) 126 | 127 | self.btn_busca_todos = Button(self.frame2, text='CONTAS PERSONALIZ.', bg='RoyalBlue1', pady=1, padx=1, bd=2, 128 | width=30, height=2, 129 | font=('Arial', 12, 'bold'), fg='black', command=self.lista_Personalizada) 130 | self.btn_busca_todos.place(x=0, y=300) 131 | 132 | def help_Desk(self): 133 | webbrowser.open(config('HELPDESK_URL')) 134 | 135 | def ultimo_registro(self): 136 | cnx = connect() 137 | 138 | cursor = cnx.cursor() 139 | 140 | try: 141 | cursor.execute("SELECT MAX(IDCONTA) +1 FROM CONTAS_PAGAR") 142 | dadosbanco = cursor.fetchone() 143 | #print(cursor.execute) 144 | if dadosbanco: 145 | self.id_contae.insert(0,dadosbanco[0]) 146 | #self.desabilitaGravar() 147 | 148 | except mysql.connector.Error as err: 149 | messagebox.showerror("Erro ao buscar ID",err) 150 | 151 | cnx.close() 152 | 153 | def cadastraContas(self,id_conta=None): 154 | self.tela1 = Toplevel() 155 | self.id_conta = Label(self.tela1, text ='IDCONTA :',font=('Arial',16, 'bold'),bg='light blue',relief=SUNKEN) 156 | self.id_conta.place(x = 0, y = 0) 157 | 158 | self.id_contae = Entry(self.tela1,width = 10,bg='lemonchiffon',bd=4) 159 | self.id_contae.place(x = 140, y = 0) 160 | 161 | 162 | self.btn_buscar = Button(self.tela1, text='BUSCAR CONTA',bg='light blue') 163 | self.btn_buscar.place(x = 270, y = 0) 164 | self.btn_buscar.bind("", self.pesquisar_Contas) 165 | 166 | self.editcategoria = Entry(self.tela1,width = 20,bg='lemonchiffon',bd=4) 167 | self.editcategoria.place(x = 440, y = 0) 168 | self.cat = Button(self.tela1, text="BUSCAR CATEG.", bg='light blue') 169 | self.cat.place(x = 660, y = 0) 170 | self.cat.bind("", self.Completar) 171 | 172 | 173 | #self.Proximo_Id() 174 | 175 | 176 | 177 | 178 | self.idcat = Label(self.tela1, text ='ID.CATEG.:',font=('Arial',16, 'bold'),bg='light blue') 179 | self.idcat.place(x = 0, y = 50) 180 | 181 | self.id_cat = Entry(self.tela1,width = 10,bg='lemonchiffon',bd=4) 182 | self.id_cat.place(x = 140, y = 50) 183 | 184 | self.cat = Label(self.tela1, text ='CATEGORIA ',font=('Arial',16, 'bold'),bg='light blue') 185 | self.cat.place(x = 270, y = 50) 186 | 187 | 188 | 189 | 190 | self.categoria = Entry(self.tela1,width = 20,bg='lemonchiffon',bd=4) 191 | self.categoria.place(x = 440, y = 50) 192 | 193 | 194 | self.valorconta = Label(self.tela1, text ='VALOR :',font=('Arial',16, 'bold'),bg='light blue') 195 | self.valorconta.place(x = 0, y = 100) 196 | 197 | self.valorcontae = Entry(self.tela1,width = 10,bg='lemonchiffon',bd=4) 198 | self.valorcontae.place(x = 140, y = 100) 199 | 200 | self.data_compra = Label(self.tela1, text ='DATA COMPRA ',font=('Arial',16, 'bold'),bg='light blue') 201 | self.data_compra.place(x = 270, y = 100) 202 | 203 | self.data_comprae = Entry(self.tela1,width = 20,bg='lemonchiffon',bd=4) 204 | self.data_comprae.place(x = 440, y = 100) 205 | 206 | self.venc = Label(self.tela1, text ='VENCTO ',font=('Arial',16, 'bold'),bg='light blue') 207 | self.venc.place(x = 660, y = 100) 208 | 209 | self.vence = Entry(self.tela1,width = 20,bg='lemonchiffon',bd=4) 210 | self.vence.place(x = 770, y = 100) 211 | 212 | self.pago = Label(self.tela1, text ='PAGO ',font=('Arial',16, 'bold'),bg='light blue') 213 | self.pago.place(x = 0, y = 150) 214 | 215 | self.combo1 = ttk.Combobox(self.tela1, height= 4,width = 10) 216 | self.combo1['values']=('SIM','NAO') 217 | self.combo1.current(1) 218 | self.combo1.place(x = 140, y = 150) 219 | 220 | 221 | self.data_pgto = Label(self.tela1, text ='DATA PGTO ',font=('Arial',16, 'bold'),bg='light blue') 222 | self.data_pgto.place(x = 270, y = 150) 223 | 224 | self.data_pgtoe = Entry(self.tela1,width = 20,bg='lemonchiffon',bd=4) 225 | self.data_pgtoe.place(x = 440, y = 150) 226 | 227 | self.tipo_pgto = Label(self.tela1, text ='TIPO PGTO ',font=('Arial',16, 'bold'),bg='light blue') 228 | 229 | self.tipo_pgto.place(x = 0, y = 200) 230 | 231 | self.combo = ttk.Combobox(self.tela1, height= 4,width = 25) 232 | self.combo['values']= self.list_pgto() 233 | self.combo.current(0) 234 | self.combo.place(x = 140, y = 205) 235 | 236 | self.observa = Label(self.tela1, text='OBSERVAÇÕES',font=('Arial',16, 'bold'),bg='lightskyblue') 237 | self.observa.place(x = 20, y =250) 238 | 239 | self.observae = Entry(self.tela1,width = 30,bg='lemonchiffon',bd=4) 240 | self.observae.place(x = 5,y = 280) 241 | #self.obs.get(1.0,END) 242 | 243 | 244 | # =========================================================================================================================================== 245 | # BOTÕES = 246 | # =========================================================================================================================================== 247 | 248 | 249 | self.btn_gravar = Button(self.tela1, text='Gravar',width = 20,height = 2,bg='green', command = self.grav_contas) 250 | self.btn_gravar.place(x = 0, y = 390) 251 | 252 | self.btn_busca_forn = Button(self.tela1, text='LIMPAR',width = 20,height = 2,bg='yellow', command = self.Limpa_gravar_Limpa_Id) 253 | self.btn_busca_forn.place(x = 220, y = 390) 254 | 255 | self.btn_busca_todos = Button(self.tela1, text='CONTAS PERSONALIZ.',width = 20,height = 2,bg='yellow', command = self.lista_Personalizada) 256 | self.btn_busca_todos.place(x = 0, y = 450) 257 | 258 | self.btn_busca_forn = Button(self.tela1, text='CATEGORIAS',width = 20,height = 2,bg='BLUE', command = self.pesquisa_Cat) 259 | self.btn_busca_forn.place(x = 220, y = 450) 260 | 261 | self.btn_atualiza = Button(self.tela1, text='ALTERAR',width = 20,height = 2,bg='skyblue',command = self.atualiza_Contas, state = 'disable')# command = self.atualiza_Contas) 262 | self.btn_atualiza.place(x = 440, y = 390) 263 | 264 | self.btn_sair = Button(self.tela1, text='SAIR',width = 20,height = 2,bg='red', command = self.tela1.destroy) 265 | self.btn_sair.place(x = 440, y = 450) 266 | 267 | self.btn_delete_conta = Button(self.tela1, text='DELETAR', width = 20,height = 6, command = self.deletar_conta, state = 'disable') 268 | self.btn_delete_conta.place(x = 680, y = 390) 269 | 270 | self.tela1.geometry("950x550+250+500") 271 | self.tela1.title("Cadastro de Contas") 272 | self.tela1.configure(background='light blue') 273 | self.tela1.transient(self.master) 274 | self.tela1.grab_set() 275 | if id_conta: 276 | self.id_contae.insert(0,id_conta) 277 | self.pesquisar_Contas(None) 278 | self.consulta_mes.destroy() 279 | else: 280 | self.Proximo_Id() 281 | 282 | def Proximo_Id(self): 283 | cnx = connect() 284 | 285 | cursor = cnx.cursor() 286 | 287 | try: 288 | cursor.execute("SELECT MAX(IDCONTA) +1 FROM CONTAS_PAGAR") 289 | dadosbanco = cursor.fetchone() 290 | #print(cursor.execute) 291 | if dadosbanco: 292 | self.id_contae.insert(0,dadosbanco[0]) 293 | #self.desabilitaGravar() 294 | 295 | except mysql.connector.Error as err: 296 | messagebox.showerror("Erro ao buscar ID",err) 297 | 298 | cnx.close() 299 | 300 | 301 | def list_pgto(self): 302 | cnx = connect() 303 | cursor = cnx.cursor() 304 | cursor.execute("SELECT DESC_PGTO FROM TIPO_PAGTO") 305 | result = [] 306 | #cursor = cursor.fetchall() 307 | for i in cursor.fetchall(): 308 | result.append(i[0]) 309 | 310 | #print(i) 311 | return result 312 | 313 | cnx.close() 314 | 315 | 316 | 317 | 318 | def grav_contas(self): 319 | self.desabilita_deletar_conta() 320 | cnx = connect() 321 | cursor = cnx.cursor() 322 | 323 | idcat = self.id_cat.get() 324 | if self.id_cat.get() == '': 325 | messagebox.showwarning("Erro", "CAMPO CÓDIGO DA CATEGORIA VAZIO") 326 | else: 327 | #forne = self.forne.get() 328 | valorcontae = self.valorcontae.get() 329 | if self.valorcontae.get() == '': 330 | messagebox.showwarning("Erro", "DIGITE O VALOR",parent=self.tela1) 331 | else: 332 | data_compra = self.data_comprae.get() 333 | vence = self.vence.get() 334 | pago = self.combo1.get().upper() 335 | #pago = self.pagoe.get().upper() 336 | data_pgto = self.data_pgtoe.get() 337 | tipo_pagto = self.combo.get().upper() 338 | #tipo_pgto = self.tipo_pgtoe.get().upper() 339 | #pago = self.combo.get() 340 | obs = self.observae.get().upper() 341 | 342 | 343 | 344 | cursor.execute("INSERT INTO CONTAS_PAGAR (ID_CAT,VALOR,DATA_COMPRA,DATA_VENCIMENTO,PAGO,DATA_PGTO,TIPO_PGTO,OBS) VALUES('"+idcat+"','"+valorcontae+"','"+data_compra+"','"+vence+"','"+pago+"','"+data_pgto+"','"+tipo_pagto+"','"+obs+"')") 345 | 346 | try: 347 | cnx.commit() 348 | #print("Dados gravados com sucesso") 349 | messagebox.showinfo("Dados Gravados", "Gravação OK! ",parent=self.tela1) 350 | #self.Limpa_gravar() 351 | self.Limpa_gravar_Limpa_Id() 352 | self.Proximo_Id() 353 | 354 | 355 | except mysql.connector.Error as err: 356 | #print("Não conseguiu gravar",err) 357 | messagebox.showerror("Não conseguiu gravar",err) 358 | 359 | cnx.close() 360 | 361 | 362 | 363 | def Limpa_gravar(self): 364 | self.id_cat.delete(0,END) 365 | self.valorcontae.delete(0,END) 366 | self.data_comprae.delete(0,END) 367 | self.categoria.delete(0,END) 368 | self.vence.delete(0,END) 369 | self.combo1.delete(0, END) 370 | self.data_pgtoe.delete(0, END) 371 | self.combo.delete(0, END) 372 | self.observae.delete(0, END) 373 | 374 | def Limpa_gravar_Limpa_Id(self): 375 | self.desabilita_alterar() 376 | self.desabilita_deletar_conta() 377 | self.habilitaGravar() 378 | self.Proximo_Id() 379 | self.id_contae.delete(0,END) 380 | self.categoria.delete(0, END) 381 | self.id_cat.delete(0,END) 382 | self.valorcontae.delete(0,END) 383 | self.data_comprae.delete(0,END) 384 | self.editcategoria.delete(0,END) 385 | self.vence.delete(0,END) 386 | self.combo1.delete(0, END) 387 | self.data_pgtoe.delete(0, END) 388 | self.combo.delete(0, END) 389 | self.observae.delete(0, END) 390 | 391 | def View_Contas(self): 392 | 393 | cnx = connect() 394 | cursor = cnx.cursor() 395 | cursor.execute("SELECT C.IDCONTA,C.ID_CAT, F.DESC_CAT, C.VALOR,C.DATA_COMPRA,DATA_VENCIMENTO,C.PAGO,C.DATA_PGTO,C.TIPO_PGTO,C.OBS FROM CONTAS_PAGAR \ 396 | AS C INNER JOIN CATEGORIAS AS F ON C.ID_CAT=F.ID_CAT ORDER BY C.IDCONTA") 397 | rows=cursor.fetchall() 398 | for row in rows: 399 | '''print(row)''' 400 | self.tree1.insert("",END, values = row) 401 | cnx.close() 402 | 403 | 404 | def pesquisa_Contas(self): 405 | self.consulta1 = Toplevel() 406 | self.tree1= ttk.Treeview(self.consulta1, column=("column", "column1","column2", 407 | "column3","column4","column5", 408 | "column6","column7","column8", 409 | "column9","column10")) 410 | 411 | 412 | self.tree1.column("#0",minwidth=0,width=0) 413 | self.tree1.heading("#1", text="IDCONTA") 414 | self.tree1.column("#1", minwidth=0,width=80) 415 | self.tree1.heading("#2", text="ID_CAT") 416 | self.tree1.column("#2", minwidth=0,width=80) 417 | self.tree1.heading("#3", text="CATEG.") 418 | self.tree1.column("#3", minwidth=0,width=280) 419 | self.tree1.heading("#4", text="VALOR") 420 | self.tree1.column("#4", minwidth=0,width=90) 421 | self.tree1.heading("#5", text="DATA_COMPRA.") 422 | self.tree1.column("#5", minwidth=0,width=110) 423 | self.tree1.heading("#6", text="VENCIMENTO") 424 | self.tree1.column("#6", minwidth=0,width=110) 425 | self.tree1.heading("#7", text="PAGO") 426 | self.tree1.column("#7", minwidth=0,width=80) 427 | self.tree1.heading("#8", text="DATA_PGTO.") 428 | self.tree1.column("#8", minwidth=0,width=110) 429 | self.tree1.heading("#9", text="TIPO_PGTO.") 430 | self.tree1.column("#9", minwidth=0,width=160) 431 | self.tree1.heading("#10", text="OBS.") 432 | self.tree1.column("#10", minwidth=0,width=320) 433 | ## self.tree1.column("#11",minwidth=0,width=0) 434 | 435 | self.tree1.configure(height=28) 436 | self.tree1.grid() 437 | self.View_Contas() 438 | 439 | 440 | self.consulta1.geometry('1580x760') 441 | self.consulta1.title('CONSULTA TODAS AS CONTAS') 442 | self.consulta1.transient(self.master) 443 | self.consulta1.focus_force() 444 | self.consulta1.grab_set() 445 | 446 | 447 | 448 | 449 | def Completar(self, event):#TRAZ A CATEGORIA 450 | self.id_cat.delete(0,END) 451 | self.categoria.delete(0,END) 452 | cnx = connect() 453 | cursor = cnx.cursor() 454 | 455 | try: 456 | cursor.execute("SELECT ID_CAT, DESC_CAT FROM CATEGORIAS WHERE DESC_CAT LIKE '%"+ self.editcategoria.get()+"%' ") 457 | dadosbanco = cursor.fetchone() 458 | #print(cursor.execute) 459 | if dadosbanco: 460 | self.id_cat.insert(0,dadosbanco[0]) 461 | self.categoria.insert(0,dadosbanco[1]) 462 | self.valorcontae.focus_force() 463 | 464 | except mysql.connector.Error as err: 465 | messagebox.showerror("Erro ao buscar Categoria",err) 466 | 467 | cnx.close() 468 | 469 | # PAGAR CONTA 470 | def atualiza_Contas(self): 471 | 472 | cnx = connect() 473 | cursor = cnx.cursor() 474 | idconta = self.id_contae.get() 475 | valorconta = self.valorcontae.get() 476 | pago = self.combo1.get().upper() 477 | data_compra = self.data_comprae.get() 478 | data_vence = self.vence.get() 479 | data_pagto = self.data_pgtoe.get() 480 | tipo_pgto = self.combo.get().upper() 481 | obs = self.observae.get().upper() 482 | 483 | 484 | sql = "UPDATE CONTAS_PAGAR SET VALOR ='"+valorconta+"',PAGO = '"+pago+"', DATA_COMPRA = '"+data_compra+"',DATA_VENCIMENTO = '"+data_vence+"',\ 485 | DATA_PGTO = '"+data_pagto+"',TIPO_PGTO = '"+tipo_pgto+"', OBS = '"+obs+"' WHERE IDCONTA = "+idconta 486 | 487 | try: 488 | cursor.execute(sql) 489 | cnx.commit() 490 | #print("Dados gravados com sucesso") 491 | messagebox.showinfo("Dados Gravados", "Gravação OK! ")#,parent=self.tela1) 492 | self.Limpa_gravar() 493 | self.desabilita_deletar_conta() 494 | 495 | except mysql.connector.Error as err: 496 | #print("Não conseguiu gravar",err) 497 | messagebox.showerror("Não conseguiu gravar",err)#,parent=tela1) 498 | 499 | cnx.close() 500 | # UPDATE CONTAS 501 | def pesquisar_Contas(self,event): 502 | self.desabilitaGravar() 503 | self.habilita_alterar() 504 | self.habilita_deletar_conta() 505 | cnx = connect() 506 | cursor = cnx.cursor() 507 | 508 | cursor.execute("SELECT C.ID_CAT,F.DESC_CAT,C.VALOR, C.DATA_COMPRA,C.DATA_VENCIMENTO,C.PAGO,C.DATA_PGTO,C.TIPO_PGTO, C.OBS FROM \ 509 | CONTAS_PAGAR AS C INNER JOIN CATEGORIAS AS F ON C.ID_CAT=F.ID_CAT WHERE IDCONTA = '"+self.id_contae.get()+"' ") 510 | 511 | dadosbanco = cursor.fetchone() 512 | if dadosbanco: 513 | self.Limpa_gravar() 514 | #print(cursor.execute()) 515 | self.id_cat.insert(0, dadosbanco[0]) 516 | self.categoria.insert(0, dadosbanco[1]) 517 | self.valorcontae.insert(0, dadosbanco[2]) 518 | self.data_comprae.insert(0, dadosbanco[3]) 519 | self.vence.insert(0, dadosbanco[4]) 520 | self.combo1.insert(0, dadosbanco[5]) 521 | self.data_pgtoe.insert(0, dadosbanco[6]) 522 | self.combo.insert(0, dadosbanco[7]) 523 | self.observae.insert(0, dadosbanco[8]) 524 | cnx.close() 525 | 526 | def deletar_conta(self): 527 | self.desabilitaGravar() 528 | cnx = connect() 529 | cursor = cnx.cursor() 530 | 531 | sql = "DELETE FROM CONTAS_PAGAR WHERE IDCONTA = '"+self.id_contae.get()+"' " 532 | 533 | try: 534 | cursor.execute(sql) 535 | cnx.commit() 536 | #print("Dados gravados com sucesso") 537 | messagebox.showinfo("DADOS APAGADOS", "DELETE OK! ",parent=self.tela1) 538 | self. Limpa_gravar_Limpa_Id() 539 | 540 | except mysql.connector.Error as err: 541 | #print("Não conseguiu gravar",err) 542 | messagebox.showerror("NÃO CONSEGUIU DELETAR",err,parent=tela1) 543 | 544 | 545 | cnx.close() 546 | 547 | def habilita_deletar_conta(self): 548 | self.btn_delete_conta = Button(self.tela1, text='DELETAR',width = 20,height = 6,bg='red', command = self.deletar_conta, state = 'normal') 549 | self.btn_delete_conta.place(x = 680, y = 390) 550 | 551 | def desabilita_deletar_conta(self): 552 | self.btn_delete_conta = Button(self.tela1, text='DELETAR',width = 20,height = 6,bg='red', command = self.deletar_conta, state = 'disable') 553 | self.btn_delete_conta.place(x = 680, y = 390) 554 | 555 | def habilita_alterar(self): 556 | self.btn_atualiza = Button(self.tela1, text='ALTERAR',width = 20,height = 2,bg='skyblue',command = self.atualiza_Contas, state = 'normal')# command = self.atualiza_Contas) 557 | self.btn_atualiza.place(x = 440, y = 390) 558 | 559 | def desabilita_alterar(self): 560 | self.btn_atualiza = Button(self.tela1, text='ALTERAR',width = 20,height = 2,bg='skyblue',command = self.atualiza_Contas, state = 'disable') 561 | self.btn_atualiza.place(x = 440, y = 390) 562 | 563 | def desabilitaGravar(self): 564 | self.btn_gravar = Button(self.tela1, text='Gravar',width = 20,height = 2,bg='green', command = self.grav_contas, state = 'disable') 565 | self.btn_gravar.place(x = 0, y = 390) 566 | 567 | 568 | def habilitaGravar(self): 569 | self.btn_gravar = Button(self.tela1, text='Gravar',width = 20,height = 2,bg='green', command = self.grav_contas, state = 'normal') 570 | self.btn_gravar.place(x = 0, y = 390) 571 | 572 | 573 | 574 | 575 | # PESQUISA CONTAS DO MÊS ATUAL NA TELA PRINCIPAL 576 | 577 | def View_Contas_Mes(self): 578 | 579 | cnx = connect() 580 | cursor = cnx.cursor() 581 | #cursor.execute("SELECT * FROM CONTAS_PAGAR ORDER BY IDCONTA ") 582 | cursor.execute("SELECT C.IDCONTA,C.ID_CAT, F.DESC_CAT, C.VALOR,C.DATA_COMPRA,DATA_VENCIMENTO,C.PAGO,C.DATA_PGTO,C.TIPO_PGTO,C.OBS FROM CONTAS_PAGAR \ 583 | AS C INNER JOIN CATEGORIAS AS F ON C.ID_CAT=F.ID_CAT WHERE MONTH(C.DATA_VENCIMENTO) = MONTH(NOW()) ORDER BY C.DATA_VENCIMENTO" ) 584 | rows=cursor.fetchall() 585 | for row in rows: 586 | '''print(row)''' 587 | self.tree5.insert("",END, values = row) 588 | cnx.close() 589 | 590 | 591 | def pesquisa_Contas_mes(self): 592 | ''' TRAZ TODAS AS CONTAS DO MÊS ''' 593 | self.consulta_mes = Toplevel() 594 | cnx = connect() 595 | cursor = cnx.cursor() 596 | cursor.execute("SELECT SUM(VALOR) FROM CONTAS_PAGAR WHERE MONTH(DATA_VENCIMENTO) = MONTH(NOW())") 597 | row=cursor.fetchone() 598 | 599 | if row: 600 | self.total_mes = Label(self.consulta_mes, text = 'TOTAL R$ ' + str(row[0]),font=('arial 22 bold'),fg='red') 601 | self.total_mes.grid() 602 | 603 | cnx.close() 604 | 605 | self.tree5= ttk.Treeview(self.consulta_mes, column=("column", "column1","column2", 606 | "column3","column4","column5","column6","column7","column8","column9","column10")) 607 | self.tree5.column("#0",minwidth=0,width=0) 608 | self.tree5.heading("#1", text="IDCONTA") 609 | self.tree5.column("#1", minwidth=0,width=80) 610 | self.tree5.heading("#2", text="ID_CAT") 611 | self.tree5.column("#2", minwidth=0,width=80) 612 | self.tree5.heading("#3", text="CATEG.") 613 | self.tree5.column("#3", minwidth=0,width=280) 614 | self.tree5.heading("#4", text="VALOR") 615 | self.tree5.column("#4", minwidth=0,width=90) 616 | self.tree5.heading("#5", text="DATA_COMPRA") 617 | self.tree5.column("#5", minwidth=0,width=110) 618 | self.tree5.heading("#6", text="VENCIMENTO") 619 | self.tree5.column("#6", minwidth=0,width=110) 620 | self.tree5.heading("#7", text="PAGO") 621 | self.tree5.column("#7", minwidth=0,width=80) 622 | self.tree5.heading("#8", text="DATA_PGTO.") 623 | self.tree5.column("#8", minwidth=0,width=110) 624 | self.tree5.heading("#9", text="TIPO_PGTO.") 625 | self.tree5.column("#9", minwidth=0,width=200) 626 | self.tree5.heading("#10", text="OBS.") 627 | self.tree5.column("#10", minwidth=0,width=280) 628 | self.tree5.column("#11",minwidth=0,width=0) 629 | 630 | self.tree5.configure(height=28) 631 | self.tree5.grid() 632 | self.tree5.bind("", self.treeDoubleClick) 633 | #self.tree5.bind("",lambda e:print(self.tree5.selection()[0])) 634 | self.View_Contas_Mes() 635 | 636 | 637 | self.consulta_mes.geometry('1480x680') 638 | self.consulta_mes.title('CONSULTA CONTAS DO MES') 639 | self.consulta_mes.transient(self.master) 640 | self.consulta_mes.focus_force() 641 | self.consulta_mes.grab_set() 642 | 643 | def treeDoubleClick(self, event): 644 | item = self.tree5.selection()[0] 645 | id_conta = self.tree5.item(item,"values")[0] 646 | self.cadastraContas(id_conta=id_conta) 647 | 648 | 649 | 650 | 651 | 652 | def View_Contas_Mes_Pagas(self): 653 | ''' PESQUISA CONTAS DO MÊS ATUAL NA TELA PRINCIPAL PAGAS ''' 654 | 655 | cnx = connect() 656 | cursor = cnx.cursor() 657 | cursor.execute("SELECT C.IDCONTA,C.ID_CAT, F.DESC_CAT, C.VALOR,C.DATA_COMPRA,DATA_VENCIMENTO,C.PAGO,C.DATA_PGTO,C.TIPO_PGTO,C.OBS FROM CONTAS_PAGAR \ 658 | AS C INNER JOIN CATEGORIAS AS F ON C.ID_CAT=F.ID_CAT WHERE MONTH(C.DATA_VENCIMENTO) = MONTH(NOW()) AND C.PAGO ='SIM'") 659 | rows=cursor.fetchall() 660 | for row in rows: 661 | ''' print(row) 662 | ''' 663 | self.tree6.insert("",END, values = row) 664 | cnx.close() 665 | 666 | 667 | def pesquisa_Contas_mes_pagas(self): 668 | self.consulta_mes_paga = Toplevel() 669 | cnx = connect() 670 | cursor = cnx.cursor() 671 | #cursor.execute("SELECT * FROM CONTAS_PAGAR ORDER BY IDCONTA ") 672 | cursor.execute("SELECT SUM(VALOR) FROM CONTAS_PAGAR WHERE MONTH(DATA_VENCIMENTO) = MONTH(NOW()) AND PAGO ='SIM'") 673 | 674 | row=cursor.fetchone() 675 | 676 | 677 | if row: 678 | self.total_mes_pago = Label(self.consulta_mes_paga, text = 'TOTAL R$ ' + str(row[0]),font=('arial 22 bold'),fg='red') 679 | self.total_mes_pago.grid()#(row = 0, column = 1) 680 | 681 | cnx.close() 682 | 683 | 684 | self.tree6= ttk.Treeview(self.consulta_mes_paga, column=("column", "column1","column2", 685 | "column3","column4","column5","column6","column7","column8","column9","column10"))#,"column11")) 686 | self.tree6.column("#0",minwidth=0,width=0) 687 | self.tree6.heading("#1", text="IDCONTA") 688 | self.tree6.column("#1", minwidth=0,width=60) 689 | self.tree6.heading("#2", text="ID_CAT") 690 | self.tree6.column("#2", minwidth=0,width=60) 691 | self.tree6.heading("#3", text="CATEG.") 692 | self.tree6.column("#3", minwidth=0,width=260) 693 | self.tree6.heading("#4", text="VALOR") 694 | self.tree6.column("#4", minwidth=0,width=90) 695 | self.tree6.heading("#5", text="DATA_COMPRA") 696 | self.tree6.column("#5", minwidth=0,width=110) 697 | self.tree6.heading("#6", text="VENCIMENTO") 698 | self.tree6.column("#6", minwidth=0,width=110) 699 | self.tree6.heading("#7", text="PAGO") 700 | self.tree6.column("#7", minwidth=0,width=60) 701 | self.tree6.heading("#8", text="DATA_PGTO.") 702 | self.tree6.column("#8", minwidth=0,width=110) 703 | self.tree6.heading("#9", text="TIPO_PGTO.") 704 | self.tree6.column("#9", minwidth=0,width=200) 705 | self.tree6.heading("#10", text="OBS.") 706 | self.tree6.column("#10", minwidth=0,width=280) 707 | self.tree6.column("#11",minwidth=0,width=0) 708 | 709 | self.tree6.configure(height=28) 710 | self.tree6.grid() 711 | self.View_Contas_Mes_Pagas() 712 | 713 | 714 | 715 | self.consulta_mes_paga.geometry('1450x798+100+50') 716 | self.consulta_mes_paga.title('CONSULTA CONTAS DO MES PAGAS') 717 | self.consulta_mes_paga.transient(self.master) 718 | self.consulta_mes_paga.focus_force() 719 | self.consulta_mes_paga.grab_set() 720 | 721 | 722 | # PESQUISA CONTAS DO MÊS ATUAL NA TELA PRINCIPAL EM ABERTO 723 | 724 | def View_Contas_Mes_Aberto(self): 725 | 726 | cnx = connect() 727 | cursor = cnx.cursor() 728 | #cursor.execute("SELECT * FROM CONTAS_PAGAR ORDER BY IDCONTA ") 729 | cursor.execute("SELECT C.IDCONTA,C.ID_CAT, F.DESC_CAT, C.VALOR,C.DATA_COMPRA,DATA_VENCIMENTO,C.PAGO,C.DATA_PGTO,C.TIPO_PGTO,C.OBS FROM CONTAS_PAGAR \ 730 | AS C INNER JOIN CATEGORIAS AS F ON C.ID_CAT=F.ID_CAT WHERE MONTH(C.DATA_VENCIMENTO) = MONTH(NOW()) AND C.PAGO ='NAO' ORDER BY C.DATA_VENCIMENTO") 731 | rows=cursor.fetchall() 732 | for row in rows: 733 | '''print(row)''' 734 | self.tree7.insert("",END, values = row) 735 | cnx.close() 736 | 737 | 738 | def pesquisa_Contas_mes_Aberto(self): 739 | self.consulta_mes_aberto = Toplevel() 740 | cnx = connect() 741 | cursor = cnx.cursor() 742 | cursor.execute("SELECT SUM(VALOR) FROM CONTAS_PAGAR WHERE MONTH(DATA_VENCIMENTO) = MONTH(NOW()) AND PAGO ='NAO'") 743 | 744 | row=cursor.fetchone() 745 | 746 | if row: 747 | self.total_mes_aberto = Label(self.consulta_mes_aberto, text = 'TOTAL R$ ' + str(row[0]),font=('arial 22 bold'),fg='red') 748 | self.total_mes_aberto.grid() 749 | 750 | cnx.close() 751 | self.tree7= ttk.Treeview(self.consulta_mes_aberto , column=("column", "column1","column2", 752 | "column3","column4","column5","column6","column7","column8","column9","column10"))#,"column11")) 753 | self.tree7.column("#0",minwidth=0,width=0) 754 | self.tree7.heading("#1", text="IDCONTA") 755 | self.tree7.column("#1", minwidth=0,width=80) 756 | self.tree7.heading("#2", text="ID_CAT") 757 | self.tree7.column("#2", minwidth=0,width=80) 758 | self.tree7.heading("#3", text="CATEG.") 759 | self.tree7.column("#3", minwidth=0,width=280) 760 | self.tree7.heading("#4", text="VALOR") 761 | self.tree7.column("#4", minwidth=0,width=90) 762 | self.tree7.heading("#5", text="DATA_COMPRA") 763 | self.tree7.column("#5", minwidth=0,width=110) 764 | self.tree7.heading("#6", text="VENCIMENTO") 765 | self.tree7.column("#6", minwidth=0,width=110) 766 | self.tree7.heading("#7", text="PAGO") 767 | self.tree7.column("#7", minwidth=0,width=80) 768 | self.tree7.heading("#8", text="DATA_PGTO.") 769 | self.tree7.column("#8", minwidth=0,width=110) 770 | self.tree7.heading("#9", text="TIPO_PGTO.") 771 | self.tree7.column("#9", minwidth=0,width=200) 772 | self.tree7.heading("#10", text="OBS.") 773 | self.tree7.column("#10", minwidth=0,width=280) 774 | self.tree7.column("#11",minwidth=0,width=0) 775 | 776 | self.tree7.configure(height=28) 777 | self.tree7.grid() 778 | self.View_Contas_Mes_Aberto() 779 | 780 | 781 | self.consulta_mes_aberto .geometry('1480x680') 782 | self.consulta_mes_aberto .title('CONSULTA CONTAS EM ABERTO MES ATUAL') 783 | self.consulta_mes_aberto .transient(self.master) 784 | self.consulta_mes_aberto .focus_force() 785 | self.consulta_mes_aberto .grab_set() 786 | 787 | 788 | 789 | # -----------------------------------------------------------------------# 790 | # CATEGORIAS # 791 | # -----------------------------------------------------------------------# 792 | 793 | def cad_Cat(self): 794 | self.cad_cat = Toplevel() 795 | self.idcat = Label(self.cad_cat, text ="ID ", fg= 'black',bg='#CCFFCC') 796 | self.idcat.grid(row = 0, column = 0) 797 | self.editidcat =Entry(self.cad_cat,width = 10,bg='lemonchiffon',bd=4) 798 | self.editidcat.grid(row = 0, column = 1,sticky=W) 799 | self.catB = Button(self.cad_cat, text="BUSCAR CATEG.",width=17,font=('Arial',14, 'bold')) 800 | self.catB.grid(row = 0, column = 2) 801 | self.catB.bind("", self.pesquisar_Cat) 802 | self.descricao = Label(self.cad_cat, text ="DESCRICAO", fg= 'black',bg='#CCFFCC') 803 | self.descricao.grid(row = 1, column = 0) 804 | self.editdescricao = Entry(self.cad_cat,width = 20,bg='lemonchiffon',bd=4) 805 | self.editdescricao.grid(row = 1, column =1,sticky=W) 806 | self.editdescricao.focus() 807 | self.obs_cat = Label(self.cad_cat, text='OBSERVAÇÕES',font=('Arial',16, 'bold'),bg='lightskyblue') 808 | self.obs_cat.grid(row = 2, column = 1) 809 | self.obs_e = Entry(self.cad_cat,width = 30,bg='lemonchiffon',bd=4) 810 | self.obs_e.grid(row =3, column=1) 811 | 812 | 813 | 814 | 815 | # =========================================================================================================================================== 816 | # BOTÕES = 817 | # =========================================================================================================================================== 818 | 819 | self.grav_cat = Button(self.cad_cat, text ='GRAVAR ',pady=2,bg ='black', padx=1,bd=2, width = 25, height = 2, 820 | font = ('Arial', 12,'bold'), fg ='blue',command = self.gravaCat)#, state = 'disable') 821 | self.grav_cat.grid(row = 7, column = 0) 822 | 823 | self.limpa_cat = Button(self.cad_cat, text ='LIMPAR ',pady=1,bg ='black', padx=2,bd=1, width = 25, height = 2, 824 | font = ('Arial', 12,'bold'), fg ='green',command = self.limpa_gravaCat) 825 | self.limpa_cat.grid(row = 7, column = 1) 826 | 827 | self.boficina = Button(self.cad_cat, text ='TODAS CATEGORIAS',pady=1,bg ='black', padx=2,bd=1, width = 25, height = 2, 828 | font = ('Arial', 12,'bold'), fg ='yellow',command = self.pesquisa_Cat) 829 | self.boficina.grid(row = 8, column = 0) 830 | 831 | self.sair_categ = Button(self.cad_cat, text ='SAIR ',pady=1,bg ='black', padx=2,bd=1, width = 25, height = 2, 832 | font = ('Arial', 12,'bold'), fg ='red', command = self.cad_cat.destroy) 833 | self.sair_categ.grid(row = 8, column = 1) 834 | 835 | self.btn_editar = Button(self.cad_cat, text='ALTERAR',width = 20,height = 2,bg='black', fg= 'yellow',command = self.atualiza_Cat) 836 | self.btn_editar.grid(row = 7 , column = 2) 837 | 838 | 839 | 840 | self.cad_cat.geometry('890x350+500+500') 841 | self.cad_cat.title('CADASTRO DE CATEGORIAS') 842 | self.cad_cat.transient(self.master) 843 | self.cad_cat.focus_force() 844 | self.cad_cat.grab_set() 845 | self.cad_cat.configure(background = '#CCFFCC') 846 | 847 | 848 | 849 | def gravaCat(self): 850 | cnx = connect() 851 | cursor = cnx.cursor() 852 | 853 | descricao = self.editdescricao.get().upper() 854 | if self.editdescricao.get() == '': 855 | messagebox.showwarning("Erro", "DIGITE A DESCRICAO",parent=self.cad_cat) 856 | else: 857 | obs = self.obs.get().upper() 858 | 859 | #data = time.strftime('%d/%m/%y %H:%M:%S') 860 | 861 | cursor.execute("INSERT INTO CATEGORIAS (DESC_CAT, OBS_CAT)\ 862 | VALUES ('"+descricao+"','"+obs+"')") 863 | 864 | try: 865 | cnx.commit() 866 | #print("Dados gravados com sucesso") 867 | messagebox.showinfo("SUCESSO","Dados gravados com sucesso!:)",parent=self.cad_cat) 868 | self.limpa_gravaCat() 869 | 870 | 871 | 872 | except mysql.connector.Error as err: 873 | #print("Não conseguiu gravar no banco de dados.:",err) 874 | messagebox.showrror("Erro ao gravar os dados",err,parent=self.cad_cat) 875 | 876 | cnx.close() 877 | 878 | 879 | 880 | 881 | def limpa_gravaCat(self):# Mysql 882 | #self.editlist_ofi.delete(0,END) 883 | self.editdescricao.delete(0,END) 884 | self.obs_e.delete(0,END) 885 | 886 | 887 | # UPDATE Categorias 888 | def pesquisar_Cat(self,event): 889 | self.desabilita_Cat() 890 | cnx = connect() 891 | cursor = cnx.cursor() 892 | 893 | cursor.execute("SELECT * FROM CATEGORIAS WHERE ID_CAT = '"+self.editidcat.get()+"' ") 894 | 895 | dadosbanco = cursor.fetchone() 896 | self.limpa_gravaCat() 897 | if dadosbanco: 898 | #self.Limpa_gravar() 899 | #print(cursor.execute()) 900 | self.editdescricao.insert(0, dadosbanco[1]) 901 | self.editcnpj.insert(0, dadosbanco[2]) 902 | 903 | cnx.close() 904 | 905 | # UPDATE CATEGORIAS 906 | def atualiza_Cat(self): 907 | cnx = connect() 908 | cursor = cnx.cursor() 909 | idcat = self.editidcat.get() 910 | descricao = self.editdescricao.get().upper() 911 | if self.editdescricao.get() == '': 912 | messagebox.showwarning("Erro", "DIGITE A DESCRICAO") 913 | else: 914 | 915 | 916 | 917 | sql = "UPDATE CATEGORIAS SET DESC_CAT = '"+descricao+"' WHERE ID_CAT = "+idcat 918 | try: 919 | cursor.execute(sql) 920 | cnx.commit() 921 | #print("Dados gravados com sucesso") 922 | messagebox.showinfo("Dados Gravados", "Gravação OK! ") 923 | self.limpa_gravaCat() 924 | self.habilita_Cat() 925 | 926 | except mysql.connector.Error as err: 927 | #print("Não conseguiu gravar",err) 928 | messagebox.showerror("Não conseguiu gravar",err) 929 | 930 | cnx.close() 931 | def desabilita_Cat(self): 932 | self.grav_cat = Button(self.cad_cat, text ='GRAVAR ',pady=2,bg ='black', padx=1,bd=2, width = 25, height = 2, 933 | font = ('Arial', 12,'bold'), fg ='blue',command = self.gravaForn, state = 'disable') 934 | self.grav_cat.grid(row = 7, column = 0) 935 | 936 | def habilita_Cat(self): 937 | self.grav_cat = Button(self.cad_cat, text ='GRAVAR ',pady=2,bg ='black', padx=1,bd=2, width = 25, height = 2, 938 | font = ('Arial', 12,'bold'), fg ='blue',command = self.gravaCat, state = 'normal') 939 | self.grav_cat.grid(row = 7, column = 0) 940 | 941 | # =========================================================================================================================== 942 | 943 | 944 | def View_Cat(self):# categorias 945 | cnx = connect() 946 | cursor = cnx.cursor() 947 | cursor.execute("SELECT * FROM CATEGORIAS ORDER BY ID_CAT ") 948 | rows=cursor.fetchall() 949 | for row in rows: 950 | '''print(row)''' 951 | self.tree2.insert("",END, values = row) 952 | cnx.close() 953 | 954 | 955 | def pesquisa_Cat(self): 956 | self.consulta2 = Toplevel() 957 | self.tree2= ttk.Treeview(self.consulta2, column=("column", "column1","column2", 958 | "column3")) 959 | self.tree2.column("#0",minwidth=0,width=0) 960 | self.tree2.heading("#1", text="IDCAT") 961 | self.tree2.column("#1", minwidth=0,width=78) 962 | self.tree2.heading("#2", text="DESCRICAO") 963 | self.tree2.column("#2", minwidth=0,width=280) 964 | self.tree2.heading("#3", text="OBSERVAÇÕES") 965 | self.tree2.column("#3", minwidth=0,width=480) 966 | self.tree2.column("#4", minwidth=0,width=10) 967 | 968 | self.tree2.configure(height=18) 969 | self.tree2.grid() 970 | self.View_Cat() 971 | 972 | 973 | self.consulta2.geometry('860x400+50+50') 974 | self.consulta2.title('CONSULTA CATEGORIAS') 975 | self.consulta2.transient(self.master) 976 | self.consulta2.focus_force() 977 | self.consulta2.grab_set() 978 | 979 | # ========================================================================================================================# 980 | # LISTA PERSONALIZADA (CATEGORIAS) # 981 | # ========================================================================================================================# 982 | 983 | def lista_PersonaCat(self):#Busca por data 984 | self.listaCat_perso = Toplevel() 985 | self.buscadados = Label(self.listaCat_perso, font =('Arial',10,'bold'), 986 | text='BUSCA POR DESCRICAO') 987 | self.buscadados.grid(row = 0, column = 0) 988 | self.descricao = Label(self.listaCat_perso, text = 'NOME') 989 | self.descricao.grid(row = 1, column = 0) 990 | self.editdescricao = Entry(self.listaCat_perso,width =20, bg = 'lemonchiffon', bd = 4) 991 | self.editdescricao.grid(row = 2, column = 0, sticky = W) 992 | self.editdescricao.focus() 993 | 994 | # ========================================================================================================================== 995 | # LINHA DE SEPARAÇÃO = 996 | # ========================================================================================================================== 997 | 998 | separa_linha2 =Frame(self.listaCat_perso, height=4, bd=2, relief=SUNKEN) 999 | separa_linha2.grid(row = 4,stick=W+E+N+S,columnspan=8,pady=10) 1000 | 1001 | 1002 | 1003 | # =========================================================================================================================== 1004 | # BOTÕES = 1005 | # =========================================================================================================================== 1006 | 1007 | self.busca_perso = Button(self.listaCat_perso, text ='BUSCAR ',pady=1,bg ='black', padx=1,bd=2, width = 15, height = 2, 1008 | font = ('Arial', 12,'bold'), fg ='blue', command = self.listaPersonaForn) 1009 | self.busca_perso.grid(row = 10, column = 0) 1010 | 1011 | sair_buscaPerso = Button(self.listaCat_perso, text ='SAIR',pady=1, bg ='red', padx = 1,bd = 2, width = 15, height = 2, 1012 | font = ('Arial', 12,'bold'), fg ='yellow', command=self.listaCat_perso.destroy) 1013 | sair_buscaPerso.grid(row = 11, column = 0) 1014 | 1015 | 1016 | 1017 | 1018 | self.listaCat_perso.geometry('840x270') 1019 | self.listaCat_perso.title('LISTAR POR DESCRICAO') 1020 | self.listaCat_perso.transient(self.master) 1021 | self.listaCat_perso.focus_force() 1022 | self.listaCat_perso.grab_set() 1023 | 1024 | 1025 | def View_Lista_For(self):#Query que traz do banco todas informacoes da lisat personalizada solicitadas 1026 | 1027 | cnx = connect() 1028 | cursor = cnx.cursor() 1029 | 1030 | cursor.execute("SELECT * FROM CATEGORIAS WHERE DESCRICAO like '%"+self.editdescricao.get()+"%' ") 1031 | rows=cursor.fetchall() 1032 | for row in rows: 1033 | #print(row) 1034 | self.treecat.insert("",END, values = row) 1035 | cnx.close() 1036 | 1037 | 1038 | def listaPersonaCat(self):#Traz todas já feitas 1039 | #self.limpaCampos() 1040 | self.consulta3 = Toplevel() 1041 | self.treecat= ttk.Treeview(self.consulta3,column=("column", "column1","column2","column3","column4","column5","column6", 1042 | "column7","column8","column9","column10","column11")) 1043 | 1044 | self.treecat.column("#0",minwidth=0,width=10) 1045 | self.treecat.heading("#1", text="ID") 1046 | self.treecat.column("#1", minwidth=0,width=30) 1047 | self.treecat.heading("#2", text="RAZAO") 1048 | self.treecat.column("#2", minwidth=0,width=260) 1049 | self.treecat.heading("#3", text="CNPJ") 1050 | self.treecat.column("#3", minwidth=0,width=140) 1051 | self.treecat.heading("#4", text="IM") 1052 | self.treecat.column("#4", minwidth=0,width=100) 1053 | self.treecat.heading("#5", text="IE") 1054 | self.treecat.column("#5", minwidth=0,width=100) 1055 | self.treecat.heading("#6", text="END.") 1056 | self.treecat.column("#6", minwidth=0,width=240) 1057 | self.treecat.heading("#7", text="BAIRRO") 1058 | self.treecat.column("#7", minwidth=0,width=180) 1059 | self.treecat.heading("#8", text="CIDADE") 1060 | self.treecat.column("#8", minwidth=0,width=180) 1061 | self.treecat.heading("#9", text="UF") 1062 | self.treecat.column("#9", minwidth=0,width=30) 1063 | self.treecat.heading("#10", text="PAIS") 1064 | self.treecat.column("#10", minwidth=0,width=80) 1065 | self.treecat.heading("#11", text="CEP") 1066 | self.treecat.column("#11", minwidth=0,width=90) 1067 | self.treecat.column("#12", minwidth=0,width=0) 1068 | 1069 | self.treecat.configure(height=20) 1070 | self.treecat.grid() 1071 | self.View_Lista_For() 1072 | self.listaCat_perso.destroy() 1073 | 1074 | 1075 | self.consulta3.geometry('1380x200') 1076 | self.consulta3.title('BUSCA PERSONALIZADA') 1077 | self.consulta3.transient(self.master) 1078 | self.consulta3.focus_force() 1079 | self.consulta3.grab_set() 1080 | 1081 | 1082 | 1083 | # SELECT TOTAL CONTAS POR TIPO DE PAGAMENTO 1084 | 1085 | def lista_Totais_pgto(self):#Busca por data e total 1086 | self.listaTotal = Toplevel() 1087 | self.lista_tipo = [] 1088 | 1089 | 1090 | self.x_index = 0 1091 | self.y_index = 0 1092 | self.x_counter = 0 1093 | 1094 | cnx = connect() 1095 | cursor = cnx.cursor() 1096 | cursor.execute("SELECT TIPO_PGTO, SUM(VALOR) FROM CONTAS_PAGAR WHERE MONTH(DATA_VENCIMENTO) = MONTH(NOW()) GROUP BY TIPO_PGTO") 1097 | rows=cursor.fetchall() 1098 | lista_valores = [] 1099 | self.lista_tipo.append(rows) 1100 | #print(self.lista_tipo) 1101 | for i in rows: 1102 | #print(i) 1103 | 1104 | lb1 = Label(self.listaTotal, text= '' + str(i[0]),font='arial 18 bold', bg='light blue')#, fg='blue') 1105 | lb1.place(x=0, y=self.y_index) 1106 | lb2 = Label(self.listaTotal, text= ' R$ '+ str(i[1]),font='arial 18 bold', bg='light blue')#, fg='blue') 1107 | lb2.place(x= 350, y=self.y_index) 1108 | lista_valores.append(i[1]) 1109 | self.x_counter +=1 1110 | #self.y_index += 0 1111 | self.y_index += 40 1112 | self.x_counter += 1 1113 | ## print('Lista de todos os valores',lista_valores) 1114 | ## print('Lista de total dos valores R$ {:.2f} '.format(sum(lista_valores))) 1115 | total_geral = "{:.2f}".format(sum(lista_valores)) 1116 | 1117 | lb3 = Label(self.listaTotal, text=' Total R$ '+ str(total_geral),font='arial 22 bold ',fg='red', bg='SteelBlue1') 1118 | lb3.place(x=0, y=200) 1119 | 1120 | cnx.close() 1121 | 1122 | self.listaTotal.geometry('640x270') 1123 | self.listaTotal.title('TOTAL FORMA PGTO MES ATUAL') 1124 | self.listaTotal.transient(self.master) 1125 | self.listaTotal.configure(background='light blue') 1126 | self.listaTotal.focus_force() 1127 | self.listaTotal.grab_set() 1128 | 1129 | 1130 | 1131 | 1132 | def cad_Faturas(self): 1133 | self.cad_fatura = Toplevel() 1134 | self.idfatura = Label(self.cad_fatura, text ="ID ", fg= 'black',bg='#CCFFCC') 1135 | self.idfatura.grid(row = 0, column = 0) 1136 | self.editidfatura =Entry(self.cad_fatura,width = 10,bg='lemonchiffon',bd=4) 1137 | self.editidfatura.grid(row = 0, column = 1,sticky=W) 1138 | 1139 | self.desccartao = Label(self.cad_fatura, text ="DESCRICAO", fg= 'black',bg='#CCFFCC') 1140 | self.desccartao.grid(row = 1, column = 0) 1141 | self.combo6 = ttk.Combobox(self.cad_fatura, height= 4,width = 25) 1142 | #self.combo6.current(1) 1143 | self.combo6.grid(row = 1, column = 1,sticky=W) 1144 | self.combo6['values']= self.list_pgto() 1145 | ''' self.editdesccartao = Entry(self.cad_fatura,width = 30,bg='lemonchiffon',bd=4) 1146 | self.editdesccartao.grid(row = 1, column =1,sticky=W) 1147 | self.editdesccartao.focus() 1148 | ''' 1149 | self.valorcartao = Label(self.cad_fatura, text ="VALOR R$", fg= 'black',bg='#CCFFCC') 1150 | self.valorcartao.grid(row = 1, column = 2) 1151 | self.editvalorcartao = Entry(self.cad_fatura,width = 10,bg='lemonchiffon',bd=4) 1152 | self.editvalorcartao.grid(row = 1, column = 3,sticky=W) 1153 | self.venctocartao = Label(self.cad_fatura, text ="VENCIMENTO", fg= 'black',bg='#CCFFCC') 1154 | self.venctocartao.grid(row = 2, column = 0) 1155 | self.editvenctocartao = Entry(self.cad_fatura,width = 20,bg='lemonchiffon',bd=4) 1156 | self.editvenctocartao.grid(row = 2, column =1,sticky=W) 1157 | self.pago_fat = Label(self.cad_fatura, text ="PAGO (SIM/NAO)", fg= 'black',bg='#CCFFCC') 1158 | self.pago_fat.grid(row = 2, column = 2) 1159 | self.combo5 = ttk.Combobox(self.cad_fatura, height= 4,width = 10) 1160 | self.combo5['values']=('SIM','NAO') 1161 | self.combo5.current(1) 1162 | self.combo5.grid(row = 2, column = 3,sticky=W) 1163 | #self.combo5['values']= self.box_list() 1164 | self.data_pgto = Label(self.cad_fatura, text ="DATA PAGAMENTO", fg= 'black',bg='#CCFFCC') 1165 | self.data_pgto.grid(row = 4, column = 0) 1166 | self.editdata_pgto = Entry(self.cad_fatura,width = 20,bg='lemonchiffon',bd=4) 1167 | self.editdata_pgto.grid(row = 4, column =1,sticky=W) 1168 | self.valor_pgto = Label(self.cad_fatura, text ="VALOR PAGO", fg= 'black',bg='#CCFFCC') 1169 | self.valor_pgto.grid(row = 4, column = 2) 1170 | self.editvalor_pgto = Entry(self.cad_fatura,width = 10,bg='lemonchiffon',bd=4) 1171 | self.editvalor_pgto.grid(row = 4, column = 3,sticky=W) 1172 | 1173 | 1174 | 1175 | # =========================================================================================================================================== 1176 | # BOTÕES = 1177 | # =========================================================================================================================================== 1178 | 1179 | self.grav_fatura = Button(self.cad_fatura, text ='GRAVAR ',pady=2,bg ='black', padx=1,bd=2, width = 25, height = 2, 1180 | font = ('Arial', 12,'bold'), fg ='blue',command = self.gravaFatura)#, state = 'disable') 1181 | self.grav_fatura.grid(row = 8, column = 0) 1182 | 1183 | self.editarfat = Button(self.cad_fatura, text='ALTERAR',width = 25,height = 2,bg='black', fg= 'yellow',command = self.edita_Fatura) 1184 | self.editarfat.grid(row = 8 , column = 1) 1185 | 1186 | ## self.limpa_forn = Button(self.cad_fatura, text ='LIMPAR ',pady=1,bg ='black', padx=2,bd=1, width = 25, height = 2, 1187 | ## font = ('Arial', 12,'bold'), fg ='green')#,command = self.limpa_gravaForn) 1188 | ## self.limpa_forn.grid(row = 7, column = 1) 1189 | ## 1190 | self.boficina = Button(self.cad_fatura, text ='TODAS FATURAS ',pady=1,bg ='black', padx=2,bd=1, width = 25, height = 2, 1191 | font = ('Arial', 12,'bold'), fg ='yellow',command = self.pesq_Faturas_all) 1192 | self.boficina.grid(row = 9, column = 0) 1193 | 1194 | self.sair_fatura = Button(self.cad_fatura, text ='SAIR ',pady=1,bg ='black', padx=2,bd=1, width = 25, height = 2, 1195 | font = ('Arial', 12,'bold'), fg ='red', command = self.cad_fatura.destroy) 1196 | self.sair_fatura.grid(row = 9, column = 1) 1197 | 1198 | 1199 | 1200 | self.cad_fatura.geometry('890x350+500+500') 1201 | self.cad_fatura.title('FATURAS CARTOES') 1202 | self.cad_fatura.transient(self.master) 1203 | self.cad_fatura.focus_force() 1204 | self.cad_fatura.grab_set() 1205 | self.cad_fatura.configure(background = '#CCFFCC') 1206 | 1207 | 1208 | def gravaFatura(self): 1209 | cnx = connect() 1210 | cursor = cnx.cursor() 1211 | descfat = self.combo6.get().upper() 1212 | if self.combo6.get() == '': 1213 | messagebox.showwarning("Erro", "DIGITE A DESCRICAO") 1214 | else: 1215 | valor_cartao = self.editvalorcartao.get() 1216 | data_vencto = self.editvenctocartao.get() 1217 | pago = self.combo5.get().upper() 1218 | data_pgto = self.editdata_pgto.get() 1219 | valor_pgto = self.editvalor_pgto.get() 1220 | 1221 | #data = time.strftime('%d/%m/%y %H:%M:%S') 1222 | 1223 | cursor.execute("INSERT INTO FATURAS (DESC_CARTAO, VALOR_CARTAO, DATA_VENCIMENTO,PAGO,DATA_PAGAMENTO,VALOR_PAGAMENTO)\ 1224 | VALUES ('"+descfat+"','"+valor_cartao+"','"+data_vencto+"','"+pago +"','"+data_pgto+"','"+valor_pgto+"')") 1225 | 1226 | try: 1227 | cnx.commit() 1228 | #print("Dados gravados com sucesso") 1229 | messagebox.showinfo("SUCESSO","Dados gravados com sucesso!:)") 1230 | self.limpa_faturas() 1231 | 1232 | 1233 | 1234 | except mysql.connector.Error as err: 1235 | #print("Não conseguiu gravar no banco de dados.:",err) 1236 | messagebox.showrror("Erro ao gravar os dados",err) 1237 | 1238 | cnx.close() 1239 | 1240 | # EDITAR FATURA PAGA/NÃO PAGO 1241 | def edita_Fatura(self): 1242 | cnx = connect() 1243 | cursor = cnx.cursor() 1244 | idfatura =self.editidfatura.get() 1245 | descfat = self.combo6.get().upper() 1246 | if self.combo6.get() == '': 1247 | messagebox.showwarning("Erro", "DIGITE A DESCRICAO") 1248 | else: 1249 | valor_cartao = self.editvalorcartao.get() 1250 | data_vencto = self.editvenctocartao.get() 1251 | pago = self.combo5.get().upper() 1252 | data_pgto = self.editdata_pgto.get() 1253 | valor_pgto = self.editvalor_pgto.get() 1254 | 1255 | #data = time.strftime('%d/%m/%y %H:%M:%S') 1256 | 1257 | sql = "UPDATE FATURAS SET DESC_CARTAO = '"+descfat+"', VALOR_CARTAO = '"+valor_cartao+"',\ 1258 | DATA_VENCIMENTO = '"+data_vencto+"',PAGO = '"+pago +"',DATA_PAGAMENTO = '"+data_pgto+"',\ 1259 | VALOR_PAGAMENTO = '"+valor_pgto+"' WHERE IDFATURA = "+idfatura 1260 | 1261 | 1262 | try: 1263 | cursor.execute(sql) 1264 | cnx.commit() 1265 | #print("Dados gravados com sucesso") 1266 | messagebox.showinfo("SUCESSO","Dados gravados com sucesso!:)") 1267 | self.limpa_faturas() 1268 | 1269 | 1270 | 1271 | except mysql.connector.Error as err: 1272 | #print("Não conseguiu gravar no banco de dados.:",err) 1273 | messagebox.showrror("Erro ao gravar os dados",err) 1274 | 1275 | cnx.close() 1276 | 1277 | 1278 | def limpa_faturas(self): 1279 | self.combo6.delete(0,END) 1280 | self.editvalorcartao.delete(0,END) 1281 | self.editvenctocartao.delete(0,END) 1282 | self.editdata_pgto.delete(0,END) 1283 | self.combo5.delete(0,END) 1284 | self.editvalor_pgto.delete(0,END) 1285 | 1286 | 1287 | 1288 | def box_list(self): 1289 | cnx = connect() 1290 | cursor = cnx.cursor() 1291 | cursor.execute("SELECT DESC_CARTAO FROM FATURAS") 1292 | result = [] 1293 | 1294 | for i in cursor.fetchall(): 1295 | result.append(i[0]) 1296 | 1297 | #print(i) 1298 | return result 1299 | 1300 | cnx.close() 1301 | # TRAZER TODAS AS FATURAS CADSTRADAS 1302 | 1303 | 1304 | def View_Faturas(self): 1305 | cnx = connect() 1306 | cursor = cnx.cursor() 1307 | cursor.execute("SELECT * FROM FATURAS ORDER BY IDFATURA ") 1308 | rows=cursor.fetchall() 1309 | for row in rows: 1310 | '''print(row)''' 1311 | self.tree3.insert("",END, values = row) 1312 | cnx.close() 1313 | 1314 | 1315 | def pesq_Faturas_all(self): 1316 | self.consulta5 = Toplevel() 1317 | self.tree3= ttk.Treeview(self.consulta5, column=("column", "column1","column2", 1318 | "column3","column4","column5","column6", 1319 | "column7"))#,"column8","column9","column10")) 1320 | 1321 | self.tree3.column("#0",minwidth=0,width=0) 1322 | self.tree3.heading("#1", text="IDFAT") 1323 | self.tree3.column("#1", minwidth=0,width=78) 1324 | self.tree3.heading("#2", text="DESCRICAO") 1325 | self.tree3.column("#2", minwidth=0,width=280) 1326 | self.tree3.heading("#3", text="VALOR") 1327 | self.tree3.column("#3", minwidth=0,width=140) 1328 | self.tree3.heading("#4", text="VENCIMENTO") 1329 | self.tree3.column("#4", minwidth=0,width=140) 1330 | self.tree3.heading("#5", text="PAGO") 1331 | self.tree3.column("#5", minwidth=0,width=60) 1332 | self.tree3.heading("#6", text="DATA_PGTO") 1333 | self.tree3.column("#6", minwidth=0,width=140) 1334 | self.tree3.heading("#7", text="VALOR_PGTO") 1335 | self.tree3.column("#7", minwidth=0,width=100) 1336 | self.tree3.column("#8",minwidth=0,width=0) 1337 | 1338 | 1339 | self.tree3.configure(height=28) 1340 | self.tree3.grid() 1341 | self.View_Faturas() 1342 | 1343 | 1344 | self.consulta5.geometry('1080x610') 1345 | self.consulta5.title('CONSULTA CATEGORIAS') 1346 | self.consulta5.transient(self.master) 1347 | self.consulta5.focus_force() 1348 | self.consulta5.grab_set() 1349 | 1350 | # TIPOS DE PAGAMENTO 1351 | def cad_Tipos_Pgto(self): 1352 | self.cad_tipospgto = Toplevel() 1353 | self.idpgto = Label(self.cad_tipospgto, text ="ID ", fg= 'black',bg='#CCFFCC') 1354 | self.idpgto.grid(row = 0, column = 0,sticky=W) 1355 | self.editidpgto =Entry(self.cad_tipospgto,width = 10,bg='lemonchiffon',bd=4) 1356 | self.editidpgto.grid(row = 0, column = 1,sticky=W) 1357 | self.desc_pgto = Label(self.cad_tipospgto, text ="DESCRICAO ", fg= 'black',bg='#CCFFCC') 1358 | self.desc_pgto.grid(row = 1, column = 0,sticky=W) 1359 | self.editdesc_pgto =Entry(self.cad_tipospgto,width = 20,bg='lemonchiffon',bd=4) 1360 | self.editdesc_pgto.grid(row = 1, column = 1,sticky=W) 1361 | 1362 | self.obs = Label(self.cad_tipospgto, text='OBSERVAÇÕES (MAXIMO 60 CARACTERES)',font=('Arial',12, 'bold'),bg='lightskyblue') 1363 | self.obs.place(x = 20, y =150) 1364 | 1365 | self.obspgto = Text(self.cad_tipospgto, height=5) 1366 | self.obspgto.place(x = 5,y = 180) 1367 | self.obspgto.get(1.0,END) 1368 | 1369 | self.grav_fatura = Button(self.cad_tipospgto, text ='GRAVAR ',pady=2,bg ='black', padx=1,bd=2, width = 25, height = 2, 1370 | font = ('Arial', 12,'bold'), fg ='blue',command = self.grava_tipopgto) 1371 | self.grav_fatura.place(x = 20, y = 280) 1372 | 1373 | 1374 | self.cad_tipospgto.geometry('655x400') 1375 | self.cad_tipospgto.title('CADASTRO TIPOS DE PAGAMENTOS') 1376 | self.cad_tipospgto.transient(self.master) 1377 | self.cad_tipospgto.focus_force() 1378 | self.cad_tipospgto.grab_set() 1379 | 1380 | def grava_tipopgto(self): 1381 | cnx = connect() 1382 | cursor = cnx.cursor() 1383 | desctipo = self.editdesc_pgto.get().upper() 1384 | if self.editdesc_pgto.get() == '': 1385 | messagebox.showwarning("Erro", "DIGITE A DESCRICAO") 1386 | else: 1387 | obs_pgto = self.obspgto.get(1.0, END).upper() 1388 | 1389 | #data = time.strftime('%d/%m/%y %H:%M:%S') 1390 | 1391 | cursor.execute("INSERT INTO TIPO_PAGTO (DESC_PGTO,OBS)\ 1392 | VALUES ('"+desctipo+"','"+obs_pgto+"')") 1393 | 1394 | try: 1395 | cnx.commit() 1396 | #print("Dados gravados com sucesso") 1397 | messagebox.showinfo("SUCESSO","Dados gravados com sucesso!:)") 1398 | self.limpa_tipopgto() 1399 | 1400 | except mysql.connector.Error as err: 1401 | #print("Não conseguiu gravar no banco de dados.:",err) 1402 | messagebox.showrror("Erro ao gravar os dados",err) 1403 | 1404 | cnx.close() 1405 | 1406 | def limpa_tipopgto(self): 1407 | self.editdesc_pgto.delete(0,END) 1408 | self.obspgto.delete(1.0,END) 1409 | 1410 | 1411 | # listar todos os tipos de pagamentos 1412 | def list_tipos_pgto(self): 1413 | cnx = connect() 1414 | cursor = cnx.cursor() 1415 | cursor.execute("SELECT * FROM TIPO_PAGTO") 1416 | rows=cursor.fetchall() 1417 | for row in rows: 1418 | #print(row) 1419 | self.tree8.insert("",END, values = row) 1420 | cnx.close() 1421 | 1422 | 1423 | def lista_tipos_pgto(self):#Traz todos os tipos cadastrados 1424 | #self.limpaCampos() 1425 | self.consulta6 = Toplevel() 1426 | self.tree8 = ttk.Treeview(self.consulta6,column=("column", "column1","column2","column3"))#,"column4","column5","column6", 1427 | #"column7","column8","column9","column10","column11")) 1428 | 1429 | self.tree8.column("#0",minwidth=0,width=10) 1430 | self.tree8.heading("#1", text="ID") 1431 | self.tree8.column("#1", minwidth=0,width=30) 1432 | self.tree8.heading("#2", text="DESCRICAO") 1433 | self.tree8.column("#2", minwidth=0,width=260) 1434 | self.tree8.heading("#3", text="OBS") 1435 | self.tree8.column("#3", minwidth=0,width=200) 1436 | self.tree8.column("#4",minwidth=0,width=10) 1437 | 1438 | self.tree8.configure(height=20) 1439 | self.tree8.grid() 1440 | self.list_tipos_pgto() 1441 | 1442 | self.consulta6.geometry('550x400') 1443 | self.consulta6.title('LISTA TODAS AS FORMAS DE PAGAMENTO CADASTRADAS') 1444 | self.consulta6.transient(self.master) 1445 | self.consulta6.focus_force() 1446 | self.consulta6.grab_set() 1447 | 1448 | 1449 | # Planilhas 1450 | 1451 | def gera_planilha(self): 1452 | workbook = xlwt.Workbook() 1453 | worksheet = workbook.add_sheet('Contas') 1454 | cnx = connect() 1455 | cursor = cnx.cursor() 1456 | 1457 | cursor.execute("SELECT C.IDCONTA,C.ID_CAT, F.DESC_CAT, C.VALOR,C.DATA_COMPRA,DATA_VENCIMENTO,C.PAGO,C.DATA_PGTO,C.TIPO_PGTO,C.OBS FROM CONTAS_PAGAR \ 1458 | AS C INNER JOIN CATEGORIAS AS F ON C.ID_CAT=F.ID_CAT AND MONTH(C.DATA_VENCIMENTO) = MONTH(NOW()) ORDER BY C.IDCONTA") 1459 | rows=cursor.fetchall() 1460 | 1461 | 1462 | worksheet.write(0,0,'IDCONTA') 1463 | worksheet.write(0,1,'ID_CAT') 1464 | worksheet.write(0,2,'DESC.CAT') 1465 | worksheet.write(0,3,'VALOR') 1466 | worksheet.write(0,4,'DATA COMPRA') 1467 | worksheet.write(0,5,'VENCIMENTO') 1468 | worksheet.write(0,6,'PAGO') 1469 | worksheet.write(0,7,'DAT PGTO') 1470 | worksheet.write(0,8,'TIPO PGTO') 1471 | worksheet.write(0,9,'OBSERVAÇÕES') 1472 | 1473 | 1474 | for i, conta in enumerate(rows): 1475 | worksheet.write(i + 1, 0, conta[0]) 1476 | worksheet.write(i + 1, 1, conta[1]) 1477 | worksheet.write(i + 1, 2, conta[2]) 1478 | worksheet.write(i + 1, 3, conta[3], style = xlwt.easyxf(num_format_str='R$#,##0.00')) 1479 | worksheet.write(i + 1, 4, conta[4], 1480 | style = xlwt.easyxf(num_format_str='dd/mm/yyyy')) 1481 | worksheet.write(i + 1, 5, conta[5], 1482 | style = xlwt.easyxf(num_format_str='dd/mm/yyyy')) 1483 | worksheet.write(i + 1, 6, conta[6]) 1484 | worksheet.write(i + 1, 7, conta[7], 1485 | style = xlwt.easyxf(num_format_str='dd/mm/yyyy')) 1486 | worksheet.write(i + 1, 8, conta[8]) 1487 | worksheet.write(i + 1, 9, conta[9], 1488 | style = xlwt.easyxf(num_format_str='@')) 1489 | 1490 | workbook.save('/home/julio/Python_Des/FINANCAS/Contas.xls') 1491 | messagebox.showinfo("SUCESSO","Planilha criada em: /home/julio/Python_Des/FINANCAS/Contas.xls)") 1492 | cnx.close() 1493 | 1494 | 1495 | # =============================================================================================================# 1496 | # LISTA PERSONALIZADA selecionar todas as contas por fornecedor # 1497 | # =============================================================================================================# 1498 | 1499 | def lista_Personalizada_Cat(self):#Busca por data 1500 | self.lista_perso_Cat = Toplevel() 1501 | self.right1 = Frame(self.lista_perso_Cat, width=700,height=80)#, bg='white') 1502 | self.right1.pack(side=TOP) 1503 | 1504 | self.left1 = Frame(self.lista_perso_Cat, width=700,height=690)#, bg='white') 1505 | self.left1.pack(side=TOP) 1506 | 1507 | self.buscadata_forn = Label(self.lista_perso_Cat, font =('Arial',10,'bold'), 1508 | text='BUSCA ENTRE DATAS:') 1509 | self.buscadata_forn.place(x = 0 , y= 0) 1510 | self.dataini_forn = Label(self.lista_perso_Cat, text = 'DATA INICIAL') 1511 | self.dataini_forn.place(x = 0 , y= 20) 1512 | self.editdataini_forn = Entry(self.lista_perso_Cat,width =20, bg = '#CCFFCC', bd = 4) 1513 | self.editdataini_forn.place(x = 0 , y= 40) 1514 | self.editdataini_forn.focus() 1515 | self.datafin_forn = Label(self.lista_perso_Cat, text = 'DATA FINAL') 1516 | self.datafin_forn.place(x = 200 , y= 20) 1517 | self.editdatafin_forn = Entry(self.lista_perso_Cat,width =20, bg = '#CCFFCC', bd = 4) 1518 | self.editdatafin_forn.place(x = 200 , y= 40) 1519 | self.categoria_conta = Label(self.lista_perso_Cat, text = 'CATEGORIA') 1520 | self.categoria_conta.place(x = 400 , y= 20) 1521 | self.editcategoria_conta = Entry(self.lista_perso_Cat,width =20, bg = '#CCFFCC', bd = 4) 1522 | self.editcategoria_conta.place(x = 400 , y= 40) 1523 | self.busca_perso_forn = Button(self.lista_perso_Cat, text ='BUSCAR ',pady=1,bg ='yellow', padx=1,bd=2, width = 15, height = 1, 1524 | font = ('Arial', 10,'bold'), fg ='blue') 1525 | self.busca_perso_forn.place(x = 600 , y= 40) 1526 | self.busca_perso_forn.bind("", self.View_Lista_perso_Cat) 1527 | 1528 | 1529 | # ================================================================================================================================= 1530 | # BOTÕES = 1531 | # ================================================================================================================================= 1532 | 1533 | self.limpa_perso_forn = Button(self.lista_perso_Cat, text ='LIMPAR ',pady=1,bg ='yellow', padx=1,bd=2, width = 15, height = 1, 1534 | font = ('Arial', 10,'bold'), fg ='blue', command = self.delete_view_labels) 1535 | self.limpa_perso_forn.place(x = 750 , y= 40) 1536 | 1537 | sair_buscaPerso_forn = Button(self.lista_perso_Cat, text ='SAIR',pady=1, bg ='red', padx = 1,bd = 2, width = 15, height = 1, 1538 | font = ('Arial', 10,'bold'), fg ='blue', command=self.lista_perso_Cat.destroy) 1539 | sair_buscaPerso_forn.place(x = 900 , y= 40) 1540 | 1541 | self.total_categ = Label(self.lista_perso_Cat, text=' Total R$ ',font='arial 17 bold ',width=15) 1542 | self.total_categ.place(x=800, y=600) 1543 | self.total_categoria = Entry(self.lista_perso_Cat,width=10,font='arial 17 bold', fg='red') 1544 | self.total_categoria.place(x=960, y=600) 1545 | 1546 | 1547 | self.tree9= ttk.Treeview(self.left1,column=("column", "column1","column2","column3","column4","column5","column6", 1548 | "column7","column8","column9")) 1549 | 1550 | self.tree9.column("#0",minwidth=0,width=10) 1551 | self.tree9.heading("#1", text="IDCONTA") 1552 | self.tree9.column("#1", minwidth=0,width=80) 1553 | self.tree9.heading("#2", text="ID_CAT") 1554 | self.tree9.column("#2", minwidth=0,width=80) 1555 | self.tree9.heading("#3", text="DESCRICAO") 1556 | self.tree9.column("#3", minwidth=0,width=250) 1557 | self.tree9.heading("#4", text="VALOR") 1558 | self.tree9.column("#4", minwidth=0,width=80) 1559 | self.tree9.heading("#5", text="DATA_COMPRA") 1560 | self.tree9.column("#5", minwidth=0,width=110) 1561 | self.tree9.heading("#6", text="VENCIMENTO") 1562 | self.tree9.column("#6", minwidth=0,width=110) 1563 | self.tree9.heading("#7", text="PAGO") 1564 | self.tree9.column("#7", minwidth=0,width=70) 1565 | self.tree9.heading("#8", text="TIPO PAGTO") 1566 | self.tree9.column("#8", minwidth=0,width=200) 1567 | self.tree9.heading("#9", text="OBSERVACAO") 1568 | self.tree9.column("#9", minwidth=0,width=250) 1569 | self.tree9.column("#10", minwidth=0,width=0) 1570 | 1571 | self.tree9.configure(height=20) 1572 | self.tree9.pack() 1573 | 1574 | self.lista_perso_Cat.geometry('1250x700') 1575 | self.lista_perso_Cat.title('Listar Todas as contas por Categorias6') 1576 | self.lista_perso_Cat.transient(self.master) 1577 | self.lista_perso_Cat.focus_force() 1578 | self.lista_perso_Cat.grab_set() 1579 | 1580 | 1581 | def View_Lista_perso_Cat(self,event):#Query que traz do banco todas as Os de pagamentos entre as datas solicitadas por fornecedor(Razao) 1582 | self.tree9.delete(*self.tree9.get_children()) 1583 | cnx = connect() 1584 | cursor = cnx.cursor() 1585 | 1586 | cursor.execute("SELECT C.IDCONTA, C.ID_CAT,F.DESC_CAT, C.VALOR,C.DATA_COMPRA, C.DATA_VENCIMENTO,C.PAGO,C.TIPO_PGTO, C.OBS FROM CONTAS_PAGAR AS C INNER JOIN \ 1587 | CATEGORIAS AS F ON C.ID_CAT = F.ID_CAT AND DATA_VENCIMENTO BETWEEN '"+self.editdataini_forn.get()+"' \ 1588 | AND '"+self.editdatafin_forn.get()+"' WHERE F.DESC_CAT LIKE '%"+ self.editcategoria_conta.get()+"%' ") 1589 | 1590 | rows=cursor.fetchall() 1591 | for row in rows: 1592 | #print(row) 1593 | self.tree9.insert("",END, values = row) 1594 | 1595 | cnx.close() 1596 | self.soma_total_cat() 1597 | 1598 | def soma_total_cat(self): 1599 | self.total_categoria.delete(0, END) 1600 | cnx = connect() 1601 | cursor = cnx.cursor() 1602 | 1603 | cursor.execute("SELECT SUM(C.VALOR) FROM CONTAS_PAGAR AS C INNER JOIN CATEGORIAS AS F ON C.ID_CAT = F.ID_CAT AND DATA_VENCIMENTO BETWEEN '"+self.editdataini_forn.get()+"' \ 1604 | AND '"+self.editdatafin_forn.get()+"' WHERE F.DESC_CAT LIKE '%"+ self.editcategoria_conta.get()+"%' ") 1605 | 1606 | row=cursor.fetchone() 1607 | if row: 1608 | self.total_categoria.insert(0,float(row[0])) 1609 | cnx.close() 1610 | 1611 | 1612 | def delete_view_labels(self): 1613 | self.editdataini_forn.delete(0, END) 1614 | self.editdatafin_forn.delete(0, END) 1615 | self.editcategoria_conta.delete(0, END) 1616 | self.total_categoria.delete(0, END) 1617 | self.tree9.delete(*self.tree9.get_children()) 1618 | 1619 | 1620 | # =============================================================================================================# 1621 | # LISTA PERSONALIZADA (PAGAMENTOS) # 1622 | # =============================================================================================================# 1623 | 1624 | def lista_Personalizada(self):#Busca por data 1625 | self.lista_perso = Toplevel() 1626 | self.right2 = Frame(self.lista_perso, width=700,height=80)#, bg='white') 1627 | self.right2.pack(side=TOP) 1628 | 1629 | self.left2 = Frame(self.lista_perso, width=700,height=690)#, bg='white') 1630 | self.left2.pack(side=TOP) 1631 | 1632 | self.buscadata = Label(self.lista_perso, font =('Arial',10,'bold'), 1633 | text='BUSCA ENTRE DATAS:') 1634 | self.buscadata.place(x = 0, y = 0) 1635 | self.dataini = Label(self.lista_perso, text = 'Data Inicial') 1636 | self.dataini.place(x = 0, y = 20) 1637 | self.editdataini = Entry(self.lista_perso,width =20, bg = '#CCFFCC', bd = 4) 1638 | self.editdataini.place(x = 0, y = 40) 1639 | self.editdataini.focus() 1640 | self.datafin = Label(self.lista_perso, text = 'Data Final') 1641 | self.datafin.place(x = 200, y = 20) 1642 | self.editdatafin = Entry(self.lista_perso,width =20, bg = '#CCFFCC', bd = 4) 1643 | self.editdatafin.place(x = 200, y = 40) 1644 | 1645 | 1646 | 1647 | self.ofi_desc = Label(self.lista_perso, text = 'STATUS') 1648 | self.ofi_desc.place(x = 400, y = 20) 1649 | self.combo2 = ttk.Combobox(self.lista_perso, height= 4,width = 15) 1650 | self.combo2['values']=('SIM','NAO') 1651 | self.combo2.current(1) 1652 | self.combo2.place(x = 400, y = 40) 1653 | self.form_pgto = Label(self.lista_perso, text = 'FORMA PGTO') 1654 | self.form_pgto.place(x=600, y = 20) 1655 | self.combo3 = ttk.Combobox(self.lista_perso, height= 4,width = 30) 1656 | self.combo3['values']= self.list_pgto() 1657 | 1658 | self.combo3.current(0) 1659 | self.combo3.place(x = 600, y = 40) 1660 | self.total_lista_personalizada = Label(self.lista_perso, text = 'TOTAL R$ ', font='arial 18 bold') 1661 | self.total_lista_personalizada.place(x = 800, y= 600) 1662 | self.total_lista_personalizada = Entry(self.lista_perso,width =10, bg = '#CCFFCC', bd = 2,fg='red',font='arial 16 bold') 1663 | self.total_lista_personalizada.place(x = 940, y = 600) 1664 | 1665 | 1666 | # ================================================================================================================================= 1667 | # BOTÕES = 1668 | # ================================================================================================================================= 1669 | 1670 | self.busca_perso = Button(self.lista_perso, text ='BUSCAR ',pady=1,bg ='black', padx=1,bd=2, width = 15, height = 1, 1671 | font = ('Arial', 12,'bold'), fg ='blue', command = self.View_Lista_perso) 1672 | self.busca_perso.place(x = 880, y = 40) 1673 | 1674 | sair_buscaPerso = Button(self.lista_perso, text ='SAIR',pady=1, bg ='red', padx = 1,bd = 2, width = 15, height = 1, 1675 | font = ('Arial', 12,'bold'), fg ='yellow', command=self.lista_perso.destroy) 1676 | sair_buscaPerso.place(x = 1040, y = 40) 1677 | 1678 | self.treepgto= ttk.Treeview(self.left2,column=("column", "column1","column2","column3","column4","column5","column6", 1679 | "column7","column8","column9")) 1680 | 1681 | self.treepgto.column("#0",minwidth=0,width=10) 1682 | self.treepgto.heading("#1", text="IDCONTA") 1683 | self.treepgto.column("#1", minwidth=0,width=80) 1684 | self.treepgto.heading("#2", text="ID_CAT") 1685 | self.treepgto.column("#2", minwidth=0,width=80) 1686 | self.treepgto.heading("#3", text="DESCRICAO") 1687 | self.treepgto.column("#3", minwidth=0,width=250) 1688 | self.treepgto.heading("#4", text="VALOR") 1689 | self.treepgto.column("#4", minwidth=0,width=80) 1690 | self.treepgto.heading("#5", text="DATA_COMPRA") 1691 | self.treepgto.column("#5", minwidth=0,width=110) 1692 | self.treepgto.heading("#6", text="VENCIMENTO") 1693 | self.treepgto.column("#6", minwidth=0,width=110) 1694 | self.treepgto.heading("#7", text="PAGO") 1695 | self.treepgto.column("#7", minwidth=0,width=70) 1696 | self.treepgto.heading("#8", text="TIPO PAGTO") 1697 | self.treepgto.column("#8", minwidth=0,width=200) 1698 | self.treepgto.heading("#9", text="OBSERVACAO") 1699 | self.treepgto.column("#9", minwidth=0,width=250) 1700 | self.treepgto.column("#10", minwidth=0,width=0) 1701 | 1702 | 1703 | self.treepgto.configure(height=20) 1704 | self.treepgto.pack() 1705 | 1706 | self.lista_perso.geometry('1300x800') 1707 | self.lista_perso.title('BUSCA PERSONALIZADA') 1708 | self.lista_perso.transient(self.master) 1709 | self.lista_perso.focus_force() 1710 | self.lista_perso.grab_set() 1711 | 1712 | 1713 | def View_Lista_perso(self):#Query que traz do banco todas as Os de pagamentos entre as datas solicitadas 1714 | self.treepgto.delete(*self.treepgto.get_children()) 1715 | cnx = connect() 1716 | cursor = cnx.cursor() 1717 | 1718 | cursor.execute("SELECT C.IDCONTA, C.ID_CAT,F.DESC_CAT, C.VALOR,C.DATA_COMPRA, C.DATA_VENCIMENTO,C.PAGO,C.TIPO_PGTO, C.OBS FROM CONTAS_PAGAR AS C INNER JOIN \ 1719 | CATEGORIAS AS F ON DATA_VENCIMENTO \ 1720 | BETWEEN '"+self.editdataini.get()+"' AND '"+self.editdatafin.get()+"' AND \ 1721 | C.PAGO = '"+(self.combo2.get())+"' AND C.TIPO_PGTO = '"+self.combo3.get()+"' AND C.ID_CAT = F.ID_CAT ORDER BY C.DATA_VENCIMENTO") 1722 | 1723 | rows=cursor.fetchall() 1724 | for row in rows: 1725 | #print(row) 1726 | self.treepgto.insert("",END, values = row) 1727 | cnx.close() 1728 | self.total_Lista_perso() 1729 | 1730 | 1731 | def total_Lista_perso(self): 1732 | self.total_lista_personalizada.delete(0, END) 1733 | cnx = connect() 1734 | cursor = cnx.cursor() 1735 | 1736 | cursor.execute("SELECT SUM(C.VALOR) AS TOTAL FROM CONTAS_PAGAR AS C INNER JOIN CATEGORIAS AS F ON DATA_VENCIMENTO \ 1737 | BETWEEN '"+self.editdataini.get()+"' AND '"+self.editdatafin.get()+"' AND \ 1738 | C.PAGO = '"+(self.combo2.get())+"' AND C.TIPO_PGTO = '"+self.combo3.get()+"' AND C.ID_CAT = F.ID_CAT") 1739 | row=cursor.fetchone() 1740 | 1741 | if row: 1742 | self.total_lista_personalizada.insert(0,float(row[0])) 1743 | cnx.close() 1744 | 1745 | def add_entradas(self): 1746 | self.entradas = Toplevel() 1747 | self.frame_entradas = Frame(self.entradas, width=700,height=600)#, bg='white') 1748 | self.frame_entradas.pack(side=TOP) 1749 | self.id_entrada = Label(self.entradas, text='COD. ENTRADA ',font =('Arial',14,'bold')) 1750 | self.id_entrada.place(x = 0, y =20) 1751 | self.id_entradae = Entry(self.entradas, width =10) 1752 | self.id_entradae.place(x = 145, y = 20) 1753 | self.fonte_entrada = Label(self.entradas, text='FONTE PAGTO', font =('Arial',14,'bold'))#, fg='blue') 1754 | self.fonte_entrada.place(x = 0, y = 50) 1755 | self.fonte_entradae = Entry(self.entradas,width = 25) 1756 | self.fonte_entradae.place(x = 145, y = 50) 1757 | self.valor_entrada = Label(self.entradas, text='VALOR PAGTO R$', font =('Arial',14,'bold')) 1758 | self.valor_entrada.place(x = 400, y = 50) 1759 | self.valor_entradae = Entry(self.entradas, width = 25, fg ='green') 1760 | self.valor_entradae.place(x = 570, y = 50) 1761 | self.data_pagto = Label(self.entradas, text='DATA PAGTO', font =('Arial',14,'bold')) 1762 | self.data_pagto.place(x = 0, y = 80) 1763 | self.data_pagtoe = Entry(self.entradas, width = 25) 1764 | self.data_pagtoe.place(x = 145, y = 80) 1765 | self.obs_ent = Label(self.entradas, text='OBSERVAÇÕES', font =('Arial',14,'bold')) 1766 | self.obs_ent.place(x = 400, y = 80) 1767 | self.obs_ent_e = Entry(self.entradas, width = 25) 1768 | self.obs_ent_e.place(x = 570, y = 80) 1769 | 1770 | self.grav_entradas = Button(self.entradas, text ='GRAVAR ',pady=1,bg ='black', padx=1,bd=1, width = 20, height = 2, 1771 | font = ('Arial', 12,'bold'), fg ='blue',command = self.gravaEntrada) 1772 | self.grav_entradas.place(x = 0 , y = 250) 1773 | 1774 | self.limpa_entradas = Button(self.entradas, text ='LIMPAR ',pady=1,bg ='black', padx=1,bd=1, width = 20, height = 2, 1775 | font = ('Arial', 12,'bold'), fg ='green',command = self.limpa_entrada) 1776 | self.limpa_entradas.place(x = 200, y = 250) 1777 | 1778 | self.sair_entradas = Button(self.entradas, text ='SAIR ',pady=1,bg ='black', padx=1,bd=1, width = 20, height = 2, 1779 | font = ('Arial', 12,'bold'), fg ='red',command = self.entradas.destroy) 1780 | self.sair_entradas.place(x = 0, y = 300) 1781 | 1782 | self.entradas.geometry("800x480+200+200") 1783 | self.entradas.title("CADASTRO ENTRADAS CRÉDITOS") 1784 | ## self.entradas.configure(background='light blue') 1785 | self.entradas.transient(self.master) 1786 | self.entradas.grab_set() 1787 | 1788 | 1789 | def gravaEntrada(self): 1790 | cnx = connect() 1791 | cursor = cnx.cursor() 1792 | 1793 | fonte_pgto = self.fonte_entradae.get().upper() 1794 | if self.fonte_entradae.get() == '': 1795 | messagebox.showwarning("Erro", "DIGITE A FONTE") 1796 | else: 1797 | valor = self.valor_entradae.get() 1798 | if self.valor_entradae.get() == '': 1799 | messagebox.showwarning("Erro", "VALOR NÃO PODE SER VAZIO") 1800 | else: 1801 | data_entrada = self.data_pagtoe.get() 1802 | if self.data_pagtoe.get() =='': 1803 | messagebox.showwarning("Erro", "DATA NÃO PODE SER VAZIO") 1804 | else: 1805 | obs = self.obs_ent_e.get().upper() 1806 | 1807 | cursor.execute("INSERT INTO ENTRADAS (FONTE_PGTO,VALOR,DATA_PGTO,OBSERVACOES)\ 1808 | VALUES ('"+fonte_pgto+"','"+valor+"','"+data_entrada+"','"+obs+"')") 1809 | 1810 | try: 1811 | cnx.commit() 1812 | #print("Dados gravados com sucesso") 1813 | messagebox.showinfo("SUCESSO","Dados gravados com sucesso!:)") 1814 | self.limpa_entrada() 1815 | 1816 | 1817 | 1818 | except mysql.connector.Error as err: 1819 | #print("Não conseguiu gravar no banco de dados.:",err) 1820 | messagebox.showrror("Erro ao gravar os dados") 1821 | 1822 | cnx.close() 1823 | 1824 | 1825 | 1826 | def limpa_entrada(self): 1827 | self.id_entradae.delete(0, END) 1828 | self.fonte_entradae.delete(0, END) 1829 | self.valor_entradae.delete(0, END) 1830 | self.data_pagtoe.delete(0, END) 1831 | self.obs_ent_e.delete(0, END) 1832 | 1833 | -------------------------------------------------------------------------------- /jsfinance/db.py: -------------------------------------------------------------------------------- 1 | from mysql.connector import connect as mysql_connect 2 | from mysql.connector import Error as MysqlError 3 | from decouple import config 4 | from urllib.parse import urlparse 5 | 6 | 7 | def dburl(url): 8 | u = urlparse(url) 9 | return dict( 10 | user=u.username, 11 | password=(u.password or ''), 12 | host=u.hostname, 13 | port=str(u.port), 14 | database=u.path[1:], 15 | auth_plugin='mysql_native_password' 16 | ) 17 | 18 | 19 | def connect(): 20 | return ConnectionAdapter(mysql_connect(**config('DATABASE_URL', cast=dburl))) 21 | 22 | 23 | class ConnectionAdapter: 24 | def __init__(self, cnx): 25 | self._cnx = cnx 26 | 27 | def __enter__(self): 28 | return self 29 | 30 | def __exit__(self, exc_type, exc_val, exc_tb): 31 | if exc_type is MysqlError: 32 | self._cnx.rollback() 33 | else: 34 | self._cnx.commit() 35 | 36 | self._cnx.close() 37 | 38 | def __getattr__(self, name): 39 | return getattr(self._cnx, name) 40 | 41 | 42 | class DoesNotExist(Exception): 43 | pass 44 | 45 | 46 | def category_get(id): 47 | with connect() as cnx: 48 | cursor = cnx.cursor() 49 | 50 | cursor.execute(f"SELECT * FROM CATEGORIAS WHERE ID_CAT = {id}") 51 | 52 | row = cursor.fetchone() 53 | 54 | if not row: 55 | raise DoesNotExist('Categoria não existe.') 56 | 57 | return row 58 | 59 | def category_save(idcat, descricao, obs): 60 | if idcat is None: 61 | category_insert(descricao, obs) 62 | else: 63 | category_update(idcat, descricao, obs) 64 | 65 | 66 | def category_update(idcat, descricao, obs): 67 | with connect() as cnx: 68 | cursor = cnx.cursor() 69 | sql = f"UPDATE CATEGORIAS SET DESC_CAT = '{descricao}', OBS_CAT = '{obs}' WHERE ID_CAT = {idcat}" 70 | 71 | cursor.execute(sql) 72 | 73 | 74 | def category_insert(descricao, obs): 75 | with connect() as cnx: 76 | # retornar o id criado. 77 | cursor = cnx.cursor() 78 | cursor.execute(f"INSERT INTO CATEGORIAS (DESC_CAT, OBS_CAT) " 79 | f"VALUES ('{descricao}', '{obs}')") 80 | 81 | -------------------------------------------------------------------------------- /jsfinance/tktools/__init__.py: -------------------------------------------------------------------------------- 1 | import tkinter as tk 2 | from tkinter import ttk 3 | from .widgets import FilledButton, StackedFrame 4 | 5 | class SmartEntry(ttk.Entry): 6 | def __init__(self, master=None, **kw): 7 | super().__init__(master=master, **kw) 8 | 9 | @property 10 | def content(self): 11 | return self.get() 12 | 13 | @content.setter 14 | def content(self, value): 15 | self.delete(0, tk.END) 16 | self.insert(0, value) 17 | 18 | 19 | class IdVar(tk.IntVar): 20 | def get(self): 21 | try: 22 | value = super().get() 23 | if isinstance(value, int) and value == 0: 24 | value = None 25 | except tk.TclError: 26 | value = None 27 | 28 | return value 29 | -------------------------------------------------------------------------------- /jsfinance/tktools/widgets.py: -------------------------------------------------------------------------------- 1 | import tkinter as tk 2 | from tkinter import ttk 3 | from tkinter.scrolledtext import ScrolledText 4 | 5 | 6 | class FilledButton(ttk.Button): 7 | def __init__(self, master=None, **kw): 8 | 9 | #self.apply_default_styles(kw) 10 | super().__init__(master=master, **kw) 11 | 12 | def pack(self, **kwargs): 13 | kwargs['fill'] = 'x' 14 | return super().pack(**kwargs) 15 | 16 | # class DebugWindow: 17 | # def __init__(self): 18 | # self.t = ScrolledText(self.frame2) 19 | # self.t.pack(side=BOTTOM, fill=BOTH, expand=True) 20 | # 21 | # def gambi(): 22 | # exec(self.t.get(1.0, END)) 23 | # 24 | # self.b = FilledButton(self.frame2, text='Run', command=gambi) 25 | # self.b.pack(side=BOTTOM) 26 | 27 | class StackedFrame(ttk.Frame): 28 | def __init__(self, *args, **kwargs): 29 | super().__init__(*args, **kwargs) 30 | self.top_margin = None 31 | 32 | def _add_expander(self): 33 | return ttk.Frame(self).pack(fill=tk.BOTH, expand=True) 34 | 35 | def add_widget(self, cls, *args, **kwargs): 36 | if not self.top_margin: 37 | self.top_margin = self._add_expander() 38 | 39 | widget = cls(*args, **kwargs) 40 | widget.pack() 41 | 42 | self._add_expander() 43 | 44 | return widget 45 | -------------------------------------------------------------------------------- /jsfinance/ui_categoria.py: -------------------------------------------------------------------------------- 1 | import tkinter as tk 2 | from tkinter import ttk 3 | from tkinter import messagebox 4 | from jsfinance.db import connect, category_get, category_save, DoesNotExist 5 | from mysql.connector import errorcode, Error as MysqlError 6 | 7 | from jsfinance.tktools import IdVar, SmartEntry 8 | 9 | """ 10 | TODO: 11 | 4. Unificar a lógica de insert/update. 12 | """ 13 | 14 | class CategoryDialog(tk.Toplevel): 15 | def __init__(self, *args, **kwargs): 16 | super().__init__(*args, **kwargs) 17 | 18 | self.id = IdVar(value="") 19 | self.descricao = tk.StringVar() 20 | self.obs = tk.StringVar() 21 | 22 | self.create_widgets() 23 | 24 | def create_widgets(self): 25 | self.lb_idcat = ttk.Label(self, text="ID ") 26 | self.lb_idcat.grid(row=0, column=0) 27 | self.tb_idcat = SmartEntry(self, width=10, textvariable=self.id) 28 | self.tb_idcat.grid(row=0, column=1, sticky=tk.W) 29 | self.bt_buscar = ttk.Button(self, text="BUSCAR CATEG.", command=self.select) 30 | self.bt_buscar.grid(row=0, column=2) 31 | self.bt_buscar.bind("", self.select) 32 | self.lb_desc = ttk.Label(self, text="DESCRICAO") 33 | self.lb_desc.grid(row=1, column=0) 34 | self.tb_desc = SmartEntry(self, width=20, textvariable=self.descricao) 35 | self.tb_desc.grid(row=1, column=1, sticky=tk.W) 36 | self.tb_desc.focus() 37 | self.lb_obs = ttk.Label(self, text='OBSERVAÇÕES') 38 | self.lb_obs.grid(row=2, column=1) 39 | self.tb_obs = SmartEntry(self, width=30, textvariable=self.obs) 40 | self.tb_obs.grid(row=3, column=1) 41 | 42 | # =========================================================================================================================================== 43 | # BOTÕES = 44 | # =========================================================================================================================================== 45 | 46 | self.bt_insert = ttk.Button(self, text='GRAVAR ', command=self.save) 47 | self.bt_insert.grid(row=7, column=0) 48 | 49 | self.bt_clear = ttk.Button(self, text='LIMPAR ', command=self.clear) 50 | self.bt_clear.grid(row=7, column=1) 51 | 52 | self.bt_list = ttk.Button(self, text='TODAS CATEGORIAS', command=lambda: CategoryList(self)) 53 | self.bt_list.grid(row=8, column=0) 54 | 55 | self.bt_exit = ttk.Button(self, text='SAIR ', command=self.destroy) 56 | self.bt_exit.grid(row=8, column=1) 57 | 58 | self.title('CADASTRO DE CATEGORIAS') 59 | self.transient(self.master) 60 | self.focus_force() 61 | self.grab_set() 62 | 63 | def save(self): 64 | idcat = self.id.get() 65 | descricao = self.descricao.get().upper() 66 | obs = self.obs.get().upper() 67 | 68 | if not descricao: 69 | messagebox.showwarning("Erro", "DIGITE A DESCRICAO", parent=self) 70 | return 71 | 72 | try: 73 | category_save(idcat, descricao, obs) 74 | except MysqlError as e: 75 | messagebox.showerror("Erro ao gravar os dados", e) 76 | 77 | messagebox.showinfo("SUCESSO", "Dados gravados com sucesso!:)") 78 | 79 | def select(self, event=None): 80 | idcat = self.id.get() 81 | 82 | try: 83 | _, self.tb_desc.content, self.tb_obs.content = category_get(idcat) 84 | except DoesNotExist as e: 85 | messagebox.showerror(e.message) 86 | 87 | def clear(self): 88 | self.id.set("") 89 | self.descricao.set("") 90 | self.obs.set("") 91 | 92 | 93 | class CategoryList(tk.Toplevel): 94 | def __init__(self, *args, **kwargs): 95 | super().__init__(*args, **kwargs) 96 | 97 | self.create_widgets() 98 | 99 | def create_widgets(self): 100 | self.tree2 = ttk.Treeview(self, column=("column", "column1", "column2", 101 | "column3")) 102 | self.tree2.column("#0", minwidth=0, width=0) 103 | self.tree2.heading("#1", text="IDCAT") 104 | self.tree2.column("#1", minwidth=0, width=78) 105 | self.tree2.heading("#2", text="DESCRICAO") 106 | self.tree2.column("#2", minwidth=0, width=280) 107 | self.tree2.heading("#3", text="OBSERVAÇÕES") 108 | self.tree2.column("#3", minwidth=0, width=480) 109 | self.tree2.column("#4", minwidth=0, width=10) 110 | 111 | self.tree2.configure(height=18) 112 | self.tree2.grid() 113 | self.View_Cat() 114 | 115 | self.geometry('860x400+50+50') 116 | self.title('CONSULTA CATEGORIAS') 117 | self.transient(self.master) 118 | self.focus_force() 119 | self.grab_set() 120 | 121 | def View_Cat(self):# categorias 122 | cnx = connect() 123 | cursor = cnx.cursor() 124 | cursor.execute("SELECT * FROM CATEGORIAS ORDER BY ID_CAT ") 125 | rows=cursor.fetchall() 126 | for row in rows: 127 | '''print(row)''' 128 | self.tree2.insert("",tk.END, values = row) 129 | cnx.close() 130 | -------------------------------------------------------------------------------- /jsfinance/ui_main.py: -------------------------------------------------------------------------------- 1 | import tkinter as tk 2 | from tkinter import ttk 3 | from jsfinance.tktools import FilledButton, StackedFrame 4 | from jsfinance.ui_categoria import CategoryDialog 5 | from pathlib import Path 6 | 7 | ASSET_DIR = Path(__file__).parent / Path('assets') 8 | 9 | def fake_command(*args): 10 | print(args) 11 | 12 | 13 | class Sistema(ttk.Frame): 14 | def __init__(self, *args, **kwargs): 15 | ttk.Frame.__init__(self, *args, **kwargs) 16 | 17 | self.create_menu(self.master) 18 | self.create_widgets() 19 | 20 | def create_menu(self, master): 21 | menus = ( 22 | 'CADASTRAR', 23 | ( 24 | ("Categorias", lambda: CategoryDialog(master=self)), 25 | ("Lançamentos", fake_command), 26 | ("Faturas Cartôes", fake_command), 27 | ("Tipos Pagamentos", fake_command), 28 | ("Sair", master.destroy), 29 | ), 30 | 'CONSULTAR', 31 | ( 32 | ("Todas as Contas", fake_command), 33 | ("Faturas Cartões", fake_command), 34 | ("Todas as Categorias", fake_command), 35 | ("Contas/Filtro", fake_command), 36 | ("Categorias/Fitro", fake_command), 37 | ("Tipos/Pagamentos", fake_command), 38 | ), 39 | 'RELATORIOS', 40 | ( 41 | ("Excel Mês Atual", fake_command), 42 | ), 43 | 'AJUDA', 44 | ( 45 | ("VERSAO 1.1", ''), 46 | ("HELPDESK", fake_command), 47 | ("MANUAL", ''), 48 | ), 49 | ) 50 | 51 | main_menu = tk.Menu(master) 52 | 53 | for name, children in zip(menus[:-1:2], menus[1::2]): 54 | submenu = tk.Menu(main_menu) 55 | for label, command in children: 56 | submenu.add_command(label=label, command=command) 57 | main_menu.add_cascade(label=name, menu=submenu) 58 | 59 | master.config(menu=main_menu) 60 | 61 | def create_widgets(self): 62 | self.pack(fill=tk.BOTH, expand=True) 63 | 64 | self.img_exit = tk.PhotoImage(file=str(ASSET_DIR / 'exit.gif')) 65 | self.img_logo = tk.PhotoImage(file=str(ASSET_DIR / 'logo.gif')) 66 | 67 | self.frm_left = StackedFrame(self) 68 | self.frm_left.pack(side=tk.LEFT, expand=True, fill=tk.BOTH) 69 | 70 | self.btn_contas = self.frm_left.add_widget(FilledButton, self.frm_left, text='LANÇAMENTOS-DÉBITOS', command=fake_command) 71 | self.btn_creditos = self.frm_left.add_widget(FilledButton, self.frm_left, text='LANÇAMENTOS-CRÉDITOS', command=fake_command) 72 | self.btn_sair = self.frm_left.add_widget(ttk.Button, self.frm_left, command=fake_command, image=self.img_exit) 73 | self.texto_logo = self.frm_left.add_widget(ttk.Label, self.frm_left, text='DESENVOLVIDO POR JS INFORMÁTICA ') 74 | self.btn_logo = self.frm_left.add_widget(ttk.Label, self.frm_left, image=self.img_logo) 75 | 76 | self.frm_right = StackedFrame(self) 77 | self.frm_right.pack(side=tk.RIGHT, expand=True, fill=tk.BOTH) 78 | 79 | self.busca_persomes = self.frm_right.add_widget(FilledButton, self.frm_right, text='LISTAR CONTAS MES ATUAL ', 80 | command=fake_command) 81 | self.busca_persomes_paga = self.frm_right.add_widget(FilledButton, self.frm_right, text='CONTAS MES ATUAL PAGAS ', 82 | command=fake_command) 83 | self.busca_persomes_aberto = self.frm_right.add_widget(FilledButton, self.frm_right, text='CONTAS MES ATUAL ABERTO ', 84 | command=fake_command) 85 | self.btn_busca_Totais = self.frm_right.add_widget(FilledButton, self.frm_right, text='TOTAIS POR TIPO DE PGTO', 86 | command=fake_command) 87 | self.btn_busca_conta = self.frm_right.add_widget(FilledButton, self.frm_right, text='LISTAR POR CATEGORIAS', 88 | command=fake_command) 89 | self.btn_busca_todos = self.frm_right.add_widget(FilledButton, self.frm_right, text='CONTAS PERSONALIZ.', 90 | command=fake_command) 91 | 92 | 93 | -------------------------------------------------------------------------------- /requirements.txt: -------------------------------------------------------------------------------- 1 | mysql-client==0.0.1 2 | mysql-connector-python==8.0.17 3 | xlwt==1.3.0 4 | python-decouple==3.1 5 | --------------------------------------------------------------------------------