From 8ffe137e1630008d98c592fccf8618fa23d2c5f4 Mon Sep 17 00:00:00 2001 From: rrene Date: Thu, 25 Apr 2024 13:56:55 -0700 Subject: [PATCH] =?UTF-8?q?--=20validaci=C3=B3n=20de=20AF.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- OC/OC.aspx.vb | 33 +++++++++++++++++++++++++-------- 1 file changed, 25 insertions(+), 8 deletions(-) diff --git a/OC/OC.aspx.vb b/OC/OC.aspx.vb index c00d99534..f7e559b31 100644 --- a/OC/OC.aspx.vb +++ b/OC/OC.aspx.vb @@ -981,7 +981,7 @@ Partial Class OC_OC Dim Total As Decimal = 0 For Each Dr As DataRow In DtDetalle.Rows - Dim DrPS As DataRow = GlobalDTPS(CveEmpresaActual, CvePS:=Dr("CvePS").ToString.ToEntero).FiltroPrimero("") + Dim DrPS As DataRow = GlobalDTPSSimplificado(CveEmpresaActual, CvePS:=Dr("CvePS").ToString.ToEntero).FiltroPrimero("") If DrPS IsNot Nothing AndAlso DrPS("IVA").ToString.ToEntero = -1 Then Total += Dr("Total").ToString.ToDecimal End If @@ -990,7 +990,7 @@ Partial Class OC_OC Dim Porcentaje As Decimal = TxtIVA.Text.ToDecimal / Total Dim LastDr As DataRow = Nothing For Each Dr As DataRow In DtDetalle.Rows - Dim DrPS As DataRow = GlobalDTPS(CveEmpresaActual, CvePS:=Dr("CvePS").ToString.ToEntero).FiltroPrimero("") + Dim DrPS As DataRow = GlobalDTPSSimplificado(CveEmpresaActual, CvePS:=Dr("CvePS").ToString.ToEntero).FiltroPrimero("") If DrPS IsNot Nothing AndAlso DrPS("IVA").ToString.ToEntero = -1 Then Dr("IVA") = Math.Round(Dr("Total").ToString.ToDecimal * Porcentaje, 6) Dr("IVAPorcentaje") = If(Math.Round(Porcentaje, 2) > 0.14, 0.16, Math.Round(Porcentaje, 2)) @@ -5013,13 +5013,30 @@ Partial Class OC_OC If ObjAF.GetActivosFijos(-1, CveEmpresaActual, LblCodigo.Text, "-1", -1, -1, "-1", -1, -1, -1, -1, -1, "", -1, UsuarioActual.CveEmpresa) Then If ObjAF.DtResultados.Rows.Count = 1 Then - HdnCodigoAF.Value = ObjAF.DtResultados.Rows(0)("Codigo").ToString - HdnCveActivoFijo.Value = ObjAF.DtResultados.Rows(0)("CveActivoFijo").ToString + Dim drr As DataRow = ObjAF.DtResultados.Rows(0) + HdnCodigoAF.Value = drr("Codigo").ToString + HdnCveActivoFijo.Value = drr("CveActivoFijo").ToString + Alert(drr("Codigo").ToString & " - " & drr("Descripcion").ToString, TipoMensaje.ToastInformacion) Else - HdnCodigoAF.Value = "-1" - HdnCveActivoFijo.Value = "-1" - LblCodigo.Text = "" - Alert("No se encontró un Activo Fijo con el código proporcionado.", TipoMensaje.MsgAdvertencia) + If ObjAF.DtResultados.Rows.Count > 1 Then + Dim drr As DataRow = ObjAF.DtResultados.FiltroPrimero($"Codigo ='{LblCodigo.Text.Trim}'") + If drr IsNot Nothing Then + HdnCodigoAF.Value = drr("Codigo").ToString + HdnCveActivoFijo.Value = drr("CveActivoFijo").ToString + Alert(drr("Codigo").ToString & " - " & drr("Descripcion").ToString, TipoMensaje.ToastInformacion) + Else + HdnCodigoAF.Value = "-1" + HdnCveActivoFijo.Value = "-1" + LblCodigo.Text = "" + Alert("No se encontró un Activo Fijo con el código proporcionado.", TipoMensaje.MsgAdvertencia) + End If + Else + HdnCodigoAF.Value = "-1" + HdnCveActivoFijo.Value = "-1" + LblCodigo.Text = "" + Alert("No se encontró un Activo Fijo con el código proporcionado.", TipoMensaje.MsgAdvertencia) + End If + End If End If