forked from arcnexus/RedFoX
-
Notifications
You must be signed in to change notification settings - Fork 0
/
configuracion.h
258 lines (228 loc) · 7.83 KB
/
configuracion.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
#ifndef CONFIGURACION_H
#define CONFIGURACION_H
#include <QString>
#include <QSqlDatabase>
#include <QSqlQuery>
#include <QFileDialog>
#include <QSettings>
#include <QVariant>
#include <QMessageBox>
#include <QApplication>
#include <QSqlRecord>
#include <QSqlTableModel>
#include <QObject>
#include <QDoubleValidator>
#include <QNetworkReply>
//CryptoPP headers
#ifdef Q_OS_WIN32
#include <C:/CriptoCpp/modes.h>
#include <C:/CriptoCpp/filters.h>
#include <C:/CriptoCpp/aes.h>
#include <C:/CriptoCpp/sha.h>
#include <C:/CriptoCpp/base64.h>
#else
#include </usr/include/cryptopp/modes.h>
#include </usr/include/cryptopp/filters.h>
#include </usr/include/cryptopp/aes.h>
#include </usr/include/cryptopp/sha.h>
#include </usr/include/cryptopp/base64.h>
#endif
class Configuracion: public QObject
{
Q_OBJECT
public:
Configuracion(QObject * parent = 0);
bool importado_sp;
QSqlDatabase globalDB;
QString global_driver;
QString global_host;
QString global_user;
QString global_pass;
int global_port;
QString global_routeLite;
QSqlDatabase groupDB;
QSqlDatabase groupDB2;
QString group_DBName;
QString group_host;
QString group_user;
QString group_pass;
int group_port;
QString group_Driver;
QSqlDatabase empresaDB;
QString nombre_bd_empresa;
QString ruta_bd_empresa;
QSqlDatabase reportsDB;
QSqlDatabase medicaDB;
QString nombre_bd_medica;
QString ruta_bd_medica;
QSqlDatabase contaDB;
QString nombre_bd_conta;
QString RutaBD_Conta;
QString nombre_bdTiendaWeb;
QString cHostBDTiendaWeb;
QString cUsuarioTiendaWeb;
QString cPasswordTiendaWeb;
QString cPuertoTiendaWeb;
QString HostDB_MediTec;
QString NombreDB_MediTec;
QString UsuarioDB_MediTec;
QString PasswordDB_MediTec;
QString PortDB_MediTec;
QString serie;
int ndigitos_factura;
QString cConector;
int idEmpresa;
QString cCodEmpresaActiva;
QString nombreEmpresa;
bool contabilidad;
bool ticket_factura;
bool enlace_web;
QString pais;
QString cEjercicio;
QString cEmpresaActiva;
QString cUsuarioActivo;
int id_usuario_activo;
QString cNivelUsuarioActivo;
int nivel;
QSqlDatabase dbConfiguracion;
QSqlDatabase dbWeb;
QSqlDatabase db_meditec;
QSqlQuery *QryConfiguracion;
QFileDialog dialogo;
bool auto_codigoart;
int tamano_codigo;
int decimales_campos_totales;
int decimales;
bool mostrar_siempre; // si está activo mostrará los 0 en decimales a partir de estandar (2) hasta valor decimales
bool medic;
bool internacional;
bool tpv_forzar_cantidad;
QString divisa_local;
QString cod_divisa_local;
QString divisa_local_reducida;
double margen;
double margen_minimo;
bool activar_seguimiento;
QString caja;
double Importe_apertura;
int caducidad_vales;
QHash <QString,QSqlRecord> ivas;
QSqlTableModel* iva_model;
QStringList ivaList;
QStringList grupo_iva;
QStringList reList;
void Cargar_iva();
int getidIva(QString cIva);
QString setTipoIva(int idIva);
QHash <QString,QSqlRecord> paises;
//QSqlTableModel* paises_model;
QSqlQueryModel *paises_model;
void Cargar_paises();
int Devolver_id_pais(QString pais);
static QString Devolver_pais(int id);
QString Devolver_moneda(int id);
QString Devolver_codDivisa(int id);
int Devolver_id_moneda(QString cDivisa);
QString Devolver_idioma(int id);
int Devolver_id_idioma(QString idioma);
int Devolver_id_forma_pago(QString forma_pago);
int Devolver_id_codigo_forma_pago(QString codigo);
QString Devolver_forma_pago(int id);
QString Devolver_codigo_forma_pago(int id);
int Devolver_id_tarifa(QString cTarifa);
QString Devolver_tarifa(int id_tarifa);
QString Devolver_tipo_gasto(int id_gasto);
int Devolver_id_tipo_gasto(QString desc);
int Devolver_id_cuenta_contable(QString codigo_cta);
QString Devolver_descripcion_tipo_iva(double tipo);
QString Devolver_descripcion_cuenta_contable(QString codigo_cta);
QString Devolver_codigo_cta_contable(int id);
QString devolver_codigo_articulo(int id);
QString devolver_codigo_barras(int id);
QString devolver_referencia_articulo(int id);
float Devolver_iva(int id);
float devolver_rec_iva(float porc_iva);
QString toRound(double number, int decimals);
QString devolver_agente(int id);
int devolver_id_agente(QString agente);
QString devolver_transportista(int id);
int devolver_id_transportista(QString transportista);
QSqlTableModel* client_model;
int devolver_id_tabla(QSqlQueryModel *model, QModelIndex index);
void CargarClientes();
QSqlTableModel* usuarios_model;
void CargarUsuarios();
bool lProfesional;
int irpf;
float porc_irpf;
int digitos_cuentas_contables;
QString cuenta_clientes;
QString cuenta_proveedores;
QString cuenta_acreedores;
QString cuenta_iva_repercutido1;
QString cuenta_iva_repercutido2;
QString cuenta_iva_repercutido3;
QString cuenta_iva_repercutido4;
QString cuenta_iva_soportado1;
QString cuenta_iva_soportado2;
QString cuenta_iva_soportado3;
QString cuenta_iva_soportado4;
QString cuenta_iva_repercutidoRe1;
QString cuenta_iva_repercutidoRe2;
QString cuenta_iva_repercutidoRe3;
QString cuenta_iva_repercutidoRe4;
QString cuenta_iva_soportado_re1;
QString cuenta_iva_soportado_re2;
QString cuenta_iva_soportado_re3;
QString cuenta_iva_soportado_re4;
QString cuenta_deudasClientes;
QString cuenta_cobrosClientes;
QString cuenta_deudasProveedor;
QString cuenta_pagosProveedor;
QString cuenta_venta_mercaderias;
QString cuenta_venta_servicios;
int id_tarifa_predeterminada;
bool actualizar_divisas;
QString toFormatoMoneda(QString cTexto);
double MonedatoDouble(QString moneda);
bool EsNumero(QString texto);
void CargarDatos(int id);
bool CargarDatosBD();
void AbrirDbWeb();
void CerrarDbWeb();
void AbridBDMediTec();
void CerrarBDMediTec();
QString ValidarCC(QString Entidad,QString Oficina, QString DC, QString CC);
QString ValidarCC(QString Entidad, QString Oficina, QString CC);
QString ValidarnifE(QString Nif);
QDoubleValidator *validator_cantidad;
QDoubleValidator *validator_porciento;
static QString letraDNI(QString Nif);
static bool comprobarNIF(QString country_code, QString nif);
static QString Crypt(QString input);
static QString DeCrypt(QString input);
static QString SHA256HashString(QString input);
void getCambio(QString from, QString to , float cuanty = 1);
float getCambioBlock(QString from, QString to , float cuanty = 1);
void updateTablaDivisas(QString current);
static void ImprimirDirecto(QString report, QMap<QString,QString> queryClausules,QMap<QString, QString> params);
static void ImprimirPDF(QString report, QMap<QString,QString> queryClausules, QMap<QString, QString> params);
static void ImprimirPreview(QString report, QMap<QString,QString> queryClausules,QMap<QString, QString> params);
public slots:
void format_text();
private slots:
void cambioReply(QNetworkReply * reply);
void cambioReplyBlock(QNetworkReply * reply);
void applyCambio(float f,QString target);
signals:
void cambioReady(float,QString target = "");
private:
void readCambio(QString s);
float readCambioBlock(QString s);
static byte key[ CryptoPP::AES::DEFAULT_KEYLENGTH ];
static byte iv[ CryptoPP::AES::BLOCKSIZE ];
bool _block;
float _cambio;
static void setUpKeys();
};
#endif // CONFIGURACION_H