From 07f7c39fdddddbbfcbdc6bee1578aae54ac70a5b Mon Sep 17 00:00:00 2001 From: JORGE LUIS CAUDILLO ESPARZA Date: Thu, 15 Aug 2019 12:49:13 -0700 Subject: [PATCH] --- App_Code/Modelos.vb | 5 +- Bancos/PopIECompras.aspx | 2 +- Bancos/PopIECompras.aspx.vb | 96 +++++++++++++++++++++++++++++--- Bancos/PopIEVentas.aspx.vb | 4 +- Bancos/ProveedoresAbonar.aspx | 2 +- Bancos/ProveedoresAbonar.aspx.vb | 83 +++++++++++++++++++++++---- 6 files changed, 168 insertions(+), 24 deletions(-) diff --git a/App_Code/Modelos.vb b/App_Code/Modelos.vb index 4d78eadb3..41b6f6116 100644 --- a/App_Code/Modelos.vb +++ b/App_Code/Modelos.vb @@ -1181,13 +1181,14 @@ Namespace Modelos 'Se agregan los PS For Each Row As DataRow In TmpDTDetalle.Rows If Not ObjVentas.AddVentaDetalle(ObjVentas.CveVenta, Row("CvePS").ToString.ToEntero, Row("Cantidad").ToString.ToDouble, Row("CveUM").ToString.ToEntero, - Row("PU").ToString.ToDouble(If(factura.ConvertirPesos, factura.TipoCambio, 1)), Row("IVA").ToString.ToDouble(If(factura.ConvertirPesos, factura.TipoCambio, 1)), Math.Round((Row("Total").ToString.ToDouble(If(factura.ConvertirPesos, factura.TipoCambio, 1)) * (1 + Row("IVA").ToString.ToDouble(If(factura.ConvertirPesos, factura.TipoCambio, 1)))), 6), + Row("PU").ToString.ToDouble(If(factura.ConvertirPesos, factura.TipoCambio, 1)), Row("ImporteIVA").ToString.ToDouble(If(factura.ConvertirPesos, factura.TipoCambio, 1)), Math.Round((Row("Total").ToString.ToDouble(If(factura.ConvertirPesos, factura.TipoCambio, 1)) * (1 + Row("PorcentajeIVA").ToString.ToDouble(If(factura.ConvertirPesos, factura.TipoCambio, 1)))), 6), Row("Obs").ToString, Row("Descuento").ToString.ToDouble(If(factura.ConvertirPesos, factura.TipoCambio, 1)), Row("TipoDescuento").ToString.ToEntero, Row("CveSubProyecto").ToString.ToEntero, Row("CvePresupuestoIngreso").ToString.ToEntero, TiempoEntrega:=Row("TiempoEntrega").ToString, CveVentaDetallePadre:=Row("CveVentaDetalle").ToString.ToEntero, CveContratoDetalle:=Row("CveContratoDetalle").ToString.ToEntero, CvePromocionDetalle:=If(DtPromociones IsNot Nothing, DtPromociones.FiltroPrimeroValor("CvePromocionDetalle", $"CvePS={Row("CvePS").ToString}").ToEntero, -1), IEPS:=Row("ImporteIEPS").ToString.ToDouble, CveMovimientoDetallePedido:=Row("CveMovimientoDetallePedido").ToString.ToEntero, ImporteRetIVA:=Row("ImporteRetIVA").ToString.ToDouble, ImporteRetISR:=Row("ImporteRetISR").ToString.ToDouble, - PorcentajeIEPS:=Row("PorcentajeIEPS").ToString.ToDouble, PorcentajeRetIVA:=Row("PorcentajeRetIVA").ToString.ToDouble, PorcentajeRetISR:=Row("PorcentajeRetISR").ToString.ToDouble, CuentaPredial:=Row("CuentaPredial").ToString) Then + PorcentajeIEPS:=Row("PorcentajeIEPS").ToString.ToDouble, PorcentajeRetIVA:=Row("PorcentajeRetIVA").ToString.ToDouble, PorcentajeRetISR:=Row("PorcentajeRetISR").ToString.ToDouble, CuentaPredial:=Row("CuentaPredial").ToString, + PorcentajeIVA:=Row("PorcentajeIVA").ToString.ToDecimal) Then ErrorList.Add("Ocurrió un error al agregar un Producto o Servicio a la factura.
Revise su factura y cualquier detalle comuníquese a Soporte Técnico") Exit For Else diff --git a/Bancos/PopIECompras.aspx b/Bancos/PopIECompras.aspx index dcc1b2cb0..9d8a06644 100644 --- a/Bancos/PopIECompras.aspx +++ b/Bancos/PopIECompras.aspx @@ -11,7 +11,7 @@   - + diff --git a/Bancos/PopIECompras.aspx.vb b/Bancos/PopIECompras.aspx.vb index 8e42df1f3..683e35fd7 100644 --- a/Bancos/PopIECompras.aspx.vb +++ b/Bancos/PopIECompras.aspx.vb @@ -307,6 +307,8 @@ Partial Class Bancos_PopIECompras Public Class IEMovimiento Public Property SubTotal As Decimal Public Property IVA As Decimal + Public Property IVADeducible As Decimal + Public Property IVANoDeducible As Decimal Public Property RetIVA As Decimal Public Property RetISR As Decimal Public Property Total As Decimal @@ -615,6 +617,8 @@ Partial Class Bancos_PopIECompras MovimientoPagar = New IEMovimiento MovimientoPagar.SubTotal = dr("SubTotal").ToString.ToDecimal MovimientoPagar.IVA = dr("IVA").ToString.ToDecimal + MovimientoPagar.IVADeducible = dr("IVADeducible").ToString.ToDecimal + MovimientoPagar.IVANoDeducible = dr("IVANoDeducible").ToString.ToDecimal MovimientoPagar.RetIVA = dr("RetIVA").ToString.ToDecimal MovimientoPagar.RetISR = dr("RetISR").ToString.ToDecimal MovimientoPagar.Total = dr("Total").ToString.ToDecimal @@ -2250,16 +2254,16 @@ Partial Class Bancos_PopIECompras If TotalImporte = CompraSaldo Then If CveMoneda = 1 AndAlso CveMonedaCompra = 1 Then - ImporteMovimiento = MovimientoPagar.IVA + ImporteMovimiento = MovimientoPagar.IVADeducible ImporteMX = ImporteMovimiento ElseIf CveMoneda = 1 AndAlso CveMonedaCompra = 2 Then - ImporteMovimiento = (MovimientoPagar.IVA) + ImporteMovimiento = (MovimientoPagar.IVADeducible) ImporteMX = ImporteMovimiento * If(FuncionalidadFluctuacionImpuestos, tipoCambioPago, tipoCambioCompra) ElseIf CveMoneda = 2 AndAlso CveMonedaCompra = 1 Then - ImporteMovimiento = (MovimientoPagar.IVA) + ImporteMovimiento = (MovimientoPagar.IVADeducible) ImporteMX = ImporteMovimiento * tipoCambioCompra ElseIf CveMoneda = 2 AndAlso CveMonedaCompra = 2 Then - ImporteMovimiento = (MovimientoPagar.IVA) + ImporteMovimiento = (MovimientoPagar.IVADeducible) ImporteMX = ImporteMovimiento * If(FuncionalidadFluctuacionImpuestos, tipoCambioPago, tipoCambioCompra) End If ImporteMovimiento = Math.Round(ImporteMovimiento, 2) @@ -2273,16 +2277,92 @@ Partial Class Bancos_PopIECompras End If Else If CveMoneda = 1 AndAlso CveMonedaCompra = 1 Then - ImporteMovimiento = MovimientoPagar.IVA * PorcentajePago + ImporteMovimiento = MovimientoPagar.IVADeducible * PorcentajePago ImporteMX = ImporteMovimiento ElseIf CveMoneda = 1 AndAlso CveMonedaCompra = 2 Then - ImporteMovimiento = (MovimientoPagar.IVA * PorcentajePago) + ImporteMovimiento = (MovimientoPagar.IVADeducible * PorcentajePago) ImporteMX = ImporteMovimiento * If(FuncionalidadFluctuacionImpuestos, tipoCambioPago, tipoCambioCompra) ElseIf CveMoneda = 2 AndAlso CveMonedaCompra = 1 Then - ImporteMovimiento = (MovimientoPagar.IVA * PorcentajePago) + ImporteMovimiento = (MovimientoPagar.IVADeducible * PorcentajePago) ImporteMX = ImporteMovimiento * tipoCambioCompra ElseIf CveMoneda = 2 AndAlso CveMonedaCompra = 2 Then - ImporteMovimiento = (MovimientoPagar.IVA * PorcentajePago) + ImporteMovimiento = (MovimientoPagar.IVADeducible * PorcentajePago) + ImporteMX = ImporteMovimiento * If(FuncionalidadFluctuacionImpuestos, tipoCambioPago, tipoCambioCompra) + End If + ImporteMovimiento = Math.Round(ImporteMovimiento, 2) + ImporteMX = Math.Round(ImporteMX, 2) + TimpocambioGeneral = If(FuncionalidadFluctuacionImpuestos, tipoCambioPago, tipoCambioCompra) + + If tipoCambioPago > 1 Then ConceptoMovimiento += $" TC:{tipoCambioPago} ${ImporteMovimiento.FormatoNumero(2)}" + End If + + PorcentajeImpuesto = MovimientoPagar.PorcentajeIVA + Dim IdCtaIVAXAcreditar As Integer = 0 + Dim IdCtaIVAAcreditable As Integer = 0 + + If GlobalDTClasificacionPorcentaje(UsuarioActual.CveEmpresa, PorcentajeIVA:=PorcentajeImpuesto).Rows.Count > 0 Then + IdCtaIVAXAcreditar = GlobalDTClasificacionPorcentaje(UsuarioActual.CveEmpresa, PorcentajeIVA:=PorcentajeImpuesto).Rows(0)("IdCtaIVAXAcreditar").ToString.ToEntero + IdCtaIVAAcreditable = GlobalDTClasificacionPorcentaje(UsuarioActual.CveEmpresa, PorcentajeIVA:=PorcentajeImpuesto).Rows(0)("IdCtaIVAAcreditable").ToString.ToEntero + End If + + IdCtaContable = If(IdCtaIVAAcreditable > 0, IdCtaIVAAcreditable, 0) + + If ObjMov.GetRetCuenta(ConceptoContable, UsuarioActual.CveEmpresa) And Not IdCtaContable > 0 Then + If ObjMov.DtResultados.Rows.Count > 0 Then + IdCtaContable = ObjMov.DtResultados.Rows(0)("IdCuentaIVAAcreditable").ToString.ToEntero + CveCuenta = ObjMov.DtResultados.Rows(0)("IdCuentaIVAAcreditableSIG").ToString.ToEntero + End If + End If + Case 280 'Iva Acreditable No Deducible + If UsuarioActual.Empresa.Funcionalidad(521) = "1" Then + 'funcionalidad que toma el 100% del pago para acreditamiento de iva + Dim TotalImporte As Decimal + + If CveMoneda = 1 AndAlso CveMonedaCompra = 1 Then + TotalImporte = ImportePagado.ToString.ToDecimal + ElseIf CveMoneda = 1 AndAlso CveMonedaCompra = 2 Then + TotalImporte = Math.Round(ImportePagado.ToString.ToDecimal / tipoCambioPago, 2) + ElseIf CveMoneda = 2 AndAlso CveMonedaCompra = 1 Then + TotalImporte = Math.Round(ImportePagado.ToString.ToDecimal * tipoCambioPago, 2) + ElseIf CveMoneda = 2 AndAlso CveMonedaCompra = 2 Then + TotalImporte = ImportePagado.ToString.ToDecimal + End If + + If TotalImporte = CompraSaldo Then + If CveMoneda = 1 AndAlso CveMonedaCompra = 1 Then + ImporteMovimiento = MovimientoPagar.IVANoDeducible + ImporteMX = ImporteMovimiento + ElseIf CveMoneda = 1 AndAlso CveMonedaCompra = 2 Then + ImporteMovimiento = (MovimientoPagar.IVANoDeducible) + ImporteMX = ImporteMovimiento * If(FuncionalidadFluctuacionImpuestos, tipoCambioPago, tipoCambioCompra) + ElseIf CveMoneda = 2 AndAlso CveMonedaCompra = 1 Then + ImporteMovimiento = (MovimientoPagar.IVANoDeducible) + ImporteMX = ImporteMovimiento * tipoCambioCompra + ElseIf CveMoneda = 2 AndAlso CveMonedaCompra = 2 Then + ImporteMovimiento = (MovimientoPagar.IVANoDeducible) + ImporteMX = ImporteMovimiento * If(FuncionalidadFluctuacionImpuestos, tipoCambioPago, tipoCambioCompra) + End If + ImporteMovimiento = Math.Round(ImporteMovimiento, 2) + ImporteMX = Math.Round(ImporteMX, 2) + TimpocambioGeneral = If(FuncionalidadFluctuacionImpuestos, tipoCambioPago, tipoCambioCompra) + + If tipoCambioPago > 1 Then ConceptoMovimiento += $" TC:{tipoCambioPago} ${ImporteMovimiento.FormatoNumero(2)}" + Else + ImporteMovimiento = 0 + ImporteMX = 0 + End If + Else + If CveMoneda = 1 AndAlso CveMonedaCompra = 1 Then + ImporteMovimiento = MovimientoPagar.IVANoDeducible * PorcentajePago + ImporteMX = ImporteMovimiento + ElseIf CveMoneda = 1 AndAlso CveMonedaCompra = 2 Then + ImporteMovimiento = (MovimientoPagar.IVANoDeducible * PorcentajePago) + ImporteMX = ImporteMovimiento * If(FuncionalidadFluctuacionImpuestos, tipoCambioPago, tipoCambioCompra) + ElseIf CveMoneda = 2 AndAlso CveMonedaCompra = 1 Then + ImporteMovimiento = (MovimientoPagar.IVANoDeducible * PorcentajePago) + ImporteMX = ImporteMovimiento * tipoCambioCompra + ElseIf CveMoneda = 2 AndAlso CveMonedaCompra = 2 Then + ImporteMovimiento = (MovimientoPagar.IVANoDeducible * PorcentajePago) ImporteMX = ImporteMovimiento * If(FuncionalidadFluctuacionImpuestos, tipoCambioPago, tipoCambioCompra) End If ImporteMovimiento = Math.Round(ImporteMovimiento, 2) diff --git a/Bancos/PopIEVentas.aspx.vb b/Bancos/PopIEVentas.aspx.vb index 9a60d6198..9715941cf 100644 --- a/Bancos/PopIEVentas.aspx.vb +++ b/Bancos/PopIEVentas.aspx.vb @@ -2062,7 +2062,7 @@ Partial Class Bancos_PopIEVentas IdCtaContable = UsuarioActual.Empresa.IdCuentaGananciaCambiaria CveCuenta = UsuarioActual.Empresa.CveCuentaGananciaCambiaria tipoCambioVentaDiferenciaCambiaria = If(FechaVenta < FechaUltimaFluctuacion, TipoCambioFluctuacion, TipoCambioOriginal) - Dim TCImpuestos As Decimal = If(FuncionalidadFluctuacionImpuestos, tipoCambioPago, tipoCambioVenta) + Dim TCImpuestos As Decimal = If(FuncionalidadFluctuacionImpuestos, tipoCambioPago, tipoCambioVentaDiferenciaCambiaria) TimpocambioGeneral = TCImpuestos Dim Diferencia As Decimal = ((MovimientoPagar.Total * PorcentajePago) * tipoCambioVentaValuacion) - ((MovimientoPagar.Total * PorcentajePago) * tipoCambioPago) 'Añadimos la diferencia de perdida en la venta @@ -2090,7 +2090,7 @@ Partial Class Bancos_PopIEVentas IdCtaContable = UsuarioActual.Empresa.IdCuentaPerdidaCambiaria CveCuenta = UsuarioActual.Empresa.CveCuentaPerdidaCambiaria tipoCambioVentaDiferenciaCambiaria = If(FechaVenta < FechaUltimaFluctuacion, TipoCambioFluctuacion, TipoCambioOriginal) - Dim TCImpuestos As Decimal = If(FuncionalidadFluctuacionImpuestos, tipoCambioPago, tipoCambioVenta) + Dim TCImpuestos As Decimal = If(FuncionalidadFluctuacionImpuestos, tipoCambioPago, tipoCambioVentaDiferenciaCambiaria) TimpocambioGeneral = TCImpuestos diff --git a/Bancos/ProveedoresAbonar.aspx b/Bancos/ProveedoresAbonar.aspx index fd65df3b5..dec829379 100644 --- a/Bancos/ProveedoresAbonar.aspx +++ b/Bancos/ProveedoresAbonar.aspx @@ -358,7 +358,7 @@ diff --git a/Bancos/ProveedoresAbonar.aspx.vb b/Bancos/ProveedoresAbonar.aspx.vb index 672ec98f1..38a671b26 100644 --- a/Bancos/ProveedoresAbonar.aspx.vb +++ b/Bancos/ProveedoresAbonar.aspx.vb @@ -310,7 +310,7 @@ Partial Class Bancos_ProveedoresAbonar ViewState("CveCuentaRetISR") = 0 End If - If UsuarioActual.CveEmpresa.Contiene(1, 4, 5, 7, 11, 12, 72, 80, 126, 119, 122,145) Then + If UsuarioActual.CveEmpresa.Contiene(1, 4, 5, 7, 11, 12, 72, 80, 126, 119, 122) Then rowComisiones.Visible = True End If @@ -1506,16 +1506,16 @@ Partial Class Bancos_ProveedoresAbonar 'funcionalidad que toma el 100% del pago para acreditamiento de iva If TotalImporte = gvr.DataKey("Saldo").ToDecimal Then If CveMoneda = 1 AndAlso gvr.DataKey("CveMoneda").ToEntero = 1 Then - ImporteMovimiento = gvr.DataKey("IVA").ToDecimal + ImporteMovimiento = gvr.DataKey("IVADeducible").ToDecimal importeMX = ImporteMovimiento ElseIf CveMoneda = 1 AndAlso gvr.DataKey("CveMoneda").ToEntero = 2 Then - ImporteMovimiento = gvr.DataKey("IVA").ToDecimal - importeMX = gvr.DataKey("IVA").ToDecimal * If(FuncionalidadFluctuacionImpuestos, TipoCambioPago, tipoCambioCompra) + ImporteMovimiento = gvr.DataKey("IVADeducible").ToDecimal + importeMX = gvr.DataKey("IVADeducible").ToDecimal * If(FuncionalidadFluctuacionImpuestos, TipoCambioPago, tipoCambioCompra) ElseIf CveMoneda = 2 AndAlso gvr.DataKey("CveMoneda").ToEntero = 1 Then - ImporteMovimiento = gvr.DataKey("IVA").ToDecimal + ImporteMovimiento = gvr.DataKey("IVADeducible").ToDecimal importeMX = ImporteMovimiento * tipoCambioCompra ElseIf CveMoneda = 2 AndAlso gvr.DataKey("CveMoneda").ToEntero = 2 Then - ImporteMovimiento = gvr.DataKey("IVA").ToDecimal + ImporteMovimiento = gvr.DataKey("IVADeducible").ToDecimal importeMX = ImporteMovimiento * If(FuncionalidadFluctuacionImpuestos, TipoCambioPago, tipoCambioCompra) End If ImporteMovimiento = Math.Round(ImporteMovimiento, 2, MidpointRounding.AwayFromZero) @@ -1528,16 +1528,79 @@ Partial Class Bancos_ProveedoresAbonar End If Else If CveMoneda = 1 AndAlso gvr.DataKey("CveMoneda").ToEntero = 1 Then - ImporteMovimiento = If(TotalImporte = gvr.DataKey("Saldo").ToDecimal AndAlso Math.Abs(Math.Round(gvr.DataKey("IVAPorPagar").ToDecimal - (gvr.DataKey("IVA").ToDecimal * PorcentajePago), 2)) <= 0.02, gvr.DataKey("IVAPorPagar").ToDecimal, gvr.DataKey("IVA").ToDecimal * PorcentajePago) + ImporteMovimiento = If(TotalImporte = gvr.DataKey("Saldo").ToDecimal AndAlso Math.Abs(Math.Round(gvr.DataKey("IVAPorPagarDeducible").ToDecimal - (gvr.DataKey("IVADeducible").ToDecimal * PorcentajePago), 2)) <= 0.02, gvr.DataKey("IVAPorPagarDeducible").ToDecimal, gvr.DataKey("IVADeducible").ToDecimal * PorcentajePago) importeMX = ImporteMovimiento ElseIf CveMoneda = 1 AndAlso gvr.DataKey("CveMoneda").ToEntero = 2 Then - ImporteMovimiento = If(TotalImporte = gvr.DataKey("Saldo").ToDecimal AndAlso Math.Abs(Math.Round(gvr.DataKey("IVAPorPagar").ToDecimal - (gvr.DataKey("IVA").ToDecimal * PorcentajePago), 2)) <= 0.02, gvr.DataKey("IVAPorPagar").ToDecimal, gvr.DataKey("IVA").ToDecimal * PorcentajePago) + ImporteMovimiento = If(TotalImporte = gvr.DataKey("Saldo").ToDecimal AndAlso Math.Abs(Math.Round(gvr.DataKey("IVAPorPagarDeducible").ToDecimal - (gvr.DataKey("IVADeducible").ToDecimal * PorcentajePago), 2)) <= 0.02, gvr.DataKey("IVAPorPagarDeducible").ToDecimal, gvr.DataKey("IVADeducible").ToDecimal * PorcentajePago) importeMX = ImporteMovimiento * If(FuncionalidadFluctuacionImpuestos, TipoCambioPago, tipoCambioCompra) ElseIf CveMoneda = 2 AndAlso gvr.DataKey("CveMoneda").ToEntero = 1 Then - ImporteMovimiento = If(TotalImporte = gvr.DataKey("Saldo").ToDecimal AndAlso Math.Abs(Math.Round(gvr.DataKey("IVAPorPagar").ToDecimal - (gvr.DataKey("IVA").ToDecimal * PorcentajePago), 2)) <= 0.02, gvr.DataKey("IVAPorPagar").ToDecimal, gvr.DataKey("IVA").ToDecimal * PorcentajePago) + ImporteMovimiento = If(TotalImporte = gvr.DataKey("Saldo").ToDecimal AndAlso Math.Abs(Math.Round(gvr.DataKey("IVAPorPagarDeducible").ToDecimal - (gvr.DataKey("IVADeducible").ToDecimal * PorcentajePago), 2)) <= 0.02, gvr.DataKey("IVAPorPagarDeducible").ToDecimal, gvr.DataKey("IVADeducible").ToDecimal * PorcentajePago) importeMX = ImporteMovimiento * tipoCambioCompra ElseIf CveMoneda = 2 AndAlso gvr.DataKey("CveMoneda").ToEntero = 2 Then - ImporteMovimiento = If(TotalImporte = gvr.DataKey("Saldo").ToDecimal AndAlso Math.Abs(Math.Round(gvr.DataKey("IVAPorPagar").ToDecimal - (gvr.DataKey("IVA").ToDecimal * PorcentajePago), 2)) <= 0.02, gvr.DataKey("IVAPorPagar").ToDecimal, gvr.DataKey("IVA").ToDecimal * PorcentajePago) + ImporteMovimiento = If(TotalImporte = gvr.DataKey("Saldo").ToDecimal AndAlso Math.Abs(Math.Round(gvr.DataKey("IVAPorPagarDeducible").ToDecimal - (gvr.DataKey("IVADeducible").ToDecimal * PorcentajePago), 2)) <= 0.02, gvr.DataKey("IVAPorPagarDeducible").ToDecimal, gvr.DataKey("IVADeducible").ToDecimal * PorcentajePago) + importeMX = ImporteMovimiento * If(FuncionalidadFluctuacionImpuestos, TipoCambioPago, tipoCambioCompra) + End If + ImporteMovimiento = Math.Round(ImporteMovimiento, 2, MidpointRounding.AwayFromZero) + importeMX = Math.Round(importeMX, 2, MidpointRounding.AwayFromZero) + + If TipoCambioPago > 1 Then ConceptoMovimiento += $" TC:{TipoCambioPago} ${ImporteMovimiento.FormatoNumero(2)}" + End If + TipoCambioGeneral = If(FuncionalidadFluctuacionImpuestos, TipoCambioPago, tipoCambioCompra) + + PorcentajeImpuesto = gvr.DataKey("PorcentajeIVA").ToDecimal + Dim IdCtaIVAXAcreditar As Integer = 0 + Dim IdCtaIVAAcreditable As Integer = 0 + + If GlobalDTClasificacionPorcentaje(UsuarioActual.CveEmpresa, PorcentajeIVA:=PorcentajeImpuesto).Rows.Count > 0 Then + IdCtaIVAXAcreditar = GlobalDTClasificacionPorcentaje(UsuarioActual.CveEmpresa, PorcentajeIVA:=PorcentajeImpuesto).Rows(0)("IdCtaIVAXAcreditar").ToString.ToEntero + IdCtaIVAAcreditable = GlobalDTClasificacionPorcentaje(UsuarioActual.CveEmpresa, PorcentajeIVA:=PorcentajeImpuesto).Rows(0)("IdCtaIVAAcreditable").ToString.ToEntero + End If + IdCtaContable = If(IdCtaIVAAcreditable > 0, IdCtaIVAAcreditable, 0) + + If ImporteMovimiento <> 0 AndAlso ObjMov.GetRetCuenta(ConceptoContable, UsuarioActual.CveEmpresa) And Not IdCtaContable > 0 Then + If ObjMov.DtResultados.Rows.Count > 0 Then + IdCtaContable = ObjMov.DtResultados.Rows(0)("IdCuentaIVAAcreditable").ToString.ToEntero + CveCuenta = ObjMov.DtResultados.Rows(0)("IdCuentaIVAAcreditableSIG").ToString.ToEntero + End If + End If + Case 280 'Iva Acreditado No Deducible + Dim TotalImporte As Decimal = gvr.FCTextBox("TxtAbonar").Text.ToDecimal + If UsuarioActual.Empresa.Funcionalidad(521) = "1" Then + 'funcionalidad que toma el 100% del pago para acreditamiento de iva + If TotalImporte = gvr.DataKey("Saldo").ToDecimal Then + If CveMoneda = 1 AndAlso gvr.DataKey("CveMoneda").ToEntero = 1 Then + ImporteMovimiento = gvr.DataKey("IVANoDeducible").ToDecimal + importeMX = ImporteMovimiento + ElseIf CveMoneda = 1 AndAlso gvr.DataKey("CveMoneda").ToEntero = 2 Then + ImporteMovimiento = gvr.DataKey("IVANoDeducible").ToDecimal + importeMX = gvr.DataKey("IVANoDeducible").ToDecimal * If(FuncionalidadFluctuacionImpuestos, TipoCambioPago, tipoCambioCompra) + ElseIf CveMoneda = 2 AndAlso gvr.DataKey("CveMoneda").ToEntero = 1 Then + ImporteMovimiento = gvr.DataKey("IVANoDeducible").ToDecimal + importeMX = ImporteMovimiento * tipoCambioCompra + ElseIf CveMoneda = 2 AndAlso gvr.DataKey("CveMoneda").ToEntero = 2 Then + ImporteMovimiento = gvr.DataKey("IVANoDeducible").ToDecimal + importeMX = ImporteMovimiento * If(FuncionalidadFluctuacionImpuestos, TipoCambioPago, tipoCambioCompra) + End If + ImporteMovimiento = Math.Round(ImporteMovimiento, 2, MidpointRounding.AwayFromZero) + importeMX = Math.Round(importeMX, 2, MidpointRounding.AwayFromZero) + + If TipoCambioPago > 1 Then ConceptoMovimiento += $" TC:{TipoCambioPago} ${ImporteMovimiento.FormatoNumero(2)}" + Else + ImporteMovimiento = 0 + importeMX = 0 + End If + Else + If CveMoneda = 1 AndAlso gvr.DataKey("CveMoneda").ToEntero = 1 Then + ImporteMovimiento = If(TotalImporte = gvr.DataKey("Saldo").ToDecimal AndAlso Math.Abs(Math.Round(gvr.DataKey("IVAPorPagarNoDeducible").ToDecimal - (gvr.DataKey("IVANoDeducible").ToDecimal * PorcentajePago), 2)) <= 0.02, gvr.DataKey("IVAPorPagarNoDeducible").ToDecimal, gvr.DataKey("IVANoDeducible").ToDecimal * PorcentajePago) + importeMX = ImporteMovimiento + ElseIf CveMoneda = 1 AndAlso gvr.DataKey("CveMoneda").ToEntero = 2 Then + ImporteMovimiento = If(TotalImporte = gvr.DataKey("Saldo").ToDecimal AndAlso Math.Abs(Math.Round(gvr.DataKey("IVAPorPagarNoDeducible").ToDecimal - (gvr.DataKey("IVANoDeducible").ToDecimal * PorcentajePago), 2)) <= 0.02, gvr.DataKey("IVAPorPagarNoDeducible").ToDecimal, gvr.DataKey("IVANoDeducible").ToDecimal * PorcentajePago) + importeMX = ImporteMovimiento * If(FuncionalidadFluctuacionImpuestos, TipoCambioPago, tipoCambioCompra) + ElseIf CveMoneda = 2 AndAlso gvr.DataKey("CveMoneda").ToEntero = 1 Then + ImporteMovimiento = If(TotalImporte = gvr.DataKey("Saldo").ToDecimal AndAlso Math.Abs(Math.Round(gvr.DataKey("IVAPorPagarNoDeducible").ToDecimal - (gvr.DataKey("IVANoDeducible").ToDecimal * PorcentajePago), 2)) <= 0.02, gvr.DataKey("IVAPorPagarNoDeducible").ToDecimal, gvr.DataKey("IVANoDeducible").ToDecimal * PorcentajePago) + importeMX = ImporteMovimiento * tipoCambioCompra + ElseIf CveMoneda = 2 AndAlso gvr.DataKey("CveMoneda").ToEntero = 2 Then + ImporteMovimiento = If(TotalImporte = gvr.DataKey("Saldo").ToDecimal AndAlso Math.Abs(Math.Round(gvr.DataKey("IVAPorPagarNoDeducible").ToDecimal - (gvr.DataKey("IVANoDeducible").ToDecimal * PorcentajePago), 2)) <= 0.02, gvr.DataKey("IVAPorPagarNoDeducible").ToDecimal, gvr.DataKey("IVANoDeducible").ToDecimal * PorcentajePago) importeMX = ImporteMovimiento * If(FuncionalidadFluctuacionImpuestos, TipoCambioPago, tipoCambioCompra) End If ImporteMovimiento = Math.Round(ImporteMovimiento, 2, MidpointRounding.AwayFromZero)