Ajuste en descuento al amortizar

This commit is contained in:
2020-03-05 17:00:14 -07:00
parent d4271708c7
commit 41b4dec550
2 changed files with 24 additions and 5 deletions

View File

@@ -397,8 +397,8 @@ Partial Class Compras_RepComprasDetalle
ImprimirPDF(String.Format("{0}Formatos\Remesa.rdlc", UsuarioActual.Empresa.Ruta), DtDatos.FiltraParametros("CveCompra > 0"), params, "Remesa", RDSName:="DsCompras")
End Sub
Protected Sub LnkExportar_Click(sender As Object, e As EventArgs) Handles LnkExportar.Click
'GvDatos.ExportToExcel("ReporteComprasClasificacion" & Now.ToShortDateString)
GenerarPDF("EXCEL")
GvDatos.ExportToExcel("ReporteComprasDetalles" & Now.ToShortDateString)
'GenerarPDF("EXCEL")
End Sub
Protected Sub LnkPdf_Click(sender As Object, e As EventArgs)

View File

@@ -12379,14 +12379,20 @@ Partial Class Ventas
' Exit Sub
'End If
Dim TotalCalculableImpuestos As Decimal = 0
Dim Cantidad, PU, Descuento As Decimal
Dim TotalDescuentosRound As Decimal = 0
Dim Cantidad, PU, Descuento, DescuentoRound As Decimal
For Each dr As DataRow In TmpDT.Rows
Cantidad = dr("Cantidad").ToString.ToDecimal
PU = dr("PU").ToString.ToDecimal
'proporcional la mortización al concepto
Descuento = PU * Cantidad / LblSubTotal1.Text.ToDecimal * Amortizacion
Descuento = (PU * Cantidad / LblSubTotal1.Text.ToDecimal * Amortizacion)
DescuentoRound = Descuento.RoundSQL(NumeroDecimales)
TotalDescuentosRound += DescuentoRound
TotalCalculableImpuestos = (Cantidad * (PU)) - Descuento
dr("Descuento") = Descuento
dr("Descuento") = DescuentoRound
dr("TotalImporte") = Math.Round(Cantidad * PU, NumeroDecimales)
dr("ImporteIVA") = Math.Round(dr("PorcentajeIVA").ToString.ToDecimal * TotalCalculableImpuestos, NumeroDecimales)
dr("ImporteIEPS") = Math.Round(dr("PorcentajeIEPS").ToString.ToDecimal * TotalCalculableImpuestos, NumeroDecimales)
@@ -12395,6 +12401,19 @@ Partial Class Ventas
dr("PorcentajeRetIVA") = ClienteRetIVA
dr("PorcentajeRetISR") = ClienteRetISR
Next
'REVISA SI EXISTEN DIFERENCIAS ENTRE EL DESCUENTO Y LO AMORTIZADO PARA REALIZAR UN AJUSTE EN EL ULTIMO CONCEPTO AGREGADO
Dim diff As Decimal = Math.Abs(TotalDescuentosRound - Amortizacion)
Dim DrUltimo As DataRow = TmpDT.Rows(TmpDT.Rows.Count - 1)
'SI EL DESCUENTO SUPERA LO AMORTIZADO RESTA LA DIFERENCIA AL ULTIMO DESCUENTO
If TotalDescuentosRound > Amortizacion Then
DrUltimo("Descuento") = DrUltimo("Descuento").ToString().ToDecimal() - diff
End If
'SI EL DESCUENTO ES MENOR A LO AMORTIZADO SUMA LA DIFERENCIA AL ULTIMO DESCUENTO
If TotalDescuentosRound < Amortizacion Then
DrUltimo("Descuento") = DrUltimo("Descuento").ToString().ToDecimal() + diff
End If
GvPS.DataSource = TmpDT
GvPS.DataBind()