Ejemplo n.º 1
0
        protected void cargarGrilla_Precio()
        {
            lblmensaje.Text = "";
            try
            {
                Facade_Proceso_Operativo.Facade_Proceso_Operativo obj_Facade_Proceso_Operativo = new SIGE.Facade_Proceso_Operativo.Facade_Proceso_Operativo();

                DataTable dt = null;

                int iidperson = 0;
                if (cmbperson.SelectedIndex >= 0)
                {
                    iidperson = Convert.ToInt32(cmbperson.SelectedValue);
                }

                string sidplanning      = cmbplanning.SelectedValue;
                string sidchannel       = cmbcanal.SelectedValue;
                int    icod_oficina     = Convert.ToInt32(cmbOficina.SelectedValue);
                int    iidNodeComercial = Convert.ToInt32(cmbNodeComercial.SelectedValue);
                string sidPDV           = cmbPuntoDeVenta.SelectedValue;
                if (sidPDV == "")
                {
                    sidPDV = "0";
                }
                string sidcategoriaProducto = cmbcategoria_producto.SelectedValue;
                string sidmarca             = cmbmarca.SelectedValue;
                if (sidcategoriaProducto == "")
                {
                    sidcategoriaProducto = "0";
                }
                string scodproducto = cmbsku.SelectedValue;
                if (scodproducto == "")
                {
                    scodproducto = "0";
                }
                if (sidmarca == "")
                {
                    sidmarca = "0";
                }


                DateTime dfecha_inicio;
                DateTime dfecha_fin;

                if (txt_fecha_inicio.SelectedDate.ToString() == "" || txt_fecha_inicio.SelectedDate.ToString() == "0" || txt_fecha_inicio.SelectedDate == null)
                {
                    dfecha_inicio = txt_fecha_inicio.MinDate;
                }
                else
                {
                    dfecha_inicio = txt_fecha_inicio.SelectedDate.Value;
                }


                if (txt_fecha_fin.SelectedDate.ToString() == "" || txt_fecha_fin.SelectedDate.ToString() == "0" || txt_fecha_fin.SelectedDate == null)
                {
                    dfecha_fin = txt_fecha_fin.MaxDate;
                }
                else
                {
                    dfecha_fin = txt_fecha_fin.SelectedDate.Value;
                }

                if (DateTime.Compare(dfecha_inicio, dfecha_fin) == 1)
                {
                    lblmensaje.Visible   = true;
                    lblmensaje.Text      = "La fecha de inicio debe ser menor o igual a la fecha fin";
                    lblmensaje.ForeColor = System.Drawing.Color.Red;
                }
                else
                {
                    //Ing Ditmar Estrada 20/01/2011
                    //dt = obj_Facade_Proceso_Operativo.Get_ReportePrecio(iidperson, sidplanning, sidchannel, sidcategoriaProducto, sidmarca, scodproducto, dfecha_inicio, dfecha_fin);
                    //este metodo se suspendio temporalmente hasta corregir la data de caracteres especiales, por miestras
                    //se usara el metodo ejecutarDataTable que se muestra acontinuacion.

                    Conexion Ocoon = new Conexion();

                    //dt = Ocoon.ejecutarDataTable("UP_WEBXPLORA_OPE_CONSULTA_PRECIO", iidperson, sidplanning, sidchannel, icod_oficina, iidNodeComercial, sidPDV, sidcategoriaProducto, sidmarca, scodproducto, dfecha_inicio, dfecha_fin);
                    //dt = Ocoon.ejecutarDataTable("prueba2", iidperson, sidplanning, sidchannel, icod_oficina, iidNodeComercial, sidPDV, sidcategoriaProducto, sidmarca, scodproducto, dfecha_inicio, dfecha_fin);
                    //dt = Ocoon.ejecutarDataTable("prueba2", 0, 0, 0, 0, 0, 0, 0, 0, 0);
                    dt = Ocoon.ejecutarDataTable("UP_WEBXPLORA_OPE_CONSULTA_STOCK_POR_DIA", iidperson, sidplanning, sidchannel, icod_oficina, iidNodeComercial, sidPDV, sidcategoriaProducto, sidmarca, scodproducto, dfecha_inicio);


                    if (dt.Rows.Count > 0)
                    {
                        gv_precios.DataSource = dt;
                        gv_precios.DataBind();


                        gv_precioToExcel.DataSource = dt;
                        gv_precioToExcel.DataBind();

                        lblmensaje.ForeColor = System.Drawing.Color.Green;
                        lblmensaje.Text      = "Se encontró " + dt.Rows.Count + " resultados";
                    }
                    else
                    {
                        lblmensaje.ForeColor = System.Drawing.Color.Blue;
                        lblmensaje.Text      = "Se encontró " + dt.Rows.Count + " resultados";
                        gv_precios.DataBind();
                    }
                }
            }
            catch (Exception ex)
            {
                ex.Message.ToString();
                lblmensaje.ForeColor = System.Drawing.Color.Red;
                lblmensaje.Text      = "Ocurrió un error inesperado, Por favor intentelo más tarde o comuníquese con el área de Tecnología de Información.";
                gv_precios.DataBind();

                //System.Threading.Thread.Sleep(8000);
                //Response.Redirect("~/err_mensaje_seccion.aspx", true);
            }
        }
        protected void cargarGrilla_Stock_Ingresos()
        {
            lblmensaje.Text = "";
            try
            {
                Facade_Proceso_Operativo.Facade_Proceso_Operativo obj_Facade_Proceso_Operativo = new SIGE.Facade_Proceso_Operativo.Facade_Proceso_Operativo();

                DataTable dt = null;

                #region person
                int iidperson = 0;
                if (cmbperson.SelectedIndex >= 0)
                {
                    iidperson = Convert.ToInt32(cmbperson.SelectedValue);
                }
                #endregion

                int iidmercaderista = 0;
                if (cmbMercaderista.SelectedIndex >= 0)
                {
                    iidmercaderista = Convert.ToInt32(cmbMercaderista.SelectedValue);
                }


                string sidplanning      = cmbplanning.SelectedValue;
                string sidchannel       = cmbcanal.SelectedValue;
                int    icod_oficina     = Convert.ToInt32(cmbOficina.SelectedValue);
                int    iidNodeComercial = Convert.ToInt32(cmbNodeComercial.SelectedValue);
                #region pdv
                string sidPDV = cmbPuntoDeVenta.SelectedValue;
                if (sidPDV == "")
                {
                    sidPDV = "0";
                }
                #endregion
                #region categoria
                string sidcategoriaProducto = cmbcategoria_producto.SelectedValue;
                if (sidcategoriaProducto == "")
                {
                    sidcategoriaProducto = "0";
                }
                #endregion
                #region marca
                string sidmarca = cmbmarca.SelectedValue;
                if (sidmarca == "")
                {
                    sidmarca = "0";
                }
                #endregion

                //string iidcorporacion = cmbcorporacion.SelectedValue;
                //if (iidcorporacion == "")
                //    iidcorporacion = "0";

                string sidTipoReporte = cmbTipo_reporte.SelectedValue;
                if (sidTipoReporte == "")
                {
                    sidTipoReporte = "0";
                }


                DateTime dfecha_inicio;
                DateTime dfecha_fin;

                #region validacion fecha if{...}
                if (txt_fecha_inicio.SelectedDate.ToString() == "" || txt_fecha_inicio.SelectedDate.ToString() == "0" || txt_fecha_inicio.SelectedDate == null)
                {
                    dfecha_inicio = txt_fecha_inicio.MinDate;
                }
                else
                {
                    dfecha_inicio = txt_fecha_inicio.SelectedDate.Value;
                }

                if (txt_fecha_fin.SelectedDate.ToString() == "" || txt_fecha_fin.SelectedDate.ToString() == "0" || txt_fecha_fin.SelectedDate == null)
                {
                    dfecha_fin = txt_fecha_fin.MaxDate;
                }
                else
                {
                    dfecha_fin = txt_fecha_fin.SelectedDate.Value;
                }

                if (DateTime.Compare(dfecha_inicio, dfecha_fin) == 1)
                {
                    lblmensaje.Visible   = true;
                    lblmensaje.Text      = "La fecha de inicio debe ser menor o igual a la fecha fin";
                    lblmensaje.ForeColor = System.Drawing.Color.Red;
                }
                #endregion
                else
                {
                    //Ing Ditmar Estrada 20/01/2011
                    //dt = obj_Facade_Proceso_Operativo.Get_ReportePrecio(iidperson, sidplanning, sidchannel, sidcategoriaProducto, sidmarca, scodproducto, dfecha_inicio, dfecha_fin);
                    //este metodo se suspendio temporalmente hasta corregir la data de caracteres especiales, por miestras
                    //se usara el metodo ejecutarDataTable que se muestra acontinuacion.

                    Conexion Ocoon = new Conexion();

                    //dt = Ocoon.ejecutarDataTable("UP_WEBXPLORA_OPE_CONSULTA_STOCK_INGRESOS", dfecha_inicio, dfecha_fin, sidplanning, sidchannel, iidcorporacion, icod_oficina, iidNodeComercial, sidPDV, sidmarca, sidcategoriaProducto, iidperson);
                    //dt = Ocoon.ejecutarDataTable("UP_WEBXPLORA_OPE_CONSULTA_STOCK_INGRESOS3", dfecha_inicio, dfecha_fin, sidplanning, sidchannel, iidcorporacion, icod_oficina, iidNodeComercial, sidPDV, sidmarca, sidcategoriaProducto, iidperson);
                    //dt = Ocoon.ejecutarDataTable("UP_WEBXPLORA_OPE_CONSULTA_STOCK_INGRESOS4", dfecha_inicio, dfecha_fin, sidplanning, sidchannel, iidcorporacion, icod_oficina, iidNodeComercial, sidPDV, sidmarca, sidcategoriaProducto, iidperson);

                    //******Modificado por: Pablo Salas*****///
                    //******Fecha:07/09/2011******////
                    //******Resumen:Muestra el Reporte diario de las Ventas dentro de un rango de Fechas
                    dt = Ocoon.ejecutarDataTable("UP_WEBXPLORA_OPE_CONSULTA_PRESENCIA", sidplanning, sidchannel, icod_oficina, iidNodeComercial, sidPDV, "0", "0", iidperson, iidmercaderista, sidTipoReporte, dfecha_inicio, dfecha_fin);// sidcategoriaProducto, sidmarca, iidperson);
                    //dt = Ocoon.ejecutarDataTable("UP_WEBXPLORA_OPE_CONSULTA_PRESENCIA", "813622482010", 1000, 9, 4475, 0, 0, 0, 8762, 9087, "05", 10/08/2011, 11/08/2011);// sidcategoriaProducto, sidmarca, iidperson);


                    if (dt.Rows.Count > 0)
                    {
                        gv_stock.DataSource = dt;
                        gv_stock.DataBind();

                        //Modificado por: Pablo Salas. Fecha:05/09/2011. Resumen: Se exporta todos los registros sean los validados e invalidados.
                        //gv_stockToExcel.DataSource = dt;
                        //gv_stockToExcel.DataBind();
                        GridView1.DataSource = dt;
                        GridView1.DataBind();

                        lblmensaje.ForeColor = System.Drawing.Color.Green;
                        lblmensaje.Text      = "Se encontró " + dt.Rows.Count + " resultados";
                    }
                    else
                    {
                        lblmensaje.ForeColor = System.Drawing.Color.Blue;
                        lblmensaje.Text      = "Se encontró " + dt.Rows.Count + " resultados";
                        gv_stock.DataBind();
                    }
                }
            }
            catch (Exception ex)
            {
                ex.Message.ToString();
                lblmensaje.ForeColor = System.Drawing.Color.Red;
                lblmensaje.Text      = "Ocurrió un error inesperado, Por favor intentelo más tarde o comuníquese con el área de Tecnología de Información.";
                gv_stock.DataBind();

                //System.Threading.Thread.Sleep(8000);
                //Response.Redirect("~/err_mensaje_seccion.aspx", true);
            }
        }
        protected void cargarGrilla_Exibicion()
        {
            try
            {
                Facade_Proceso_Operativo.Facade_Proceso_Operativo obj_Facade_Proceso_Operativo = new SIGE.Facade_Proceso_Operativo.Facade_Proceso_Operativo();

                DataTable dt = null;

                int    iidperson   = Convert.ToInt32(cmbperson.SelectedValue);
                string sidplanning = cmbplanning.SelectedValue;
                string sidchannel  = cmbcanal.SelectedValue;

                int    icod_oficina     = Convert.ToInt32(cmbOficina.SelectedValue);
                int    iidNodeComercial = Convert.ToInt32(cmbNodeComercial.SelectedValue);
                string sidPDV           = cmbPuntoDeVenta.SelectedValue;
                if (sidPDV == "")
                {
                    sidPDV = "0";
                }
                string sidcategoriaProducto = cmbcategoria_producto.SelectedValue;
                if (sidcategoriaProducto == "")
                {
                    sidcategoriaProducto = "0";
                }
                string sidmarca = cmbmarca.SelectedValue;
                if (sidmarca == "")
                {
                    sidmarca = "0";
                }

                DateTime dfecha_inicio;
                DateTime dfecha_fin;

                if (txt_fecha_inicio.SelectedDate.ToString() == "" || txt_fecha_inicio.SelectedDate.ToString() == "0" || txt_fecha_inicio.SelectedDate == null)
                {
                    dfecha_inicio = txt_fecha_inicio.MinDate;
                }
                else
                {
                    dfecha_inicio = txt_fecha_inicio.SelectedDate.Value;
                }


                if (txt_fecha_fin.SelectedDate.ToString() == "" || txt_fecha_fin.SelectedDate.ToString() == "0" || txt_fecha_fin.SelectedDate == null)
                {
                    dfecha_fin = txt_fecha_fin.MaxDate;
                }
                else
                {
                    dfecha_fin = txt_fecha_fin.SelectedDate.Value;
                }

                if (DateTime.Compare(dfecha_inicio, dfecha_fin) == 1)
                {
                    lblmensaje.Visible   = true;
                    lblmensaje.Text      = "La fecha de inicio debe ser menor o igual a la fecha fin";
                    lblmensaje.ForeColor = System.Drawing.Color.Red;
                }
                else
                {
                    dt = obj_Facade_Proceso_Operativo.Get_ReporteExibicion(iidperson, sidplanning, sidchannel, icod_oficina, iidNodeComercial, sidPDV, sidcategoriaProducto, sidmarca, dfecha_inicio, dfecha_fin);

                    gvExhib.DataSource = dt;
                    gvExhib.DataBind();

                    gv_exhibicionToExcel.DataSource = dt;
                    gv_exhibicionToExcel.DataBind();

                    lblmensaje.Visible = true;
                    msjRptaGrilla      = "Se encontro " + dt.Rows.Count + " resultados";
                    lblmensaje.Text    = msjRptaGrilla;
                }
            }
            catch (Exception ex)
            {
                ex.Message.ToString();
                gvExhib.DataBind();
                lblmensaje.Visible = true;
                lblmensaje.Text    = "";
                if (cmbplanning.SelectedIndex > 0)
                {
                    lblmensaje.Text = "Ocurrió un error inesperado, Por favor intentelo más tarde o comuníquese con el área de Tecnología de Información.";
                }
            }
        }
        protected void cargarGrilla_Ventas()
        {
            lblmensaje.Text = "";
            try
            {
                Facade_Proceso_Operativo.Facade_Proceso_Operativo obj_Facade_Proceso_Operativo = new SIGE.Facade_Proceso_Operativo.Facade_Proceso_Operativo();

                DataTable dt = null;
                compañia = Convert.ToInt32(this.Session["companyid"]);
                string sAño = cmb_año.SelectedValue;
                if (sAño == "")
                {
                    sAño = "0";
                }
                string sMes = cmb_mes.SelectedValue;
                if (sMes == "")
                {
                    sMes = "0";
                }
                string sDia = calendar_day.SelectedDate.ToString();
                if (sDia == "")
                {
                    sDia = "0";
                }
                string sPeriodo = cmb_periodo.SelectedValue;
                if (sPeriodo == "")
                {
                    sPeriodo = "0";
                }
                string scanal = cmbcanal.SelectedValue;
                if (scanal == "")
                {
                    scanal = "0";
                }
                string sPdv = cmb_pdv.SelectedValue;
                if (sPdv == "")
                {
                    sPdv = "0";
                }



                Conexion Ocoon = new Conexion();

                dt = Ocoon.ejecutarDataTable("UP_WEBXPLORA_OPE_CONSULTA_REPORTE_VENTA_MASISA", scanal, "254", compañia, sPdv, sAño, sMes, sDia, sPeriodo);

                if (dt.Rows.Count > 0)
                {
                    gv_ventas.DataSource = dt;
                    gv_ventas.DataBind();


                    gv_stockToExcel.DataSource = dt;
                    gv_stockToExcel.DataBind();

                    lblmensaje.ForeColor = System.Drawing.Color.Green;
                    lblmensaje.Text      = "Se encontró " + dt.Rows.Count + " resultados";
                }
                else
                {
                    lblmensaje.ForeColor = System.Drawing.Color.Blue;
                    lblmensaje.Text      = "Se encontró " + dt.Rows.Count + " resultados";
                    gv_ventas.DataBind();
                }
            }
            catch (Exception ex)
            {
                ex.Message.ToString();
                lblmensaje.ForeColor = System.Drawing.Color.Red;
                lblmensaje.Text      = "Ocurrió un error inesperado, Por favor intentelo más tarde o comuníquese con el área de Tecnología de Información.";
                gv_ventas.DataBind();

                //System.Threading.Thread.Sleep(8000);
                //Response.Redirect("~/err_mensaje_seccion.aspx", true);
            }
        }
        protected void cargarGrilla_quiebre()
        {
            lblmensaje.Text = "";
            try
            {
                Facade_Proceso_Operativo.Facade_Proceso_Operativo obj_Facade_Proceso_Operativo = new SIGE.Facade_Proceso_Operativo.Facade_Proceso_Operativo();

                DataTable dt = null;

                int iidperson = 0;
                if (cmbperson.SelectedIndex >= 0)
                {
                    iidperson = Convert.ToInt32(cmbperson.SelectedValue);
                }

                string sidplanning      = cmbplanning.SelectedValue;
                string sidchannel       = cmbcanal.SelectedValue;
                int    icod_oficina     = Convert.ToInt32(cmbOficina.SelectedValue);
                int    iidNodeComercial = Convert.ToInt32(cmbNodeComercial.SelectedValue);
                string sidPDV           = cmbPuntoDeVenta.SelectedValue;
                if (sidPDV == "")
                {
                    sidPDV = "0";
                }
                string sidcategoriaProducto = cmbcategoria_producto.SelectedValue;
                string sidmarca             = cmbmarca.SelectedValue;
                if (sidcategoriaProducto == "")
                {
                    sidcategoriaProducto = "0";
                }
                string scodproducto = cmbsku.SelectedValue;
                if (scodproducto == "")
                {
                    scodproducto = "0";
                }
                if (sidmarca == "")
                {
                    sidmarca = "0";
                }

                compañia = Convert.ToInt32(this.Session["companyid"]);
                DateTime dfecha_inicio;
                DateTime dfecha_fin;

                if (txt_fecha_inicio.SelectedDate.ToString() == "" || txt_fecha_inicio.SelectedDate.ToString() == "0" || txt_fecha_inicio.SelectedDate == null)
                {
                    dfecha_inicio = txt_fecha_inicio.MinDate;
                }
                else
                {
                    dfecha_inicio = txt_fecha_inicio.SelectedDate.Value;
                }


                if (txt_fecha_fin.SelectedDate.ToString() == "" || txt_fecha_fin.SelectedDate.ToString() == "0" || txt_fecha_fin.SelectedDate == null)
                {
                    dfecha_fin = txt_fecha_fin.MaxDate;
                }
                else
                {
                    dfecha_fin = txt_fecha_fin.SelectedDate.Value;
                }

                if (DateTime.Compare(dfecha_inicio, dfecha_fin) == 1)
                {
                    lblmensaje.Visible   = true;
                    lblmensaje.Text      = "La fecha de inicio debe ser menor o igual a la fecha fin";
                    lblmensaje.ForeColor = System.Drawing.Color.Red;
                }
                else
                {
                    Conexion Ocoon = new Conexion();

                    dt = Ocoon.ejecutarDataTable("UP_WEBXPLORA_OPE_CONSULTA_QUIEBRE_3M", iidperson, sidplanning, sidchannel, icod_oficina, iidNodeComercial, sidPDV, sidcategoriaProducto, sidmarca, scodproducto, dfecha_inicio, dfecha_fin, compañia);

                    if (dt.Rows.Count > 0)
                    {
                        gv_quiebres.DataSource = dt;
                        gv_quiebres.DataBind();


                        gv_quiebreToExcel.DataSource = dt;
                        gv_quiebreToExcel.DataBind();

                        lblmensaje.ForeColor = System.Drawing.Color.Green;
                        lblmensaje.Text      = "Se encontró " + dt.Rows.Count + " resultados";
                    }
                    else
                    {
                        lblmensaje.ForeColor = System.Drawing.Color.Blue;
                        lblmensaje.Text      = "Se encontró " + dt.Rows.Count + " resultados";
                        gv_quiebres.DataBind();
                    }
                }
            }
            catch (Exception ex)
            {
                ex.Message.ToString();
                lblmensaje.ForeColor = System.Drawing.Color.Red;
                lblmensaje.Text      = "Ocurrió un error inesperado, Por favor intentelo más tarde o comuníquese con el área de Tecnología de Información.";
                gv_quiebres.DataBind();

                //System.Threading.Thread.Sleep(8000);
                //Response.Redirect("~/err_mensaje_seccion.aspx", true);
            }
        }
Ejemplo n.º 6
0
        protected void cargarGrilla_Reporte_Presencia()
        {
            lblmensaje.Text = "";
            try
            {
                Facade_Proceso_Operativo.Facade_Proceso_Operativo obj_Facade_Proceso_Operativo = new SIGE.Facade_Proceso_Operativo.Facade_Proceso_Operativo();

                DataSet ds = null;

                compañia = Convert.ToInt32(this.Session["companyid"]);

                string sidplanning = cmbplanning.SelectedValue;
                if (sidplanning == "")
                {
                    sidplanning = "0";
                }

                string sidchannel = cmbcanal.SelectedValue;
                if (sidchannel == "")
                {
                    sidchannel = "0";
                }

                int iidmercaderista = Convert.ToInt32(cmbMercaderista.SelectedValue);
                int icod_oficina    = Convert.ToInt32(cmbOficina.SelectedValue);

                int icod_malla;
                if (cmbMalla.Enabled)
                {
                    icod_malla = Convert.ToInt32(cmbMalla.SelectedValue);
                }
                else
                {
                    icod_malla = 0;
                }

                string sidPDV = cmbPuntoDeVenta.SelectedValue;
                if (sidPDV == "")
                {
                    sidPDV = "0";
                }

                string sidTipoReporte = cmbTipo_reporte.SelectedValue;
                if (sidTipoReporte == "")
                {
                    sidTipoReporte = "0";
                }
                TipoReporte = sidTipoReporte;

                DateTime dfecha_inicio;
                DateTime dfecha_fin;

                #region validacion fecha if{...}
                if (txt_fecha_inicio.SelectedDate.ToString() == "" || txt_fecha_inicio.SelectedDate.ToString() == "0" || txt_fecha_inicio.SelectedDate == null)
                {
                    dfecha_inicio = txt_fecha_inicio.MinDate;
                }
                else
                {
                    dfecha_inicio = txt_fecha_inicio.SelectedDate.Value;
                }

                if (txt_fecha_fin.SelectedDate.ToString() == "" || txt_fecha_fin.SelectedDate.ToString() == "0" || txt_fecha_fin.SelectedDate == null)
                {
                    dfecha_fin = txt_fecha_fin.MaxDate;
                }
                else
                {
                    dfecha_fin = txt_fecha_fin.SelectedDate.Value;
                }

                if (DateTime.Compare(dfecha_inicio, dfecha_fin) == 1)
                {
                    lblmensaje.Visible   = true;
                    lblmensaje.Text      = "La fecha de inicio debe ser menor o igual a la fecha fin";
                    lblmensaje.ForeColor = System.Drawing.Color.Red;
                }
                #endregion
                //else if (sidTipoReporte.Equals("0"))
                //{
                //    lblmensaje.Visible = true;
                //    lblmensaje.Text = "Debe seleccionar un Tipo de Reporte.";
                //    lblmensaje.ForeColor = System.Drawing.Color.Red;
                //}
                else
                {
                    Conexion Ocoon = new Conexion();
                    ds = Ocoon.ejecutarDataSet("UP_WEBXPLORA_OPE_CONSULTA_PRESENCIA_WITH_PIVOT", compañia, sidplanning, sidchannel, iidmercaderista, icod_oficina, icod_malla, sidPDV, sidTipoReporte, dfecha_inicio, dfecha_fin);

                    if (ds != null && ds.Tables.Count > 0)
                    {
                        if (ds.Tables[0].Rows.Count > 0)
                        {
                            Productos = ds.Tables[0];
                            DataTable Datos = ds.Tables[1];

                            if (Datos.Rows.Count > 0)
                            {
                                gv_presencia.DataSource = Datos;
                                //gv_presencia.DataBind();

                                GridView1.DataSource = Datos;

                                //GridView1.DataBind();
                                gv_Presencia_DataBind();
                                lblmensaje.ForeColor = System.Drawing.Color.Green;
                                lblmensaje.Text      = "Se encontró " + Datos.Rows.Count + " resultados";

                                if (TipoReporte.Equals("04") || TipoReporte.Equals("0") || TipoReporte.Equals("05"))
                                {
                                    if (ds.Tables[2] != null)
                                    {
                                        gv_Calculos.DataSource = ds.Tables[2];
                                        gv_Calculos.DataBind();
                                        GridView2.DataSource = ds.Tables[2];
                                        GridView2.DataBind();
                                    }
                                }
                                else
                                {
                                    gv_Calculos.DataSource = null;
                                    gv_Calculos.DataBind();
                                    GridView2.DataSource = null;
                                    GridView2.DataBind();
                                }
                            }
                            else
                            {
                                lblmensaje.ForeColor = System.Drawing.Color.Blue;
                                lblmensaje.Text      = "Se encontró " + Datos.Rows.Count + " resultados";
                            }
                        }
                        else
                        {
                            lblmensaje.ForeColor = System.Drawing.Color.Blue;
                            lblmensaje.Text      = "No se encontraron resultados";
                            gv_Presencia_DataBind();
                            gv_Calculos.DataBind();
                            GridView1.DataBind();
                        }
                    }
                    else
                    {
                        lblmensaje.ForeColor = System.Drawing.Color.Blue;
                        lblmensaje.Text      = "No se encontraron resultados";
                        gv_Presencia_DataBind();
                        gv_Calculos.DataBind();
                        GridView1.DataBind();
                    }
                }
            }
            catch (Exception ex)
            {
                ex.Message.ToString();
                lblmensaje.ForeColor = System.Drawing.Color.Red;
                lblmensaje.Text      = "Ocurrió un error inesperado, Por favor intentelo más tarde o comuníquese con el área de Tecnología de Información.";
                gv_Presencia_DataBind();
                gv_Calculos.DataBind();
                GridView1.DataBind();
            }
        }
Ejemplo n.º 7
0
        protected void cargarGrilla_Impulso()
        {
            lblmensaje.Text = "";
            try
            {
                Facade_Proceso_Operativo.Facade_Proceso_Operativo obj_Facade_Proceso_Operativo = new SIGE.Facade_Proceso_Operativo.Facade_Proceso_Operativo();

                DataTable dt = null;

                #region person
                int iidperson = 0;
                if (cmbperson.SelectedIndex >= 0)
                {
                    iidperson = Convert.ToInt32(cmbperson.SelectedValue);
                }
                #endregion
                string sidplanning      = cmbplanning.SelectedValue;
                string sidchannel       = cmbcanal.SelectedValue;
                int    icod_oficina     = Convert.ToInt32(cmbOficina.SelectedValue);
                int    iidNodeComercial = Convert.ToInt32(cmbNodeComercial.SelectedValue);
                #region pdv
                string sidPDV = cmbPuntoDeVenta.SelectedValue;
                if (sidPDV == "")
                {
                    sidPDV = "0";
                }
                #endregion
                #region categoria
                string sidcategoriaProducto = cmbcategoria_producto.SelectedValue;
                if (sidcategoriaProducto == "")
                {
                    sidcategoriaProducto = "0";
                }
                #endregion
                #region marca
                string sidmarca = cmbmarca.SelectedValue;
                if (sidmarca == "")
                {
                    sidmarca = "0";
                }
                #endregion

                string iidcorporacion = cmbcorporacion.SelectedValue;
                if (iidcorporacion == "")
                {
                    iidcorporacion = "0";
                }

                DateTime dfecha_inicio;
                DateTime dfecha_fin;

                #region validacion fecha if{...}
                if (txt_fecha_inicio.SelectedDate.ToString() == "" || txt_fecha_inicio.SelectedDate.ToString() == "0" || txt_fecha_inicio.SelectedDate == null)
                {
                    dfecha_inicio = txt_fecha_inicio.MinDate;
                }
                else
                {
                    dfecha_inicio = txt_fecha_inicio.SelectedDate.Value;
                }

                if (txt_fecha_fin.SelectedDate.ToString() == "" || txt_fecha_fin.SelectedDate.ToString() == "0" || txt_fecha_fin.SelectedDate == null)
                {
                    dfecha_fin = txt_fecha_fin.MaxDate;
                }
                else
                {
                    dfecha_fin = txt_fecha_fin.SelectedDate.Value;
                }

                if (DateTime.Compare(dfecha_inicio, dfecha_fin) == 1)
                {
                    lblmensaje.Visible   = true;
                    lblmensaje.Text      = "La fecha de inicio debe ser menor o igual a la fecha fin";
                    lblmensaje.ForeColor = System.Drawing.Color.Red;
                }
                #endregion
                else
                {
                    Conexion Ocoon = new Conexion();

                    //dt = Ocoon.ejecutarDataTable("UP_WEBXPLORA_OPE_CONSULTA_STOCK_INGRESOS", dfecha_inicio, dfecha_fin, sidplanning, sidchannel, iidcorporacion, icod_oficina, iidNodeComercial, sidPDV, sidmarca, sidcategoriaProducto, iidperson);
                    //dt = Ocoon.ejecutarDataTable("UP_WEBXPLORA_OPE_CONSULTA_STOCK_INGRESOS3", dfecha_inicio, dfecha_fin, sidplanning, sidchannel, iidcorporacion, icod_oficina, iidNodeComercial, sidPDV, sidmarca, sidcategoriaProducto, iidperson);
                    //dt = Ocoon.ejecutarDataTable("UP_WEBXPLORA_OPE_CONSULTA_IMPULSO_SANFERNANDO_MODERNO", sidplanning, sidchannel, iidcorporacion, icod_oficina, iidNodeComercial, sidPDV, sidcategoriaProducto, sidmarca, dfecha_inicio, dfecha_fin);
                    //UP_WEBXPLORA_OPE_CONSULTA_IMPULSO_SANFERNANDO_MODERNO_ModiBy_pSalas
                    dt = Ocoon.ejecutarDataTable("UP_WEBXPLORA_OPE_CONSULTA_IMPULSO_SANFERNANDO_MODERNO", sidchannel, sidplanning, iidcorporacion, icod_oficina, iidNodeComercial, sidPDV, sidcategoriaProducto, sidmarca, dfecha_inicio, dfecha_fin, 0);
                    //dt = Ocoon.ejecutarDataTable("UP_WEBXPLORA_OPE_CONSULTA_IMPULSO_SANFERNANDO_MODERNO_ModiBy_pSalas", sidplanning,  0, 0, 0, "0", 0, 0, dfecha_inicio, dfecha_fin, "0");



                    if (dt.Rows.Count > 0)
                    {
                        gv_impulso.DataSource = dt;
                        gv_impulso.DataBind();


                        gv_impulsoToExcel.DataSource = dt;
                        gv_impulsoToExcel.DataBind();

                        lblmensaje.ForeColor = System.Drawing.Color.Green;
                        lblmensaje.Text      = "Se encontró " + dt.Rows.Count + " resultados";
                    }
                    else
                    {
                        lblmensaje.ForeColor = System.Drawing.Color.Blue;
                        lblmensaje.Text      = "Se encontró " + dt.Rows.Count + " resultados";
                        gv_impulso.DataBind();
                    }
                }
            }
            catch (Exception ex)
            {
                ex.Message.ToString();
                lblmensaje.ForeColor = System.Drawing.Color.Red;
                lblmensaje.Text      = "Ocurrió un error inesperado, Por favor intentelo más tarde o comuníquese con el área de Tecnología de Información.";
                gv_impulso.DataBind();

                //System.Threading.Thread.Sleep(8000);
                //Response.Redirect("~/err_mensaje_seccion.aspx", true);
            }
        }
Ejemplo n.º 8
0
        protected void cargarGrilla_Ventas()
        {
            lblmensaje.Text = "";
            try
            {
                Facade_Proceso_Operativo.Facade_Proceso_Operativo obj_Facade_Proceso_Operativo = new SIGE.Facade_Proceso_Operativo.Facade_Proceso_Operativo();

                DataTable dt = null;

                string iidpersons = "0";
                if (cmbperson.SelectedIndex >= 0)
                {
                    /// Obtener id del person y anidarlos en una cadena------------
                    /// Ditmar Estrada

                    string cadenaIdPersons = "";

                    for (int i = 0; i < cmbperson.Items.Count; i++)
                    {
                        if (cmbperson.Items[i].Selected)
                        {
                            cadenaIdPersons = cadenaIdPersons + cmbperson.Items[i].Value + ",";
                        }
                    }
                    iidpersons = cadenaIdPersons.Substring(0, cadenaIdPersons.Length - 1);

                    //----
                }

                string sidplanning      = cmbplanning.SelectedValue;
                string sidchannel       = cmbcanal.SelectedValue;
                int    icod_oficina     = Convert.ToInt32(cmbOficina.SelectedValue);
                int    iidNodeComercial = Convert.ToInt32(cmbNodeComercial.SelectedValue);
                string sidPDV           = cmbPuntoDeVenta.SelectedValue;
                if (sidPDV == "")
                {
                    sidPDV = "0";
                }
                string sidcategoriaProducto = cmbcategoria_producto.SelectedValue;
                string sidmarca             = cmbmarca.SelectedValue;
                if (sidcategoriaProducto == "")
                {
                    sidcategoriaProducto = "0";
                }
                string scodproducto = cmbsku.SelectedValue;
                if (scodproducto == "")
                {
                    scodproducto = "0";
                }
                if (sidmarca == "")
                {
                    sidmarca = "0";
                }
                int iidsupervisor = Convert.ToInt32(cmbSupervisor.SelectedValue);
                int iidsector     = Convert.ToInt32(cmbSector.SelectedValue);

                DateTime dfecha_inicio;
                DateTime dfecha_fin;

                if (txt_fecha_inicio.SelectedDate.ToString() == "" || txt_fecha_inicio.SelectedDate.ToString() == "0" || txt_fecha_inicio.SelectedDate == null)
                {
                    dfecha_inicio = txt_fecha_inicio.MinDate;
                }
                else
                {
                    dfecha_inicio = txt_fecha_inicio.SelectedDate.Value;
                }


                if (txt_fecha_fin.SelectedDate.ToString() == "" || txt_fecha_fin.SelectedDate.ToString() == "0" || txt_fecha_fin.SelectedDate == null)
                {
                    dfecha_fin = txt_fecha_fin.MaxDate;
                }
                else
                {
                    dfecha_fin = txt_fecha_fin.SelectedDate.Value;
                }

                if (DateTime.Compare(dfecha_inicio, dfecha_fin) == 1)
                {
                    lblmensaje.Visible   = true;
                    lblmensaje.Text      = "La fecha de inicio debe ser menor o igual a la fecha fin";
                    lblmensaje.ForeColor = System.Drawing.Color.Red;
                }
                else
                {
                    Conexion Ocoon = new Conexion();

                    dt = Ocoon.ejecutarDataTable("UP_WEBXPLORA_OPE_CONSULTA_VENTA_BORRAR", iidsupervisor, iidpersons, sidplanning, sidchannel, icod_oficina, iidsector, iidNodeComercial, sidPDV, sidcategoriaProducto, sidmarca, scodproducto, dfecha_inicio, dfecha_fin);

                    if (dt.Rows.Count > 0)
                    {
                        gv_ventas.DataSource = dt;
                        gv_ventas.DataBind();


                        gv_stockToExcel.DataSource = dt;
                        gv_stockToExcel.DataBind();

                        lblmensaje.ForeColor = System.Drawing.Color.Green;
                        lblmensaje.Text      = "Se encontró " + dt.Rows.Count + " resultados";
                    }
                    else
                    {
                        lblmensaje.ForeColor = System.Drawing.Color.Blue;
                        lblmensaje.Text      = "Se encontró " + dt.Rows.Count + " resultados";
                        gv_ventas.DataBind();
                    }
                }
            }
            catch (Exception ex)
            {
                ex.Message.ToString();
                lblmensaje.ForeColor = System.Drawing.Color.Red;
                lblmensaje.Text      = "Ocurrió un error inesperado, Por favor intentelo más tarde o comuníquese con el área de Tecnología de Información.";
                gv_ventas.DataBind();

                //System.Threading.Thread.Sleep(8000);
                //Response.Redirect("~/err_mensaje_seccion.aspx", true);
            }
        }