nuevo reporte de caducidad

This commit is contained in:
Antonio Gonzalez
2020-10-26 21:56:23 -07:00
parent 979fbed252
commit 4edcc49351
5 changed files with 162 additions and 59 deletions

View File

@@ -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

View File

@@ -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()

View File

@@ -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()

View File

@@ -11,6 +11,20 @@
Reporte de Productos por Caducar
</asp:Content>
<asp:Content ID="Content5" ContentPlaceHolderID="H" runat="Server">
<asp:UpdatePanel ID="UpLnkAcciones" runat="server" UpdateMode="Conditional">
<ContentTemplate>
<li>
<asp:LinkButton ID="LnkImprimirPDF" runat="server" OnClick="LnkImprimirPDF_Click" Visible="true"><i class="fa fa-file-pdf-o"></i><span style="padding: 10px">PDF</span></asp:LinkButton>
</li>
<li>
<asp:LinkButton ID="LnkImprimirExcel" runat="server" OnClick="LnkImprimirExcel_Click" Visible="true"><i class="fa fa-file-excel-o"></i><span style="padding: 10px">Excel</span></asp:LinkButton>
</li>
</ContentTemplate>
<Triggers>
<asp:PostBackTrigger ControlID="LnkImprimirPDF"/>
<asp:PostBackTrigger ControlID="LnkImprimirExcel"/>
</Triggers>
</asp:UpdatePanel>
</asp:Content>
<asp:Content ID="Content6" ContentPlaceHolderID="C" runat="Server">
<asp:UpdatePanel ID="UPFiltros" runat="server" UpdateMode="Conditional">
@@ -23,42 +37,49 @@
</div>
<div class="titlefiltros caption">
<div class="row" style="margin-left: 10px;">
<div class="col-md-2">
<div class="col-sm-1" style="text-align:right">
<label>Proveedor:</label>
</div>
<div class="col-md-1">
<ADS:Dropdownlost ID="DdlProveedor" runat="server" DataValueField="CveProveedor" DataTextField="RazonSocial" CssClassDdl="select2me" Width="100%" CssStyle="width: 100%;"></ADS:Dropdownlost>
</div>
<div class="col-md-2">
<div class="input-group input-sm input-small date date-picker" data-date-format="dd/mm/yyyy" style="width: 100% !important; padding: 0px;">
<div class="col-sm-1" style="text-align:right">
<label>Fecha Inicio:</label>
</div>
<div class="col-md-1">
<div class="input-group input-sm input-small date date-picker" data-date-format="dd/mm/yyyy" style="width: 100% !important; padding: 0px;display:flex">
<asp:TextBox ID="TxtFechaInicio" runat="server" CssClass="form-control" CausesValidation="true" MaxLength="10"></asp:TextBox>
<span class="input-group-btn ">
<asp:LinkButton ID="ImgCalFechaIEjec" class="btn default " Text="<i class='fa fa-calendar'></i>" runat="server"></asp:LinkButton>
</span>
<ajax:MaskedEditExtender ID="MEEFechaIEjec" runat="server" TargetControlID="TxtFechaIEjec" Mask="99/99/9999" MaskType="Date" DisplayMoney="Left" AcceptNegative="Left"></ajax:MaskedEditExtender>
<ajax:CalendarExtender ID="CalFechaIEjec" runat="server" TargetControlID="TxtFechaIEjec" PopupButtonID="ImgCalFechaIEjec" PopupPosition="BottomRight" Enabled="True"></ajax:CalendarExtender>
<asp:RequiredFieldValidator ID="RFVFechaIEjec" runat="server" ControlToValidate="TxtFechaIEjec" Display="None" ErrorMessage="El campo <b>''Fecha Inicial Ejecución''</b> es requerido por la aplicación, por favor ingrese una fecha." ValidationGroup="Valida"></asp:RequiredFieldValidator>
<asp:CompareValidator ID="CVFechaIEjec" runat="server" ControlToValidate="TxtFechaIEjec" Display="None" ErrorMessage="El campo <b>''Fecha Inicial Ejecución''</b> no tienes el formato correcto, por favor intente de nuevo con el siguiente formato: (dd/mm/yyyy)." Operator="DataTypeCheck" Type="Date" ValidationGroup="Valida"></asp:CompareValidator>
<ajax:ValidatorCalloutExtender ID="VCOFechaIEjec1" runat="server" HighlightCssClass="vco" TargetControlID="RFVFechaIEjec" Width="350px"></ajax:ValidatorCalloutExtender>
<ajax:ValidatorCalloutExtender ID="VCOFechaIEjec2" runat="server" HighlightCssClass="vco" TargetControlID="CVFechaIEjec" Width="350px"></ajax:ValidatorCalloutExtender>
</div>
<ajax:MaskedEditExtender ID="MEEFechaIEjec" runat="server" TargetControlID="TxtFechaInicio" Mask="99/99/9999" MaskType="Date" DisplayMoney="Left" AcceptNegative="Left"></ajax:MaskedEditExtender>
<ajax:CalendarExtender ID="CalFechaIEjec" runat="server" TargetControlID="TxtFechaInicio" PopupButtonID="ImgCalFechaIEjec" PopupPosition="BottomRight" Enabled="True"></ajax:CalendarExtender>
</div>
<div class="col-md-2">
<div class="input-group input-sm input-small date date-picker" data-date-format="dd/mm/yyyy" style="width: 100% !important; padding: 0px;">
<div class="col-sm-1" style="text-align:right">
<label>Fecha Fin:</label>
</div>
<div class="col-md-1">
<div class="input-group input-sm input-small date date-picker" data-date-format="dd/mm/yyyy" style="width: 100% !important; padding: 0px;display:flex">
<asp:TextBox ID="TxtFechaFin" runat="server" CssClass="form-control" CausesValidation="true" MaxLength="10"></asp:TextBox>
<span class="input-group-btn ">
<asp:LinkButton ID="LinkButton1" class="btn default " Text="<i class='fa fa-calendar'></i>" runat="server"></asp:LinkButton>
</span>
<ajax:MaskedEditExtender ID="MaskedEditExtender1" runat="server" TargetControlID="TxtFechaIEjec" Mask="99/99/9999" MaskType="Date" DisplayMoney="Left" AcceptNegative="Left"></ajax:MaskedEditExtender>
<ajax:CalendarExtender ID="CalendarExtender1" runat="server" TargetControlID="TxtFechaIEjec" PopupButtonID="ImgCalFechaIEjec" PopupPosition="BottomRight" Enabled="True"></ajax:CalendarExtender>
<asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ControlToValidate="TxtFechaIEjec" Display="None" ErrorMessage="El campo <b>''Fecha Inicial Ejecución''</b> es requerido por la aplicación, por favor ingrese una fecha." ValidationGroup="Valida"></asp:RequiredFieldValidator>
<asp:CompareValidator ID="CompareValidator1" runat="server" ControlToValidate="TxtFechaIEjec" Display="None" ErrorMessage="El campo <b>''Fecha Inicial Ejecución''</b> no tienes el formato correcto, por favor intente de nuevo con el siguiente formato: (dd/mm/yyyy)." Operator="DataTypeCheck" Type="Date" ValidationGroup="Valida"></asp:CompareValidator>
<ajax:ValidatorCalloutExtender ID="ValidatorCalloutExtender1" runat="server" HighlightCssClass="vco" TargetControlID="RFVFechaIEjec" Width="350px"></ajax:ValidatorCalloutExtender>
<ajax:ValidatorCalloutExtender ID="ValidatorCalloutExtender2" runat="server" HighlightCssClass="vco" TargetControlID="CVFechaIEjec" Width="350px"></ajax:ValidatorCalloutExtender>
</div>
<ajax:MaskedEditExtender ID="MaskedEditExtender1" runat="server" TargetControlID="TxtFechaFin" Mask="99/99/9999" MaskType="Date" DisplayMoney="Left" AcceptNegative="Left"></ajax:MaskedEditExtender>
<ajax:CalendarExtender ID="CalendarExtender1" runat="server" TargetControlID="TxtFechaFin" PopupButtonID="ImgCalFechaIEjec" PopupPosition="BottomRight" Enabled="True"></ajax:CalendarExtender>
</div>
<div class="col-md-2">
<div class="col-sm-1" style="text-align:right">
<label>Sucursal:</label>
</div>
<div class="col-md-1">
<asp:DropDownList runat="server" ID="DdlSucursal" CssClass="select2me" DataTextField="SubProyecto" DataValueField="CveSubProyecto"></asp:DropDownList>
</div>
<div class="col-md-2">
<asp:DropDownList runat="server" ID="DdlClasificacion" CssClass="select2me" DataTextField="Clasificacion" DataValueField="CveClasificacion"/>
<div class="col-sm-1" style="text-align:right">
<label>Clasificación:</label>
</div>
<div class="col-md-1">
<asp:DropDownList runat="server" ID="DdlClasificacion" CssClass="select2me" DataTextField="Clasificacion" DataValueField="CveClasificacion" Width="100%"/>
</div>
</div>
</div>
@@ -70,10 +91,10 @@
<ContentTemplate>
<asp:GridView ID="GvDatos" runat="server" AutoGenerateColumns="False" DataKeyNames="Cantidad,PS,Lote,FechaCaducidad" EmptyDataText="No se encontraron Tipo Gasto" ToolTip="Reporte de productos caducidad " CssClass="table table-striped table-advance table-hover" Style="margin-top: -10px; width: 100%" GridLines="None">
<Columns>
<asp:BoundField HeaderText="Cantidad" DataField="Cantidad" />
<asp:BoundField HeaderText="Cantidad" DataField="Cantidad" DataFormatString="{0:n2}" ItemStyle-HorizontalAlign="Right" />
<asp:BoundField HeaderText="PS" DataField="PS" />
<asp:BoundField HeaderText="Lote" DataField="Lote" />
<asp:BoundField HeaderText="FechaCaducidad" DataField="FechaCaducidad" />
<asp:BoundField HeaderText="FechaCaducidad" DataField="FechaCaducidad" DataFormatString = "{0:dd/MM/yyyy}" />
</Columns>
</asp:GridView>
</ContentTemplate>

View File

@@ -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("<strong>Proveedor: </strong>{0}&nbsp;&nbsp;&nbsp;&nbsp;", DdlProveedor.SelectedText);
Filtros.AppendFormat("<strong>Fecha Inicio: </strong>{0}&nbsp;&nbsp;&nbsp;&nbsp;", TxtFechaInicio.Text);
Filtros.AppendFormat("<strong>Fecha Fin: </strong>{0}&nbsp;&nbsp;&nbsp;&nbsp;", TxtFechaFin.Text);
Filtros.AppendFormat("<strong>Sucursal: </strong>{0}&nbsp;&nbsp;&nbsp;&nbsp;", DdlSucursal.SelectedItem.Text);
Filtros.AppendFormat("<strong>Clasificación: </strong>{0}&nbsp;&nbsp;&nbsp;&nbsp;", DdlClasificacion.SelectedItem.Text);
List<ReportParameter> @params = new List<ReportParameter>();
@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);
}
}