1 | #ifndef MAINWINDOW_H |
---|
2 | #define MAINWINDOW_H |
---|
3 | |
---|
4 | #include <QtWidgets> |
---|
5 | |
---|
6 | #include <formloadmatrix.H> |
---|
7 | #include <ui_formLoadMatrix.h> |
---|
8 | #include <formviewmatrix.H> |
---|
9 | #include <formvariablesexogenas.h> |
---|
10 | #include <formexportmatrix.h> |
---|
11 | #include <formencadenamientos.h> |
---|
12 | #include <ui_formcompararresultados.h> |
---|
13 | #include <formcompararresultados.h> |
---|
14 | //Formulario para comparar el modelo no clasico |
---|
15 | #include <ui_formcompararmnc.h> |
---|
16 | #include <formcompararmnc.h> |
---|
17 | //Formulario de incidencias |
---|
18 | #include "ui_formincidenciai.h" |
---|
19 | #include <formincidenciai.h> |
---|
20 | #include <formpreciosnohomogeneos.h> |
---|
21 | //Formulario para exportar reporte |
---|
22 | #include <formexportreport.h> |
---|
23 | #include <ui_formexportreport.h> |
---|
24 | #include "accountwidget.H" |
---|
25 | //Formulario de descomposicon |
---|
26 | #include <formdescomposicion.h> |
---|
27 | #include <ui_formdescomposicion.h> |
---|
28 | //Formulario de Carga |
---|
29 | #include <formcargando.h> |
---|
30 | |
---|
31 | //Funciones genericas |
---|
32 | #include <genericFunctions.h> |
---|
33 | //Librería de gráficos |
---|
34 | #include <qcustomplot.h> |
---|
35 | #include <sstream> |
---|
36 | #include <stackwidget.H> |
---|
37 | #include <stackvariablesexogenas.h> |
---|
38 | #include <stackencadenamientos.h> |
---|
39 | #include <stackpreciosnohomogeneos.h> |
---|
40 | |
---|
41 | #include <QTabWidget> |
---|
42 | |
---|
43 | #include <QMap> |
---|
44 | #include <QVector> |
---|
45 | #include <QPrinter> |
---|
46 | |
---|
47 | #include <Eigen> |
---|
48 | |
---|
49 | |
---|
50 | class MainWindow : public QMainWindow |
---|
51 | { |
---|
52 | Q_OBJECT |
---|
53 | |
---|
54 | QMenu menuFile; |
---|
55 | QMenu menuTools; |
---|
56 | QMenu menuViews; |
---|
57 | QMenu menuHelp; |
---|
58 | |
---|
59 | QMenu CoeficientesTecnicos; |
---|
60 | QMenu Encadenamientos; |
---|
61 | |
---|
62 | QMenu Modelos; |
---|
63 | QMenu PHClasico; |
---|
64 | QMenu PHClasicoIncidencia; |
---|
65 | QMenu PHNoClasico; |
---|
66 | QMenu PHNoClasicoIncidencia; |
---|
67 | QMenu PreciosNH; |
---|
68 | QMenu PreciosNHIncidencia; |
---|
69 | |
---|
70 | //Acciones principales |
---|
71 | QAction actionLoadMatrix; |
---|
72 | QAction actionExportMatrix; |
---|
73 | QAction actionQuit; |
---|
74 | QAction actionNewProject; |
---|
75 | |
---|
76 | //Acciones del menú de coeficientes |
---|
77 | QAction actionCH; |
---|
78 | QAction actionCV; |
---|
79 | QAction actionVariableExogena; |
---|
80 | QAction actionEncadenamiento; |
---|
81 | |
---|
82 | //Acciones del Modelo clásico y no clásico |
---|
83 | QAction actionModeloClasico; |
---|
84 | QAction actionCompararResultados; |
---|
85 | QAction actionModeloNoClasico; |
---|
86 | QAction actionCompararResultadosMNC; |
---|
87 | |
---|
88 | //Acciones de precios homógeneos por módelo clásico |
---|
89 | QAction actionPHClasicoIncidencia100; |
---|
90 | QAction actionPHCIncidenciaCuenta; |
---|
91 | QAction actionPHCIncidenciaComponente; |
---|
92 | |
---|
93 | //Acciones de precios homógeneos por módelo no clásico |
---|
94 | QAction actionPHNoClasicoIncidencia100; |
---|
95 | QAction actionPHNCIncidenciaCuenta; |
---|
96 | QAction actionPHNCIncidenciaComponente; |
---|
97 | |
---|
98 | //Acciones de precios no homógeneos |
---|
99 | QAction actionPNHIncidencia100; |
---|
100 | QAction actionPNHIncidenciaCuenta; |
---|
101 | QAction actionPNHIncidenciaComponente; |
---|
102 | |
---|
103 | //Acción para la descomposición |
---|
104 | QAction actionDescomposicion; |
---|
105 | |
---|
106 | QAction actionSeleccionarTabla; |
---|
107 | |
---|
108 | //Acciones del manú de ayuda |
---|
109 | QAction actionManual; |
---|
110 | QAction actionAcercaDe; |
---|
111 | |
---|
112 | QTableWidget * tableWidget; |
---|
113 | QTabWidget * tabWidget; |
---|
114 | QMap<QString,QStringList> diccCuentasExogenas; |
---|
115 | QMap<int,QVector<QString> > diccCuentasEndogenas; |
---|
116 | QMap<int,QVector<QString> > espacioCuentasExogenas; |
---|
117 | QMap<int, QMap<QString,QStringList> > diccCuentasComponentes; |
---|
118 | QMap<int, QMap<QString,QStringList> > diccCuentasEncadenamientos; |
---|
119 | QMap<QString,double> totalCuentas; |
---|
120 | |
---|
121 | QStringList ComponentesEndogenos; |
---|
122 | |
---|
123 | QTableWidget *MatrizExgEnd; |
---|
124 | |
---|
125 | stackVariablesExogenas *stackVE; |
---|
126 | stackEncadenamientos *stackEncadenamiento; |
---|
127 | StackPreciosNoHomogeneos *stackPNH; |
---|
128 | |
---|
129 | //Matriz con la tabla principal |
---|
130 | Eigen::MatrixXd PrincipalTable; |
---|
131 | //Tabla de Exogenas y Endogenas |
---|
132 | Eigen::MatrixXd EndogenasyExogenas; |
---|
133 | //Tabla del sector B (exogena/endogena) |
---|
134 | Eigen::MatrixXd ExoEndo; |
---|
135 | //Matriz del Coeficiente Técnico |
---|
136 | Eigen::MatrixXd An; |
---|
137 | Eigen::MatrixXd MBn; |
---|
138 | //Matrices de los múltiplicadores de lontief |
---|
139 | Eigen::MatrixXd MatrixMa; |
---|
140 | Eigen::MatrixXd MatrixMb; |
---|
141 | Eigen::MatrixXd MatrizMat; |
---|
142 | Eigen::MatrixXd MatrizMbt; |
---|
143 | //Matrices para la descomposicion |
---|
144 | Eigen::MatrixXd A0; |
---|
145 | Eigen::MatrixXd M1; |
---|
146 | Eigen::MatrixXd M2; |
---|
147 | Eigen::MatrixXd M3; |
---|
148 | Eigen::MatrixXd T; |
---|
149 | Eigen::MatrixXd O; |
---|
150 | Eigen::MatrixXd C; |
---|
151 | |
---|
152 | double total_ma; |
---|
153 | |
---|
154 | QString csvFilePath; |
---|
155 | char csvSeparator; |
---|
156 | int numAccounts; |
---|
157 | int matrixSize; |
---|
158 | int precission; |
---|
159 | |
---|
160 | QString componentePNH; |
---|
161 | |
---|
162 | Eigen::MatrixXd MatrizEndogenaEndogena; |
---|
163 | |
---|
164 | int opcionCuentaExogena; |
---|
165 | int opcionVentanaExogena; |
---|
166 | int opcionExportarMatriz; |
---|
167 | int opcionEncadenamientos; |
---|
168 | int opcionCuentaEncadenamientos; |
---|
169 | int opcionMa; |
---|
170 | int opcionMb; |
---|
171 | int opcionFormCompararResultados; |
---|
172 | int opcionFormCompararResultadosMNC; |
---|
173 | int opcionMAT; |
---|
174 | int opcionMBT; |
---|
175 | int opcionPNHT; |
---|
176 | int opcionFormPNH; |
---|
177 | |
---|
178 | QVector<double> subtotalEnd; |
---|
179 | QVector<double> subtotalExog; |
---|
180 | QVector<double> subtotalExogEnd; |
---|
181 | QVector<double> Vpond; |
---|
182 | //Son los vectores que almacenrán los totales del vectorFila y vectorColumna para An |
---|
183 | QVector<double> vFila; |
---|
184 | QVector<double> vColumna; |
---|
185 | |
---|
186 | int cantidadSelecciones; |
---|
187 | int cantidadEncadenamientos; |
---|
188 | int cantidadEscenarios; |
---|
189 | int cantidadResultados; |
---|
190 | int cantidadMNC;//Cantidad de Modelos No Clasicos |
---|
191 | int cantidadResultadosMNC; |
---|
192 | //Cantidad de resultados de incidencia en modelo de precios homogéneos clásico |
---|
193 | int cantidadPHCindidenciaiCuenta; |
---|
194 | int cantidadPHCindidenciaiComponente; |
---|
195 | //Cantidad de resultados de incidencia en modelo de precios homogéneos no clásico |
---|
196 | int cantidadPHNCindidenciaiCuenta; |
---|
197 | int cantidadPHNCindidenciaiComponente; |
---|
198 | //Cantidad de resultados de incidencia en modelo de precios no homogéneos |
---|
199 | int cantidadPNHincidencia100; |
---|
200 | int cantidadPNHincidenciaiCuenta; |
---|
201 | int cantidadPNHincidenciaiComponente; |
---|
202 | |
---|
203 | FormLoadMatrix * formLoadMatrix; |
---|
204 | FormMatrixView * formViewMatrix; |
---|
205 | FormVariablesExogenas * formVariablesExogenas; |
---|
206 | FormExportMatrix * formExportMatriz; |
---|
207 | FormEncadenamientos * formEncadenamientos; |
---|
208 | FormCompararResultados *formCompararResultados; |
---|
209 | FormCompararMNC *formCompararMNC; |
---|
210 | FormIncidenciaI *FI; |
---|
211 | FormPreciosNoHomogeneos * formPreciosNoHomogeneos; |
---|
212 | FormDescomposicion *formdescomposicion; |
---|
213 | |
---|
214 | void initGUI(); |
---|
215 | |
---|
216 | void createCentralWidget(); |
---|
217 | void createMatrixCentralWidget(); |
---|
218 | void loadsAccounts(QTableWidget *); |
---|
219 | void hideStackedWidget(); |
---|
220 | |
---|
221 | void createMenuBar(); |
---|
222 | void matricesMenuBar(); |
---|
223 | void populateTable(QTableWidget *); |
---|
224 | |
---|
225 | void CalcularTotales(QTableWidget *, int inicio, bool &); |
---|
226 | void TotalPrincipalTable(QTableWidget *, Eigen::MatrixXd & , int init); |
---|
227 | bool comprobarNombreCuenta(QString, int indice); |
---|
228 | void clonarTabla(QTableWidget *,QTableWidget *, int cantidad); |
---|
229 | void setAccountTitle(QTableWidget *); |
---|
230 | void insertremoveRowCol(QTableWidget *, int rowcol, bool opcion); |
---|
231 | void crearDiccionario(QTableWidget *, bool endogena=true); |
---|
232 | QStringList obtenerCuentasEndogenas(QTableWidget *,QStringList); |
---|
233 | QStringList obtenerCuentasExogenas(QTableWidget *,QStringList ); |
---|
234 | void spanEndogenaCell(QTableWidget *, int inicio, int celda, bool endex=true); |
---|
235 | void spanExogenaCell(QTableWidget *,int celda); |
---|
236 | |
---|
237 | void TotalEndoExoTable(int elementos, int cantidad); |
---|
238 | |
---|
239 | void setEndogenaExogenaCell(QTableWidget *, int inicioExogena, int elementos,bool condicion); |
---|
240 | void CalcularAn(QTableWidget *, QTableWidget *, QTableWidget *, int count, bool endogena = false); |
---|
241 | QString Separador(QTableWidgetItem *,bool quitar); |
---|
242 | void EndogenaAn(); |
---|
243 | |
---|
244 | void calcularTotalCuentas(QTableWidget *); |
---|
245 | void estimarVectorPonderacion(); |
---|
246 | |
---|
247 | void obtenerCuentaComponentes(); |
---|
248 | void crearMatrizEncadenamiento(QTableWidget *, QTableWidget *); |
---|
249 | void crearMatrizEncadenamientoEndogena(QTableWidget *, QTableWidget *, Eigen::MatrixXd Matrix); |
---|
250 | void calcularTotalesEncadenamientos(QTableWidget *); |
---|
251 | void cuentacomponentesEncadenamiento(QTableWidget *, int count); |
---|
252 | |
---|
253 | void calcularSubtotal(QTableWidget *,int inicio, int fin,int exogena); |
---|
254 | void llenarEscenario(QTableWidget *, bool clasico=true); |
---|
255 | void calcularFinEscenario(QTableWidget *); |
---|
256 | QVector<double> obtenerResultadoEscenario(QVector<double>); |
---|
257 | QStringList obtenerNombreResultadoEscenario(); |
---|
258 | void cuentacomponentesResultado(QTableWidget *, int count, bool clasico = true); |
---|
259 | |
---|
260 | void obtenerMatrizExgEnd(); |
---|
261 | void crearMatrizExgEnd(QTableWidget *,QTableWidget *,int elementos,int inicioExogena); |
---|
262 | void calcularMatrizExgEnd(QTableWidget *); |
---|
263 | void ctvMatrizExgEnd(QTableWidget *, QTableWidget *); |
---|
264 | void titlespanMatrizExgEnd(QTableWidget *); |
---|
265 | void estimarMb(QTableWidget *, QTableWidget *); |
---|
266 | void calcularSubtotalEndExg(); |
---|
267 | QVector<double> obtenerResultadoEscenarioMNC(QVector<double>); |
---|
268 | void calcularFinEscenarioMNC(QTableWidget *); |
---|
269 | QStringList obtenerNombreResultadoEscenarioMNC(); |
---|
270 | |
---|
271 | void restarIdentidadAn(QTableWidget *); |
---|
272 | void titleEndogena(QTableWidget *); |
---|
273 | |
---|
274 | void calcularMaT(); |
---|
275 | void calcularPHCIncidencia100(QTableWidget *); |
---|
276 | void calcularPHCIncidenciaI(QTableWidget *, QMap<QString, double>); |
---|
277 | void calcularPHCIncidenciaIComponente(QTableWidget *,QTableWidget *); |
---|
278 | |
---|
279 | void calcularMbT(); |
---|
280 | void calcularMb(); |
---|
281 | void calcularPHNCIncidencia100(QTableWidget *); |
---|
282 | void calcularVectorSend(QString componente, QVector<double> &); |
---|
283 | void multiplicarMatricesPNH(QTableWidget *, QVector<double>); |
---|
284 | void calcularPNHIncidencia100(QTableWidget *, Eigen::MatrixXd Diagonal); |
---|
285 | void crearFormularioPNH(); |
---|
286 | QStringList obtenerCuentas(); |
---|
287 | |
---|
288 | //Función estimar los vectores fila y columna para la clasificación en los encadenamientos |
---|
289 | void estimarVIFVC(); |
---|
290 | //Función para estimar la clasificación de las cuentas por CW o Rassmusen |
---|
291 | void estimarClasificador(double &, double &, int index, int total = 0); |
---|
292 | //Función para determinar los clasificadores |
---|
293 | void determinarClasificador(QTableWidget *, int index_table, int element, int total = 0); |
---|
294 | |
---|
295 | //Función para validar la cuenta producto/actividad |
---|
296 | bool validarDescomposicion(QStringList); |
---|
297 | |
---|
298 | //Funciones referentes a la descomposicion |
---|
299 | void calcularA0(QVector<double>); |
---|
300 | void calcularAuxiliares(); |
---|
301 | void calcularMatricesDescomposicion(); |
---|
302 | |
---|
303 | //Funcion para crear una nueva pestaña |
---|
304 | void createTab(QString , QTableWidget *,bool current=false); |
---|
305 | |
---|
306 | bool ComprobarCuentas(); |
---|
307 | int ObtenerIndice(QString ); |
---|
308 | |
---|
309 | QStringList ObtenerNombreCuenta(int contador); |
---|
310 | QList<int> ObtenerLimitesCuenta(int contador,int opccion); |
---|
311 | |
---|
312 | protected: |
---|
313 | void closeEvent(QCloseEvent *); |
---|
314 | |
---|
315 | private slots: |
---|
316 | void slotNuevoProyecto(); |
---|
317 | void slotLoadMatrix(); |
---|
318 | void slotExportMatrix(); |
---|
319 | |
---|
320 | void slotFormLoadMatrixAccepted(const QString &, int, int); |
---|
321 | void slotFormLoadMatrixClosed(); |
---|
322 | void slotOnlyaccount(); |
---|
323 | void slotOnlycomponent(); |
---|
324 | |
---|
325 | void AgregarCuenta(); |
---|
326 | void RestaurarCeldas(); |
---|
327 | void FinalizarCuentas(); |
---|
328 | void ModificarCuenta(); |
---|
329 | void slotCoeficienteHorizontal(); |
---|
330 | void slotCoeficienteVertical(); |
---|
331 | void slotAccChange(); |
---|
332 | |
---|
333 | //Slots para las variables exógenas |
---|
334 | void slotVariableExogena(); |
---|
335 | void slotCloseExogena(); |
---|
336 | void slotAgregarExogena(); |
---|
337 | void slotFinalizarExogena(); |
---|
338 | void slotDeshacerExogena(); |
---|
339 | |
---|
340 | void slotMa(); |
---|
341 | |
---|
342 | //Slots para encadenamientos |
---|
343 | void slotEncadenamientos(); |
---|
344 | void slotCloseEncadenamiento(); |
---|
345 | void slotAgregarEncadenamiento(); |
---|
346 | void slotVerEncadenamiento(); |
---|
347 | |
---|
348 | //Slots para reportes |
---|
349 | void slotEncadenamientoReport(); |
---|
350 | void slotGenerarEncadenamientoReport(QString,bool); |
---|
351 | |
---|
352 | //Slots para gráfico |
---|
353 | void slotEncadenamientoGraphic(); |
---|
354 | |
---|
355 | //Slots para exportar |
---|
356 | void slotCloseExport(); |
---|
357 | void slotSaveExport(); |
---|
358 | void slotSearchExport(); |
---|
359 | |
---|
360 | //Slots para el modelo clásico |
---|
361 | void slotModeloClasico(); |
---|
362 | void calcularEscenario(bool clasico = true); |
---|
363 | void finalizarEscenario(); |
---|
364 | |
---|
365 | //Slots para el modelo no clásico |
---|
366 | void slotModeloNoClasico(); |
---|
367 | void calcularEscenarioNC(); |
---|
368 | void finalizarEscenarioNC(); |
---|
369 | |
---|
370 | //Slot para descomposicion |
---|
371 | void slotDescomposicion(); |
---|
372 | void slotAgregarDescomposicion(); |
---|
373 | |
---|
374 | void slotCompararResultadosMNC(); |
---|
375 | void slotVerResultadoMNC(); |
---|
376 | |
---|
377 | void slotPHCIncidencia100(); |
---|
378 | void slotPHCIncidenciaiCuenta(); |
---|
379 | void slotCalcularPHCIncidenciaiCuenta(); |
---|
380 | void slotPHCIncidenciaiComponente(); |
---|
381 | void slotCalcularPHCIncidenciaiComponente(); |
---|
382 | |
---|
383 | void slotCompararResultados(); |
---|
384 | void slotVerResultado(); |
---|
385 | |
---|
386 | void slotPHNCIncidencia100(); |
---|
387 | void slotPHNCIncidenciaiCuenta(); |
---|
388 | void slotCalcularPHNCIncidenciaiCuenta(); |
---|
389 | void slotPHNCIncidenciaiComponente(); |
---|
390 | void slotCalcularPHNCIncidenciaiComponente(); |
---|
391 | |
---|
392 | void slotPNHIncudencia100(); |
---|
393 | void slotCloseformPNH(); |
---|
394 | void slotSelectPNH(); |
---|
395 | void slotPNHIncidenciaiCuenta(); |
---|
396 | void slotPNHIncidenciaiComponente(); |
---|
397 | void slotSelectPNHi(); |
---|
398 | void slotCalcularPNHIncidenciaiCuenta(); |
---|
399 | void slotSelectPNHic(); |
---|
400 | void slotCalcularPNHIncidenciaiComponente(); |
---|
401 | |
---|
402 | void slotSeleccionarTabla(); |
---|
403 | |
---|
404 | //Slots del menú de ayuda |
---|
405 | void abrirManual(); |
---|
406 | void acercaDe(); |
---|
407 | |
---|
408 | public: |
---|
409 | MainWindow(); |
---|
410 | QString numberFormat(double &); |
---|
411 | }; |
---|
412 | |
---|
413 | #endif // MAINWINDOW_H |
---|