Esempio n. 1
0
        void EjecutarConsulta()
        {
            int n_tipcon = 0;
            int n_tipmon = 0;
            int n_tipimp = 0;
            int n_tipval = 0;

            // INDICAMOS LE TIPO DE CONSULTA
            if (OptTip1.Checked == true)
            {
                n_tipcon = 1;
            }
            if (OptTip2.Checked == true)
            {
                n_tipcon = 2;
            }
            if (OptTip3.Checked == true)
            {
                n_tipcon = 3;
            }
            if (OptTip4.Checked == true)
            {
                n_tipcon = 4;
            }

            // INDICAMOS EL TIPO DE MONEDA
            if (OptSel1.Checked == true)
            {
                n_tipmon = 1;
            }                                                 // SOLO MONEDA NACIONAL
            if (OptSel2.Checked == true)
            {
                n_tipmon = 2;
            }                                                 // SOLO MONEDA EXTRANJERA
            if (OptSel3.Checked == true)
            {
                n_tipmon = 3;
            }                                                 // TODO EN MONEDA NACIONAL
            if (OptSel4.Checked == true)
            {
                n_tipmon = 4;
            }                                                 // TODO EN MONEDA EXTRANJERA

            // INDICAMOS EL TIPO DE IMPORTE A MOSTRAR
            if (OptSelImp1.Checked == true)
            {
                n_tipimp = 1;
            }                                                   // IMPORTE INCLUIDO IGV
            if (OptSelImp2.Checked == true)
            {
                n_tipimp = 2;
            }                                                   // IMPORTE SIN IGV
            if (OptSelImp3.Checked == true)
            {
                n_tipimp = 3;
            }                                                   // SOLO EL IGV

            CN_vta_ventas funCom = new CN_vta_ventas();

            funCom.mysConec    = mysConec;
            funCom.STU_SISTEMA = STU_SISTEMA;

            string c_CadINCli = funFlex.Flex_CadenaIN(FgPro, 2, 1);
            string c_CadINIte = funFlex.Flex_CadenaIN(FgItem, 2, 1);;

            if (n_tipcon == 1)
            {
                Cabecera1();
                funCom.Consulta14(STU_SISTEMA.EMPRESAID, n_tipmon, n_tipimp);
                dtLista = funCom.dtLista1;
                funFlex.FlexMostrarDatos(FgDatos, arrCabecera1, dtLista, 2, true);
                SumarColumnas();
            }
            if (n_tipcon == 2)
            {
                int n_row    = 0;
                int n_anover = 0;
                for (n_row = 1; n_row <= FgHisAno.Rows.Count - 1; n_row++)
                {
                    if (FgHisAno.GetData(n_row, 2).ToString() == "True")
                    {
                        n_anover = Convert.ToInt32(FgHisAno.GetData(n_row, 1));
                    }
                }
                Cabecera2();
                funCom.Consulta17(STU_SISTEMA.EMPRESAID, n_anover, n_tipmon, n_tipimp);
                dtLista = funCom.dtLista1;
                funFlex.FlexMostrarDatos(FgDatos, arrCabecera2, dtLista, 2, true);
                SumarColumnas2();
            }
            if (n_tipcon == 3)
            {
                int n_row    = 0;
                int n_anover = 0;
                for (n_row = 1; n_row <= FgHisAno.Rows.Count - 1; n_row++)
                {
                    if (FgHisAno.GetData(n_row, 2).ToString() == "True")
                    {
                        n_anover = Convert.ToInt32(FgHisAno.GetData(n_row, 1));
                    }
                }
                Cabecera3();
                if (OptTipVal1.Checked == true)
                {
                    n_tipval = 1;
                }
                if (OptTipVal2.Checked == true)
                {
                    n_tipval = 2;
                }
                if (OptTipVal3.Checked == true)
                {
                    n_tipval = 3;
                }

                if (n_tipval == 3)
                {
                    funCom.Consulta23(STU_SISTEMA.EMPRESAID, n_anover, n_tipmon, n_tipval);
                }
                else
                {
                    funCom.Consulta18(STU_SISTEMA.EMPRESAID, n_anover, n_tipmon, n_tipval);
                }
                dtLista = funCom.dtLista1;

                funFlex.FlexMostrarDatos(FgDatos, arrCabecera3, dtLista, 2, true);
                if (OptTipVal3.Checked != true)
                {
                    SumarColumnas3();
                }
                else
                {
                    FgDatos.Cols.Remove(FgDatos.Cols.Count - 1);
                }
            }
            if (n_tipcon == 4)
            {
                int n_row    = 0;
                int n_anover = 0;
                for (n_row = 1; n_row <= FgHisAno.Rows.Count - 1; n_row++)
                {
                    if (FgHisAno.GetData(n_row, 2).ToString() == "True")
                    {
                        n_anover = Convert.ToInt32(FgHisAno.GetData(n_row, 1));
                    }
                }
                Cabecera4();
                funCom.Consulta19(STU_SISTEMA.EMPRESAID, n_anover, n_tipmon, n_tipimp);
                dtLista = funCom.dtLista1;
                funFlex.FlexMostrarDatos(FgDatos, arrCabecera4, dtLista, 2, true);
                SumarColumnas();
            }
        }