diff --git a/Bancos/ProveedoresAbonar.aspx b/Bancos/ProveedoresAbonar.aspx index 48f92f474..9d5d23cab 100644 --- a/Bancos/ProveedoresAbonar.aspx +++ b/Bancos/ProveedoresAbonar.aspx @@ -369,7 +369,7 @@ diff --git a/Bancos/ProveedoresAbonar.aspx.vb b/Bancos/ProveedoresAbonar.aspx.vb index cdd2e3557..9c6fc4e0e 100644 --- a/Bancos/ProveedoresAbonar.aspx.vb +++ b/Bancos/ProveedoresAbonar.aspx.vb @@ -574,7 +574,6 @@ Partial Class Bancos_ProveedoresAbonar FiltroInv = "" 'queno considera lo proporcional End If - If PorcentajeAlmacen = 0 Then ' sin recibir e.Row.FCLabel("LbEstatusInv").Text = "" e.Row.FCLabel("LbEstatusInv").ForeColor = Drawing.Color.Red @@ -732,11 +731,6 @@ Partial Class Bancos_ProveedoresAbonar ImporteSeleccionado += gvr.FCTextBox("TxtAbonar").Text.ToDecimal If gvr.DataKey("UUID") <> "" Then - '529 - - - - Valida.Verificar(gvr.DataKey("UUID"), gvr.DataKey("RFC"), UsuarioActual.Empresa.RFC, gvr.DataKey("TotalOriginal").ToDecimal) If Not UsuarioActual.Empresa.FacturaProduccion OrElse UsuarioActual.CveEmpresa < 2 Then @@ -770,7 +764,6 @@ Partial Class Bancos_ProveedoresAbonar ObjCompra.Dispose() Else MsgValidadas.AppendFormat("Factura Cancelada: {0} - {1} con movimientos de almacen, relacione su factura nueva para descontar saldo
", gvr.DataKey("SerieFolio"), gvr.DataKey("Descripcion")) - End If Else @@ -807,7 +800,7 @@ Partial Class Bancos_ProveedoresAbonar Dim ObjMov As New ClsContabilidad(ObjIE.IniciaTransacSQL) Dim ObjComp As New ClsCompras(ObjIE.IniciaTransacSQL) Dim ObjConta As ClsContPAQi = Nothing - If UsuarioActual.Empresa.UsaContabilidad Then + If UsuarioActual.Empresa.TipoContabilidad = 2 AndAlso UsuarioActual.Empresa.UsaContabilidad Then ObjConta = New ClsContPAQi(UsuarioActual.Empresa) ObjConta.IniciaTransacSQL() End If @@ -892,7 +885,6 @@ Partial Class Bancos_ProveedoresAbonar End If Anexo.Text = "" - 'inserto los movimientos de la conta para abonar al saldo If CvePrePoliza > 0 Then @@ -935,21 +927,6 @@ Partial Class Bancos_ProveedoresAbonar End If End If - 'If ObjIE.GetFluctuacionesBitacora(UsuarioActual.CveEmpresa) Then - ' If ObjIE.DtResultados.Rows.Count > 0 Then - ' Dim tFecha As Date = TxtFechaDocumento.Text.ToDate - ' Dim FechaC As String = String.Format("{0}/{1}/{2}", tFecha.Year, tFecha.Month, tFecha.Day) - ' Dim drr As DataRow = ObjIE.DtResultados.FiltroPrimero("Fecha < #" & FechaC & "#", "Fecha DESC") - - ' If drr IsNot Nothing Then - ' FechaUltimaFluctuacion = drr("Fecha").ToString.ToDate - ' TipoCambioFluctuacion = drr("TipoCambio").ToString.ToDecimal - ' End If - - ' End If - 'End If - - Dim DttPlantilla As DataTable = Nothing If ObjMov.GetPlantillaConceptos(UsuarioActual.CveEmpresa, CvePlantillaPoliza) Then DttPlantilla = ObjMov.DtResultados @@ -961,31 +938,24 @@ Partial Class Bancos_ProveedoresAbonar For Each gvr As GridViewRow In GvCxP.Rows If gvr.FCCheckBox("Chk").Checked Then Dim EsImportacion As Boolean = False - + tipoCambioCompra = gvr.DataKey("TipoCambioOriginal").ToDecimal + PorcentajePago = (gvr.FCTextBox("TxtAbonar").Text.ToDecimal) / gvr.DataKey("Original").ToDecimal + tipoCambioCompraValuacion = 1 'Tipos de cambio If CveMoneda = 1 AndAlso gvr.DataKey("CveMoneda").ToEntero = 1 Then 'Si la venta viene en Pesos y se va a pagar en Pesos TipoCambioPago = 1 - tipoCambioCompra = 1 - PorcentajePago = gvr.FCTextBox("TxtAbonar").Text.ToDecimal / gvr.DataKey("Original").ToDecimal ElseIf CveMoneda = 1 AndAlso gvr.DataKey("CveMoneda").ToEntero = 2 Then 'Si la venta viene en Dolares y se va a pagar en Pesos TipoCambioPago = TxtTC.Text.ToDecimal - tipoCambioCompra = gvr.DataKey("TipoCambio").ToDecimal - tipoCambioCompraValuacion = If(gvr.DataKey("Fecha").ToDate < FechaUltimaFluctuacion, TipoCambioFluctuacion, gvr.DataKey("TipoCambio").ToDecimal) - PorcentajePago = ((gvr.FCTextBox("TxtAbonar").Text.ToDecimal) / gvr.DataKey("Original").ToDecimal).RoundSQL + tipoCambioCompraValuacion = If(gvr.DataKey("Fecha").ToDate < FechaUltimaFluctuacion, TipoCambioFluctuacion, tipoCambioCompra) ElseIf CveMoneda = 2 AndAlso gvr.DataKey("CveMoneda").ToEntero = 2 Then 'Si la venta viene en Dolares y se va a pagar en DOLARES 'TipoCambioPago = 'GlobalTipoCambio(TxtFechaDocumento.Text.ToDate).ToString.ToDecimal TipoCambioPago = TxtTCDolaresDolares.Text.ToDecimal - tipoCambioCompra = gvr.DataKey("TipoCambio").ToDecimal - tipoCambioCompraValuacion = If(gvr.DataKey("Fecha").ToDate < FechaUltimaFluctuacion, TipoCambioFluctuacion, gvr.DataKey("TipoCambio").ToDecimal) - PorcentajePago = gvr.FCTextBox("TxtAbonar").Text.ToDecimal / gvr.DataKey("Original").ToDecimal + tipoCambioCompraValuacion = If(gvr.DataKey("Fecha").ToDate < FechaUltimaFluctuacion, TipoCambioFluctuacion, tipoCambioCompra) ElseIf CveMoneda = 2 AndAlso gvr.DataKey("CveMoneda").ToEntero = 1 Then 'Si la venta viene en pesos y se va a pagar en DOLARES TipoCambioPago = TxtTCDolares.Text.ToDecimal - tipoCambioCompra = 1 - PorcentajePago = (gvr.FCTextBox("TxtAbonar").Text.ToDecimal) / gvr.DataKey("Original").ToDecimal End If CveSubProyecto = gvr.DataKey("CveSubProyecto").ToEntero - 'If ObjMov.GetPlantillaConceptos(UsuarioActual.CveEmpresa, CvePlantillaPoliza) Then If DttPlantilla IsNot Nothing AndAlso DttPlantilla.Rows.Count > 0 Then For Each Row As DataRow In DttPlantilla.Rows ConceptoContable = Row("CveConcepto").ToString.ToEntero @@ -996,7 +966,6 @@ Partial Class Bancos_ProveedoresAbonar Referencia = gvr.DataKey("SerieFolio").ToString Dim PorcentajeImpuesto As Decimal = 0 - Select Case ConceptoContable Case 17 'Pago Proveedores @@ -1011,21 +980,8 @@ Partial Class Bancos_ProveedoresAbonar End Select End If - If CveMoneda = 1 AndAlso gvr.DataKey("CveMoneda").ToEntero = 1 Then - ImporteMovimiento = gvr.FCTextBox("TxtAbonar").Text.ToDecimal - importeMX = ImporteMovimiento - ElseIf CveMoneda = 1 AndAlso gvr.DataKey("CveMoneda").ToEntero = 2 Then - ImporteMovimiento = gvr.FCTextBox("TxtAbonar").Text.ToDecimal - importeMX = gvr.FCTextBox("TxtAbonar").Text.ToDecimal * tipoCambioCompraValuacion - ElseIf CveMoneda = 2 AndAlso gvr.DataKey("CveMoneda").ToEntero = 1 Then - ImporteMovimiento = gvr.FCTextBox("TxtAbonar").Text.ToDecimal - importeMX = gvr.FCTextBox("TxtAbonar").Text.ToDecimal * tipoCambioCompraValuacion - ElseIf CveMoneda = 2 AndAlso gvr.DataKey("CveMoneda").ToEntero = 2 Then - ImporteMovimiento = gvr.FCTextBox("TxtAbonar").Text.ToDecimal - importeMX = ImporteMovimiento * tipoCambioCompraValuacion - End If - ImporteMovimiento = ImporteMovimiento.RoundSQL - importeMX = importeMX.RoundSQL + ImporteMovimiento = gvr.FCTextBox("TxtAbonar").Text.ToDecimal.RoundSQL + importeMX = (gvr.FCTextBox("TxtAbonar").Text.ToDecimal * tipoCambioCompraValuacion).RoundSQL TipoCambioGeneral = tipoCambioCompraValuacion ConceptoMovimiento = $"{HplProveedor.Text} F:{gvr.DataKey("SerieFolio")}" 'cuando son dolares, y tienen complementaria, se hace el registro @@ -1070,26 +1026,10 @@ Partial Class Bancos_ProveedoresAbonar ConceptoContable = 285 End If - If CveMoneda = 1 AndAlso gvr.DataKey("CveMoneda").ToEntero = 1 Then - ImporteMovimiento = gvr.DataKey("RetIVA").ToDecimal * PorcentajePago - importeMX = ImporteMovimiento - ElseIf CveMoneda = 1 AndAlso gvr.DataKey("CveMoneda").ToEntero = 2 Then - tipoCambioCompra = gvr.DataKey("TipoCambio").ToDecimal - ImporteMovimiento = gvr.DataKey("RetIVA").ToDecimal * PorcentajePago - importeMX = ImporteMovimiento * tipoCambioCompra - ElseIf CveMoneda = 2 AndAlso gvr.DataKey("CveMoneda").ToEntero = 1 Then - ImporteMovimiento = gvr.DataKey("RetIVA").ToDecimal * PorcentajePago - importeMX = ImporteMovimiento * tipoCambioCompra - ElseIf CveMoneda = 2 AndAlso gvr.DataKey("CveMoneda").ToEntero = 2 Then - tipoCambioCompra = gvr.DataKey("TipoCambio").ToDecimal - ImporteMovimiento = gvr.DataKey("RetIVA").ToDecimal * PorcentajePago - importeMX = ImporteMovimiento * tipoCambioCompra - End If - ImporteMovimiento = ImporteMovimiento.RoundSQL - importeMX = importeMX.RoundSQL + ImporteMovimiento = (gvr.DataKey("RetIVA").ToDecimal * PorcentajePago).RoundSQL + importeMX = (ImporteMovimiento * tipoCambioCompra).RoundSQL + TipoCambioGeneral = tipoCambioCompra - - If tipoCambioCompra > 1 Then ConceptoMovimiento += $" TC:{tipoCambioCompra} ${ImporteMovimiento.FormatoNumero(2)}" 'Conta ContPAQ @@ -1127,23 +1067,10 @@ Partial Class Bancos_ProveedoresAbonar Funcionalidad = 578 ConceptoContable = 286 End If - If CveMoneda = 1 AndAlso gvr.DataKey("CveMoneda").ToEntero = 1 Then - ImporteMovimiento = gvr.DataKey("RetIVA").ToDecimal * PorcentajePago - importeMX = ImporteMovimiento - ElseIf CveMoneda = 1 AndAlso gvr.DataKey("CveMoneda").ToEntero = 2 Then - tipoCambioCompra = gvr.DataKey("TipoCambio").ToDecimal - ImporteMovimiento = (gvr.DataKey("RetIVA").ToDecimal * PorcentajePago) - importeMX = ImporteMovimiento * If(FuncionalidadFluctuacionImpuestos, TipoCambioPago, tipoCambioCompra) - ElseIf CveMoneda = 2 AndAlso gvr.DataKey("CveMoneda").ToEntero = 1 Then - ImporteMovimiento = (gvr.DataKey("RetIVA").ToDecimal * PorcentajePago) - importeMX = ImporteMovimiento * tipoCambioCompra - ElseIf CveMoneda = 2 AndAlso gvr.DataKey("CveMoneda").ToEntero = 2 Then - tipoCambioCompra = gvr.DataKey("TipoCambio").ToDecimal - ImporteMovimiento = (gvr.DataKey("RetIVA").ToDecimal * PorcentajePago) - importeMX = ImporteMovimiento * If(FuncionalidadFluctuacionImpuestos, TipoCambioPago, tipoCambioCompra) - End If - ImporteMovimiento = ImporteMovimiento.RoundSQL - importeMX = importeMX.RoundSQL + + ImporteMovimiento = (gvr.DataKey("RetIVA").ToDecimal * PorcentajePago).RoundSQL + importeMX = (ImporteMovimiento * If(FuncionalidadFluctuacionImpuestos, TipoCambioPago, tipoCambioCompra)).RoundSQL + TipoCambioGeneral = If(FuncionalidadFluctuacionImpuestos, TipoCambioPago, tipoCambioCompra) If TipoCambioPago > 1 Then ConceptoMovimiento += $" TC:{TipoCambioPago} ${ImporteMovimiento.FormatoNumero(2)}" @@ -1177,21 +1104,9 @@ Partial Class Bancos_ProveedoresAbonar ConceptoContable = 328 End If - If CveMoneda = 1 AndAlso gvr.DataKey("CveMoneda").ToEntero = 1 Then - ImporteMovimiento = gvr.DataKey("RetISR").ToDecimal * PorcentajePago - importeMX = ImporteMovimiento - ElseIf CveMoneda = 1 AndAlso gvr.DataKey("CveMoneda").ToEntero = 2 Then - ImporteMovimiento = (gvr.DataKey("RetISR").ToDecimal * PorcentajePago) - importeMX = ImporteMovimiento * tipoCambioCompra - ElseIf CveMoneda = 2 AndAlso gvr.DataKey("CveMoneda").ToEntero = 1 Then - ImporteMovimiento = (gvr.DataKey("RetISR").ToDecimal * PorcentajePago) - importeMX = ImporteMovimiento * tipoCambioCompra - ElseIf CveMoneda = 2 AndAlso gvr.DataKey("CveMoneda").ToEntero = 2 Then - ImporteMovimiento = (gvr.DataKey("RetISR").ToDecimal * PorcentajePago) - importeMX = ImporteMovimiento * tipoCambioCompra - End If - ImporteMovimiento = Math.Round(ImporteMovimiento, 2, MidpointRounding.AwayFromZero) - importeMX = Math.Round(importeMX, 2, MidpointRounding.AwayFromZero) + ImporteMovimiento = (gvr.DataKey("RetISR").ToDecimal * PorcentajePago).RoundSQL + importeMX = (ImporteMovimiento * tipoCambioCompra).RoundSQL + TipoCambioGeneral = tipoCambioCompra If tipoCambioCompra > 1 Then ConceptoMovimiento += $" TC:{tipoCambioCompra} ${ImporteMovimiento.FormatoNumero(2)}" @@ -1221,22 +1136,8 @@ Partial Class Bancos_ProveedoresAbonar funcionalidad = 348 ConceptoContable = 328 End If - - If CveMoneda = 1 AndAlso gvr.DataKey("CveMoneda").ToEntero = 1 Then - ImporteMovimiento = gvr.DataKey("RetISR").ToDecimal * PorcentajePago - importeMX = ImporteMovimiento - ElseIf CveMoneda = 1 AndAlso gvr.DataKey("CveMoneda").ToEntero = 2 Then - ImporteMovimiento = (gvr.DataKey("RetISR").ToDecimal * PorcentajePago) - importeMX = ImporteMovimiento * If(FuncionalidadFluctuacionImpuestos, TipoCambioPago, tipoCambioCompra) - ElseIf CveMoneda = 2 AndAlso gvr.DataKey("CveMoneda").ToEntero = 1 Then - ImporteMovimiento = (gvr.DataKey("RetISR").ToDecimal * PorcentajePago) - importeMX = ImporteMovimiento * tipoCambioCompra - ElseIf CveMoneda = 2 AndAlso gvr.DataKey("CveMoneda").ToEntero = 2 Then - ImporteMovimiento = (gvr.DataKey("RetISR").ToDecimal * PorcentajePago) - importeMX = ImporteMovimiento * If(FuncionalidadFluctuacionImpuestos, TipoCambioPago, tipoCambioCompra) - End If - ImporteMovimiento = ImporteMovimiento.RoundSQL - importeMX = importeMX.RoundSQL + ImporteMovimiento = (gvr.DataKey("RetISR").ToDecimal * PorcentajePago).RoundSQL + importeMX = (ImporteMovimiento * If(FuncionalidadFluctuacionImpuestos, TipoCambioPago, tipoCambioCompra)).RoundSQL TipoCambioGeneral = TipoCambioPago If TipoCambioPago > 1 Then ConceptoMovimiento += $" TC:{TipoCambioPago} ${ImporteMovimiento.FormatoNumero(2)}" @@ -1254,7 +1155,6 @@ Partial Class Bancos_ProveedoresAbonar End If End If - End If Case 14 'Iva X Acreditar @@ -1263,23 +1163,8 @@ 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 - importeMX = ImporteMovimiento - ElseIf CveMoneda = 1 AndAlso gvr.DataKey("CveMoneda").ToEntero = 2 Then - tipoCambioCompra = gvr.DataKey("TipoCambio").ToDecimal - ImporteMovimiento = gvr.DataKey("IVA").ToDecimal - importeMX = ImporteMovimiento * tipoCambioCompra - ElseIf CveMoneda = 2 AndAlso gvr.DataKey("CveMoneda").ToEntero = 1 Then - ImporteMovimiento = gvr.DataKey("IVA").ToDecimal - importeMX = ImporteMovimiento * tipoCambioCompra - ElseIf CveMoneda = 2 AndAlso gvr.DataKey("CveMoneda").ToEntero = 2 Then - tipoCambioCompra = gvr.DataKey("TipoCambio").ToDecimal - ImporteMovimiento = gvr.DataKey("IVA").ToDecimal - importeMX = ImporteMovimiento * tipoCambioCompra - End If - ImporteMovimiento = ImporteMovimiento.RoundSQL - importeMX = importeMX.RoundSQL + ImporteMovimiento = (gvr.DataKey("IVA").ToDecimal).RoundSQL + importeMX = (ImporteMovimiento * tipoCambioCompra).RoundSQL If tipoCambioCompra > 1 Then ConceptoMovimiento += $" TC:{tipoCambioCompra} ${ImporteMovimiento.FormatoNumero(2)}" Else @@ -1287,23 +1172,10 @@ Partial Class Bancos_ProveedoresAbonar importeMX = 0 End If Else - ImporteMovimiento = gvr.DataKey("IVA").ToDecimal * PorcentajePago - - If CveMoneda = 1 AndAlso gvr.DataKey("CveMoneda").ToEntero = 1 Then - importeMX = ImporteMovimiento - ElseIf CveMoneda = 1 AndAlso gvr.DataKey("CveMoneda").ToEntero = 2 Then - tipoCambioCompra = gvr.DataKey("TipoCambio").ToDecimal - importeMX = ImporteMovimiento * tipoCambioCompra - ElseIf CveMoneda = 2 AndAlso gvr.DataKey("CveMoneda").ToEntero = 1 Then - importeMX = ImporteMovimiento * tipoCambioCompra - ElseIf CveMoneda = 2 AndAlso gvr.DataKey("CveMoneda").ToEntero = 2 Then - tipoCambioCompra = gvr.DataKey("TipoCambio").ToDecimal - importeMX = ImporteMovimiento * tipoCambioCompra - End If - ImporteMovimiento = ImporteMovimiento.RoundSQL - importeMX = importeMX.RoundSQL - + ImporteMovimiento = (gvr.DataKey("IVA").ToDecimal * PorcentajePago).RoundSQL + importeMX = (ImporteMovimiento * tipoCambioCompra).RoundSQL If tipoCambioCompra > 1 Then ConceptoMovimiento += $" TC:{tipoCambioCompra} ${ImporteMovimiento.FormatoNumero(2)}" + End If TipoCambioGeneral = If(FuncionalidadFluctuacionImpuestos, TipoCambioPago, tipoCambioCompra) @@ -1330,24 +1202,10 @@ Partial Class Bancos_ProveedoresAbonar 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("IVADeducible").ToDecimal - importeMX = ImporteMovimiento - ElseIf CveMoneda = 1 AndAlso gvr.DataKey("CveMoneda").ToEntero = 2 Then - tipoCambioCompra = gvr.DataKey("TipoCambio").ToDecimal - 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("IVADeducible").ToDecimal - importeMX = ImporteMovimiento * tipoCambioCompra - ElseIf CveMoneda = 2 AndAlso gvr.DataKey("CveMoneda").ToEntero = 2 Then - tipoCambioCompra = gvr.DataKey("TipoCambio").ToDecimal - ImporteMovimiento = gvr.DataKey("IVADeducible").ToDecimal - importeMX = ImporteMovimiento * If(FuncionalidadFluctuacionImpuestos, TipoCambioPago, tipoCambioCompra) - End If - ImporteMovimiento = Math.Round(ImporteMovimiento, 2, MidpointRounding.AwayFromZero) - importeMX = Math.Round(importeMX, 2, MidpointRounding.AwayFromZero) + ImporteMovimiento = (gvr.DataKey("IVADeducible").ToDecimal).RoundSQL + importeMX = (ImporteMovimiento * If(FuncionalidadFluctuacionImpuestos, TipoCambioPago, tipoCambioCompra)).RoundSQL If TipoCambioPago > 1 Then ConceptoMovimiento += $" TC:{TipoCambioPago} ${ImporteMovimiento.FormatoNumero(2)}" Else @@ -1356,19 +1214,8 @@ Partial Class Bancos_ProveedoresAbonar End If Else ImporteMovimiento = gvr.DataKey("IVADeducible").ToDecimal * PorcentajePago + importeMX = ImporteMovimiento * If(FuncionalidadFluctuacionImpuestos, TipoCambioPago, tipoCambioCompra) - If CveMoneda = 1 AndAlso gvr.DataKey("CveMoneda").ToEntero = 1 Then - importeMX = ImporteMovimiento - ElseIf CveMoneda = 1 AndAlso gvr.DataKey("CveMoneda").ToEntero = 2 Then - tipoCambioCompra = gvr.DataKey("TipoCambio").ToDecimal - importeMX = ImporteMovimiento * If(FuncionalidadFluctuacionImpuestos, TipoCambioPago, tipoCambioCompra) - ElseIf CveMoneda = 2 AndAlso gvr.DataKey("CveMoneda").ToEntero = 1 Then - importeMX = ImporteMovimiento * tipoCambioCompra - ElseIf CveMoneda = 2 AndAlso gvr.DataKey("CveMoneda").ToEntero = 2 Then - tipoCambioCompra = gvr.DataKey("TipoCambio").ToDecimal - - importeMX = ImporteMovimiento * If(FuncionalidadFluctuacionImpuestos, TipoCambioPago, tipoCambioCompra) - End If ImporteMovimiento = ImporteMovimiento.RoundSQL importeMX = importeMX.RoundSQL @@ -1411,20 +1258,8 @@ Partial Class Bancos_ProveedoresAbonar Case 25 'IEPS X Acreditar Dim TotalImporte As Decimal = gvr.FCTextBox("TxtAbonar").Text.ToDecimal - ImporteMovimiento = gvr.DataKey("IEPSPorPagar").ToDecimal * PorcentajePago - If CveMoneda = 1 AndAlso gvr.DataKey("CveMoneda").ToEntero = 1 Then - importeMX = ImporteMovimiento - ElseIf CveMoneda = 1 AndAlso gvr.DataKey("CveMoneda").ToEntero = 2 Then - tipoCambioCompra = gvr.DataKey("TipoCambio").ToDecimal - importeMX = ImporteMovimiento * tipoCambioCompra - ElseIf CveMoneda = 2 AndAlso gvr.DataKey("CveMoneda").ToEntero = 1 Then - importeMX = ImporteMovimiento * tipoCambioCompra - ElseIf CveMoneda = 2 AndAlso gvr.DataKey("CveMoneda").ToEntero = 2 Then - tipoCambioCompra = gvr.DataKey("TipoCambio").ToDecimal - importeMX = ImporteMovimiento * tipoCambioCompra - End If - ImporteMovimiento = Math.Round(ImporteMovimiento, 2, MidpointRounding.AwayFromZero) - importeMX = Math.Round(importeMX, 2, MidpointRounding.AwayFromZero) + ImporteMovimiento = (gvr.DataKey("IEPSPorPagar").ToDecimal * PorcentajePago).RoundSQL + importeMX = (ImporteMovimiento * tipoCambioCompra).RoundSQL TipoCambioGeneral = tipoCambioCompra If tipoCambioCompra > 1 Then ConceptoMovimiento += $" TC:{tipoCambioCompra} ${ImporteMovimiento.FormatoNumero(2)}" @@ -1435,20 +1270,8 @@ Partial Class Bancos_ProveedoresAbonar End If Case 26 'IEPS Acreditable Dim TotalImporte As Decimal = gvr.FCTextBox("TxtAbonar").Text.ToDecimal - ImporteMovimiento = gvr.DataKey("IEPSPorPagar").ToDecimal * PorcentajePago - If CveMoneda = 1 AndAlso gvr.DataKey("CveMoneda").ToEntero = 1 Then - importeMX = ImporteMovimiento - ElseIf CveMoneda = 1 AndAlso gvr.DataKey("CveMoneda").ToEntero = 2 Then - tipoCambioCompra = gvr.DataKey("TipoCambio").ToDecimal - importeMX = ImporteMovimiento * If(FuncionalidadFluctuacionImpuestos, TipoCambioPago, tipoCambioCompra) - ElseIf CveMoneda = 2 AndAlso gvr.DataKey("CveMoneda").ToEntero = 1 Then - importeMX = ImporteMovimiento * tipoCambioCompra - ElseIf CveMoneda = 2 AndAlso gvr.DataKey("CveMoneda").ToEntero = 2 Then - tipoCambioCompra = gvr.DataKey("TipoCambio").ToDecimal - importeMX = ImporteMovimiento * If(FuncionalidadFluctuacionImpuestos, TipoCambioPago, tipoCambioCompra) - End If - ImporteMovimiento = Math.Round(ImporteMovimiento, 2, MidpointRounding.AwayFromZero) - importeMX = Math.Round(importeMX, 2, MidpointRounding.AwayFromZero) + ImporteMovimiento = (gvr.DataKey("IEPSPorPagar").ToDecimal * PorcentajePago).RoundSQL + importeMX = (ImporteMovimiento * If(FuncionalidadFluctuacionImpuestos, TipoCambioPago, tipoCambioCompra)).RoundSQL TipoCambioGeneral = If(FuncionalidadFluctuacionImpuestos, TipoCambioPago, tipoCambioCompra) If ImporteMovimiento <> 0 AndAlso TipoContabilidad <> 1 AndAlso ObjMov.GetRetCuenta(ConceptoContable, UsuarioActual.CveEmpresa) Then @@ -1456,6 +1279,7 @@ Partial Class Bancos_ProveedoresAbonar IdCtaContable = ObjMov.DtResultados.Rows(0)("IdCuentaIEPSAcreditable").ToString.ToEntero End If End If + Case 64 'Ganancia If CveMoneda <> 1 OrElse gvr.DataKey("CveMoneda").ToEntero <> 1 Then @@ -1479,37 +1303,6 @@ Partial Class Bancos_ProveedoresAbonar importeMX = ImporteMovimiento End If - '' si tiene funcionalidad de flucturación con ivas, tomar tipocambioventa - 'If tipoCambioPago > tipoCambioVentaDiferenciaCambiaria AndAlso gvr.DataKey("CveMoneda").ToEntero = 2 Then - ' ImporteMovimiento = (gvr.FCTextBox("TxtAbonar").Text.ToDecimal * tipoCambioPago) - (gvr.FCTextBox("TxtAbonar").Text.ToDecimal * tipoCambioVentaDiferenciaCambiaria) 'Añadimos la diferencia de ganancia en la venta - ' ImporteMovimiento -= ((gvr.DataKey("IVA").ToDecimal * PorcentajePago) * TCImpuestos) - ((gvr.DataKey("IVA").ToDecimal * PorcentajePago) * tipoCambioVentaDiferenciaCambiaria) 'Añadimos la diferencia de ganancia en el IVA - ' ImporteMovimiento += ((gvr.DataKey("RetIVA").ToDecimal * PorcentajePago) * TCImpuestos) - ((gvr.DataKey("RetIVA").ToDecimal * PorcentajePago) * tipoCambioVentaDiferenciaCambiaria) 'Añadimos la diferencia de ganancia en el RetIVA - ' ImporteMovimiento += ((gvr.DataKey("RetISR").ToDecimal * PorcentajePago) * TCImpuestos) - ((gvr.DataKey("RetISR").ToDecimal * PorcentajePago) * tipoCambioVentaDiferenciaCambiaria) 'Añadimos la diferencia de ganancia en el RetISR - ' ImporteMovimiento -= ((gvr.DataKey("IEPS").ToDecimal * PorcentajePago) * TCImpuestos) - ((gvr.DataKey("IEPS").ToDecimal * PorcentajePago) * tipoCambioVentaDiferenciaCambiaria) 'Añadimos la diferencia de ganancia en el IEPS - ' ImporteMovimiento = Math.Abs(Math.Round(ImporteMovimiento, 2, MidpointRounding.AwayFromZero)) - ' importeMX = ImporteMovimiento - 'End If - - - 'Dim TotalImporte As Decimal = gvr.FCTextBox("TxtAbonar").Text.ToDecimal - - ''Dim IVA As Decimal = If(TotalImporte = gvr.DataKey("Saldo").ToDecimal, gvr.DataKey("IVAPorPagar").ToDecimal, gvr.DataKey("IVA").ToDecimal * PorcentajePago) - 'Dim IVA As Decimal = 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) - 'Dim IEPS As Decimal = If(TotalImporte = gvr.DataKey("Saldo").ToDecimal AndAlso Math.Abs(Math.Round(gvr.DataKey("IEPSPorPagar").ToDecimal - (gvr.DataKey("IEPS").ToDecimal * PorcentajePago), 2)) <= 0.02, gvr.DataKey("IEPSPorPagar").ToDecimal, gvr.DataKey("IEPS").ToDecimal * PorcentajePago) 'If(TotalImporte = gvr.DataKey("Saldo").ToDecimal, gvr.DataKey("IEPSPorPagar").ToDecimal, gvr.DataKey("IEPS").ToDecimal * PorcentajePago) - - 'IdCtaContable = UsuarioActual.Empresa.IdCuentaGananciaCambiaria - 'Dim TCImpuestos As Decimal = If(FuncionalidadFluctuacionImpuestos, TipoCambioPago, tipoCambioCompraValuacion) - 'TipoCambioGeneral = TCImpuestos - '''' si tiene funcionalidad de flucturación con ivas, tomar tipocambioCompra - 'If TipoCambioPago < tipoCambioCompra AndAlso gvr.DataKey("CveMoneda").ToEntero = 2 Then - ' ImporteMovimiento = (gvr.FCTextBox("TxtAbonar").Text.ToDecimal * TipoCambioPago) - (gvr.FCTextBox("TxtAbonar").Text.ToDecimal * tipoCambioCompra) 'Añadimos la diferencia de ganancia en la venta - ' ImporteMovimiento -= (IVA * TCImpuestos) - (IVA * tipoCambioCompra) 'Añadimos la diferencia de ganancia en el IVA - ' ImporteMovimiento += ((gvr.DataKey("RetIVA").ToDecimal * PorcentajePago) * TCImpuestos) - ((gvr.DataKey("RetIVA").ToDecimal * PorcentajePago) * tipoCambioCompra) 'Añadimos la diferencia de ganancia en el RetIVA - ' ImporteMovimiento += ((gvr.DataKey("RetISR").ToDecimal * PorcentajePago) * TCImpuestos) - ((gvr.DataKey("RetISR").ToDecimal * PorcentajePago) * tipoCambioCompra) 'Añadimos la diferencia de ganancia en el RetISR - ' ImporteMovimiento -= (IEPS * TCImpuestos) - (IEPS * tipoCambioCompra) 'Añadimos la diferencia de ganancia en el IEPS - ' ImporteMovimiento = Math.Abs(Math.Round(ImporteMovimiento, 2, MidpointRounding.AwayFromZero)) - ' importeMX = ImporteMovimiento - 'End If Else ImporteMovimiento = 0 End If @@ -1531,23 +1324,6 @@ Partial Class Bancos_ProveedoresAbonar ImporteMovimiento = Math.Abs(Diferencia) importeMX = ImporteMovimiento End If - - 'Dim TotalImporte As Decimal = gvr.FCTextBox("TxtAbonar").Text.ToDecimal - 'Dim IVA As Decimal = 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) - 'Dim IEPS As Decimal = If(TotalImporte = gvr.DataKey("Saldo").ToDecimal AndAlso Math.Abs(Math.Round(gvr.DataKey("IEPSPorPagar").ToDecimal - (gvr.DataKey("IEPS").ToDecimal * PorcentajePago), 2)) <= 0.02, gvr.DataKey("IEPSPorPagar").ToDecimal, gvr.DataKey("IEPS").ToDecimal * PorcentajePago) 'If(TotalImporte = gvr.DataKey("Saldo").ToDecimal, gvr.DataKey("IEPSPorPagar").ToDecimal, gvr.DataKey("IEPS").ToDecimal * PorcentajePago) - - 'IdCtaContable = UsuarioActual.Empresa.IdCuentaPerdidaCambiaria - 'Dim TCImpuestos As Decimal = If(FuncionalidadFluctuacionImpuestos, TipoCambioPago, tipoCambioCompraValuacion) - '' si tiene funcionalidad de flucturación con ivas, tomar tipocambioCompra - 'If TipoCambioPago > tipoCambioCompra AndAlso gvr.DataKey("CveMoneda").ToEntero = 2 Then - ' ImporteMovimiento = (gvr.FCTextBox("TxtAbonar").Text.ToDecimal * tipoCambioCompra) - (gvr.FCTextBox("TxtAbonar").Text.ToDecimal * TipoCambioPago) 'Añadimos la diferencia de ganancia en la venta - ' ImporteMovimiento -= (IVA * tipoCambioCompra) - (IVA * TCImpuestos) 'Añadimos la diferencia de ganancia en el IVA - ' ImporteMovimiento += ((gvr.DataKey("RetIVA").ToDecimal * PorcentajePago) * tipoCambioCompra) - ((gvr.DataKey("RetIVA").ToDecimal * PorcentajePago) * TCImpuestos) 'Añadimos la diferencia de ganancia en el RetIVA - ' ImporteMovimiento += ((gvr.DataKey("RetISR").ToDecimal * PorcentajePago) * tipoCambioCompra) - ((gvr.DataKey("RetISR").ToDecimal * PorcentajePago) * TCImpuestos) 'Añadimos la diferencia de ganancia en el RetISR - ' ImporteMovimiento -= (IEPS * tipoCambioCompra) - (IEPS * TCImpuestos) 'Añadimos la diferencia de ganancia en el IEPS - ' ImporteMovimiento = Math.Abs(Math.Round(ImporteMovimiento, 2, MidpointRounding.AwayFromZero)) - ' importeMX = ImporteMovimiento - 'End If Else ImporteMovimiento = 0 End If @@ -1645,8 +1421,6 @@ Partial Class Bancos_ProveedoresAbonar ObjComp.ProgramarCompra(gvr.DataKey("CveCompra").ToEntero, 0, UsuarioActual.CveUsuario, -1) End If - ' End If - End If Next ConceptoMovimiento = $"{TxtPagueseA.Text.Trim} - {TxtObservaciones.Text} {If(TipoCambioPago > 1, $" TC:{TipoCambioPago}", "")}" @@ -1816,7 +1590,6 @@ Partial Class Bancos_ProveedoresAbonar Exit For Else - 'IVA. siempre se registra aunque sea cero If MsgError = "" Then