From 4edcc49351f0147ff1fff8e745f4604aa26f656e Mon Sep 17 00:00:00 2001 From: Antonio Gonzalez Date: Mon, 26 Oct 2020 21:56:23 -0700 Subject: [PATCH] nuevo reporte de caducidad --- App_Code/ClsProductosServicios.vb | 70 +++++++++--------- Inventarios/EntregaAlmacen.aspx.vb | 3 + Inventarios/RecepcionAlmacen.aspx.vb | 1 + Inventarios/RepProductosPorCaducar.aspx | 65 +++++++++++------ Inventarios/RepProductosPorCaducar.aspx.cs | 82 +++++++++++++++++++++- 5 files changed, 162 insertions(+), 59 deletions(-) diff --git a/App_Code/ClsProductosServicios.vb b/App_Code/ClsProductosServicios.vb index 159317562..f809ab9d8 100644 --- a/App_Code/ClsProductosServicios.vb +++ b/App_Code/ClsProductosServicios.vb @@ -56,8 +56,8 @@ Public Class ClsProductosServicios Public Property CveMetodoInventario As Integer Public Property CveTipoPS As Integer Public Property Estado2 As Integer - Public Property CveMarca As Integer - + Public Property CveMarca As Integer + Public Property IEPSPorcentaje As Double Public Property AplicaIEPS As Boolean @@ -202,11 +202,11 @@ Public Class ClsProductosServicios CveConexion = 0 End If - End Sub + End Sub #End Region - Public Function GetPS(CvePS As Integer, CveClasificacion As Integer, CveEmpresa As Integer, Optional Codigo As String = "-1", Optional Codigo2 As String = "-1", - Optional CodigoBarras As String = "-1", Optional PS As String = "-1", Optional EsPaquete As Integer = -1, Optional CveSubProyecto As Integer = -1, - Optional pAplicaParaVenta As Integer = -1, Optional pEstado As Integer = -1, Optional CveClasificacionCosto As Integer = -1, Optional CveTipoPS As Integer = -1, + Public Function GetPS(CvePS As Integer, CveClasificacion As Integer, CveEmpresa As Integer, Optional Codigo As String = "-1", Optional Codigo2 As String = "-1", + Optional CodigoBarras As String = "-1", Optional PS As String = "-1", Optional EsPaquete As Integer = -1, Optional CveSubProyecto As Integer = -1, + Optional pAplicaParaVenta As Integer = -1, Optional pEstado As Integer = -1, Optional CveClasificacionCosto As Integer = -1, Optional CveTipoPS As Integer = -1, Optional CveCompuesto As Integer = -1, Optional SATClavePS As String = "-1", Optional TopSelect As Integer = 10000) As Boolean Dim Retorno As Boolean = False @@ -1685,10 +1685,10 @@ Public Class ClsProductosServicios End Try Return Retorno - End Function + End Function #End Region - - + + #Region "Precios Lista" Public Function GetPSPreciosLista(CveEmpresa As Integer, CvePrecioLista As Integer, Optional CveClasificacion As Integer = -1, Optional CvePS As Integer = -1, Optional CveProveedor As Integer = -1, Optional Estado As Integer = -1, Optional Marcas As String = "-1", Optional CveModelo As Integer = -1) As Boolean @@ -1846,7 +1846,7 @@ Public Class ClsProductosServicios End Try Return Retorno - End Function + End Function Public Function GetPSExistenciasWS(CvePS As Integer, CvePrecioLista As Integer, CveUnidadMedida As Integer, CveEmpresa As Integer, CveAlmacen As Integer, Optional CveSeccionAlmacen As Integer = -1, Optional CveTipoAlmacen As Integer = -1, Optional CveSubProyecto As Integer = -1, Optional FechaMovto As String = "-1", Optional Serie As String = "-1", Optional CveVendedor As Integer = -1, Optional CveCliente As Integer = -1, @@ -1855,38 +1855,38 @@ Public Class ClsProductosServicios Dim Retorno As Boolean = False DataAdapter("PA_Vta_ProductosExistenciasWSGet") - With SqlAdapter.SelectCommand.Parameters - .Add("@CvePS", SqlDbType.Int).Value = CvePS - .Add("@CvePrecioLista", SqlDbType.Int).Value = CvePrecioLista - .Add("@CveUnidadMedida", SqlDbType.Int).Value = CveUnidadMedida - .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa - .Add("@CveAlmacen", SqlDbType.Int).Value = CveAlmacen - .Add("@CveSeccionAlmacen", SqlDbType.Int).Value = CveSeccionAlmacen - .Add("@CveTipoAlmacen", SqlDbType.Int).Value = CveTipoAlmacen - .Add("@CveSubProyecto", SqlDbType.Int).Value = CveSubProyecto - .Add("@FechaMovto", SqlDbType.DateTime).Value = DateTime.ParseExact(FechaMovto, "yyyy/MM/dd HH:mm", Nothing) - .Add("@Serie", SqlDbType.VarChar).Value = Serie - .Add("@Lote", SqlDbType.VarChar).Value = Lote - .Add("@Batch", SqlDbType.VarChar).Value = Batch - .Add("@CveVendedor", SqlDbType.Int).Value = CveVendedor - .Add("@CveCliente", SqlDbType.Int).Value = CveCliente - .Add("@ExcluyeAdelantado", SqlDbType.Int).Value = ExcluyeAdelantado - .Add("@PendientePorSurtir", SqlDbType.Int).Value = PendientePorSurtir - .Add("@ExcluyeApartados", SqlDbType.Int).Value = ExcluyeApartados - .Add("@RestringirAlmacenes", SqlDbType.Int).Value = RestringirAlmacenes - End With + With SqlAdapter.SelectCommand.Parameters + .Add("@CvePS", SqlDbType.Int).Value = CvePS + .Add("@CvePrecioLista", SqlDbType.Int).Value = CvePrecioLista + .Add("@CveUnidadMedida", SqlDbType.Int).Value = CveUnidadMedida + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + .Add("@CveAlmacen", SqlDbType.Int).Value = CveAlmacen + .Add("@CveSeccionAlmacen", SqlDbType.Int).Value = CveSeccionAlmacen + .Add("@CveTipoAlmacen", SqlDbType.Int).Value = CveTipoAlmacen + .Add("@CveSubProyecto", SqlDbType.Int).Value = CveSubProyecto + .Add("@FechaMovto", SqlDbType.DateTime).Value = DateTime.ParseExact(FechaMovto, "yyyy/MM/dd HH:mm", Nothing) + .Add("@Serie", SqlDbType.VarChar).Value = Serie + .Add("@Lote", SqlDbType.VarChar).Value = Lote + .Add("@Batch", SqlDbType.VarChar).Value = Batch + .Add("@CveVendedor", SqlDbType.Int).Value = CveVendedor + .Add("@CveCliente", SqlDbType.Int).Value = CveCliente + .Add("@ExcluyeAdelantado", SqlDbType.Int).Value = ExcluyeAdelantado + .Add("@PendientePorSurtir", SqlDbType.Int).Value = PendientePorSurtir + .Add("@ExcluyeApartados", SqlDbType.Int).Value = ExcluyeApartados + .Add("@RestringirAlmacenes", SqlDbType.Int).Value = RestringirAlmacenes + End With Try SqlAdapter.Fill(Data) Retorno = True Catch ex As Exception OnError("Ocurrió un error al obtener las productos y sus existencias.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) - End Try - + End Try + Return Retorno - End Function - + End Function + #End Region - + #Region "Porcentaje Productos" Public Function GetPorcentajeProductos(CveCliente As Integer) As Boolean Dim Retorno As Boolean = False diff --git a/Inventarios/EntregaAlmacen.aspx.vb b/Inventarios/EntregaAlmacen.aspx.vb index ae40df21d..3f8e54856 100644 --- a/Inventarios/EntregaAlmacen.aspx.vb +++ b/Inventarios/EntregaAlmacen.aspx.vb @@ -1026,6 +1026,8 @@ Partial Class Inventarios_EntregaAlmacen AplicaCaducidad = If(GlobalDTPS(UsuarioActual.CveEmpresa, CvePS:=CvePSSerie).FiltraParametros("").Rows(0)("AplicaCaducidad").ToString = "True", True, False) End If + GvSerie.Columns(1).HeaderText = If(UsuarioActual.Empresa.Funcionalidad(147) = "Fecha Elaboración", "Fecha Elaboración", "Fecha Caducidad") + If AplicaCaducidad Then GvSerie.Columns(1).Visible = True TdCaducidad1.Visible = True @@ -1229,6 +1231,7 @@ Partial Class Inventarios_EntregaAlmacen Private Sub CargaLote(Optional CerrarCompletado As Boolean = False) RegistraScript("$('#DivLote').modal('show')") + GvLote.Columns(2).HeaderText = If(UsuarioActual.Empresa.Funcionalidad(147) = "Fecha Elaboración", "Fecha Elaboración", "Fecha Caducidad") GvLote.DataSource = DtDatosDetalleLote.FiltraParametros(String.Format("ConsecId = {0}", CveConsecSerie), "Consec DESC") GvLote.DataBind() diff --git a/Inventarios/RecepcionAlmacen.aspx.vb b/Inventarios/RecepcionAlmacen.aspx.vb index 44ca59990..06d4fbfe7 100644 --- a/Inventarios/RecepcionAlmacen.aspx.vb +++ b/Inventarios/RecepcionAlmacen.aspx.vb @@ -1824,6 +1824,7 @@ Partial Class Inventarios_RecepcionAlmacen End Sub Private Sub CargaLote(Tipo As Integer, Optional CerrarCompletado As Boolean = False) RegistraScript("$('#DivLote').modal();", "ModalLote") + GvLote.Columns(2).HeaderText = If(UsuarioActual.Empresa.Funcionalidad(147) = "Fecha Elaboración", "Fecha Elaboración", "Fecha Caducidad") GvLote.DataSource = DtDatosLoteDetalle.FiltraParametros(String.Format("ConsecId = {0}", CveConsecSerie), "Consec DESC") GvLote.DataBind() diff --git a/Inventarios/RepProductosPorCaducar.aspx b/Inventarios/RepProductosPorCaducar.aspx index eb7484e0d..14b1fe232 100644 --- a/Inventarios/RepProductosPorCaducar.aspx +++ b/Inventarios/RepProductosPorCaducar.aspx @@ -11,6 +11,20 @@ Reporte de Productos por Caducar + + +
  • + PDF +
  • +
  • + Excel +
  • +
    + + + + +
    @@ -23,42 +37,49 @@
    -
    +
    + +
    +
    -
    -
    +
    + +
    +
    +
    - - - - - -
    + +
    -
    -
    +
    + +
    +
    +
    - - - - - -
    + +
    -
    +
    + +
    +
    -
    - +
    + +
    +
    +
    @@ -70,10 +91,10 @@ - + - + diff --git a/Inventarios/RepProductosPorCaducar.aspx.cs b/Inventarios/RepProductosPorCaducar.aspx.cs index a25961a9d..aed1cd91b 100644 --- a/Inventarios/RepProductosPorCaducar.aspx.cs +++ b/Inventarios/RepProductosPorCaducar.aspx.cs @@ -6,25 +6,62 @@ using System.Web.UI; using System.Web.UI.WebControls; using Extensiones; using System.Data; +using Microsoft.Reporting.WebForms; +using System.Text; public partial class Inventarios_RepProductosPorCaducar : ClsPaginas { + private DataTable DTDatos + { + get + { + return (DataTable)ViewState["DTDatos"]; + } + + set + { + ViewState["DTDatos"] = value; + } + } + protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { - //CargaFiltros(); + CargaFiltros(); + CargarDatos(); } } + private void CargarDatos() + { + ClsInventarios ObjInventarios = new ClsInventarios(); + if (ObjInventarios.GetProductosCaducidad(DdlProveedor.SelectedValue.ToEntero(),TxtFechaInicio.Text.ToDate(),TxtFechaFin.Text.ToDate(), DdlSucursal.SelectedValue.ToEntero(), + DdlClasificacion.SelectedValue.ToEntero())) + { + GvDatos.DataSource = ObjInventarios.DtResultados; + DTDatos = ObjInventarios.DtResultados; + } + ObjInventarios.Dispose(); + GvDatos.DataBind(); + } + private void CargaFiltros() { + CargarFechaText(); CargarProveedores(); CargarSucursales(); CargarClasificaciones(); } + private void CargarFechaText() + { + DateTime date = new DateTime(DateTime.Today.Year, DateTime.Today.Month,1); + TxtFechaInicio.Text = date.ToString("dd/MM/yyyy"); + TxtFechaFin.Text = date.AddMonths(1).AddDays(-1).ToString("dd/MM/yyyy"); + } + private void CargarProveedores() { DdlProveedor.setEsWebService(true); @@ -42,6 +79,7 @@ public partial class Inventarios_RepProductosPorCaducar : ClsPaginas } ObjSubProyectos.Dispose(); DdlSucursal.DataBind(); + DdlSucursal.Items.Insert(0, new ListItem("Todas", "-1")); } private void CargarClasificaciones() @@ -53,11 +91,51 @@ public partial class Inventarios_RepProductosPorCaducar : ClsPaginas } ObjClasificacion.Dispose(); DdlClasificacion.DataBind(); - DdlClasificacion.Items.Insert(0,new ListItem("Todos","-1")); + DdlClasificacion.Items.Insert(0,new ListItem("Todas","-1")); } protected void BtnConsultar_Click(object sender, EventArgs e) { + CargarDatos(); + UpDatos.Update(); + } + protected void LnkImprimirPDF_Click(object sender, EventArgs e) + { + ImprimirReporte("PDF"); + } + + protected void LnkImprimirExcel_Click(object sender, EventArgs e) + { + ImprimirReporte("Excel"); + } + + private void ImprimirReporte(string formato) + { + StringBuilder Filtros = new StringBuilder(); + Filtros.AppendFormat("Proveedor: {0}    ", DdlProveedor.SelectedText); + Filtros.AppendFormat("Fecha Inicio: {0}    ", TxtFechaInicio.Text); + Filtros.AppendFormat("Fecha Fin: {0}    ", TxtFechaFin.Text); + Filtros.AppendFormat("Sucursal: {0}    ", DdlSucursal.SelectedItem.Text); + Filtros.AppendFormat("Clasificación: {0}    ", DdlClasificacion.SelectedItem.Text); + List @params = new List(); + + @params.Add(new ReportParameter("Filtros", Filtros.ToString())); + @params.Add(new ReportParameter("UsuarioImprimio", UsuarioActual.Nombre)); + @params.Add(new ReportParameter("NombreEmpresa", UsuarioActual.Empresa.Empresa)); + + var logouri = string.Format("{0}://{1}:{2}/Empresas/{3}/Logo.png", Request.Url.Scheme, Request.Url.Host, Request.Url.Port, UsuarioActual.CveEmpresa); + System.IO.FileInfo Imagen = new System.IO.FileInfo(string.Format("{0}/Logo.png", UsuarioActual.Empresa.Ruta)); + if (Imagen.Exists) + { + @params.Add(new ReportParameter("LogoPath", logouri)); + } + else + { + @params.Add(new ReportParameter("LogoPath", "")); + } + @params.Add(new ReportParameter("FechaCaducidadHeader", (UsuarioActual.Empresa.Funcionalidad(147) == "Fecha Elaboración" ? "Fecha Elaboración" : "Fecha Caducidad"))); + + ImprimirPDF("Empresas/Grales/Formatos/RepProductosCaducidad.rdlc", DTDatos, @params, "Reporte de Productos por Caducar", formato); } } \ No newline at end of file