public async Task <Response <List <Ticket> > > ObtenerTicketsPorIntervalo(IntervaloTicket i)
        {
            var response = new Response <List <Ticket> >();

            try
            {
                using (var connection = new SqlConnection(con.getConnection()))
                {
                    using (var command = new SqlCommand("Reporte.spObtenerTicketsIntervalo", connection))
                    {
                        command.CommandType = CommandType.StoredProcedure;
                        command.Parameters.Clear();
                        command.Parameters.AddWithValue("@idEmpresa", i.idEmpresa);
                        command.Parameters.AddWithValue("@fechaInicio", i.fechaInicio);
                        command.Parameters.AddWithValue("@fechaFinal", i.fechaFinal);
                        command.Parameters.AddWithValue("@horaInicio", i.horaInicio);
                        command.Parameters.AddWithValue("@horaFinal", i.horaFinal);
                        connection.Open();
                        using (var reader = await command.ExecuteReaderAsync())
                        {
                            var list = new List <Ticket>();

                            while (reader.Read())
                            {
                                var ticket = new Ticket();
                                ticket.idTicket      = reader.GetInt32("idTicket");
                                ticket.fecha         = reader.GetString("fecha");
                                ticket.hora          = reader.GetString("hora");
                                ticket.total         = reader.GetDouble("total");
                                ticket.descripcion   = reader.GetString("descripcion");
                                ticket.comentario    = reader.GetString("comentario");
                                ticket.idEstatus     = reader.GetInt32("idEstatus");
                                ticket.nombreEstatus = reader.GetString("nombreEstatus");
                                ticket.idUsuario     = reader.GetInt32("idUsuario");
                                ticket.activo        = reader.GetBoolean("activo");
                                ticket.pago          = reader.GetDouble("pago");
                                ticket.cambio        = reader.GetDouble("cambio");
                                list.Add(ticket);
                            }
                            response.success = true;
                            response.message = "Datos Obtenidos Correctamente";
                            response.Data    = list;
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                response.success = false;
                response.message = ex.Message;
            }
            return(response);
        }
        public async Task <ActionResult> ObtenerReportePorIntervalo([FromBody] IntervaloTicket i)
        {
            var response = new Response <Reporte>();

            try
            {
                response = await this.reporte.ObtenerReportePorIntervalo(i);
            }
            catch (Exception ex)
            {
                response.success = false;
                response.message = ex.Message;
            }
            return(Ok(response));
        }
예제 #3
0
        public async Task <Response <Reporte> > ObtenerReportePorIntervalo(IntervaloTicket i)
        {
            var response = new Response <Reporte>();

            try
            {
                using (var connection = new SqlConnection(con.getConnection()))
                {
                    using (var command = new SqlCommand("Reporte.spReportePorIntervalo ", connection))
                    {
                        command.CommandType = CommandType.StoredProcedure;
                        command.Parameters.Clear();
                        command.Parameters.AddWithValue("@idEmpresa", i.idEmpresa);
                        command.Parameters.AddWithValue("@fechaInicio", i.fechaInicio);
                        command.Parameters.AddWithValue("@fechaFinal", i.fechaFinal);
                        command.Parameters.AddWithValue("@horaInicio", i.horaInicio);
                        command.Parameters.AddWithValue("@horaFinal", i.horaFinal);
                        connection.Open();
                        using (var reader = await command.ExecuteReaderAsync())
                        {
                            var reporte = new Reporte();
                            while (reader.Read())
                            {
                                reporte.totalVendido       = reader.GetDouble("totalVendido");
                                reporte.articuloMasVendido = reader.GetString("articuloMasVendido");
                                reporte.totalArticulos     = reader.GetInt32("totalArticulos");
                                reporte.totalGastos        = reader.GetDouble("totalGastos");
                                reporte.totalIngresos      = reader.GetDouble("totalIngresos");
                            }
                            response.success = true;
                            response.message = "Datos Obtenidos Correctamente";
                            response.Data    = reporte;
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                response.success = false;
                response.message = ex.Message;
            }
            return(response);
        }
예제 #4
0
        public async Task <Response <List <ReporteProducto> > > ObtenerReporteProductoPorIntervalo(IntervaloTicket i)
        {
            var response = new Response <List <ReporteProducto> >();

            try
            {
                using (var connection = new SqlConnection(con.getConnection()))
                {
                    using (var command = new SqlCommand("Reporte.spReporteProductosPorIntervalo", connection))
                    {
                        command.CommandType = CommandType.StoredProcedure;
                        command.Parameters.Clear();
                        command.Parameters.AddWithValue("@idEmpresa", i.idEmpresa);
                        command.Parameters.AddWithValue("@fechaInicio", i.fechaInicio);
                        command.Parameters.AddWithValue("@fechaFinal", i.fechaFinal);
                        command.Parameters.AddWithValue("@horaInicio", i.horaInicio);
                        command.Parameters.AddWithValue("@horaFinal", i.horaFinal);
                        connection.Open();
                        using (var reader = await command.ExecuteReaderAsync())
                        {
                            var list = new List <ReporteProducto>();
                            while (reader.Read())
                            {
                                var reporte = new ReporteProducto();
                                reporte.idProducto = reader.GetInt32("idProducto");
                                reporte.nombre     = reader.GetString("nombre");
                                reporte.precio     = reader.GetDouble("precio");
                                reporte.cantidad   = reader.GetInt32("cantidad");
                                reporte.total      = reader.GetDouble("total");
                                list.Add(reporte);
                            }
                            response.success = true;
                            response.message = "Datos Obtenidos Correctamente";
                            response.Data    = list;
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                response.success = false;
                response.message = ex.Message;
            }
            return(response);
        }