-clientesabonar, descuento pronto pago
- extensiones, redondeo mayor a 4
This commit is contained in:
@@ -890,13 +890,13 @@ Namespace Extensiones
|
|||||||
Public Function RoundSQL(Valor As Double, Optional Decimales As Integer = 2) As Double
|
Public Function RoundSQL(Valor As Double, Optional Decimales As Integer = 2) As Double
|
||||||
'Return Math.Round(Valor, Decimales, MidpointRounding.AwayFromZero)
|
'Return Math.Round(Valor, Decimales, MidpointRounding.AwayFromZero)
|
||||||
'primero, se redondea a 4, para que concuerde al redondeo de sql, si se redondea a 2 decimales por ejemplo
|
'primero, se redondea a 4, para que concuerde al redondeo de sql, si se redondea a 2 decimales por ejemplo
|
||||||
Return If(Decimales < 4, Math.Round(Math.Round(Valor, 4, MidpointRounding.AwayFromZero), Decimales, MidpointRounding.AwayFromZero), Math.Round(Valor, MidpointRounding.AwayFromZero))
|
Return If(Decimales < 4, Math.Round(Math.Round(Valor, 4, MidpointRounding.AwayFromZero), Decimales, MidpointRounding.AwayFromZero), Math.Round(Valor, Decimales, MidpointRounding.AwayFromZero))
|
||||||
End Function
|
End Function
|
||||||
|
|
||||||
<Runtime.CompilerServices.Extension()>
|
<Runtime.CompilerServices.Extension()>
|
||||||
Public Function RoundSQL(Valor As Decimal, Optional Decimales As Integer = 2) As Decimal
|
Public Function RoundSQL(Valor As Decimal, Optional Decimales As Integer = 2) As Decimal
|
||||||
'primero, se redondea a 4, para que concuerde al redondeo de sql
|
'primero, se redondea a 4, para que concuerde al redondeo de sql
|
||||||
Return If(Decimales < 4, Math.Round(Math.Round(Valor, 4, MidpointRounding.AwayFromZero), Decimales, MidpointRounding.AwayFromZero), Math.Round(Valor, MidpointRounding.AwayFromZero))
|
Return If(Decimales < 4, Math.Round(Math.Round(Valor, 4, MidpointRounding.AwayFromZero), Decimales, MidpointRounding.AwayFromZero), Math.Round(Valor, Decimales, MidpointRounding.AwayFromZero))
|
||||||
End Function
|
End Function
|
||||||
<Runtime.CompilerServices.Extension()>
|
<Runtime.CompilerServices.Extension()>
|
||||||
Public Function Abs(Valor As Double) As Double
|
Public Function Abs(Valor As Double) As Double
|
||||||
|
|||||||
@@ -641,8 +641,10 @@ Partial Class Ventas_ClientesAbonar
|
|||||||
e.Row.FCRangeValidator("RVComision").MaximumValue = e.Row.DBCampo("Saldo")
|
e.Row.FCRangeValidator("RVComision").MaximumValue = e.Row.DBCampo("Saldo")
|
||||||
End If
|
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").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
|
End If
|
||||||
|
|
||||||
Else
|
Else
|
||||||
@@ -1876,12 +1878,12 @@ Partial Class Ventas_ClientesAbonar
|
|||||||
|
|
||||||
Dim DtVentasNC = InicializaDTVentasNC()
|
Dim DtVentasNC = InicializaDTVentasNC()
|
||||||
|
|
||||||
Dim TotalImporte As Decimal = ObjFacturaDevolucion.DtDetalle.SUM("TotalImporte").ToDecimal()
|
Dim TotalImporte As Decimal = ObjFacturaDevolucion.DtDetalle.SUMD("TotalImporte")
|
||||||
Dim ImporteIVA As Decimal = ObjFacturaDevolucion.DtDetalle.SUM("ImporteIVA").ToDecimal()
|
Dim ImporteIVA As Decimal = ObjFacturaDevolucion.DtDetalle.SUMD("ImporteIVA")
|
||||||
Dim ImporteRetIVA As Decimal = ObjFacturaDevolucion.DtDetalle.SUM("ImporteRetIVA").ToDecimal()
|
Dim ImporteRetIVA As Decimal = ObjFacturaDevolucion.DtDetalle.SUMD("ImporteRetIVA")
|
||||||
Dim ImporteRetISR As Decimal = ObjFacturaDevolucion.DtDetalle.SUM("ImporteRetISR").ToDecimal()
|
Dim ImporteRetISR As Decimal = ObjFacturaDevolucion.DtDetalle.SUMD("ImporteRetISR")
|
||||||
Dim ImporteIEPS As Decimal = ObjFacturaDevolucion.DtDetalle.SUM("ImporteIEPS").ToDecimal()
|
Dim ImporteIEPS As Decimal = ObjFacturaDevolucion.DtDetalle.SUMD("ImporteIEPS")
|
||||||
Dim Descuento As Decimal = ObjFacturaDevolucion.DtDetalle.SUM("Descuento").ToDecimal()
|
Dim Descuento As Decimal = ObjFacturaDevolucion.DtDetalle.SUMD("Descuento")
|
||||||
Dim Amortizacion As Decimal = 0
|
Dim Amortizacion As Decimal = 0
|
||||||
|
|
||||||
Dim Total As Decimal = (TotalImporte + ImporteIVA + ImporteIEPS) - (ImporteRetIVA + ImporteRetISR + Descuento + Amortizacion)
|
Dim Total As Decimal = (TotalImporte + ImporteIVA + ImporteIEPS) - (ImporteRetIVA + ImporteRetISR + Descuento + Amortizacion)
|
||||||
@@ -1908,7 +1910,7 @@ Partial Class Ventas_ClientesAbonar
|
|||||||
DtVentasNC.AcceptChanges()
|
DtVentasNC.AcceptChanges()
|
||||||
|
|
||||||
ObjFacturaDevolucion.DtVentasNC = DtVentasNC
|
ObjFacturaDevolucion.DtVentasNC = DtVentasNC
|
||||||
|
ObjFacturaDevolucion.GenerarPDFFactura = True
|
||||||
Dim Resp = ObjFacturaDevolucion.EmitirFactura(False, Trasac:=Trasac, ObjContPaqTransac:=ObjConta)
|
Dim Resp = ObjFacturaDevolucion.EmitirFactura(False, Trasac:=Trasac, ObjContPaqTransac:=ObjConta)
|
||||||
Return Resp
|
Return Resp
|
||||||
|
|
||||||
@@ -2056,21 +2058,25 @@ Partial Class Ventas_ClientesAbonar
|
|||||||
Dim ImporteReferencia As Decimal = Total
|
Dim ImporteReferencia As Decimal = Total
|
||||||
Dim Porcentaje As Decimal = ((Importe * 100) / ImporteReferencia) / 100
|
Dim Porcentaje As Decimal = ((Importe * 100) / ImporteReferencia) / 100
|
||||||
Dim FiltroStr As String = ""
|
Dim FiltroStr As String = ""
|
||||||
|
Dim ImporteTotalConcepto As Decimal = 0
|
||||||
For Each Dr As DataRow In DtImpuestosLocal.Rows
|
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"))
|
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("ImportePU") = ImporteTotalConcepto.RoundSQL(6)
|
||||||
Dr("ImporteRetIVA") = (Dr("ImporteTotal").ToString().ToDecimal() * Dr("PorcentajeRetIVA").ToString().ToDecimal()).RoundSQL(2)
|
Dr("ImporteTotal") = ImporteTotalConcepto.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("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("ImporteIVA") = Math.Round(Porcentaje * TmpDT.SUM("ImporteIVA", FiltroStr), 2)
|
||||||
'Dr("ImporteRetIVA") = Math.Round(Porcentaje * TmpDT.SUM("ImporteRetIVA", FiltroStr), 2)
|
'Dr("ImporteRetIVA") = Math.Round(Porcentaje * TmpDT.SUM("ImporteRetIVA", FiltroStr), 2)
|
||||||
'Dr("ImporteRetISR") = Math.Round(Porcentaje * TmpDT.SUM("ImporteRetISR", FiltroStr), 2)
|
'Dr("ImporteRetISR") = Math.Round(Porcentaje * TmpDT.SUM("ImporteRetISR", FiltroStr), 2)
|
||||||
'Dr("ImporteIEPS") = Math.Round(Porcentaje * TmpDT.SUM("ImporteIEPS", 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
|
Next
|
||||||
'codigo para ajuste de centavo, si el importe total no cuadra con los totales
|
'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"))
|
Dim difTmp As Decimal = Importe - (DtImpuestosLocal.SUMD("ImporteTotal") + DtImpuestosLocal.SUMD("ImporteIVA") + DtImpuestosLocal.SUMD("ImporteIEPS") - DtImpuestosLocal.SUMD("ImporteRetIVA") - DtImpuestosLocal.SUMD("ImporteRetISR"))
|
||||||
|
|||||||
Reference in New Issue
Block a user