From a27d873895109bd973c59761a6b37a07b36081c6 Mon Sep 17 00:00:00 2001 From: Jonathan Alexis Perez Morales Date: Wed, 21 Jul 2021 12:36:21 -0700 Subject: [PATCH] Descuento de usado no reparte bien entre varias partidas --- Ventas/PV.aspx | 2 +- Ventas/PV.aspx.vb | 26 +++++++++++++------------- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/Ventas/PV.aspx b/Ventas/PV.aspx index 931b817de..fc06bd5a1 100644 --- a/Ventas/PV.aspx +++ b/Ventas/PV.aspx @@ -775,7 +775,7 @@ Descuentos: -   +  <%----%> Amort. Ant.: diff --git a/Ventas/PV.aspx.vb b/Ventas/PV.aspx.vb index daa018d47..eb9a6e81d 100644 --- a/Ventas/PV.aspx.vb +++ b/Ventas/PV.aspx.vb @@ -688,7 +688,7 @@ Partial Class PV Get Return New Dictionary(Of Integer, Decimal) From { {20516, 0.23D}, 'Descuento para lubricantes LTH - {20515, 0.28D} 'Descuento para filtros LTH + {20515, 0.24D} 'Descuento para filtros LTH } End Get End Property @@ -1114,7 +1114,7 @@ Partial Class PV TxtPrecio.Attributes.Add("onKeyUp ", "Recalcula();") ImgDescPU.Attributes.Add("onclick", "javascript:$('#ModalDescuento').modal(); $get('LblTitulo1').style.display = ''; $get('LblTitulo2').style.display = 'none'; $get('LblTituloTipo1').style.display = ''; $get('LblTituloTipo2').style.display = 'none'; $get('HdnTipoDescuento').value = '0'; $get('LblPrecio1').style.display = ''; $get('LblTotalPS1').style.display = 'none'; $get('LblSubTotal1').style.display = 'none'; $get('LblAmort').style.display = 'none'; $get('BtnAplicarDescP').style.display = ''; $get('BtnAplicarDescG').style.display = 'none'; $get('TrMotivoDescuento').style.display = '';") 'ImgDescConcepto.Attributes.Add("onclick", "javascript:$('#ModalDescuento').modal(); $get('LblTitulo1').style.display = ''; $get('LblTitulo2').style.display = 'none'; $get('LblTituloTipo1').style.display = ''; $get('LblTituloTipo2').style.display = 'none'; $get('HdnTipoDescuento').value = '1'; $get('LblPrecio1').style.display = 'none'; $get('LblTotalPS1').style.display = ''; $get('LblSubTotal1').style.display = 'none'; $get('LblAmort').style.display = 'none'; $get('BtnAplicarDescP').style.display = ''; $get('BtnAplicarDescG').style.display = 'none'; $get('TrMotivoDescuento').style.display = '';") - ImgDescTotal.Attributes.Add("onclick", "javascript:$('#ModalDescuento').modal(); $get('LblTitulo1').style.display = ''; $get('LblTitulo2').style.display = 'none'; $get('LblTituloTipo1').style.display = ''; $get('LblTituloTipo2').style.display = 'none'; $get('HdnTipoDescuento').value = '2'; $get('LblPrecio1').style.display = 'none'; $get('LblTotalPS1').style.display = 'none'; $get('LblSubTotal1').style.display = ''; $get('LblAmort').style.display = 'none'; $get('BtnAplicarDescP').style.display = 'none'; $get('BtnAplicarDescG').style.display = ''; $get('TrMotivoDescuento').style.display = '';") + 'ImgDescTotal.Attributes.Add("onclick", "javascript:$('#ModalDescuento').modal(); $get('LblTitulo1').style.display = ''; $get('LblTitulo2').style.display = 'none'; $get('LblTituloTipo1').style.display = ''; $get('LblTituloTipo2').style.display = 'none'; $get('HdnTipoDescuento').value = '2'; $get('LblPrecio1').style.display = 'none'; $get('LblTotalPS1').style.display = 'none'; $get('LblSubTotal1').style.display = ''; $get('LblAmort').style.display = 'none'; $get('BtnAplicarDescP').style.display = 'none'; $get('BtnAplicarDescG').style.display = ''; $get('TrMotivoDescuento').style.display = '';") ImgOtrosConceptos.Attributes.Add("onclick", "javascript:$('#ModalOtrosConceptos').modal();") LkbAgregarComplementos.Attributes.Add("onclick", "javascript:$('#ModalComplementos').modal();") 'ImgCerrar.Attributes.Add("OnClick", "$('#DivAnticipos').hide();") @@ -1653,7 +1653,7 @@ Partial Class PV TxtObsPS.Enabled = False TxtPrecio.Enabled = False ImgDescPU.Attributes.Clear() - ImgDescTotal.Attributes.Clear() + 'ImgDescTotal.Attributes.Clear() LbAgregar.Enabled = False DdlCuentasTerminal.Enabled = False @@ -1716,7 +1716,7 @@ Partial Class PV TxtObsPS.Enabled = True TxtPrecio.Enabled = True ImgDescPU.Attributes.Clear() - ImgDescTotal.Attributes.Clear() + 'ImgDescTotal.Attributes.Clear() LbAgregar.Enabled = True DdlCuentasTerminal.Enabled = True @@ -1793,7 +1793,7 @@ Partial Class PV TxtObsPS.Enabled = True TxtPrecio.Enabled = True LbAgregar.Enabled = True - ImgDescTotal.Attributes.Add("onclick", "javascript:$('#ModalDescuento').modal(); $get('LblTitulo1').style.display = ''; $get('LblTitulo2').style.display = 'none'; $get('LblTituloTipo1').style.display = ''; $get('LblTituloTipo2').style.display = 'none'; $get('HdnTipoDescuento').value = '2'; $get('LblPrecio1').style.display = 'none'; $get('LblTotalPS1').style.display = 'none'; $get('LblSubTotal1').style.display = ''; $get('LblAmort').style.display = 'none'; $get('BtnAplicarDescP').style.display = 'none'; $get('BtnAplicarDescG').style.display = ''; $get('TrMotivoDescuento').style.display = '';") + 'ImgDescTotal.Attributes.Add("onclick", "javascript:$('#ModalDescuento').modal(); $get('LblTitulo1').style.display = ''; $get('LblTitulo2').style.display = 'none'; $get('LblTituloTipo1').style.display = ''; $get('LblTituloTipo2').style.display = 'none'; $get('HdnTipoDescuento').value = '2'; $get('LblPrecio1').style.display = 'none'; $get('LblTotalPS1').style.display = 'none'; $get('LblSubTotal1').style.display = ''; $get('LblAmort').style.display = 'none'; $get('BtnAplicarDescP').style.display = 'none'; $get('BtnAplicarDescG').style.display = ''; $get('TrMotivoDescuento').style.display = '';") LblSubTotal1.Text = TxtSubTotal.Text LblAmort.Text = TxtSubTotal.Text @@ -5050,13 +5050,13 @@ Partial Class PV If CveVentaDetalle <= 0 AndAlso Not EsCargo Then Dim ListaPSCargo = CalculaUsados(Consec) If ListaPSCargo.Count > 0 Then - CalculaRecepcionUsados(CvePS, ListaPSCargo, Cantidad) + CalculaRecepcionUsados(CvePS, ListaPSCargo, Cantidad, Consec) End If ElseIf CveVentaDetalle > 0 AndAlso Not EsCargo Then EliminarUsados() Dim ListaPSCargo = CalculaUsados(Consec, LimpiarUsados:=False) If ListaPSCargo.Count > 0 Then - CalculaRecepcionUsados(CvePS, ListaPSCargo, Cantidad) + CalculaRecepcionUsados(CvePS, ListaPSCargo, Cantidad, Consec) End If End If @@ -7148,7 +7148,7 @@ Partial Class PV EmitirImprimirNew() End Sub - Private Sub CalculaRecepcionUsados(CvePS As Integer, ListaPSCargo As List(Of Integer), CantidadUsado As Decimal) + Private Sub CalculaRecepcionUsados(CvePS As Integer, ListaPSCargo As List(Of Integer), CantidadUsado As Decimal, ConsecPSPadre As Integer) If Modalidad = "U" Then If TmpDTRecepcionUsados.Rows.Count > 0 Then @@ -7168,7 +7168,7 @@ Partial Class PV Dim TotalCargos As Decimal = 0 Dim TotalCantidad As Decimal = 0 Dim StrTamanios As New StringBuilder() - StrTamanios.Append("Se recibieron los siguientes usados:") + StrTamanios.Append("Se recibierón los siguientes usados:") 'For Each Gvr As GridViewRow In Gv.Rows ' If Gvr.RowType = DataControlRowType.DataRow Then @@ -7233,8 +7233,8 @@ Partial Class PV ' Exit Sub 'End If - Dim DtUsadosFiltro As DataTable = TmpDT.FiltraParametros($"EsCargo = True AND EliminarDB = False AND CvePS IN ({StrCargos})") - Dim DivisorUsado = DtUsadosFiltro.Rows.Count.ToString().ToDecimal() + Dim DtUsadosFiltro As DataTable = TmpDT.FiltraParametros($"ConsecPSPadre = {ConsecPSPadre} AND EsCargo = True AND EliminarDB = False AND CvePS IN ({StrCargos}) AND (Total - Descuento) > 0.0000") + Dim DivisorUsado As Decimal = 1 For Each Dr As DataRow In DtUsadosFiltro.Rows @@ -7278,8 +7278,8 @@ Partial Class PV Next TmpDT.AcceptChanges() If TotalCargos > 0 Then ' cuando se entrega más valor de usados, que los cargos hechos, se descuenta sobre el PU del producto de venta - Dim DtPSFiltro As DataTable = TmpDT.FiltraParametros($"EsCargo = False AND EliminarDB = False AND CvePS={CvePS}") - Dim Divisor = DtPSFiltro.Rows.Count.ToString().ToDecimal() + Dim DtPSFiltro As DataTable = TmpDT.FiltraParametros($"Consec = {ConsecPSPadre} AND EsCargo = False AND EliminarDB = False AND CvePS={CvePS} AND (Total - Descuento) > 0.0000", Orderby:="Consec DESC") + Dim Divisor As Decimal = 1 For Each Dr As DataRow In DtPSFiltro.Rows