Ajuste en descuento al amortizar
This commit is contained in:
@@ -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")
|
ImprimirPDF(String.Format("{0}Formatos\Remesa.rdlc", UsuarioActual.Empresa.Ruta), DtDatos.FiltraParametros("CveCompra > 0"), params, "Remesa", RDSName:="DsCompras")
|
||||||
End Sub
|
End Sub
|
||||||
Protected Sub LnkExportar_Click(sender As Object, e As EventArgs) Handles LnkExportar.Click
|
Protected Sub LnkExportar_Click(sender As Object, e As EventArgs) Handles LnkExportar.Click
|
||||||
'GvDatos.ExportToExcel("ReporteComprasClasificacion" & Now.ToShortDateString)
|
GvDatos.ExportToExcel("ReporteComprasDetalles" & Now.ToShortDateString)
|
||||||
GenerarPDF("EXCEL")
|
'GenerarPDF("EXCEL")
|
||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
Protected Sub LnkPdf_Click(sender As Object, e As EventArgs)
|
Protected Sub LnkPdf_Click(sender As Object, e As EventArgs)
|
||||||
|
|||||||
@@ -12379,14 +12379,20 @@ Partial Class Ventas
|
|||||||
' Exit Sub
|
' Exit Sub
|
||||||
'End If
|
'End If
|
||||||
Dim TotalCalculableImpuestos As Decimal = 0
|
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
|
For Each dr As DataRow In TmpDT.Rows
|
||||||
Cantidad = dr("Cantidad").ToString.ToDecimal
|
Cantidad = dr("Cantidad").ToString.ToDecimal
|
||||||
PU = dr("PU").ToString.ToDecimal
|
PU = dr("PU").ToString.ToDecimal
|
||||||
'proporcional la mortización al concepto
|
'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
|
TotalCalculableImpuestos = (Cantidad * (PU)) - Descuento
|
||||||
dr("Descuento") = Descuento
|
dr("Descuento") = DescuentoRound
|
||||||
dr("TotalImporte") = Math.Round(Cantidad * PU, NumeroDecimales)
|
dr("TotalImporte") = Math.Round(Cantidad * PU, NumeroDecimales)
|
||||||
dr("ImporteIVA") = Math.Round(dr("PorcentajeIVA").ToString.ToDecimal * TotalCalculableImpuestos, NumeroDecimales)
|
dr("ImporteIVA") = Math.Round(dr("PorcentajeIVA").ToString.ToDecimal * TotalCalculableImpuestos, NumeroDecimales)
|
||||||
dr("ImporteIEPS") = Math.Round(dr("PorcentajeIEPS").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("PorcentajeRetIVA") = ClienteRetIVA
|
||||||
dr("PorcentajeRetISR") = ClienteRetISR
|
dr("PorcentajeRetISR") = ClienteRetISR
|
||||||
Next
|
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.DataSource = TmpDT
|
||||||
GvPS.DataBind()
|
GvPS.DataBind()
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user