1 | #ifndef MAINWINDOW_H |
---|
2 | #define MAINWINDOW_H |
---|
3 | |
---|
4 | #include <QtGui> |
---|
5 | |
---|
6 | #include <formloadmatrix.H> |
---|
7 | #include <formviewmatrix.H> |
---|
8 | #include <formvariablesexogenas.h> |
---|
9 | #include <formexportmatrix.h> |
---|
10 | #include <formencadenamientos.h> |
---|
11 | #include <ui_formcompararresultados.h> |
---|
12 | #include <formcompararresultados.h> |
---|
13 | #include <ui_formcompararmnc.h> |
---|
14 | #include <formcompararmnc.h> |
---|
15 | |
---|
16 | #include <sstream> |
---|
17 | #include <stackwidget.H> |
---|
18 | #include <stackvariablesexogenas.h> |
---|
19 | #include <stackencadenamientos.h> |
---|
20 | |
---|
21 | #include <QTabWidget> |
---|
22 | |
---|
23 | #include <QMap> |
---|
24 | #include <QVector> |
---|
25 | |
---|
26 | #include <Eigen> |
---|
27 | |
---|
28 | |
---|
29 | class MainWindow : public QMainWindow |
---|
30 | { |
---|
31 | Q_OBJECT |
---|
32 | |
---|
33 | QMenu menuFile; |
---|
34 | QMenu OpMatrices; |
---|
35 | QMenu menuTools; |
---|
36 | QMenu menuViews; |
---|
37 | QMenu menuHelp; |
---|
38 | QMenu EndoExo; |
---|
39 | QMenu Modelos; |
---|
40 | |
---|
41 | QAction actionLoadMatrix; |
---|
42 | QAction actionExportMatrix; |
---|
43 | QAction actionQuit; |
---|
44 | |
---|
45 | QAction actionCH; |
---|
46 | QAction actionCV; |
---|
47 | QAction actionVariableExogena; |
---|
48 | QAction actionCTVEndEx; |
---|
49 | QAction actionLa; |
---|
50 | |
---|
51 | QAction actionEncadenamiento; |
---|
52 | QAction actionModeloClasico; |
---|
53 | QAction actionCompararResultados; |
---|
54 | QAction actionModeloNoClasico; |
---|
55 | QAction actionCompararResultadosMNC; |
---|
56 | |
---|
57 | |
---|
58 | QTableWidget * tableWidget; |
---|
59 | QTabWidget * tabWidget; |
---|
60 | QMap<QString,QStringList> diccCuentasExogenas; |
---|
61 | QMap<int,QVector<QString> > diccCuentasEndogenas; |
---|
62 | QMap<int,QVector<QString> > espacioCuentasExogenas; |
---|
63 | QMap<QString,QStringList> diccCuentasComponentes; |
---|
64 | QMap<QString,QStringList> diccCuentasEncadenamientos; |
---|
65 | |
---|
66 | QTableWidget *MatrizExgEnd; |
---|
67 | |
---|
68 | stackVariablesExogenas *stackVE; |
---|
69 | stackEncadenamientos *stackEncadenamiento; |
---|
70 | |
---|
71 | Eigen::MatrixXd MatrixMa; |
---|
72 | Eigen::MatrixXd MatrixMb; |
---|
73 | |
---|
74 | |
---|
75 | QString csvFilePath; |
---|
76 | char csvSeparator; |
---|
77 | int numAccounts; |
---|
78 | int matrixSize; |
---|
79 | int precission; |
---|
80 | double matrix[100][100]; |
---|
81 | |
---|
82 | double MatrizEndogenaEndogena[200][200]; |
---|
83 | |
---|
84 | int opcionCuentaExogena; |
---|
85 | int opcionVentanaExogena; |
---|
86 | int opcionExportarMatriz; |
---|
87 | int opcionEncadenamientos; |
---|
88 | int opcionCuentaEncadenamientos; |
---|
89 | int opcionMa; |
---|
90 | int opcionFormCompararResultados; |
---|
91 | int opcionFormCompararResultadosMNC; |
---|
92 | |
---|
93 | QVector<double> subtotalEnd; |
---|
94 | QVector<double> subtotalExog; |
---|
95 | QVector<double> subtotalExogEnd; |
---|
96 | |
---|
97 | int cantidadEncadenamientos; |
---|
98 | int cantidadEscenarios; |
---|
99 | int cantidadResultados; |
---|
100 | int cantidadMNC;//Cantidad de Modelos No Clasicos |
---|
101 | int cantidadResultadosMNC; |
---|
102 | |
---|
103 | FormLoadMatrix * formLoadMatrix; |
---|
104 | FormViewMatrix * formViewMatrix; |
---|
105 | FormVariablesExogenas * formVariablesExogenas; |
---|
106 | FormExportMatrix * formExportMatriz; |
---|
107 | FormEncadenamientos * formEncadenamientos; |
---|
108 | FormCompararResultados *formCompararResultados; |
---|
109 | FormCompararMNC *formCompararMNC; |
---|
110 | |
---|
111 | void initGUI(); |
---|
112 | |
---|
113 | void createCentralWidget(); |
---|
114 | void createMatrixCentralWidget(); |
---|
115 | |
---|
116 | void createMenuBar(); |
---|
117 | void matricesMenuBar(); |
---|
118 | void populateTable(QTableWidget *); |
---|
119 | void CalcularTotales(QTableWidget *, int inicio); |
---|
120 | void loadMatrizExogena(); |
---|
121 | void clonarTabla(QTableWidget *,QTableWidget *, int cantidad); |
---|
122 | void noEditColZero(QTableWidget *); |
---|
123 | void setAccountTitle(QTableWidget *); |
---|
124 | void insertremoveRowCol(QTableWidget *, int rowcol, bool opcion); |
---|
125 | void crearDiccionario(QTableWidget *, bool endogena=true); |
---|
126 | QStringList obtenerCuentasEndogenas(QTableWidget *,QStringList); |
---|
127 | QStringList obtenerCuentasExogenas(QTableWidget *,QStringList ); |
---|
128 | void spanEndogenaCell(QTableWidget *, int inicio, int celda, bool endex=true); |
---|
129 | void spanExogenaCell(QTableWidget *,int celda); |
---|
130 | void tableItem(QTableWidget *, int inicio, int fin, QString texto); |
---|
131 | |
---|
132 | QList<QString> llenarLista(QList<QString>, QTableWidget *, int valor, int opcion); |
---|
133 | void insertRowExogena(QList<QString>, QTableWidget *, int opcion); |
---|
134 | void setEndogenaExogenaCell(QTableWidget *, int inicioExogena, int elementos,bool condicion); |
---|
135 | void CalcularAn(QTableWidget *, QTableWidget *, QTableWidget *, int count, bool endogena = false); |
---|
136 | QString Separador(QTableWidgetItem *,bool quitar); |
---|
137 | void ItemsNoEditable(QTableWidget *, int inicio, int fin, int col=0); |
---|
138 | void CellStyle(QTableWidgetItem *); |
---|
139 | void CellStyleComponente(QTableWidgetItem *); |
---|
140 | void CellStyleExEn(QTableWidgetItem *); |
---|
141 | void EndogenaAn(); |
---|
142 | |
---|
143 | void obtenerCuentaComponentes(); |
---|
144 | void crearTablaVaciaEncadenamiento(int columnas, QTableWidget *, int filas=4); |
---|
145 | void crearMatrizEncadenamiento(QTableWidget *, QTableWidget *); |
---|
146 | void crearMatrizEncadenamientoEndogena(QTableWidget *, QTableWidget *); |
---|
147 | void calcularTotalesEncadenamientos(QTableWidget *); |
---|
148 | void encademientosStyle(QTableWidgetItem *); |
---|
149 | |
---|
150 | void calcularSubtotal(QTableWidget *, int inicio, int fin, int exogena); |
---|
151 | void llenarEscenario(QTableWidget *, bool clasico=true); |
---|
152 | void calcularFinEscenario(QTableWidget *); |
---|
153 | QVector<double> obtenerResultadoEscenario(QVector<double>); |
---|
154 | QStringList obtenerNombreResultadoEscenario(); |
---|
155 | void crearTablaComparar(QTableWidget *, QTableWidget *); |
---|
156 | void cuentacomponentesResultado(QTableWidget *, int count, bool clasico = true); |
---|
157 | void validar(); |
---|
158 | |
---|
159 | void obtenerMatrizExgEnd(); |
---|
160 | void crearMatrizExgEnd(QTableWidget *,QTableWidget *,int elementos,int inicioExogena); |
---|
161 | void calcularMatrizExgEnd(QTableWidget *); |
---|
162 | void ctvMatrizExgEnd(QTableWidget *, QTableWidget *); |
---|
163 | void titlespanMatrizExgEnd(QTableWidget *); |
---|
164 | void estimarMb(QTableWidget *, QTableWidget *); |
---|
165 | void calcularSubtotalEndExg(); |
---|
166 | QVector<double> obtenerResultadoEscenarioMNC(QVector<double>); |
---|
167 | void calcularFinEscenarioMNC(QTableWidget *); |
---|
168 | QStringList obtenerNombreResultadoEscenarioMNC(); |
---|
169 | |
---|
170 | void crearMatrizEndogena(QTableWidget *); |
---|
171 | void restarIdentidadAn(QTableWidget *); |
---|
172 | void titleEndogena(QTableWidget *); |
---|
173 | |
---|
174 | bool ComprobarCuentas(); |
---|
175 | int ObtenerIndice(QString ); |
---|
176 | |
---|
177 | QStringList ObtenerNombreCuenta(int contador); |
---|
178 | QList<int> ObtenerLimitesCuenta(int contador,int opccion); |
---|
179 | QStringList ObtenerComponentes(QTableWidget *); |
---|
180 | void CrearTablaVacia(int contador,QTableWidget *); |
---|
181 | |
---|
182 | protected: |
---|
183 | void closeEvent(QCloseEvent *); |
---|
184 | |
---|
185 | private slots: |
---|
186 | void slotLoadMatrix(); |
---|
187 | void slotExportMatrix(); |
---|
188 | void slotFormLoadMatrixAccepted(const QString &, int, int); |
---|
189 | void slotFormLoadMatrixClosed(); |
---|
190 | |
---|
191 | void AgregarCuenta(); |
---|
192 | void RestaurarCeldas(); |
---|
193 | void FinalizarCuentas(); |
---|
194 | void ModificarCuenta(); |
---|
195 | void slotCoeficienteHorizontal(); |
---|
196 | void slotCoeficienteVertical(); |
---|
197 | void slotAccChange(); |
---|
198 | |
---|
199 | void slotVariableExogena(); |
---|
200 | void slotCloseExogena(); |
---|
201 | void slotAgregarExogena(); |
---|
202 | void slotFinalizarExogena(); |
---|
203 | void slotDeshacerExogena(); |
---|
204 | void AnMa(); |
---|
205 | |
---|
206 | void slotMa(); |
---|
207 | |
---|
208 | void slotEncadenamientos(); |
---|
209 | void slotCloseEncadenamiento(); |
---|
210 | void slotAgregarEncadenamiento(); |
---|
211 | void slotVerEncadenamiento(); |
---|
212 | |
---|
213 | void slotCloseExport(); |
---|
214 | void slotSaveExport(); |
---|
215 | void slotSearchExport(); |
---|
216 | |
---|
217 | void slotModeloClasico(); |
---|
218 | void calcularEscenario(bool clasico = true); |
---|
219 | void finalizarEscenario(); |
---|
220 | |
---|
221 | void slotModeloNoClasico(); |
---|
222 | void calcularEscenarioNC(); |
---|
223 | void finalizarEscenarioNC(); |
---|
224 | |
---|
225 | void slotCompararResultadosMNC(); |
---|
226 | void slotVerResultadoMNC(); |
---|
227 | |
---|
228 | void slotCompararResultados(); |
---|
229 | void slotVerResultado(); |
---|
230 | |
---|
231 | public: |
---|
232 | MainWindow(); |
---|
233 | std::vector<std::string> csv_read_row(std::string , char); |
---|
234 | std::vector<std::string> csv_read_row(std::istream &, char); |
---|
235 | QString numberFormat(double &); |
---|
236 | |
---|
237 | int contarElementosMap(QMap<QString, QStringList> diccionario); |
---|
238 | int retornarIndiceCuenta(QString nombre_cuenta); |
---|
239 | }; |
---|
240 | |
---|
241 | #endif // MAINWINDOW_H |
---|