using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.UI.WebControls; using Extensiones; using System.Data; using static Extensiones.ModExtensiones; using Microsoft.Reporting.WebForms; public partial class CGame_RepIngresos : ClsPaginas { protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { InicializaValores(); DdlHuerta.SelectedValueExist(Request["CveHuerta"] == null ? "-1" : Request["CveHuerta"].ToString()); txtFechaI.Text = Request["FechaI"] == null ? DateTime.Now.ToString() : Request["FechaI"].ToString(); txtFechaF.Text = Request["FechaF"] == null ? DateTime.Now.ToString() : Request["FechaF"].ToString(); if (DdlHuerta.SelectedValue.ToEntero() > 0) { Consulta(); } } } private void InicializaValores() { CargaHuerta(); txtFechaI.Text = DateTime.Now.FirstDayOfMonth().ToShortDateString(); txtFechaF.Text = DateTime.Now.ToShortDateString(); UPFiltros.Update(); } private void CargaHuerta() { ClsCGame ObjCGame = new ClsCGame(); if (ObjCGame.GetHuerta(UsuarioActual.CveEmpresa)) { DdlHuerta.DataSource = ObjCGame.DtResultados; DdlHuerta.Items.Insert(0, new ListItem("Todos", "-1")); } ObjCGame.Dispose(); DdlHuerta.DataBind(); } private void Consulta() { ClsCGame ObjCGame = new ClsCGame(); if (ObjCGame.GetRepIngresos(DdlHuerta.SelectedValue.ToEntero(), txtFechaI.Text.ToDate(), txtFechaF.Text.ToDate(), UsuarioActual.CveEmpresa)) { GvDatos.DataSource = ObjCGame.DtResultados; } if (ObjCGame.GetIngresosAgrupados(DdlHuerta.SelectedValue.ToEntero(), txtFechaI.Text.ToDate(), txtFechaF.Text.ToDate(), UsuarioActual.CveEmpresa)) { GvIngresosAgrupados.DataSource = ObjCGame.DtResultados; } ObjCGame.Dispose(); GvDatos.DataBind(); GvIngresosAgrupados.DataBind(); UPDatos.Update(); } protected void BtnConsultar_Click(object sender, EventArgs e) { Consulta(); } protected void GvDatos_RowDataBound(object sender, GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.DataRow) { if (e.Row.RowIndex == 0) { e.Row.Cells[0].Text = "Total"; e.Row.CssClass = "Totales"; } } } protected void GvIngresosAgrupados_RowDataBound(object sender, GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.DataRow) { if (e.Row.RowIndex == 0) { e.Row.Cells[0].Text = "Total"; e.Row.CssClass = "Totales"; } else if (e.Row.DBCampo("CvePS").ToEntero() < 1) { if (e.Row.DBCampo("Tipo").ToEntero() == 1) { e.Row.Cells[0].Text = "Primera"; e.Row.CssClass = "SubTotales"; } if (e.Row.DBCampo("Tipo").ToEntero() == 2) { e.Row.Cells[0].Text = "Segunda"; e.Row.CssClass = "SubTotales"; } if (e.Row.DBCampo("Tipo").ToEntero() == 3) { e.Row.Cells[0].Text = "Jugo"; e.Row.CssClass = "SubTotales"; } } } } }