-clientesabonar, descuento pronto pago

- extensiones, redondeo mayor a 4
This commit is contained in:
2020-01-22 18:41:56 -07:00
parent 64422caab8
commit 200e0b2ee1
2 changed files with 22 additions and 16 deletions

View File

@@ -641,8 +641,10 @@ Partial Class Ventas_ClientesAbonar
e.Row.FCRangeValidator("RVComision").MaximumValue = e.Row.DBCampo("Saldo")
End If
If e.Row.DBCampo("DescuentoProntoPago").ToDecimal() >= 0 Then
If e.Row.DBCampo("DescuentoProntoPago").ToDecimal() > 0 Then
e.Row.FCCheckBox("ChkGenerarNC").Visible = True
e.Row.FCCheckBox("ChkGenerarNC").Attributes.Add("onclick", String.Format("FnSuma(this,{0},{1}); FnCambia({2},this,{1},0,{3},{4});", e.Row.FCTextBox("TxtAbonar").ClientID, e.Row.DBCampo("Saldo").ToDecimal - e.Row.DBCampo("DescuentoProntoPago").ToDecimal, e.Row.FCCheckBox("ChkGenerarNC").ClientID, CveMonedaFiltro, moneda))
End If
Else
@@ -1876,12 +1878,12 @@ Partial Class Ventas_ClientesAbonar
Dim DtVentasNC = InicializaDTVentasNC()
Dim TotalImporte As Decimal = ObjFacturaDevolucion.DtDetalle.SUM("TotalImporte").ToDecimal()
Dim ImporteIVA As Decimal = ObjFacturaDevolucion.DtDetalle.SUM("ImporteIVA").ToDecimal()
Dim ImporteRetIVA As Decimal = ObjFacturaDevolucion.DtDetalle.SUM("ImporteRetIVA").ToDecimal()
Dim ImporteRetISR As Decimal = ObjFacturaDevolucion.DtDetalle.SUM("ImporteRetISR").ToDecimal()
Dim ImporteIEPS As Decimal = ObjFacturaDevolucion.DtDetalle.SUM("ImporteIEPS").ToDecimal()
Dim Descuento As Decimal = ObjFacturaDevolucion.DtDetalle.SUM("Descuento").ToDecimal()
Dim TotalImporte As Decimal = ObjFacturaDevolucion.DtDetalle.SUMD("TotalImporte")
Dim ImporteIVA As Decimal = ObjFacturaDevolucion.DtDetalle.SUMD("ImporteIVA")
Dim ImporteRetIVA As Decimal = ObjFacturaDevolucion.DtDetalle.SUMD("ImporteRetIVA")
Dim ImporteRetISR As Decimal = ObjFacturaDevolucion.DtDetalle.SUMD("ImporteRetISR")
Dim ImporteIEPS As Decimal = ObjFacturaDevolucion.DtDetalle.SUMD("ImporteIEPS")
Dim Descuento As Decimal = ObjFacturaDevolucion.DtDetalle.SUMD("Descuento")
Dim Amortizacion As Decimal = 0
Dim Total As Decimal = (TotalImporte + ImporteIVA + ImporteIEPS) - (ImporteRetIVA + ImporteRetISR + Descuento + Amortizacion)
@@ -1908,7 +1910,7 @@ Partial Class Ventas_ClientesAbonar
DtVentasNC.AcceptChanges()
ObjFacturaDevolucion.DtVentasNC = DtVentasNC
ObjFacturaDevolucion.GenerarPDFFactura = True
Dim Resp = ObjFacturaDevolucion.EmitirFactura(False, Trasac:=Trasac, ObjContPaqTransac:=ObjConta)
Return Resp
@@ -2056,21 +2058,25 @@ Partial Class Ventas_ClientesAbonar
Dim ImporteReferencia As Decimal = Total
Dim Porcentaje As Decimal = ((Importe * 100) / ImporteReferencia) / 100
Dim FiltroStr As String = ""
Dim ImporteTotalConcepto As Decimal = 0
For Each Dr As DataRow In DtImpuestosLocal.Rows
FiltroStr = String.Format("ISNULL(PorcentajeIVA,0) = {0} AND ISNULL(PorcentajeRetIVA,0) = {1} AND ISNULL(PorcentajeRetISR,0) = {2} AND ISNULL(PorcentajeIEPS,0) = {3} AND ISNULL(CveSubProyecto,0) = {4} ", Dr("PorcentajeIVA").ToString.ToDecimal, Dr("PorcentajeRetIVA").ToString.ToDecimal, Dr("PorcentajeRetISR").ToString.ToDecimal, Dr("PorcentajeIEPS").ToString.ToDecimal, Dr("CveSubProyecto"))
Dr("ImporteTotal") = Math.Round(Porcentaje * (TmpDT.SUM("TotalImporte", FiltroStr) - TmpDT.SUM("Descuento", FiltroStr)), 2)
ImporteTotalConcepto = Porcentaje * (TmpDT.SUMD("TotalImporte", FiltroStr) - TmpDT.SUMD("Descuento", FiltroStr))
Dr("ImporteIVA") = (Dr("ImporteTotal").ToString().ToDecimal() * Dr("PorcentajeIVA").ToString().ToDecimal()).RoundSQL(2)
Dr("ImporteRetIVA") = (Dr("ImporteTotal").ToString().ToDecimal() * Dr("PorcentajeRetIVA").ToString().ToDecimal()).RoundSQL(2)
Dr("ImporteRetISR") = (Dr("ImporteTotal").ToString().ToDecimal() * Dr("PorcentajeRetISR").ToString().ToDecimal()).RoundSQL(2)
Dr("ImporteIEPS") = (Dr("ImporteTotal").ToString().ToDecimal() * Dr("PorcentajeIEPS").ToString().ToDecimal()).RoundSQL(2)
Dr("ImportePU") = ImporteTotalConcepto.RoundSQL(6)
Dr("ImporteTotal") = ImporteTotalConcepto.RoundSQL(2)
Dr("ImporteIVA") = (ImporteTotalConcepto * Dr("PorcentajeIVA").ToString().ToDecimal()).RoundSQL(2)
Dr("ImporteRetIVA") = (ImporteTotalConcepto * Dr("PorcentajeRetIVA").ToString().ToDecimal()).RoundSQL(2)
Dr("ImporteRetISR") = (ImporteTotalConcepto * Dr("PorcentajeRetISR").ToString().ToDecimal()).RoundSQL(2)
Dr("ImporteIEPS") = (ImporteTotalConcepto * Dr("PorcentajeIEPS").ToString().ToDecimal()).RoundSQL(2)
'Dr("ImporteIVA") = Math.Round(Porcentaje * TmpDT.SUM("ImporteIVA", FiltroStr), 2)
'Dr("ImporteRetIVA") = Math.Round(Porcentaje * TmpDT.SUM("ImporteRetIVA", FiltroStr), 2)
'Dr("ImporteRetISR") = Math.Round(Porcentaje * TmpDT.SUM("ImporteRetISR", FiltroStr), 2)
'Dr("ImporteIEPS") = Math.Round(Porcentaje * TmpDT.SUM("ImporteIEPS", FiltroStr), 2)
Dr("ImportePU") = Dr("ImporteTotal").ToString.ToDecimal '(Dr("ImporteTotal").ToString.ToDecimal - Dr("ImporteIVA").ToString.ToDecimal - Dr("ImporteRetIVA").ToString.ToDecimal - Dr("ImporteRetISR").ToString.ToDecimal - Dr("ImporteIEPS").ToString.ToDecimal)
'(Dr("ImporteTotal").ToString.ToDecimal - Dr("ImporteIVA").ToString.ToDecimal - Dr("ImporteRetIVA").ToString.ToDecimal - Dr("ImporteRetISR").ToString.ToDecimal - Dr("ImporteIEPS").ToString.ToDecimal)
Next
'codigo para ajuste de centavo, si el importe total no cuadra con los totales
Dim difTmp As Decimal = Importe - (DtImpuestosLocal.SUMD("ImporteTotal") + DtImpuestosLocal.SUMD("ImporteIVA") + DtImpuestosLocal.SUMD("ImporteIEPS") - DtImpuestosLocal.SUMD("ImporteRetIVA") - DtImpuestosLocal.SUMD("ImporteRetISR"))