From 2dc9346e259e880ab36ade54c8b313b30d2b15af Mon Sep 17 00:00:00 2001 From: Jonathan Alexis Perez Morales Date: Thu, 15 Jun 2023 17:52:50 -0700 Subject: [PATCH] Correcion en aplicacion de anticipos con descuentos, filtro de subproyectos --- Ventas/Ventas.aspx.vb | 34 +++++++++++++++++++++++++--------- 1 file changed, 25 insertions(+), 9 deletions(-) diff --git a/Ventas/Ventas.aspx.vb b/Ventas/Ventas.aspx.vb index 61dbf6af5..986cfb108 100644 --- a/Ventas/Ventas.aspx.vb +++ b/Ventas/Ventas.aspx.vb @@ -6320,7 +6320,7 @@ Partial Class Ventas UpINV.Update() End Sub - Private Sub CargaSubProyecto(Optional CveSubProyecto As Integer = -1) + Private Sub CargaSubProyecto(Optional CveSubProyecto As Integer = -1, Optional FiltraPorProyecto As Boolean = False) 'DdlSubProyecto.Items.Clear() 'DdlSubProyecto.SelectedValue = Nothing 'If DdlProyecto.SelectedValue.ToEntero() > 0 Then @@ -6329,6 +6329,20 @@ Partial Class Ventas 'End If 'DdlSubProyecto.DataBind() 'DdlSubProyecto.Items.Insert(0, New ListItem("Sin SubProyecto Asignado", "-1")) + + If FiltraPorProyecto Then + DdlSubProyecto.Items.Clear() + + Using ObjSubP As New ClsSubProyectos + If ObjSubP.GetSubProyectos(UsuarioActual.CveEmpresa) Then + DdlSubProyecto.DataSource = ObjSubP.DtResultados.FiltraParametros(String.Format("CveProyecto = {0}", DdlProyecto.SelectedValue)) + End If + End Using + + DdlSubProyecto.DataBind() + DdlSubProyecto.Items.Insert(0, New ListItem("Sin SubProyecto Asignado", "-1")) + End If + If CveSubProyecto > 0 Then DdlSubProyecto.SelectedValueExist(CveSubProyecto) End Sub @@ -18089,7 +18103,7 @@ Partial Class Ventas End If End Sub Protected Sub DdlProyecto_SelectedIndexChanged(sender As Object, e As System.EventArgs) Handles DdlProyecto.SelectedIndexChanged - CargaSubProyecto() + CargaSubProyecto(FiltraPorProyecto:=True) End Sub #End Region @@ -30131,11 +30145,7 @@ Partial Class Ventas 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")) Dim importePuTemp As Decimal = 0 - If AplicaDescuentos Then - importePuTemp = (Porcentaje * (TmpDT.SUMD("TotalImporte", FiltroStr))) - Else - importePuTemp = (Porcentaje * (TmpDT.SUMD("TotalImporte", FiltroStr) - TmpDT.SUMD("Descuento", FiltroStr))) - End If + importePuTemp = (Porcentaje * (TmpDT.SUMD("TotalImporte", FiltroStr) - TmpDT.SUMD("Descuento", FiltroStr))) If Not AplicaImpuestosLocales Then importePuTemp = importePuTemp - TotalImpuestosLocalesVentaOriginal @@ -30154,10 +30164,13 @@ Partial Class Ventas Dr("ImporteRetIVA") = (importePuTemp * Dr("PorcentajeRetIVA").ToString().ToDecimal()) Dr("ImporteRetISR") = (importePuTemp * Dr("PorcentajeRetISR").ToString().ToDecimal()) - Dr("ImportePU") = importePuTemp If AplicaDescuentos Then + Dr("ImportePU") = importePuTemp + TmpDT.SUMD("Descuento", FiltroStr) Dr("Descuento") = Porcentaje * TmpDT.SUMD("Descuento", FiltroStr) + Dr("ImporteTotal") = Dr("ImportePU").ToString().ToDecimal().RoundSQL(2) + Else + Dr("ImportePU") = importePuTemp End If If AplicaRedondeo Then @@ -30172,11 +30185,14 @@ Partial Class Ventas End If End If - Next Dim importeNC = (DtImpuestosLocal.SUMD("ImporteTotal") + DtImpuestosLocal.SUMD("ImporteIVA") + DtImpuestosLocal.SUMD("ImporteIEPS") - DtImpuestosLocal.SUMD("ImporteRetIVA") - DtImpuestosLocal.SUMD("ImporteRetISR")) + If AplicaDescuentos Then + importeNC -= DtImpuestosLocal.SUMD("Descuento") + End If + If AplicaImpuestosLocales Then Importe = Importe + TotalImpuestosLocalesRecalculado End If