diff --git a/App_Code/ClsInventarios.vb b/App_Code/ClsInventarios.vb index 699faf04e..24520e128 100644 --- a/App_Code/ClsInventarios.vb +++ b/App_Code/ClsInventarios.vb @@ -1588,6 +1588,58 @@ Public Class ClsInventarios End Function + Public Function GetExistenciasCaducidad(CvePS As Integer, CveAlmacen As Integer, CveUsuario As Integer, CveEmpresa As Integer, Optional CveAlmacenes As String = "-1") As Boolean + Dim Retorno As Boolean = False + + DataAdapter("PA_Inv_ExistenciaCaducidadGet") + + With SqlAdapter.SelectCommand.Parameters + .Add("@CvePS", SqlDbType.Int).Value = CvePS + .Add("@CveAlmacen", SqlDbType.VarChar).Value = CveAlmacen + .Add("@CveUsuario", SqlDbType.Int).Value = CveUsuario + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + .Add("@CveAlmacenes", SqlDbType.VarChar).Value = CveAlmacenes + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch Ex1 As SqlException + + Me.OnError("Ocurrió un error al obtener el kardex de almacen.", Ex1, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + + Catch ex As Exception + OnError("Ocurrió un error al obtener el kardex de almacen.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End Try + + Return Retorno + + End Function + + Public Function GetProductosCaducidad(CveProveedor As Integer, FechaInicio As Date, FechaFin As Date, CveSubProyecto As Integer, CveClasificacion As Integer) As Boolean + Dim Retorno As Boolean = False + + DataAdapter("PA_Inv_ProductosCaducidadGet") + + With SqlAdapter.SelectCommand.Parameters + .Add("@CveProveedor", SqlDbType.Int).Value = CveProveedor + .Add("@FechaInicio", SqlDbType.Date).Value = FechaInicio + .Add("@FechaFin", SqlDbType.Date).Value = FechaFin + .Add("@CveSubProyecto", SqlDbType.Int).Value = CveSubProyecto + .Add("@CveClasificacion", SqlDbType.Int).Value = CveClasificacion + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al obtener el listo de caducidad de productos.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End Try + + Return Retorno + + End Function + #End Region #Region " INVENTARIOS - REPORTES " diff --git a/App_Code/ClsPaginas.vb b/App_Code/ClsPaginas.vb index 8fe10c062..82bb1cb39 100644 --- a/App_Code/ClsPaginas.vb +++ b/App_Code/ClsPaginas.vb @@ -38,14 +38,14 @@ Public Class ClsPaginas - Public ReadOnly Property EsProduccion As Boolean - Get - If IsNothing(System.Configuration.ConfigurationManager.AppSettings("EsProduccion")) Then - Return False - Else - Return (System.Configuration.ConfigurationManager.AppSettings("EsProduccion").ToString() = "1") - End If - End Get + Public ReadOnly Property EsProduccion As Boolean + Get + If IsNothing(System.Configuration.ConfigurationManager.AppSettings("EsProduccion")) Then + Return False + Else + Return (System.Configuration.ConfigurationManager.AppSettings("EsProduccion").ToString() = "1") + End If + End Get End Property #Region "Propiedades" @@ -3783,6 +3783,7 @@ Public Class ClsPaginas PaginaDict.Add("/Contratos/Contrato2.aspx".ToUpper(), -1) PaginaDict.Add("/Flotillas/CatMantenimientos.aspx".ToUpper(), -1) PaginaDict.Add("/Inventarios/PaqueteDetalles.aspx".ToUpper(), -1) + PaginaDict.Add("/Inventarios/RepProductosPorCaducar.aspx".ToUpper(), 693) 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/Bancos/ProveedoresAbonar.aspx.vb b/Bancos/ProveedoresAbonar.aspx.vb index 284b693e4..74ddb3d8c 100644 --- a/Bancos/ProveedoresAbonar.aspx.vb +++ b/Bancos/ProveedoresAbonar.aspx.vb @@ -3258,7 +3258,7 @@ Partial Class Bancos_ProveedoresAbonar ' Alert(alertaContabilizacion, ModExtensiones.TipoMensaje.MsgInformacion) Else - Alert("Ocurrio un error al contabilizar, pongase en contacto con Soporte Técnico", TipoMensaje.MsgError) + 'Alert("Ocurrio un error al contabilizar, pongase en contacto con Soporte Técnico", TipoMensaje.MsgError) MsgError = "Ocurrio un error al contabilizar, pongase en contacto con Soporte Técnico" End If diff --git a/Compras/PopUpVerFactura.aspx.vb b/Compras/PopUpVerFactura.aspx.vb index 3ec5ea9e1..b4fdc4a72 100644 --- a/Compras/PopUpVerFactura.aspx.vb +++ b/Compras/PopUpVerFactura.aspx.vb @@ -3876,7 +3876,7 @@ Partial Class PopUpVerFactura Dr("Abono") = 0 DtMovimientosPoliza.Rows.Add(Dr) End If - ElseIf UsuarioActual.CveEmpresa = 119 Then + ElseIf UsuarioActual.CveEmpresa.Contiene(119, 141) Then Dim PreP As New ClsContabilidad If PreP.GetPrePolizasDetalle(-1, CveIE) Then DtMovimientosPoliza = New DataTable @@ -3889,8 +3889,8 @@ Partial Class PopUpVerFactura For Each drt As DataRow In PreP.DtResultados.Rows Dim Dr = DtMovimientosPoliza.NewRow - Dr("CODIGO") = drt("ContpaqCodigo") - Dr("Cuenta") = drt("ContpaqCuenta") + Dr("CODIGO") = drt("CuentaCodigo") + Dr("Cuenta") = drt("CuentaNombre") Dr("Cargo") = If(drt("TipoMovto").ToString = "False", drt("ImporteMN"), "0") Dr("Abono") = If(drt("TipoMovto").ToString = "True", drt("ImporteMN"), "0") DtMovimientosPoliza.Rows.Add(Dr) 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/Kardex.aspx b/Inventarios/Kardex.aspx index d3d08e46b..48b08eb61 100644 --- a/Inventarios/Kardex.aspx +++ b/Inventarios/Kardex.aspx @@ -127,6 +127,9 @@
  • Series Disponibles
  • +
  • + Caducidad de producto +
  •  
  • @@ -378,6 +381,11 @@ + + + + + @@ -538,6 +546,43 @@ + + + diff --git a/Inventarios/Kardex.aspx.vb b/Inventarios/Kardex.aspx.vb index f2f961c3b..9288bac7a 100644 --- a/Inventarios/Kardex.aspx.vb +++ b/Inventarios/Kardex.aspx.vb @@ -66,9 +66,9 @@ Partial Class Inventarios_Kardex Private Sub CargaPermisos() If UsuarioActual.CveRol = 1 Then ChkAgruparAlmacen.Visible = True Dim TienePermisoImportes As Boolean = UsuarioActual.TienePermisoProceso(201) - GvM.Columns(13).Visible = TienePermisoImportes ' costo - GvM.Columns(14).Visible = TienePermisoImportes ' importe - GvM.Columns(16).Visible = TienePermisoImportes ' valor + GvM.Columns(14).Visible = TienePermisoImportes ' costo + GvM.Columns(15).Visible = TienePermisoImportes ' importe + GvM.Columns(17).Visible = TienePermisoImportes ' valor End Sub Private Function isWithFamily() As Boolean @@ -87,7 +87,7 @@ Partial Class Inventarios_Kardex CBLTiposAlmacen.DataSource = GlobalDTTipoAlmacen(-1) CBLTiposAlmacen.DataBind() For Each item As ListItem In CBLTiposAlmacen.Items - If item.Text = "Entrega Adelantado" Then + If item.Text.Contiene("Entrega Adelantado", "Transitorio") Then item.Selected = False Else item.Selected = True @@ -199,13 +199,18 @@ Partial Class Inventarios_Kardex AplicaSeccion = DtTemp.MAX("SeccionAlmacen") <> "" AplicaLote = DtTemp.MAX("Lote") <> "" AplicaCaducidad = DtTemp.MAX("FechaCaducidad") <> "" - If AplicaSeccion Then GvM.Columns(7).Visible = True - If AplicaSerie Then GvM.Columns(8).Visible = True - If AplicaLote Then GvM.Columns(9).Visible = True - If AplicaCaducidad Then GvM.Columns(10).Visible = True + + GvM.Columns(6).Visible = DtTemp.MAX("FolioRelacionEntrada") <> "" + + If AplicaSeccion Then GvM.Columns(8).Visible = True + If AplicaSerie Then GvM.Columns(9).Visible = True + If AplicaLote Then GvM.Columns(10).Visible = True + If AplicaCaducidad Then GvM.Columns(11).Visible = True Dim AuxAplicaSerie As Boolean = GlobalDTPS(UsuarioActual.CveEmpresa, CvePS:=CveProducto).FiltroPrimeroValor("AplicaSerie") = "True" + Dim AuxAplicaCad As Boolean = GlobalDTPS(UsuarioActual.CveEmpresa, CvePS:=CveProducto).FiltroPrimeroValor("AplicaCaducidad") = "True" LnkSeries.Visible = AuxAplicaSerie + LnkCaducidad.Visible = AuxAplicaCad 'CARGA INDICADORES If UsuarioActual.TienePermisoProceso(201) Then DivIndicadores.Visible = True @@ -324,6 +329,19 @@ Partial Class Inventarios_Kardex ObjInventarios.Dispose() GvSeries.DataBind() End Sub + + Private Sub CargarCaducidadProducto() + Dim almacenes As String = ddlAlmacen.GetSelectedValues() + If almacenes = "" Then + almacenes = "-1" + End If + Dim ObjInventarios As New ClsInventarios + If ObjInventarios.GetExistenciasCaducidad(ddlProducto2.SelectedValue.ToEntero(), -1, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, almacenes) Then + GvProductoCaducidad.DataSource = ObjInventarios.DtResultados + End If + ObjInventarios.Dispose() + GvProductoCaducidad.DataBind() + End Sub #End Region #Region " IMPRIMIR " @@ -440,6 +458,12 @@ Partial Class Inventarios_Kardex UpGridSeries.Update() RegistraScript(String.Format("$('#{0}').modal('show');", "DivModalSerie")) End Sub + + Protected Sub LnkCaducidad_OnClick(sender As Object, e As EventArgs) Handles LnkCaducidad.Click + CargarCaducidadProducto() + UpProductoCaducidad.Update() + RegistraScript(String.Format("$('#{0}').modal('show');", "DivModalCaducidad")) + End Sub #End Region diff --git a/Inventarios/KardexAlmacenHorizontal.aspx b/Inventarios/KardexAlmacenHorizontal.aspx index 3ccaa1725..5a7f0a38e 100644 --- a/Inventarios/KardexAlmacenHorizontal.aspx +++ b/Inventarios/KardexAlmacenHorizontal.aspx @@ -200,7 +200,8 @@
    - + +
    diff --git a/Inventarios/RecepcionAlmacen.aspx b/Inventarios/RecepcionAlmacen.aspx index 44dbb2eb4..592ecfc4d 100644 --- a/Inventarios/RecepcionAlmacen.aspx +++ b/Inventarios/RecepcionAlmacen.aspx @@ -489,7 +489,7 @@ - + diff --git a/Inventarios/RecepcionAlmacen.aspx.vb b/Inventarios/RecepcionAlmacen.aspx.vb index 06ced37cc..8a628b84b 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/RepApartados.aspx.vb b/Inventarios/RepApartados.aspx.vb index d2d984085..c6e777e22 100644 --- a/Inventarios/RepApartados.aspx.vb +++ b/Inventarios/RepApartados.aspx.vb @@ -35,7 +35,7 @@ Partial Class Inventarios_RepApartados DdlSubProyectos.DataBind() DdlSubProyectos.Items.Insert(0, New ListItem(" Todas ", "-1")) - If UsuarioActual.CveEmpresa = 119 Then + If UsuarioActual.Empresa.Funcionalidad(105) = "1" Then DdlClientesWS.setEsWebService(True) Else DdlClientesWS.setEsWebService(False) @@ -44,15 +44,9 @@ Partial Class Inventarios_RepApartados DdlClientesWS.ddl.Items.Insert(0, New ListItem("Todos", "-1")) End If - If UsuarioActual.CveEmpresa = 119 Then - DdlClienteTraspasar.setEsWebService(True) - Else - DdlClienteTraspasar.setEsWebService(False) - DdlClienteTraspasar.DataSource = GlobalDTCliente(UsuarioActual.CveEmpresa, -1) - DdlClienteTraspasar.DataBind() - DdlClienteTraspasar.ddl.Items.Insert(0, New ListItem("Todos", "-1")) - End If - + + DdlClienteTraspasar.setEsWebService(True) + Dim DTVendedores As New DataTable DTVendedores = GlobalDTVendedores(UsuarioActual.CveEmpresa, True) DTVendedores.Merge(GlobalDTVendedores(UsuarioActual.CveEmpresa, False)) @@ -139,7 +133,13 @@ Partial Class Inventarios_RepApartados End If DdlClienteTraspasar.SelectedValue = "-1" - DdlClienteTraspasar.SelectedText = "Seleccione" + DdlClienteTraspasar.SelectedText = "Seleccione" + + + If UsuarioActual.CveVendedor > 0 AndAlso CveVendedor.ToEntero <= 0 Then + CveVendedor = UsuarioActual.CveVendedor.ToString + End If + DdlVendedor.SelectedValueExist(CveVendedor) DdlSubProyectos.SelectedValueExist(CveSucursal) diff --git a/Inventarios/RepProductosPorCaducar.aspx b/Inventarios/RepProductosPorCaducar.aspx new file mode 100644 index 000000000..14b1fe232 --- /dev/null +++ b/Inventarios/RepProductosPorCaducar.aspx @@ -0,0 +1,104 @@ +<%@ Page Title="Compras - Reporte de Productos por Caducar" Language="C#" MasterPageFile="~/Site.master" AutoEventWireup="true" CodeFile="RepProductosPorCaducar.aspx.cs" Inherits="Inventarios_RepProductosPorCaducar" %> + +<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="asp" %> + + + + + + + + Reporte de Productos por Caducar + + + + +
  • + PDF +
  • +
  • + Excel +
  • +
    + + + + +
    +
    + + + +
    +
    +
    + + +
    +
    +
    +
    + +
    +
    + +
    +
    + +
    +
    +
    + + + + +
    + + +
    +
    + +
    +
    +
    + + + + +
    + + +
    +
    + +
    +
    + +
    +
    + +
    +
    + +
    +
    +
    +
    +
    +
    +
    + + + + + + + + + + + + +
    + + diff --git a/Inventarios/RepProductosPorCaducar.aspx.cs b/Inventarios/RepProductosPorCaducar.aspx.cs new file mode 100644 index 000000000..aed1cd91b --- /dev/null +++ b/Inventarios/RepProductosPorCaducar.aspx.cs @@ -0,0 +1,141 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Web; +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(); + 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); + DdlProveedor.Attributes.Add("data-metodo", "getproveedores"); + DdlProveedor.SelectedValue = "-1"; + DdlProveedor.SelectedText = "Todos"; + } + + private void CargarSucursales() + { + ClsSubProyectos ObjSubProyectos = new ClsSubProyectos(); + if (ObjSubProyectos.GetSubProyectos(UsuarioActual.CveEmpresa)) + { + DdlSucursal.DataSource = ObjSubProyectos.DtResultados; + } + ObjSubProyectos.Dispose(); + DdlSucursal.DataBind(); + DdlSucursal.Items.Insert(0, new ListItem("Todas", "-1")); + } + + private void CargarClasificaciones() + { + ClsClasificaciones ObjClasificacion = new ClsClasificaciones(); + if (ObjClasificacion.GetClasificaciones(UsuarioActual.CveEmpresa)) + { + DdlClasificacion.DataSource = ObjClasificacion.DtResultados; + } + ObjClasificacion.Dispose(); + DdlClasificacion.DataBind(); + 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 diff --git a/Inventarios/TraspasoAlmacen.aspx.vb b/Inventarios/TraspasoAlmacen.aspx.vb index 9ac1ebf21..dfae741be 100644 --- a/Inventarios/TraspasoAlmacen.aspx.vb +++ b/Inventarios/TraspasoAlmacen.aspx.vb @@ -1016,7 +1016,7 @@ Partial Class Inventarios_TraspasoAlmacen ErrorMovInv = True End If - If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, False, importe, TxtObservaciones.Text, 289, TxtObservaciones.Text, Fecha, IdCtaContable, -1, CveMovimientoAlmacen:=CveMovimientoEntrada, ImporteMX:=importe, Contabilizable:=False) Then + If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, False, importe, TxtObservaciones.Text, 68, TxtObservaciones.Text, Fecha, IdCtaContable, -1, CveMovimientoAlmacen:=CveMovimientoEntrada, ImporteMX:=importe, Contabilizable:=False) Then ErrorMovInv = True End If End If @@ -1316,6 +1316,7 @@ Partial Class Inventarios_TraspasoAlmacen GvDatos.Columns(5).Visible = DtTemp.MAX("Serie").ToString <> "" GvDatos.Columns(6).Visible = DtTemp.MAX("Lote").ToString <> "" + GvDatos.Columns(7).HeaderText = If(UsuarioActual.Empresa.Funcionalidad(147) = "Fecha Elaboración", "Fecha Elaboración", "Fecha Caducidad") GvDatos.Columns(7).Visible = DtTemp.MAX("FechaCaducidad").ToString.ToDate > MinFecha GvDatos.Columns(8).Visible = DtTemp.MAX("CveSeccionAlmacen").ToString.ToEntero > 0 @@ -1731,7 +1732,7 @@ Partial Class Inventarios_TraspasoAlmacen Dim ImporteDecimal As Decimal = importe.ToDecimal.RoundSQL Dim IdCtaContable As Integer = GlobalDTAlmacen(UsuarioActual.CveEmpresa).FiltroPrimeroValor("IdCtaContable", String.Format("CveAlmacen = {0}", DdlAlmacenTransitorioRecepcion.SelectedValue.ToEntero)).ToEntero - If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, True, ImporteDecimal, TxtObservaciones.Text, 289, TxtObservaciones.Text, Fecha, IdCtaContable, -1, + If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, True, ImporteDecimal, TxtObservaciones.Text, 68, TxtObservaciones.Text, Fecha, IdCtaContable, -1, CveMovimientoAlmacen:=CveMovimientoEntrada, ImporteMX:=ImporteDecimal) Then ErrorMovInv = True TextoError = "Ocurrió un erro al cancelar el traspaso" @@ -1823,7 +1824,7 @@ Partial Class Inventarios_TraspasoAlmacen Dim Fecha As Date = TxtFechaRecepcion.Text.ToDate Dim CveAlmacenEntrada As Integer = GvDatosRecepcion.Rows(0).DataKey("CveAlmacenDestino").ToEntero - Dim CveAlmacenSalida As Integer = GvDatosRecepcion.Rows(0).DataKey("CveAlmacenSalida").ToEntero + Dim CveAlmacenSalida As Integer = DdlAlmacenTransitorioRecepcion.SelectedValue.ToEntero Dim TipoAlmacenDestino As Integer = GlobalDTAlmacenUsuarios(UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa).FiltroPrimeroValor("CveTipoAlmacen", $"CveAlmacen = {CveAlmacenEntrada}").ToEntero() Dim TipoAlmacenOrigen As Integer = GlobalDTAlmacenUsuarios(UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa).FiltroPrimeroValor("CveTipoAlmacen", $"CveAlmacen = {CveAlmacenSalida}").ToEntero() @@ -1902,11 +1903,11 @@ Partial Class Inventarios_TraspasoAlmacen Dim importe As Decimal = resultado.SUMD("Total").RoundSQL Dim IdCtaContable As Integer = GlobalDTAlmacen(UsuarioActual.CveEmpresa).FiltroPrimeroValor("IdCtaContable", String.Format("CveAlmacen = {0}", DdlAlmacenTransitorioRecepcion.SelectedValue.ToEntero)).ToEntero - If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, True, importe, TxtObservaciones.Text, 289, TxtObservaciones.Text, Fecha, IdCtaContable, -1, CveMovimientoAlmacen:=CveMovimientoSalida, ImporteMX:=importe, Contabilizable:=False) Then + If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, True, importe, TxtObservaciones.Text, 68, TxtObservaciones.Text, Fecha, IdCtaContable, -1, CveMovimientoAlmacen:=CveMovimientoSalida, ImporteMX:=importe, Contabilizable:=False) Then ErrorMovInv = True End If - If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, False, importe, TxtObservaciones.Text, 68, TxtObservaciones.Text, Fecha, IdCtaContable, -1, CveMovimientoAlmacen:=CveMovimientoSalida, ImporteMX:=importe, Contabilizable:=False) Then + If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, False, importe, TxtObservaciones.Text, 68, TxtObservaciones.Text, Fecha, IdCtaContable, -1, CveMovimientoAlmacen:=CveMovimientoEntrada, ImporteMX:=importe, Contabilizable:=False) Then ErrorMovInv = True End If End If @@ -2027,8 +2028,8 @@ Partial Class Inventarios_TraspasoAlmacen TxtObservacionesRecepcion.Text = "" Dim Mensaje As StringBuilder = New StringBuilder - Mensaje.AppendFormat("Se realizo correctamente la recepción.
    Folio de Entrada: {0}", Folio, CveMovimientoSalida) - Mensaje.AppendFormat("
    Imprimir Reporte", Encripta(String.Format("OP=Alm&CveMovimiento={0}", CveMovimientoSalida))) 'onclick='ImprimirTraslado()' + Mensaje.AppendFormat("Se realizo correctamente la recepción.
    Folio de Entrada: {0}", Folio, CveMovimientoEntrada) + Mensaje.AppendFormat("
    Imprimir Reporte", Encripta(String.Format("OP=Alm&CveMovimiento={0}", CveMovimientoEntrada))) 'onclick='ImprimirTraslado()' If CveMovimientoVirtualEntrada > 0 Then Mensaje.AppendFormat("


    Folio Virtual {2}
    Imprimir Reporte", Encripta(String.Format("OP=Alm&CveMovimiento={0}", CveMovimientoVirtualEntrada)), CveMovimientoVirtualEntrada, FolioVirtualEntrada) 'onclick='ImprimirTraslado()' diff --git a/Ventas/ProductosServicios.aspx b/Ventas/ProductosServicios.aspx index 9ce597ef4..91b9fb262 100644 --- a/Ventas/ProductosServicios.aspx +++ b/Ventas/ProductosServicios.aspx @@ -876,7 +876,7 @@
    - +
    diff --git a/Ventas/ProductosServicios.aspx.vb b/Ventas/ProductosServicios.aspx.vb index 09381fd6c..7f2285a55 100644 --- a/Ventas/ProductosServicios.aspx.vb +++ b/Ventas/ProductosServicios.aspx.vb @@ -876,6 +876,10 @@ Partial Class ProductosyServicios ChkLote.Checked = ObjProductosServicios.AplicaLote ChkCaducidad.Checked = ObjProductosServicios.AplicaCaducidad ChkSeccion.Checked = ObjProductosServicios.AplicaSeccion + If ObjProductosServicios.DtResultados.Rows(0)("TiempoCaducidad") IsNot Nothing Then + TxtTiempoCaducidad.Text = ObjProductosServicios.DtResultados.Rows(0)("TiempoCaducidad").ToString() + DivTiempoCaducidad.Visible = ChkCaducidad.Checked + End If If ObjProductosServicios.AplicaSeccion Then CargaGvSeccionAlmacen()