diff --git a/Inventarios/EntregaAlmacen.aspx.vb b/Inventarios/EntregaAlmacen.aspx.vb index 8a609ffe0..b5ca68e64 100644 --- a/Inventarios/EntregaAlmacen.aspx.vb +++ b/Inventarios/EntregaAlmacen.aspx.vb @@ -10,8 +10,8 @@ Imports Microsoft.Reporting.WebForms Imports Stimulsoft.Base.Indicator Partial Class Inventarios_EntregaAlmacen - Inherits ClsPaginas - + Inherits ClsPaginas + #Region "PROPIEDADES" Private Property CveVentaAD As Integer Get @@ -269,19 +269,19 @@ Partial Class Inventarios_EntregaAlmacen Set(value As Integer) ViewState("FormaPaqueteria") = value End Set - End Property - - Private Property ValidaLoteCaducidad As Boolean + 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 - + End Property + #End Region - + Protected Sub Page_Load(sender As Object, e As System.EventArgs) Handles Me.Load If Not IsPostBack Then @@ -289,17 +289,17 @@ Partial Class Inventarios_EntregaAlmacen CargaParametrosAD() If UsuarioActual.CveEmpresa.Contiene(1, 72, 80, 146, 119) Then DdlAlmacen.AutoPostBack = True - If UsuarioActual.Empresa.Funcionalidad(281).ToEntero() = 1 Then - - TxtFecha.Enabled = False - ImgFecha.Visible = False - + If UsuarioActual.Empresa.Funcionalidad(281).ToEntero() = 1 Then + + TxtFecha.Enabled = False + ImgFecha.Visible = False + End If End If - End Sub - - + End Sub + + #Region " INICIALIZA VALORES " Private Sub InicializaValores() TipoEstatus = -1 @@ -321,9 +321,9 @@ Partial Class Inventarios_EntregaAlmacen DdlClientes.ddl.DataSource = GlobalDTCliente(UsuarioActual.CveEmpresa) DdlClientes.ddl.DataBind() DdlClientes.ddl.Items.Insert(0, New ListItem("Todos", "-1")) - End If - - + End If + + DdlAlmacen.DataSource = GlobalDTAlmacenUsuarios(UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, -1).FiltraParametros(StrAlmacenes) 'GlobalDTAlmacen(UsuarioActual.CveEmpresa) DdlAlmacen.Items.Insert(0, New ListItem(" Seleccione ", "-1")) DdlAlmacen.SelectedValue = "-1" @@ -348,8 +348,8 @@ Partial Class Inventarios_EntregaAlmacen If ObjInventarios.GetSucursalesAlmacenUsuario(UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa) Then DdlSubProyectos.DataSource = ObjInventarios.DtResultados End If - ObjInventarios.Dispose() - Else + ObjInventarios.Dispose() + Else DdlSubProyectos.DataSource = GlobalDTSubProyectos(-1, CveEmpresa:=UsuarioActual.CveEmpresa) End If DdlSubProyectos.DataBind() @@ -364,11 +364,11 @@ Partial Class Inventarios_EntregaAlmacen LimpiaCampos() - End Sub - + End Sub + #End Region - - + + #Region " CARGA PARAMETROS - EXCLUSIVO USO AD " Private Sub CargaParametrosAD() @@ -386,9 +386,9 @@ Partial Class Inventarios_EntregaAlmacen BtnGuardar.Visible = False End If - End Sub + End Sub #End Region - + #Region " CARGA PENDIENTES POR SURTIR " Protected Sub DdlCliente_SelectedIndexChanged(sender As Object, e As EventArgs) CargaFolios() @@ -506,11 +506,11 @@ Partial Class Inventarios_EntregaAlmacen End Select UpPendientes.Update() End If - End Sub - + End Sub + #End Region - - + + #Region " CARGA VENTA POR SURTIR " Protected Sub BtnSurtir_Click(sender As Object, e As EventArgs) @@ -562,7 +562,7 @@ Partial Class Inventarios_EntregaAlmacen If ObjInventario.DtResultados IsNot Nothing AndAlso ObjInventario.DtResultados.Rows.Count > 0 Then - DtDatos = ObjInventario.DtResultados + DtDatos = ObjInventario.DtResultados If Not DtDatos.Columns.Contains("Consec") Then DtDatos.Columns.Add("Consec", GetType(Integer)) If Not DtDatos.Columns.Contains("CantidadGV") Then DtDatos.Columns.Add("CantidadGV", GetType(Double)) If Not DtDatos.Columns.Contains("CantidadTraspaso") Then DtDatos.Columns.Add("CantidadTraspaso", GetType(Double)) @@ -578,9 +578,9 @@ Partial Class Inventarios_EntregaAlmacen DtDatosDetalleLote = Nothing CreaDtDetalleLote() - If DtDatos.Rows(0) IsNot Nothing Then - Dim drE As DataRow = DtDatos.Rows(0) - + If DtDatos.Rows(0) IsNot Nothing Then + Dim drE As DataRow = DtDatos.Rows(0) + EsDevolucionVenta = drE("EsDevolucionVenta").ToString().ToEntero() TipoDocto = DtDatos.Rows(0)("TipoDocto").ToString() TipoMovimiento = If(TipoDocto.Contiene({"Rem", "Ing", "Ped", "PeC", "Ant"}) And (EsDevolucionVenta = 0 Or CveVentaAD > 0), 1, 2) @@ -589,18 +589,18 @@ Partial Class Inventarios_EntregaAlmacen HLFolio.Text = drE("SerieFolio").ToString() If UsuarioActual.TienePermisoProceso(201) Then HLFolio.NavigateUrl = $"/Ventas/Ventas.aspx?CveVenta={CveVenta}" - End If - - 'filtra los Almacenes de domicilio - If DtDatos.Rows(0)("ServicioDomicilio").ToString() = "True" Then - StrAlmacenes = String.Format("{0} AND Almacen like '%Domicilio%' ", StrAlmacenes) - Else - StrAlmacenes = String.Format("{0} AND NOT (Almacen like '%Domicilio%') ", StrAlmacenes) - End If - - trObsGral.Visible = drE("Observaciones").ToString() <> "" + End If + + 'filtra los Almacenes de domicilio + If DtDatos.Rows(0)("ServicioDomicilio").ToString() = "True" Then + StrAlmacenes = String.Format("{0} AND Almacen like '%Domicilio%' ", StrAlmacenes) + Else + StrAlmacenes = String.Format("{0} AND NOT (Almacen like '%Domicilio%') ", StrAlmacenes) + End If + + trObsGral.Visible = drE("Observaciones").ToString() <> "" LbObservaciones.Text = DtDatos.Rows(0)("Observaciones").ToString() - trObsAlmacen.Visible = drE("ObservacionesAlmacen").ToString() <> "" + trObsAlmacen.Visible = drE("ObservacionesAlmacen").ToString() <> "" LbObservacionesAlmacen.Text = drE("ObservacionesAlmacen").ToString() CveVentaSurtir = CveVenta CveAlmacenTraspasoDestino = drE(If(EsDevolucionVenta = 1 And TipoDocto <> "Rem", "CveAlmacenTraspasoOrigen", "CveAlmacenTraspasoDestino")).ToString().ToEntero() @@ -610,23 +610,23 @@ Partial Class Inventarios_EntregaAlmacen CveCliente = drE("CveCliente").ToString().ToEntero() ClienteEntregaPersonal(CveCliente) CveSubProyecto = drE("CveSubProyecto").ToString().ToEntero() - EsInterno = CBool(DtDatos.Rows(0)("EsInterno").ToString()) - CveDireccionEnvio = drE("CveDireccionEnvio").ToString.ToEntero - - If CveDireccionEnvio > 0 Then - trDireccionEnvio.Visible = True - 'carga la dirección de envío - Dim ObjClientes As New ClsClientes - If ObjClientes.DireccionEnvioGet(CveDireccionEnvio, CveCliente, -1) Then - Dim drenvio As DataRow = ObjClientes.DtResultados.FiltroPrimero("") - LblDirEnvio.Text = drenvio("SucursalClienteVentaDireccion").ToString - End If - - ObjClientes.Dispose() - Else - trDireccionEnvio.Visible = False - End If - + EsInterno = CBool(DtDatos.Rows(0)("EsInterno").ToString()) + CveDireccionEnvio = drE("CveDireccionEnvio").ToString.ToEntero + + If CveDireccionEnvio > 0 Then + trDireccionEnvio.Visible = True + 'carga la dirección de envío + Dim ObjClientes As New ClsClientes + If ObjClientes.DireccionEnvioGet(CveDireccionEnvio, CveCliente, -1) Then + Dim drenvio As DataRow = ObjClientes.DtResultados.FiltroPrimero("") + LblDirEnvio.Text = drenvio("SucursalClienteVentaDireccion").ToString + End If + + ObjClientes.Dispose() + Else + trDireccionEnvio.Visible = False + End If + If DtDatos.SUM("CantidadS") <= 0 Then GvDatos.CssClass = "table table-striped table-hover Widthall ScrollAD gvInventario gvEscondeColumna" Else @@ -644,52 +644,52 @@ Partial Class Inventarios_EntregaAlmacen If TipoMovimiento = 2 And TipoDocto = "Rem" And Not CveAlmacenTraspasoDestino > 0 Then Alert("La remisión que se intenta devolver presenta inconsistencias. Comuniquese con servicio tecnico SIG.", TipoMensaje.MsgError) BtnGuardar.Visible = False - End If - - - If CveAlmacen <= 0 Then - DdlAlmacen.Items.Clear() - If CveAlmacenTraspasoOrigen > 0 Then 'Not (EsDevolucionVenta = 1 And DtDatos.Rows(0)("TipoDocto").ToString() = "Rem" And UsuarioActual.Empresa.Funcionalidad(145) = "1") - ESTO ES PARA CUANDO SEA REMISION DE ENTREGA POR ADELANTADO FUNCIONA LA DEVOLUCION - DdlAlmacen.Items.Clear() - DdlAlmacen.Items.Insert(0, New ListItem(GlobalDTAlmacen(UsuarioActual.CveEmpresa).FiltroPrimeroValor("Almacen", $"CveAlmacen = {CveAlmacenTraspasoOrigen}"), CveAlmacenTraspasoOrigen.ToString())) - Else - '[IPP] PARCHE - Debe hacerse permiso proceso - 17Enero2018 - Dim RestriccionAlmacenSubProyecto = If(UsuarioActual.CveEmpresa.Contiene(72, 80), $" AND CveSubProyecto = {CveSubProyecto}", "") - DdlAlmacen.DataSource = GlobalDTAlmacenUsuarios(UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, -1).FiltraParametros($"{StrAlmacenes} {RestriccionAlmacenSubProyecto}") - End If - - DdlAlmacen.Items.Insert(0, New ListItem(" Seleccione ", "-1")) - DdlAlmacen.SelectedValue = "-1" - DdlAlmacen.DataBind() - DdlAlmacen.SelectedValueExist(UsuarioActual.CveAlmacen) - If CveAlmacenTraspasoOrigen > 0 Then - DdlAlmacen.SelectedValueExist(CveAlmacenTraspasoOrigen) - End If - End If - - If UsuarioActual.CveEmpresa = 119 Then - Dim CveSubProyectoAlmacen As Integer = GlobalDTAlmacen(UsuarioActual.CveEmpresa, CveAlmacen:=CveAlmacen).FiltroPrimeroValor("CveSubProyecto", "").ToEntero - - If CveSubProyectoAlmacen.ToString.Contiene(UsuarioActual.Empresa.Funcionalidad(347)) Then - ValidaLoteCaducidad = True - Else - ValidaLoteCaducidad = False - End If - - End If - - If Not DtDatos.Columns.Contains("Serie") Then DtDatos.Columns.Add("Serie", GetType(String)) - - If Not DtDatos.Columns.Contains("Lote") Then DtDatos.Columns.Add("Lote", GetType(String)) - - If Not DtDatos.Columns.Contains("CveSeccion") Then DtDatos.Columns.Add("CveSeccion", GetType(Integer)) - - If Not DtDatos.Columns.Contains("FechaCaducidad") Then DtDatos.Columns.Add("FechaCaducidad", GetType(Date)) - - If Not DtDatos.Columns.Contains("Seleccionado") Then DtDatos.Columns.Add("Seleccionado", GetType(Boolean)) - - If Not DtDatos.Columns.Contains("CantidadSeleccionada") Then DtDatos.Columns.Add("CantidadSeleccionada", GetType(Double)) - + End If + + + If CveAlmacen <= 0 Then + DdlAlmacen.Items.Clear() + If CveAlmacenTraspasoOrigen > 0 Then 'Not (EsDevolucionVenta = 1 And DtDatos.Rows(0)("TipoDocto").ToString() = "Rem" And UsuarioActual.Empresa.Funcionalidad(145) = "1") - ESTO ES PARA CUANDO SEA REMISION DE ENTREGA POR ADELANTADO FUNCIONA LA DEVOLUCION + DdlAlmacen.Items.Clear() + DdlAlmacen.Items.Insert(0, New ListItem(GlobalDTAlmacen(UsuarioActual.CveEmpresa).FiltroPrimeroValor("Almacen", $"CveAlmacen = {CveAlmacenTraspasoOrigen}"), CveAlmacenTraspasoOrigen.ToString())) + Else + '[IPP] PARCHE - Debe hacerse permiso proceso - 17Enero2018 + Dim RestriccionAlmacenSubProyecto = If(UsuarioActual.CveEmpresa.Contiene(72, 80), $" AND CveSubProyecto = {CveSubProyecto}", "") + DdlAlmacen.DataSource = GlobalDTAlmacenUsuarios(UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, -1).FiltraParametros($"{StrAlmacenes} {RestriccionAlmacenSubProyecto}") + End If + + DdlAlmacen.Items.Insert(0, New ListItem(" Seleccione ", "-1")) + DdlAlmacen.SelectedValue = "-1" + DdlAlmacen.DataBind() + DdlAlmacen.SelectedValueExist(UsuarioActual.CveAlmacen) + If CveAlmacenTraspasoOrigen > 0 Then + DdlAlmacen.SelectedValueExist(CveAlmacenTraspasoOrigen) + End If + End If + + If UsuarioActual.CveEmpresa = 119 Then + Dim CveSubProyectoAlmacen As Integer = GlobalDTAlmacen(UsuarioActual.CveEmpresa, CveAlmacen:=CveAlmacen).FiltroPrimeroValor("CveSubProyecto", "").ToEntero + + If CveSubProyectoAlmacen.ToString.Contiene(UsuarioActual.Empresa.Funcionalidad(347)) Then + ValidaLoteCaducidad = True + Else + ValidaLoteCaducidad = False + End If + + End If + + If Not DtDatos.Columns.Contains("Serie") Then DtDatos.Columns.Add("Serie", GetType(String)) + + If Not DtDatos.Columns.Contains("Lote") Then DtDatos.Columns.Add("Lote", GetType(String)) + + If Not DtDatos.Columns.Contains("CveSeccion") Then DtDatos.Columns.Add("CveSeccion", GetType(Integer)) + + If Not DtDatos.Columns.Contains("FechaCaducidad") Then DtDatos.Columns.Add("FechaCaducidad", GetType(Date)) + + If Not DtDatos.Columns.Contains("Seleccionado") Then DtDatos.Columns.Add("Seleccionado", GetType(Boolean)) + + If Not DtDatos.Columns.Contains("CantidadSeleccionada") Then DtDatos.Columns.Add("CantidadSeleccionada", GetType(Double)) + If UsuarioActual.Empresa.Funcionalidad(280) = "1" Then FormaPaqueteria = DtDatos.Rows(0)("FormaPaqueteria").ToString().ToEntero() Dim FormaPaq As Integer = FormaPaqueteria @@ -726,7 +726,7 @@ Partial Class Inventarios_EntregaAlmacen Case "Dev" 'cuand es devolucionventa=1, es cancelación de la devolución If EsDevolucionVenta = 1 Then Filtro = "CveConcepto = 18" Else Filtro = "CveConcepto IN (3,40)" - Case "DPe" + Case "DPe" Filtro = "CveConcepto = 9" Case Else Filtro = "CveConcepto = 9" @@ -741,13 +741,13 @@ Partial Class Inventarios_EntregaAlmacen If TipoDocto.Contiene("Ing") AndAlso TipoMovimiento = 2 Then Dim DtMov As DataTable = DtExistencias.FiltraParametros("CveConcepto = 40", "", {"CveAlmacen"}) If DtMov.Rows.Count > 0 AndAlso CveAlmacen <= 0 Then - Dim CveAlmacenDev As Integer = DtMov.Rows(0)("CveAlmacen").ToString().ToEntero() - - 'DdlAlmacen.Items.Clear() - 'DdlAlmacen.DataSource = GlobalDTAlmacenUsuarios(UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, -1).FiltraParametros($"CveAlmacen = {CveAlmacenDev}") - 'DdlAlmacen.DataBind() - - DdlAlmacen.SelectedValueExist(CveAlmacenDev) ' se va a poder regresar en algun almacen diferente + Dim CveAlmacenDev As Integer = DtMov.Rows(0)("CveAlmacen").ToString().ToEntero() + + 'DdlAlmacen.Items.Clear() + 'DdlAlmacen.DataSource = GlobalDTAlmacenUsuarios(UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, -1).FiltraParametros($"CveAlmacen = {CveAlmacenDev}") + 'DdlAlmacen.DataBind() + + DdlAlmacen.SelectedValueExist(CveAlmacenDev) ' se va a poder regresar en algun almacen diferente EsDevolucionDirecta = True End If End If @@ -898,15 +898,15 @@ Partial Class Inventarios_EntregaAlmacen If AplicaSeccion Then GvDatos.Columns(7).Visible = True If AplicaLote Then GvDatos.Columns(8).Visible = True If AplicaCaducidad Then GvDatos.Columns(9).Visible = True - If Not String.IsNullOrWhiteSpace(UsuarioActual.Empresa.Funcionalidad(147)) Then GvDatos.Columns(9).HeaderText = UsuarioActual.Empresa.Funcionalidad(147) - 'GvDatos.Columns(9).HeaderText = If(UsuarioActual.Empresa.Funcionalidad(147) <> "", UsuarioActual.Empresa.Funcionalidad(147), "") - - 'SugerirFecha() - If DdlAlmacen.SelectedValue.ToEntero > 0 And CveVentaSurtir > 0 Then - CargaVentaPorSurtir(CveVentaSurtir, CveAlmacen:=DdlAlmacen.SelectedValue.ToEntero) - ' SugiereLoteCaducidad(DdlAlmacen.SelectedValue.ToEntero) - End If - End If + If Not String.IsNullOrWhiteSpace(UsuarioActual.Empresa.Funcionalidad(147)) Then GvDatos.Columns(9).HeaderText = UsuarioActual.Empresa.Funcionalidad(147) + 'GvDatos.Columns(9).HeaderText = If(UsuarioActual.Empresa.Funcionalidad(147) <> "", UsuarioActual.Empresa.Funcionalidad(147), "") + + 'SugerirFecha() + If DdlAlmacen.SelectedValue.ToEntero > 0 And CveVentaSurtir > 0 Then + CargaVentaPorSurtir(CveVentaSurtir, CveAlmacen:=DdlAlmacen.SelectedValue.ToEntero) + ' SugiereLoteCaducidad(DdlAlmacen.SelectedValue.ToEntero) + End If + End If GvDatos.DataSource = DtDatos GvDatos.DataBind() @@ -930,11 +930,11 @@ Partial Class Inventarios_EntregaAlmacen If e.Row.RowType = DataControlRowType.DataRow Then 'código temporal - Dim AplicaSerie As Boolean = CBool(e.Row.DBCampo("AplicaSerie")) - + Dim AplicaSerie As Boolean = CBool(e.Row.DBCampo("AplicaSerie")) + If AplicaSerie Then e.Row.FCButton("BtnSerie").Visible = True - e.Row.FCButton("BtnSerie").Text = "Serie" + e.Row.FCButton("BtnSerie").Text = "Serie" e.Row.FCButton("BtnSerie").CommandArgument = String.Format("{0}°{1}°{2}°{3}°{4}°{5}", e.Row.DBCampo("CvePS"), e.Row.DBCampo("CveUM"), e.Row.DBCampo("PS"), e.Row.DBCampo("CantidadF"), e.Row.DBCampo("Consec"), e.Row.DBCampo("Inv_CveMetodoInventario")) e.Row.FCTextBox("TbCantidadF").Enabled = False e.Row.FCCheckBox("cbInv").Enabled = False @@ -954,22 +954,22 @@ Partial Class Inventarios_EntregaAlmacen LbCantidad.Text = e.Row.DBCampo("CantidadF") LbCantidad2.Text = e.Row.DBCampo("CantidadF") AgregaSerie(e.Row.DBCampo("ObservacionesDetalle"), 3) - End If - - If TipoDocto = "Ing" AndAlso e.Row.DBCampo("ObservacionesDetalle").Length > 8 AndAlso DdlAlmacen.SelectedValue.ToEntero > 0 AndAlso UsuarioActual.CveRol = 1 Then - Dim Str = e.Row.DBCampo("ObservacionesDetalle").Replace(",", " ").Replace(".", " ").Replace(vbTab, " ").Replace(vbLf, " ").Split(" "c) + End If + + If TipoDocto = "Ing" AndAlso e.Row.DBCampo("ObservacionesDetalle").Length > 8 AndAlso DdlAlmacen.SelectedValue.ToEntero > 0 AndAlso UsuarioActual.CveRol = 1 Then + Dim Str = e.Row.DBCampo("ObservacionesDetalle").Replace(",", " ").Replace(".", " ").Replace(vbTab, " ").Replace(vbLf, " ").Split(" "c) CveConsecSerie = e.Row.DBCampo("Consec").ToString().ToEntero() PSSerie = e.Row.DBCampo("PS").ToString() CvePSSerie = e.Row.DBCampo("CvePS").ToEntero() CveUMSerie = e.Row.DBCampo("CveUM").ToEntero() LbCantidad.Text = e.Row.DBCampo("CantidadF") - LbCantidad2.Text = e.Row.DBCampo("CantidadF") - For Each st As String In Str - If Not st.Contiene("", "/") Then - AgregaSerie(st, 3) - End If - Next - + LbCantidad2.Text = e.Row.DBCampo("CantidadF") + For Each st As String In Str + If Not st.Contiene("", "/") Then + AgregaSerie(st, 3) + End If + Next + End If Else @@ -996,41 +996,41 @@ Partial Class Inventarios_EntregaAlmacen e.Row.FCDropDownList("DdlSeccionAlmacen").Visible = False 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 - e.Row.FCTextBox("TxtCaducidad").ReadOnly = True - CType(e.Row.FindControl("RFVCaducidad"), RequiredFieldValidator).Enabled = False - - 'si aplica caducidad y viene vacía (posible por venta anterior), que se active su registro - If e.Row.FCTextBox("TxtCaducidad").Text = "" OrElse e.Row.FCTextBox("TxtCaducidad").Text.ToDate <= MinFecha Then - e.Row.FCTextBox("TxtCaducidad").ReadOnly = False - CType(e.Row.FindControl("RFVCaducidad"), RequiredFieldValidator).Enabled = True - e.Row.FCTextBox("TxtCaducidad").Enabled = True - End If - Else - e.Row.FCTextBox("TxtCaducidad").Visible = False - e.Row.FCLinkButton("LnkCaducidad").Visible = False - e.Row.FCTextBox("TxtCaducidad").Enabled = True - End If - - If CBool(e.Row.DBCampo("AplicaLote")) Then - e.Row.FCTextBox("TxtLote").Visible = True - 'si aplica caducidad y viene vacía (posible por venta anterior), que se active su registro - If e.Row.FCTextBox("TxtLote").Text = "" Then - e.Row.FCTextBox("TxtLote").ReadOnly = False - e.Row.FCTextBox("TxtLote").Enabled = True - Else - e.Row.FCTextBox("TxtLote").ReadOnly = True - End If - - Else - e.Row.FCTextBox("TxtLote").Visible = False - End If - - 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 + e.Row.FCTextBox("TxtCaducidad").ReadOnly = True + CType(e.Row.FindControl("RFVCaducidad"), RequiredFieldValidator).Enabled = False + + 'si aplica caducidad y viene vacía (posible por venta anterior), que se active su registro + If e.Row.FCTextBox("TxtCaducidad").Text = "" OrElse e.Row.FCTextBox("TxtCaducidad").Text.ToDate <= MinFecha Then + e.Row.FCTextBox("TxtCaducidad").ReadOnly = False + CType(e.Row.FindControl("RFVCaducidad"), RequiredFieldValidator).Enabled = True + e.Row.FCTextBox("TxtCaducidad").Enabled = True + End If + Else + e.Row.FCTextBox("TxtCaducidad").Visible = False + e.Row.FCLinkButton("LnkCaducidad").Visible = False + e.Row.FCTextBox("TxtCaducidad").Enabled = True + End If + + If CBool(e.Row.DBCampo("AplicaLote")) Then + e.Row.FCTextBox("TxtLote").Visible = True + 'si aplica caducidad y viene vacía (posible por venta anterior), que se active su registro + If e.Row.FCTextBox("TxtLote").Text = "" Then + e.Row.FCTextBox("TxtLote").ReadOnly = False + e.Row.FCTextBox("TxtLote").Enabled = True + Else + e.Row.FCTextBox("TxtLote").ReadOnly = True + End If + + Else + e.Row.FCTextBox("TxtLote").Visible = False + End If + + End If + e.Row.FCButton("BtnDividir").Attributes.Add("onclick", String.Format("Dividir('{0}');", e.Row.FCTextBox("TxtDividir").ClientID)) e.Row.FCButton("BtnDividir").CommandArgument = e.Row.RowIndex.ToString() e.Row.FCTextBox("TxtDividir").Attributes.Add("onkeyup", String.Format("LimitaCantidad({0},this,'{1}');", e.Row.DBCampo("CantidadF"), e.Row.FCButton("BtnDividir").ClientID)) @@ -1063,24 +1063,24 @@ Partial Class Inventarios_EntregaAlmacen End Sub Private Sub CargaDocumentos(tCveVenta As Integer) - If tCveVenta > 0 Then - Dim objInv As New ClsEdocumentacion - - If objInv.DocumentacionElectronicaGet(-1, -1, -1, UsuarioActual.CveEmpresa, -1, tCveVenta) Then - GvDocs.DataSource = objInv.DtResultados.FiltraParametros("Adjunto <> ''") - End If - objInv.Dispose() - GvDocs.DataBind() - End If - - End Sub - - + If tCveVenta > 0 Then + Dim objInv As New ClsEdocumentacion + + If objInv.DocumentacionElectronicaGet(-1, -1, -1, UsuarioActual.CveEmpresa, -1, tCveVenta) Then + GvDocs.DataSource = objInv.DtResultados.FiltraParametros("Adjunto <> ''") + End If + objInv.Dispose() + GvDocs.DataBind() + End If + + End Sub + + #End Region - - + + #Region " AGREGAR " - + Protected Sub BtnSerie_Click(sender As Object, e As EventArgs) Dim Argumentos = CType(sender, Button).CommandArgument.Split("°"c) @@ -1095,24 +1095,24 @@ Partial Class Inventarios_EntregaAlmacen CveUMSerie = Argumentos(1).ToEntero() PSSerie = Argumentos(2).ToString() CveConsecSerie = Argumentos(4).ToEntero() - CveMetodoInventario = Argumentos(5).ToEntero() - - + CveMetodoInventario = Argumentos(5).ToEntero() + + If CveMetodoInventario = 6 Then RegistraScript("$('#DivLote').modal('show')") - CargaLote() + CargaLote() UpLoteBatch.Update() - Else - RegistraScript("$('#DivSerie').modal('show')") - CargaSerie() - UpSerie.Update() - End If - - - End Sub - + Else + RegistraScript("$('#DivSerie').modal('show')") + CargaSerie() + UpSerie.Update() + End If + + + End Sub + #Region " AGREGA POR SERIE/LOTE " - + Private Sub CreaDtDetalle() If DtDatosDetalle Is Nothing Then DtDatosDetalle = New DataTable @@ -1135,8 +1135,8 @@ Partial Class Inventarios_EntregaAlmacen Dim AplicaCaducidad = False If GlobalDTPS(UsuarioActual.CveEmpresa, ).FiltraParametros("").Rows(0) IsNot Nothing Then AplicaCaducidad = If(GlobalDTPS(UsuarioActual.CveEmpresa, CvePS:=CvePSSerie).FiltraParametros("").Rows(0)("AplicaCaducidad").ToString() = "True", True, False) - End If - + End If + GvSerie.Columns(1).HeaderText = UsuarioActual.Empresa.Funcionalidad(147) If AplicaCaducidad Then @@ -1268,7 +1268,7 @@ Partial Class Inventarios_EntregaAlmacen ObjInventarios.Dispose() Exit Sub End If - ObjInventarios.Dispose() + ObjInventarios.Dispose() Else If DtExistencias IsNot Nothing Then Dim Existencia = DtExistencias.SUM("Cantidad", $"CvePS = {CvePSSerie} AND CveUM = {CveUMSerie} AND Serie = '{Serie}'") @@ -1321,11 +1321,11 @@ Partial Class Inventarios_EntregaAlmacen DtDatosDetalle.AcceptChanges() CargaSerie() - End Sub + End Sub #End Region - + #Region " AGREGA CON LOTE BATCH " - + Private Sub CreaDtDetalleLote() If DtDatosDetalleLote Is Nothing Then DtDatosDetalleLote = New DataTable @@ -1514,9 +1514,9 @@ Partial Class Inventarios_EntregaAlmacen End Try DtDatosDetalleLote.AcceptChanges() CargaLote() - End Sub + End Sub #End Region - + #Region " AGREGA CON TXT | CODIGO - SERIE " Protected Sub BtnCodigoPS_Click(sender As Object, e As EventArgs) @@ -1650,12 +1650,12 @@ Partial Class Inventarios_EntregaAlmacen End If TxtCantidadEspecialDiv.Text = "1" - End Sub + End Sub #End Region - + #End Region - - + + #Region " GUARDAR " Protected Sub BtnGuardar_Click(sender As Object, e As EventArgs) @@ -1705,12 +1705,12 @@ Partial Class Inventarios_EntregaAlmacen Exit For End If - Next - - If (Not ValidaLoteCaducidad) OrElse (UsuarioActual.CveEmpresa <> 119) Then - ValidaSeccion = False - ValidaCaducidad = False - ValidaLote = False + Next + + If (Not ValidaLoteCaducidad) OrElse (UsuarioActual.CveEmpresa <> 119) Then + ValidaSeccion = False + ValidaCaducidad = False + ValidaLote = False End If If ValidaSeccion Then @@ -1853,9 +1853,9 @@ Partial Class Inventarios_EntregaAlmacen FechaCaducidad = If(CBool(Dr("AplicaCaducidad")) AndAlso Dr("FechaCaducidad").ToString() <> "", Dr("FechaCaducidad").ToString().ToDate, MinFecha) Lote = If(CBool(Dr("AplicaLote")), Dr("Lote").ToString().Trim, "-1") - If Not ValidaLoteCaducidad Then - FechaCaducidad = MinFecha - Lote = "-1" + If Not ValidaLoteCaducidad Then + FechaCaducidad = MinFecha + Lote = "-1" End If If Dr("CantidadGV").ToString().ToDecimal > 0 Then @@ -1921,8 +1921,8 @@ Partial Class Inventarios_EntregaAlmacen 'BUSCA SI EXISTE YA UN TRASPASO DEL ALMACEN DE APARTADO CveMovimientoSalida = DtTraspasos.FiltroPrimeroValor("CveMovimientoSalida", $"CveAlmacen = {Dr2("CveAlmacen")}").ToEntero() - If Not CveMovimientoSalida > 0 Then - + If Not CveMovimientoSalida > 0 Then + CveMovimientoSalida = ObjInventario.AddMovimiento(Dr2("CveAlmacen").ToString().ToEntero(), CveConceptoSalidaSinCosto, 1, TxtFecha.Text.ToDate, -1, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, -1, CveVentaSurtir, -1, -1, Observaciones:=TxtObservaciones.Text.Trim, Guia:=TxtGuia.Text, CveContrato:=CveContrato, Modulo:="RE/GSC1") FolioSalida = ObjInventario.Folio @@ -1959,8 +1959,8 @@ Partial Class Inventarios_EntregaAlmacen Next End If If ErrorMovInv Then Exit For - Next - + Next + Else If ObjInventario.GetExistenciasProducto(Dr("CvePS").ToString().ToEntero(), Dr("CveUM").ToString().ToEntero(), UsuarioActual.CveEmpresa, -1, FechaMovto:=TxtFecha.Text.ToDateTime.ToString("yyyy/MM/dd HH:mm"), CveTipoAlmacen:=26, CveSubProyecto:=CveSubProyecto, Caducidad:=If(CBool(Dr("AplicaCaducidad")), Dr("FechaCaducidad").ToString().ToDate, MinFecha), Lote:=If(CBool(Dr("AplicaLote")), Dr("Lote").ToString(), "-1"), CveSeccionAlmacen:=If(CBool(Dr("AplicaSeccion")), Dr("CveSeccion").ToString().ToEntero(), -1)) Then @@ -2467,18 +2467,18 @@ Partial Class Inventarios_EntregaAlmacen For Each Dr As DataRow In DtDatos.Rows CantidadPendiente = Dr("CantidadGV").ToString().ToDecimal - Dr("CantidadTraspaso").ToString().ToDecimal - CantidadEntradaSinCosto If CantidadPendiente > 0 Then - Dim PU As Decimal = 0 - Dim CveSeccionAlmacen As Integer = If(CBool(Dr("AplicaSeccion")), Dr("CveSeccion").ToString().ToEntero(), -1) - - 'SI FUE POR SERIE + Dim PU As Decimal = 0 + Dim CveSeccionAlmacen As Integer = If(CBool(Dr("AplicaSeccion")), Dr("CveSeccion").ToString().ToEntero(), -1) + + 'SI FUE POR SERIE DtDetalle = DtDatosDetalle.FiltraParametros(String.Format("ConsecId = {0} AND FueTraspaso IS NULL", Dr("Consec"))) DtDetalleLote = DtDatosDetalleLote.FiltraParametros(String.Format("ConsecId = {0} AND FueTraspaso IS NULL", Dr("Consec"))) If DtDetalle.Rows.Count > 0 Then For Each Dr1 As DataRow In DtDetalle.Rows - If TipoMovimiento = 2 AndAlso DtExistencias IsNot Nothing Then - 'CveSeccionAlmacen = DtExistencias.FiltroPrimeroValor("CveSeccionAlmacen", $"ISNULL(CveTipoAlmacenDevolucion,0) <> 26 AND CvePS = {Dr("CvePS")} AND CveUM = {Dr("CveUM").ToString().ToEntero()} AND Serie = '{Dr1("Serie").ToString()}'").ToString().ToEntero - - PU = DtExistencias.FiltroPrimeroValor("PU", $"CveTipoAlmacenDevolucion <> 26 AND CvePS = {Dr("CvePS")} AND CveUM = {Dr("CveUM").ToString().ToEntero()} AND Serie = '{Dr1("Serie").ToString()}'").ToString().ToDecimal + If TipoMovimiento = 2 AndAlso DtExistencias IsNot Nothing Then + 'CveSeccionAlmacen = DtExistencias.FiltroPrimeroValor("CveSeccionAlmacen", $"ISNULL(CveTipoAlmacenDevolucion,0) <> 26 AND CvePS = {Dr("CvePS")} AND CveUM = {Dr("CveUM").ToString().ToEntero()} AND Serie = '{Dr1("Serie").ToString()}'").ToString().ToEntero + + PU = DtExistencias.FiltroPrimeroValor("PU", $"CveTipoAlmacenDevolucion <> 26 AND CvePS = {Dr("CvePS")} AND CveUM = {Dr("CveUM").ToString().ToEntero()} AND Serie = '{Dr1("Serie").ToString()}'").ToString().ToDecimal End If If Not ObjInventario.AddMovimientoDetalle(CveMovimiento, 1, Dr("CveUM").ToString().ToEntero(), Dr("CvePS").ToString().ToEntero(), PU, Serie:=Dr1("Serie").ToString(), CveVentaDetalle:=Dr("CveVentaDetalle").ToString().ToEntero(), FechaCaducidad:=If(CBool(Dr("AplicaCaducidad")), Dr("FechaCaducidad").ToString().ToDate, MinFecha), Lote:=If(CBool(Dr("AplicaLote")), Dr("Lote").ToString(), "-1"), CveSeccionAlmacen:=-3) Then @@ -2539,17 +2539,17 @@ Partial Class Inventarios_EntregaAlmacen TextoError.AppendFormat("No se pudo generar el movimiento de entrada correctamente") ErrorMovInv = True Else - If ObjInventario.GetMovimientosDetalle(CveMovimiento, UsuarioActual.CveEmpresa) AndAlso ObjInventario.DtResultados.Rows.Count > 0 Then - ImporteAlmacen = ObjInventario.DtResultados.SUMD("Total").RoundSQL - + If ObjInventario.GetMovimientosDetalle(CveMovimiento, UsuarioActual.CveEmpresa) AndAlso ObjInventario.DtResultados.Rows.Count > 0 Then + ImporteAlmacen = ObjInventario.DtResultados.SUMD("Total").RoundSQL + For Each Dr As DataRow In ObjInventario.DtResultados.Rows If Not ObjInventario.AddMovimientoDetalle(CveMovimientoEntrada, Dr("Cantidad").ToString().ToDouble, Dr("CveUM").ToString().ToEntero(), Dr("CvePS").ToString().ToEntero(), Dr("PU").ToString().ToDecimal, CveAF:=Dr("CveAF").ToString().ToEntero(), CveSeccionAlmacen:=-3, Serie:=Dr("Serie").ToString(), Lote:=Dr("Lote").ToString(), FechaCaducidad:=Dr("FechaCaducidad").ToString().ToDate, CveVentaDetalle:=Dr("CveVentaDetalle").ToString().ToEntero(), EsInterno:=EsInterno, CveMovimientoDetalleEntrada:=Dr("CveMovimientoDetalle").ToString().ToEntero()) Then ErrorMovInv = True TextoError.AppendFormat("Ocurrió un error al guardar los movimientos de entrada") Exit For End If - Next - + Next + Else ErrorMovInv = True TextoError.AppendFormat("Ocurrió un error al guardar los movimientos de entrada") @@ -2557,8 +2557,8 @@ Partial Class Inventarios_EntregaAlmacen End If 'se registra - If ContabilizaMovimientoAlmacen(ObjConta, TxtFecha.Text.ToDate, HLFolio.Text, "EntregaAlmacen", CveMovimiento, CveMovimientoEntrada, ImporteAlmacen, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, False) <= 0 Then - ErrorMovInv = True + If ContabilizaMovimientoAlmacen(ObjConta, TxtFecha.Text.ToDate, HLFolio.Text, "EntregaAlmacen", CveMovimiento, CveMovimientoEntrada, ImporteAlmacen, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, False) <= 0 Then + ErrorMovInv = True End If Else 'REGISTRO LA PREPOLIZA DE COSTO VS ALMACEN - SALIDA ALMACEN @@ -2581,98 +2581,98 @@ Partial Class Inventarios_EntregaAlmacen Dim CveAlmacenOrigen = If(CveAlmacenTraspasoDestino > 0, CveAlmacenTraspasoDestino, DdlAlmacen.SelectedValue.ToEntero()) Dim CveSeccionAlmacen As Integer = 0 Dim ValorTraspaso As Decimal = 0 - If DtTempApartados IsNot Nothing AndAlso DtTempApartados.Rows.Count > 0 Then - For Each Dr As DataRow In DtTempApartados.Rows - - If CveMovimientoSalidaApartado = -1 Or CveAlmacenApartado <> Dr("CveAlmacen").ToString().ToEntero() Then - CveMovimientoSalidaApartado = ObjInventario.AddMovimiento(CveAlmacenOrigen, 8, 1, TxtFecha.Text.ToDate, -1, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, -1, CveVentaSurtir, -1, -1, - Observaciones:=TxtObservaciones.Text.Trim, Guia:=TxtGuia.Text, CveContrato:=CveContrato, CveVendedor:=CveVendedor, CveCliente:=CveCliente, - CveAlmacenDestino:=Dr("CveAlmacen").ToString().ToEntero(), Modulo:="RE/G9") - FolioSalida = ObjInventario.Folio - CveAlmacenApartado = Dr("CveAlmacen").ToString().ToEntero() - - Dim DrMovto = DtTraspasos.NewRow - DrMovto("Almacen") = Dr("Almacen").ToString().ToEntero() - DrMovto("CveAlmacen") = Dr("CveAlmacen").ToString().ToEntero() - DrMovto("CveMovimientoSalida") = CveMovimientoSalidaApartado - DrMovto("FolioSalida") = FolioSalida - DtTraspasos.Rows.Add(DrMovto) - End If - - If Not CveMovimientoSalidaApartado > 0 Then - ErrorMovInv = True - TextoError.AppendFormat("Ocurrió un error al guardar los movimientos de control de apartados") - Exit For - End If - 'If CBool(Dr("AplicaSeccion")) Then - ' CveSeccionAlmacen = GlobalDTInvPSSeccionesAlmacen(UsuarioActual.CveEmpresa, CveAlmacenOrigen, Dr("CvePS").ToString().ToEntero()).FiltroPrimeroValor("CveSeccionAlmacen").ToEntero() - ' Dim a As String = String.Format("CveAlmacen={0}-CvePS:{1}-CveseccionAlmacen={2}", CveAlmacenOrigen, Dr("CvePS"), CveSeccionAlmacen) - 'Else - ' CveSeccionAlmacen = -1 - 'End If - CveSeccionAlmacen = -3 - - If Not ObjInventario.AddMovimientoDetalle(CveMovimientoSalidaApartado, Dr("Cantidad").ToString().ToDecimal, Dr("CveUM").ToString().ToEntero(), Dr("CvePS").ToString().ToEntero(), Dr("PU").ToString().ToDecimal, CveAF:=Dr("CveAF").ToString().ToEntero(), Serie:=Dr("Serie").ToString(), CveVentaDetalle:=Dr("CveVentaDetalle").ToString().ToEntero(), Lote:=Dr("Lote").ToString(), CveSeccionAlmacen:=CveSeccionAlmacen) Then - ErrorMovInv = True - TextoError.AppendFormat("Ocurrió un error al guardar los movimientos de control de apartados") - Exit For - End If - Next - - If Not ErrorMovInv Then - - Dim CvePrePolizaTraspaso As Integer = ObjConta.AddPrePolizas("EA/Apart", 53, 0, 0, 1, TxtFecha.Text.ToDate, "Traspaso Apartado", UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa) - If CvePrePolizaTraspaso > 0 Then - - If Not ObjConta.AddPrePolizasDetalle(CvePrePolizaTraspaso, True, ValorTraspaso, TxtObservaciones.Text, 68, TxtObservaciones.Text, TxtFecha.Text.ToDate, -1, -1, CveMovimientoAlmacen:=CveMovimientoSalidaApartado, Contabilizable:=False, ImporteMX:=ValorTraspaso) Then - ErrorMovInv = True - End If - - For Each Dr1 As DataRow In DtTraspasos.Rows - CveMovimientoSalida = Dr1("CveMovimientoSalida").ToString().ToEntero() - - CveMovimientoEntradaApartado = ObjInventario.AddMovimiento(Dr1("CveAlmacen").ToString().ToEntero(), 9, 1, TxtFecha.Text.ToDate, -1, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, - -1, CveVentaSurtir, -1, -1, Observaciones:=TxtObservaciones.Text.Trim, CveAlmacenDestino:=DdlAlmacen.SelectedValue.ToEntero(), - CveMovimientoRelacionado:=CveMovimientoSalida, Guia:=TxtGuia.Text, CveContrato:=CveContrato, CveVendedor:=CveVendedor, - CveCliente:=CveCliente, Modulo:="RE/G10") - FolioEntrada = ObjInventario.Folio - - If Not CveMovimientoEntradaApartado > 0 Then - ErrorMovInv = True - TextoError.AppendFormat("Ocurrió un error al procesar los movimientos de traspaso de apartado. Por favor vuelva a intentar.") - Exit For - End If - - Dr1("CveMovimientoEntrada") = CveMovimientoEntradaApartado - Dr1("FolioEntrada") = FolioEntrada - - If ObjInventario.GetMovimientosDetalle(CveMovimientoSalida, UsuarioActual.CveEmpresa) Then - ValorTraspaso = ObjInventario.DtResultados.SUMD("Total").RoundSQL - For Each Dr As DataRow In ObjInventario.DtResultados.Rows - - CveSeccionAlmacen = -3 - - If Not ObjInventario.AddMovimientoDetalle(CveMovimientoEntradaApartado, Dr("Cantidad").ToString().ToDecimal, Dr("CveUM").ToString().ToEntero(), Dr("CvePS").ToString().ToEntero(), Dr("PU").ToString().ToDecimal, CveAF:=Dr("CveAF").ToString().ToEntero(), Serie:=Dr("Serie").ToString(), CveMovimientoDetalleEntrada:=Dr("CveMovimientoDetalle").ToString().ToEntero(), Lote:=Dr("Lote").ToString(), CveSeccionAlmacen:=CveSeccionAlmacen) Then - ErrorMovInv = True - TextoError.AppendFormat("Ocurrió un error al procesar los conceptos de traspaso de apartado. Por favor vuelva a intentar.") - Exit For - End If - Next - End If - - If ErrorMovInv Then Exit For - - If Not ErrorMovInv AndAlso Not ObjConta.AddPrePolizasDetalle(CvePrePolizaTraspaso, False, ValorTraspaso, TxtObservaciones.Text, 68, TxtObservaciones.Text, TxtFecha.Text.ToDate, -1, -1, CveMovimientoAlmacen:=CveMovimientoEntradaApartado, Contabilizable:=False, ImporteMX:=ValorTraspaso) Then - ErrorMovInv = True - End If - Next - - - Else - ErrorMovInv = True - End If - End If - End If + If DtTempApartados IsNot Nothing AndAlso DtTempApartados.Rows.Count > 0 Then + For Each Dr As DataRow In DtTempApartados.Rows + + If CveMovimientoSalidaApartado = -1 Or CveAlmacenApartado <> Dr("CveAlmacen").ToString().ToEntero() Then + CveMovimientoSalidaApartado = ObjInventario.AddMovimiento(CveAlmacenOrigen, 8, 1, TxtFecha.Text.ToDate, -1, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, -1, CveVentaSurtir, -1, -1, + Observaciones:=TxtObservaciones.Text.Trim, Guia:=TxtGuia.Text, CveContrato:=CveContrato, CveVendedor:=CveVendedor, CveCliente:=CveCliente, + CveAlmacenDestino:=Dr("CveAlmacen").ToString().ToEntero(), Modulo:="RE/G9") + FolioSalida = ObjInventario.Folio + CveAlmacenApartado = Dr("CveAlmacen").ToString().ToEntero() + + Dim DrMovto = DtTraspasos.NewRow + DrMovto("Almacen") = Dr("Almacen").ToString().ToEntero() + DrMovto("CveAlmacen") = Dr("CveAlmacen").ToString().ToEntero() + DrMovto("CveMovimientoSalida") = CveMovimientoSalidaApartado + DrMovto("FolioSalida") = FolioSalida + DtTraspasos.Rows.Add(DrMovto) + End If + + If Not CveMovimientoSalidaApartado > 0 Then + ErrorMovInv = True + TextoError.AppendFormat("Ocurrió un error al guardar los movimientos de control de apartados") + Exit For + End If + 'If CBool(Dr("AplicaSeccion")) Then + ' CveSeccionAlmacen = GlobalDTInvPSSeccionesAlmacen(UsuarioActual.CveEmpresa, CveAlmacenOrigen, Dr("CvePS").ToString().ToEntero()).FiltroPrimeroValor("CveSeccionAlmacen").ToEntero() + ' Dim a As String = String.Format("CveAlmacen={0}-CvePS:{1}-CveseccionAlmacen={2}", CveAlmacenOrigen, Dr("CvePS"), CveSeccionAlmacen) + 'Else + ' CveSeccionAlmacen = -1 + 'End If + CveSeccionAlmacen = -3 + + If Not ObjInventario.AddMovimientoDetalle(CveMovimientoSalidaApartado, Dr("Cantidad").ToString().ToDecimal, Dr("CveUM").ToString().ToEntero(), Dr("CvePS").ToString().ToEntero(), Dr("PU").ToString().ToDecimal, CveAF:=Dr("CveAF").ToString().ToEntero(), Serie:=Dr("Serie").ToString(), CveVentaDetalle:=Dr("CveVentaDetalle").ToString().ToEntero(), Lote:=Dr("Lote").ToString(), CveSeccionAlmacen:=CveSeccionAlmacen) Then + ErrorMovInv = True + TextoError.AppendFormat("Ocurrió un error al guardar los movimientos de control de apartados") + Exit For + End If + Next + + If Not ErrorMovInv Then + + Dim CvePrePolizaTraspaso As Integer = ObjConta.AddPrePolizas("EA/Apart", 53, 0, 0, 1, TxtFecha.Text.ToDate, "Traspaso Apartado", UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa) + If CvePrePolizaTraspaso > 0 Then + + If Not ObjConta.AddPrePolizasDetalle(CvePrePolizaTraspaso, True, ValorTraspaso, TxtObservaciones.Text, 68, TxtObservaciones.Text, TxtFecha.Text.ToDate, -1, -1, CveMovimientoAlmacen:=CveMovimientoSalidaApartado, Contabilizable:=False, ImporteMX:=ValorTraspaso) Then + ErrorMovInv = True + End If + + For Each Dr1 As DataRow In DtTraspasos.Rows + CveMovimientoSalida = Dr1("CveMovimientoSalida").ToString().ToEntero() + + CveMovimientoEntradaApartado = ObjInventario.AddMovimiento(Dr1("CveAlmacen").ToString().ToEntero(), 9, 1, TxtFecha.Text.ToDate, -1, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, + -1, CveVentaSurtir, -1, -1, Observaciones:=TxtObservaciones.Text.Trim, CveAlmacenDestino:=DdlAlmacen.SelectedValue.ToEntero(), + CveMovimientoRelacionado:=CveMovimientoSalida, Guia:=TxtGuia.Text, CveContrato:=CveContrato, CveVendedor:=CveVendedor, + CveCliente:=CveCliente, Modulo:="RE/G10") + FolioEntrada = ObjInventario.Folio + + If Not CveMovimientoEntradaApartado > 0 Then + ErrorMovInv = True + TextoError.AppendFormat("Ocurrió un error al procesar los movimientos de traspaso de apartado. Por favor vuelva a intentar.") + Exit For + End If + + Dr1("CveMovimientoEntrada") = CveMovimientoEntradaApartado + Dr1("FolioEntrada") = FolioEntrada + + If ObjInventario.GetMovimientosDetalle(CveMovimientoSalida, UsuarioActual.CveEmpresa) Then + ValorTraspaso = ObjInventario.DtResultados.SUMD("Total").RoundSQL + For Each Dr As DataRow In ObjInventario.DtResultados.Rows + + CveSeccionAlmacen = -3 + + If Not ObjInventario.AddMovimientoDetalle(CveMovimientoEntradaApartado, Dr("Cantidad").ToString().ToDecimal, Dr("CveUM").ToString().ToEntero(), Dr("CvePS").ToString().ToEntero(), Dr("PU").ToString().ToDecimal, CveAF:=Dr("CveAF").ToString().ToEntero(), Serie:=Dr("Serie").ToString(), CveMovimientoDetalleEntrada:=Dr("CveMovimientoDetalle").ToString().ToEntero(), Lote:=Dr("Lote").ToString(), CveSeccionAlmacen:=CveSeccionAlmacen) Then + ErrorMovInv = True + TextoError.AppendFormat("Ocurrió un error al procesar los conceptos de traspaso de apartado. Por favor vuelva a intentar.") + Exit For + End If + Next + End If + + If ErrorMovInv Then Exit For + + If Not ErrorMovInv AndAlso Not ObjConta.AddPrePolizasDetalle(CvePrePolizaTraspaso, False, ValorTraspaso, TxtObservaciones.Text, 68, TxtObservaciones.Text, TxtFecha.Text.ToDate, -1, -1, CveMovimientoAlmacen:=CveMovimientoEntradaApartado, Contabilizable:=False, ImporteMX:=ValorTraspaso) Then + ErrorMovInv = True + End If + Next + + + Else + ErrorMovInv = True + End If + End If + End If End If End If End If @@ -2723,9 +2723,9 @@ Partial Class Inventarios_EntregaAlmacen ' COMIENZA: VIRTUAL If Not ErrorMovInv AndAlso TipoDocto.Contiene("Ing", "Dev") AndAlso UsuarioActual.Empresa.Funcionalidad(573) = "1" AndAlso CveMovimiento > 0 Then - Dim DtPSVirtual As New DataTable("DtTamanios") - Dim tCveAlmacen As Integer = -1 - + Dim DtPSVirtual As New DataTable("DtTamanios") + Dim tCveAlmacen As Integer = -1 + If ObjInventario.GetMovimientos(CveMovimiento, -1, -1, UsuarioActual.CveEmpresa) AndAlso ObjInventario.DtResultados.Rows.Count > 0 Then tCveAlmacen = ObjInventario.DtResultados.FiltroPrimeroValor("CveAlmacen").ToEntero() End If @@ -2760,13 +2760,13 @@ Partial Class Inventarios_EntregaAlmacen End If 'SI NO TIENE ALMACEN VIRTUAL ASIGNADO NO GENERA EL MOVIMIENTO VIRTUAL - If CveAlmacenVirtual <= 0 Then - ValidaVirtual = False + If CveAlmacenVirtual <= 0 Then + ValidaVirtual = False End If 'SI NO APLICA VIRTUAL EN LOS PRODUCTOS NO VALIDA - If CveAlmacenVirtual > 0 AndAlso DtPSVirtual IsNot Nothing AndAlso DtPSVirtual.Rows.Count = 0 Then - ValidaVirtual = False + If CveAlmacenVirtual > 0 AndAlso DtPSVirtual IsNot Nothing AndAlso DtPSVirtual.Rows.Count = 0 Then + ValidaVirtual = False End If If DtPSVirtual IsNot Nothing AndAlso DtPSVirtual.Rows.Count > 0 AndAlso CveAlmacenVirtual > 0 AndAlso CveConceptoMovimientoVirtual > 0 Then @@ -2787,13 +2787,13 @@ Partial Class Inventarios_EntregaAlmacen Exit For End If TotalVirtual += (CantidadUsado * PU) - Next - 'insertar en prepóliza de la salida virtual - If Not ErrorMovInv Then - ErrorMovInv = Not GenerarPrePoliza(ObjInventario, ObjVentas, ObjConta, CveMovimientoVirtual, TextoError) - - End If - + Next + 'insertar en prepóliza de la salida virtual + If Not ErrorMovInv Then + ErrorMovInv = Not GenerarPrePoliza(ObjInventario, ObjVentas, ObjConta, CveMovimientoVirtual, TextoError) + + End If + Else ErrorMovInv = True End If @@ -2914,10 +2914,10 @@ Partial Class Inventarios_EntregaAlmacen If RbEntregaInterna.Checked Then Msg.AppendFormat("

Se agregó una guía de paquetería interna") - End If - + End If + If UsuarioActual.Empresa.Funcionalidad(531) = "1" AndAlso TipoDocto = "Rem" Then - Msg.AppendFormat("

Recibir Usado: Ir a Recepción de Usados", CveVentaSurtir) + Msg.AppendFormat("

Recibir Usado: Ir a Recepción de Usados", CveVentaSurtir) End If Alert(Msg.ToString(), TipoMensaje.MsgInformacion) @@ -2948,7 +2948,7 @@ Partial Class Inventarios_EntregaAlmacen Dim tmpCostos As DataTable = DtCostos.FiltraParametros("", "", {"CveClasificacion"}) Dim IdCtaContableAlmacen As Integer = GlobalDTAlmacen(UsuarioActual.CveEmpresa).FiltroPrimeroValor("IdCtaContable", $"CveAlmacen = {DdlAlmacen.SelectedValue}").ToEntero() - 'Dim CveCuentaAlmacen As Integer = 0 'GlobalDTAlmacen(UsuarioActual.CveEmpresa).FiltroPrimeroValor("IdCtaContableSIG", $"CveAlmacen = {DdlAlmacen.SelectedValue}").ToEntero() + 'Dim CveCuentaAlmacen As Integer = 0 'GlobalDTAlmacen(UsuarioActual.CveEmpresa).FiltroPrimeroValor("IdCtaContableSIG", $"CveAlmacen = {DdlAlmacen.SelectedValue}").ToEntero() Dim IdCtaContable As Integer = 0 If tmpCostos.Rows.Count > 0 Then @@ -2965,11 +2965,11 @@ Partial Class Inventarios_EntregaAlmacen Dim ValorMultiplicador As Decimal = 1 If TipoMovimiento = 1 Then - ValorMultiplicador = 1 + ValorMultiplicador = 1 ElseIf TipoMovimiento = 2 AndAlso TipoDocto.Contiene({"Dev"}) AndAlso (EsDevolucionVenta = 1) Then ValorMultiplicador = 1 ElseIf TipoMovimiento = 2 Then - ValorMultiplicador = -1 + ValorMultiplicador = -1 End If Dim CvePrePoliza As Integer = ObjConta.AddPrePolizas("Inventario/EntregaAlmacen", 4, TotalCosto, TotalCosto, 1, Fecha, ClienteNombre, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa) @@ -3103,7 +3103,7 @@ Partial Class Inventarios_EntregaAlmacen End If Dim ObjInventario As New ClsInventarios : ObjInventario.IniciaTransacSQL() - Dim ObjGeneral As New ClsGenerales(ObjInventario.IniciaTransacSQL()) + Dim ObjGeneral As New ClsGenerales(ObjInventario.IniciaTransacSQL()) Dim ObjConta As New ClsContabilidad(ObjInventario.IniciaTransacSQL()) Dim CveMovimientoSalida As Integer Dim ConceptoMovimiento = 0 @@ -3111,7 +3111,7 @@ Partial Class Inventarios_EntregaAlmacen Dim CveMovimientoEntrada As Integer Dim FolioEntrada As Integer Dim ErrorMovInv As Boolean - Dim DtDetalle As New DataTable + Dim DtDetalle As New DataTable Dim TextoError = "" 'PASA DATOS DEL GV A DATATABLE PARA MANEJOR CON FOR EACH @@ -3229,15 +3229,15 @@ Partial Class Inventarios_EntregaAlmacen TextoError = "Ocurrió un error al procesar los conceptos con serie. Por favor vuelva a intentar." Exit For End If - Next - 'ElseIf DtDetalleLote.Rows.Count > 0 Then 'SI FUE POR LOTE BATCH - ' For Each Dr1 As DataRow In DtDetalleLote.Rows - ' If Not ObjInventario.AddMovimientoDetalle(CveMovimientoSalida, Dr1("Cantidad").ToString().ToDecimal, Dr("CveUM").ToString().ToEntero(), Dr("CvePS").ToString().ToEntero(), 0, Serie:="", Lote:=Dr1("Lote").ToString(), FechaCaducidad:=FechaCaducidad, CveSeccionAlmacen:=CveSeccionAlmacen, CveVentaDetalle:=-1, CveContratoDetalle:=Dr("CveContratoDetalle").ToString().ToEntero()) Then - ' ErrorMovInv = True - ' TextoError = "Ocurrió un error al procesar los conceptos con serie. Por favor vuelva a intentar." - ' Exit For - ' End If - ' Next + Next + 'ElseIf DtDetalleLote.Rows.Count > 0 Then 'SI FUE POR LOTE BATCH + ' For Each Dr1 As DataRow In DtDetalleLote.Rows + ' If Not ObjInventario.AddMovimientoDetalle(CveMovimientoSalida, Dr1("Cantidad").ToString().ToDecimal, Dr("CveUM").ToString().ToEntero(), Dr("CvePS").ToString().ToEntero(), 0, Serie:="", Lote:=Dr1("Lote").ToString(), FechaCaducidad:=FechaCaducidad, CveSeccionAlmacen:=CveSeccionAlmacen, CveVentaDetalle:=-1, CveContratoDetalle:=Dr("CveContratoDetalle").ToString().ToEntero()) Then + ' ErrorMovInv = True + ' TextoError = "Ocurrió un error al procesar los conceptos con serie. Por favor vuelva a intentar." + ' Exit For + ' End If + ' Next Else 'NORMAL If Not ObjInventario.AddMovimientoDetalle(CveMovimientoSalida, Dr("CantidadGV").ToString().ToDecimal, Dr("CveUM").ToString().ToEntero(), Dr("CvePS").ToString().ToEntero(), 0, -1, Lote:=Lote, FechaCaducidad:=FechaCaducidad, CveSeccionAlmacen:=CveSeccionAlmacen, CveContratoDetalle:=Dr("CveContratoDetalle").ToString().ToEntero()) Then ErrorMovInv = True @@ -3250,39 +3250,39 @@ Partial Class Inventarios_EntregaAlmacen TextoError = "Ocurrió un error al generar el movimiento de salida." ErrorMovInv = True End If - End If - + End If + Dim ValorTraspaso As Decimal = 0 'ENTRADA POR TRASPASO - If Not ErrorMovInv Then - 'sino es transitorio, los transitorios, ya no se hace otro movimiento - - ConceptoMovimiento = If(ChkTransitorio.Checked, 2, 27) - Almacen2 = If(ChkTransitorio.Checked, DdlAlmacenTransitorio.SelectedValue.ToEntero(), CveAlmacenTraspasoDestino) + If Not ErrorMovInv Then + 'sino es transitorio, los transitorios, ya no se hace otro movimiento + + ConceptoMovimiento = If(ChkTransitorio.Checked, 2, 27) + Almacen2 = If(ChkTransitorio.Checked, DdlAlmacenTransitorio.SelectedValue.ToEntero(), CveAlmacenTraspasoDestino) CveMovimientoEntrada = ObjInventario.AddMovimiento(Almacen2, ConceptoMovimiento, 1, TxtFecha.Text.ToDate, -1, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, -1, -1, -1, -1, Observaciones:=TxtObservaciones.Text.Trim, Guia:="", CveContrato:=CveContrato, CveMovimientoRelacionado:=CveMovimientoSalida, CveAlmacenDestino:=CveAlmacenTraspasoDestino, - Recibio:=If(ChkTransitorio.Checked, TxtResponsable.Text.Trim, ""), Modulo:="RE/GT1", CveOP:=CveOP) - FolioEntrada = ObjInventario.Folio - If CveMovimientoEntrada > 0 Then - If ObjInventario.GetMovimientosDetalle(CveMovimientoSalida, UsuarioActual.CveEmpresa) Then - Dim CveSeccionAlmacen As Integer = -1 - ValorTraspaso = ObjInventario.DtResultados.SUMD("Total").RoundSQL - For Each Dr As DataRow In ObjInventario.DtResultados.Rows - - CveSeccionAlmacen = -3 - - If Not ObjInventario.AddMovimientoDetalle(CveMovimientoEntrada, Dr("Cantidad").ToString().ToDecimal, Dr("CveUM").ToString().ToEntero(), Dr("CvePS").ToString().ToEntero(), Dr("PU").ToString().ToDecimal, CveAF:=Dr("CveAF").ToString().ToEntero(), CveSeccionAlmacen:=CveSeccionAlmacen, Serie:=Dr("Serie").ToString(), Lote:=Dr("Lote").ToString(), FechaCaducidad:=Dr("FechaCaducidad").ToString().ToDate, CveMovimientoDetalleEntrada:=Dr("CveMovimientoDetalle").ToString().ToEntero(), CveVentaDetalle:=Dr("CveVentaDetalle").ToString().ToEntero()) Then - ErrorMovInv = True - TextoError = "Ocurrió un error al guardar los movimientos de entrada" - Exit For - End If - Next - End If - Else - TextoError = "Ocurrió un error al generar el movimiento de entrada" - ErrorMovInv = True - End If - + Recibio:=If(ChkTransitorio.Checked, TxtResponsable.Text.Trim, ""), Modulo:="RE/GT1", CveOP:=CveOP) + FolioEntrada = ObjInventario.Folio + If CveMovimientoEntrada > 0 Then + If ObjInventario.GetMovimientosDetalle(CveMovimientoSalida, UsuarioActual.CveEmpresa) Then + Dim CveSeccionAlmacen As Integer = -1 + ValorTraspaso = ObjInventario.DtResultados.SUMD("Total").RoundSQL + For Each Dr As DataRow In ObjInventario.DtResultados.Rows + + CveSeccionAlmacen = -3 + + If Not ObjInventario.AddMovimientoDetalle(CveMovimientoEntrada, Dr("Cantidad").ToString().ToDecimal, Dr("CveUM").ToString().ToEntero(), Dr("CvePS").ToString().ToEntero(), Dr("PU").ToString().ToDecimal, CveAF:=Dr("CveAF").ToString().ToEntero(), CveSeccionAlmacen:=CveSeccionAlmacen, Serie:=Dr("Serie").ToString(), Lote:=Dr("Lote").ToString(), FechaCaducidad:=Dr("FechaCaducidad").ToString().ToDate, CveMovimientoDetalleEntrada:=Dr("CveMovimientoDetalle").ToString().ToEntero(), CveVentaDetalle:=Dr("CveVentaDetalle").ToString().ToEntero()) Then + ErrorMovInv = True + TextoError = "Ocurrió un error al guardar los movimientos de entrada" + Exit For + End If + Next + End If + Else + TextoError = "Ocurrió un error al generar el movimiento de entrada" + ErrorMovInv = True + End If + End If 'MARCA SOLICITUD CON EL MOVIMIENTO GENERADO @@ -3291,12 +3291,12 @@ Partial Class Inventarios_EntregaAlmacen TextoError = "Ocurrió un error al vincular los movimientos con la solicitud de traspaso. Por favor verifique y vuelva a intentar" ErrorMovInv = True End If - End If - + End If + Dim Fecha As Date = TxtFecha.Text.ToDate 'Paqueterias Guias If RbEntregaInterna.Checked AndAlso Not ErrorMovInv Then - Dim CveEstatus As Integer = 0 ' DdlEstatus.SelectedValue.ToEntero() + Dim CveEstatus As Integer = 0 ' DdlEstatus.SelectedValue.ToEntero() Dim FechaEstimada As String = "-1" 'If(TxtFechaEstimada.Text = "", "-1", TxtFechaEstimada.Text) Dim NoCajas As Integer = 0 'TxtNoCajas.Text.ToEntero() Dim Observaciones As String = "" 'TxtObservacionesPaqInterna.Text @@ -3316,23 +3316,23 @@ Partial Class Inventarios_EntregaAlmacen ErrorMovInv = True Alert("Error en el paqueteria guia", TipoMensaje.MsgError) End If - End If - - 'AGREGAMOS PREPOLIZAS TRASPASO DIRECTO: - - Dim CvePrePolizaTraspaso As Integer = ObjConta.AddPrePolizas("EA/GT", 53, 0, 0, 1, Fecha, "Traspaso", UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa) - If CvePrePolizaTraspaso > 0 Then - - - If Not ObjConta.AddPrePolizasDetalle(CvePrePolizaTraspaso, True, ValorTraspaso, TxtObservaciones.Text, 68, TxtObservaciones.Text, Fecha, -1, -1, CveMovimientoAlmacen:=CveMovimientoSalida, Contabilizable:=False, ImporteMX:=ValorTraspaso) Then - ErrorMovInv = True - End If - - If Not ErrorMovInv AndAlso Not ObjConta.AddPrePolizasDetalle(CvePrePolizaTraspaso, False, ValorTraspaso, TxtObservaciones.Text, 68, TxtObservaciones.Text, Fecha, -1, -1, CveMovimientoAlmacen:=CveMovimientoEntrada, Contabilizable:=False, ImporteMX:=ValorTraspaso) Then - ErrorMovInv = True - End If - Else - ErrorMovInv = True + End If + + 'AGREGAMOS PREPOLIZAS TRASPASO DIRECTO: + + Dim CvePrePolizaTraspaso As Integer = ObjConta.AddPrePolizas("EA/GT", 53, 0, 0, 1, Fecha, "Traspaso", UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa) + If CvePrePolizaTraspaso > 0 Then + + + If Not ObjConta.AddPrePolizasDetalle(CvePrePolizaTraspaso, True, ValorTraspaso, TxtObservaciones.Text, 68, TxtObservaciones.Text, Fecha, -1, -1, CveMovimientoAlmacen:=CveMovimientoSalida, Contabilizable:=False, ImporteMX:=ValorTraspaso) Then + ErrorMovInv = True + End If + + If Not ErrorMovInv AndAlso Not ObjConta.AddPrePolizasDetalle(CvePrePolizaTraspaso, False, ValorTraspaso, TxtObservaciones.Text, 68, TxtObservaciones.Text, Fecha, -1, -1, CveMovimientoAlmacen:=CveMovimientoEntrada, Contabilizable:=False, ImporteMX:=ValorTraspaso) Then + ErrorMovInv = True + End If + Else + ErrorMovInv = True End If @@ -3511,160 +3511,160 @@ Partial Class Inventarios_EntregaAlmacen CargaGvDatos() UpDatos.Update() - End Sub - + End Sub + #End Region - + #Region " TRASPASO - TRANSITORIO " Protected Sub ChkTransitorio_CheckedChanged(sender As Object, e As EventArgs) TxtResponsable.Text = "" DivTransitorio2.Visible = ChkTransitorio.Checked - End Sub + End Sub #End Region - + #Region "SECCION ALMACEN" - 'Private Sub CreaDtSeccionAlmacen() - ' DtSeccionAlmacen = New DataTable - ' DtSeccionAlmacen.Columns.Add("CantidadSeccionAlmacen", GetType(Decimal)) - ' DtSeccionAlmacen.Columns.Add("IndexSeccionAlmacen", GetType(Integer)) - ' DtSeccionAlmacen.Columns.Add("CveSeccionAlmacen", GetType(Integer)) - ' DtSeccionAlmacen.Columns.Add("CvePS", GetType(Integer)) - ' DtSeccionAlmacen.Columns.Add("SeccionAlmacen", GetType(String)) - ' DtSeccionAlmacen.Columns.Add("Consec", GetType(Integer)) - 'End Sub - 'Private Sub CargaDdlAlmacen() - ' DdlSeccionAlmacen.DataSource = GlobalDTSeccionAlmacen(UsuarioActual.CveEmpresa, -1) - ' DdlSeccionAlmacen.Items.Insert(0, New ListItem("Seleccione", "-1")) - ' DdlSeccionAlmacen.DataBind() - 'End Sub - 'Protected Sub LnkSeccionAlmacen_Click(sender As Object, e As EventArgs) - ' Dim gvRow As GridViewRow = DirectCast((DirectCast(sender, LinkButton)).NamingContainer, GridViewRow) - - ' If Not DdlAlmacen.SelectedValue.ToEntero() > 0 Then - ' Alert("Tiene que tener seleccionado un almacen para registrar seccion almacen.", TipoMensaje.MsgAdvertencia) - ' Exit Sub - ' End If - - ' CantidadTotal = gvRow.FCTextBox("TbCantidadF").Text.ToDecimal - ' IndexSeccionAlmacen = gvRow.RowIndex - ' CvePS = gvRow.DataKey("CvePS").ToEntero() - ' CargaSeccionAlmacen() - ' RegistraScript("$('#DModalSeccionAlmacen').modal()") - 'End Sub - - 'Private Sub CargaSeccionAlmacen() - ' Dim CantidadTotalSeccion As Decimal = DtSeccionAlmacen.FiltraParametros($"IndexSeccionAlmacen = {IndexSeccionAlmacen}").SUMD("CantidadSeccionAlmacen") - ' GvSeccion.DataSource = DtSeccionAlmacen.FiltraParametros($"IndexSeccionAlmacen = {IndexSeccionAlmacen}") - ' GvSeccion.DataBind() - - ' TxtCantidadSeccion.Text = "" - ' DdlSeccionAlmacen.SelectedIndex = 0 - ' Dim CantidadRestante As Decimal = CantidadTotal - CantidadTotalSeccion - ' If CantidadRestante = 0 Then - ' RVTxtCantidad.MaximumValue = "1" - ' TxtCantidadSeccion.Enabled = False - ' Else - ' RVTxtCantidad.MaximumValue = CantidadRestante.ToString() - ' TxtCantidadSeccion.Enabled = True - ' End If - - ' If CantidadTotalSeccion > 0 Then - ' GvDatos.Rows(IndexSeccionAlmacen).FCTextBox("TbCantidadF").Enabled = False - ' GvDatos.Rows(IndexSeccionAlmacen).FCTextBox("TbCantidadF").ToolTip = "Cuenta con sección almacen" - - ' Else - ' GvDatos.Rows(IndexSeccionAlmacen).FCTextBox("TbCantidadF").Enabled = True - ' GvDatos.Rows(IndexSeccionAlmacen).FCTextBox("TbCantidadF").ToolTip = "" - - ' End If - - ' If DtSeccionAlmacen.SUMD("CantidadSeccionAlmacen") > 0 Then - ' DdlAlmacen.Enabled = False - ' DdlAlmacen.ToolTip = "Cuenta con sección almacen" - ' Else - ' DdlAlmacen.Enabled = True - ' DdlAlmacen.ToolTip = "" - ' End If - - ' UpModalSeccionAlmacen.Update() - ' UpDatos.Update() - ' UpGenerales.Update() - 'End Sub - - 'Protected Sub LnkAddSeccionAlmacen_Click(sender As Object, e As EventArgs) - - ' Dim ObjInv As New ClsInventarios - ' Dim CantidadDisponible As Decimal = 0 - ' If ObjInv.GetMovimientosDetalleSeccionesAlmacen(DdlSeccionAlmacen.SelectedValue.ToEntero(), DdlAlmacen.SelectedValue.ToEntero(), - ' CvePS, UsuarioActual.CveEmpresa) Then - ' If ObjInv.DtResultados.Rows.Count > 0 Then - ' CantidadDisponible = ObjInv.DtResultados.Rows(0)("CantidadRestante").ToString().ToDecimal - ' End If - ' End If - ' ObjInv.Dispose() - - ' CantidadDisponible -= DtSeccionAlmacen.FiltraParametros($"CvePS = {CvePS} AND CveSeccionAlmacen = {DdlSeccionAlmacen.SelectedValue}").SUMD("CantidadSeccionAlmacen") - - ' If TxtCantidadSeccion.Text.ToDecimal > CantidadDisponible Then - ' Alert($"No tiene cantidad de producto suficiente en esta seccion de almacen, su cantidad restante es: {CantidadDisponible}", TipoMensaje.MsgAdvertencia) - ' Exit Sub - ' End If - - ' Dim Row As DataRow = Nothing - ' DtSeccionAlmacen.AcceptChanges() - ' Row = DtSeccionAlmacen.NewRow - ' Row("CantidadSeccionAlmacen") = TxtCantidadSeccion.Text.ToDecimal - ' Row("IndexSeccionAlmacen") = IndexSeccionAlmacen - ' Row("CveSeccionAlmacen") = DdlSeccionAlmacen.SelectedValue.ToEntero() - ' Row("SeccionAlmacen") = DdlSeccionAlmacen.SelectedItem.Text - ' Row("CvePS") = CvePS - ' Row("Consec") = DtSeccionAlmacen.Rows.Count + 1 - ' DtSeccionAlmacen.Rows.Add(Row) - ' DtSeccionAlmacen.AcceptChanges() - ' CargaSeccionAlmacen() - 'End Sub - - 'Protected Sub LnkEliminarSeccion_Click(sender As Object, e As EventArgs) - ' Dim gvRow As GridViewRow = DirectCast((DirectCast(sender, LinkButton)).NamingContainer, GridViewRow) - ' Dim Index As Integer = 0 - ' For Each Dr As DataRow In DtSeccionAlmacen.Rows - ' If Dr("Consec").ToString().ToEntero() = gvRow.DataKey("Consec").ToEntero() Then - ' Exit For - ' End If - ' Index += 1 - ' Next - ' DtSeccionAlmacen.Rows.RemoveAt(Index) - ' DtSeccionAlmacen.AcceptChanges() - ' CargaSeccionAlmacen() - 'End Sub - - 'Protected Sub LnkVerSecciones_Click(sender As Object, e As EventArgs) - ' If Not CveVentaSurtir > 0 Then - ' Alert("Tiene que seleccionar la venta a surtir", TipoMensaje.MsgAdvertencia) - ' Exit Sub - ' End If - - ' If Not DdlAlmacen.SelectedValue.ToEntero() > 0 Then - ' Alert("Tiene que seleccionar el almacen", TipoMensaje.MsgAdvertencia) - ' Exit Sub - ' End If - - ' Dim ObjInv As New ClsInventarios - ' If ObjInv.GetExistenciaSeccionAlmacen(CveVentaSurtir, DdlAlmacen.SelectedValue.ToEntero(), UsuarioActual.CveEmpresa) Then - ' GvVerSeccionesAlmacen.DataSource = ObjInv.DtResultados - ' End If - ' ObjInv.Dispose() - ' GvVerSeccionesAlmacen.DataBind() - ' UpVerSeccionesAlmacen.Update() - ' RegistraScript("$('#ModalVerSeccionesAlmacen').modal()") - 'End Sub - + 'Private Sub CreaDtSeccionAlmacen() + ' DtSeccionAlmacen = New DataTable + ' DtSeccionAlmacen.Columns.Add("CantidadSeccionAlmacen", GetType(Decimal)) + ' DtSeccionAlmacen.Columns.Add("IndexSeccionAlmacen", GetType(Integer)) + ' DtSeccionAlmacen.Columns.Add("CveSeccionAlmacen", GetType(Integer)) + ' DtSeccionAlmacen.Columns.Add("CvePS", GetType(Integer)) + ' DtSeccionAlmacen.Columns.Add("SeccionAlmacen", GetType(String)) + ' DtSeccionAlmacen.Columns.Add("Consec", GetType(Integer)) + 'End Sub + 'Private Sub CargaDdlAlmacen() + ' DdlSeccionAlmacen.DataSource = GlobalDTSeccionAlmacen(UsuarioActual.CveEmpresa, -1) + ' DdlSeccionAlmacen.Items.Insert(0, New ListItem("Seleccione", "-1")) + ' DdlSeccionAlmacen.DataBind() + 'End Sub + 'Protected Sub LnkSeccionAlmacen_Click(sender As Object, e As EventArgs) + ' Dim gvRow As GridViewRow = DirectCast((DirectCast(sender, LinkButton)).NamingContainer, GridViewRow) + + ' If Not DdlAlmacen.SelectedValue.ToEntero() > 0 Then + ' Alert("Tiene que tener seleccionado un almacen para registrar seccion almacen.", TipoMensaje.MsgAdvertencia) + ' Exit Sub + ' End If + + ' CantidadTotal = gvRow.FCTextBox("TbCantidadF").Text.ToDecimal + ' IndexSeccionAlmacen = gvRow.RowIndex + ' CvePS = gvRow.DataKey("CvePS").ToEntero() + ' CargaSeccionAlmacen() + ' RegistraScript("$('#DModalSeccionAlmacen').modal()") + 'End Sub + + 'Private Sub CargaSeccionAlmacen() + ' Dim CantidadTotalSeccion As Decimal = DtSeccionAlmacen.FiltraParametros($"IndexSeccionAlmacen = {IndexSeccionAlmacen}").SUMD("CantidadSeccionAlmacen") + ' GvSeccion.DataSource = DtSeccionAlmacen.FiltraParametros($"IndexSeccionAlmacen = {IndexSeccionAlmacen}") + ' GvSeccion.DataBind() + + ' TxtCantidadSeccion.Text = "" + ' DdlSeccionAlmacen.SelectedIndex = 0 + ' Dim CantidadRestante As Decimal = CantidadTotal - CantidadTotalSeccion + ' If CantidadRestante = 0 Then + ' RVTxtCantidad.MaximumValue = "1" + ' TxtCantidadSeccion.Enabled = False + ' Else + ' RVTxtCantidad.MaximumValue = CantidadRestante.ToString() + ' TxtCantidadSeccion.Enabled = True + ' End If + + ' If CantidadTotalSeccion > 0 Then + ' GvDatos.Rows(IndexSeccionAlmacen).FCTextBox("TbCantidadF").Enabled = False + ' GvDatos.Rows(IndexSeccionAlmacen).FCTextBox("TbCantidadF").ToolTip = "Cuenta con sección almacen" + + ' Else + ' GvDatos.Rows(IndexSeccionAlmacen).FCTextBox("TbCantidadF").Enabled = True + ' GvDatos.Rows(IndexSeccionAlmacen).FCTextBox("TbCantidadF").ToolTip = "" + + ' End If + + ' If DtSeccionAlmacen.SUMD("CantidadSeccionAlmacen") > 0 Then + ' DdlAlmacen.Enabled = False + ' DdlAlmacen.ToolTip = "Cuenta con sección almacen" + ' Else + ' DdlAlmacen.Enabled = True + ' DdlAlmacen.ToolTip = "" + ' End If + + ' UpModalSeccionAlmacen.Update() + ' UpDatos.Update() + ' UpGenerales.Update() + 'End Sub + + 'Protected Sub LnkAddSeccionAlmacen_Click(sender As Object, e As EventArgs) + + ' Dim ObjInv As New ClsInventarios + ' Dim CantidadDisponible As Decimal = 0 + ' If ObjInv.GetMovimientosDetalleSeccionesAlmacen(DdlSeccionAlmacen.SelectedValue.ToEntero(), DdlAlmacen.SelectedValue.ToEntero(), + ' CvePS, UsuarioActual.CveEmpresa) Then + ' If ObjInv.DtResultados.Rows.Count > 0 Then + ' CantidadDisponible = ObjInv.DtResultados.Rows(0)("CantidadRestante").ToString().ToDecimal + ' End If + ' End If + ' ObjInv.Dispose() + + ' CantidadDisponible -= DtSeccionAlmacen.FiltraParametros($"CvePS = {CvePS} AND CveSeccionAlmacen = {DdlSeccionAlmacen.SelectedValue}").SUMD("CantidadSeccionAlmacen") + + ' If TxtCantidadSeccion.Text.ToDecimal > CantidadDisponible Then + ' Alert($"No tiene cantidad de producto suficiente en esta seccion de almacen, su cantidad restante es: {CantidadDisponible}", TipoMensaje.MsgAdvertencia) + ' Exit Sub + ' End If + + ' Dim Row As DataRow = Nothing + ' DtSeccionAlmacen.AcceptChanges() + ' Row = DtSeccionAlmacen.NewRow + ' Row("CantidadSeccionAlmacen") = TxtCantidadSeccion.Text.ToDecimal + ' Row("IndexSeccionAlmacen") = IndexSeccionAlmacen + ' Row("CveSeccionAlmacen") = DdlSeccionAlmacen.SelectedValue.ToEntero() + ' Row("SeccionAlmacen") = DdlSeccionAlmacen.SelectedItem.Text + ' Row("CvePS") = CvePS + ' Row("Consec") = DtSeccionAlmacen.Rows.Count + 1 + ' DtSeccionAlmacen.Rows.Add(Row) + ' DtSeccionAlmacen.AcceptChanges() + ' CargaSeccionAlmacen() + 'End Sub + + 'Protected Sub LnkEliminarSeccion_Click(sender As Object, e As EventArgs) + ' Dim gvRow As GridViewRow = DirectCast((DirectCast(sender, LinkButton)).NamingContainer, GridViewRow) + ' Dim Index As Integer = 0 + ' For Each Dr As DataRow In DtSeccionAlmacen.Rows + ' If Dr("Consec").ToString().ToEntero() = gvRow.DataKey("Consec").ToEntero() Then + ' Exit For + ' End If + ' Index += 1 + ' Next + ' DtSeccionAlmacen.Rows.RemoveAt(Index) + ' DtSeccionAlmacen.AcceptChanges() + ' CargaSeccionAlmacen() + 'End Sub + + 'Protected Sub LnkVerSecciones_Click(sender As Object, e As EventArgs) + ' If Not CveVentaSurtir > 0 Then + ' Alert("Tiene que seleccionar la venta a surtir", TipoMensaje.MsgAdvertencia) + ' Exit Sub + ' End If + + ' If Not DdlAlmacen.SelectedValue.ToEntero() > 0 Then + ' Alert("Tiene que seleccionar el almacen", TipoMensaje.MsgAdvertencia) + ' Exit Sub + ' End If + + ' Dim ObjInv As New ClsInventarios + ' If ObjInv.GetExistenciaSeccionAlmacen(CveVentaSurtir, DdlAlmacen.SelectedValue.ToEntero(), UsuarioActual.CveEmpresa) Then + ' GvVerSeccionesAlmacen.DataSource = ObjInv.DtResultados + ' End If + ' ObjInv.Dispose() + ' GvVerSeccionesAlmacen.DataBind() + ' UpVerSeccionesAlmacen.Update() + ' RegistraScript("$('#ModalVerSeccionesAlmacen').modal()") + 'End Sub + #End Region - + #Region "DIVIDIR" - + Protected Sub Dividir(sender As Object, e As EventArgs) Dim index2 As Integer = 0 @@ -3745,11 +3745,11 @@ Partial Class Inventarios_EntregaAlmacen index2 += 1 Next - End Sub - - + End Sub + + #End Region - + #Region " GUIAS - SABE QUE ES PORQUE NO VEO QUE SE UTILIZE EN ALGUNA PARTE - EN MIRAS DE ELIMINAR - IPP 24 AGOSTO 2017 " Private Sub BtnNumeroGuia_Click(sender As Object, e As EventArgs) Handles BtnNumeroGuia.Click Dim Objeto As New ClsInventarios @@ -3783,11 +3783,11 @@ Partial Class Inventarios_EntregaAlmacen End If - End Sub + End Sub #End Region - + #Region "SUGERENCIAS" - + Protected Sub BtnVerSugerencias_Click(sender As Object, e As EventArgs) If Not CveVentaSurtir > 0 Then Alert("Tiene que seleccionar la venta a surtir", TipoMensaje.MsgAdvertencia) @@ -3887,12 +3887,12 @@ Partial Class Inventarios_EntregaAlmacen params.Add(New ReportParameter("UsuarioImprimio", UsuarioActual.Usuario)) ImprimirPDF("Empresas/Grales/Formatos/RepEntregaAlmacenSugerencia.rdlc", DtDatosSugerencias, params, "Equipo GPS") - End Sub - + End Sub + #End Region - + #Region "TipoEntrega" - + Protected Sub EntregaRadioGroup_Click(sender As Object, e As EventArgs) If RbEntregaExterna.Checked Then RegistraScript($"AbrirVentana('/General/PopUpPaqueteriasGuias.aspx?CveVenta={CveVentaSurtir}',800,547,'N')") @@ -3919,155 +3919,155 @@ Partial Class Inventarios_EntregaAlmacen ElseIf RbEntregaInterna.Checked Then 'RegistraScript("$('#ModalPaqueteriaInterna').modal('show')") End If - End Sub + End Sub #End Region - -#Region "Cliente entrega personal" - Private Sub ClienteEntregaPersonal(CveCliente As Integer) - Dim ObjVentas As New ClsVentas() - If ObjVentas.GetClientesPersonalEntrega(-1, CveCliente, UsuarioActual.CveEmpresa, 1) Then - If ObjVentas.DtResultados.Rows.Count > 0 Then - GvClentesPersonalEntrega.DataSource = ObjVentas.DtResultados - GvClentesPersonalEntrega.DataBind() - DivPersonalEntrega.Visible = True - Else - DivPersonalEntrega.Visible = False - End If - End If - ObjVentas.Dispose() - UpClentesPersonalEntrega.Update() - End Sub -#End Region - -#Region "sugerir caducidad" - - Private Sub SugiereLoteCaducidad(CveAlmacen As Integer) - Dim TempDT As New DataTable - Dim DtLotesCaducidad As New DataTable - TempDT = DtDatos.Clone - Dim CvePSAnterior As Integer = 0 - Dim ObjInventarios As New ClsInventarios() - - For Each dr As DataRow In DtDatos.Rows - If CBool(dr("AplicaLote")) Then - If CvePSAnterior <> dr("CvePS").ToString.ToEntero Then - CvePSAnterior = dr("CvePS").ToString.ToEntero - - If ObjInventarios.GetExistenciasCaducidad(dr("CvePS").ToString.ToEntero, CveAlmacen, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa) Then - DtLotesCaducidad.Merge(ObjInventarios.DtResultados) - - End If - End If - End If - Next - - ObjInventarios.Dispose() - - For Each dr As DataRow In DtDatos.Rows - If CBool(dr("AplicaLote")) Then - - Dim dtta As DataTable = DtLotesCaducidad.FiltraParametros(String.Format("CvePS = {0}", dr("CvePS"))) - - If dtta IsNot Nothing AndAlso dtta.Rows.Count > 0 Then - - 'recorre que cumplan con la cantidad total a llenar - Dim CantidadSurtir As Decimal = dr("CantidadF").ToString.ToDecimal - For Each drl As DataRow In dtta.Rows - If CantidadSurtir < drl("Cantidad").ToString.ToDecimal Then - dr("CantidadF") = CantidadSurtir - dr("CantidadC") = CantidadSurtir - dr("Lote") = drl("Lote") - dr("FechaCaducidad") = drl("FechaCaducidad") - TempDT.ImportRow(dr) - CantidadSurtir = 0 - Else - CantidadSurtir -= drl("Cantidad").ToString.ToDecimal - dr("CantidadF") = drl("Cantidad").ToString.ToDecimal - dr("CantidadC") = drl("Cantidad").ToString.ToDecimal - dr("Lote") = drl("Lote") - dr("FechaCaducidad") = drl("FechaCaducidad") - TempDT.ImportRow(dr) - End If - If CantidadSurtir <= 0 Then Exit For - Next - - Else - 'error, no hay lote sugerido - End If - Else - TempDT.ImportRow(dr) - End If - - Next - - - DtDatos = TempDT - End Sub - -#End Region - - - 'Protected void LnkEditarDir_Click(Object sender, EventArgs e) - '{ - - - ' int CveCliente = GvRow.DataKey("CveCliente").ToEntero(); - ' int CveDireccion = GvRow.DataKey("CveDireccionEnvio").ToEntero(); - - ' HdnCveVenta.Value = GvRow.DataKey("CveVenta"); - ' CargaModalCombosDirecciones(CveCliente, CveDireccion); - - ' UpModalEditarentrega.Update(); - ' this.RegistraScript("$('#DivEditarEntrega').modal('show');"); - '} - - - - Protected Sub LnkEditarDir_Click(sender As Object, e As EventArgs) - - HdnCveVenta.Value = CveVentaSurtir.ToString - CargaModalCombosDirecciones(CveCliente, CveDireccionEnvio) - - RegistraScript("$('#DivEditarEntrega').modal('show');") - - End Sub - - - Private Sub CargaModalCombosDirecciones(CveCliente As Integer, CveDireccionEnvio As Integer) - - DdlModalDireccionEnvio.Items.Clear() - - Dim dtt As New DataTable() - Dim ObjClientes As New ClsClientes() - If (ObjClientes.DireccionEnvioGet(-1, CveCliente, -1)) Then - dtt = ObjClientes.DtResultados - End If - ObjClientes.Dispose() - - DdlModalDireccionEnvio.DataSource = dtt - DdlModalDireccionEnvio.DataBind() - DdlModalDireccionEnvio.SelectedValueExist(CveDireccionEnvio) - UpModalEditarentrega.Update() - dtt.Dispose() - - End Sub - - - Protected Sub BtnModalEditarentrega_Click(sender As Object, e As EventArgs) - Dim ProcesoOK As Boolean = True - - Dim ObjVentas As New ClsVentas() - If Not ObjVentas.UpdateDireccionEnvioVenta(HdnCveVenta.Value.ToEntero(), DdlModalDireccionEnvio.SelectedValue.ToEntero(), UsuarioActual.CveEmpresa) Then - ProcesoOK = False - End If - ObjVentas.Dispose() - - If ProcesoOK Then - RegistraScript("$('#DivEditarEntrega').modal('hide');") - Alert("Dirección Actualizada correctamente.", ModExtensiones.TipoMensaje.ToastInformacion) - 'CargaDatos() - End If - - - End Sub + +#Region "Cliente entrega personal" + Private Sub ClienteEntregaPersonal(CveCliente As Integer) + Dim ObjVentas As New ClsVentas() + If ObjVentas.GetClientesPersonalEntrega(-1, CveCliente, UsuarioActual.CveEmpresa, 1) Then + If ObjVentas.DtResultados.Rows.Count > 0 Then + GvClentesPersonalEntrega.DataSource = ObjVentas.DtResultados + GvClentesPersonalEntrega.DataBind() + DivPersonalEntrega.Visible = True + Else + DivPersonalEntrega.Visible = False + End If + End If + ObjVentas.Dispose() + UpClentesPersonalEntrega.Update() + End Sub +#End Region + +#Region "sugerir caducidad" + + Private Sub SugiereLoteCaducidad(CveAlmacen As Integer) + Dim TempDT As New DataTable + Dim DtLotesCaducidad As New DataTable + TempDT = DtDatos.Clone + Dim CvePSAnterior As Integer = 0 + Dim ObjInventarios As New ClsInventarios() + + For Each dr As DataRow In DtDatos.Rows + If CBool(dr("AplicaLote")) Then + If CvePSAnterior <> dr("CvePS").ToString.ToEntero Then + CvePSAnterior = dr("CvePS").ToString.ToEntero + + If ObjInventarios.GetExistenciasCaducidad(dr("CvePS").ToString.ToEntero, CveAlmacen, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa) Then + DtLotesCaducidad.Merge(ObjInventarios.DtResultados) + + End If + End If + End If + Next + + ObjInventarios.Dispose() + + For Each dr As DataRow In DtDatos.Rows + If CBool(dr("AplicaLote")) Then + + Dim dtta As DataTable = DtLotesCaducidad.FiltraParametros(String.Format("CvePS = {0}", dr("CvePS"))) + + If dtta IsNot Nothing AndAlso dtta.Rows.Count > 0 Then + + 'recorre que cumplan con la cantidad total a llenar + Dim CantidadSurtir As Decimal = dr("CantidadF").ToString.ToDecimal + For Each drl As DataRow In dtta.Rows + If CantidadSurtir < drl("Cantidad").ToString.ToDecimal Then + dr("CantidadF") = CantidadSurtir + dr("CantidadC") = CantidadSurtir + dr("Lote") = drl("Lote") + dr("FechaCaducidad") = drl("FechaCaducidad") + TempDT.ImportRow(dr) + CantidadSurtir = 0 + Else + CantidadSurtir -= drl("Cantidad").ToString.ToDecimal + dr("CantidadF") = drl("Cantidad").ToString.ToDecimal + dr("CantidadC") = drl("Cantidad").ToString.ToDecimal + dr("Lote") = drl("Lote") + dr("FechaCaducidad") = drl("FechaCaducidad") + TempDT.ImportRow(dr) + End If + If CantidadSurtir <= 0 Then Exit For + Next + + Else + 'error, no hay lote sugerido + End If + Else + TempDT.ImportRow(dr) + End If + + Next + + + DtDatos = TempDT + End Sub + +#End Region + + + 'Protected void LnkEditarDir_Click(Object sender, EventArgs e) + '{ + + + ' int CveCliente = GvRow.DataKey("CveCliente").ToEntero(); + ' int CveDireccion = GvRow.DataKey("CveDireccionEnvio").ToEntero(); + + ' HdnCveVenta.Value = GvRow.DataKey("CveVenta"); + ' CargaModalCombosDirecciones(CveCliente, CveDireccion); + + ' UpModalEditarentrega.Update(); + ' this.RegistraScript("$('#DivEditarEntrega').modal('show');"); + '} + + + + Protected Sub LnkEditarDir_Click(sender As Object, e As EventArgs) + + HdnCveVenta.Value = CveVentaSurtir.ToString + CargaModalCombosDirecciones(CveCliente, CveDireccionEnvio) + + RegistraScript("$('#DivEditarEntrega').modal('show');") + + End Sub + + + Private Sub CargaModalCombosDirecciones(CveCliente As Integer, CveDireccionEnvio As Integer) + + DdlModalDireccionEnvio.Items.Clear() + + Dim dtt As New DataTable() + Dim ObjClientes As New ClsClientes() + If (ObjClientes.DireccionEnvioGet(-1, CveCliente, -1)) Then + dtt = ObjClientes.DtResultados + End If + ObjClientes.Dispose() + + DdlModalDireccionEnvio.DataSource = dtt + DdlModalDireccionEnvio.DataBind() + DdlModalDireccionEnvio.SelectedValueExist(CveDireccionEnvio) + UpModalEditarentrega.Update() + dtt.Dispose() + + End Sub + + + Protected Sub BtnModalEditarentrega_Click(sender As Object, e As EventArgs) + Dim ProcesoOK As Boolean = True + + Dim ObjVentas As New ClsVentas() + If Not ObjVentas.UpdateDireccionEnvioVenta(HdnCveVenta.Value.ToEntero(), DdlModalDireccionEnvio.SelectedValue.ToEntero(), UsuarioActual.CveEmpresa) Then + ProcesoOK = False + End If + ObjVentas.Dispose() + + If ProcesoOK Then + RegistraScript("$('#DivEditarEntrega').modal('hide');") + Alert("Dirección Actualizada correctamente.", ModExtensiones.TipoMensaje.ToastInformacion) + 'CargaDatos() + End If + + + End Sub End Class