Ferretera. Recalculo de precios, segun es credito o contado

This commit is contained in:
2024-03-01 16:14:23 -07:00
parent 2324bf20b7
commit 295f1884fa
2 changed files with 61 additions and 8 deletions

View File

@@ -12955,13 +12955,13 @@ Partial Class Ventas
'si el codigo objeto impuesto es 02 y no tiene desglose de impuestos por el descuento, debe asignar el valor 04 - Si objeto de impuesto y no causa impuesto
If concepto.Impuestos.Count = 0 AndAlso concepto.ObjetoImpuesto = "02" AndAlso (concepto.Importe - concepto.Descuento + concepto.ImporteGravaIVAAdicional).RoundSQL(2) = 0.00D Then
concepto.ObjetoImpuesto = "04"
''se ajusta a un centavo, para que se pueda emitir con un centavo.
'If UsuarioActual.CveEmpresa = 140 Then
' concepto.ObjetoImpuesto = "02"
' concepto.Descuento = concepto.Descuento - 0.01D
' Obj.SubTotal = Obj.SubTotal + 0.01D
' Obj.Total = Obj.Total + 0.01D
'End If
'se ajusta a un centavo, para que se pueda emitir con un centavo.
If UsuarioActual.CveEmpresa = 140 Then
concepto.ObjetoImpuesto = "02"
concepto.Descuento = concepto.Descuento - 0.01D
Obj.SubTotal = Obj.SubTotal + 0.01D
Obj.Total = Obj.Total + 0.01D
End If
End If
Timbre.Conceptos.Add(concepto)
@@ -17341,6 +17341,15 @@ Partial Class Ventas
Alert("No hay una lista de precios predeterminada", TipoMensaje.MsgAdvertencia)
End If
If UsuarioActual.Empresa.Funcionalidad(109) = "1" Then
If RBLPago.SelectedValue = "1" Then
Dim CvePrecioListaCredito = GlobalDTPrecioListas(UsuarioActual.CveEmpresa).FiltroPrimeroValor("CvePrecioLista", "ISNULL(Credito,False) = True").ToEntero()
If CvePrecioListaCredito > 0 Then
CvePrecioListaPS = CvePrecioListaCredito
End If
End If
End If
If CvePrecioListaPS > 0 Then
Dim ObjPS As New ClsProductosServicios
If ObjPS.GetPSPreciosLista(UsuarioActual.CveEmpresa, CvePrecioListaPS, CvePS:=CvePSParametro) Then
@@ -23256,6 +23265,9 @@ Partial Class Ventas
End Sub
Private Sub RBLPago_SelectedIndexChanged(sender As Object, e As EventArgs) Handles RBLPago.SelectedIndexChanged
LimpiaEscondeContado()
If UsuarioActual.Empresa.Funcionalidad(109) = "1" Then
RecalculaPrecios()
End If
End Sub
Private Function ValidaPagosContado(Optional MostrarAlertas As Boolean = True, Optional TipoDoctoViejo As String = "") As Boolean
Dim Retorno As Boolean = False
@@ -37414,5 +37426,41 @@ Partial Class Ventas
RegistraScript("MuestraAnticipos();", "AE")
End Sub
Private Sub RecalculaPrecios()
If TmpDT IsNot Nothing Then
For Each Row As DataRow In TmpDT.Rows
Dim Cantidad As Decimal = Row("Cantidad").ToString().ToDecimal()
Dim CveClasificacion As Integer = Row("CveClasificacion").ToString().ToEntero
Dim CvePS As Integer = Row("CvePS").ToString().ToEntero
Dim ObjPrecioSugerido As Modelos.MPrecioSugerido = CalculaPrecioSugerido(CvePS, CveClasificacion)
If ObjPrecioSugerido.PrecioSugerido > 0 Then
Dim PU As Decimal = ObjPrecioSugerido.PrecioSugerido.RoundSQL(6)
Dim ObjDescuento As Modelos.VentaDescuentos = CalcularDescuentos(CvePS, Cantidad, PU)
If ObjDescuento.EsPUModificado Then
PU = ObjDescuento.PU
End If
Row("PU") = PU
Dim TotalCalculableImpuestos As Decimal = ((Cantidad * PU) - (ObjDescuento.ImporteDescuento))
Dim TotalCalculableImpuestosIVA As Decimal = 0
TotalCalculableImpuestosIVA = TotalCalculableImpuestos * (1 + Row("PorcentajeIEPS").ToString().ToDecimal)
Row("ImporteIVA") = (Row("PorcentajeIVA").ToString().ToDecimal * TotalCalculableImpuestosIVA).RoundSQL(NumeroDecimales)
Row("Descuento") = (ObjDescuento.ImporteDescuento).RoundSQL(NumeroDecimales)
Row("Total") = (Cantidad * PU)
Row("TotalImporte") = (Cantidad * PU).RoundSQL(NumeroDecimales)
End If
Next
Me.CalculaTotalesVenta()
End If
End Sub
End Class