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