From da8f11ebb95bb9e00d63ea17263cc84a1cc8e000 Mon Sep 17 00:00:00 2001 From: rakcsle Date: Thu, 2 Nov 2023 11:28:59 -0700 Subject: [PATCH] Entradas salidas, cambio control fecha --- Inventarios/EntradasSalidas.aspx | 24 +++++--- Inventarios/EntradasSalidas.aspx.vb | 95 ++++++++++++++++++++--------- 2 files changed, 80 insertions(+), 39 deletions(-) diff --git a/Inventarios/EntradasSalidas.aspx b/Inventarios/EntradasSalidas.aspx index ae2dd3728..77cb16eac 100644 --- a/Inventarios/EntradasSalidas.aspx +++ b/Inventarios/EntradasSalidas.aspx @@ -152,10 +152,12 @@
-
-
- -
+
+ + + + + <%--
@@ -170,18 +172,20 @@ -
+
--%> +
-
- + + <%-- +
--%> + -
- +
+
diff --git a/Inventarios/EntradasSalidas.aspx.vb b/Inventarios/EntradasSalidas.aspx.vb index 225110738..e3de650ef 100644 --- a/Inventarios/EntradasSalidas.aspx.vb +++ b/Inventarios/EntradasSalidas.aspx.vb @@ -3,6 +3,7 @@ Option Strict On Imports System.Data Imports System.IO +Imports CrystalDecisions.CrystalReports.ViewerObjectModel Imports Extensiones Partial Class Inventarios_EntradasSalidas @@ -383,13 +384,15 @@ Partial Class Inventarios_EntradasSalidas CreaDT() CargaCombos() - TxtFecha.Text = NowADS().ToShortDateString + + 'TxtFecha.Text = Mov.Fecha.ToDateTime.ToString("yyyy-MM-dd HH:mm:ss").Replace(" ", "T") + TxtFecha.Text = NowADS().ToDateTime.ToString("yyyy-MM-dd HH:mm:ss").Replace(" ", "T") TxtFechaInvFisico.Text = NowADS().ToShortDateString - RVFecha.MaximumValue = NowADS().ToShortDateString + 'RVFecha.MaximumValue = NowADS().ToShortDateString If Not UsuarioActual.CveEmpresa = 48 Then TxtFecha.Enabled = False - ImgFecha.Visible = False + 'ImgFecha.Visible = False End If @@ -468,7 +471,7 @@ Partial Class Inventarios_EntradasSalidas If UsuarioActual.Empresa.Funcionalidad(281).ToEntero = 1 Then TxtFecha.Enabled = False - ImgFecha.Visible = False + 'ImgFecha.Visible = False TxtFechaInvFisico.Enabled = False ImgFechaInvFisico.Visible = False @@ -485,7 +488,7 @@ Partial Class Inventarios_EntradasSalidas If EsConsumoInterno AndAlso UsuarioActual.TienePermisoProceso(340) Then TxtFecha.Enabled = True - ImgFecha.Visible = True + 'ImgFecha.Visible = True End If End If @@ -755,9 +758,9 @@ Partial Class Inventarios_EntradasSalidas CveMovimiento = Mov.CveMovimiento DtMov = Mov.DtResultados - TextBox1.Text = Mov.Fecha.ToDateTime.ToString("yyyy-MM-dd HH:mm:ss").Replace(" ", "T") - TxtFecha.Text = Mov.Fecha.ToShortDateString - TxtHora.Text = Mov.Fecha.ToString("HH:mm") + TxtFecha.Text = Mov.Fecha.ToDateTime.ToString("yyyy-MM-dd HH:mm:ss").Replace(" ", "T") + 'TxtFecha.Text = Mov.Fecha.ToShortDateString + 'TxtHora.Text = Mov.Fecha.ToString("HH:mm") EstatusAlmacenCompra = Mov.EstatusAlmacenCompra Folio = Mov.Folio Dim drM As DataRow = DtMov.Rows(0) @@ -1116,10 +1119,10 @@ Partial Class Inventarios_EntradasSalidas 'BLOQUEA FECHA CUANDO YA SE TIENE POLIZA If HdnIdPoliza.Value.ToEntero > 0 And Not PermiteGuardar() Then TxtFecha.Enabled = False - ImgFecha.Enabled = False + 'ImgFecha.Enabled = False Else TxtFecha.Enabled = True - ImgFecha.Enabled = True + 'ImgFecha.Enabled = True TxtObservaciones.Enabled = True End If @@ -1146,7 +1149,7 @@ Partial Class Inventarios_EntradasSalidas If UsuarioActual.Empresa.Funcionalidad(281).ToEntero = 1 Then TxtFecha.Enabled = False - ImgFecha.Visible = False + 'ImgFecha.Visible = False TxtFechaInvFisico.Enabled = False ImgFechaInvFisico.Visible = False @@ -1410,10 +1413,18 @@ Partial Class Inventarios_EntradasSalidas #Region " AGREGAR - GUARDAR " Private Function GetExistencias(CvePS As Integer, CveUnidadMedida As Integer, CveEmpresa As Integer, CveAlmacen As Integer, Optional CveSeccionAlmacen As Integer = -1, Optional Serie As String = "-1", Optional Lote As String = "-1", Optional FechaCaducidad As Date = MinFecha) As Decimal + + Dim FechaMovimiento As DateTime = TxtFecha.Text.Replace(",", "").ToDateTime + Dim FechaMovtoStr As String = $"{FechaMovimiento.ToString("yyyy/MM/dd")} {FechaMovimiento.ToString("hh:mm")}" + Dim Inv As New ClsInventarios - Dim Existencia As Decimal = Inv.GetExistenciasPS(CvePS, CveUnidadMedida, CveEmpresa, CveAlmacen, CveSeccionAlmacen:=CveSeccionAlmacen, FechaMovto:=String.Format("{0} {1}", TxtFecha.Text.ToDate.ToString("yyyy/MM/dd"), TxtHora.Text), Serie:=Serie, Lote:=Lote, FechaCaducidad:=FechaCaducidad) + + + Dim Existencia As Decimal = Inv.GetExistenciasPS(CvePS, CveUnidadMedida, CveEmpresa, CveAlmacen, CveSeccionAlmacen:=CveSeccionAlmacen, FechaMovto:=FechaMovtoStr, Serie:=Serie, Lote:=Lote, FechaCaducidad:=FechaCaducidad) Inv.Dispose() + Return Existencia + End Function 'Protected Sub btnAgregar_Click(sender As Object, e As EventArgs) Handles LbAgregar.Click @@ -1587,6 +1598,20 @@ Partial Class Inventarios_EntradasSalidas End Sub Protected Sub BtnGuardar_Click(sender As Object, e As EventArgs) Handles BtnGuardar.Click + + If Not IsDate(TxtFecha.Text.Replace(",", "")) Then + Alert("Debe seleccioanr una fecha valida", TipoMensaje.MsgAdvertencia) + Exit Sub + End If + + + If TxtFecha.Text.Replace(",", "").ToDate.ToString("dd/MM/yyyy").ToDate > NowADS().ToString("dd/MM/yyyy").ToDate Then + Alert("El campo ''Fecha'' no puede ser mayor al dia actual. Por favor verifcar", TipoMensaje.MsgAdvertencia) + Exit Sub + End If + + + If EsNuevoMov Then CveMovimiento = 0 End If @@ -1626,17 +1651,24 @@ Partial Class Inventarios_EntradasSalidas ActivoFijo = DdlActivoFijo.SelectedValue.ToEntero End If + Dim FechaMovimiento As DateTime = TxtFecha.Text.Replace(",", "").ToDateTime + Dim FechaMovtoStr As String = $"{FechaMovimiento.ToString("yyyy/MM/dd")} {FechaMovimiento.ToString("hh:mm:ss")}" + 'ACTUALIZAR If CveMovimiento > 0 Then Dim Mensaje As String = "" 'Actualiza Movimiento - If Not ObjInventario.UpdateMovimiento(CveMovimiento, DdlAlmacen.SelectedValue.ToEntero, DdlConcepto.SelectedValue.ToEntero, 1, String.Format("{0} {1}", TxtFecha.Text.ToDate.ToString("yyyy/MM/dd"), TxtHora.Text).ToDate, + + + + If Not ObjInventario.UpdateMovimiento(CveMovimiento, DdlAlmacen.SelectedValue.ToEntero, DdlConcepto.SelectedValue.ToEntero, 1, FechaMovimiento, TxtFolio.Text.ToEntero, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, -1, -1, SubProyecto, ActivoFijo, Guia:=TxtGuia.Text, Observaciones:=TxtObservaciones.Text) Then Mensaje = "Error al Actualizar el Movimiento" ErrorMovInv = True End If + If Not ErrorMovInv Then ' Actualizo los movimientos @@ -1644,7 +1676,7 @@ Partial Class Inventarios_EntradasSalidas 'Determina PU dependiendo MONEDA If DdlConcepto.SelectedValue.ToEntero = 2 AndAlso DdlMoneda.SelectedValue.ToEntero = 2 Then - ImporteConcepto = Dr("PU").ToString.ToDecimal * GlobalTipoCambio(TxtFecha.Text.ToDate).ToDecimal + ImporteConcepto = Dr("PU").ToString.ToDecimal * GlobalTipoCambio(TxtFecha.Text.Replace(",", "").ToDate).ToDecimal Else ImporteConcepto = Dr("PU").ToString.ToDecimal End If @@ -1670,7 +1702,11 @@ Partial Class Inventarios_EntradasSalidas Else If GlobalDTInvConceptos.FiltraParametros(String.Format("CveConcepto = {0}", DdlConcepto.SelectedValue.ToEntero)).Rows.Count > 0 AndAlso GlobalDTInvConceptos.FiltraParametros(String.Format("CveConcepto = {0}", DdlConcepto.SelectedValue.ToEntero)).Rows(0)("Origen").ToString.ToEntero < 0 Then - If ObjInventario.GetExistenciasPS(Dr("CvePS").ToString.ToEntero, Dr("CveUM").ToString.ToEntero, UsuarioActual.CveEmpresa, CveAlmacen:=DdlAlmacen.SelectedValue.ToEntero, FechaMovto:=String.Format("{0} {1}", TxtFecha.Text.ToDate.ToString("yyyy/MM/dd"), TxtHora.Text), Serie:=If(Dr("Serie").ToString = "", "-1", Dr("Serie").ToString), Lote:=If(Dr("Lote").ToString = "", "-1", Dr("Lote").ToString)) >= Dr("Cantidad").ToString.ToDouble Then + + + Dim FechaMovtoExistenciaStr As String = $"{FechaMovimiento.ToString("yyyy/MM/dd")} {FechaMovimiento.ToString("hh:mm")}" + + If ObjInventario.GetExistenciasPS(Dr("CvePS").ToString.ToEntero, Dr("CveUM").ToString.ToEntero, UsuarioActual.CveEmpresa, CveAlmacen:=DdlAlmacen.SelectedValue.ToEntero, FechaMovto:=FechaMovtoExistenciaStr, Serie:=If(Dr("Serie").ToString = "", "-1", Dr("Serie").ToString), Lote:=If(Dr("Lote").ToString = "", "-1", Dr("Lote").ToString)) >= Dr("Cantidad").ToString.ToDouble Then If Not ObjInventario.AddMovimientoDetalle(CveMovimiento, Dr("Cantidad").ToString.ToDouble, Dr("CveUM").ToString.ToEntero, Dr("CvePS").ToString.ToEntero, ImporteConcepto, CveAF:=Dr("CveAF").ToString.ToEntero, CveSeccionAlmacen:=Dr("CveSeccionAlmacen").ToString.ToEntero, Serie:=Dr("Serie").ToString, Observaciones:=Dr("Observaciones").ToString, Lote:=Dr("Lote").ToString, FechaCaducidad:=Dr("FechaCaducidad").ToString.ToDate, CveUsuarioModifico:=UsuarioActual.CveUsuario, CveCultivoCuadroDetalle:=Dr("CveCultivoCuadroDetalle").ToString.ToEntero) Then Mensaje = "Error al Agregar los nuevos movimientos" ErrorMovInv = True : Exit For @@ -1721,9 +1757,9 @@ Partial Class Inventarios_EntradasSalidas End If If CuentaCargoCOG > 0 AndAlso CuentaAbonoAlmacen > 0 Then - If ObjContaAC.AddMovimiento(IDPoliza, CuentaCargoCOG, False, Importe, "", "", 0, TxtFecha.Text.ToDate, "") Then + If ObjContaAC.AddMovimiento(IDPoliza, CuentaCargoCOG, False, Importe, "", "", 0, TxtFecha.Text.Replace(",", "").ToDate, "") Then 'actualizo el idcuenta del presupuesto - If Not ObjContaAC.AddMovimiento(IDPoliza, CuentaAbonoAlmacen, True, Importe, "", "", 0, TxtFecha.Text.ToDate, "") Then + If Not ObjContaAC.AddMovimiento(IDPoliza, CuentaAbonoAlmacen, True, Importe, "", "", 0, TxtFecha.Text.Replace(",", "").ToDate, "") Then ErrorAC = True End If Else @@ -1759,7 +1795,7 @@ Partial Class Inventarios_EntradasSalidas 'GUARDAR Else - Dim Fecha As Date = String.Format("{0} {1}", TxtFecha.Text.ToDate.ToString("yyyy/MM/dd"), TxtHora.Text).ToDate + Dim Fecha As DateTime = FechaMovimiento Dim CveCliente As Integer = CInt(IIf((DdlClientes.SelectedValue.ToEntero <= 0), -1, DdlClientes.SelectedValue.ToEntero)) Dim CveClienteSucursal As Integer = CInt(IIf((DdlClientesSucursales.SelectedValue.ToEntero <= 0), -1, DdlClientesSucursales.SelectedValue.ToEntero)) @@ -1785,7 +1821,7 @@ Partial Class Inventarios_EntradasSalidas Dim TotalCantidad As Double = DtMovimientos.SUMD("Cantidad") - Dim CvePrePoliza As Integer = ObjConta.AddPrePolizas("Inv/ES", 53, 0, 0, 1, TxtFecha.Text.ToDate, obs, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, CveTipoPoliza:=3) + Dim CvePrePoliza As Integer = ObjConta.AddPrePolizas("Inv/ES", 53, 0, 0, 1, TxtFecha.Text.Replace(",", "").ToDate, obs, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, CveTipoPoliza:=3) CveMovimiento = ObjInventario.AddMovimiento(CveAlmacen, DdlConcepto.SelectedValue.ToEntero, 1, Fecha, tFolio, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, -1, -1, SubProyecto, ActivoFijo, Guia:=TxtGuia.Text, Observaciones:=TxtObservaciones.Text, CvePersonal:=DdlPersonal.SelectedValue.ToEntero, Recibio:=TxtResponsable.Text.Trim, CveCliente:=CveCliente, CveClienteSucursal:=CveClienteSucursal, DepartamentoEntrega:=TxtDepartamentoEntrega.Text, PedidoContrato:=TxtPedidoContrato.Text, CveProveedor:=tCveProveedor, Modulo:="ES/1") @@ -1802,7 +1838,8 @@ Partial Class Inventarios_EntradasSalidas If DdlConcepto.SelectedValue.Contiene({"3", "11", "13", "21", "30", "31"}) Then For Each Dr As DataRow In DtMovimientos.Rows Dim FechaCaducidadVal As Date = If(Dr("AplicaCaducidad").ToString = "True", Dr("FechaCaducidad").ToString.ToDate, MinFecha) - If ObjInventario.GetExistenciasPS(Dr("CvePS").ToString.ToEntero, Dr("CveUM").ToString.ToEntero, UsuarioActual.CveEmpresa, DdlAlmacen.SelectedValue.ToEntero, FechaMovto:=String.Format("{0} {1}", TxtFecha.Text.ToDate.ToString("yyyy/MM/dd"), TxtHora.Text), Serie:=If(Dr("Serie").ToString = "", "-1", Dr("Serie").ToString), Lote:=If(Dr("Lote").ToString = "", "-1", Dr("Lote").ToString), FechaCaducidad:=FechaCaducidadVal) >= Dr("Cantidad").ToString.ToDouble Then + Dim FechaMovtoExistenciaStr As String = $"{FechaMovimiento.ToString("yyyy/MM/dd")} {FechaMovimiento.ToString("hh:mm")}" + If ObjInventario.GetExistenciasPS(Dr("CvePS").ToString.ToEntero, Dr("CveUM").ToString.ToEntero, UsuarioActual.CveEmpresa, DdlAlmacen.SelectedValue.ToEntero, FechaMovto:=FechaMovtoExistenciaStr, Serie:=If(Dr("Serie").ToString = "", "-1", Dr("Serie").ToString), Lote:=If(Dr("Lote").ToString = "", "-1", Dr("Lote").ToString), FechaCaducidad:=FechaCaducidadVal) >= Dr("Cantidad").ToString.ToDouble Then If Not ObjInventario.AddMovimientoDetalle(CveMovimiento, Dr("Cantidad").ToString.ToDouble, Dr("CveUM").ToString.ToEntero, Dr("CvePS").ToString.ToEntero, Dr("PU").ToString.ToDecimal, Dr("CveAF").ToString.ToEntero, CveSeccionAlmacen:=Dr("CveSeccionAlmacen").ToString.ToEntero, Serie:=Dr("Serie").ToString, Observaciones:=Dr("Observaciones").ToString, Lote:=Dr("Lote").ToString, FechaCaducidad:=FechaCaducidadVal, CveUsuarioModifico:=UsuarioActual.CveUsuario, CveCultivoCuadroDetalle:=Dr("CveCultivoCuadroDetalle").ToString.ToEntero) Then Mensaje = "Error al guardar los movimientos" @@ -1841,7 +1878,7 @@ Partial Class Inventarios_EntradasSalidas Else For Each Dr As DataRow In DtMovimientos.Rows If DdlConcepto.SelectedValue.ToEntero = 2 AndAlso DdlMoneda.SelectedValue.ToEntero = 2 Then - ImporteConcepto = Dr("PU").ToString.ToDecimal * GlobalTipoCambio(TxtFecha.Text.ToDate).ToDecimal + ImporteConcepto = Dr("PU").ToString.ToDecimal * GlobalTipoCambio(TxtFecha.Text.Replace(",", "").ToDate).ToDecimal Else ImporteConcepto = Dr("PU").ToString.ToDecimal End If @@ -2008,7 +2045,7 @@ Partial Class Inventarios_EntradasSalidas End If AC.Dispose() - IDPoliza = ObjContaAC.AddPoliza(3, "Salida de Almacen", TotalPorDevengar, TotalPorDevengar, UsuarioActual.CveUsuario, TxtFecha.Text.ToDate) + IDPoliza = ObjContaAC.AddPoliza(3, "Salida de Almacen", TotalPorDevengar, TotalPorDevengar, UsuarioActual.CveUsuario, TxtFecha.Text.Replace(",", "").ToDate) If IDPoliza > 0 Then Dim CuentaCargoCOG As Integer @@ -2034,9 +2071,9 @@ Partial Class Inventarios_EntradasSalidas If Importe > 0 Then If CuentaCargoCOG > 0 AndAlso CuentaAbonoAlmacen > 0 Then - If ObjContaAC.AddMovimiento(IDPoliza, CuentaCargoCOG, False, Importe, "", ConceptoRenglon, 0, TxtFecha.Text.ToDate, "") Then + If ObjContaAC.AddMovimiento(IDPoliza, CuentaCargoCOG, False, Importe, "", ConceptoRenglon, 0, TxtFecha.Text.Replace(",", "").ToDate, "") Then 'actualizo el idcuenta del presupuesto - If Not ObjContaAC.AddMovimiento(IDPoliza, CuentaAbonoAlmacen, True, Importe, "", ConceptoRenglon, 0, TxtFecha.Text.ToDate, "") Then + If Not ObjContaAC.AddMovimiento(IDPoliza, CuentaAbonoAlmacen, True, Importe, "", ConceptoRenglon, 0, TxtFecha.Text.Replace(",", "").ToDate, "") Then ErrorAC = True Mensaje = "No se pudo insertar movimiento en la poliza 2." End If @@ -2252,7 +2289,7 @@ Partial Class Inventarios_EntradasSalidas Dim ObjInv As New ClsInventarios If CveMovimiento <= 0 Then - CveMovimiento = ObjInv.AddMovimiento(DdlAlmacen.SelectedValue.ToEntero, DdlConcepto.SelectedValue.ToEntero, 1, TxtFecha.Text.ToDate, TxtFolio.Text.ToEntero, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, -1, -1, -1, -1, Modulo:="ES/CS1") + CveMovimiento = ObjInv.AddMovimiento(DdlAlmacen.SelectedValue.ToEntero, DdlConcepto.SelectedValue.ToEntero, 1, TxtFecha.Text.Replace(",", "").ToDate, TxtFolio.Text.ToEntero, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, -1, -1, -1, -1, Modulo:="ES/CS1") End If ObjInv.AddMovimientoDetalle(CveMovimiento, Cantidad, CveUM, CvePS, CostoPromedio, -1, Serie:=SerieLote) @@ -2966,7 +3003,7 @@ Partial Class Inventarios_EntradasSalidas Dim ErrorAC As Boolean = False Dim TotalPorDevengar As Double = 0 Dim Folio As String = "" - Dim Fecha As Date = TxtFecha.Text.ToDate + Dim Fecha As Date = TxtFecha.Text.Replace(",", "").ToDate 'cuando tiene AC y es salida de almacen, se manda al gasto @@ -3832,7 +3869,7 @@ Partial Class Inventarios_EntradasSalidas If tmpCostos.Rows.Count > 0 Then Dim Concepto As String = If(TxtObservaciones.Text = "", ConceptoPoliza, $" {TxtObservaciones.Text}") - Dim CvePrePoliza As Integer = ObjConta.AddPrePolizas("Inv_EntradaSalida", 74, DtCostos.SUM("Total"), DtCostos.SUM("Total"), 1, TxtFecha.Text.ToDate, ConceptoPoliza, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa) + Dim CvePrePoliza As Integer = ObjConta.AddPrePolizas("Inv_EntradaSalida", 74, DtCostos.SUM("Total"), DtCostos.SUM("Total"), 1, TxtFecha.Text.Replace(",", "").ToDate, ConceptoPoliza, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa) CvePrePolizaRegistrada = CvePrePoliza If HplCompra.Visible AndAlso HplCompra.Text <> "" Then @@ -4078,7 +4115,7 @@ Partial Class Inventarios_EntradasSalidas If DdlPS.SelectedValue.ToEntero > 0 Then Dim ObjInventario As New ClsInventarios - Dim CostoPromedio As Decimal = ObjInventario.GetCostoPS(DdlPS.SelectedValue.ToEntero, txtCantidad.Text.ToDouble, DdlAlmacenInventarioFisico.SelectedValue.ToEntero, "", TxtFecha.Text.ToDate) + Dim CostoPromedio As Decimal = ObjInventario.GetCostoPS(DdlPS.SelectedValue.ToEntero, txtCantidad.Text.ToDouble, DdlAlmacenInventarioFisico.SelectedValue.ToEntero, "", TxtFecha.Text.Replace(",", "").ToDate) 'GlobalDTPS(UsuarioActual.CveEmpresa, DdlPS.SelectedValue.ToEntero).FiltroPrimeroValor("CostoPromedio", "").ToDecimal If CostoPromedio > 0 Then @@ -5437,7 +5474,7 @@ Partial Class Inventarios_EntradasSalidas If DtPSVirtual IsNot Nothing AndAlso DtPSVirtual.Rows.Count > 0 Then - CveMovimientoVirtual = ObjInventario.AddMovimiento(CveAlmacenVirtual, If(tOrigen > 0, 36, 37), 1, TxtFecha.text.todate, -1, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, -1, -1, -1, -1, CveMovimientoRelacionado:=CveMovimiento, Observaciones:=TxtObservaciones.Text.Trim, Modulo:="ES/GV") + CveMovimientoVirtual = ObjInventario.AddMovimiento(CveAlmacenVirtual, If(tOrigen > 0, 36, 37), 1, TxtFecha.Text.Replace(",", "").ToDate, -1, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, -1, -1, -1, -1, CveMovimientoRelacionado:=CveMovimiento, Observaciones:=TxtObservaciones.Text.Trim, Modulo:="ES/GV") FolioVirtual = ObjInventario.Folio For Each RowUsado As DataRow In DtPSVirtual.Rows