Files
SIG/Ventas/RepComisionesJAM2Detalle.aspx.cs
2023-10-09 11:55:07 -07:00

81 lines
2.9 KiB
C#

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI.WebControls;
using System.Data;
using Extensiones;
using Microsoft.Reporting.WebForms;
public partial class Ventas_RepComisionesJAM2Detalle : ClsPaginas
{
#region PROPIEDADES
#endregion
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
InicializaValores();
}
}
private void InicializaValores()
{
txtFechaI.Text = NowADS().FirstDayOfMonth().ToShortDateString();
txtFechaF.Text = NowADS().LastDayOfMonth().ToShortDateString();
DdlVendedor.DataSource = get_GlobalDTVendedores(UsuarioActual.CveEmpresa);
DdlVendedor.DataBind();
DdlSubProyecto.DataSource = get_GlobalDTSubProyectos(-1, CveEmpresa: UsuarioActual.CveEmpresa);
DdlSubProyecto.DataBind();
DdlVendedor.SelectedValueExist(Request["CveVendedor"] == null ? "-1" : Request["CveVendedor"].ToString());
DdlSubProyecto.SelectedValueExist(Request["CveSubProyecto"] == null ? "-1" : Request["CveSubProyecto"].ToString());
txtFechaI.Text = Request["FechaI"] == null ? NowADS().FirstDayOfMonth().ToShortDateString() : Request["FechaI"].ToString();
txtFechaF.Text = Request["FechaF"] == null ? NowADS().LastDayOfMonth().ToShortDateString() : Request["FechaF"].ToString();
CargaDatos();
}
private void CargaDatos()
{
ClsEsquemasComisiones ObjComisiones = new ClsEsquemasComisiones();
DateTime FechaI, FechaF;
if (txtFechaI.Text != "") { FechaI = txtFechaI.Text.ToDate(); } else { FechaI = DateTime.MinValue; }
if (txtFechaF.Text != "") { FechaF = txtFechaF.Text.ToDate(); } else { FechaF = DateTime.MaxValue; }
if (ObjComisiones.GetRepComisiones2Detalle(DdlVendedor.SelectedValue.ToEntero(), FechaI, FechaF, DdlSubProyecto.SelectedValue.ToEntero(), UsuarioActual.CveEmpresa))
{
GvDatos.DataSource = ObjComisiones.DtResultados;
}
ObjComisiones.Dispose();
GvDatos.DataBind();
UpDatos.Update();
}
protected void GvDatos_RowDataBound(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow)
{
if (e.Row.DBCampo("CveVendedor").ToEntero() < 1)
{
e.Row.Cells[0].Text = "Total";
e.Row.CssClass = "Totales";
}else if(e.Row.DBCampo("CveVenta").ToEntero() < 1)
{
e.Row.Cells[0].Text = e.Row.DBCampo("Vendedor").ToString();
e.Row.CssClass = "SubTotales";
}
else
{
e.Row.Cells[8].Text = "";
}
}
}
protected void BtnConsultar_Click(object sender, EventArgs e)
{
CargaDatos();
}
}