[44d1e60] | 1 | #ifndef MAINWINDOW_H |
---|
| 2 | #define MAINWINDOW_H |
---|
| 3 | |
---|
| 4 | #include <QtGui> |
---|
[8daa049] | 5 | |
---|
[44d1e60] | 6 | #include <formloadmatrix.H> |
---|
| 7 | #include <formviewmatrix.H> |
---|
[9dd61b1] | 8 | #include <formvariablesexogenas.h> |
---|
[8daa049] | 9 | #include <formexportmatrix.h> |
---|
| 10 | #include <formencadenamientos.h> |
---|
[fa3f7a3] | 11 | #include <ui_formcompararresultados.h> |
---|
| 12 | #include <formcompararresultados.h> |
---|
[96b0c4a] | 13 | #include <ui_formcompararmnc.h> |
---|
| 14 | #include <formcompararmnc.h> |
---|
[fc268a0] | 15 | #include "ui_formincidenciai.h" |
---|
| 16 | #include <formincidenciai.h> |
---|
[04999c9] | 17 | #include <formpreciosnohomogeneos.h> |
---|
[8daa049] | 18 | |
---|
[44d1e60] | 19 | #include <sstream> |
---|
| 20 | #include <stackwidget.H> |
---|
[9dd61b1] | 21 | #include <stackvariablesexogenas.h> |
---|
[8daa049] | 22 | #include <stackencadenamientos.h> |
---|
[04999c9] | 23 | #include <stackpreciosnohomogeneos.h> |
---|
[8daa049] | 24 | |
---|
| 25 | #include <QTabWidget> |
---|
| 26 | |
---|
[9dd61b1] | 27 | #include <QMap> |
---|
[8daa049] | 28 | #include <QVector> |
---|
| 29 | |
---|
[96b0c4a] | 30 | #include <Eigen> |
---|
| 31 | |
---|
[44d1e60] | 32 | |
---|
| 33 | class MainWindow : public QMainWindow |
---|
| 34 | { |
---|
| 35 | Q_OBJECT |
---|
| 36 | |
---|
| 37 | QMenu menuFile; |
---|
[9dd61b1] | 38 | QMenu OpMatrices; |
---|
[44d1e60] | 39 | QMenu menuTools; |
---|
| 40 | QMenu menuViews; |
---|
| 41 | QMenu menuHelp; |
---|
[9dd61b1] | 42 | QMenu EndoExo; |
---|
[fc268a0] | 43 | |
---|
[96b0c4a] | 44 | QMenu Modelos; |
---|
[fc268a0] | 45 | QMenu PHClasico; |
---|
| 46 | QMenu PHClasicoIncidencia; |
---|
[cfbc36f] | 47 | QMenu PHNoClasico; |
---|
| 48 | QMenu PHNoClasicoIncidencia; |
---|
[04999c9] | 49 | QMenu PreciosNH; |
---|
| 50 | QMenu PreciosNHIncidencia; |
---|
[9dd61b1] | 51 | |
---|
[44d1e60] | 52 | QAction actionLoadMatrix; |
---|
| 53 | QAction actionExportMatrix; |
---|
| 54 | QAction actionQuit; |
---|
[fc268a0] | 55 | QAction actionNewProject; |
---|
[9dd61b1] | 56 | |
---|
| 57 | QAction actionCH; |
---|
| 58 | QAction actionCV; |
---|
| 59 | QAction actionVariableExogena; |
---|
[fa3f7a3] | 60 | QAction actionCTVEndEx; |
---|
[9dd61b1] | 61 | QAction actionLa; |
---|
[fa3f7a3] | 62 | |
---|
[fc268a0] | 63 | QAction actionEncadenamiento; |
---|
| 64 | |
---|
[fa3f7a3] | 65 | QAction actionModeloClasico; |
---|
| 66 | QAction actionCompararResultados; |
---|
[67c9f67] | 67 | QAction actionModeloNoClasico; |
---|
[96b0c4a] | 68 | QAction actionCompararResultadosMNC; |
---|
[9dd61b1] | 69 | |
---|
[fc268a0] | 70 | QAction actionPHClasicoIncidencia100; |
---|
| 71 | QAction actionPHCIncidenciaCuenta; |
---|
| 72 | QAction actionPHCIncidenciaComponente; |
---|
| 73 | |
---|
[cfbc36f] | 74 | QAction actionPHNoClasicoIncidencia100; |
---|
| 75 | QAction actionPHNCIncidenciaCuenta; |
---|
| 76 | QAction actionPHNCIncidenciaComponente; |
---|
[9dd61b1] | 77 | |
---|
[04999c9] | 78 | QAction actionPNHIncidencia100; |
---|
| 79 | QAction actionPNHIncidenciaCuenta; |
---|
| 80 | QAction actionPNHIncidenciaComponente; |
---|
| 81 | |
---|
[44d1e60] | 82 | QTableWidget * tableWidget; |
---|
[9dd61b1] | 83 | QTabWidget * tabWidget; |
---|
| 84 | QMap<QString,QStringList> diccCuentasExogenas; |
---|
[8daa049] | 85 | QMap<int,QVector<QString> > diccCuentasEndogenas; |
---|
| 86 | QMap<int,QVector<QString> > espacioCuentasExogenas; |
---|
| 87 | QMap<QString,QStringList> diccCuentasComponentes; |
---|
| 88 | QMap<QString,QStringList> diccCuentasEncadenamientos; |
---|
[fc268a0] | 89 | QMap<QString,double> totalCuentas; |
---|
| 90 | |
---|
| 91 | QStringList ComponentesEndogenos; |
---|
[9dd61b1] | 92 | |
---|
[96b0c4a] | 93 | QTableWidget *MatrizExgEnd; |
---|
| 94 | |
---|
[9dd61b1] | 95 | stackVariablesExogenas *stackVE; |
---|
[8daa049] | 96 | stackEncadenamientos *stackEncadenamiento; |
---|
[04999c9] | 97 | StackPreciosNoHomogeneos *stackPNH; |
---|
[9dd61b1] | 98 | |
---|
[96b0c4a] | 99 | Eigen::MatrixXd MatrixMa; |
---|
| 100 | Eigen::MatrixXd MatrixMb; |
---|
[fc268a0] | 101 | Eigen::MatrixXd MatrizMat; |
---|
[cfbc36f] | 102 | Eigen::MatrixXd MatrizMbt; |
---|
[96b0c4a] | 103 | |
---|
[44d1e60] | 104 | |
---|
| 105 | QString csvFilePath; |
---|
| 106 | char csvSeparator; |
---|
| 107 | int numAccounts; |
---|
| 108 | int matrixSize; |
---|
[96b0c4a] | 109 | int precission; |
---|
[44d1e60] | 110 | double matrix[100][100]; |
---|
[bd5e45b] | 111 | |
---|
[04999c9] | 112 | QString componentePNH; |
---|
| 113 | |
---|
[8daa049] | 114 | double MatrizEndogenaEndogena[200][200]; |
---|
| 115 | |
---|
[bd5e45b] | 116 | int opcionCuentaExogena; |
---|
| 117 | int opcionVentanaExogena; |
---|
| 118 | int opcionExportarMatriz; |
---|
[8daa049] | 119 | int opcionEncadenamientos; |
---|
| 120 | int opcionCuentaEncadenamientos; |
---|
[fa3f7a3] | 121 | int opcionMa; |
---|
[cfbc36f] | 122 | int opcionMb; |
---|
[fa3f7a3] | 123 | int opcionFormCompararResultados; |
---|
[96b0c4a] | 124 | int opcionFormCompararResultadosMNC; |
---|
[fc268a0] | 125 | int opcionMAT; |
---|
[cfbc36f] | 126 | int opcionMBT; |
---|
[04999c9] | 127 | int opcionPNHT; |
---|
| 128 | int opcionFormPNH; |
---|
[fa3f7a3] | 129 | |
---|
| 130 | QVector<double> subtotalEnd; |
---|
| 131 | QVector<double> subtotalExog; |
---|
[96b0c4a] | 132 | QVector<double> subtotalExogEnd; |
---|
[fc268a0] | 133 | QVector<double> Vpond; |
---|
[8daa049] | 134 | |
---|
| 135 | int cantidadEncadenamientos; |
---|
[fa3f7a3] | 136 | int cantidadEscenarios; |
---|
| 137 | int cantidadResultados; |
---|
[96b0c4a] | 138 | int cantidadMNC;//Cantidad de Modelos No Clasicos |
---|
| 139 | int cantidadResultadosMNC; |
---|
[04999c9] | 140 | //Cantidad de resultados de incidencia en modelo de precios homogéneos clásico |
---|
[fc268a0] | 141 | int cantidadPHCindidenciaiCuenta; |
---|
| 142 | int cantidadPHCindidenciaiComponente; |
---|
[04999c9] | 143 | //Cantidad de resultados de incidencia en modelo de precios homogéneos no clásico |
---|
[cfbc36f] | 144 | int cantidadPHNCindidenciaiCuenta; |
---|
| 145 | int cantidadPHNCindidenciaiComponente; |
---|
[04999c9] | 146 | //Cantidad de resultados de incidencia en modelo de precios no homogéneos |
---|
| 147 | int cantidadPNHincidencia100; |
---|
| 148 | int cantidadPNHincidenciaiCuenta; |
---|
| 149 | int cantidadPNHincidenciaiComponente; |
---|
[44d1e60] | 150 | |
---|
| 151 | FormLoadMatrix * formLoadMatrix; |
---|
| 152 | FormViewMatrix * formViewMatrix; |
---|
[9dd61b1] | 153 | FormVariablesExogenas * formVariablesExogenas; |
---|
[bd5e45b] | 154 | FormExportMatrix * formExportMatriz; |
---|
[8daa049] | 155 | FormEncadenamientos * formEncadenamientos; |
---|
[fa3f7a3] | 156 | FormCompararResultados *formCompararResultados; |
---|
[96b0c4a] | 157 | FormCompararMNC *formCompararMNC; |
---|
[fc268a0] | 158 | FormIncidenciaI *FI; |
---|
[04999c9] | 159 | FormPreciosNoHomogeneos * formPreciosNoHomogeneos; |
---|
[44d1e60] | 160 | |
---|
| 161 | void initGUI(); |
---|
| 162 | |
---|
| 163 | void createCentralWidget(); |
---|
| 164 | void createMatrixCentralWidget(); |
---|
| 165 | |
---|
| 166 | void createMenuBar(); |
---|
[9dd61b1] | 167 | void matricesMenuBar(); |
---|
[44d1e60] | 168 | void populateTable(QTableWidget *); |
---|
[9dd61b1] | 169 | void CalcularTotales(QTableWidget *, int inicio); |
---|
| 170 | void loadMatrizExogena(); |
---|
| 171 | void clonarTabla(QTableWidget *,QTableWidget *, int cantidad); |
---|
| 172 | void noEditColZero(QTableWidget *); |
---|
| 173 | void setAccountTitle(QTableWidget *); |
---|
| 174 | void insertremoveRowCol(QTableWidget *, int rowcol, bool opcion); |
---|
[8daa049] | 175 | void crearDiccionario(QTableWidget *, bool endogena=true); |
---|
| 176 | QStringList obtenerCuentasEndogenas(QTableWidget *,QStringList); |
---|
| 177 | QStringList obtenerCuentasExogenas(QTableWidget *,QStringList ); |
---|
| 178 | void spanEndogenaCell(QTableWidget *, int inicio, int celda, bool endex=true); |
---|
| 179 | void spanExogenaCell(QTableWidget *,int celda); |
---|
[e506dab] | 180 | void tableItem(QTableWidget *, int inicio, int fin, QString texto); |
---|
[9dd61b1] | 181 | |
---|
| 182 | QList<QString> llenarLista(QList<QString>, QTableWidget *, int valor, int opcion); |
---|
| 183 | void insertRowExogena(QList<QString>, QTableWidget *, int opcion); |
---|
| 184 | void setEndogenaExogenaCell(QTableWidget *, int inicioExogena, int elementos,bool condicion); |
---|
[67c9f67] | 185 | void CalcularAn(QTableWidget *, QTableWidget *, QTableWidget *, int count, bool endogena = false); |
---|
[bd5e45b] | 186 | QString Separador(QTableWidgetItem *,bool quitar); |
---|
[8daa049] | 187 | void ItemsNoEditable(QTableWidget *, int inicio, int fin, int col=0); |
---|
[aa628c3] | 188 | void CellStyle(QTableWidgetItem *); |
---|
[cfdcc67] | 189 | void CellStyleComponente(QTableWidgetItem *); |
---|
| 190 | void CellStyleExEn(QTableWidgetItem *); |
---|
[aa628c3] | 191 | void EndogenaAn(); |
---|
[9dd61b1] | 192 | |
---|
[fc268a0] | 193 | void calcularTotalCuentas(QTableWidget *); |
---|
| 194 | void estimarVectorPonderacion(QTableWidget *); |
---|
| 195 | |
---|
[8daa049] | 196 | void obtenerCuentaComponentes(); |
---|
[fc268a0] | 197 | void crearTablaVaciaEncadenamiento(int filas, QTableWidget *, int columnas=4); |
---|
[8daa049] | 198 | void crearMatrizEncadenamiento(QTableWidget *, QTableWidget *); |
---|
| 199 | void crearMatrizEncadenamientoEndogena(QTableWidget *, QTableWidget *); |
---|
| 200 | void calcularTotalesEncadenamientos(QTableWidget *); |
---|
| 201 | void encademientosStyle(QTableWidgetItem *); |
---|
| 202 | |
---|
[cfbc36f] | 203 | void calcularSubtotal(QTableWidget *,int inicio, int fin,int exogena); |
---|
[96b0c4a] | 204 | void llenarEscenario(QTableWidget *, bool clasico=true); |
---|
[fa3f7a3] | 205 | void calcularFinEscenario(QTableWidget *); |
---|
| 206 | QVector<double> obtenerResultadoEscenario(QVector<double>); |
---|
| 207 | QStringList obtenerNombreResultadoEscenario(); |
---|
| 208 | void crearTablaComparar(QTableWidget *, QTableWidget *); |
---|
[96b0c4a] | 209 | void cuentacomponentesResultado(QTableWidget *, int count, bool clasico = true); |
---|
[fa3f7a3] | 210 | void validar(); |
---|
| 211 | |
---|
[67c9f67] | 212 | void obtenerMatrizExgEnd(); |
---|
| 213 | void crearMatrizExgEnd(QTableWidget *,QTableWidget *,int elementos,int inicioExogena); |
---|
| 214 | void calcularMatrizExgEnd(QTableWidget *); |
---|
| 215 | void ctvMatrizExgEnd(QTableWidget *, QTableWidget *); |
---|
| 216 | void titlespanMatrizExgEnd(QTableWidget *); |
---|
| 217 | void estimarMb(QTableWidget *, QTableWidget *); |
---|
[96b0c4a] | 218 | void calcularSubtotalEndExg(); |
---|
| 219 | QVector<double> obtenerResultadoEscenarioMNC(QVector<double>); |
---|
| 220 | void calcularFinEscenarioMNC(QTableWidget *); |
---|
| 221 | QStringList obtenerNombreResultadoEscenarioMNC(); |
---|
[67c9f67] | 222 | |
---|
[9dd61b1] | 223 | void crearMatrizEndogena(QTableWidget *); |
---|
[8daa049] | 224 | void restarIdentidadAn(QTableWidget *); |
---|
| 225 | void titleEndogena(QTableWidget *); |
---|
[9dd61b1] | 226 | |
---|
[fc268a0] | 227 | void calcularMaT(); |
---|
| 228 | void calcularPHCIncidencia100(QTableWidget *); |
---|
| 229 | void calcularPHCIncidenciaI(QTableWidget *, QMap<QString, double>); |
---|
| 230 | void calcularPHCIncidenciaIComponente(QTableWidget *,QTableWidget *); |
---|
| 231 | |
---|
[cfbc36f] | 232 | void calcularMbT(); |
---|
| 233 | void calcularMb(); |
---|
[04999c9] | 234 | void calcularPHNCIncidencia100(QTableWidget *); |
---|
| 235 | void calcularVectorSend(QString componente, QVector<double> &); |
---|
| 236 | void multiplicarMatricesPNH(QTableWidget *, QVector<double>); |
---|
| 237 | void calcularPNHIncidencia100(QTableWidget *, Eigen::MatrixXd Diagonal); |
---|
| 238 | void crearFormularioPNH(); |
---|
[cfbc36f] | 239 | |
---|
[9dd61b1] | 240 | bool ComprobarCuentas(); |
---|
| 241 | int ObtenerIndice(QString ); |
---|
| 242 | |
---|
| 243 | QStringList ObtenerNombreCuenta(int contador); |
---|
| 244 | QList<int> ObtenerLimitesCuenta(int contador,int opccion); |
---|
| 245 | QStringList ObtenerComponentes(QTableWidget *); |
---|
| 246 | void CrearTablaVacia(int contador,QTableWidget *); |
---|
[44d1e60] | 247 | |
---|
| 248 | protected: |
---|
| 249 | void closeEvent(QCloseEvent *); |
---|
| 250 | |
---|
| 251 | private slots: |
---|
[fc268a0] | 252 | void slotNuevoProyecto(); |
---|
[44d1e60] | 253 | void slotLoadMatrix(); |
---|
| 254 | void slotExportMatrix(); |
---|
[96b0c4a] | 255 | void slotFormLoadMatrixAccepted(const QString &, int, int); |
---|
[44d1e60] | 256 | void slotFormLoadMatrixClosed(); |
---|
| 257 | |
---|
[9dd61b1] | 258 | void AgregarCuenta(); |
---|
| 259 | void RestaurarCeldas(); |
---|
| 260 | void FinalizarCuentas(); |
---|
| 261 | void ModificarCuenta(); |
---|
| 262 | void slotCoeficienteHorizontal(); |
---|
| 263 | void slotCoeficienteVertical(); |
---|
[67c9f67] | 264 | void slotAccChange(); |
---|
[9dd61b1] | 265 | |
---|
| 266 | void slotVariableExogena(); |
---|
| 267 | void slotCloseExogena(); |
---|
| 268 | void slotAgregarExogena(); |
---|
| 269 | void slotFinalizarExogena(); |
---|
| 270 | void slotDeshacerExogena(); |
---|
[67c9f67] | 271 | void AnMa(); |
---|
[fa3f7a3] | 272 | |
---|
| 273 | void slotMa(); |
---|
[9dd61b1] | 274 | |
---|
[8daa049] | 275 | void slotEncadenamientos(); |
---|
| 276 | void slotCloseEncadenamiento(); |
---|
| 277 | void slotAgregarEncadenamiento(); |
---|
| 278 | void slotVerEncadenamiento(); |
---|
| 279 | |
---|
[bd5e45b] | 280 | void slotCloseExport(); |
---|
| 281 | void slotSaveExport(); |
---|
| 282 | void slotSearchExport(); |
---|
| 283 | |
---|
[fa3f7a3] | 284 | void slotModeloClasico(); |
---|
[96b0c4a] | 285 | void calcularEscenario(bool clasico = true); |
---|
[fa3f7a3] | 286 | void finalizarEscenario(); |
---|
| 287 | |
---|
[67c9f67] | 288 | void slotModeloNoClasico(); |
---|
[96b0c4a] | 289 | void calcularEscenarioNC(); |
---|
| 290 | void finalizarEscenarioNC(); |
---|
| 291 | |
---|
| 292 | void slotCompararResultadosMNC(); |
---|
| 293 | void slotVerResultadoMNC(); |
---|
[67c9f67] | 294 | |
---|
[fc268a0] | 295 | void slotPHCIncidencia100(); |
---|
| 296 | void slotPHCIncidenciaiCuenta(); |
---|
| 297 | void slotCalcularPHCIncidenciaiCuenta(); |
---|
| 298 | void slotPHCIncidenciaiComponente(); |
---|
| 299 | void slotCalcularPHCIncidenciaiComponente(); |
---|
| 300 | |
---|
[fa3f7a3] | 301 | void slotCompararResultados(); |
---|
| 302 | void slotVerResultado(); |
---|
| 303 | |
---|
[cfbc36f] | 304 | void slotPHNCIncidencia100(); |
---|
| 305 | void slotPHNCIncidenciaiCuenta(); |
---|
| 306 | void slotCalcularPHNCIncidenciaiCuenta(); |
---|
| 307 | void slotPHNCIncidenciaiComponente(); |
---|
| 308 | void slotCalcularPHNCIncidenciaiComponente(); |
---|
| 309 | |
---|
[04999c9] | 310 | void slotPNHIncudencia100(); |
---|
| 311 | void slotCloseformPNH(); |
---|
| 312 | void slotSelectPNH(); |
---|
| 313 | void slotPNHIncidenciaiCuenta(); |
---|
| 314 | void slotPNHIncidenciaiComponente(); |
---|
| 315 | void slotSelectPNHi(); |
---|
| 316 | void slotCalcularPNHIncidenciaiCuenta(); |
---|
| 317 | void slotSelectPNHic(); |
---|
| 318 | void slotCalcularPNHIncidenciaiComponente(); |
---|
| 319 | |
---|
[44d1e60] | 320 | public: |
---|
| 321 | MainWindow(); |
---|
| 322 | std::vector<std::string> csv_read_row(std::string , char); |
---|
| 323 | std::vector<std::string> csv_read_row(std::istream &, char); |
---|
| 324 | QString numberFormat(double &); |
---|
[9dd61b1] | 325 | |
---|
[8daa049] | 326 | int contarElementosMap(QMap<QString, QStringList> diccionario); |
---|
[9dd61b1] | 327 | int retornarIndiceCuenta(QString nombre_cuenta); |
---|
[44d1e60] | 328 | }; |
---|
| 329 | |
---|
| 330 | #endif // MAINWINDOW_H |
---|