diff --git a/Inventarios/EntregaAlmacen.aspx.vb b/Inventarios/EntregaAlmacen.aspx.vb index c714d911f..73b8d4d85 100644 --- a/Inventarios/EntregaAlmacen.aspx.vb +++ b/Inventarios/EntregaAlmacen.aspx.vb @@ -508,13 +508,11 @@ Partial Class Inventarios_EntregaAlmacen If e.Row.RowType = DataControlRowType.DataRow Then e.Row.FCLinkButton("BtnSurtir").CommandArgument = If(e.Row.DBCampo("TipoEntrega") = "1", e.Row.DBCampo("CveVenta"), e.Row.DBCampo("CveTraspasoSolicitud")) - - Select Case e.Row.DBCampo("TipoEntrega").ToString().ToEntero() Case 1 If UsuarioActual.TienePermisoProceso(201) Then - Dim Css = "Texto" - Dim Liga = $"/Ventas/Ventas.aspx?&CveVenta={e.Row.DBCampo("CveVenta")}" + Dim Css As String = "Texto" + Dim Liga As String = $"/Ventas/Ventas.aspx?&CveVenta={e.Row.DBCampo("CveVenta")}" e.Row.FCLabel("LblFolio").Text = "" + e.Row.FCLabel("LblFolio").Text + "" End If @@ -532,8 +530,8 @@ Partial Class Inventarios_EntregaAlmacen e.Row.FCLinkButton("BtnSurtir").Text = " Recibir" End If Case 2 - Dim Css = "Texto" - Dim Liga = $"/Inventarios/TrasladoSolicitud.aspx?&CveTraspasoSolicitud={e.Row.DBCampo("CveTraspasoSolicitud")}" + Dim Css As String = "Texto" + Dim Liga As String = $"/Inventarios/TrasladoSolicitud.aspx?&CveTraspasoSolicitud={e.Row.DBCampo("CveTraspasoSolicitud")}" e.Row.FCLabel("LblFolio").Text = "" + e.Row.FCLabel("LblFolio").Text + "" e.Row.FCLinkButton("BtnSurtir").CssClass = "btn btn-primary btn-sm" e.Row.FCLinkButton("BtnSurtir").Text = " Traspasar " @@ -548,7 +546,7 @@ Partial Class Inventarios_EntregaAlmacen #Region " CARGA VENTA POR SURTIR " Protected Sub BtnSurtir_Click(sender As Object, e As EventArgs) - Dim Boton = CType(sender, LinkButton) + Dim Boton As LinkButton = CType(sender, LinkButton) CveVentaAD = -1 If Boton.CommandArgument.ToEntero() > 0 Then @@ -598,7 +596,7 @@ Partial Class Inventarios_EntregaAlmacen ArchivoBitacora = String.Format("{0}Temp\EntregaDT_{1}_{2}.xml", UsuarioActual.Empresa.Ruta, UsuarioActual.CveUsuario, CveVenta) ArchivoBitacoraDetalle = String.Format("{0}Temp\EntregaDTD_{1}_{2}.xml", UsuarioActual.Empresa.Ruta, UsuarioActual.CveUsuario, CveVenta) If ArchivoBitacora <> "" Then - Dim Archivo = New System.IO.FileInfo(ArchivoBitacora) + Dim Archivo As New System.IO.FileInfo(ArchivoBitacora) If Archivo.Exists() Then HplCargaBitacora.Visible = True uppCargaBitacora.Update() @@ -609,7 +607,7 @@ Partial Class Inventarios_EntregaAlmacen 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)) - Dim Index = 1 + Dim Index As Integer = 1 For Each Dr As DataRow In DtDatos.Rows Dr("Consec") = Index Index += 1 @@ -695,7 +693,7 @@ Partial Class Inventarios_EntregaAlmacen 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}", "") + Dim RestriccionAlmacenSubProyecto As String = If(UsuarioActual.CveEmpresa.Contiene(72, 80), $" AND CveSubProyecto = {CveSubProyecto}", "") DdlAlmacen.DataSource = GlobalDTAlmacenUsuarios(UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, -1).FiltraParametros($"{StrAlmacenes} {RestriccionAlmacenSubProyecto}") End If @@ -841,7 +839,7 @@ Partial Class Inventarios_EntregaAlmacen End If LbObservaciones.Text = DtDatos.Rows(0)("Observaciones").ToString() - Dim Index = 1 + Dim Index As Integer = 1 For Each Dr As DataRow In DtDatos.Rows Dr("Consec") = Index Index += 1 @@ -962,7 +960,7 @@ Partial Class Inventarios_EntregaAlmacen UpVenta.Update() 'CARGA LO PRECARGADO CON SERIE - Dim Contador = 0 + Dim Contador As Integer = 0 For Each Gvr As GridViewRow In GvDatos.Rows If Gvr.DataKey("CvePS").ToEntero() = CvePSSerie AndAlso DtDatosDetalle IsNot Nothing Then Contador = DtDatosDetalle.FiltraParametros(String.Format("ConsecId = {0}", Gvr.DataKey("Consec"))).Rows.Count @@ -987,7 +985,7 @@ Partial Class Inventarios_EntregaAlmacen e.Row.FCTextBox("TbCantidadF").Enabled = False e.Row.FCCheckBox("cbInv").Enabled = False If e.Row.DBCampo("Consec") <> "" AndAlso DtDatosDetalle IsNot Nothing Then - Dim Contador = DtDatosDetalle.FiltraParametros(String.Format("ConsecId = {0}", e.Row.DBCampo("Consec"))).Rows.Count + Dim Contador As Integer = DtDatosDetalle.FiltraParametros(String.Format("ConsecId = {0}", e.Row.DBCampo("Consec"))).Rows.Count e.Row.FCTextBox("TbCantidadF").Text = Contador.ToString() Else e.Row.FCTextBox("TbCantidadF").Text = "0" @@ -1004,7 +1002,7 @@ Partial Class Inventarios_EntregaAlmacen 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) + Dim Str As Array = 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() @@ -1042,7 +1040,7 @@ Partial Class Inventarios_EntregaAlmacen 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 + If (e.Row.FCTextBox("TxtCaducidad").Text = "" OrElse e.Row.FCTextBox("TxtCaducidad").Text.ToDate <= MinFecha) OrElse UsuarioActual.TienePermisoProceso(364) Then e.Row.FCTextBox("TxtCaducidad").ReadOnly = False CType(e.Row.FindControl("RFVCaducidad"), RequiredFieldValidator).Enabled = True e.Row.FCTextBox("TxtCaducidad").Enabled = True @@ -1056,13 +1054,12 @@ Partial Class Inventarios_EntregaAlmacen 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 + If e.Row.FCTextBox("TxtLote").Text = "" OrElse UsuarioActual.TienePermisoProceso(364) 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 @@ -1126,7 +1123,7 @@ Partial Class Inventarios_EntregaAlmacen Protected Sub BtnSerie_Click(sender As Object, e As EventArgs) - Dim Argumentos = CType(sender, Button).CommandArgument.Split("°"c) + Dim Argumentos As String() = CType(sender, Button).CommandArgument.Split("°"c) LbProducto.Text = Argumentos(2) LbCantidad.Text = Argumentos(3) @@ -1140,7 +1137,6 @@ Partial Class Inventarios_EntregaAlmacen CveConsecSerie = Argumentos(4).ToEntero() CveMetodoInventario = Argumentos(5).ToEntero() - If CveMetodoInventario = 6 Then RegistraScript("$('#DivLote').modal({backdrop: 'static', keyboard: false});") CargaLote() @@ -1151,7 +1147,6 @@ Partial Class Inventarios_EntregaAlmacen UpSerie.Update() End If - End Sub #Region " AGREGA POR SERIE/LOTE " @@ -1175,7 +1170,7 @@ Partial Class Inventarios_EntregaAlmacen If Not CargaMasivo Then RegistraScript("$('#DivSerie').modal({backdrop: 'static', keyboard: false})", "show") - Dim AplicaCaducidad = False + Dim AplicaCaducidad As Boolean = False Dim dttt As DataTable = GlobalDTPSSimplificado(UsuarioActual.CveEmpresa, CvePS:=CvePSSerie) If dttt IsNot Nothing AndAlso dttt.Rows.Count > 0 Then AplicaCaducidad = If(dttt.FiltraParametros("").Rows(0)("AplicaCaducidad").ToString() = "True", True, False) @@ -1238,7 +1233,7 @@ Partial Class Inventarios_EntregaAlmacen End If 'SI TIENE SALIDA POR SERIE LOTE, BLOQUEAMOS CHECK Y TXTCANTIDAD - Dim Contador = 0 + Dim Contador As Integer = 0 For Each Gvr As GridViewRow In GvDatos.Rows If Gvr.DataKey("AplicaSerie") = "True" Then Contador = DtDatosDetalle.FiltraParametros(String.Format("ConsecId = {0}", Gvr.DataKey("Consec"))).Rows.Count @@ -1309,7 +1304,7 @@ Partial Class Inventarios_EntregaAlmacen 'Valida Existencia If TipoMovimiento = 1 Then Dim ObjInventarios As New ClsInventarios - Dim Existencia = ObjInventarios.GetExistenciasPS(CvePSSerie, CveUMSerie, UsuarioActual.CveEmpresa, DdlAlmacen.SelectedValue.ToEntero(), FechaMovto:=TxtFecha.Text.ToDateTime.ToString("yyyy/MM/dd HH:mm"), Serie:=Serie, CveVendedor:=CveVendedor, CveSubProyecto:=CveSubProyecto, CveCliente:=If(UsuarioActual.Empresa.Funcionalidad(146) = "1", -1, CveCliente), ExcluyeApartados:=If(TipoEntrega = 2, 1, -1)) + Dim Existencia As Decimal = ObjInventarios.GetExistenciasPS(CvePSSerie, CveUMSerie, UsuarioActual.CveEmpresa, DdlAlmacen.SelectedValue.ToEntero(), FechaMovto:=TxtFecha.Text.ToDateTime.ToString("yyyy/MM/dd HH:mm"), Serie:=Serie, CveVendedor:=CveVendedor, CveSubProyecto:=CveSubProyecto, CveCliente:=If(UsuarioActual.Empresa.Funcionalidad(146) = "1", -1, CveCliente), ExcluyeApartados:=If(TipoEntrega = 2, 1, -1)) If Existencia < 1 Then Alert($"No hay existencia suficiente del producto ""{PSSerie}"" con la Serie definida ""{Serie}"". Por favor rectifique y vuelva a intentar", TipoMensaje.MsgAdvertencia, If(Tipo = 2, "window.setTimeout(Focus,200);", "")) RegistraScript("playsonidito('142608__autistic-lucario__error.wav')", "Error2") @@ -1319,7 +1314,7 @@ Partial Class Inventarios_EntregaAlmacen ObjInventarios.Dispose() Else If DtExistencias IsNot Nothing Then - Dim Existencia = DtExistencias.SUM("Cantidad", $"CvePS = {CvePSSerie} AND CveUM = {CveUMSerie} AND Serie = '{Serie}'") + Dim Existencia As Decimal = DtExistencias.SUMD("Cantidad", $"CvePS = {CvePSSerie} AND CveUM = {CveUMSerie} AND Serie = '{Serie}'") If Existencia < 1 Then Alert($"No hay existencia suficiente del producto ""{PSSerie}"" con la Serie definida ""{Serie}"". Por favor rectifique y vuelva a intentar", TipoMensaje.MsgAdvertencia, If(Tipo = 2, "window.setTimeout(Focus,200);", "")) RegistraScript("playsonidito('142608__autistic-lucario__error.wav')", "Error3") @@ -1328,8 +1323,7 @@ Partial Class Inventarios_EntregaAlmacen End If End If - - Dim Row = DtDatosDetalle.NewRow + Dim Row As DataRow = DtDatosDetalle.NewRow Row("ConsecId") = CveConsecSerie Row("Consec") = DtDatosDetalle.Rows.Count + 1 @@ -1539,15 +1533,15 @@ Partial Class Inventarios_EntregaAlmacen Exit Sub End If - Dim Row = DtDatosDetalleLote.NewRow - Dim CantidadLote = TxtCantidadLote.Text.ToDecimal + Dim Row As DataRow = DtDatosDetalleLote.NewRow + Dim CantidadLote As Decimal = TxtCantidadLote.Text.ToDecimal Dim MensajeSinExistencias As New StringBuilder Dim ObjInventarios As New ClsInventarios 'VERIFICA EXISTENCIAS If TipoMovimiento = 1 Then - Dim Existencia = ObjInventarios.GetExistenciasPS(CvePSSerie, CveUMSerie, UsuarioActual.CveEmpresa, DdlAlmacen.SelectedValue.ToEntero(), FechaMovto:=TxtFecha.Text.ToDateTime.ToString("yyyy/MM/dd HH:mm"), CveVendedor:=CveVendedor, CveSubProyecto:=CveSubProyecto, CveCliente:=If(UsuarioActual.Empresa.Funcionalidad(146) = "1", -1, CveCliente), Lote:=Lote, ExcluyeApartados:=If(TipoEntrega = 2, 1, -1)) + Dim Existencia As Decimal = ObjInventarios.GetExistenciasPS(CvePSSerie, CveUMSerie, UsuarioActual.CveEmpresa, DdlAlmacen.SelectedValue.ToEntero(), FechaMovto:=TxtFecha.Text.ToDateTime.ToString("yyyy/MM/dd HH:mm"), CveVendedor:=CveVendedor, CveSubProyecto:=CveSubProyecto, CveCliente:=If(UsuarioActual.Empresa.Funcionalidad(146) = "1", -1, CveCliente), Lote:=Lote, ExcluyeApartados:=If(TipoEntrega = 2, 1, -1)) If Existencia < CantidadLote Then Alert($"No hay existencia suficiente del producto ""{PSSerie}"" con el lote definido ""{Lote}"" y el batch ""{Batch}"". Por favor rectifique y vuelva a intentar", TipoMensaje.MsgAdvertencia) RegistraScript("playsonidito('142608__autistic-lucario__error.wav')") @@ -1556,7 +1550,7 @@ Partial Class Inventarios_EntregaAlmacen End If Else If DtExistencias IsNot Nothing Then - Dim Existencia = DtExistencias.SUM("Cantidad", $"CvePS = {CvePSSerie} AND CveUM = {CveUMSerie} AND Lote = '{Lote}' AND Batch = '{Batch}'") + Dim Existencia As Decimal = DtExistencias.SUMD("Cantidad", $"CvePS = {CvePSSerie} AND CveUM = {CveUMSerie} AND Lote = '{Lote}' AND Batch = '{Batch}'") If Existencia < CantidadLote Then Alert($"No hay existencia suficiente del producto ""{PSSerie}"" con el lote definido ""{Lote}"" y el batch ""{Batch}"". Por favor rectifique y vuelva a intentar", TipoMensaje.MsgAdvertencia) RegistraScript("playsonidito('142608__autistic-lucario__error.wav')") @@ -1566,7 +1560,7 @@ Partial Class Inventarios_EntregaAlmacen End If End If - Dim FechaCaducidad = "" + Dim FechaCaducidad As String = "" If ObjInventarios.LoteRecomendadoGet(CvePSSerie, UsuarioActual.CveEmpresa, DdlAlmacen.SelectedValue.ToEntero()) AndAlso ObjInventarios.DtResultados.Rows.Count > 0 Then FechaCaducidad = ObjInventarios.DtResultados.Rows(0)("FechaCaducidad").ToString().ToDate.ToShortDateString End If @@ -1619,19 +1613,19 @@ Partial Class Inventarios_EntregaAlmacen End If TdSeriePS.Visible = False - Dim Existe = False - Dim PSTemp = "" + Dim Existe As Boolean = False + Dim PSTemp As String = "" For Each Gvr As GridViewRow In GvDatos.Rows If Gvr.DataKey("CodigoBarras") = TxtCodigoPS.Text.Trim Then - Dim TxtCantidad = GvDatos.Rows(Gvr.RowIndex).FCTextBox("TbCantidadF") + Dim TxtCantidad As TextBox = GvDatos.Rows(Gvr.RowIndex).FCTextBox("TbCantidadF") If Gvr.DataKey("CantidadF").ToDecimal - TxtCantidad.Text.ToDecimal - 1 >= 0 Then ''VALIDA EXISTENCIA If Not TipoDocto.Contiene("Dev") Then If TipoMovimiento = 1 Then Dim ObjInventario As New ClsInventarios - Dim Existencia = ObjInventario.GetExistenciasPS(Gvr.DataKey("CvePS").ToString().ToEntero(), Gvr.DataKey("CveUM").ToString().ToEntero(), UsuarioActual.CveEmpresa, DdlAlmacen.SelectedValue.ToEntero(), FechaMovto:=TxtFecha.Text.ToDateTime.ToString("yyyy/MM/dd HH:mm"), CveVendedor:=CveVendedor, CveSubProyecto:=CveSubProyecto, CveCliente:=If(UsuarioActual.Empresa.Funcionalidad(146) = "1", -1, CveCliente), ExcluyeApartados:=If(TipoEntrega = 2, 1, -1)) + Dim Existencia As Decimal = ObjInventario.GetExistenciasPS(Gvr.DataKey("CvePS").ToString().ToEntero(), Gvr.DataKey("CveUM").ToString().ToEntero(), UsuarioActual.CveEmpresa, DdlAlmacen.SelectedValue.ToEntero(), FechaMovto:=TxtFecha.Text.ToDateTime.ToString("yyyy/MM/dd HH:mm"), CveVendedor:=CveVendedor, CveSubProyecto:=CveSubProyecto, CveCliente:=If(UsuarioActual.Empresa.Funcionalidad(146) = "1", -1, CveCliente), ExcluyeApartados:=If(TipoEntrega = 2, 1, -1)) ObjInventario.Dispose() If Not Existencia >= TxtCantidad.Text.ToDecimal + 1 Then TxtCodigoPS.Text = "" @@ -1641,7 +1635,7 @@ Partial Class Inventarios_EntregaAlmacen End If Else If DtExistencias IsNot Nothing Then - Dim Existencia = DtExistencias.SUM("Cantidad", $"CvePS = {Gvr.DataKey("CvePS")} AND CveUM = {Gvr.DataKey("CveUM").ToString().ToEntero()}") + Dim Existencia As Decimal = DtExistencias.SUMD("Cantidad", $"CvePS = {Gvr.DataKey("CvePS")} AND CveUM = {Gvr.DataKey("CveUM").ToString().ToEntero()}") If Not Existencia >= TxtCantidad.Text.ToDecimal + 1 Then TxtCodigoPS.Text = "" Alert($"No hay existencias suficientes del producto:
""{Gvr.DataKey("Codigo")}-{Gvr.DataKey("PS")}"".
Solo hay disponibles {Existencia.FormatoNumero} en Almacen. Por favor Verifique y vuelva a intentar.", TipoMensaje.MsgAdvertencia, "window.setTimeout(Focus,200);") @@ -1663,7 +1657,7 @@ Partial Class Inventarios_EntregaAlmacen Exit Sub End If - Dim CantidadEspecial = Gvr.DataKey("CveClasificacion").ToString().ToEntero().Contiene(17601, 17881) OrElse Gvr.DataKey("CvePS").ToString().ToEntero().Contiene(343032, 343033) + Dim CantidadEspecial As Boolean = Gvr.DataKey("CveClasificacion").ToString().ToEntero().Contiene(17601, 17881) OrElse Gvr.DataKey("CvePS").ToString().ToEntero().Contiene(343032, 343033) If CantidadEspecial Then RegistraScript("CantidadEspecial();window.setTimeout(FocusCantidadEspecial,200);") @@ -1702,7 +1696,7 @@ Partial Class Inventarios_EntregaAlmacen End Sub Private Sub VerificaVentaSurtida() - Dim Surtida = True + Dim Surtida As Boolean = True For Each Gvr As GridViewRow In GvDatos.Rows If Gvr.DataKey("CantidadF").ToDecimal <> Gvr.FCTextBox("TbCantidadF").Text.ToDecimal Then @@ -1729,7 +1723,7 @@ Partial Class Inventarios_EntregaAlmacen AgregaCantidadEspecial() End Sub Private Sub AgregaCantidadEspecial() - Dim TxtCantidad = GvDatos.Rows(RowIndexCantidadEspecial).FCTextBox("TbCantidadF") + Dim TxtCantidad As TextBox = GvDatos.Rows(RowIndexCantidadEspecial).FCTextBox("TbCantidadF") If CantidadEspecialTemp - TxtCantidadEspecialDiv.Text.ToDecimal - TxtCantidad.Text.ToDecimal >= 0 Then TxtCantidad.Text = (TxtCantidad.Text.ToDecimal + TxtCantidadEspecialDiv.Text.ToDecimal).ToString().FormatoNumero 'RegistraScript("$('#ModalCantidad').modal('hide');") @@ -1872,7 +1866,7 @@ Partial Class Inventarios_EntregaAlmacen Dim FolioVirtual As Integer = -1 'PASA DATOS DEL GV A DATATABLE PARA MANEJOR CON FOR EACH - Dim Index = 0 + Dim Index As Integer = 0 For Each gvr As GridViewRow In GvDatos.Rows If gvr.FCCheckBox("cbInv").Checked AndAlso gvr.FCTextBox("TbCantidadF").Text.ToDecimal > 0 Then DtDatos.Rows(Index)("CantidadGV") = gvr.FCTextBox("TbCantidadF").Text.ToDecimal @@ -1921,8 +1915,7 @@ Partial Class Inventarios_EntregaAlmacen DtTraspasos.Columns.Add("CveTipoAlmacen", GetType(Integer)) DtTraspasos.Columns.Add("CveConceptoMovimientoSalida", GetType(Integer)) - Dim CveMovimientoSalida = -1, FolioSalida = -1, CveMovimientoEntrada = -1, CveMovimientoEntradaApartado = -1, FolioEntrada = -1, CveMovimientoSalidaDevRem = -1, FolioMovimientoSalidaDevRem = -1, CveMovimientoEntradaDevRem = -1, FolioMovimientoEntradaDevRem = -1 - + Dim CveMovimientoSalida As Integer = -1, FolioSalida As Integer = -1, CveMovimientoEntrada As Integer = -1, CveMovimientoEntradaApartado As Integer = -1, FolioEntrada As Integer = -1, CveMovimientoSalidaDevRem As Integer = -1, FolioMovimientoSalidaDevRem As Integer = -1, CveMovimientoEntradaDevRem As Integer = -1, FolioMovimientoEntradaDevRem As Integer = -1 Dim DtDevSinCosto As New DataTable DtDevSinCosto.Columns.Add("CveAlmacen", GetType(Integer)) @@ -1957,7 +1950,7 @@ Partial Class Inventarios_EntregaAlmacen Next StrXML.Append("") - Dim TieneErrorExistencia = False + Dim TieneErrorExistencia As Boolean = False If ObjInventario.GetExistenciasPSXML(StrXML.ToString(), DdlAlmacen.SelectedValue.ToEntero(), TxtFecha.Text.ToDateTime.ToString("yyyy/MM/dd HH:mm"), CveSubProyecto, CveVendedor, If(UsuarioActual.Empresa.Funcionalidad(146) = "1", -1, CveCliente), If(TipoEntrega = 2, 1, -1), UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa) Then If ObjInventario.DtResultados.Rows.Count > 0 Then TieneErrorExistencia = True @@ -2019,7 +2012,7 @@ Partial Class Inventarios_EntregaAlmacen Exit For End If - Dim DrMovto = DtTraspasos.NewRow + Dim DrMovto As DataRow = DtTraspasos.NewRow DrMovto("Almacen") = Dr2("Almacen").ToString().ToEntero() DrMovto("CveAlmacen") = Dr2("CveAlmacen").ToString().ToEntero() DrMovto("CveMovimientoSalida") = CveMovimientoSalida @@ -2069,7 +2062,7 @@ Partial Class Inventarios_EntregaAlmacen Exit For End If - Dim DrMovto = DtTraspasos.NewRow + Dim DrMovto As DataRow = DtTraspasos.NewRow DrMovto("Almacen") = Dr1("Almacen").ToString().ToEntero() DrMovto("CveAlmacen") = Dr1("CveAlmacen").ToString().ToEntero() DrMovto("CveMovimientoSalida") = CveMovimientoSalida @@ -2212,7 +2205,7 @@ Partial Class Inventarios_EntregaAlmacen Exit For End If - Dim DrMovto = DtTraspasos.NewRow + Dim DrMovto As DataRow = DtTraspasos.NewRow DrMovto("Almacen") = Dr2("Almacen").ToString().ToEntero() DrMovto("CveAlmacen") = Dr2("CveAlmacen").ToString().ToEntero() DrMovto("CveMovimientoSalida") = CveMovimientoSalida @@ -2266,7 +2259,7 @@ Partial Class Inventarios_EntregaAlmacen Exit For End If - Dim DrMovto = DtTraspasos.NewRow + Dim DrMovto As DataRow = DtTraspasos.NewRow DrMovto("Almacen") = Dr2("Almacen").ToString().ToEntero() DrMovto("CveAlmacen") = Dr2("CveAlmacen").ToString().ToEntero() DrMovto("CveMovimientoSalida") = CveMovimientoSalida @@ -2319,7 +2312,7 @@ Partial Class Inventarios_EntregaAlmacen Exit For End If - Dim DrMovto = DtTraspasos.NewRow + Dim DrMovto As DataRow = DtTraspasos.NewRow DrMovto("Almacen") = Dr1("Almacen").ToString().ToEntero() DrMovto("CveAlmacen") = Dr1("CveAlmacen").ToString().ToEntero() DrMovto("CveMovimientoSalida") = CveMovimientoSalida @@ -2414,7 +2407,7 @@ Partial Class Inventarios_EntregaAlmacen FolioGarantia = ObjInventario.Folio For Each RowGarantia As DataRow In DtGarantias.Rows - Dim CvePS = RowGarantia("CvePS").ToString().ToEntero() + Dim CvePS As Integer = RowGarantia("CvePS").ToString().ToEntero() Dim CveTamaño As Integer = RowGarantia("CveTamaño").ToString().ToEntero() Dim CveUM As Integer = RowGarantia("CveUnidadMedida").ToString().ToEntero() Dim PU As Decimal = 0 'valor cero, por tema contable 'RowGarantia("Importe").ToString().ToDecimal() ' / RowGarantia("Cantidad").ToString().ToDouble() @@ -2456,16 +2449,16 @@ Partial Class Inventarios_EntregaAlmacen If Not ErrorMovInv AndAlso TipoMovimiento = 2 AndAlso UsuarioActual.Empresa.Funcionalidad(587) = "1" Then For Each Dr1 As DataRow In DtExistencias.FiltraParametros("CveTipoAlmacenDevolucion = 26").Rows - Dim CveMovimientoSalidaSinCosto = Dr1("CveMovimiento").ToString().ToEntero() + Dim CveMovimientoSalidaSinCosto As Integer = Dr1("CveMovimiento").ToString().ToEntero() 'Dim CveAlmacenSinCosto As Integer = Dr1("CveAlmacenDevolucion").ToString().ToEntero() 'Dim AlmacenSinCosto As String = GlobalDTAlmacen(UsuarioActual.CveEmpresa, CveTipoAlmacen:=26).FiltroPrimeroValor("Almacen", $"CveAlmacen={CveAlmacenSinCosto}").ToString() - Dim CveMovimientoDevolucionSinCosto = ObjInventario.AddMovimiento(DdlAlmacen.SelectedValue.ToEntero(), 41, 1, TxtFecha.Text.ToDate, -1, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, -1, CveVentaSurtir, -1, -1, + Dim CveMovimientoDevolucionSinCosto As Integer = ObjInventario.AddMovimiento(DdlAlmacen.SelectedValue.ToEntero(), 41, 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/G4") - Dim FolioDevSinCosto = ObjInventario.Folio + Dim FolioDevSinCosto As Integer = ObjInventario.Folio If Not CveMovimientoDevolucionSinCosto > 0 Then ErrorMovInv = True @@ -2488,7 +2481,7 @@ Partial Class Inventarios_EntregaAlmacen If ErrorMovInv Then Exit For - Dim DrMovto = DtDevSinCosto.NewRow + Dim DrMovto As DataRow = DtDevSinCosto.NewRow DrMovto("Almacen") = DdlAlmacen.SelectedItem.Text DrMovto("CveAlmacen") = DdlAlmacen.SelectedValue.ToEntero() DrMovto("CveMovimientoEntrada") = CveMovimientoDevolucionSinCosto @@ -2515,7 +2508,7 @@ Partial Class Inventarios_EntregaAlmacen If CveAlmacenTraspasoDestino = DdlAlmacen.SelectedValue.ToEntero() And TipoDocto <> "Rem" Then CveAlmacenTraspasoDestino = 0 If Not ErrorMovInv AndAlso CantidadPendientePorSalir > 0 Then - Dim ConceptoMovimiento = 3 + Dim ConceptoMovimiento As Integer = 3 ConceptoMovimiento = If(TipoMovimiento = 1, ConceptoMovimiento, 18) ConceptoMovimiento = If(CveAlmacenTraspasoDestino > 0, 8, ConceptoMovimiento) @@ -2692,10 +2685,10 @@ Partial Class Inventarios_EntregaAlmacen If TipoMovimiento = 2 Then If ObjInventario.VentasAlmacenApartadosGet(CveVentaSurtir) Then - Dim DtTempApartados = ObjInventario.DtResultados.FiltraParametros("CveTipoAlmacen = 9", "CveAlmacen") - Dim CveMovimientoSalidaApartado = -1 - Dim CveAlmacenApartado = -1 - Dim CveAlmacenOrigen = If(CveAlmacenTraspasoDestino > 0, CveAlmacenTraspasoDestino, DdlAlmacen.SelectedValue.ToEntero()) + Dim DtTempApartados As DataTable = ObjInventario.DtResultados.FiltraParametros("CveTipoAlmacen = 9", "CveAlmacen") + Dim CveMovimientoSalidaApartado As Integer = -1 + Dim CveAlmacenApartado As Integer = -1 + Dim CveAlmacenOrigen As Integer = 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 @@ -2708,7 +2701,7 @@ Partial Class Inventarios_EntregaAlmacen FolioSalida = ObjInventario.Folio CveAlmacenApartado = Dr("CveAlmacen").ToString().ToEntero() - Dim DrMovto = DtTraspasos.NewRow + Dim DrMovto As DataRow = DtTraspasos.NewRow DrMovto("Almacen") = Dr("Almacen").ToString().ToEntero() DrMovto("CveAlmacen") = Dr("CveAlmacen").ToString().ToEntero() DrMovto("CveMovimientoSalida") = CveMovimientoSalidaApartado @@ -2898,7 +2891,7 @@ Partial Class Inventarios_EntregaAlmacen End If For Each RowUsado As DataRow In DtPSVirtual.Rows - Dim CvePS = RowUsado("CvePS").ToString().ToEntero() + Dim CvePS As Integer = RowUsado("CvePS").ToString().ToEntero() Dim CantidadUsado As Decimal = RowUsado("Cantidad").ToString().ToDecimal() Dim PU As Decimal = RowUsado("Cargo").ToString().ToDecimal() Dim CveUM As Integer = RowUsado("CveUM").ToString().ToEntero() @@ -2947,7 +2940,7 @@ Partial Class Inventarios_EntregaAlmacen 'AGREGA BITACORA A VENTA If Not ErrorMovInv Then - Dim MensajeBitacora = If(TipoMovimiento = 1, "Surtida", "Devuelta") + Dim MensajeBitacora As String = If(TipoMovimiento = 1, "Surtida", "Devuelta") If Not ObjEventos.AddEventoBitacora(String.Format("Venta {2} en Folio: {1}", CveMovimiento, Folio, MensajeBitacora), "-1", UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, CveVenta:=CveVentaSurtir) Then ErrorMovInv = True End If @@ -3103,7 +3096,7 @@ Partial Class Inventarios_EntregaAlmacen ValorMultiplicador = -1 End If - Dim CvePrePoliza As Integer = ObjConta.AddPrePolizas("Inventario/EntregaAlmacen", 1, TotalCosto, TotalCosto, 1, Fecha, ClienteNombre, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa) + Dim CvePrePoliza As Integer = ObjConta.AddPrePolizas("Inventario/EntregaAlmacen", 4, TotalCosto, TotalCosto, 1, Fecha, ClienteNombre, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa) 'Se agrega movimiento separado por la cuenta de ventas (ER) If CvePrePoliza > 0 Then @@ -3222,16 +3215,16 @@ Partial Class Inventarios_EntregaAlmacen Dim ObjGeneral As New ClsGenerales(ObjInventario.IniciaTransacSQL()) Dim ObjConta As New ClsContabilidad(ObjInventario.IniciaTransacSQL()) Dim CveMovimientoSalida As Integer - Dim ConceptoMovimiento = 0 + Dim ConceptoMovimiento As Integer = 0 Dim FolioSalida As Integer Dim CveMovimientoEntrada As Integer Dim FolioEntrada As Integer Dim ErrorMovInv As Boolean Dim DtDetalle As New DataTable - Dim TextoError = "" + Dim TextoError As String = "" 'PASA DATOS DEL GV A DATATABLE PARA MANEJOR CON FOR EACH - Dim Index = 0 + Dim Index As Integer = 0 For Each gvr As GridViewRow In GvDatos.Rows If gvr.FCCheckBox("cbInv").Checked AndAlso gvr.FCTextBox("TbCantidadF").Text.ToDecimal > 0 Then DtDatos.Rows(Index)("CantidadGV") = gvr.FCTextBox("TbCantidadF").Text.ToDecimal @@ -3247,7 +3240,7 @@ Partial Class Inventarios_EntregaAlmacen If ObjInventario.EntregaAlmacenTraspasosGet(CveTraspasoSurtir) Then DtDatosTraspaso = ObjInventario.DtResultados End If - Dim CantidadGV = GvDatos.Rows.Cast(Of GridViewRow)().Sum(Function(gvr) gvr.DataKey("CantidadF").ToDecimal) + Dim CantidadGV As Decimal = GvDatos.Rows.Cast(Of GridViewRow)().Sum(Function(gvr) gvr.DataKey("CantidadF").ToDecimal) If DtDatos.SUM("CantidadF") <> DtDatosTraspaso.SUM("CantidadF") Then ObjInventario.RollBack() ObjInventario.Dispose() @@ -3268,8 +3261,8 @@ Partial Class Inventarios_EntregaAlmacen End If 'VALIDA ALMACENES - Dim Almacen1 = DdlAlmacen.SelectedValue.ToEntero() - Dim Almacen2 = CveAlmacenTraspasoDestino + Dim Almacen1 As Integer = DdlAlmacen.SelectedValue.ToEntero() + Dim Almacen2 As Integer = CveAlmacenTraspasoDestino If Almacen1 <= 0 Or Almacen2 <= 0 Then Alert("Ocurrió un error al obtener los almacenes del movimiento. Por favor recargue y vuelva a intentar.", TipoMensaje.MsgAdvertencia) ObjInventario.RollBack() @@ -3299,7 +3292,7 @@ Partial Class Inventarios_EntregaAlmacen Next StrXML.Append("") - Dim TieneErrorExistencia = False + Dim TieneErrorExistencia As Boolean = False If ObjInventario.GetExistenciasPSXML(StrXML.ToString(), DdlAlmacen.SelectedValue.ToEntero(), TxtFecha.Text.ToDateTime.ToString("yyyy/MM/dd HH:mm"), CveSubProyecto, CveVendedor, If(UsuarioActual.Empresa.Funcionalidad(146) = "1", -1, CveCliente), If(TipoEntrega = 2, 1, -1), UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa) Then If ObjInventario.DtResultados.Rows.Count > 0 Then TieneErrorExistencia = True @@ -3502,7 +3495,7 @@ Partial Class Inventarios_EntregaAlmacen Dim Asunto As String = String.Format("{0} Envio de pedido: {1}", UsuarioActual.Empresa.NombreCorto, SerieFolio) Dim Cuerpo As New StringBuilder() Dim Destinatario As String = "" - Dim MensajeEnviado = False + Dim MensajeEnviado As Boolean = False Dim tCvecliente As Integer Dim tCveVendedor As Integer Dim bytes() As Byte = Nothing @@ -3951,7 +3944,7 @@ Partial Class Inventarios_EntregaAlmacen DtDatosSugerencias.Columns.Add("CantidadSeleccionada", GetType(Double)) End If - Dim Index = 1 + Dim Index As Integer = 1 For Each Dr As DataRow In DtDatosSugerencias.Rows Dr("Consec") = Index @@ -4005,7 +3998,7 @@ Partial Class Inventarios_EntregaAlmacen Protected Sub BtnImprimirSugerencias_Click(sender As Object, e As EventArgs) Dim LogoRutaFisica As String = String.Format("Empresas\{0}\Logo.png", UsuarioActual.CveEmpresa) - Dim logouri = String.Format("{0}://{1}:{2}/ashx/sigfiles.ashx?P={3}", Request.Url.Scheme, Request.Url.Host, Request.Url.Port, Encripta(LogoRutaFisica)) + Dim logouri As String = String.Format("{0}://{1}:{2}/ashx/sigfiles.ashx?P={3}", Request.Url.Scheme, Request.Url.Host, Request.Url.Port, Encripta(LogoRutaFisica)) Dim Imagen As New System.IO.FileInfo(String.Format("{0}Logo.png", UsuarioActual.Empresa.Ruta)) Dim params As New List(Of ReportParameter) diff --git a/Inventarios/RecepcionAlmacen.aspx.vb b/Inventarios/RecepcionAlmacen.aspx.vb index 144a7ed28..765935819 100644 --- a/Inventarios/RecepcionAlmacen.aspx.vb +++ b/Inventarios/RecepcionAlmacen.aspx.vb @@ -1711,7 +1711,7 @@ Partial Class Inventarios_RecepcionAlmacen #Region " AGREGA POR SERIE/LOTE " Protected Sub BtnSerie_Click(sender As Object, e As EventArgs) - Dim Argumentos = CType(sender, Button).CommandArgument.Split("°"c) + Dim Argumentos As String() = CType(sender, Button).CommandArgument.Split("°"c) LbProducto.Text = Argumentos(3) LbCantidad.Text = Argumentos(4).FormatoNumero @@ -1969,7 +1969,7 @@ Partial Class Inventarios_RecepcionAlmacen End If End Sub Protected Sub BtnLote_Click(sender As Object, e As EventArgs) - Dim Argumentos = CType(sender, Button).CommandArgument.Split("°"c) + Dim Argumentos As String() = CType(sender, Button).CommandArgument.Split("°"c) LbLoteProducto2.Text = Argumentos(3) LbLoteCantidad2.Text = Argumentos(4).FormatoNumero