120 lines
3.8 KiB
C#
120 lines
3.8 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;
|
|
using System.Web.UI;
|
|
|
|
public partial class Inventarios_RepMovimientosSalida : ClsPaginas
|
|
{
|
|
protected void Page_Load(object sender, EventArgs e)
|
|
{
|
|
if (!IsPostBack)
|
|
{
|
|
InicializaValores();
|
|
}
|
|
}
|
|
|
|
private void InicializaValores()
|
|
{
|
|
txtFechaI.Text = NowADS().FirstDayOfMonth().ToShortDateString();
|
|
txtFechaF.Text = NowADS().ToShortDateString();
|
|
DdlSubProyecto.DataSource = get_GlobalDTSubProyectosUsuarios(UsuarioActual.CveUsuario, -1, UsuarioActual.CveEmpresa);
|
|
DdlSubProyecto.DataBind();
|
|
DdlSubProyecto.Items.Insert(0, new ListItem("Todos", "-1"));
|
|
|
|
//Cargo Clasificaciones
|
|
DdlClasificacion.DataSource = get_GlobalDTClasificaciones(UsuarioActual.CveEmpresa);
|
|
DdlClasificacion.DataBind();
|
|
|
|
DdlClientes.setEsWebService(true);
|
|
|
|
}
|
|
|
|
private void Consulta()
|
|
{
|
|
int tCveCliente = -1;
|
|
int tCveGrupo = -1;
|
|
if (DdlClientes.SelectedValue.ToEntero() > 0) tCveCliente = DdlClientes.SelectedValue.ToEntero();
|
|
if (DdlGrupo.SelectedValue.ToEntero() > 0) tCveGrupo = DdlGrupo.SelectedValue.ToEntero();
|
|
|
|
ClsInventarios ObjInv = new ClsInventarios();
|
|
if (ObjInv.GetRepMovimientosSalida(txtFechaI.Text.ToDate(), txtFechaF.Text.ToDate(), DdlSubProyecto.SelectedValue.ToEntero(), tCveCliente, DdlClasificacion.SelectedValue.ToEntero(), DdlGrupo.SelectedValue.ToEntero(), UsuarioActual.CveEmpresa))
|
|
{
|
|
if (tCveGrupo == 1)
|
|
GvDatos.DataSource = ObjInv.DtResultados;
|
|
else
|
|
GvGrupo.DataSource = ObjInv.DtResultados;
|
|
}
|
|
ObjInv.Dispose();
|
|
GvDatos.DataBind();
|
|
GvGrupo.DataBind();
|
|
UpDatos.Update();
|
|
|
|
if (DdlGrupo.SelectedValue == "1")
|
|
{
|
|
TbDetalle.Visible = true;
|
|
GvDatos.Visible = true;
|
|
GvGrupo.Visible = false;
|
|
}
|
|
else
|
|
{
|
|
TbDetalle.Visible = false;
|
|
GvDatos.Visible = false;
|
|
GvGrupo.Visible = true;
|
|
}
|
|
|
|
}
|
|
|
|
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 GvGrupo_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("Grupo2") == "" && e.Row.DBCampo("Grupo1") != "")
|
|
{
|
|
e.Row.CssClass = "SubTotales";
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
public override void VerifyRenderingInServerForm(Control control)
|
|
{
|
|
//base.VerifyRenderingInServerForm(control);
|
|
}
|
|
|
|
protected void LnkExcel_Click(object sender, EventArgs e)
|
|
{
|
|
if (DdlGrupo.SelectedValue == "1")
|
|
{
|
|
GvDatos.ExportToExcelG("Movimientos de Salida", "Movimientos de Salida", UsuarioActual);
|
|
}
|
|
else
|
|
{
|
|
GvGrupo.ExportToExcelG("Movimientos de Salida", "Movimientos de Salida", UsuarioActual);
|
|
}
|
|
|
|
}
|
|
} |