예제 #1
0
        public CajaBE ReporteCajaDia(SqlConnection cnBD, string usuario, int idCliente, string fechaInicio, List <ListaComboBE> loTienda)
        {
            //LISTADO
            List <ReporteCajaBE> listado = new List <ReporteCajaBE>();
            ReporteCajaBE        obe     = new ReporteCajaBE();
            //LISTADO - COLUMNAS
            List <ReporteColumnas> loColumns  = new List <ReporteColumnas>();
            ReporteColumnas        obeColumns = new ReporteColumnas();
            //INGRESOS
            List <DashBoardBE> loGraficoIngreso  = new List <DashBoardBE>();
            DashBoardBE        obeGraficoIngreso = new DashBoardBE();
            //EGRESOS
            List <DashBoardBE> loGraficoEgreso  = new List <DashBoardBE>();
            DashBoardBE        obeGraficoEgreso = new DashBoardBE();

            CajaBE lobe = new CajaBE();

            using (SqlCommand cmd = new SqlCommand("[dbo].[USP_ReporteCaja_Dia]", cnBD))
            {
                cmd.CommandType    = CommandType.StoredProcedure;
                cmd.CommandTimeout = 0;
                cmd.Parameters.Add("@Usuario", SqlDbType.VarChar, 50).Value     = usuario;
                cmd.Parameters.Add("@IdCliente", SqlDbType.VarChar, 50).Value   = idCliente;
                cmd.Parameters.Add("@FechaInicio", SqlDbType.VarChar, 10).Value = fechaInicio;
                cmd.Parameters.Add("@loTienda", SqlDbType.Structured).Value     = CrearEstructura(loTienda);

                using (SqlDataReader drd = cmd.ExecuteReader())
                {
                    lobe             = new CajaBE();
                    loGraficoIngreso = new List <DashBoardBE>();
                    loGraficoEgreso  = new List <DashBoardBE>();


                    if (drd.HasRows)
                    {
                        int pos_CajaAnterior = drd.GetOrdinal("CajaAnterior");
                        while (drd.Read())
                        {
                            lobe.CajaAnterior = drd.GetDecimal(pos_CajaAnterior);
                        }
                    }
                    drd.NextResult();
                    if (drd.HasRows)
                    {
                        #region Lista - columnas
                        int pos_IdTienda       = drd.GetOrdinal("IdTienda");
                        int pos_DesTienda      = drd.GetOrdinal("DesTienda");
                        int pos_Clase          = drd.GetOrdinal("Clase");
                        int pos_NombreProducto = drd.GetOrdinal("NombreProducto");
                        int pos_Descripcion    = drd.GetOrdinal("Descripcion");
                        int pos_Cantidad       = drd.GetOrdinal("Cantidad");
                        int pos_Precio         = drd.GetOrdinal("Precio");
                        //int pos_PrecioCosto = drd.GetOrdinal("PrecioCosto");
                        int pos_Tipo = drd.GetOrdinal("Tipo");
                        int pos_FechaInicioReporte = drd.GetOrdinal("FechaInicioReporte");
                        #endregion Lista - columnas
                        listado = new List <ReporteCajaBE>();
                        while (drd.Read())
                        {
                            obe = new ReporteCajaBE();
                            #region Lista - campos
                            obe.IdTienda       = drd.GetInt32(pos_IdTienda);
                            obe.DesTienda      = drd.GetString(pos_DesTienda);
                            obe.Clase          = drd.GetString(pos_Clase);
                            obe.NombreProducto = drd.GetString(pos_NombreProducto);
                            obe.Descripcion    = drd.GetString(pos_Descripcion);
                            obe.Cantidad       = drd.GetInt32(pos_Cantidad);
                            obe.Precio         = drd.GetDecimal(pos_Precio);
                            //obe.PrecioCosto = drd.GetDecimal(pos_PrecioCosto);
                            obe.Tipo = drd.GetString(pos_Tipo);
                            obe.FechaInicioReporte = drd.GetString(pos_FechaInicioReporte);
                            listado.Add(obe);
                            #endregion Lista - campos
                        }
                    }
                    drd.NextResult();
                    if (drd.HasRows)
                    {
                        #region ColumnasLista - columnas
                        int pos_field  = drd.GetOrdinal("field");
                        int pos_header = drd.GetOrdinal("header");
                        int pos_width  = drd.GetOrdinal("width");
                        #endregion ColumnasLista - columnas
                        loColumns = new List <ReporteColumnas>();
                        while (drd.Read())
                        {
                            #region ColumnasLista - campos
                            obeColumns        = new ReporteColumnas();
                            obeColumns.field  = drd.GetString(pos_field);
                            obeColumns.header = drd.GetString(pos_header);
                            obeColumns.width  = drd.GetInt32(pos_width);
                            loColumns.Add(obeColumns);
                            #endregion ColumnasLista - campos
                        }
                    }
                    //GRAFICOS
                    drd.NextResult();
                    if (drd.HasRows)
                    {
                        #region columnas
                        int pos_Serie = drd.GetOrdinal("serie");
                        int pos_Label = drd.GetOrdinal("label");
                        #endregion columnas
                        //loGraficoDia = new List<DashBoardBE>();
                        obeGraficoIngreso = new DashBoardBE();
                        List <Decimal> serie = new List <Decimal>();
                        List <String>  label = new List <String>();
                        while (drd.Read())
                        {
                            #region cargarData
                            serie.Add(drd.GetDecimal(pos_Serie));
                            label.Add(drd.GetString(pos_Label));
                            #endregion cargarData
                        }
                        obeGraficoIngreso.serie = serie;
                        obeGraficoIngreso.label = label;
                        loGraficoIngreso.Add(obeGraficoIngreso);
                    }
                    drd.NextResult();
                    if (drd.HasRows)
                    {
                        #region columnas
                        int pos_Serie = drd.GetOrdinal("serie");
                        int pos_Label = drd.GetOrdinal("label");
                        #endregion columnas
                        //loGraficoSemana = new List<DashBoardBE>();
                        obeGraficoEgreso = new DashBoardBE();
                        List <Decimal> serie = new List <Decimal>();
                        List <String>  label = new List <String>();
                        while (drd.Read())
                        {
                            #region cargarData
                            serie.Add(drd.GetDecimal(pos_Serie));
                            label.Add(drd.GetString(pos_Label));
                            #endregion cargarData
                        }
                        obeGraficoEgreso.serie = serie;
                        obeGraficoEgreso.label = label;
                        loGraficoEgreso.Add(obeGraficoEgreso);
                    }
                }
            }
            lobe.listado          = listado;
            lobe.loColumns        = loColumns;
            lobe.loGraficoIngreso = loGraficoIngreso;
            lobe.loGraficoEgreso  = loGraficoEgreso;

            return(lobe);
        }
예제 #2
0
        public CajaBE ListarDatosIniciales(SqlConnection cnBD, string usuario, int idCliente, List <ListaComboBE> loTienda)
        {
            List <DashBoardBE> loGraficoIngresos  = new List <DashBoardBE>();
            DashBoardBE        obeGraficoIngresos = new DashBoardBE();
            List <DashBoardBE> loGraficoEgresos   = new List <DashBoardBE>();
            DashBoardBE        obeGraficoEgresos  = new DashBoardBE();

            CajaBE obe = new CajaBE();

            using (SqlCommand cmd = new SqlCommand("[dbo].[USP_FlujoCaja_DatosIniciales]", cnBD))
            {
                cmd.CommandType    = CommandType.StoredProcedure;
                cmd.CommandTimeout = 0;
                cmd.Parameters.Add("@Usuario", SqlDbType.VarChar, 50).Value = usuario;
                cmd.Parameters.Add("@IdCliente", SqlDbType.Int).Value       = idCliente;
                cmd.Parameters.Add("@loTienda", SqlDbType.Structured).Value = CrearEstructura(loTienda);

                using (SqlDataReader drd = cmd.ExecuteReader())
                {
                    obe = new CajaBE();
                    loGraficoIngresos = new List <DashBoardBE>();
                    loGraficoEgresos  = new List <DashBoardBE>();

                    if (drd.HasRows)
                    {
                        #region columnas
                        int pos_Serie = drd.GetOrdinal("serie");
                        int pos_Label = drd.GetOrdinal("label");
                        #endregion columnas
                        //loGraficoDia = new List<DashBoardBE>();
                        obeGraficoIngresos = new DashBoardBE();
                        List <Decimal> serie = new List <Decimal>();
                        List <String>  label = new List <String>();
                        while (drd.Read())
                        {
                            #region cargarData
                            serie.Add(drd.GetDecimal(pos_Serie));
                            label.Add(drd.GetString(pos_Label));
                            #endregion cargarData
                        }
                        obeGraficoIngresos.serie = serie;
                        obeGraficoIngresos.label = label;
                        loGraficoIngresos.Add(obeGraficoIngresos);
                    }
                    drd.NextResult();
                    if (drd.HasRows)
                    {
                        #region columnas
                        int pos_Serie = drd.GetOrdinal("serie");
                        int pos_Label = drd.GetOrdinal("label");
                        #endregion columnas
                        //loGraficoSemana = new List<DashBoardBE>();
                        obeGraficoEgresos = new DashBoardBE();
                        List <Decimal> serie = new List <Decimal>();
                        List <String>  label = new List <String>();
                        while (drd.Read())
                        {
                            #region cargarData
                            serie.Add(drd.GetDecimal(pos_Serie));
                            label.Add(drd.GetString(pos_Label));
                            #endregion cargarData
                        }
                        obeGraficoEgresos.serie = serie;
                        obeGraficoEgresos.label = label;
                        loGraficoEgresos.Add(obeGraficoEgresos);
                    }

                    obe.loGraficoIngreso = loGraficoIngresos;
                    obe.loGraficoEgreso  = loGraficoEgresos;

                    //obe.listado = loGraficoMes;
                    //obe.loColumns = loGraficoMes;
                }
            }
            return(obe);
        }
예제 #3
0
        public DashBoard_DatosInicialesBE ListarDatosIniciales(SqlConnection cnBD, string usuario)
        {
            List <DashBoardBE>         loGraficoDia     = new List <DashBoardBE>();
            DashBoardBE                obeGraficoDia    = new DashBoardBE();
            List <DashBoardBE>         loGraficoSemana  = new List <DashBoardBE>();
            DashBoardBE                obeGraficoSemana = new DashBoardBE();
            List <DashBoardBE>         loGraficoMes     = new List <DashBoardBE>();
            DashBoardBE                obeGraficoMes    = new DashBoardBE();
            DashBoard_DatosInicialesBE obe = new DashBoard_DatosInicialesBE();

            using (SqlCommand cmd = new SqlCommand("[dbo].[USP_DashBoard_Grafico]", cnBD))
            {
                cmd.CommandType    = CommandType.StoredProcedure;
                cmd.CommandTimeout = 0;
                cmd.Parameters.Add("@Usuario", SqlDbType.VarChar, 50).Value = usuario;

                using (SqlDataReader drd = cmd.ExecuteReader())
                {
                    obe             = new DashBoard_DatosInicialesBE();
                    loGraficoDia    = new List <DashBoardBE>();
                    loGraficoSemana = new List <DashBoardBE>();
                    loGraficoMes    = new List <DashBoardBE>();

                    if (drd.HasRows)
                    {
                        #region columnas
                        int pos_Serie = drd.GetOrdinal("serie");
                        int pos_Label = drd.GetOrdinal("label");
                        #endregion columnas
                        //loGraficoDia = new List<DashBoardBE>();
                        obeGraficoDia = new DashBoardBE();
                        List <Decimal> serie = new List <Decimal>();
                        List <String>  label = new List <String>();
                        while (drd.Read())
                        {
                            #region cargarData
                            serie.Add(drd.GetInt32(pos_Serie));
                            label.Add(drd.GetString(pos_Label));
                            #endregion cargarData
                        }
                        obeGraficoDia.serie = serie;
                        obeGraficoDia.label = label;
                        loGraficoDia.Add(obeGraficoDia);
                    }
                    drd.NextResult();
                    if (drd.HasRows)
                    {
                        #region columnas
                        int pos_Serie = drd.GetOrdinal("serie");
                        int pos_Label = drd.GetOrdinal("label");
                        #endregion columnas
                        //loGraficoSemana = new List<DashBoardBE>();
                        obeGraficoSemana = new DashBoardBE();
                        List <Decimal> serie = new List <Decimal>();
                        List <String>  label = new List <String>();
                        while (drd.Read())
                        {
                            #region cargarData
                            serie.Add(drd.GetInt32(pos_Serie));
                            label.Add(drd.GetString(pos_Label));
                            #endregion cargarData
                        }
                        obeGraficoSemana.serie = serie;
                        obeGraficoSemana.label = label;
                        loGraficoSemana.Add(obeGraficoSemana);
                    }
                    drd.NextResult();
                    if (drd.HasRows)
                    {
                        #region columnas
                        int pos_Serie = drd.GetOrdinal("serie");
                        int pos_Label = drd.GetOrdinal("label");
                        #endregion columnas
                        //loGraficoMes = new List<DashBoardBE>();
                        obeGraficoMes = new DashBoardBE();
                        List <Decimal> serie = new List <Decimal>();
                        List <String>  label = new List <String>();
                        while (drd.Read())
                        {
                            #region cargarData
                            serie.Add(drd.GetInt32(pos_Serie));
                            label.Add(drd.GetString(pos_Label));
                            #endregion cargarData
                        }
                        obeGraficoMes.serie = serie;
                        obeGraficoMes.label = label;
                        loGraficoMes.Add(obeGraficoMes);
                    }
                    obe.loGraficoDia    = loGraficoDia;
                    obe.loGraficoSemana = loGraficoSemana;
                    obe.loGraficoMes    = loGraficoMes;
                }
            }
            return(obe);
        }