Changeset 37dd9aa in mmcs


Ignore:
Timestamp:
Sep 28, 2015, 11:56:51 AM (9 years ago)
Author:
rboet <rboet@…>
Branches:
master
Children:
95d916c
Parents:
32f758e
Message:

incorporada la funcionabilidad de clasificador de cuentas/componentes

Files:
7 edited

Legend:

Unmodified
Added
Removed
  • Makefile

    r07b8f66 r37dd9aa  
    11#############################################################################
    22# Makefile for building: SMSAM
    3 # Generated by qmake (2.01a) (Qt 4.8.2) on: Wed Sep 23 11:12:13 2015
     3# Generated by qmake (2.01a) (Qt 4.8.2) on: lun sep 28 10:36:38 2015
    44# Project:  SMSAM.pro
    55# Template: app
  • mainwindow.C

    r32f758e r37dd9aa  
    18701870        connect(&actionEncadenamiento,SIGNAL(triggered()),this,SLOT(slotEncadenamientos()));
    18711871        actionEncadenamiento.setEnabled(true);
     1872        //Clasificador de Cuentas
     1873        connect(&actionClasificarCuentas,SIGNAL(triggered()),this,SLOT(slotClasificarCuentas()));
     1874        actionClasificarCuentas.setEnabled(true);
    18721875
    18731876        //Se activa la opción de modelo clásico
     
    29212924}
    29222925
     2926//Clasificador de cuentas
     2927void MainWindow::slotClasificarCuentas()
     2928{
     2929    QTableWidget *An = findChild<QTableWidget *>("MatrizAn");
     2930    QTableWidget *Ma = findChild<QTableWidget *>("MatrizMa");
     2931    int count = An->rowCount()-1;
     2932    QTableWidget *CC = new QTableWidget;
     2933    CC->setObjectName("Clasificador de Cuentas");
     2934    crearTablaVaciaEncadenamiento(count,CC,8);
     2935    cuentacomponentesResultado(CC,count-1,true);
     2936    QVector<double> vectorFila;
     2937    QVector<double> vectorColumna;
     2938    obtenerUiUj(An,vectorFila,vectorColumna);
     2939    calcularClasificador(CC,vectorFila,vectorColumna);
     2940    vectorFila.clear();
     2941    vectorColumna.clear();
     2942    obtenerUiUj(Ma,vectorFila,vectorColumna);
     2943    calcularClasificador(CC,vectorFila,vectorColumna,5);
     2944    CC->resizeColumnsToContents();//Ajuste de Columnas
     2945    agregarPrimeraCelda(CC);
     2946
     2947    tabWidget->addTab(new QWidget,"Clasificador");
     2948    int indice=ObtenerIndice("Clasificador");
     2949    QHBoxLayout * layoutCentralWidget = new QHBoxLayout;
     2950    layoutCentralWidget->addWidget(CC);
     2951    QWidget *widget = tabWidget->widget(indice);
     2952    widget->setLayout(layoutCentralWidget);//Se añade el widget y layout a la pestaña creada
     2953    actionClasificarCuentas.setDisabled(true);
     2954    tabWidget->setCurrentIndex(indice);
     2955}
     2956
     2957/*      Funcion que calcular los Ui y Uj para los clasificadores    */
     2958void MainWindow::obtenerUiUj(QTableWidget *tw, QVector<double> &ui, QVector<double> &uj)
     2959{
     2960    int contador = tw->rowCount();
     2961    double totalFila = 0;
     2962    double totalColumna = 0;
     2963    QVector<double> vectorFila;
     2964    QVector<double> vectorColumna;
     2965    for(int i=2;i<contador;i++)
     2966    {
     2967        double sumaFila = 0;
     2968        double sumaColumna = 0;
     2969        for(int j=2;j<contador;j++)
     2970        {
     2971            QString itemFila = Separador(tw->item(i,j),true);
     2972            QString itemColumna = Separador(tw->item(j,i),true);
     2973            double fila = itemFila.toDouble();
     2974            double columna = itemColumna.toDouble();
     2975            sumaFila+=fila;
     2976            sumaColumna+=columna;
     2977            totalFila+=fila;
     2978            totalColumna+=columna;
     2979        }
     2980        vectorFila.append(sumaFila);
     2981        vectorColumna.append(sumaColumna);
     2982    }
     2983    int cantidad = vectorFila.count();
     2984    for(int i=0;i<cantidad;i++)
     2985    {
     2986        double fila = vectorFila.at(i)/totalFila;
     2987        ui.append(fila);
     2988        double columna = vectorColumna.at(i)/totalColumna;
     2989        uj.append(columna);
     2990    }
     2991}
     2992
     2993/*          Funcion que hace los cálculos de los clasificadores            */
     2994void MainWindow::calcularClasificador(QTableWidget *tw, QVector<double> ui, QVector<double> uj,int init)
     2995{
     2996    int count = tw->rowCount()-1;
     2997    //Fuente Negrita
     2998    QFont font;
     2999    font.setBold(true);
     3000    //Titulos Ui, Uj y Tipo de Cuenta
     3001    QTableWidgetItem *uiItem = new QTableWidgetItem("Ui");
     3002    uiItem->setFlags(uiItem->flags() ^ Qt::ItemIsEditable);
     3003    uiItem->setFont(font);
     3004    tw->setItem(0,init,uiItem);
     3005    QTableWidgetItem *ujItem = new QTableWidgetItem("Uj");
     3006    ujItem->setFlags(ujItem->flags() ^ Qt::ItemIsEditable);
     3007    ujItem->setFont(font);
     3008    tw->setItem(0,init+1,ujItem);
     3009    QTableWidgetItem *tcItem = new QTableWidgetItem("Tipo de Cuenta");
     3010    tcItem->setFlags(tcItem->flags() ^ Qt::ItemIsEditable);
     3011    tcItem->setFont(font);
     3012    tw->setItem(0,init+2,tcItem);
     3013    for(int i=0;i<count;i++)
     3014    {
     3015        QTableWidgetItem *vFila = new QTableWidgetItem(QString::number(ui.at(i),'f',precission));
     3016        vFila->setFlags(vFila->flags() ^ Qt::ItemIsEditable);
     3017        QString itemFila = Separador(vFila,false);
     3018        vFila->setText(itemFila);
     3019        tw->setItem(i+1,init,vFila);
     3020        QTableWidgetItem *vColumna = new QTableWidgetItem(QString::number(uj.at(i),'f',precission));
     3021        vColumna->setFlags(vColumna->flags() ^ Qt::ItemIsEditable);
     3022        QString itemColumna = Separador(vColumna,false);
     3023        vColumna->setText(itemColumna);
     3024        tw->setItem(i+1,init+1,vColumna);
     3025        QTableWidgetItem *tipo = new QTableWidgetItem;
     3026        tipo->setFlags(tipo->flags() ^ Qt::ItemIsEditable);
     3027        //Se determina que tipo de cuenta es
     3028        if(ui.at(i)<1 and uj.at(i)<1)
     3029        {
     3030            tipo->setText("Independiente");
     3031        }
     3032        else if(ui.at(i)>1 and uj.at(i)<1)
     3033        {
     3034            tipo->setText("Impulsor de Economía");
     3035        }
     3036        else if(ui.at(i)<1 and uj.at(i)>1)
     3037        {
     3038            tipo->setText("Base");
     3039        }
     3040        else if(ui.at(i)>1 and uj.at(i)>1)
     3041        {
     3042            tipo->setText("Clave");
     3043        }
     3044        tw->setItem(i+1,init+2,tipo);
     3045    }
     3046}
     3047
     3048void MainWindow::agregarPrimeraCelda(QTableWidget *tw)
     3049{
     3050    tw->insertRow(0);
     3051    //Se colocan no editables la celda 0 y 1
     3052    noEditColZero(tw);
     3053    QTableWidgetItem *one = new QTableWidgetItem;
     3054    one->setFlags(one->flags() ^ Qt::ItemIsEditable);
     3055    tw->setItem(0,1,one);
     3056    for(int i=0;i<3;i++)
     3057    {
     3058        QTableWidgetItem *cAn = new QTableWidgetItem("Clasificador por An");
     3059        cAn->setTextAlignment(Qt::AlignCenter);
     3060        cAn->setFlags(cAn->flags() ^ Qt::ItemIsEditable);
     3061        CellStyleExEn(cAn);
     3062        tw->setItem(0,i+2,cAn);
     3063        QTableWidgetItem *cMa = new QTableWidgetItem("Clasificador por Ma");
     3064        cMa->setTextAlignment(Qt::AlignCenter);
     3065        cMa->setFlags(cMa->flags() ^ Qt::ItemIsEditable);
     3066        CellStyleExEn(cMa);
     3067        tw->setItem(0,5+i,cMa);
     3068    }
     3069    tw->setSpan(0,2,1,3);
     3070    tw->setSpan(0,5,1,3);
     3071}
     3072
    29233073//FH_005
    29243074void MainWindow::slotModeloClasico()
     
    49215071    int index = tabWidget->currentIndex();
    49225072    QString tabName = tabWidget->tabText(index);
    4923     if(tabName.contains("Inicio") or tabName.contains("Encadenamiento") or tabName.contains("Escenario")
     5073    if(tabName.contains("Inicio") or tabName.contains("Encadenamiento") or tabName.contains("Escenario") or tabName.contains("Clasificador")
    49245074            or tabName.contains("Resultado") or tabName.contains("Comparacion") or tabName.contains("Seleccion"))
    49255075    {
     
    50175167                }
    50185168            }
     5169            ItemsNoEditable(nuevaTabla,0,2,1);
    50195170
    50205171            titleSeleccionar(nuevaTabla);
  • mainwindow.H

    r32f758e r37dd9aa  
    204204    void encademientosStyle(QTableWidgetItem *);
    205205    void cuentacomponentesEncadenamiento(QTableWidget *, int count);
     206    void obtenerUiUj(QTableWidget *, QVector<double> &, QVector<double> &);
     207    void calcularClasificador(QTableWidget *, QVector<double>, QVector<double>, int init = 2);
     208    void agregarPrimeraCelda(QTableWidget *);
    206209
    207210    void calcularSubtotal(QTableWidget *,int inicio, int fin,int exogena);
     
    282285    void slotAgregarEncadenamiento();
    283286    void slotVerEncadenamiento();
     287    void slotClasificarCuentas();
    284288
    285289    void slotCloseExport();
  • moc_mainwindow.cpp

    r32f758e r37dd9aa  
    22** Meta object code from reading C++ file 'mainwindow.H'
    33**
    4 ** Created: Fri Sep 25 11:00:29 2015
     4** Created: Mon Sep 28 11:46:38 2015
    55**      by: The Qt Meta Object Compiler version 63 (Qt 4.8.2)
    66**
     
    2424       0,       // classname
    2525       0,    0, // classinfo
    26       56,   14, // methods
     26      57,   14, // methods
    2727       0,    0, // properties
    2828       0,    0, // enums/sets
     
    5555     475,   11,   11,   11, 0x08,
    5656     499,   11,   11,   11, 0x08,
    57      517,   11,   11,   11, 0x08,
    58      534,   11,   11,   11, 0x08,
    59      553,   11,   11,   11, 0x08,
    60      581,  573,   11,   11, 0x08,
    61      605,   11,   11,   11, 0x28,
    62      625,   11,   11,   11, 0x08,
    63      646,   11,   11,   11, 0x08,
    64      668,   11,   11,   11, 0x08,
    65      690,   11,   11,   11, 0x08,
    66      713,   11,   11,   11, 0x08,
    67      741,   11,   11,   11, 0x08,
    68      763,   11,   11,   11, 0x08,
    69      786,   11,   11,   11, 0x08,
    70      813,   11,   11,   11, 0x08,
    71      848,   11,   11,   11, 0x08,
    72      879,   11,   11,   11, 0x08,
    73      918,   11,   11,   11, 0x08,
    74      943,   11,   11,   11, 0x08,
    75      962,   11,   11,   11, 0x08,
     57     523,   11,   11,   11, 0x08,
     58     541,   11,   11,   11, 0x08,
     59     558,   11,   11,   11, 0x08,
     60     577,   11,   11,   11, 0x08,
     61     605,  597,   11,   11, 0x08,
     62     629,   11,   11,   11, 0x28,
     63     649,   11,   11,   11, 0x08,
     64     670,   11,   11,   11, 0x08,
     65     692,   11,   11,   11, 0x08,
     66     714,   11,   11,   11, 0x08,
     67     737,   11,   11,   11, 0x08,
     68     765,   11,   11,   11, 0x08,
     69     787,   11,   11,   11, 0x08,
     70     810,   11,   11,   11, 0x08,
     71     837,   11,   11,   11, 0x08,
     72     872,   11,   11,   11, 0x08,
     73     903,   11,   11,   11, 0x08,
     74     942,   11,   11,   11, 0x08,
     75     967,   11,   11,   11, 0x08,
    7676     986,   11,   11,   11, 0x08,
    77     1014,   11,   11,   11, 0x08,
    78     1050,   11,   11,   11, 0x08,
    79     1082,   11,   11,   11, 0x08,
    80     1122,   11,   11,   11, 0x08,
    81     1145,   11,   11,   11, 0x08,
    82     1164,   11,   11,   11, 0x08,
    83     1180,   11,   11,   11, 0x08,
    84     1207,   11,   11,   11, 0x08,
    85     1238,   11,   11,   11, 0x08,
    86     1255,   11,   11,   11, 0x08,
    87     1290,   11,   11,   11, 0x08,
    88     1308,   11,   11,   11, 0x08,
    89     1347,   11,   11,   11, 0x08,
     77    1010,   11,   11,   11, 0x08,
     78    1038,   11,   11,   11, 0x08,
     79    1074,   11,   11,   11, 0x08,
     80    1106,   11,   11,   11, 0x08,
     81    1146,   11,   11,   11, 0x08,
     82    1169,   11,   11,   11, 0x08,
     83    1188,   11,   11,   11, 0x08,
     84    1204,   11,   11,   11, 0x08,
     85    1231,   11,   11,   11, 0x08,
     86    1262,   11,   11,   11, 0x08,
     87    1279,   11,   11,   11, 0x08,
     88    1314,   11,   11,   11, 0x08,
     89    1332,   11,   11,   11, 0x08,
     90    1371,   11,   11,   11, 0x08,
    9091
    9192       0        // eod
     
    105106    "slotEncadenamientos()\0slotCloseEncadenamiento()\0"
    106107    "slotAgregarEncadenamiento()\0"
    107     "slotVerEncadenamiento()\0slotCloseExport()\0"
    108     "slotSaveExport()\0slotSearchExport()\0"
    109     "slotModeloClasico()\0clasico\0"
    110     "calcularEscenario(bool)\0calcularEscenario()\0"
    111     "finalizarEscenario()\0slotModeloNoClasico()\0"
    112     "calcularEscenarioNC()\0finalizarEscenarioNC()\0"
     108    "slotVerEncadenamiento()\0slotClasificarCuentas()\0"
     109    "slotCloseExport()\0slotSaveExport()\0"
     110    "slotSearchExport()\0slotModeloClasico()\0"
     111    "clasico\0calcularEscenario(bool)\0"
     112    "calcularEscenario()\0finalizarEscenario()\0"
     113    "slotModeloNoClasico()\0calcularEscenarioNC()\0"
     114    "finalizarEscenarioNC()\0"
    113115    "slotCompararResultadosMNC()\0"
    114116    "slotVerResultadoMNC()\0slotPHCIncidencia100()\0"
     
    160162        case 20: _t->slotAgregarEncadenamiento(); break;
    161163        case 21: _t->slotVerEncadenamiento(); break;
    162         case 22: _t->slotCloseExport(); break;
    163         case 23: _t->slotSaveExport(); break;
    164         case 24: _t->slotSearchExport(); break;
    165         case 25: _t->slotModeloClasico(); break;
    166         case 26: _t->calcularEscenario((*reinterpret_cast< bool(*)>(_a[1]))); break;
    167         case 27: _t->calcularEscenario(); break;
    168         case 28: _t->finalizarEscenario(); break;
    169         case 29: _t->slotModeloNoClasico(); break;
    170         case 30: _t->calcularEscenarioNC(); break;
    171         case 31: _t->finalizarEscenarioNC(); break;
    172         case 32: _t->slotCompararResultadosMNC(); break;
    173         case 33: _t->slotVerResultadoMNC(); break;
    174         case 34: _t->slotPHCIncidencia100(); break;
    175         case 35: _t->slotPHCIncidenciaiCuenta(); break;
    176         case 36: _t->slotCalcularPHCIncidenciaiCuenta(); break;
    177         case 37: _t->slotPHCIncidenciaiComponente(); break;
    178         case 38: _t->slotCalcularPHCIncidenciaiComponente(); break;
    179         case 39: _t->slotCompararResultados(); break;
    180         case 40: _t->slotVerResultado(); break;
    181         case 41: _t->slotPHNCIncidencia100(); break;
    182         case 42: _t->slotPHNCIncidenciaiCuenta(); break;
    183         case 43: _t->slotCalcularPHNCIncidenciaiCuenta(); break;
    184         case 44: _t->slotPHNCIncidenciaiComponente(); break;
    185         case 45: _t->slotCalcularPHNCIncidenciaiComponente(); break;
    186         case 46: _t->slotPNHIncudencia100(); break;
    187         case 47: _t->slotCloseformPNH(); break;
    188         case 48: _t->slotSelectPNH(); break;
    189         case 49: _t->slotPNHIncidenciaiCuenta(); break;
    190         case 50: _t->slotPNHIncidenciaiComponente(); break;
    191         case 51: _t->slotSelectPNHi(); break;
    192         case 52: _t->slotCalcularPNHIncidenciaiCuenta(); break;
    193         case 53: _t->slotSelectPNHic(); break;
    194         case 54: _t->slotCalcularPNHIncidenciaiComponente(); break;
    195         case 55: _t->slotSeleccionarTabla(); break;
     164        case 22: _t->slotClasificarCuentas(); break;
     165        case 23: _t->slotCloseExport(); break;
     166        case 24: _t->slotSaveExport(); break;
     167        case 25: _t->slotSearchExport(); break;
     168        case 26: _t->slotModeloClasico(); break;
     169        case 27: _t->calcularEscenario((*reinterpret_cast< bool(*)>(_a[1]))); break;
     170        case 28: _t->calcularEscenario(); break;
     171        case 29: _t->finalizarEscenario(); break;
     172        case 30: _t->slotModeloNoClasico(); break;
     173        case 31: _t->calcularEscenarioNC(); break;
     174        case 32: _t->finalizarEscenarioNC(); break;
     175        case 33: _t->slotCompararResultadosMNC(); break;
     176        case 34: _t->slotVerResultadoMNC(); break;
     177        case 35: _t->slotPHCIncidencia100(); break;
     178        case 36: _t->slotPHCIncidenciaiCuenta(); break;
     179        case 37: _t->slotCalcularPHCIncidenciaiCuenta(); break;
     180        case 38: _t->slotPHCIncidenciaiComponente(); break;
     181        case 39: _t->slotCalcularPHCIncidenciaiComponente(); break;
     182        case 40: _t->slotCompararResultados(); break;
     183        case 41: _t->slotVerResultado(); break;
     184        case 42: _t->slotPHNCIncidencia100(); break;
     185        case 43: _t->slotPHNCIncidenciaiCuenta(); break;
     186        case 44: _t->slotCalcularPHNCIncidenciaiCuenta(); break;
     187        case 45: _t->slotPHNCIncidenciaiComponente(); break;
     188        case 46: _t->slotCalcularPHNCIncidenciaiComponente(); break;
     189        case 47: _t->slotPNHIncudencia100(); break;
     190        case 48: _t->slotCloseformPNH(); break;
     191        case 49: _t->slotSelectPNH(); break;
     192        case 50: _t->slotPNHIncidenciaiCuenta(); break;
     193        case 51: _t->slotPNHIncidenciaiComponente(); break;
     194        case 52: _t->slotSelectPNHi(); break;
     195        case 53: _t->slotCalcularPNHIncidenciaiCuenta(); break;
     196        case 54: _t->slotSelectPNHic(); break;
     197        case 55: _t->slotCalcularPNHIncidenciaiComponente(); break;
     198        case 56: _t->slotSeleccionarTabla(); break;
    196199        default: ;
    197200        }
     
    231234        return _id;
    232235    if (_c == QMetaObject::InvokeMetaMethod) {
    233         if (_id < 56)
     236        if (_id < 57)
    234237            qt_static_metacall(this, _c, _id, _a);
    235         _id -= 56;
     238        _id -= 57;
    236239    }
    237240    return _id;
Note: See TracChangeset for help on using the changeset viewer.