Esempio n. 1
0
        void EjecutarConsulta()
        {
            int n_idmon  = 0;
            int n_tipfch = 0;
            int n_tipsal = 0;

            if (funFunciones.NulosC(TxtFchIni.Text) == "")
            {
                MessageBox.Show("¡ No ha indicado la fecha de inicio para la consulta !", "", MessageBoxButtons.OK, MessageBoxIcon.Information, MessageBoxDefaultButton.Button1);
                TxtFchIni.Focus();
                return;
            }
            if (funFunciones.NulosC(TxtFchFin.Text) == "")
            {
                MessageBox.Show("¡ No ha indicado la fecha final para la consulta !", "", MessageBoxButtons.OK, MessageBoxIcon.Information, MessageBoxDefaultButton.Button1);
                TxtFchFin.Focus();
                return;
            }

            DateTime d_fchini = Convert.ToDateTime(TxtFchIni.Text);
            DateTime d_fchfin = Convert.ToDateTime(TxtFchFin.Text);

            if (d_fchini > d_fchfin)
            {
                MessageBox.Show("¡ La fecha de inicio no puede ser mayor a la fecha final de la consulta !", "", MessageBoxButtons.OK, MessageBoxIcon.Information, MessageBoxDefaultButton.Button1);
                TxtFchIni.Focus();
                return;
            }


            if (OptTod.Checked == true)
            {
                n_idmon = 0;
            }
            if (OptSol.Checked == true)
            {
                n_idmon = 115;
            }
            if (OptDol.Checked == true)
            {
                n_idmon = 151;
            }

            //if (OptFchEmi.Checked == true) { n_tipfch = 1; }
            //if (OptFchVen.Checked == true) { n_tipfch = 2; }
            //if (OptFchReg.Checked == true) { n_tipfch = 3; }

            if (OptTodDoc.Checked == true)
            {
                n_tipsal = 1;
            }
            if (OptPen.Checked == true)
            {
                n_tipsal = 2;
            }
            if (OptPag.Checked == true)
            {
                n_tipsal = 3;
            }

            //CN_log_compras funCom = new CN_log_compras();
            int           n_tipoconsulta = 0;
            CN_vta_ventas funCom         = new CN_vta_ventas();

            funCom.mysConec    = mysConec;
            funCom.STU_SISTEMA = STU_SISTEMA;
            if (OptRes.Checked == true)
            {
                n_tipoconsulta = 1;
            }
            if (OptDet.Checked == true)
            {
                n_tipoconsulta = 2;
            }
            //if (OptResDet.Checked == true) { n_tipoconsulta = 3; }

            funCom.Consulta2(STU_SISTEMA.EMPRESAID, TxtFchIni.Text, TxtFchFin.Text, n_idmon, n_tipfch, n_tipsal, n_Libro, n_tipoconsulta);
            dtLista = funCom.dtLista1;
            if (OptRes.Checked == true)
            {
                FgDatos.Cols.Count = 13;
                Cabecera1();
                funFlex.FlexMostrarDatos(FgDatos, arrCabecera1, dtLista, 2, true);
                SetearCabecera1();
            }
            if (OptDet.Checked == true)
            {
                FgDatos.Cols.Count = 18;
                Cabecera2();
                funFlex.FlexMostrarDatos(FgDatos, arrCabecera2, dtLista, 2, true);
                SetearCabecera2();
            }
            //if (OptResDet.Checked == true)
            //{
            //    FgDatos.Cols.Count = 7;
            //    Cabecera3();
            //    funFlex.FlexMostrarDatos(FgDatos, arrCabecera3, dtLista, 2, true);
            //    SetearCabecera3();
            //}
        }