Option Explicit On Option Strict On Imports System.Data Imports Extensiones Imports Microsoft.Reporting.WebForms Partial Class Inventarios_ResguardoMaterial Inherits ClsPaginas #Region "Propiedades" Public Property DtMovimientos() As DataTable Get Return CType(ViewState("DtMovimientos"), DataTable) End Get Set(value As DataTable) ViewState("DtMovimientos") = value End Set End Property Public Property DtMovimientosLiberacion() As DataTable Get Return CType(ViewState("DtMovimientosLiberacion"), DataTable) End Get Set(value As DataTable) ViewState("DtMovimientosLiberacion") = value End Set End Property Public Property CveAlmacenLiberación() As Integer Get Return ViewState("CveAlmacenLiberación").ToString.ToEntero End Get Set(value As Integer) ViewState("CveAlmacenLiberación") = value End Set End Property Public Property CvePersonalLiberacion() As Integer Get Return ViewState("CvePersonalLiberacion").ToString.ToEntero End Get Set(value As Integer) ViewState("CvePersonalLiberacion") = value End Set End Property Public Property CveClienteLiberacion() As Integer Get Return ViewState("CveClienteLiberacion").ToString.ToEntero End Get Set(value As Integer) ViewState("CveClienteLiberacion") = value End Set End Property Public Property CveProveedorLiberacion() As Integer Get Return ViewState("CveProveedorLiberacion").ToString.ToEntero End Get Set(value As Integer) ViewState("CveProveedorLiberacion") = value End Set End Property Public Property FechaLiberacion As String Get Return ViewState("FechaLiberacion").ToString End Get Set(value As String) ViewState("FechaLiberacion") = value End Set End Property Public Property EsSurtidoUniforme As Boolean Get If ViewState("EsSurtidoUniforme") Is Nothing Then Return False Else Return Boolean.Parse(ViewState("EsSurtidoUniforme").ToString) End If End Get Set(value As Boolean) ViewState("EsSurtidoUniforme") = value End Set End Property Private Property ValidaLoteCaducidad As Boolean Get Return CType(ViewState("ValidaLoteCaducidad"), Boolean) End Get Set(value As Boolean) ViewState("ValidaLoteCaducidad") = value End Set End Property Private Property CantidadTotal As Decimal Get Return CType(ViewState("CantidadTotal"), Decimal) End Get Set(value As Decimal) ViewState("CantidadTotal") = value End Set End Property Private Property CvePS As Integer Get Return CType(ViewState("CvePS"), Integer) End Get Set(value As Integer) ViewState("CvePS") = value End Set End Property Private Property TipoSeccionAlmacen As Integer Get Return CType(ViewState("TipoSeccionAlmacen"), Integer) End Get Set(value As Integer) ViewState("TipoSeccionAlmacen") = value End Set End Property #End Region Protected Sub Page_Load(sender As Object, e As EventArgs) Handles Me.Load If Not IsPostBack Then If Not Request.QueryString("EsSurtidoUniforme") Is Nothing Then EsSurtidoUniforme = If(Request.QueryString("EsSurtidoUniforme").ToString = "1", True, False) End If InicializaValores() If Not Request.QueryString("CvePersonal") Is Nothing Then Try Dim CvePersonal As Integer = Request.QueryString("CvePersonal").ToString.ToEntero OcultarControles(CvePersonal) TxtFecha.Enabled = False Catch ex As Exception End Try End If End If End Sub Private Sub OcultarControles(CvePersonal As Integer) DdlPersonal.SelectedValue = CvePersonal.ToString() DdlPersonal.SelectedText = GlobalDTRHPersonal(UsuarioActual.CveEmpresa, CvePersonal).FiltroPrimeroValor("NombreCompleto", $" CvePersonal = {CvePersonal}") DdlPersonal.Enabled = False DVTipo.Visible = False End Sub #Region " INICIALIZA VALORES " Private Sub InicializaValores() CreaDT() CargaCombos() TxtFecha.Text = NowADS().ToShortDateString TxtFechaLiberacion.Text = NowADS().ToShortDateString GvM.DataBind() CantidadTotal = 0 CvePS = 0 TipoSeccionAlmacen = 0 End Sub Protected Sub CreaDT() Dim dt As New DataTable Dim column As DataColumn = New DataColumn("No") column.DataType = Type.GetType("System.Int32") With column .AutoIncrement = True .AutoIncrementSeed = 1 .AutoIncrementStep = 1 End With dt.Columns.Add(column) dt.Columns.Add("CveMovimiento", Type.GetType("System.Int32")) dt.Columns.Add("CveMovimientoDetalle", Type.GetType("System.Int32")) dt.Columns.Add("Cantidad", Type.GetType("System.Double")) dt.Columns.Add("CveUM", Type.GetType("System.Int32")) dt.Columns.Add("UnidadMedida") dt.Columns.Add("CvePS", Type.GetType("System.Int32")) dt.Columns.Add("PS") dt.Columns.Add("Estatus") dt.Columns.Add("Codigo") dt.Columns.Add("SeccionAlmacen") dt.Columns.Add("Serie") dt.Columns.Add("Lote") dt.Columns.Add("FechaCaducidad", Type.GetType("System.DateTime")) dt.Columns.Add("CveSeccionAlmacen", Type.GetType("System.Int32")) dt.Columns.Add("Observaciones") dt.Columns.Add("CvePersonal", Type.GetType("System.Int32")) dt.Columns.Add("Checado", Type.GetType("System.Boolean")) DtMovimientos = dt CargaGvM() End Sub Private Sub CargaCombos() DdlPersonal.setEsWebService(True) DdlPersonal.Attributes.Add("data-metodo", "getpersonal") DdlPersonal.SelectedValue = "-1" DdlPersonal.SelectedText = "Seleccione" DdlPersonalLiberacion.setEsWebService(True) DdlPersonalLiberacion.Attributes.Add("data-metodo", "getpersonal") DdlPersonalLiberacion.SelectedValue = "-1" DdlPersonalLiberacion.SelectedText = "Seleccione" DdlCliente.setEsWebService(True) DdlCliente.Attributes.Add("data-metodo", "getcliente") DdlCliente.SelectedValue = "-1" DdlCliente.SelectedText = "Seleccione" DdlClienteLiberacion.setEsWebService(True) DdlClienteLiberacion.Attributes.Add("data-metodo", "getcliente") DdlClienteLiberacion.SelectedValue = "-1" DdlClienteLiberacion.SelectedText = "Seleccione" DdlProveedor.setEsWebService(True) DdlProveedor.Attributes.Add("data-metodo", "getproveedores") DdlProveedor.SelectedValue = "-1" DdlProveedor.SelectedText = "Seleccione" DdlProveedorLiberacion.setEsWebService(True) DdlProveedorLiberacion.Attributes.Add("data-metodo", "getproveedores") DdlProveedorLiberacion.SelectedValue = "-1" DdlProveedorLiberacion.SelectedText = "Seleccione" If isWhitFamily() Then DdlClasificacion.DataSource = GlobalDTSubFamilias(UsuarioActual.CveEmpresa).FiltraParametros("", Orderby:="Clasificacion") Else DdlClasificacion.DataSource = GlobalDTClasificaciones(UsuarioActual.CveEmpresa).FiltraParametros(" Codigo = '' OR Codigo IS NULL ", Orderby:="Clasificacion") End If DdlClasificacion.DataBind() If EsSurtidoUniforme Then 'RESGUARDO DdlAlmacen.DataSource = GlobalDTAlmacenUsuarios(UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, -1).FiltraParametros("CveTipoAlmacen IN (19)") 'GlobalDTAlmacen(UsuarioActual.CveEmpresa) DdlAlmacen.DataBind() DdlAlmacen.Items.Insert(0, New ListItem("Seleccione", "-1")) 'Almacen Destino DdlAlmacenDestino.DataSource = GlobalDTAlmacenUsuarios(UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, 20) DdlAlmacenDestino.DataBind() DdlAlmacenDestino.Items.Insert(0, New ListItem("Seleccione", "-1")) 'LIBERACION DdlAlmacenLiberacion.DataSource = GlobalDTAlmacenUsuarios(UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, 20) DdlAlmacenLiberacion.DataBind() DdlAlmacenLiberacion.Items.Insert(0, New ListItem("Seleccione", "-1")) ''Almacen Destino Else 'RESGUARDO DdlAlmacen.DataSource = GlobalDTAlmacenUsuarios(UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, -1).FiltraParametros("CveTipoAlmacen IN (1,2)") ''almacen:material,herramientas,'.FiltraParametros("CveTipoAlmacen NOT IN (8)") 'GlobalDTAlmacen(UsuarioActual.CveEmpresa) DdlAlmacen.DataBind() DdlAlmacen.Items.Insert(0, New ListItem("Seleccione", "-1")) 'Almacen Destino DdlAlmacenDestino.DataSource = GlobalDTAlmacenUsuarios(UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, 8) DdlAlmacenDestino.DataBind() DdlAlmacenDestino.Items.Insert(0, New ListItem("Seleccione", "-1")) 'LIBERACION DdlAlmacenLiberacion.DataSource = GlobalDTAlmacenUsuarios(UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, 8) DdlAlmacenLiberacion.DataBind() DdlAlmacenLiberacion.Items.Insert(0, New ListItem("Seleccione", "-1")) End If ''Almacen Destino DdlAlmacenDestinoLiberacion.DataSource = GlobalDTAlmacenUsuarios(UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, -1).FiltraParametros("CveTipoAlmacen IN (1,2)") ''almacen:material,herramientas, DdlAlmacenDestinoLiberacion.DataBind() DdlAlmacenDestinoLiberacion.Items.Insert(0, New ListItem("Seleccione", "-1")) CargaPS() End Sub Private Sub CargaPS() DdlProducto2.setEsWebService(UsuarioActual.Empresa.Funcionalidad(105) = "1") If DdlProducto2.UsaWebService Then 'DdlProducto2.ddlWS.Attributes.Add("data-pagina", "Inventarios") 'DdlProducto2.ddlWS.Attributes.Add("data-cveclasificacion", DdlClasificacion.SelectedValue.ToString) End If If Not DdlProducto2.UsaWebService AndAlso CType(DdlProducto2.DataSource, DataTable) Is Nothing Then DdlProducto2.DataSource = GlobalDTPSSimplificado(UsuarioActual.CveEmpresa) DdlProducto2.DataBind() End If VerificaProducto() End Sub Private Function isWhitFamily() As Boolean Return (UsuarioActual.CveEmpresa = 66) End Function #End Region #Region " RESGUARDO " #Region " FUNCIONALIDAD 105 - CLASIFICACION PS" Protected Sub DdlClasificacion_SelectedIndexChanged(sender As Object, e As System.EventArgs) Handles DdlClasificacion.SelectedIndexChanged CargaProductosPorClasificacion() End Sub Protected Sub DdlProducto_ValueChanged(sender As Object, e As EventArgs) Handles DdlProducto2.selectedindexchange VerificaProducto() End Sub Private Sub CargaProductosPorClasificacion() If UsuarioActual.Empresa.Funcionalidad(105) = "" Then 'Dim filtro As String = "" 'If Not (DdlClasificacion.SelectedValue = "-1") Then ' If isWhitFamily() Then ' 'filtro = String.Format("CveSubFamilia={0}", DdlClasificacion.SelectedValue) ' Else ' filtro = String.Format("CveClasificacion={0}", DdlClasificacion.SelectedValue) ' End If 'End If DdlProducto2.DataSource = GlobalDTPSSimplificado(UsuarioActual.CveEmpresa, CveClasificacion:=DdlClasificacion.SelectedValue.ToEntero).FiltraParametros("", "PSCodigo") DdlProducto2.DataBind() DdlProducto2.ddl.Items.Insert(0, New ListItem("----", "-1")) Else 'If isWhitFamily() Then ' 'DdlProducto2.ddlWS.Attributes.Add("data-idSubFamilia", DdlClasificacion.SelectedValue) 'Else DdlProducto2.ddlWS.Attributes.Add("data-cveclasificacion", DdlClasificacion.SelectedValue) 'End If End If End Sub Private Sub VerificaProducto() If DdlProducto2.SelectedValue.ToEntero > 0 Then Dim drp As DataRow = GlobalDTPSSimplificado(UsuarioActual.CveEmpresa, CvePS:=DdlProducto2.SelectedValue.ToEntero).FiltroPrimero("") If drp IsNot Nothing Then 'activa Serie If CBool(drp("AplicaSerie")) Then ThSerie.Visible = True TrSerie.Visible = True TxtnSerie.Visible = True Else ThSerie.Visible = False TrSerie.Visible = False TxtnSerie.Visible = False TxtnSerie.Text = "" End If 'activa seccion If CBool(drp("AplicaSeccion")) Then ThSeccion.Visible = True TrSeccion.Visible = True If DdlAlmacen.SelectedValue.ToEntero > 0 Then DdlSeccionAlmacen.Items.Clear() CargaSeccionesAlmacen(DdlSeccionAlmacen, DdlAlmacen.SelectedValue.ToEntero, DdlProducto2.SelectedValue.ToEntero, UsuarioActual.CveEmpresa) 'Dim dtt As DataTable = GlobalDTInvPSSeccionesAlmacen(UsuarioActual.CveEmpresa, DdlAlmacen.SelectedValue.ToEntero, DdlProducto2.SelectedValue.ToEntero) 'DdlSeccionAlmacen.DataSource = dtt 'DdlSeccionAlmacen.DataBind() 'If dtt.Rows.Count > 1 Then ' DdlSeccionAlmacen.Items.Insert(0, New ListItem("Seleccione", "-1")) 'End If 'dtt.Dispose() End If Else ThSeccion.Visible = False TrSeccion.Visible = False DdlSeccionAlmacen.Items.Clear() End If 'activa lote If CBool(drp("AplicaLote")) Then ThLote.Visible = True TrLote.Visible = True Else ThLote.Visible = False TrLote.Visible = False TxtLote.Text = "" End If 'activa caducidad If CBool(drp("AplicaCaducidad")) Then ThCaducidad.Visible = True TrCaducidad.Visible = True Else ThCaducidad.Visible = False TrCaducidad.Visible = False TxtCaducidad.Text = "" End If Else TxtnSerie.Visible = False End If End If 'If (1.Contiene("3", "7", "8", "11")) Then ' Dim objinv As New ClsInventarios ' If objinv.GetExistenciasPS(DdlProducto2.SelectedValue.ToEntero, -1, UsuarioActual.CveEmpresa, DdlAlmacen.SelectedValue.ToEntero, FechaMovto:=DateTime.Today.AddDays(1).ToString("yyyy/MM/dd HH:mm")) Then ' DdlUnidad.DataSource = objinv.DtResultados.FiltraParametros("", "UnidadMedida", {"CveUnidadMedida", "UnidadMedida"}) ' If objinv.DtResultados.Rows.Count = 0 Then ' Alert("No hay existencias de este producto", TipoMensaje.MsgAdvertencia) ' End If ' End If ' objinv.Dispose() 'Else ' DdlUnidad.DataSource = GlobalDTProductosServiciosEquivalencias(DdlProducto2.SelectedValue.ToEntero, -1) 'End If DdlUnidad.Items.Clear() DdlUnidad.DataSource = GlobalDTProductosServiciosEquivalencias(DdlProducto2.SelectedValue.ToEntero, -1, UsuarioActual.CveEmpresa) DdlUnidad.DataBind() UPDatos.Update() End Sub #End Region #Region " EXISTENCIAS " Private Function GetExistencias(CvePS As Integer, CveUnidadMedida As Integer, CveEmpresa As Integer, CveAlmacen As Integer, Optional Serie As String = "-1") As Double Dim Inv As New ClsInventarios Dim Existencia As Double = Inv.GetExistenciasPS(CvePS, CveUnidadMedida, CveEmpresa, CveAlmacen, FechaMovto:=TxtFecha.Text.ToDateTime.ToString("yyyy/MM/dd HH:mm"), Serie:=Serie) Inv.Dispose() Return Existencia End Function #End Region #Region " AGREGAR " Protected Sub btnAgregar_Click(sender As Object, e As EventArgs) Handles LbAgregar.Click AgregaProducto() LimpiarAgregar() End Sub Protected Sub AgregaProducto() Dim PSSelected As Integer = DdlProducto2.SelectedValue.ToEntero If DdlAlmacen.SelectedValue.ToEntero <= 0 Then Alert("Seleccione un almacen", TipoMensaje.MsgInformacion) : Exit Sub If PSSelected > 0 Then If TxtnSerie.Visible Then If TxtnSerie.Text = "" Then Alert("Serie-Lote es necesario", TipoMensaje.MsgAdvertencia) Return End If End If Dim Valido As Boolean = True Dim cantidadd As Double = txtCantidad.Text.ToDouble Dim Existencia As Double = GetExistencias(PSSelected, DdlUnidad.SelectedValue.ToEntero, UsuarioActual.CveEmpresa, DdlAlmacen.SelectedValue.ToEntero, If(TxtnSerie.Visible, TxtnSerie.Text, "-1").ToString) If Existencia - txtCantidad.Text.ToDouble - DtMovimientos.SUM("Cantidad", $"CvePS = {PSSelected} ") < 0 Then If Existencia <= 0 Then Alert("No hay existencia del producto", TipoMensaje.MsgAdvertencia) Else Alert(String.Format("Solo hay en existencia: {0}", Existencia - DtMovimientos.SUM("Cantidad", $"CvePS = {PSSelected} ")), TipoMensaje.MsgAdvertencia) If Not UsuarioActual.TienePermisoProceso(114) Then cantidadd = Existencia End If End If Valido = False 'Valido = If(UsuarioActual.TienePermisoProceso(114), True, False) End If If Valido Then Dim CveClasificacion As Integer Dim dr As DataRow = GlobalDTPS(UsuarioActual.CveEmpresa, CvePS:=PSSelected).FiltroPrimero("", "PS") If dr IsNot Nothing Then CveClasificacion = dr("CveClasificacion").ToString.ToEntero Dim registro As DataRow = DtMovimientos.NewRow registro.Item("Cantidad") = cantidadd registro.Item("CveUM") = DdlUnidad.SelectedValue.ToEntero registro.Item("UnidadMedida") = DdlUnidad.SelectedItem.Text registro.Item("CvePS") = PSSelected registro.Item("PS") = DdlProducto2.SelectedText registro.Item("Estatus") = "" registro.Item("SeccionAlmacen") = If(DdlSeccionAlmacen.SelectedValue.ToEntero > 0, DdlSeccionAlmacen.SelectedItem.Text, "") registro.Item("Serie") = TxtnSerie.Text registro.Item("Lote") = If(TxtLote.Text = "", "", TxtLote.Text) registro.Item("FechaCaducidad") = If(TxtCaducidad.Text = "", MinFecha.ToString, TxtCaducidad.Text) registro.Item("CveSeccionAlmacen") = If(DdlSeccionAlmacen.SelectedValue.ToEntero > 0, DdlSeccionAlmacen.SelectedValue.ToEntero, -1) registro.Item("Observaciones") = TxtObservacionesdetalle.Text DtMovimientos.Rows.Add(registro) CargaGvM() UPDatos.Update() txtCantidad.Text = "" txtCantidad.Focus() End If End If End Sub Private Sub LimpiarAgregar() DdlClasificacion.SelectedValue = "-1" txtCantidad.Text = "" TxtObservacionesdetalle.Text = "" ThCaducidad.Visible = False TrCaducidad.Visible = False TxtCaducidad.Text = "" ThLote.Visible = False TrLote.Visible = False TxtLote.Text = "" ThSerie.Visible = False TrSerie.Visible = False TxtnSerie.Visible = False TxtnSerie.Text = "" ThSeccion.Visible = False TrSeccion.Visible = False DdlSeccionAlmacen.Items.Clear() End Sub #End Region #Region " GvM " Private Sub CargaGvM() If DtMovimientos IsNot Nothing Then GvM.Columns(4).Visible = DtMovimientos.MAX("CveSeccionAlmacen").ToString.ToEntero > 0 GvM.Columns(5).Visible = DtMovimientos.MAX("Serie").ToString <> "" GvM.Columns(6).Visible = DtMovimientos.MAX("Lote").ToString <> "" GvM.Columns(7).Visible = DtMovimientos.MAX("FechaCaducidad").ToString.ToDate > MinFecha End If GvM.DataSource = DtMovimientos GvM.DataBind() End Sub Private Sub GvM_RowDeleting(sender As Object, e As GridViewDeleteEventArgs) Handles GvM.RowDeleting Dim DbRow As DataRow = Nothing DbRow = DtMovimientos.Rows(e.RowIndex) DtMovimientos.Rows.Remove(DbRow) GvM.EditIndex = -1 CargaGvM() UPDatos.Update() End Sub Protected Sub GvM_RowDataBound(sender As Object, e As GridViewRowEventArgs) If e.Row.RowType = DataControlRowType.DataRow Then 'If DtSeccionAlmacen.FiltraParametros($"IndexSeccionAlmacen = {e.Row.RowIndex}").SUMD("CantidadSeccionAlmacen") > 0 Then ' e.Row.FCLinkButton("lnkRemove").Visible = False ' e.Row.FCLinkButton("lnkRemove").ToolTip = "Cuenta con sección almacen" 'End If End If End Sub #End Region #Region " NUEVO " Protected Sub BtnNuevo_Click(sender As Object, e As EventArgs) LimpiarMovimiento() End Sub Private Sub LimpiarMovimiento() DtMovimientos.Clear() CargaGvM() BtnGuardarResguardo.Visible = True DdlAlmacen.SelectedValueExist("-1") DdlAlmacenDestino.SelectedValueExist("-1") TxtObservaciones.Text = "" TxtFecha.Text = NowADS().ToShortDateString DdlPersonal.SelectedValue = "-1" DdlPersonal.SelectedText = "Seleccione" LimpiarAgregar() UPDatos.Update() UpGenerales.Update() End Sub #End Region #End Region #Region " LIBERACION " #Region " GV DATOS LIBERACION " Protected Sub GvMLiberacion_RowDataBound(sender As Object, e As GridViewRowEventArgs) If e.Row.RowType = DataControlRowType.DataRow Then e.Row.FCLabel("LblCantidad").Text = e.Row.FCLabel("LblCantidad").Text.FormatoNumero(2) If CBool(e.Row.DBCampo("AplicaSeccion")) AndAlso DdlAlmacenDestinoLiberacion.SelectedValue.ToEntero > 0 Then Dim dtt As DataTable = GlobalDTInvPSSeccionesAlmacen(UsuarioActual.CveEmpresa, DdlAlmacenDestinoLiberacion.SelectedValue.ToEntero, e.Row.DBCampo("CvePS").ToEntero) e.Row.FCDropDownList("DdlSeccionAlmacen").Visible = True e.Row.FCDropDownList("DdlSeccionAlmacen").DataSource = dtt e.Row.FCDropDownList("DdlSeccionAlmacen").DataBind() If dtt.Rows.Count = 0 Then e.Row.FCDropDownList("DdlSeccionAlmacen").Items.Insert(0, New ListItem("Seleccione", "-1")) End If dtt.Dispose() End If If (ValidaLoteCaducidad) OrElse (UsuarioActual.CveEmpresa <> 119) Then If CBool(e.Row.DBCampo("AplicaCaducidad")) Then e.Row.FCTextBox("TxtCaducidad").Visible = True e.Row.FCLinkButton("LnkCaducidad").Visible = True Else e.Row.FCTextBox("TxtCaducidad").Visible = False e.Row.FCLinkButton("LnkCaducidad").Visible = False End If If CBool(e.Row.DBCampo("AplicaLote")) Then e.Row.FCTextBox("TxtLote").Visible = True Else e.Row.FCTextBox("TxtLote").Visible = False End If End If End If End Sub Protected Sub GvMLiberacion_RowCreated(sender As Object, e As GridViewRowEventArgs) If e.Row.RowType = DataControlRowType.DataRow Then Dim Index As Integer = e.Row.RowIndex e.Row.FCTextBox("TxtCantidad").Attributes.Add("onKeyUp", String.Format("ValidarCantidad({0});", Index)) End If End Sub #End Region #Region " CARGA RESGUARDOS PARA LIBERACION " Protected Sub BtnVerificarExistencias_Click(sender As Object, e As EventArgs) If UsuarioActual.CveEmpresa <> 140 Then If Not DdlProveedorLiberacion.SelectedValue.ToEntero > 0 AndAlso DdlTipo.SelectedValue.ToEntero = 3 Then Alert("Tiene que seleccionar un proveedor.", TipoMensaje.MsgAdvertencia) Exit Sub End If If Not DdlPersonalLiberacion.SelectedValue.ToEntero > 0 AndAlso DdlTipo.SelectedValue.ToEntero = 1 Then Alert("Tiene que seleccionar un personal.", TipoMensaje.MsgAdvertencia) Exit Sub End If If Not DdlClienteLiberacion.SelectedValue.ToEntero > 0 AndAlso DdlTipo.SelectedValue.ToEntero = 2 Then Alert("Tiene que seleccionar un cliente.", TipoMensaje.MsgAdvertencia) Exit Sub End If Else GvMLiberacion.Columns(1).HeaderText = If(DdlTipo.SelectedValue.ToEntero = 1, "Personal", If(DdlTipo.SelectedValue.ToEntero = 2, "Cliente", "Proveedor")) End If If UsuarioActual.CveEmpresa = 140 Then If (DdlTipo.SelectedValue.ToEntero = 1 And DdlPersonalLiberacion.SelectedValue.ToEntero <= 0) Or (DdlTipo.SelectedValue.ToEntero = 2 And DdlClienteLiberacion.SelectedValue.ToEntero <= 0) Or (DdlTipo.SelectedValue.ToEntero = 3 And DdlProveedorLiberacion.SelectedValue.ToEntero <= 0) Then DVInformacionMoviminetoLiberacion.Visible = False BtnGuardarLiberacion.Visible = False GvMLiberacion.Columns(1).Visible = True Else DVInformacionMoviminetoLiberacion.Visible = True BtnGuardarLiberacion.Visible = True GvMLiberacion.Columns(1).Visible = False GvMLiberacion.Columns(1).HeaderText = "" End If End If CargaResguardos() UpGridLiberacion.Update() UpGenerales.Update() End Sub Private Sub CargaResguardos() Dim ObjInventario As New ClsInventarios() Dim Existencias As Double = 0 If ObjInventario.GetMovimientosDetallePorPersonal(DdlPersonalLiberacion.SelectedValue.ToEntero, DdlAlmacenLiberacion.SelectedValue.ToEntero, DdlClienteLiberacion.SelectedValue.ToEntero, DdlProveedorLiberacion.SelectedValue.ToEntero, DdlTipo.SelectedValue.ToEntero) Then DtMovimientosLiberacion = ObjInventario.DtResultados DtMovimientosLiberacion.Columns("No").AutoIncrement = True DtMovimientosLiberacion.Columns("No").AutoIncrementSeed = DtMovimientosLiberacion.Rows.Count + 1 DtMovimientosLiberacion.Columns("No").AutoIncrementStep = 1 Dim keys(1) As DataColumn keys(0) = DtMovimientosLiberacion.Columns("No") DtMovimientosLiberacion.PrimaryKey = keys CargaGvMLiberacion() If DdlPersonalLiberacion.SelectedValue.ToEntero <> -1 Then LblTipo.InnerText = "Personal/Responsable:" LbTipoLiberacion.Text = DdlPersonalLiberacion.SelectedText End If If DdlProveedorLiberacion.SelectedValue.ToEntero <> -1 Then LblTipo.InnerText = "Proveedor:" LbTipoLiberacion.Text = DdlProveedorLiberacion.SelectedText End If If DdlClienteLiberacion.SelectedValue.ToEntero <> -1 Then LblTipo.InnerText = "Cliente:" LbTipoLiberacion.Text = DdlClienteLiberacion.SelectedText End If CvePersonalLiberacion = DdlPersonalLiberacion.SelectedValue.ToEntero CveClienteLiberacion = DdlClienteLiberacion.SelectedValue.ToEntero CveProveedorLiberacion = DdlProveedorLiberacion.SelectedValue.ToEntero LbAlmacenLiberacion.Text = DdlAlmacenLiberacion.SelectedItem.Text CveAlmacenLiberación = DdlAlmacenLiberacion.SelectedValue.ToEntero LbFechaLiberacion.Text = TxtFechaLiberacion.Text FechaLiberacion = TxtFechaLiberacion.Text BtnGuardarLiberacion.Visible = True UpGeneralesLibreacion.Update() Else Alert("Ocurrió un error al cargar los resguardos del personal. Por favor vuelva a intentar.", TipoMensaje.MsgError) End If ObjInventario.Dispose() End Sub Private Sub CargaGvMLiberacion() GvMLiberacion.Columns(6).Visible = DtMovimientosLiberacion.MAX("Serie").ToString <> "" GvMLiberacion.Columns(7).Visible = DtMovimientosLiberacion.MAX("AplicaLote").ToString = "True" GvMLiberacion.Columns(8).Visible = DtMovimientosLiberacion.MAX("AplicaCaducidad").ToString = "True" ' .ToDate > MinFecha GvMLiberacion.Columns(9).Visible = DtMovimientosLiberacion.MAX("CveSeccionAlmacen").ToString.ToEntero > 0 Or DtMovimientosLiberacion.MAX("AplicaSeccion") = "True" GvMLiberacion.DataSource = DtMovimientosLiberacion GvMLiberacion.DataBind() UpGridLiberacion.Update() End Sub #End Region #Region " LIMPIAR LIBERACION " Private Sub LimpiarLiberacion() LbTipoLiberacion.Text = "" LblTipo.InnerText = "" CvePersonalLiberacion = -1 CveClienteLiberacion = -1 CveProveedorLiberacion = -1 LbAlmacenLiberacion.Text = "" CveAlmacenLiberación = -1 LbFechaLiberacion.Text = "" FechaLiberacion = "" BtnGuardarLiberacion.Visible = False DdlAlmacenDestinoLiberacion.SelectedValue = "-1" TxtObservacionesLiberacion.Text = "" DtMovimientosLiberacion.Clear() CargaGvMLiberacion() UpGeneralesLibreacion.Update() End Sub #End Region #End Region #Region " GUARDAR " Protected Sub BtnGuardarResguardo_Click(sender As Object, e As EventArgs) Handles BtnGuardarResguardo.Click If Not GvM.Rows.Count > 0 Then Alert("No hay ningun registro para generar el movimiento. Por favor rectifique y vuelva a intentar.", TipoMensaje.MsgAdvertencia) Exit Sub End If If Not DdlProveedor.SelectedValue.ToEntero > 0 And DivProveedor.Visible Then Alert("Tiene que seleccionar un proveedor.", TipoMensaje.MsgAdvertencia) Exit Sub End If 'VALIDA LA EXISTENCIA DEL ALMACEN Dim ObjInventario As New ClsInventarios Dim ErrorExistencia As Boolean = False Dim TextoExistencia As StringBuilder = New StringBuilder Dim Existencia As Double TextoExistencia.Append("Los siguiente productos se ajustaron por falta de exitencia:
") For Each dr As DataRow In DtMovimientos.Rows Existencia = ObjInventario.GetExistenciasPS(dr("CvePS").ToString.ToEntero, dr("CveUM").ToString.ToEntero, UsuarioActual.CveEmpresa, DdlAlmacen.SelectedValue.ToEntero, FechaMovto:=TxtFecha.Text.ToDate.ToString("yyyy/MM/dd 23:59"), Serie:=If(dr("Serie").ToString = "", "-1", dr("Serie").ToString)) Existencia -= DtMovimientos.SUM("Cantidad", $"CvePS = {dr("CvePS").ToString.ToEntero} AND CveUM = {dr("CveUM").ToString.ToEntero} {If(dr("Serie").ToString <> "-1", $" AND Serie = '{dr("Serie").ToString}'", "")}") If Existencia < 0 Then ErrorExistencia = True dr("Cantidad") = Existencia TextoExistencia.AppendFormat("- #{0} {1}
", dr("No").ToString, dr("PS").ToString) End If Next ObjInventario.Dispose() If ErrorExistencia Then Alert(TextoExistencia.ToString, TipoMensaje.MsgError) End If Guardar(23) End Sub Protected Sub BtnGuardarLiberacion_Click(sender As Object, e As EventArgs) If Not DdlProveedorLiberacion.SelectedValue.ToEntero > 0 And DivProveedorLiberacion2.Visible Then Alert("Tiene que seleccionar un proveedor.", TipoMensaje.MsgAdvertencia) Exit Sub End If If Not GvMLiberacion.Rows.Count > 0 Then Alert("No hay ningun registro para generar el movimiento. Por favor rectifique y vuelva a intentar.", TipoMensaje.MsgAdvertencia) Exit Sub End If Dim TieneError As Boolean = True Dim TotalCantidad As Decimal = 0 For Each Gvr As GridViewRow In GvMLiberacion.Rows If Gvr.FCTextBox("TxtCantidad").Text.ToDecimal > 0 Then TieneError = False Exit For Else TotalCantidad += Gvr.FCTextBox("TxtCantidad").Text.ToDecimal End If Next If TieneError Then Alert("Se debe seleccionar por lo menos una cantidad de los resguardos para generar la liberación. Por favor rectifique y vuelva a intentar.", TipoMensaje.MsgAdvertencia) Exit Sub End If Guardar(24) End Sub Private Sub Guardar(Concepto As Integer) Dim ObjInventario As New ClsInventarios Dim ObjEventos As New ClsOIEventos(ObjInventario.IniciaTransacSQL()) 'Inicia la transacción Dim ObjConta As New ClsContabilidad(ObjInventario.IniciaTransacSQL()) Dim TieneError As Boolean = False Dim MensajeError As String = "" Dim ImporteConcepto As Decimal = 0 Dim CveMovimientoSalida As Integer = 0 Dim FolioSalida As Integer = 0 Dim CveMovimientoEntrada As Integer = 0 Dim FolioEntrada As Integer = 0 'Para Campos Nuevos AF y OC Dim SubProyecto As Integer = -1 Dim ActivoFijo As Integer = -1 Dim CveProveedor As Integer = -1 Dim CveCliente As Integer = -1 Dim CvePersonal As Integer = -1 If RbTipoCliente.Checked Then CveCliente = DdlCliente.SelectedValue.ToEntero If RbTipoProveedor.Checked Then CveProveedor = DdlProveedor.SelectedValue.ToEntero If RbTipoPersonal.Checked Then CvePersonal = DdlPersonal.SelectedValue.ToEntero Dim Fecha As Date = If(Concepto = 23, TxtFecha.Text.ToDate, FechaLiberacion.ToDate) Select Case (Concepto) Case 23 ' Resguardo 'SALIDA ORIGEN CveMovimientoSalida = ObjInventario.AddMovimiento(DdlAlmacen.SelectedValue.ToEntero, 24, 1, Fecha, -1, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, -1, -1, SubProyecto, ActivoFijo, Observaciones:=TxtObservaciones.Text, CvePersonal:=CvePersonal, CveAlmacenDestino:=DdlAlmacenDestino.SelectedValue.ToEntero, CveCliente:=CveCliente, CveProveedor:=CveProveedor, Modulo:="ResgMat1") FolioSalida = ObjInventario.Folio If CveMovimientoSalida <= 0 Then TieneError = True MensajeError = "Ocurrió un error al guardar el movimiento de salida. Por favor vuelva a intentar." Exit Select End If Dim Cont As Integer = 0 For Each Dr As DataRow In DtMovimientos.Rows If Not ObjInventario.AddMovimientoDetalle(CveMovimientoSalida, Dr("Cantidad").ToString.ToDecimal, Dr("CveUM").ToString.ToEntero, Dr("CvePS").ToString.ToEntero, 0, -1, CveSeccionAlmacen:=Dr("CveSeccionAlmacen").ToString.ToEntero, Serie:=Dr("Serie").ToString, Lote:=Dr("Lote").ToString, FechaCaducidad:=Dr("FechaCaducidad").ToString.ToDate, Observaciones:=Dr("Observaciones").ToString) Then MensajeError = "Ocurrió un error al guardar los detalles del movimiento de salida. Por favor vuelva a intentar." TieneError = True Exit For End If Cont += 1 Next Cont = 0 If Not TieneError Then CveMovimientoEntrada = ObjInventario.AddMovimiento(DdlAlmacenDestino.SelectedValue.ToEntero, 2, 1, Fecha, -1, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, -1, -1, SubProyecto, ActivoFijo, Observaciones:=TxtObservaciones.Text, CvePersonal:=CvePersonal, CveMovimientoRelacionado:=CveMovimientoSalida, CveCliente:=CveCliente, CveProveedor:=CveProveedor, Modulo:="ResgMat2") FolioEntrada = ObjInventario.Folio Dim Importe As Decimal = 0 If CveMovimientoEntrada <= 0 Then MensajeError = "Ocurrió un error al guardar el movimiento de entrada correctamente. Por favor vuelva a intentar." TieneError = True Else If ObjInventario.GetMovimientosDetalle(CveMovimientoSalida, UsuarioActual.CveEmpresa) Then Dim CveSeccionAlmacen As Integer = 0 Importe = ObjInventario.DtResultados.SUMD("Total").RoundSQL For Each Dr As DataRow In ObjInventario.DtResultados.Rows If CBool(Dr("AplicaSeccion")) Then CveSeccionAlmacen = GlobalDTInvPSSeccionesAlmacen(UsuarioActual.CveEmpresa, DdlAlmacenDestino.SelectedValue.ToEntero, Dr("CvePS").ToString.ToEntero).FiltroPrimeroValor("CveSeccionAlmacen").ToEntero Else CveSeccionAlmacen = -1 End If If Not ObjInventario.AddMovimientoDetalle(CveMovimientoEntrada, Dr("Cantidad").ToString.ToDecimal, Dr("CveUM").ToString.ToEntero, Dr("CvePS").ToString.ToEntero, Dr("PU").ToString.ToDecimal, Dr("CveAF").ToString.ToEntero, CveSeccionAlmacen:=CveSeccionAlmacen, Lote:=Dr("Lote").ToString, FechaCaducidad:=Dr("FechaCaducidad").ToString.ToDate, Serie:=Dr("Serie").ToString, Observaciones:=Dr("Observaciones").ToString) Then TieneError = True MensajeError = "Ocurrió un error al guardar los movimientos de entrada" Exit For End If Cont += 1 Next End If End If 'registra la prepoliza ContabilizaMovimientoAlmacen(ObjConta, Fecha, "Resguardo", "ResgMat", CveMovimientoSalida, CveMovimientoEntrada, Importe, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, False) End If Case 24 'LIBERACION 'SALIDA ORIGEN - RESGUARDO CveMovimientoSalida = ObjInventario.AddMovimiento(CveAlmacenLiberación, 3, 1, Fecha, -1, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, -1, -1, SubProyecto, ActivoFijo, Observaciones:=TxtObservacionesLiberacion.Text, CvePersonal:=CvePersonalLiberacion, CveAlmacenDestino:=DdlAlmacenDestinoLiberacion.SelectedValue.ToEntero, CveProveedor:=CveProveedorLiberacion, CveCliente:=CveClienteLiberacion, MovimientoFijo:=True, Modulo:="ResgMat3") FolioSalida = ObjInventario.Folio Dim DiccionarioSecciones As New HybridDictionary Dim DiccionarioLote As New HybridDictionary Dim DiccionarioCaducidad As New HybridDictionary If CveMovimientoSalida <= 0 Then TieneError = True MensajeError = "Ocurrió un error al guardar el movimiento de salida. Por favor vuelva a intentar." Exit Select End If Dim Cont As Integer = 0 For Each Gvr As GridViewRow In GvMLiberacion.Rows If Gvr.FCTextBox("TxtCantidad").Text.ToDouble > 0 Then Dim Lote As String = "-1" Dim FechaCaducidad As Date = MinFecha If Gvr.FCTextBox("TxtLote").Text.Trim <> "" Then Lote = Gvr.FCTextBox("TxtLote").Text.Trim 'If Gvr.datakey("FechaCaducidad").todate > MinFecha Then FechaCaducidad = Gvr.datakey("FechaCaducidad").todate If Gvr.FCTextBox("TxtCaducidad").Text.ToDate > MinFecha Then FechaCaducidad = Gvr.FCTextBox("TxtCaducidad").Text.ToDate If Not ObjInventario.AddMovimientoDetalle(CveMovimientoSalida, Gvr.FCTextBox("TxtCantidad").Text.ToDecimal, Gvr.DataKey("CveUM").ToString.ToEntero, Gvr.DataKey("CvePS").ToString.ToEntero, Gvr.DataKey("PU").ToString.ToDecimal, -1, CveSeccionAlmacen:=Gvr.DataKey("CveSeccionAlmacen").ToEntero, Serie:=Gvr.DataKey("Serie").ToString, Lote:=Lote, FechaCaducidad:=FechaCaducidad, Observaciones:=Gvr.DataKey("Observaciones").ToString, CveMovimientoDetalleEntrada:=Gvr.DataKey("CveMovimientoDetalle").ToEntero) Then MensajeError = "Ocurrió un error al guardar los detalles del movimiento de salida. Por favor vuelva a intentar." TieneError = True Exit For Else DiccionarioSecciones.Add(ObjInventario.CveMovimientoDetalle, Gvr.FCDropDownList("DdlSeccionAlmacen").SelectedValue) DiccionarioLote.Add(ObjInventario.CveMovimientoDetalle, Gvr.FCTextBox("TxtLote").Text) DiccionarioCaducidad.Add(ObjInventario.CveMovimientoDetalle, Gvr.FCTextBox("TxtCaducidad").Text.todate) End If End If Cont += 1 Next If Not TieneError Then CveMovimientoEntrada = ObjInventario.AddMovimiento(DdlAlmacenDestinoLiberacion.SelectedValue.ToEntero, 23, 1, Fecha, -1, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, -1, -1, SubProyecto, ActivoFijo, Observaciones:=TxtObservacionesLiberacion.Text, CvePersonal:=CvePersonalLiberacion, CveMovimientoRelacionado:=CveMovimientoSalida, CveProveedor:=CveProveedorLiberacion, CveCliente:=CveClienteLiberacion, MovimientoFijo:=True, Modulo:="ResgMat4") FolioEntrada = ObjInventario.Folio Dim Importe As Decimal = 0 If CveMovimientoEntrada <= 0 Then MensajeError = "Ocurrió un error al guardar el movimiento de entrada correctamente. Por favor vuelva a intentar." TieneError = True Else If ObjInventario.GetMovimientosDetalle(CveMovimientoSalida, UsuarioActual.CveEmpresa) Then Cont = 0 Importe = ObjInventario.DtResultados.SUMD("Total").RoundAD For Each Dr As DataRow In ObjInventario.DtResultados.Rows Dim CveSeccionAlmacen As Integer = -1 'DiccionarioSecciones(Dr("CveMovimientoDetalle").ToString.ToEntero).ToString.ToEntero Dim Lote As String = "-1" Dim FechaCaducidad As Date = MinFecha If DiccionarioLote(Dr("CveMovimientoDetalle").ToString.ToEntero).ToString <> "" Then Lote = DiccionarioLote(Dr("CveMovimientoDetalle").ToString.ToEntero).ToString If DiccionarioCaducidad(Dr("CveMovimientoDetalle").ToString.ToEntero).ToString.todate > MinFecha Then FechaCaducidad = DiccionarioCaducidad(Dr("CveMovimientoDetalle").ToString.ToEntero).ToString.ToDate If Not ObjInventario.AddMovimientoDetalle(CveMovimientoEntrada, Dr("Cantidad").ToString.ToDecimal, Dr("CveUM").ToString.ToEntero, Dr("CvePS").ToString.ToEntero, Dr("PU").ToString.ToDecimal, Dr("CveAF").ToString.ToEntero, CveSeccionAlmacen:=CveSeccionAlmacen, Serie:=Dr("Serie").ToString, Lote:=Lote, FechaCaducidad:=FechaCaducidad, Observaciones:=Dr("Observaciones").ToString) Then TieneError = True MensajeError = "Ocurrió un error al guardar los movimientos de entrada" Exit For End If Cont += 1 Next End If ContabilizaMovimientoAlmacen(ObjConta, Fecha, "Resguardo", "ResgMat", CveMovimientoSalida, CveMovimientoEntrada, Importe, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, False) End If End If End Select If Not TieneError Then TieneError = Not AgregarAgenda(ObjEventos, FolioEntrada, FolioSalida) End If If Not TieneError Then ObjInventario.Commit() Dim Msg As New StringBuilder If Concepto = 23 Then 'FolioEntrada Msg.AppendFormat("
Resguardo con Folio: {1}", CveMovimientoSalida, FolioEntrada) Msg.AppendFormat("
Imprimir Resguardo ", Encripta(String.Format("OP=Alm&CveMovimiento={0}", CveMovimientoSalida))) Msg.AppendFormat("


El Movimiento de control se registro con el Folio: {1}", CveMovimientoEntrada, FolioSalida) Else Msg.AppendFormat("
Liberación de Resguardo con Folio: {1}", CveMovimientoEntrada, FolioEntrada) Msg.AppendFormat("
Imprimir liberación de Resguardo ", Encripta(String.Format("OP=Alm&CveMovimiento={0}", CveMovimientoEntrada))) Msg.AppendFormat("


El Movimiento de control se registro con el Folio: {1}", CveMovimientoSalida, FolioSalida) End If Alert(Msg.ToString, TipoMensaje.MsgInformacion) 'Limpia Valores cuando inserta de campos especiales If UsuarioActual.CveEmpresa = 66 Then DdlSubProyecto.SelectedValueExist("-1") End If If Concepto = 23 Then LimpiarMovimiento() Else LimpiarLiberacion() End If UPDatos.Update() Else Alert(MensajeError, TipoMensaje.MsgError) ObjInventario.RollBack() End If ObjInventario.Dispose() ObjEventos.Dispose() End Sub Public Function ContabilizaMovimientoAlmacen(ByRef ObjConta As ClsContabilidad, Fecha As Date, Concepto As String, Modulo As String, CveMovimientoSalida As Integer, CveMovimientoEntrada As Integer, Importe As Decimal, CveUsuario As Integer, CveEmpresa As Integer, Contabilizable As Boolean) As Integer Dim Retorno As Integer = -1 Dim ErrorMovInv As Boolean = False Dim CvePrePoliza As Integer = ObjConta.AddPrePolizas(Modulo, 53, 0, 0, 1, Fecha, Concepto, CveUsuario, CveEmpresa) If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, True, Importe, Importe, 68, "", Concepto, CveMovimientoAlmacen:=CveMovimientoSalida, Contabilizable:=Contabilizable) Then ErrorMovInv = True End If If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, False, Importe, Importe, 68, "", Concepto, CveMovimientoAlmacen:=CveMovimientoEntrada, Contabilizable:=Contabilizable) Then ErrorMovInv = True End If If Not ErrorMovInv Then Retorno = CvePrePoliza Return Retorno End Function Private Function AgregarAgenda(ByRef ObjEventos As ClsOIEventos, FolioEntrada As Integer, FolioSalida As Integer) As Boolean Dim TieneError As Boolean = False Dim RecurrenciaTipo As Integer = 0, Frecuencia As Integer = -1, DiasSemana As String = "-1", Dias As Integer = -1, Mes As Integer = -1, RecurrenciaFin As String = "-1", CveAgendaTipo As Integer = 4, Prioridad As Integer = 3, CveTipoEvento As Integer = 2, Importe As Integer = -1 Dim Asunto As String = $"Vencimiento de Resguardo de Material. FolioEntrada:{FolioEntrada}, FolioSalida:{FolioSalida}" Dim Descripcion As String = TxtObservaciones.Text.Trim() Dim Fecha As DateTime = TxtFechaVigencia.Text.Trim().ToDateTime() Dim FechaI As DateTime = Fecha Dim FechaF As DateTime = Fecha.AddHours(22) If Fecha > MinFecha Then TieneError = Not ObjEventos.AddEventoAgenda(CveAgendaTipo, Asunto, Descripcion, Prioridad, FechaI, FechaF, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, RecurrenciaTipo:=RecurrenciaTipo, Frecuencia:=Frecuencia, DiasSemana:=DiasSemana, Dia:=Dias, Mes:=Mes, RecurrenciaFin:=RecurrenciaFin, CveTipoEvento:=CveTipoEvento, Importe:=Importe) End If Return Not TieneError End Function #End Region #Region "TIPOS" Protected Sub RbTipo_CheckedChanged(sender As Object, e As EventArgs) DivCliente.Visible = False DivPersonal.Visible = False DivProveedor.Visible = False If RbTipoCliente.Checked Then DivCliente.Visible = True 'DdlPersonal.Attributes.Add("data-metodo", "getcliente") End If If RbTipoPersonal.Checked Then DivPersonal.Visible = True 'DdlPersonal.Attributes.Add("data-metodo", "getpersonal") End If If RbTipoProveedor.Checked Then DivProveedor.Visible = True 'DdlPersonal.Attributes.Add("data-metodo", "getproveedores") End If UpGenerales.Update() End Sub Protected Sub DdlTipo_SelectedIndexChanged(sender As Object, e As EventArgs) 'DdlPersonalLiberacion.ddl.SelectedIndex = 0 'DdlProveedorLiberacion.SelectedValue = "-1" 'DdlProveedorLiberacion.SelectedText = "Seleccione" 'DdlClienteLiberacion.SelectedValue = "0" DivPersonalLiberacion.Visible = False DivPersonalLiberacion2.Visible = False DivClienteLiberacion.Visible = False DivClienteLiberacion2.Visible = False DivProveedorLiberacion.Visible = False DivProveedorLiberacion2.Visible = False If DdlTipo.SelectedValue.ToEntero = 1 Then DivPersonalLiberacion.Visible = True DivPersonalLiberacion2.Visible = True End If If DdlTipo.SelectedValue.ToEntero = 2 Then DivClienteLiberacion.Visible = True DivClienteLiberacion2.Visible = True End If If DdlTipo.SelectedValue.ToEntero = 3 Then DivProveedorLiberacion.Visible = True DivProveedorLiberacion2.Visible = True End If UpFiltraLiberacion.Update() End Sub #End Region Private Sub ImgExcel_Click(sender As Object, e As EventArgs) Handles ImgExcel.Click Imprime("Excel") End Sub Private Sub Imprime(Formato As String) If DtMovimientosLiberacion IsNot Nothing Then Dim params As New List(Of ReportParameter) ImprimirPDF("Empresas/Grales/Formatos/ResguardoMaterial.rdlc", DtMovimientosLiberacion, params, String.Format("RepResguardoMaterial-{0}", NowADS().ToDateTime.ToShortDateString), Formato) Else Alert("No hay datos consultados", TipoMensaje.MsgAdvertencia) End If End Sub Private Sub DdlAlmacenDestinoLiberacion_SelectedIndexChanged(sender As Object, e As EventArgs) Handles DdlAlmacenDestinoLiberacion.SelectedIndexChanged Dim CveSubProyecto As Integer = GlobalDTAlmacen(UsuarioActual.CveEmpresa, CveAlmacen:=DdlAlmacenDestinoLiberacion.selectedvalue.toentero).FiltroPrimeroValor("CveSubProyecto").ToEntero CargaResguardos() End Sub End Class