Files
SIG/CGame/RepPreEnfriado.aspx.cs
JORGE LUIS CAUDILLO ESPARZA c35cf91883 Commit inicial Ventas Productivo
2019-08-14 16:40:54 -07:00

73 lines
2.7 KiB
C#

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_RepPreEnfriado : 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();
ChkLiquidado.Checked= Convert.ToBoolean(Request["Liquidado"] == null ? 0 : Request["Liquidado"].ToString().ToEntero());
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.GetRepPreEnfriado(DdlHuerta.SelectedValue.ToEntero(), txtFechaI.Text.ToDate(), txtFechaF.Text.ToDate(),UsuarioActual.CveEmpresa,ChkLiquidado.Checked))
{
GvDatos.DataSource = ObjCGame.DtResultados;
}
ObjCGame.Dispose();
GvDatos.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";
}else if (e.Row.DBCampo("CvePS").ToEntero() < 1)
{
e.Row.CssClass = "SubTotales";
}else if (e.Row.DBCampo("CveOrdenProduccion").ToEntero() < 1){
e.Row.Cells[1].Text = "No asignada";
}
}
}
}