Cantidad de recepcion de usados
This commit is contained in:
@@ -4993,13 +4993,13 @@ Partial Class PV
|
||||
If CveVentaDetalle <= 0 AndAlso Not EsCargo Then
|
||||
Dim ListaPSCargo = CalculaUsados(Consec)
|
||||
If ListaPSCargo.Count > 0 Then
|
||||
CalculaRecepcionUsados(CvePS, ListaPSCargo)
|
||||
CalculaRecepcionUsados(CvePS, ListaPSCargo, Cantidad)
|
||||
End If
|
||||
ElseIf CveVentaDetalle > 0 AndAlso Not EsCargo Then
|
||||
EliminarUsados()
|
||||
Dim ListaPSCargo = CalculaUsados(Consec, LimpiarUsados:=False)
|
||||
If ListaPSCargo.Count > 0 Then
|
||||
CalculaRecepcionUsados(CvePS, ListaPSCargo)
|
||||
CalculaRecepcionUsados(CvePS, ListaPSCargo, Cantidad)
|
||||
End If
|
||||
End If
|
||||
|
||||
@@ -7091,7 +7091,7 @@ Partial Class PV
|
||||
|
||||
EmitirImprimirNew()
|
||||
End Sub
|
||||
Private Sub CalculaRecepcionUsados(CvePS As Integer, ListaPSCargo As List(Of Integer))
|
||||
Private Sub CalculaRecepcionUsados(CvePS As Integer, ListaPSCargo As List(Of Integer), CantidadUsado As Decimal)
|
||||
|
||||
If Modalidad = "U" Then
|
||||
If TmpDTRecepcionUsados.Rows.Count > 0 Then
|
||||
@@ -7139,14 +7139,14 @@ Partial Class PV
|
||||
Dim DrTamanio As DataRow = GlobalDTAcumTamaños.FiltroPrimero($"CveEmpresa = {UsuarioActual.CveEmpresa} AND CvePSCargo = {DdlRecepcionUsados.SelectedValue}")
|
||||
|
||||
If DdlRecepcionUsados.SelectedValue.ToEntero() > 0 Then
|
||||
TotalCargos += 1D * DrTamanio("Cargo").ToString().ToDecimal
|
||||
TotalCantidad += 1D
|
||||
TotalCargos += CantidadUsado * DrTamanio("Cargo").ToString().ToDecimal
|
||||
TotalCantidad += CantidadUsado
|
||||
StrTamanios.AppendFormat("{0},", DrTamanio("CodigoPS"))
|
||||
|
||||
Dim Row As DataRow = TmpDTRecepcionUsados.NewRow()
|
||||
Row("CvePS") = DrTamanio("CvePSCargo").ToString().ToEntero
|
||||
Row("CvePSRelacionado") = CvePS
|
||||
Row("Cantidad") = 1D
|
||||
Row("Cantidad") = CantidadUsado
|
||||
Row("CveUM") = DrTamanio("CveUM").ToString().ToEntero
|
||||
Row("CveVentaDetalle") = -1
|
||||
Row("PU") = DrTamanio("Cargo").ToString().ToDecimal
|
||||
@@ -7176,11 +7176,14 @@ Partial Class PV
|
||||
' Exit Sub
|
||||
'End If
|
||||
|
||||
For Each Dr As DataRow In TmpDT.FiltraParametros($"EsCargo = True AND EliminarDB = False AND CvePS IN ({StrCargos})").Rows
|
||||
Dim DtUsadosFiltro As DataTable = TmpDT.FiltraParametros($"EsCargo = True AND EliminarDB = False AND CvePS IN ({StrCargos})")
|
||||
Dim DivisorUsado = DtUsadosFiltro.Rows.Count.ToString().ToDecimal()
|
||||
|
||||
For Each Dr As DataRow In DtUsadosFiltro.Rows
|
||||
|
||||
Dim TotalAnterior As Decimal = Dr("Cantidad").ToString.ToDecimal * Dr("PU").ToString.ToDecimal
|
||||
'Dim PUActual As Decimal = (TotalAnterior - TotalCargos) / Dr("Cantidad").ToString.ToDecimal
|
||||
Dim DescuentoCargo As Decimal = (TotalCargos / Dr("Cantidad").ToString.ToDecimal)
|
||||
Dim DescuentoCargo As Decimal = (TotalCargos / DivisorUsado)
|
||||
|
||||
If DescuentoCargo > (TotalAnterior - Dr("Descuento").ToString.ToDecimal()) Then
|
||||
DescuentoCargo = (TotalAnterior - Dr("Descuento").ToString.ToDecimal())
|
||||
@@ -7218,20 +7221,23 @@ 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
|
||||
For Each Dr As DataRow In TmpDT.FiltraParametros($"EsCargo = False AND EliminarDB = False AND CvePS={CvePS}").Rows
|
||||
Dim DtPSFiltro As DataTable = TmpDT.FiltraParametros($"EsCargo = False AND EliminarDB = False AND CvePS={CvePS}")
|
||||
Dim Divisor = DtPSFiltro.Rows.Count.ToString().ToDecimal()
|
||||
|
||||
Dim PUAnterior As Decimal = Dr("Cantidad").ToString.ToDecimal * Dr("PU").ToString.ToDecimal
|
||||
Dim DescuentoCargo As Decimal = (TotalCargos / Dr("Cantidad").ToString.ToDecimal)
|
||||
For Each Dr As DataRow In DtPSFiltro.Rows
|
||||
|
||||
If DescuentoCargo > (PUAnterior - Dr("Descuento").ToString.ToDecimal()) Then
|
||||
DescuentoCargo = (PUAnterior - Dr("Descuento").ToString.ToDecimal())
|
||||
Dim TotalAnterior As Decimal = Dr("Cantidad").ToString.ToDecimal * Dr("PU").ToString.ToDecimal
|
||||
Dim DescuentoCargo As Decimal = (TotalCargos / Divisor)
|
||||
|
||||
If DescuentoCargo > (TotalAnterior - Dr("Descuento").ToString.ToDecimal()) Then
|
||||
DescuentoCargo = (TotalAnterior - Dr("Descuento").ToString.ToDecimal())
|
||||
End If
|
||||
|
||||
'Dim PUActual As Decimal = PUAnterior - DescuentoCargo
|
||||
Dim Descuento As Decimal = Dr("Descuento").ToString.ToDecimal + DescuentoCargo
|
||||
|
||||
Dim TotalCalculableImpuestos As Decimal = (Dr("Cantidad").ToString.ToDecimal * (PUAnterior)) - Descuento
|
||||
TotalCargos += -DescuentoCargo
|
||||
Dim TotalCalculableImpuestos As Decimal = (Dr("Cantidad").ToString.ToDecimal * Dr("PU").ToString.ToDecimal) - Descuento
|
||||
TotalCargos -= DescuentoCargo
|
||||
|
||||
Dim drt As DataRow() = TmpDT.Select("Consec = " & Dr("Consec").ToString)
|
||||
Dim drr As DataRow = drt(0)
|
||||
|
||||
Reference in New Issue
Block a user