Commit inicial Ventas Productivo
This commit is contained in:
134
Compras/RepComprasInventarios.aspx.cs
Normal file
134
Compras/RepComprasInventarios.aspx.cs
Normal file
@@ -0,0 +1,134 @@
|
||||
using System;
|
||||
using System.Data;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Web;
|
||||
using System.Web.UI;
|
||||
using System.Web.UI.WebControls;
|
||||
|
||||
using Extensiones;
|
||||
using static Extensiones.ModExtensiones;
|
||||
using Microsoft.Reporting.WebForms;
|
||||
|
||||
public partial class Compras_RepComprasInventarios : ClsPaginas
|
||||
{
|
||||
#region "Propiedades"
|
||||
private DataTable DtDatos
|
||||
{
|
||||
get
|
||||
{
|
||||
return (DataTable)ViewState["DtDatos"];
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
ViewState["DtDatos"] = value;
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
protected void Page_Load(object sender, EventArgs e)
|
||||
{
|
||||
if (!IsPostBack)
|
||||
{
|
||||
InicializaDatos();
|
||||
}
|
||||
}
|
||||
|
||||
protected void InicializaDatos()
|
||||
{
|
||||
txtFechaIC.Text = new DateTime(DateTime.Now.Year, DateTime.Now.Month - 1, DateTime.Now.Day).ToShortDateString();
|
||||
txtFechaFC.Text = DateTime.Now.ToShortDateString();
|
||||
txtFechaI.Text = new DateTime(DateTime.Now.Year, DateTime.Now.Month - 1, DateTime.Now.Day).ToShortDateString();
|
||||
txtFechaF.Text = DateTime.Now.ToShortDateString();
|
||||
|
||||
CargaCombos();
|
||||
|
||||
CargaDatos();
|
||||
}
|
||||
|
||||
protected void CargaCombos()
|
||||
{
|
||||
//Carga SubProyectos
|
||||
DdlSubProyecto.DataSource = get_GlobalDTSubProyectosUsuarios(UsuarioActual.CveUsuario, -1, UsuarioActual.CveEmpresa, -1, 1);
|
||||
DdlSubProyecto.DataBind();
|
||||
|
||||
//Carga Proveedores
|
||||
DdlProveedor.DataSource = get_GlobalDTCompProveedores(UsuarioActual.CveEmpresa);
|
||||
DdlProveedor.DataBind();
|
||||
}
|
||||
|
||||
protected void CargaDatos()
|
||||
{
|
||||
ClsCompras ObjCompras = new ClsCompras();
|
||||
|
||||
DateTime FechaIC = (txtFechaIC.Text.ToString() != "" ? txtFechaIC.Text.ToDateTime() : MinFecha);
|
||||
DateTime FechaFC = (txtFechaFC.Text.ToString() != "" ? txtFechaFC.Text.ToDateTime() : DateTime.Now);
|
||||
DateTime FechaI = (txtFechaI.Text.ToString() != "" ? txtFechaI.Text.ToDateTime() : MinFecha);
|
||||
DateTime FechaF = (txtFechaF.Text.ToString() != "" ? txtFechaF.Text.ToDateTime() : DateTime.Now);
|
||||
|
||||
if (ObjCompras.GetRepComprasInventarios(FechaIC, FechaFC, FechaI, FechaF, UsuarioActual.CveEmpresa, DdlSubProyecto.SelectedValue.ToEntero(), DdlProveedor.SelectedValue.ToEntero()))
|
||||
{
|
||||
DtDatos = ObjCompras.DtResultados;
|
||||
GvComprasInv.DataSource = DtDatos;
|
||||
}
|
||||
|
||||
ObjCompras.Dispose();
|
||||
GvComprasInv.DataBind();
|
||||
UPDatos.Update();
|
||||
}
|
||||
|
||||
protected void BtnConsultar_Click(object sender, EventArgs e)
|
||||
{
|
||||
CargaDatos();
|
||||
}
|
||||
|
||||
protected void LnkPDF_Click(object sender, EventArgs e)
|
||||
{
|
||||
GeneraImpresion("PDF");
|
||||
}
|
||||
|
||||
protected void LnkExcel_Click(object sender, EventArgs e)
|
||||
{
|
||||
GeneraImpresion("Excel");
|
||||
}
|
||||
protected void GeneraImpresion(string Formato)
|
||||
{
|
||||
System.IO.FileInfo Imagen = new System.IO.FileInfo(String.Format("{0}/Logo.png", UsuarioActual.Empresa.Ruta));
|
||||
string logouri = String.Format("{0}://{1}:{2}/Empresas/{3}/Logo.png", Request.Url.Scheme, Request.Url.Host, Request.Url.Port, UsuarioActual.CveEmpresa);
|
||||
|
||||
string FIC = (txtFechaIC.Text == "" ? "" : $" <b>Fecha Inicio:</b> {txtFechaIC.Text}");
|
||||
string FFC = (txtFechaFC.Text == "" ? "" : $" <b>Fecha Fin:</b> {txtFechaFC.Text}");
|
||||
|
||||
string FIR = (txtFechaI.Text == "" ? "" : $" <b>Fecha Inicio recibió:</b> {txtFechaI.Text}");
|
||||
string FFR = (txtFechaF.Text == "" ? "" : $" <b>Fecha Fin recibió:</b> {txtFechaF.Text}");
|
||||
|
||||
string proveedor = (DdlProveedor.SelectedValue == "-1"? "": $" <b>Proveedor:</b> {DdlProveedor.SelectedItem.Text}");
|
||||
string subproyecto = (DdlSubProyecto.SelectedValue == "-1" ? "" : $" <b>SubProyecto:</b> {DdlSubProyecto.SelectedItem.Text}");
|
||||
|
||||
if (DtDatos.Rows.Count > 0)
|
||||
{
|
||||
List<ReportParameter> paramList = new List<ReportParameter>();
|
||||
|
||||
paramList.Add(new ReportParameter("NombreEmpresa", UsuarioActual.Empresa.Empresa ));
|
||||
paramList.Add(new ReportParameter("UsuarioImprimio", UsuarioActual.Nombre ));
|
||||
paramList.Add(new ReportParameter("AgrupadoPor", $"{FIC}{FFC}{FIR}{FFR}{subproyecto}{proveedor}"));
|
||||
|
||||
if (Imagen.Exists)
|
||||
{
|
||||
paramList.Add(new ReportParameter("LogoPath", logouri));
|
||||
}
|
||||
else
|
||||
{
|
||||
paramList.Add(new ReportParameter("LogoPath", ""));
|
||||
}
|
||||
|
||||
ImprimirPDF("Empresas/Grales/Formatos/RepComprasInventarios.rdlc", DtDatos, paramList, "RepComprasInventarios", Formato);
|
||||
}
|
||||
else
|
||||
{
|
||||
Alert("No se encontraron datos con los filtros especificados", TipoMensaje.MsgAdvertencia);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user