Descuento de usado no reparte bien entre varias partidas

This commit is contained in:
2021-07-21 12:36:21 -07:00
parent c2ff0ed590
commit a27d873895
2 changed files with 14 additions and 14 deletions

View File

@@ -775,7 +775,7 @@
<td><b>Descuentos:</b></td>
<td>
<asp:Label ID="LblDescuentos" ClientIDMode="Static" runat="server" Style="text-align: right;" Text="0.00" Width="78px"></asp:Label></td>
<td align="right">&nbsp;<asp:LinkButton ID="ImgDescTotal" runat="server" Text="<i class='fa fa-comment-o'></i>" Style="cursor: pointer;" AlternateText="Agregar Descuento" /></td>
<td align="right">&nbsp;<%--<asp:LinkButton ID="ImgDescTotal" runat="server" Text="<i class='fa fa-comment-o'></i>" Style="cursor: pointer;" AlternateText="Agregar Descuento" />--%></td>
</tr>
<tr align="right">
<td style="border: 1px none white"><b>Amort. Ant.:</b></td>

View File

@@ -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