" <<
+ "background: #fff;color:#000;border:1px solid #2D3037;text-align:center;";
+}
+
+const QStringList GenDoc::m_gen_color(){
+ Views v;
+ const QStringList r = {
+ "#1e7e34", v.m_msg[56], v.m_msg[57],
+ "color:#00b5ad;text-align:center;", "#57B4C0",
+ v.m_msg[58], v.m_msg[59],
+ "color: #2D3037;text-align:center;", "#a71d2a",
+ v.m_msg[60] , v.m_msg[61],
+ "color: #ef325a;text-align:center;"
+ };
+ return r;
+}
diff --git a/gendoc.h b/gendoc.h
new file mode 100644
index 0000000..761d0bc
--- /dev/null
+++ b/gendoc.h
@@ -0,0 +1,22 @@
+#ifndef GENDOC_H
+#define GENDOC_H
+
+#include
+#include "tools.h"
+#include "initial.h"
+#include "views.h"
+
+class GenDoc : public QWidget
+{
+ Q_OBJECT
+public:
+ explicit GenDoc(QWidget *parent = nullptr);
+ const QString m_gen_tags( QStringList );
+ const QStringList m_gen_color();
+ QStringList m_t;
+ void m_set_t();
+signals:
+
+};
+
+#endif // GENDOC_H
diff --git a/initial.cpp b/initial.cpp
new file mode 100644
index 0000000..f628742
--- /dev/null
+++ b/initial.cpp
@@ -0,0 +1,64 @@
+#include "initial.h"
+
+Initial::Initial(QWidget *parent) : QWidget(parent){}
+
+bool Initial::m_check_file(){
+ QFileInfo local_file( m_path_file );
+ if( local_file.exists() ){
+ m_read_file();
+ }else{
+ QDir().mkpath( m_dir );
+ m_file_create();
+ }
+ return true;
+}
+
+void Initial::m_file_create(){
+ QFile file( m_path_file );
+ QTextStream out_file( &file );
+ m_set_content();
+ file.open(QFile::ReadWrite|QFile::Text);
+ out_file << m_content << '\n';
+ file.flush();
+ file.close();
+}
+
+void Initial::m_set_content(){
+ QString content = "# --------------------------------\n"
+ "# Terminal Finances 1.0.0\n"
+ "# Developed by Marcos Oliveira\n"
+ "# \n"
+ "# --------------------------------\n"
+ "lang = " + m_lang + "\n"
+ "theme = " + m_theme + "\n"
+ "currency = " + m_currency;
+ m_content = content;
+}
+
+void Initial::m_read_file(){
+ QFile inputFile( m_path_file );
+ if(inputFile.open( QFile::ReadOnly | QFile::Text )){
+ QTextStream content(&inputFile);
+ while ( ! content.atEnd() ){
+
+ QString line = content.readLine();
+ line.replace(" ", "");
+ //line.remove('#');
+ QStringList fullline = line.split('=');
+
+ if( fullline.first() == "lang" ){
+ m_lang = fullline.last();
+ }
+
+ if( fullline.first() == "theme" ){
+ m_theme = fullline.last();
+ }
+
+ if( fullline.first() == "currency" ){
+ m_currency = fullline.last();
+ }
+
+ }
+ }
+ inputFile.close();
+}
diff --git a/initial.h b/initial.h
new file mode 100644
index 0000000..d38d266
--- /dev/null
+++ b/initial.h
@@ -0,0 +1,33 @@
+#ifndef INITIAL_H
+#define INITIAL_H
+
+#include
+#include
+#include
+#include
+#include
+#include
+
+class Initial : public QWidget{
+ Q_OBJECT
+public:
+ explicit Initial(QWidget *parent = nullptr);
+ const QString m_home = qgetenv("HOME"),
+ m_file_ini = "config.ini",
+ m_dir = m_home + "/.config/terminalfinances",
+ m_path_file = m_dir + "/" + m_file_ini,
+ m_en = "/etc/xdg/terminalfinances/TerminalFinances_en_US.qm",
+ m_es = "/etc/xdg/terminalfinances/TerminalFinances_en_US.qm";
+
+ QString m_content, m_lang = "pt", m_theme = "light",
+ m_get_lang = qgetenv("LANG"), m_currency = "R$";
+
+ bool m_check_file();
+ void m_file_create();
+ void m_set_content();
+ void m_read_file();
+signals:
+
+};
+
+#endif // INITIAL_H
diff --git a/main.cpp b/main.cpp
new file mode 100644
index 0000000..815ae7c
--- /dev/null
+++ b/main.cpp
@@ -0,0 +1,26 @@
+#include "terminalfinances.h"
+#include
+#include "initial.h"
+#include
+#include
+
+int main(int argc, char ** argv ){
+ QApplication a(argc, argv);
+ Initial z;
+ QTranslator t;
+ z.m_check_file();
+
+ if( z.m_lang == "en" ){
+ t.load( z.m_en );
+ }else if( z.m_lang == "es" ){
+ t.load( z.m_es );
+ }
+
+ if( z.m_lang != "pt" ){
+ a.installTranslator( &t );
+ }
+
+ TerminalFinances w;
+ w.show();
+ return a.exec();
+}
diff --git a/model.cpp b/model.cpp
new file mode 100644
index 0000000..bac0b53
--- /dev/null
+++ b/model.cpp
@@ -0,0 +1,71 @@
+#include "model.h"
+
+Model::Model(QWidget *parent) : QWidget(parent){}
+
+bool Model::m_insert(QStringList insert ){
+ QString values, fields = "tf_value, tf_account, tf_desc, tf_op, tf_user";
+ for( int i = 3; i >= 0; --i ){
+ values += "'" + insert[i] + "', ";
+ }
+ values += "'" + m_user + "'";
+ m_sql = "INSERT INTO " + m_table + "( " + fields + " ) VALUES ( " + values + " )";
+ return m_query.exec( m_sql );
+}
+
+QString Model::m_read_show_data(){
+ Views v;
+
+ for( int k = 24; k <= 31; k++){
+ m_set_headers << v.m_msg[k];
+ }
+
+ m_sql = "SELECT * FROM " + m_table + " ORDER BY id DESC LIMIT 20";
+ return m_sql;
+}
+
+bool Model::m_update(QStringList insert ){
+ m_sql = "UPDATE " + m_table + " SET tf_value='" + insert[1] + "', tf_desc='" + insert[2] + "', tf_date_update=CURRENT_TIMESTAMP WHERE id=" + insert[0];
+ return m_query.exec( m_sql );
+}
+
+bool Model::m_delete( QString id ){
+ m_sql = "DELETE FROM " + m_table + " WHERE id=" + id;
+ return m_query.exec( m_sql );
+}
+
+QString Model::m_select_distinct_year(){
+ m_sql = "SELECT DISTINCT SUBSTR(tf_date_update,1,4) FROM " + m_table + " ORDER BY SUBSTR(tf_date_update,1,4) DESC";
+ return m_sql;
+}
+
+void Model::m_set_sql(QStringList sqlist ){
+ Views v;
+ // combo_month, combo_year, combo_month_index_str
+ // sqlist[0], sqlist[1], sqlist[2]
+ QString sql, sql_c, sql_d;
+ if( sqlist[0] == v.m_msg[3] && sqlist[1] == v.m_msg[3] ){
+ sql = "SELECT * FROM terminalfinances";
+ sql_c = "SELECT tf_value FROM terminalfinances WHERE tf_op == '0'";
+ sql_d = "SELECT tf_value FROM terminalfinances WHERE tf_op == '1'";
+ }
+
+ if( sqlist[0] == v.m_msg[3] && sqlist[1] != v.m_msg[3] ){
+ sql = "SELECT * FROM terminalfinances WHERE SUBSTR(tf_date_update,1,4) == '" + sqlist[1] + "'";
+ sql_c = "SELECT tf_value FROM terminalfinances WHERE SUBSTR(tf_date_update,1,4) == '" + sqlist[1] + "' AND tf_op == '0'";
+ sql_d = "SELECT tf_value FROM terminalfinances WHERE SUBSTR(tf_date_update,1,4) == '" + sqlist[1] + "' AND tf_op == '1'";
+ }
+
+ if( sqlist[0] != v.m_msg[3] && sqlist[1] == v.m_msg[3] ){
+ sql = "SELECT * FROM terminalfinances WHERE SUBSTR(tf_date_update,6,2) == '" + sqlist[2] + "'";
+ sql_c = "SELECT tf_value FROM terminalfinances WHERE SUBSTR(tf_date_update,6,2) == '" + sqlist[2] + "' AND tf_op == '0'";
+ sql_d = "SELECT tf_value FROM terminalfinances WHERE SUBSTR(tf_date_update,6,2) == '" + sqlist[2] + "' AND tf_op == '1'";
+ }
+
+ if( sqlist[0] != v.m_msg[3] && sqlist[1] != v.m_msg[3] ){
+ sql = "SELECT * FROM terminalfinances WHERE SUBSTR(tf_date_update,1,4) = '" + sqlist[1] + "' AND SUBSTR(tf_date_update,6,2) == '" + sqlist[2] + "'";
+ sql_c = "SELECT tf_value FROM terminalfinances WHERE SUBSTR(tf_date_update,1,4) = '" + sqlist[1] + "' AND SUBSTR(tf_date_update,6,2) == '" + sqlist[2] + "' AND tf_op == '0'";
+ sql_d = "SELECT tf_value FROM terminalfinances WHERE SUBSTR(tf_date_update,1,4) = '" + sqlist[1] + "' AND SUBSTR(tf_date_update,6,2) == '" + sqlist[2] + "' AND tf_op == '1'";
+ }
+
+ m_sqlist << sql << sql_c << sql_d;
+}
diff --git a/model.h b/model.h
new file mode 100644
index 0000000..b0fb24f
--- /dev/null
+++ b/model.h
@@ -0,0 +1,30 @@
+#ifndef MODEL_H
+#define MODEL_H
+
+#include
+#include
+#include
+#include "views.h"
+
+class Model : public QWidget{
+ Q_OBJECT
+public:
+ explicit Model(QWidget *parent = nullptr);
+ QSqlQuery m_query;
+ QString m_sql;
+ QString m_table = "terminalfinances";
+ const QString m_user = qgetenv( "USER" );
+ bool m_insert( QStringList );
+ bool m_delete( QString );
+ bool m_update( QStringList );
+ QString m_read_show_data();
+ QString m_select_distinct_year( );
+ QStringList m_set_headers;
+ void m_set_sql( QStringList );
+ QStringList m_sqlist;
+
+signals:
+
+};
+
+#endif // MODEL_H
diff --git a/start.cpp b/start.cpp
new file mode 100644
index 0000000..99097d7
--- /dev/null
+++ b/start.cpp
@@ -0,0 +1,29 @@
+#include "start.h"
+
+Start::Start(QWidget *parent) : QWidget(parent){}
+
+void Start::m_run( QStringList files ){
+ Views v;
+ QString user_filedb = files[0], userdir = files[1], absolute_dir_filedb = files[2];
+ QFileInfo localdb( user_filedb );
+ QFile file( user_filedb );
+ QDir localdir( userdir );
+
+ if ( !localdir.exists() ){
+ if( QDir().mkpath( userdir ) ){
+ if( QFile::copy( absolute_dir_filedb , user_filedb ) ){
+ if( ! file.setPermissions( QFile::ReadOwner|QFile::WriteOwner ) ){
+ qDebug() << v.m_msg[62];
+ }
+ }
+ }
+ }
+
+ if( ! localdb.exists() ){
+ if( QFile::copy( absolute_dir_filedb , user_filedb ) ){
+ if( ! file.setPermissions( QFile::ReadOwner|QFile::WriteOwner ) ){
+ qDebug() << v.m_msg[62];
+ }
+ }
+ }
+}
diff --git a/start.h b/start.h
new file mode 100644
index 0000000..ef55dd9
--- /dev/null
+++ b/start.h
@@ -0,0 +1,20 @@
+#ifndef START_H
+#define START_H
+
+#include
+#include
+#include
+#include
+#include
+#include "views.h"
+
+class Start : public QWidget{
+ Q_OBJECT
+public:
+ explicit Start(QWidget *parent = nullptr);
+ void m_run( QStringList );
+signals:
+
+};
+
+#endif // START_H
diff --git a/terminal-finances.desktop b/terminal-finances.desktop
new file mode 100644
index 0000000..51f981b
--- /dev/null
+++ b/terminal-finances.desktop
@@ -0,0 +1,18 @@
+[Desktop Entry]
+Version=1.0
+Name=Terminal Finances
+GenericName=Financial management
+Comment=Personal Financial Management
+Exec=terminal-finances %u
+Icon=/usr/share/pixmaps/terminal-finances/terminal-finances.png
+Terminal=false
+Type=Application
+StartupNotify=true
+Categories=Utility;Qt;
+Keywords=finances;financial;accounting;
+GenericName[pt_BR]=Gestão Financeira
+Comment[pt_BR]=Gestão Financeira pessoal
+GenericName[es_ES]=Gestión financiera
+Comment[es_ES]=Gestión financiera personal
+GenericName[en_US]=Financial management
+Comment[en_US]=Personal Financial Management
diff --git a/terminalfinances.cpp b/terminalfinances.cpp
new file mode 100644
index 0000000..6078e67
--- /dev/null
+++ b/terminalfinances.cpp
@@ -0,0 +1,594 @@
+#include "terminalfinances.h"
+#include "ui_terminalfinances.h"
+#include
+
+TerminalFinances::TerminalFinances(QWidget *parent) : QMainWindow(parent) , ui(new Ui::TerminalFinances){
+ ui->setupUi(this);
+ m_set_checked_lang();
+ m_start_db();
+ m_set_accounts();
+ m_set_month_year();
+ m_show_data();
+ m_set_combos();
+}
+
+TerminalFinances::~TerminalFinances(){
+ delete ui;
+}
+
+void TerminalFinances::m_show_data(){
+ Model m;
+ Tools t;
+ Views v;
+ m.m_query.prepare( m.m_read_show_data() );
+ int count = 0, w = 70;
+ if( m.m_query.exec() ){
+ ui->selData->setColumnCount(8);
+ while ( m.m_query.next() ) {
+ ui->selData->insertRow(count);
+ for ( int c = 0; c <= 8; c++ ) {
+ if( c == 1 ){
+ ui->selData->setItem(count, c, new QTableWidgetItem( t.m_currency( m.m_query.value(c).toString() ) ) );
+ }else if( c == 2 ){
+ ui->selData->setItem(count, c, new QTableWidgetItem( t.m_get_account_str( m.m_query.value(c).toString(), m.m_query.value(4).toString() ) ) );
+ }else if( c == 4 ){
+ ui->selData->setItem(count, c, new QTableWidgetItem( t.m_get_op_str( m.m_query.value(c).toString() ) ) );
+ }else if( c > 5 ){
+ ui->selData->setItem(count, c, new QTableWidgetItem( t.m_dateformat( m.m_query.value(c).toString(), 0 ) ) );
+ }else{
+ ui->selData->setItem(count, c, new QTableWidgetItem( m.m_query.value(c).toString() ) );
+ }
+ }
+ ui->selData->setRowHeight( count , 30 );
+ count++;
+ }
+ for( int i = 0; i <= 7; ++i){
+ if( i == 1 ){ w = 105; }
+ if( i == 2 ){ w = 160; }
+ if( i == 3){ w = 780; }
+ if( i == 4 || i == 5){ w = 118; }
+ if( i == 6 || i == 7){ w = 200; }
+ ui->selData->setColumnWidth(i, w);
+ }
+ ui->selData->setHorizontalHeaderLabels( m.m_set_headers );
+ m_set_data_ui();
+ while( count < ui->selData->rowCount() ){
+ ui->selData->removeRow( count );
+ }
+ }
+}
+
+void TerminalFinances::m_set_lang( QString language ){
+ Initial z;
+ Views v;
+ z.m_read_file();
+ z.m_lang = language;
+ z.m_file_create();
+ QMessageBox::StandardButton reply;
+ reply = QMessageBox::question(this, v.m_msg[0], v.m_msg[1], QMessageBox::Yes|QMessageBox::No);
+ if(reply == QMessageBox::Yes){
+ close();
+ }
+ ui->statusbar->showMessage(v.m_msg[2]);
+}
+
+void TerminalFinances::m_set_checked_lang(){
+ Initial z;
+ z.m_check_file();
+ if( z.m_lang == "pt" ){
+ ui->actionPortugu_s->setChecked( true );
+ }else if( z.m_lang == "es" ){
+ ui->actionEspa_ol->setChecked( true );
+ }else{
+ ui->actionIngl_s->setChecked( true );
+ }
+
+ if( z.m_theme == "dark" ){
+ this->setStyleSheet("background-color:#383c4a;color:#d4dce3;font-size:15px;");
+ ui->actionDark->setChecked( true );
+ ui->actionLight->setChecked( false );
+ }else{
+ this->setStyleSheet("font-size:15px;");
+ ui->actionDark->setChecked( false );
+ ui->actionLight->setChecked( true );
+ }
+
+ m_currency = z.m_currency;
+}
+
+void TerminalFinances::m_set_combos(){
+ Tools t;
+ Views v;
+ QStringList months = t.m_all_months();
+ ui->combo_rel_month->addItem( v.m_msg[3] );
+ for( int i = 0; i < months.size(); ++i ){
+ ui->combo_rel_month->addItem( months[i] );
+ }
+
+ Model m;
+ m.m_query.prepare( m.m_select_distinct_year() );
+ m.m_query.prepare( m.m_sql );
+ ui->combo_rel_year->addItem(v.m_msg[3]);
+ if( m.m_query.exec() ){
+ while( m.m_query.next() ) {
+ ui->combo_rel_year->addItem( m.m_query.value( 0 ).toString() );
+ }
+ }
+
+ ui->balance_status->setStyleSheet("color:#57B4C0;");
+
+ ui->tabWidget->setCurrentIndex(0);
+ connect(ui->field_search, SIGNAL(returnPressed()),ui->btn_search,SIGNAL(clicked()));
+ //connect(ui->btn_c, SIGNAL(returnPressed()),ui->desc_c,SIGNAL(clicked()));
+
+}
+
+void TerminalFinances::m_set_data_ui(){
+ ui->selData->setEditTriggers( QAbstractItemView::NoEditTriggers);
+ ui->selData->setSelectionBehavior( QAbstractItemView::SelectRows);
+ ui->selData->verticalHeader()->setVisible(false);
+ ui->selData->verticalHeader()->setMinimumWidth(30);
+ ui->selData->setStyleSheet("QTableView {selection-background-color: #57B4C0;}");
+}
+
+void TerminalFinances::m_set_month_year(){
+ Tools t;
+ ui->current_month_year_c->setText( t.m_get_month() );
+ ui->current_month_year_d->setText( t.m_get_month() );
+}
+
+void TerminalFinances::m_start_db(){
+ Start s;
+ Views v;
+ QStringList files;
+ files << m_user_filedb << m_userdir << m_absolute_dir_filedb;
+ s.m_run( files );
+ m_db.setDatabaseName( m_user_filedb );
+ ! m_db.open() ? ui->statusbar->showMessage( tr("Falha ao conectar ao banco.") ) : ui->statusbar->showMessage( v.m_msg[4] );
+ QTimer::singleShot( 3000, [&](){ ui->statusbar->clearMessage(); } );
+}
+
+void TerminalFinances::m_set_accounts(){
+ AccountsList a;
+ QStringList accounts_c = a.m_accounts(0);
+ QStringList accounts_d = a.m_accounts(1);
+ for( int i = 0; i < accounts_c.size() ; ++i ){
+ ui->account_type_c->addItem( accounts_c[i] );
+ }
+ for( int i = 0; i < accounts_d.size() ; ++i ){
+ ui->account_type_d->addItem( accounts_d[i] );
+ }
+}
+
+void TerminalFinances::on_btn_c_clicked(){
+ Tools t;
+ Views v;
+ Model m;
+ QStringList fields;
+
+ fields << "0" << ui->desc_c->text() << QString::number( ui->account_type_c->currentIndex() ) << t.m_rm_semidot( ui->value_c->text() );
+
+ if( ! t.m_fields_validate( fields ) ){
+ QMessageBox::warning( this, v.m_msg[6], v.m_msg[7] );
+ return;
+ }
+
+ if( m.m_insert( fields ) ){
+ ui->info_c->clear();
+ ui->desc_c->clear();
+ ui->value_c->setValue(0.00);
+ ui->statusbar->showMessage( v.m_msg[8] );
+ ui->selData->clear();
+ m_show_data();
+ QTimer::singleShot( 3000, [&](){ ui->statusbar->clearMessage(); } );
+ }else{
+ QMessageBox::critical( this, v.m_msg[9] , v.m_msg[10]);
+ }
+}
+
+void TerminalFinances::on_selData_cellDoubleClicked(int row, int column){
+ column = 0;
+ ui->selData->setStyleSheet("QTableView {selection-background-color: #E06C75;}");
+ QStringList fields = { ui->selData->item( row , column)->text(), ui->selData->item( row , 1)->text(), ui->selData->item( row , 3)->text() };
+ UpdateFields u( fields );
+ u.exec();
+ ui->selData->clear();
+ m_show_data();
+}
+
+void TerminalFinances::on_btn_d_clicked(){
+ Tools t;
+ Views v;
+ Model m;
+ QStringList fields;
+ fields << "1" << ui->desc_d->text() << QString::number(ui->account_type_d->currentIndex() ) << t.m_rm_semidot( ui->value_d->text() );
+ if( ! t.m_fields_validate( fields ) ){
+ QMessageBox::warning( this, v.m_msg[6] , v.m_msg[7] );
+ return;
+ }
+
+ if( m.m_insert( fields ) ){
+ ui->info_d->clear();
+ ui->desc_d->clear();
+ ui->value_d->setValue(0.00);
+ ui->statusbar->showMessage( v.m_msg[12] );
+ ui->selData->clear();
+ m_show_data();
+ QTimer::singleShot( 3000, [&](){ ui->statusbar->clearMessage(); } );
+ }else{
+ QMessageBox::critical( this, v.m_msg[9] , v.m_msg[10]);
+ }
+}
+
+void TerminalFinances::on_btn_send_mail_clicked(){
+ FileSave f;
+ Views v;
+ QString content = f.m_save_content();
+ QProcess * process = new QProcess(this);
+ QString sendmail = "xdg-email";
+ QStringList arguments;
+ arguments << "--utf8" <<
+ "--subject" <<
+ "Terminal Finances" <<
+ "--body" <<
+ content ;
+ process->start(sendmail, arguments );
+
+ ui->statusbar->showMessage( v.m_msg[13] );
+ QTimer::singleShot( 3000, [&](){ ui->statusbar->clearMessage(); } );
+}
+
+void TerminalFinances::on_btn_save_clicked(){
+
+ FileSave f;
+ Views v;
+ QFile file( f.m_filename );
+
+ if( !file.open( QFile::ReadOnly | QFile::Text) ){
+ QMessageBox::warning( this , v.m_msg[14] , v.m_msg[15] );
+ return;
+ }
+
+ QTextStream enter_file( &file );
+ QString text = enter_file.readAll();
+ qDebug() << f.m_filename;
+ QTextEdit parent;
+ parent.setText( text );
+
+
+ QPrinter printer;
+ printer.setOutputFileName("terminalfinances.pdf");
+ printer.setPrinterName("Terminal Finances");
+ QPrintDialog diag_printer( &printer, this );
+ if( diag_printer.exec() == QDialog::Rejected ){
+ return;
+ }
+
+ parent.print(&printer);
+ ui->statusbar->showMessage( v.m_msg[16] );
+ QTimer::singleShot( 3000, [&](){ ui->statusbar->clearMessage(); } );
+
+}
+
+void TerminalFinances::on_btn_search_clicked(){
+ m_search_list();
+}
+
+
+void TerminalFinances::on_btn_generate_rel_clicked(){
+
+ Views v;
+ Tools t;
+ FileSave s;
+ GenDoc g;
+ Model m;
+ m.m_read_show_data();
+ g.m_set_t();
+
+ QString combo_month = ui->combo_rel_month->currentText(),
+ combo_month_index_str {},
+ combo_year = ui->combo_rel_year->currentText(),
+ result {}, sql, sql_c, sql_d,balance_color {},balance_name {},
+ balance_string, total_cred, total_deb;
+
+ QStringList to_result, sqlist;
+
+ float total {0}, total_c {0}, total_d {0}, balance;
+ qint64 combo_month_index = ui->combo_rel_month->currentIndex();
+
+ combo_month_index_str = ( combo_month_index < 10 ? "0" + QString::number( combo_month_index ) : QString::number( combo_month_index ) );
+ QSqlQuery query, query_c, query_d;
+
+ sqlist << combo_month << combo_year << combo_month_index_str;
+ m.m_set_sql( sqlist );
+ sql = m.m_sqlist[0], sql_c = m.m_sqlist[1], sql_d = m.m_sqlist[2];
+
+
+ if( query.exec( sql ) ){
+ while( query.next() ){
+ total += query.value( 1 ).toFloat();
+ }
+ }
+
+ if( query_c.exec( sql_c ) ){
+ while( query_c.next() ){
+ total_c += query_c.value( 0 ).toFloat();
+ }
+ }
+
+ if( query_d.exec( sql_d ) ){
+ while( query_d.next() ){
+ total_d += query_d.value( 0 ).toFloat();
+ }
+ }
+
+ balance = total_c - total_d;
+ const QStringList gencolor = g.m_gen_color();
+
+ if( balance > 0 ){
+ balance_color = gencolor[0];
+ balance_name = gencolor[1];
+ ui->balance_status->setText( gencolor[2] );
+ ui->balance_status->setStyleSheet( gencolor[3] );
+ }else if( balance == 0 ){
+ balance_color = gencolor[4];
+ balance_name = gencolor[5];
+ ui->balance_status->setText( gencolor[6] );
+ ui->balance_status->setStyleSheet( gencolor[7] );
+ }else{
+ balance_color = gencolor[8];
+ balance_name = gencolor[9];
+ ui->balance_status->setText( gencolor[10] );
+ ui->balance_status->setStyleSheet( gencolor[11] );
+ }
+
+ balance_string = QString::number( balance );
+ total_cred = QString::number( total_c);
+ total_deb = QString::number( total_d);
+
+ to_result << combo_month << combo_year << total_cred << total_deb << balance_color << balance_string;
+
+
+ if( total > 0 ){
+ result = g.m_gen_tags( to_result );
+ }
+
+ if( query.exec() ){
+ int count = 0, w = 70;
+ while( query.next() ){
+ result += g.m_t[0] + g.m_t[1] + t.m_dateformat( query.value( 7 ).toString(), 1) + g.m_t[2] +
+ g.m_t[1] + t.m_get_op_str( query.value( 4 ).toString() ) + g.m_t[2] +
+ g.m_t[1] + t.m_get_account_str( query.value( 2 ).toString(), query.value(4).toString() ) + g.m_t[2] +
+ g.m_t[1] + query.value( 3 ).toString() + g.m_t[2] +
+ g.m_t[1] + m_currency.leftJustified(6, ' ') + t.m_currency( query.value( 1 ).toString() ) + g.m_t[2] +
+ g.m_t[1] + query.value( 0 ).toString() + g.m_t[2] + g.m_t[3];
+
+ ui->tableWidget->setColumnCount(8);
+
+ ui->tableWidget->insertRow(count);
+ for ( int c = 0; c <= 8; c++ ) {
+ if( c == 1 ){
+ ui->tableWidget->setItem(count, c, new QTableWidgetItem( t.m_currency( query.value(c).toString() ) ) );
+ }else if( c == 2 ){
+ ui->tableWidget->setItem(count, c, new QTableWidgetItem( t.m_get_account_str( query.value(c).toString(), query.value(4).toString() ) ) );
+ }else if( c == 4 ){
+ ui->tableWidget->setItem(count, c, new QTableWidgetItem( t.m_get_op_str( query.value(c).toString() ) ) );
+ }else if( c > 5 ){
+ ui->tableWidget->setItem(count, c, new QTableWidgetItem( t.m_dateformat( query.value(c).toString(), 0 ) ) );
+ }else{
+ ui->tableWidget->setItem(count, c, new QTableWidgetItem( query.value(c).toString() ) );
+ }
+ }
+ ui->tableWidget->setRowHeight( count , 30 );
+ count++;
+
+
+
+ }
+
+ for( int i = 0; i <= 7; ++i){
+ if( i == 1 ){ w = 105; }
+ if( i == 2 ){ w = 160; }
+ if( i == 3){ w = 780; }
+ if( i == 4 || i == 5){ w = 118; }
+ if( i == 6 || i == 7){ w = 200; }
+ ui->tableWidget->setColumnWidth(i, w);
+ }
+ ui->tableWidget->setHorizontalHeaderLabels( m.m_set_headers );
+ ui->tableWidget->setEditTriggers( QAbstractItemView::NoEditTriggers);
+ ui->tableWidget->setSelectionBehavior( QAbstractItemView::SelectRows);
+ ui->tableWidget->verticalHeader()->setVisible(false);
+ ui->tableWidget->verticalHeader()->setMinimumWidth(30);
+ ui->tableWidget->setStyleSheet("QTableView {selection-background-color: #57B4C0;}");
+ ui->label_rel_c->setText( "" + m_currency.leftJustified(6, ' ') + t.m_currency( QString::number( total_c ) ) + "
" );
+ ui->label_rel_d->setText( "" + m_currency.leftJustified(6, ' ') + t.m_currency( QString::number( total_d ) ) + "
" );
+ ui->label_rel_s->setText( "" + m_currency.leftJustified(6, ' ') + t.m_currency( QString::number( balance ) ) + "
" );
+ while( count < ui->tableWidget->rowCount() ){
+ ui->tableWidget->removeRow( count );
+ }
+
+ if( total > 0 ){
+ s.m_save_file( result );
+ }
+
+ }else{
+ QMessageBox::critical(this, v.m_msg[17] , v.m_msg[18] );
+ }
+
+}
+
+void TerminalFinances::m_search_list(){
+ Views v;
+ QString search = ui->field_search->text();
+ if( search.isEmpty() ){
+ QMessageBox::warning( this, v.m_msg[19] , v.m_msg[20] );
+ return;
+ }
+
+ QSqlQuery query, query_t;
+
+ query.prepare("SELECT * FROM terminalfinances WHERE tf_desc LIKE '%" + search + "%' OR tf_account LIKE '%" + search + "%' OR tf_value LIKE '%" + search + "%'");
+ query_t.prepare("SELECT SUM(tf_value) FROM terminalfinances WHERE tf_desc LIKE '%" + search + "%' OR tf_account LIKE '%" + search + "%' OR tf_value LIKE '%" + search + "%'");
+ int count = 0;
+
+ Tools t;
+ if( query.exec() ){
+
+ float total_search = {0};
+ if( query_t.exec() ){
+ while ( query_t.next() ) {
+ total_search = query_t.value( 0 ).toFloat();
+ }
+
+ ui->label_total_search->setText( "" + t.m_currency( QString::number( total_search ) ) + "
" );
+ }
+
+ ui->search_tab->setColumnCount(8);
+ while ( query.next() ) {
+
+ ui->search_tab->insertRow(count);
+
+ for ( int c = 0; c <= 8; c++ ) {
+ if( c == 1){
+ ui->search_tab->setItem(count, c, new QTableWidgetItem( t.m_currency( query.value(c).toString() ) ) );
+ }else if( c == 2 ){
+ ui->search_tab->setItem(count, c, new QTableWidgetItem( t.m_get_account_str( query.value(c).toString(), query.value(4).toString() ) ) );
+ }else if( c == 4 ){
+ ui->search_tab->setItem(count, c, new QTableWidgetItem( t.m_get_op_str( query.value(c).toString() ) ) );
+ }else if( c > 5 ){
+ ui->search_tab->setItem(count, c, new QTableWidgetItem( t.m_dateformat( query.value(c).toString(), 0 ) ) );
+ }else{
+ ui->search_tab->setItem(count, c, new QTableWidgetItem( query.value(c).toString() ) );
+ }
+ }
+
+ ui->search_tab->setRowHeight( count , 30 );
+
+ count++;
+ }
+
+
+ if( count == 0 ){
+ ui->label_total_search->setText( "0,00
" );
+ for ( int r = 7; r > -1; r-- ) {
+ ui->search_tab->removeColumn( r );
+ }
+ for (int m = ui->search_tab->rowCount(); m > -1 ; --m) {
+ ui->search_tab->removeRow( m );
+ }
+ QMessageBox::information( this , v.m_msg[21] , v.m_msg[22] + " '" + search + "' .", v.m_msg[23] );
+ ui->field_search->clear();
+ ui->field_search->setFocus();
+ return;
+ }
+
+ ui->field_search->clear();
+
+ ui->search_tab->setColumnWidth(0, 100);
+ ui->search_tab->setColumnWidth(1, 100);
+ ui->search_tab->setColumnWidth(2, 200);
+ ui->search_tab->setColumnWidth(3, 700);
+ ui->search_tab->setColumnWidth(4, 100);
+ ui->search_tab->setColumnWidth(5, 100);
+ ui->search_tab->setColumnWidth(6, 200);
+ ui->search_tab->setColumnWidth(7, 200);
+
+
+ QStringList headers;
+
+ for( int k = 24; k <= 31; k++){
+ headers << v.m_msg[k];
+ }
+
+ ui->search_tab->setHorizontalHeaderLabels( headers );
+
+
+ ui->search_tab->setEditTriggers( QAbstractItemView::NoEditTriggers);
+ ui->search_tab->setSelectionBehavior( QAbstractItemView::SelectRows);
+ ui->search_tab->verticalHeader()->setMinimumWidth(30);
+ ui->search_tab->setStyleSheet("QTableView {selection-background-color: #57B4C0;}");
+
+
+ while( count < ui->search_tab->rowCount() ){
+ ui->search_tab->removeRow( count );
+ }
+
+ }else{
+ qDebug() << v.m_msg[32];
+ }
+}
+
+
+void TerminalFinances::on_actionTerminal_Finances_triggered(){
+ Views v;
+ QMessageBox::about( this , v.m_msg[33] , v.m_msg[34] );
+}
+
+void TerminalFinances::on_actionSair_triggered(){
+ close();
+}
+
+void TerminalFinances::on_actionLan_amentos_triggered(){
+ ui->tabWidget->setCurrentIndex(1);
+}
+
+void TerminalFinances::on_actionRelat_rios_triggered(){
+ ui->tabWidget->setCurrentIndex(2);
+}
+
+void TerminalFinances::on_actionPesquisar_triggered(){
+ ui->tabWidget->setCurrentIndex(3);
+ ui->field_search->setFocus();
+}
+
+void TerminalFinances::on_actionPortugu_s_triggered(){
+ ui->actionEspa_ol->setChecked( false );
+ ui->actionIngl_s->setChecked( false );
+ m_set_lang("pt");
+}
+
+void TerminalFinances::on_actionIngl_s_triggered(){
+ Initial z;
+ ui->actionEspa_ol->setChecked( false );
+ ui->actionPortugu_s->setChecked( false );
+ m_set_lang("en");
+}
+
+void TerminalFinances::on_actionEspa_ol_triggered(){
+ ui->actionPortugu_s->setChecked( false );
+ ui->actionIngl_s->setChecked( false );
+ m_set_lang("es");
+}
+
+void TerminalFinances::on_actionDark_triggered(){
+ Initial z;
+ z.m_read_file();
+ z.m_theme = "dark";
+ z.m_file_create();
+ this->setStyleSheet("background-color:#383c4a;color:#d4dce3;font-size:15px;");
+ ui->actionDark->setChecked( true );
+ ui->actionLight->setChecked( false );
+}
+
+void TerminalFinances::on_actionLight_triggered(){
+ Initial z;
+ z.m_read_file();
+ z.m_theme = "light";
+ z.m_file_create();
+ this->setStyleSheet("");
+ this->setStyleSheet("font-size:15px;");
+ ui->actionDark->setChecked( false );
+ ui->actionLight->setChecked( true );
+
+}
+
+void TerminalFinances::on_actionExportar_Banco_de_Dados_triggered(){
+ Tools t;
+ Views v;
+ QString filename = QFileDialog::getSaveFileName( this, v.m_msg[35] , QDir::homePath() + t.m_return_filename_db(), "*.db");
+ QString user_filedb = m_user_filedb;
+ if( QFile::copy( user_filedb, filename ) ){
+ ui->statusbar->showMessage( v.m_msg[36] );
+ QTimer::singleShot( 4000, [&](){ ui->statusbar->clearMessage(); } );
+ }
+}
diff --git a/terminalfinances.h b/terminalfinances.h
new file mode 100644
index 0000000..cee7a0d
--- /dev/null
+++ b/terminalfinances.h
@@ -0,0 +1,95 @@
+#ifndef TERMINALFINANCES_H
+#define TERMINALFINANCES_H
+
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include "start.h"
+#include "tools.h"
+#include "accountslist.h"
+#include "model.h"
+#include "updatefields.h"
+#include "filesave.h"
+#include "initial.h"
+#include "gendoc.h"
+#include "views.h"
+
+QT_BEGIN_NAMESPACE
+namespace Ui { class TerminalFinances; }
+QT_END_NAMESPACE
+
+class TerminalFinances : public QMainWindow{
+ Q_OBJECT
+
+public:
+ TerminalFinances(QWidget *parent = nullptr);
+ ~TerminalFinances();
+
+ const QString m_home_user = qgetenv("HOME");
+ const QString m_filedb = "terminalfinances.db";
+ const QString m_absolute_dir_filedb = "/etc/xdg/terminalfinances/terminalfinances.db"; // from
+ const QString m_userdir = m_home_user + "/.config/terminalfinances";
+ const QString m_user_filedb = m_home_user + "/.config/terminalfinances/" + m_filedb; // for
+
+ QSqlDatabase m_db = QSqlDatabase::addDatabase("QSQLITE");
+ QString m_currency;
+
+ void m_set_combos();
+ void m_show_data();
+ void m_set_accounts();
+ void m_start_db();
+ void m_set_month_year();
+ void m_set_data_ui();
+ void m_search_list();
+ void m_set_checked_lang();
+ void m_set_lang( QString );
+
+private slots:
+ void on_btn_c_clicked();
+
+ void on_selData_cellDoubleClicked(int row, int column);
+
+ void on_btn_d_clicked();
+
+ void on_btn_generate_rel_clicked();
+
+ void on_btn_send_mail_clicked();
+
+ void on_btn_save_clicked();
+
+ void on_btn_search_clicked();
+
+ void on_actionTerminal_Finances_triggered();
+
+ void on_actionSair_triggered();
+
+ void on_actionLan_amentos_triggered();
+
+ void on_actionRelat_rios_triggered();
+
+ void on_actionPesquisar_triggered();
+
+ void on_actionPortugu_s_triggered();
+
+ void on_actionIngl_s_triggered();
+
+ void on_actionEspa_ol_triggered();
+
+ void on_actionDark_triggered();
+
+ void on_actionLight_triggered();
+
+ void on_actionExportar_Banco_de_Dados_triggered();
+
+private:
+ Ui::TerminalFinances *ui;
+};
+#endif // TERMINALFINANCES_H
diff --git a/terminalfinances.ui b/terminalfinances.ui
new file mode 100644
index 0000000..569c7c8
--- /dev/null
+++ b/terminalfinances.ui
@@ -0,0 +1,959 @@
+
+
+ TerminalFinances
+
+
+
+ 0
+ 0
+ 1920
+ 1080
+
+
+
+
+ 0
+ 0
+
+
+
+ Terminal Finances
+
+
+
+ /usr/share/pixmaps/terminal-finances/start.png/usr/share/pixmaps/terminal-finances/start.png
+
+
+
+ -
+
+
-
+
+
+ 0
+
+
+
+ 32
+ 32
+
+
+
+
+ Terminal Finances
+
+
+
-
+
+
-
+
+
-
+
+
+ <html><head><title>Terminal Finances 1.0.0</title></head><body><table border="0" style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px;" align="center" cellspacing="2" cellpadding="0"><tr><td rowspan="6"><p><img src="/usr/share/pixmaps/terminal-finances/start.png"/></p></td><td/><td rowspan="2"><p><span style=" font-size:30px; font-weight:600;">Terminal Finances</span><br/><span style=" font-style:italic;">Versão 1.0.0</span></p></td><td/><td rowspan="2"><p><span style=" font-size:18px; font-weight:600;">Atalhos de comandos</span></p></td></tr><tr><td/><td/></tr><tr><td/><td><p><a href="https://terminalroot.com.br/cpp/"><span style=" text-decoration: underline; color:#17a2b8;">terminalroot.com.br</span></a></p></td><td/><td><p>Ctrl + E, Exportar o banco de dados</p></td></tr><tr><td/><td><p><a href="https://github.com/terroo/terminal-finances"><span style=" text-decoration: underline; color:#17a2b8;">github.com/terroo/terminal-finances</span></a></p></td><td/><td><p>Ctrl + Q, Para fechar esse programa</p></td></tr><tr><td/><td><p><a href="https://github.com/terroo/terminal-finances/issues"><span style=" text-decoration: underline; color:#17a2b8;">github.com/terroo/terminal-finances/issues</span></a></p></td><td/><td><p>Ctrl + A, Sobre o Terminal Finances</p></td></tr><tr><td/><td><p>Por Marcos Oliveira</p></td><td/><td><p>Ctrl + F, Pesquise contas, dados e valores</p></td></tr></table></body></html>
+
+
+
+
+
+
+
+
+
+
+
+ Inserir Crédito e/ou Débito, Editar e Excluir Lançamentos
+
+
+ -
+
+
-
+
+
+ Adicionar Crédito
+
+
+ Qt::AlignCenter
+
+
+
-
+
+
+ QLayout::SetDefaultConstraint
+
+
-
+
+
+ Mês/Ano
+
+
+
+ -
+
+
+ Descrição
+
+
+
+ -
+
+
+
+
+
+
+ -
+
+
+ true
+
+
+
+
+
+ true
+
+
+ true
+
+
+ false
+
+
+
+ -
+
+
+ false
+
+
+
+
+
+
+ -
+
+
+
+ 0
+ 0
+
+
+
+ PointingHandCursor
+
+
+ Lançar Crédito
+
+
+
+ /usr/share/pixmaps/terminal-finances/send-credit.png/usr/share/pixmaps/terminal-finances/send-credit.png
+
+
+ true
+
+
+
+ -
+
+
+ 999999.989999999990687
+
+
+ 1.000000000000000
+
+
+ QAbstractSpinBox::DefaultStepType
+
+
+ 0.000000000000000
+
+
+
+ -
+
+
+ Tipo de Conta
+
+
+
+ -
+
+
+ Valor
+
+
+
+ -
+
+
+ 200
+
+
+ Descreva o crédito
+
+
+
+
+
+
+
+
+
+
+ -
+
+
-
+
+
+ Adicionar Débito
+
+
+ Qt::AlignCenter
+
+
+ false
+
+
+ false
+
+
+
+ QLayout::SetDefaultConstraint
+
+
+ 10
+
+
-
+
+
-
+
+
+ Valor
+
+
+
+ -
+
+
+ 999999.989999999990687
+
+
+ QAbstractSpinBox::DefaultStepType
+
+
+
+ -
+
+
+
+
+
+
+ -
+
+
+ -
+
+
+
+ 0
+ 0
+
+
+
+ PointingHandCursor
+
+
+ Lançar Débito
+
+
+
+ /usr/share/pixmaps/terminal-finances/send-debit.png/usr/share/pixmaps/terminal-finances/send-debit.png
+
+
+ true
+
+
+
+ -
+
+
+ Tipo de Conta
+
+
+
+ -
+
+
+ true
+
+
+
+
+
+ true
+
+
+
+ -
+
+
+ Mês/Ano
+
+
+
+ -
+
+
+ 200
+
+
+ Descreva o débito
+
+
+
+ -
+
+
+ Descrição
+
+
+
+
+
+
+
+
+
+
+ -
+
+
-
+
+
+ Últimos Lançamentos
+
+
+
-
+
+
-
+
+
+ -
+
+
+ Qt::Horizontal
+
+
+
+ 40
+ 20
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Relatórios de Lançamentos e Consultar Saldos
+
+
+ -
+
+
-
+
+
+ Relatórios de lançamentos
+
+
+
-
+
+
+ -
+
+
-
+
+
+
+ 0
+ 0
+
+
+
+ Salvar PDF ou Imprimir
+
+
+
+ /usr/share/pixmaps/terminal-finances/pdf.png/usr/share/pixmaps/terminal-finances/pdf.png
+
+
+
+ -
+
+
+
+ 0
+ 0
+
+
+
+ Enviar E-mail
+
+
+
+ /usr/share/pixmaps/terminal-finances/mail.png/usr/share/pixmaps/terminal-finances/mail.png
+
+
+
+ -
+
+
+
+ 0
+ 0
+
+
+
+ Gerar Relatório
+
+
+
+ /usr/share/pixmaps/terminal-finances/spreadsheet.png/usr/share/pixmaps/terminal-finances/spreadsheet.png
+
+
+
+
+
+ -
+
+
-
+
+
+
+ 13
+ 50
+ false
+ PreferDefault
+
+
+
+ <html><head/><body><p align="center">STATUS DO SALDO</p></body></html>
+
+
+
+ -
+
+
+ false
+
+
+
+ 75
+ true
+ PreferDefault
+
+
+
+ <html><head/><body><p align="center"> ◉ Aguardando</p></body></html>
+
+
+ Qt::AlignCenter
+
+
+
+
+
+ -
+
+
+ Qt::Horizontal
+
+
+
+ -
+
+
-
+
+
+ -
+
+
+ <html><head/><body>
+<p align="right">Conta: </p>
+</body></html>
+
+
+
+ -
+
+
+ true
+
+
+
+ -
+
+
+ Qt::LeftToRight
+
+
+ false
+
+
+ <html><head/>
+<body>
+<p align="right">Mês: </p>
+</body>
+</html>
+
+
+
+ -
+
+
+ false
+
+
-
+
+ Todas
+
+
+
+
+ -
+
+
+ <html><head/><body><p align="right">Ano: </p></body></html>
+
+
+
+
+
+ -
+
+
-
+
+
-
+
+
+ <html><head/><body><p align="center">Saldo</p></body></html>
+
+
+
+ -
+
+
+ <html><head/><body><p align="center">Crédito</p></body></html>
+
+
+
+ -
+
+
+ <html><head/><body><p align="center">Débito</p></body></html>
+
+
+
+ -
+
+
+ background-color:#ef325a;border-color:#dc3545;
+
+
+
+ <h1 style="text-align:center;">0,00</h1>
+
+
+
+ -
+
+
+
+
+
+ <h1 style="text-align:center;">0,00</h1>
+
+
+
+ -
+
+
+ background-color:#00b5ad;border-color:#28a745;text-align:center;
+
+
+
+ <h1 style="text-align:center;">0,00</h1>
+
+
+
+
+
+
+
+ -
+
+
+ Qt::Horizontal
+
+
+
+
+
+
+
+
+
+
+
+
+ Pesquisa por Descrição, Valores e Contas
+
+
+ -
+
+
-
+
+
+ Pesquisa por Descrição
+
+
+
-
+
+
-
+
+
-
+
+
+ 80
+
+
+ 0
+
+
+ Informe a palavra de pesquisa
+
+
+
+ -
+
+
+ Pesquisar
+
+
+
+ /usr/share/pixmaps/terminal-finances/search.png/usr/share/pixmaps/terminal-finances/search.png
+
+
+
+
+
+
+
+
+
+
+ -
+
+
+ Qt::Vertical
+
+
+
+ -
+
+
+ Total da pesquisa
+
+
+
-
+
+
-
+
+
-
+
+
+ <html><head/><body><p><span style=" text-decoration: underline;">Total: </span></p></body></html>
+
+
+
+ -
+
+
+ <html><head/><body><h2><span style=" font-weight:600;">0,00</span></h2></body></html>
+
+
+
+
+
+
+
+
+
+
+
+
+ -
+
+
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Barra de Ferramentas
+
+
+ false
+
+
+ Qt::AllToolBarAreas
+
+
+ Qt::Vertical
+
+
+
+ 40
+ 40
+
+
+
+ LeftToolBarArea
+
+
+ false
+
+
+
+
+
+
+
+
+
+
+
+
+
+ /usr/share/pixmaps/terminal-finances/close.png/usr/share/pixmaps/terminal-finances/close.png
+
+
+ Sair
+
+
+ Ctrl+Q
+
+
+
+
+
+ /usr/share/pixmaps/terminal-finances/start.png/usr/share/pixmaps/terminal-finances/start.png
+
+
+ Terminal Finances
+
+
+ Ctrl+A
+
+
+
+
+
+ /usr/share/pixmaps/terminal-finances/balance.png/usr/share/pixmaps/terminal-finances/balance.png
+
+
+ Lançamentos
+
+
+
+
+
+ /usr/share/pixmaps/terminal-finances/tab3.png/usr/share/pixmaps/terminal-finances/tab3.png
+
+
+ Relatórios
+
+
+
+
+
+ /usr/share/pixmaps/terminal-finances/search.png/usr/share/pixmaps/terminal-finances/search.png
+
+
+ Pesquisar
+
+
+ Ctrl+F
+
+
+
+
+ true
+
+
+
+ /usr/share/pixmaps/terminal-finances/pt.png/usr/share/pixmaps/terminal-finances/pt.png
+
+
+ Português
+
+
+
+
+ true
+
+
+
+ /usr/share/pixmaps/terminal-finances/en.png/usr/share/pixmaps/terminal-finances/en.png
+
+
+ English
+
+
+
+
+ true
+
+
+
+ /usr/share/pixmaps/terminal-finances/es.png/usr/share/pixmaps/terminal-finances/es.png
+
+
+ Español
+
+
+
+
+ true
+
+
+
+ /usr/share/pixmaps/terminal-finances/dark.png/usr/share/pixmaps/terminal-finances/dark.png
+
+
+ Dark
+
+
+
+
+ true
+
+
+
+ /usr/share/pixmaps/terminal-finances/light.png/usr/share/pixmaps/terminal-finances/light.png
+
+
+ Light
+
+
+
+
+
+ /usr/share/pixmaps/terminal-finances/db.png/usr/share/pixmaps/terminal-finances/db.png
+
+
+ Exportar Banco de Dados
+
+
+ Ctrl+E
+
+
+
+
+ desc_c
+ account_type_c
+ current_month_year_c
+ value_c
+ btn_c
+ desc_d
+ account_type_d
+ current_month_year_d
+ value_d
+ btn_d
+ selData
+ tabWidget
+ tableWidget
+ btn_save
+ btn_send_mail
+ btn_generate_rel
+ combo_rel_month
+ combo_rel_year
+ combo_rel_op
+ field_search
+ btn_search
+ search_tab
+
+
+
+
diff --git a/terminalfinances/TerminalFinances_en_US.qm b/terminalfinances/TerminalFinances_en_US.qm
new file mode 100644
index 0000000..928e29d
Binary files /dev/null and b/terminalfinances/TerminalFinances_en_US.qm differ
diff --git a/terminalfinances/TerminalFinances_en_US.ts b/terminalfinances/TerminalFinances_en_US.ts
new file mode 100644
index 0000000..0094256
--- /dev/null
+++ b/terminalfinances/TerminalFinances_en_US.ts
@@ -0,0 +1,746 @@
+
+
+
+
+ TerminalFinances
+
+
+
+
+
+
+
+
+
+ <html><head><title>Terminal Finances 1.0.0</title></head><body><table border="0" style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px;" align="center" cellspacing="2" cellpadding="0"><tr><td rowspan="6"><p><img src=":/assets/img/start.png"/></p></td><td/><td rowspan="2"><p><span style=" font-size:30px; font-weight:600;">Terminal Finances</span><br/><span style=" font-style:italic;">Versão 1.0.0</span></p></td><td/><td rowspan="2"><p><span style=" font-size:18px; font-weight:600;">Command shortcuts</span></p></td></tr><tr><td/><td/></tr><tr><td/><td><p><a href="https://terminalroot.com.br/cpp/"><span style=" text-decoration: underline; color:#17a2b8;">terminalroot.com.br</span></a></p></td><td/><td><p>Ctrl + E, Export the database</p></td></tr><tr><td/><td><p><a href="https://github.com/terroo/terminal-finances"><span style=" text-decoration: underline; color:#17a2b8;">github.com/terroo/terminal-finances</span></a></p></td><td/><td><p>Ctrl + Q, To close this program</p></td></tr><tr><td/><td><p><a href="https://github.com/terroo/terminal-finances/issues"><span style=" text-decoration: underline; color:#17a2b8;">github.com/terroo/terminal-finances/issues</span></a></p></td><td/><td><p>Ctrl + A, About Terminal Finances</p></td></tr><tr><td/><td><p>By Marcos Oliveira</p></td><td/><td><p>Ctrl + F, Search accounts, data and values</p></td></tr></table></body></html>
+
+
+
+
+ <html><head><title>Terminal Finances 1.0.0</title></head><body><table border="0" style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px;" align="center" cellspacing="2" cellpadding="0"><tr><td rowspan="6"><p><img src="/usr/share/pixmaps/terminal-finances/start.png"/></p></td><td/><td rowspan="2"><p><span style=" font-size:30px; font-weight:600;">Terminal Finances</span><br/><span style=" font-style:italic;">Versão 1.0.0</span></p></td><td/><td rowspan="2"><p><span style=" font-size:18px; font-weight:600;">Command shortcuts</span></p></td></tr><tr><td/><td/></tr><tr><td/><td><p><a href="https://terminalroot.com.br/cpp/"><span style=" text-decoration: underline; color:#17a2b8;">terminalroot.com.br</span></a></p></td><td/><td><p>Ctrl + E, Export the database</p></td></tr><tr><td/><td><p><a href="https://github.com/terroo/terminal-finances"><span style=" text-decoration: underline; color:#17a2b8;">github.com/terroo/terminal-finances</span></a></p></td><td/><td><p>Ctrl + Q, To close this program</p></td></tr><tr><td/><td><p><a href="https://github.com/terroo/terminal-finances/issues"><span style=" text-decoration: underline; color:#17a2b8;">github.com/terroo/terminal-finances/issues</span></a></p></td><td/><td><p>Ctrl + A, About Terminal Finances</p></td></tr><tr><td/><td><p>By Marcos Oliveira</p></td><td/><td><p>Ctrl + F, Search accounts, data and values</p></td></tr></table></body></html>
+
+
+
+
+ Insert Credit and/or Debit, Edit and Delete Entries
+
+
+
+
+ Add Credit
+
+
+
+
+
+ Month/Year
+
+
+
+
+
+ Description
+
+
+
+
+ Post Credit
+
+
+
+
+
+ Account Type
+
+
+
+
+
+ Value
+
+
+
+
+ Describe the credit
+
+
+
+
+ Add Debit
+
+
+
+
+ Post Debit
+
+
+
+
+ Describe the debt
+
+
+
+
+ Last Releases
+
+
+
+
+ Launch Reports and Consult Balances
+
+
+
+
+ Release reports
+
+
+
+
+ Save PDF or Print
+
+
+
+
+ Send Email
+
+
+
+
+ Generate Report
+
+
+
+
+ <html><head/><body><p align="center">BALANCE STATUS</p></body></html>
+
+
+
+
+ <html><head/><body><p align="center"> ◉ Awaiting</p></body></html>
+
+
+
+
+ <html><head/><body>
+<p align="right">Account: </p>
+</body></html>
+
+
+
+
+ <html><head/>
+<body>
+<p align="right">Month: </p>
+</body>
+</html>
+
+
+
+
+ All
+
+
+
+
+ <html><head/><body><p align="right">Year: </p></body></html>
+
+
+
+
+ <html><head/><body><p align="center">Balance</p></body></html>
+
+
+
+
+ <html><head/><body><p align="center">Credit</p></body></html>
+
+
+
+
+ <html><head/><body><p align="center">Debit</p></body></html>
+
+
+
+
+
+
+ <h1 style="text-align:center;">0,00</h1>
+
+
+
+
+ Search by Description, Values and Accounts
+
+
+
+
+ ToolBar
+
+
+
+ Search by Description, Values and Accounts
+
+
+
+
+ Search by Description
+
+
+
+
+ Enter the search word
+
+
+
+
+
+ Search
+
+
+
+
+ Search Total
+
+
+
+
+
+
+
+
+
+
+
+
+
+ ToolBar
+
+
+
+
+ File
+
+
+
+
+ Tools
+
+
+
+
+ About
+
+
+
+
+ Languages
+
+
+
+
+ Themes
+
+
+
+
+ Quit
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Postings
+
+
+
+
+ reports
+
+
+
+
+
+
+
+
+
+ Portuguese
+
+
+
+
+
+
+
+
+
+ Spanish
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Export Database
+
+
+
+
+
+
+
+
+
+ Failed to connect to the database.
+
+
+
+ UpdateFields
+
+
+
+ Terminal Finances::Update Posting
+
+
+
+
+ Edit the code post:
+
+
+
+
+
+
+
+
+
+ Value
+
+
+
+
+ Description
+
+
+
+
+ Delete
+
+
+
+
+ Edit
+
+
+
+ Views
+
+
+
+ Action
+
+
+
+
+ Terminal Finances must be restarted for the changes to take effect and there are no problems.<br><b>Do you want to do that now?</b>
+
+
+
+
+ Close and open Terminal Finances.
+
+
+
+
+ All
+
+
+
+
+ Connected to the database!
+
+
+
+
+ credit
+
+
+
+
+ Notice
+
+
+
+
+ Fill in all fields
+
+
+
+
+ Credit inserted successfully!
+
+
+
+
+ Failure
+
+
+
+
+ Failed to enter data
+
+
+
+
+ debit
+
+
+
+
+ Debit successfully inserted!
+
+
+
+
+ Opening your email client with report in the message body!
+
+
+
+
+ Error
+
+
+
+
+ File cannot be saved.
+
+
+
+
+ PDF or print done successfully!
+
+
+
+
+ Error generating report
+
+
+
+
+ Failed to query data.
+
+
+
+
+ Correct use
+
+
+
+
+ Enter the term you want to search for.
+
+
+
+
+ Empty result
+
+
+
+
+ No results found for the term:
+
+
+
+
+ I'll search another term
+
+
+
+
+ Number
+
+
+
+
+ Value
+
+
+
+
+ Account Type
+
+
+
+
+ Description
+
+
+
+
+ Operation
+
+
+
+
+ User
+
+
+
+
+ Creation date
+
+
+
+
+ Last update
+
+
+
+
+ Failed to retrieve data.
+
+
+
+
+ About Terminal Finances
+
+
+
+
+ <h2>Terminal Finances 1.0.0</h2><p>Developed by Marcos Oliveira<br>Copyright 2021 Terminal Root Sistemas Inc.</p><p><a style='color:#17a2b8;font-weight:bold;' href='https://terminalroot.com.br/cpp/'>terminalroot.com.br</a></p><hr><p><i>The program is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.</i></p><br>
+
+
+
+
+ Export Database
+
+
+
+
+ Database exported successfully!
+
+
+
+
+ Salary
+
+
+
+
+ Bonus
+
+
+
+
+ Vacation
+
+
+
+
+ Extra income
+
+
+
+
+ Electricity bill
+
+
+
+
+ Water bill
+
+
+
+
+ Food
+
+
+
+
+ Payments
+
+
+
+
+ Telephone bill
+
+
+
+
+ Internet bill
+
+
+
+
+ Error removing the previous file.
+
+
+
+
+ Error creating file
+
+
+
+
+ The file could not be created.
+
+
+
+
+ The file could not be read.
+
+
+
+
+ Credit:
+
+
+
+
+ Debit:
+
+
+
+
+ Balance:
+
+
+
+
+ Date
+
+
+
+
+ Type
+
+
+
+
+ Positive
+
+
+
+
+ ⬤ POSITIVE BALANCE
+
+
+
+
+ Zeroed
+
+
+
+
+ ◯ ZERO BALANCE
+
+
+
+
+ Negative
+
+
+
+
+ ⬤ BALANCE NEGATIVE
+
+
+
+
+ Failed to apply permissions.
+
+
+
+
+ January
+
+
+
+
+ February
+
+
+
+
+ March
+
+
+
+
+ April
+
+
+
+
+ May
+
+
+
+
+ June
+
+
+
+
+ July
+
+
+
+
+ August
+
+
+
+
+ September
+
+
+
+
+ October
+
+
+
+
+ November
+
+
+
+
+ December
+
+
+
+
+ Error updating data.
+
+
+
+
+ Do you really want to delete the item
+
+
+
diff --git a/terminalfinances/TerminalFinances_es_ES.qm b/terminalfinances/TerminalFinances_es_ES.qm
new file mode 100644
index 0000000..0d8b0d5
Binary files /dev/null and b/terminalfinances/TerminalFinances_es_ES.qm differ
diff --git a/terminalfinances/TerminalFinances_es_ES.ts b/terminalfinances/TerminalFinances_es_ES.ts
new file mode 100644
index 0000000..8a8c5a0
--- /dev/null
+++ b/terminalfinances/TerminalFinances_es_ES.ts
@@ -0,0 +1,746 @@
+
+
+
+
+ TerminalFinances
+
+
+
+
+
+
+
+
+
+ <html><head><title>Terminal Finances 1.0.0</title></head><body><table border="0" style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px;" align="center" cellspacing="2" cellpadding="0"><tr><td rowspan="6"><p><img src=":/assets/img/start.png"/></p></td><td/><td rowspan="2"><p><span style=" font-size:30px; font-weight:600;">Terminal Finances</span><br/><span style=" font-style:italic;">Versão 1.0.0</span></p></td><td/><td rowspan="2"><p><span style=" font-size:18px; font-weight:600;">Atajos de comando</span></p></td></tr><tr><td/><td/></tr><tr><td/><td><p><a href="https://terminalroot.com.br/cpp/"><span style=" text-decoration: underline; color:#17a2b8;">terminalroot.com.br</span></a></p></td><td/><td><p>Ctrl + E, Exportar la base de datos</p></td></tr><tr><td/><td><p><a href="https://github.com/terroo/terminal-finances"><span style=" text-decoration: underline; color:#17a2b8;">github.com/terroo/terminal-finances</span></a></p></td><td/><td><p>Ctrl + Q, Para fechar esse programa</p></td></tr><tr><td/><td><p><a href="https://github.com/terroo/terminal-finances/issues"><span style=" text-decoration: underline; color:#17a2b8;">github.com/terroo/terminal-finances/issues</span></a></p></td><td/><td><p>Ctrl + A, Acerca de Terminal Finances</p></td></tr><tr><td/><td><p>Por Marcos Oliveira</p></td><td/><td><p>Ctrl + F, Buscar cuentas, datos y valores</p></td></tr></table></body></html>
+
+
+
+
+ <html><head><title>Terminal Finances 1.0.0</title></head><body><table border="0" style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px;" align="center" cellspacing="2" cellpadding="0"><tr><td rowspan="6"><p><img src="/usr/share/pixmaps/terminal-finances/start.png"/></p></td><td/><td rowspan="2"><p><span style=" font-size:30px; font-weight:600;">Terminal Finances</span><br/><span style=" font-style:italic;">Versão 1.0.0</span></p></td><td/><td rowspan="2"><p><span style=" font-size:18px; font-weight:600;">Atajos de comando</span></p></td></tr><tr><td/><td/></tr><tr><td/><td><p><a href="https://terminalroot.com.br/cpp/"><span style=" text-decoration: underline; color:#17a2b8;">terminalroot.com.br</span></a></p></td><td/><td><p>Ctrl + E, Exportar la base de datos</p></td></tr><tr><td/><td><p><a href="https://github.com/terroo/terminal-finances"><span style=" text-decoration: underline; color:#17a2b8;">github.com/terroo/terminal-finances</span></a></p></td><td/><td><p>Ctrl + Q, Para fechar esse programa</p></td></tr><tr><td/><td><p><a href="https://github.com/terroo/terminal-finances/issues"><span style=" text-decoration: underline; color:#17a2b8;">github.com/terroo/terminal-finances/issues</span></a></p></td><td/><td><p>Ctrl + A, Acerca de Terminal Finances</p></td></tr><tr><td/><td><p>Por Marcos Oliveira</p></td><td/><td><p>Ctrl + F, Buscar cuentas, datos y valores</p></td></tr></table></body></html>
+
+
+
+
+ Insertar Crédito y/o Débito, Editar y Eliminar Entradas
+
+
+
+
+ Añadir crédito
+
+
+
+
+
+ Mes/Año
+
+
+
+
+
+ Descripción
+
+
+
+
+ Post Crédito
+
+
+
+
+
+ Tipo de Cuenta
+
+
+
+
+
+ Valor
+
+
+
+
+ Describe el Crédito
+
+
+
+
+ Agregar Débito
+
+
+
+
+ Post Débito
+
+
+
+
+ Describe el Débito
+
+
+
+
+ Ultimos Lanzamientos
+
+
+
+
+ Lanzar informes y consultar saldos
+
+
+
+
+ Reportes de Lanzamiento
+
+
+
+
+ Guardar PDF o Imprimir
+
+
+
+
+ Enviar Correo Electrónico
+
+
+
+
+ Generar Informe
+
+
+
+
+ <html><head/><body><p align="center">ESTADO DE BALANCE</p></body></html>
+
+
+
+
+ <html><head/><body><p align="center"> ◉ Esperando</p></body></html>
+
+
+
+
+ <html><head/><body>
+<p align="right">Cuenta: </p>
+</body></html>
+
+
+
+
+ <html><head/>
+<body>
+<p align="right">Mes: </p>
+</body>
+</html>
+
+
+
+
+ Todos
+
+
+
+
+ <html><head/><body><p align="right">Año: </p></body></html>
+
+
+
+
+ <html><head/><body><p align="center">Saldo</p></body></html>
+
+
+
+
+ <html><head/><body><p align="center">Crédito</p></body></html>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Búsqueda por Descripción, Valores y Cuentas
+
+
+
+
+ Barra de herramientas
+
+
+
+ Búsqueda por Descripción, Valores y Cuentas
+
+
+
+
+ Buscar por Descripción
+
+
+
+
+ Ingrese la Palabra de Búsqueda
+
+
+
+
+
+ Buscar
+
+
+
+
+ Total de búsqueda
+
+
+
+
+ <html><head/><body><p><span style=" text-decoration: underline;">Total: </span></p></body></html>
+
+
+
+
+ <html><head/><body><h2><span style=" font-weight:600;">0,00</span></h2></body></html>
+
+
+
+ Barra de herramientas
+
+
+
+
+ Archivo
+
+
+
+
+ Herramientas
+
+
+
+
+ Acerca de
+
+
+
+
+ Idiomas
+
+
+
+
+ Temas
+
+
+
+
+ Salir
+
+
+
+
+ Ctrl+Q
+
+
+
+
+ Ctrl+A
+
+
+
+
+ Lanzamientos
+
+
+
+
+ Informes
+
+
+
+
+ Ctrl+F
+
+
+
+
+ Portugués
+
+
+
+
+ Inglés
+
+
+
+
+ Español
+
+
+
+
+ Dark
+
+
+
+
+ Light
+
+
+
+
+ Exportar base de datos
+
+
+
+
+ Ctrl+E
+
+
+
+
+ No se pudo conectar a la base de datos.
+
+
+
+ UpdateFields
+
+
+
+ Terminal Finances::Lanzamiento de actualización
+
+
+
+
+ Edite el lanzamiento del código:
+
+
+
+
+
+
+
+
+
+ Valor
+
+
+
+
+ Descripción
+
+
+
+
+ Eliminar
+
+
+
+
+ Editar
+
+
+
+ Views
+
+
+
+ Acción
+
+
+
+
+ Terminal Finances debe reiniciarse para que los cambios surtan efecto y no haya problemas. <br><b>¿Quieres hacer eso ahora?</b>
+
+
+
+
+ Cierre y abra Terminal Finances.
+
+
+
+
+ Todos
+
+
+
+
+ ¡Conectado a la base de datos!
+
+
+
+
+ credito
+
+
+
+
+
+
+
+
+
+ Completa todos los campos
+
+
+
+
+ ¡Crédito insertado correctamente!
+
+
+
+
+ Fracaso
+
+
+
+
+ Error al ingresar datos
+
+
+
+
+ debito
+
+
+
+
+ ¡Débito insertado correctamente!
+
+
+
+
+ ¡Abriendo su cliente de correo electrónico con informe en el cuerpo del mensaje!
+
+
+
+
+ Error
+
+
+
+
+ No se puede guardar el archivo.
+
+
+
+
+ PDF o impresión realizada con éxito!
+
+
+
+
+ Error al generar el informe
+
+
+
+
+ No se pudieron consultar los datos.
+
+
+
+
+ Uso correcto
+
+
+
+
+ Ingrese el término que desea buscar.
+
+
+
+
+ Resultado vacío
+
+
+
+
+ No se encontraron resultados para el término:
+
+
+
+
+ Buscaré otro término
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Tipo de cuenta
+
+
+
+
+ Descripción
+
+
+
+
+ Operación
+
+
+
+
+ Usuario
+
+
+
+
+ Fecha de creación
+
+
+
+
+ Última actualización
+
+
+
+
+ No se pudieron recuperar los datos.
+
+
+
+
+ Acerca de Terminal Finances
+
+
+
+
+ <h2>Terminal Finances 1.0.0</h2><p>Desarrollado por Marcos Oliveira<br>Copyright 2021 Terminal Root Sistemas Inc.</p><p><a style='color:#17a2b8;font-weight:bold;' href='https://terminalroot.com.br/cpp/'>terminalroot.com.br</a></p><hr><p><i>The program is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.</i></p><br>
+
+
+
+
+ Exportar base de datos
+
+
+
+
+ ¡Base de datos exportada correctamente!
+
+
+
+
+ Salario
+
+
+
+
+ Prima
+
+
+
+
+ Vacaciones
+
+
+
+
+ Ingresos extra
+
+
+
+
+ Factura de electricidad
+
+
+
+
+ Factura de agua
+
+
+
+
+ Alimentación
+
+
+
+
+ Pagos
+
+
+
+
+ Factura telefónica
+
+
+
+
+ Factura de Internet
+
+
+
+
+ Error al eliminar el archivo anterior.
+
+
+
+
+ Error al crear el archivo
+
+
+
+
+ El archivo no podría ser creado.
+
+
+
+
+ No se pudo leer el archivo.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Fecha
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ ⬤ BALANCE POSITIVO
+
+
+
+
+ Cero
+
+
+
+
+ ◯ BALANCE ZERO
+
+
+
+
+
+
+
+
+
+ ⬤ BALANCE NEGATIVO
+
+
+
+
+ No se pudieron aplicar los permisos.
+
+
+
+
+ Enero
+
+
+
+
+ Febrero
+
+
+
+
+ Marzo
+
+
+
+
+
+
+
+
+
+ May
+
+
+
+
+ Junio
+
+
+
+
+ Julio
+
+
+
+
+
+
+
+
+
+ Septiembre
+
+
+
+
+ Octubre
+
+
+
+
+ Noviembre
+
+
+
+
+ Diciembre
+
+
+
+
+ Error al actualizar los datos.
+
+
+
+
+ ¿De verdad quieres eliminar el elemento?
+
+
+
diff --git a/terminalfinances/terminalfinances.db b/terminalfinances/terminalfinances.db
new file mode 100644
index 0000000..ab71d5b
Binary files /dev/null and b/terminalfinances/terminalfinances.db differ
diff --git a/tools.cpp b/tools.cpp
new file mode 100644
index 0000000..01ec389
--- /dev/null
+++ b/tools.cpp
@@ -0,0 +1,96 @@
+#include "tools.h"
+
+Tools::Tools(QWidget *parent) : QWidget(parent){
+ m_get_datetime();
+}
+
+QString Tools::m_currency( QString value ){
+ double valor = value.toDouble();
+ auto lang = QLocale("pt_BR");
+ return lang.toString(valor, 'f', 2) ;
+}
+
+bool Tools::m_fields_validate( QStringList fields ){
+ for( int i = 0; i < fields.size(); ++i ){
+ if( fields[i].isEmpty() || fields[i] == "0.00" ){
+ return false;
+ }
+ }
+ return true;
+}
+
+void Tools::m_get_datetime(){
+ QDateTime UTC(QDateTime::currentDateTimeUtc());
+ QDateTime local(UTC.toLocalTime());
+ int int_day = QDate::currentDate().day(),
+ int_month = QDate::currentDate().month(),
+ int_year = QDate::currentDate().year(),
+ int_hour = local.time().hour(),
+ int_min = local.time().minute(),
+ int_sec = local.time().second();
+ int c_datetime[6] { int_day, int_month, int_year, int_hour, int_min, int_sec };
+ for( int i = 0; i < 6; ++i){
+ m_datetime[i] = c_datetime[i];
+ }
+
+}
+
+QString Tools::m_get_month(){
+ QStringList months = m_all_months();
+ QString str = months[ m_datetime[1] - 1 ] + "/" + QString::number( m_datetime[2] );
+ return str;
+}
+
+QString Tools::m_rm_semidot(QString str ){
+ return str.replace(",", ".");
+}
+
+QStringList Tools::m_all_months(){
+ Views v;
+ QStringList r;
+ for( int i = 63; i <= 74; ++i ){
+ r << v.m_msg[i];
+ }
+ return r;
+}
+
+QString Tools::m_return_filename_db(){
+ QString str_d, str_m;
+ str_d = ( m_datetime[0] < 10 ? "0" + QString::number( m_datetime[0] ) : QString::number( m_datetime[0] ) );
+ str_m = ( m_datetime[1] < 10 ? "0" + QString::number( m_datetime[1] ) : QString::number( m_datetime[1] ) );
+ return ("/terminalfinances-" + QString::number( m_datetime[2] ) + "-" + str_m + "-" + str_d + ".db" );
+}
+
+QString Tools::m_dateformat(QString str, int n ){
+ QString fmt = "yyyy-MM-dd hh:mm:ss";
+ QDateTime dt = QDateTime::fromString(str, fmt);
+ if( n == 0 ){
+ str = dt.toString(" dd/MM/yyyy hh:mm:ss");
+ }else{
+ str = dt.toString(" dd/MM/yyyy");
+ }
+
+ return str;
+}
+
+QString Tools::m_get_account_str( QString account, QString op ){
+ Views v;
+ QString account_name;
+ int n = 0;
+ for (int j = 37; j <= 46; ++j) {
+ n = j - 37;
+
+ if( account == QString::number( n ) ){
+ if( op == "1" ){
+ j += 4;
+ }
+ account_name = v.m_msg[j];
+ }
+ }
+ return account_name;
+}
+
+QString Tools::m_get_op_str( QString op ){
+ Views v;
+ return ( op == "0" ? v.m_msg[5] : v.m_msg[11] );
+}
diff --git a/tools.h b/tools.h
new file mode 100644
index 0000000..1a3d5a4
--- /dev/null
+++ b/tools.h
@@ -0,0 +1,30 @@
+#ifndef TOOLS_H
+#define TOOLS_H
+
+#include
+#include
+#include
+#include
+#include
+#include "views.h"
+
+class Tools : public QWidget{
+ Q_OBJECT
+public:
+ explicit Tools(QWidget *parent = nullptr);
+ bool m_fields_validate( QStringList );
+ void m_get_datetime();
+ QString m_get_month();
+ QString m_rm_semidot( QString );
+ int m_datetime[6];
+ QStringList m_all_months();
+ QString m_currency( QString );
+ QString m_return_filename_db();
+ QString m_dateformat( QString, int );
+ QString m_get_account_str( QString, QString );
+ QString m_get_op_str( QString );
+signals:
+
+};
+
+#endif // TOOLS_H
diff --git a/updatefields.cpp b/updatefields.cpp
new file mode 100644
index 0000000..6dafa8e
--- /dev/null
+++ b/updatefields.cpp
@@ -0,0 +1,52 @@
+#include "updatefields.h"
+#include "ui_updatefields.h"
+
+UpdateFields::UpdateFields( QStringList fields, QWidget *parent ) : QDialog(parent), ui(new Ui::UpdateFields){
+ ui->setupUi(this);
+ fields[1].remove(".");
+ fields[1].replace(",", ".");
+ ui->fiel_desc_edit_balance->setText( fields[2] );
+ ui->value_edit_balance->setValue( fields[1].toDouble() );
+ ui->label_id->setText( fields[0] );
+ m_update_fields = fields;
+}
+
+UpdateFields::~UpdateFields(){
+ delete ui;
+}
+
+void UpdateFields::on_button_edit_balance_clicked(){
+ Views v;
+ Tools t;
+ QStringList fields = { ui->label_id->text(), t.m_rm_semidot( ui->value_edit_balance->text() ), ui->fiel_desc_edit_balance->text() };
+ if( ! t.m_fields_validate( fields ) ){
+ QMessageBox::warning( this, v.m_msg[6], v.m_msg[7] );
+ return;
+ }
+
+ Model m;
+ if( m.m_update( fields ) ){
+ this->close();
+ }else{
+ QMessageBox::critical( this, v.m_msg[14], v.m_msg[75] );
+ this->close();
+ }
+
+}
+
+void UpdateFields::on_pushButton_clicked(){
+ Views v;
+ Model m;
+ QMessageBox::StandardButton reply;
+ reply = QMessageBox::question(this, v.m_msg[6], v.m_msg[76] + ui->label_id->text() + "?",
+ QMessageBox::Yes|QMessageBox::No);
+ if (reply == QMessageBox::Yes) {
+ if( m.m_delete( ui->label_id->text() ) ){
+ this->close();
+ }else{
+ QMessageBox::critical( this, v.m_msg[14], v.m_msg[75] );
+ this->close();
+ }
+
+ }
+}
diff --git a/updatefields.h b/updatefields.h
new file mode 100644
index 0000000..9abd13a
--- /dev/null
+++ b/updatefields.h
@@ -0,0 +1,32 @@
+#ifndef UPDATEFIELDS_H
+#define UPDATEFIELDS_H
+
+#include
+#include
+#include "model.h"
+#include "tools.h"
+#include "views.h"
+
+namespace Ui {
+class UpdateFields;
+}
+
+class UpdateFields : public QDialog{
+ Q_OBJECT
+
+public:
+ explicit UpdateFields(QStringList fields = {""}, QWidget *parent = nullptr );
+ ~UpdateFields();
+ QStringList m_update_fields;
+ bool m_item_del = false;
+
+private slots:
+ void on_button_edit_balance_clicked();
+
+ void on_pushButton_clicked();
+
+private:
+ Ui::UpdateFields *ui;
+};
+
+#endif // UPDATEFIELDS_H
diff --git a/updatefields.ui b/updatefields.ui
new file mode 100644
index 0000000..b8e2ea9
--- /dev/null
+++ b/updatefields.ui
@@ -0,0 +1,131 @@
+
+
+ UpdateFields
+
+
+
+ 0
+ 0
+ 554
+ 168
+
+
+
+ Terminal Finances::Atualizar Lançamento
+
+
+
+
+ 9
+ 10
+ 531
+ 141
+
+
+
+ -
+
+
-
+
+
+ Editar o lançamento de código:
+
+
+
+ -
+
+
+ true
+
+
+
+ 15
+ 75
+ true
+
+
+
+ 99
+
+
+
+ -
+
+
-
+
+
+ Valor
+
+
+
+ -
+
+
+ 999999.989999999990687
+
+
+ 1.000000000000000
+
+
+ QAbstractSpinBox::AdaptiveDecimalStepType
+
+
+ 0.000000000000000
+
+
+
+
+
+
+
+ -
+
+
-
+
+
+ Descrição
+
+
+
+ -
+
+
+
+
+ -
+
+
-
+
+
+ color:#fff;
+background-color:#dc3545;
+border-color:#dc3545;
+font-weight:bold;
+
+
+ Excluir
+
+
+
+ -
+
+
+ color:#fff;
+/*background-color:#28a745;*/
+background-color:#57B4C0;
+border-color:#28a745;
+font-weight:bold;
+
+
+ Editar
+
+
+
+
+
+
+
+
+
+
+
diff --git a/views.cpp b/views.cpp
new file mode 100644
index 0000000..370fe4a
--- /dev/null
+++ b/views.cpp
@@ -0,0 +1,3 @@
+#include "views.h"
+
+Views::Views(QWidget *parent) : QWidget(parent){}
diff --git a/views.h b/views.h
new file mode 100644
index 0000000..efe9a26
--- /dev/null
+++ b/views.h
@@ -0,0 +1,91 @@
+#ifndef VIEWS_H
+#define VIEWS_H
+
+#include
+
+class Views : public QWidget{
+ Q_OBJECT
+public:
+ explicit Views(QWidget *parent = nullptr);
+ const QStringList m_msg = {tr("Ação"), tr("É necessário reiniciar o Terminal Finances para que as alterações tenham efeito e não haja problemas.
Deseja fazer isso agora ?"),
+ tr("Feche a abra o Terminal Finances."),
+ tr("Todos"),
+ tr("Conectado ao banco!"),
+ tr("credito"),
+ tr("Aviso"),
+ tr("Preencha todos os campos"),
+ tr("Crédito inserido com sucesso!"),
+ tr("Falha"),
+ tr("Falha ao inserir os dados"),
+ tr("debito"),
+ tr("Débito inserido com sucesso!"),
+ tr("Abrindo seu cliente de e-mail com relatório no corpo da mensagem!"),
+ tr("Erro"),
+ tr("Arquivo não pode ser salvo."),
+ tr("PDF ou impressão realizada com sucesso!"),
+ tr("Erro ao gerar relatório"),
+ tr("Falha ao consultar dados."),
+ tr("Uso correto"),
+ tr("Informe o termo que deseja pesquisar."),
+ tr("Resultado vazio"),
+ tr("Nenhum resultado encontrado para o termo:"),
+ tr("Vou Pesquisar outro termo"),
+ tr("Código"),
+ tr("Valor"),
+ tr("Tipo de Conta"),
+ tr("Descrição"),
+ tr("Operação"),
+ tr("Usuário"),
+ tr("Data de Criação"),
+ tr("Última atualização"),
+ tr("Falha ao resgatar dados."),
+ tr("Sobre Terminal Finances"),
+ tr("Terminal Finances 1.0.0
Desenvolvido por Marcos Oliveira
Copyright 2021 Terminal Root Sistemas Inc.
terminalroot.com.br
The program is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
"),
+ tr("Exportar Banco de Dados"),
+ tr("Banco de dados exportado com sucesso!"),
+ tr("Salário"),
+ tr("Décimo Terceiro"),
+ tr("Férias"),
+ tr("Renda extra"),
+ tr("Conta de Luz"),
+ tr("Conta de Água"),
+ tr("Alimentação"),
+ tr("Pagamentos"),
+ tr("Telefone"),
+ tr("Internet"),
+ tr("Erro ao remover o arquivo anterior."),
+ tr("Erro ao criar arquivo"),
+ tr("Não foi possível criar o arquivo."),
+ tr("Não foi possível ler o arquivo."),
+ tr("Crédito: "),
+ tr("Débito: "),
+ tr("Saldo: "),
+ tr("Data"),
+ tr("Tipo"),
+ tr("Positivo"),
+ tr(" \u2B24 SALDO POSITIVO"),
+ tr("Zerado"),
+ tr(" \u25EF SALDO ZERADO"),
+ tr("Negativo"),
+ tr(" \u2B24 SALDO NEGATIVO"),
+ tr("Falha ao aplicar permissões."),
+ tr("Janeiro"),
+ tr("Fevereiro"),
+ tr("Março"),
+ tr("Abril"),
+ tr("Maio"),
+ tr("Junho"),
+ tr("Julho"),
+ tr("Agosto"),
+ tr("Setembro"),
+ tr("Outubro"),
+ tr("Novembro"),
+ tr("Dezembro"),
+ tr("Erro ao atualizar os dados."),
+ tr("Deseja realmente deletar o item ")
+ };
+signals:
+
+};
+
+#endif // VIEWS_H