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><b>Descuentos:</b></td>
<td> <td>
<asp:Label ID="LblDescuentos" ClientIDMode="Static" runat="server" Style="text-align: right;" Text="0.00" Width="78px"></asp:Label></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>
<tr align="right"> <tr align="right">
<td style="border: 1px none white"><b>Amort. Ant.:</b></td> <td style="border: 1px none white"><b>Amort. Ant.:</b></td>

View File

@@ -688,7 +688,7 @@ Partial Class PV
Get Get
Return New Dictionary(Of Integer, Decimal) From { Return New Dictionary(Of Integer, Decimal) From {
{20516, 0.23D}, 'Descuento para lubricantes LTH {20516, 0.23D}, 'Descuento para lubricantes LTH
{20515, 0.28D} 'Descuento para filtros LTH {20515, 0.24D} 'Descuento para filtros LTH
} }
End Get End Get
End Property End Property
@@ -1114,7 +1114,7 @@ Partial Class PV
TxtPrecio.Attributes.Add("onKeyUp ", "Recalcula();") 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 = '';") 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 = '';") '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();") ImgOtrosConceptos.Attributes.Add("onclick", "javascript:$('#ModalOtrosConceptos').modal();")
LkbAgregarComplementos.Attributes.Add("onclick", "javascript:$('#ModalComplementos').modal();") LkbAgregarComplementos.Attributes.Add("onclick", "javascript:$('#ModalComplementos').modal();")
'ImgCerrar.Attributes.Add("OnClick", "$('#DivAnticipos').hide();") 'ImgCerrar.Attributes.Add("OnClick", "$('#DivAnticipos').hide();")
@@ -1653,7 +1653,7 @@ Partial Class PV
TxtObsPS.Enabled = False TxtObsPS.Enabled = False
TxtPrecio.Enabled = False TxtPrecio.Enabled = False
ImgDescPU.Attributes.Clear() ImgDescPU.Attributes.Clear()
ImgDescTotal.Attributes.Clear() 'ImgDescTotal.Attributes.Clear()
LbAgregar.Enabled = False LbAgregar.Enabled = False
DdlCuentasTerminal.Enabled = False DdlCuentasTerminal.Enabled = False
@@ -1716,7 +1716,7 @@ Partial Class PV
TxtObsPS.Enabled = True TxtObsPS.Enabled = True
TxtPrecio.Enabled = True TxtPrecio.Enabled = True
ImgDescPU.Attributes.Clear() ImgDescPU.Attributes.Clear()
ImgDescTotal.Attributes.Clear() 'ImgDescTotal.Attributes.Clear()
LbAgregar.Enabled = True LbAgregar.Enabled = True
DdlCuentasTerminal.Enabled = True DdlCuentasTerminal.Enabled = True
@@ -1793,7 +1793,7 @@ Partial Class PV
TxtObsPS.Enabled = True TxtObsPS.Enabled = True
TxtPrecio.Enabled = True TxtPrecio.Enabled = True
LbAgregar.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 LblSubTotal1.Text = TxtSubTotal.Text
LblAmort.Text = TxtSubTotal.Text LblAmort.Text = TxtSubTotal.Text
@@ -5050,13 +5050,13 @@ Partial Class PV
If CveVentaDetalle <= 0 AndAlso Not EsCargo Then If CveVentaDetalle <= 0 AndAlso Not EsCargo Then
Dim ListaPSCargo = CalculaUsados(Consec) Dim ListaPSCargo = CalculaUsados(Consec)
If ListaPSCargo.Count > 0 Then If ListaPSCargo.Count > 0 Then
CalculaRecepcionUsados(CvePS, ListaPSCargo, Cantidad) CalculaRecepcionUsados(CvePS, ListaPSCargo, Cantidad, Consec)
End If End If
ElseIf CveVentaDetalle > 0 AndAlso Not EsCargo Then ElseIf CveVentaDetalle > 0 AndAlso Not EsCargo Then
EliminarUsados() EliminarUsados()
Dim ListaPSCargo = CalculaUsados(Consec, LimpiarUsados:=False) Dim ListaPSCargo = CalculaUsados(Consec, LimpiarUsados:=False)
If ListaPSCargo.Count > 0 Then If ListaPSCargo.Count > 0 Then
CalculaRecepcionUsados(CvePS, ListaPSCargo, Cantidad) CalculaRecepcionUsados(CvePS, ListaPSCargo, Cantidad, Consec)
End If End If
End If End If
@@ -7148,7 +7148,7 @@ Partial Class PV
EmitirImprimirNew() EmitirImprimirNew()
End Sub 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 Modalidad = "U" Then
If TmpDTRecepcionUsados.Rows.Count > 0 Then If TmpDTRecepcionUsados.Rows.Count > 0 Then
@@ -7168,7 +7168,7 @@ Partial Class PV
Dim TotalCargos As Decimal = 0 Dim TotalCargos As Decimal = 0
Dim TotalCantidad As Decimal = 0 Dim TotalCantidad As Decimal = 0
Dim StrTamanios As New StringBuilder() 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 'For Each Gvr As GridViewRow In Gv.Rows
' If Gvr.RowType = DataControlRowType.DataRow Then ' If Gvr.RowType = DataControlRowType.DataRow Then
@@ -7233,8 +7233,8 @@ Partial Class PV
' Exit Sub ' Exit Sub
'End If 'End If
Dim DtUsadosFiltro As DataTable = TmpDT.FiltraParametros($"EsCargo = True AND EliminarDB = False AND CvePS IN ({StrCargos})") 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 = DtUsadosFiltro.Rows.Count.ToString().ToDecimal() Dim DivisorUsado As Decimal = 1
For Each Dr As DataRow In DtUsadosFiltro.Rows For Each Dr As DataRow In DtUsadosFiltro.Rows
@@ -7278,8 +7278,8 @@ Partial Class PV
Next Next
TmpDT.AcceptChanges() 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 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 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 = DtPSFiltro.Rows.Count.ToString().ToDecimal() Dim Divisor As Decimal = 1
For Each Dr As DataRow In DtPSFiltro.Rows For Each Dr As DataRow In DtPSFiltro.Rows