Usados entregados como descuentos
This commit is contained in:
@@ -2707,7 +2707,7 @@
|
||||
<div class="col-md-12" visible="false">
|
||||
<asp:GridView ID="GvRecepcionUsados" runat="server" GridLines="None" ShowHeaderWhenEmpty="true" CssClass="table table-hover table-striped ScrollAD mysmallbtn"
|
||||
data-sort="true" BorderWidth="1" BorderColor="#D3D3D3" CellSpacing="0" Width="100%" AutoGenerateColumns="False" data-height="100"
|
||||
DataKeyNames="CvePSCargo,CveUM,Cargo,CveTamaño">
|
||||
DataKeyNames="CvePSCargo,CveUM,Cargo,CveTamaño,CodigoPS">
|
||||
<Columns>
|
||||
<asp:BoundField DataField="CodigoPS" HeaderText="Tamaño" ItemStyle-HorizontalAlign="Left" ItemStyle-Width="35%" />
|
||||
<asp:TemplateField HeaderText="Cantidad" ItemStyle-HorizontalAlign="Center" ItemStyle-Width="20%">
|
||||
|
||||
@@ -4657,7 +4657,28 @@ Partial Class PV
|
||||
DdlPSIndexChange(DdlPS.SelectedValue.ToEntero, DdlPS)
|
||||
DdlUnidadMedida.SelectedValueExist(GvRow.DataKey("CveUM"))
|
||||
TxtCantidad.Text = GvRow.DataKey("Cantidad")
|
||||
TxtObsPS.Text = GvRow.DataKey("Obs")
|
||||
|
||||
'Dim TotalCargos As Decimal = 0
|
||||
'Dim StrTamanios As New StringBuilder()
|
||||
'StrTamanios.Append("Se recibierón los siguientes usados:")
|
||||
|
||||
'For Each Gvr As GridViewRow In GvRecepcionUsados.Rows
|
||||
' If Gvr.RowType = DataControlRowType.DataRow Then
|
||||
' If Gvr.FCTextBox("TxtCantidad").Text.ToString.ToDecimal > 0 Then
|
||||
' TotalCargos += Gvr.FCTextBox("TxtCantidad").Text.ToString.ToDecimal * Gvr.DataKey("Cargo").ToDecimal
|
||||
' StrTamanios.AppendFormat("{0},", Gvr.DataKey("CodigoPS"))
|
||||
' End If
|
||||
' End If
|
||||
'Next
|
||||
|
||||
'If TotalCargos > 0 Then
|
||||
' StrTamanios.Remove(StrTamanios.Length - 1, 1)
|
||||
'Else
|
||||
' StrTamanios.Clear()
|
||||
'End If
|
||||
|
||||
TxtObsPS.Text = GvRow.DataKey("Obs") '.Replace(StrTamanios.ToString(), "")
|
||||
|
||||
TxtPrecio.Text = GvRow.DataKey("PU")
|
||||
TxtDescuento.Text = GvRow.DataKey("Descuento")
|
||||
LblTotalPS.Text = GvRow.DataKey("Total")
|
||||
@@ -6681,12 +6702,16 @@ Partial Class PV
|
||||
|
||||
Dim TotalCargos As Decimal = 0
|
||||
Dim TotalCantidad As Decimal = 0
|
||||
Dim StrTamanios As New StringBuilder()
|
||||
StrTamanios.Append("Se recibierón los siguientes usados:")
|
||||
|
||||
For Each Gvr As GridViewRow In Gv.Rows
|
||||
If Gvr.RowType = DataControlRowType.DataRow Then
|
||||
|
||||
If Gvr.FCTextBox("TxtCantidad").Text.ToString.ToDecimal > 0 Then
|
||||
TotalCargos += Gvr.FCTextBox("TxtCantidad").Text.ToString.ToDecimal * Gvr.DataKey("Cargo").ToDecimal
|
||||
TotalCantidad += Gvr.FCTextBox("TxtCantidad").Text.ToString.ToDecimal
|
||||
StrTamanios.AppendFormat("{0},", Gvr.DataKey("CodigoPS"))
|
||||
|
||||
Dim Row As DataRow = TmpDTRecepcionUsados.NewRow()
|
||||
Row("CvePS") = Gvr.DataKey("CvePSCargo").ToEntero
|
||||
@@ -6703,9 +6728,15 @@ Partial Class PV
|
||||
End If
|
||||
Next
|
||||
|
||||
If TotalCargos > 0 Then
|
||||
StrTamanios.Remove(StrTamanios.Length - 1, 1)
|
||||
Else
|
||||
StrTamanios.Clear()
|
||||
End If
|
||||
|
||||
Dim StrCargos As New StringBuilder
|
||||
For Each CvePSCargo As Integer In ListaPSCargo
|
||||
StrCargos.AppendFormat("{0},", CvePSCargo)
|
||||
StrCargos.AppendFormat(" {0},", CvePSCargo)
|
||||
Next
|
||||
StrCargos.Remove(StrCargos.Length - 1, 1)
|
||||
|
||||
@@ -6720,28 +6751,38 @@ Partial Class PV
|
||||
For Each Dr As DataRow In TmpDT.FiltraParametros($"EsCargo = True AND EliminarDB = False AND CvePS IN ({StrCargos})").Rows
|
||||
|
||||
Dim TotalAnterior As Decimal = Dr("Cantidad").ToString.ToDecimal * Dr("PU").ToString.ToDecimal
|
||||
Dim PUActual As Decimal = (TotalAnterior - TotalCargos) / Dr("Cantidad").ToString.ToDecimal
|
||||
Dim Descuento As Decimal = Dr("Descuento").ToString.ToDecimal
|
||||
Dim TotalCalculableImpuestos As Decimal = (Dr("Cantidad").ToString.ToDecimal * (PUActual)) - Descuento
|
||||
TotalCargos -= TotalAnterior
|
||||
|
||||
If PUActual <= 0 Then
|
||||
Dim drt As DataRow() = TmpDT.Select("Consec = " & Dr("Consec").ToString)
|
||||
TmpDT.Rows.Remove(drt(0))
|
||||
Else
|
||||
Dim drt As DataRow() = TmpDT.Select("Consec = " & Dr("Consec").ToString)
|
||||
Dim drr As DataRow = drt(0)
|
||||
drr("PU") = PUActual
|
||||
drr("ImporteIVA") = Math.Round(Dr("PorcentajeIVA").ToString.ToDecimal * TotalCalculableImpuestos, NumeroDecimales)
|
||||
drr("ImporteRetIVA") = Math.Round(ClienteRetIVA * TotalCalculableImpuestos, NumeroDecimales)
|
||||
drr("ImporteRetISR") = Math.Round(ClienteRetISR * TotalCalculableImpuestos, NumeroDecimales)
|
||||
drr("ImporteIEPS") = Math.Round(Dr("PorcentajeIEPS").ToString.ToDecimal * TotalCalculableImpuestos, NumeroDecimales)
|
||||
drr("IEPS") = Dr("ImporteIEPS")
|
||||
drr("Total") = (Dr("Cantidad").ToString.ToDecimal * PUActual)
|
||||
drr("TotalImporte") = Math.Round(Dr("Cantidad").ToString.ToDecimal * PUActual, NumeroDecimales)
|
||||
'Dim PUActual As Decimal = (TotalAnterior - TotalCargos) / Dr("Cantidad").ToString.ToDecimal
|
||||
Dim DescuentoCargo As Decimal = (TotalCargos / Dr("Cantidad").ToString.ToDecimal)
|
||||
|
||||
If DescuentoCargo > (TotalAnterior - Dr("Descuento").ToString.ToDecimal()) Then
|
||||
DescuentoCargo = (TotalAnterior - Dr("Descuento").ToString.ToDecimal())
|
||||
End If
|
||||
|
||||
Dim Descuento As Decimal = Dr("Descuento").ToString.ToDecimal + DescuentoCargo
|
||||
Dim TotalCalculableImpuestos As Decimal = (Dr("Cantidad").ToString.ToDecimal * (Dr("PU").ToString.ToDecimal)) - Descuento
|
||||
TotalCargos -= DescuentoCargo
|
||||
|
||||
'If PUActual <= 0 Then
|
||||
' Dim drt As DataRow() = TmpDT.Select("Consec = " & Dr("Consec").ToString)
|
||||
' TmpDT.Rows.Remove(drt(0))
|
||||
'Else
|
||||
|
||||
|
||||
'End If
|
||||
|
||||
Dim drt As DataRow() = TmpDT.Select("Consec = " & Dr("Consec").ToString)
|
||||
Dim drr As DataRow = drt(0)
|
||||
'drr("PU") = PUActual
|
||||
drr("ImporteIVA") = Math.Round(Dr("PorcentajeIVA").ToString.ToDecimal * TotalCalculableImpuestos, NumeroDecimales)
|
||||
drr("ImporteRetIVA") = Math.Round(ClienteRetIVA * TotalCalculableImpuestos, NumeroDecimales)
|
||||
drr("ImporteRetISR") = Math.Round(ClienteRetISR * TotalCalculableImpuestos, NumeroDecimales)
|
||||
drr("ImporteIEPS") = Math.Round(Dr("PorcentajeIEPS").ToString.ToDecimal * TotalCalculableImpuestos, NumeroDecimales)
|
||||
drr("IEPS") = Dr("ImporteIEPS")
|
||||
drr("Descuento") = Descuento
|
||||
drr("Obs") = StrTamanios.ToString() + Dr("Obs").ToString()
|
||||
'drr("Total") = (Dr("Cantidad").ToString.ToDecimal * PUActual)
|
||||
'drr("TotalImporte") = Math.Round(Dr("Cantidad").ToString.ToDecimal * PUActual, NumeroDecimales)
|
||||
|
||||
If TotalCargos <= 0 Then
|
||||
Exit For
|
||||
End If
|
||||
@@ -6752,27 +6793,47 @@ Partial Class PV
|
||||
For Each Dr As DataRow In TmpDT.FiltraParametros($"EsCargo = False AND EliminarDB = False AND CvePS={CvePS}").Rows
|
||||
|
||||
Dim PUAnterior As Decimal = Dr("Cantidad").ToString.ToDecimal * Dr("PU").ToString.ToDecimal
|
||||
Dim PUActual As Decimal = PUAnterior - (TotalCargos / Dr("Cantidad").ToString.ToDecimal)
|
||||
Dim Descuento As Decimal = Dr("Descuento").ToString.ToDecimal
|
||||
Dim TotalCalculableImpuestos As Decimal = (Dr("Cantidad").ToString.ToDecimal * (PUActual)) - Descuento
|
||||
TotalCargos += -(TotalCargos / Dr("Cantidad").ToString.ToDecimal)
|
||||
Dim DescuentoCargo As Decimal = (TotalCargos / Dr("Cantidad").ToString.ToDecimal)
|
||||
|
||||
If PUActual <= 0 Then
|
||||
Dim drt As DataRow() = TmpDT.Select("Consec = " & Dr("Consec").ToString)
|
||||
TmpDT.Rows.Remove(drt(0))
|
||||
Else
|
||||
Dim drt As DataRow() = TmpDT.Select("Consec = " & Dr("Consec").ToString)
|
||||
Dim drr As DataRow = drt(0)
|
||||
drr("PU") = PUActual
|
||||
drr("ImporteIVA") = Math.Round(Dr("PorcentajeIVA").ToString.ToDecimal * TotalCalculableImpuestos, NumeroDecimales)
|
||||
drr("ImporteRetIVA") = Math.Round(ClienteRetIVA * TotalCalculableImpuestos, NumeroDecimales)
|
||||
drr("ImporteRetISR") = Math.Round(ClienteRetISR * TotalCalculableImpuestos, NumeroDecimales)
|
||||
drr("ImporteIEPS") = Math.Round(Dr("PorcentajeIEPS").ToString.ToDecimal * TotalCalculableImpuestos, NumeroDecimales)
|
||||
drr("IEPS") = Dr("ImporteIEPS")
|
||||
drr("Total") = (Dr("Cantidad").ToString.ToDecimal * PUActual)
|
||||
drr("TotalImporte") = Math.Round(Dr("Cantidad").ToString.ToDecimal * PUActual, NumeroDecimales)
|
||||
If DescuentoCargo > (PUAnterior - Dr("Descuento").ToString.ToDecimal()) Then
|
||||
DescuentoCargo = (PUAnterior - 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 drt As DataRow() = TmpDT.Select("Consec = " & Dr("Consec").ToString)
|
||||
Dim drr As DataRow = drt(0)
|
||||
|
||||
drr("ImporteIVA") = Math.Round(Dr("PorcentajeIVA").ToString.ToDecimal * TotalCalculableImpuestos, NumeroDecimales)
|
||||
drr("ImporteRetIVA") = Math.Round(ClienteRetIVA * TotalCalculableImpuestos, NumeroDecimales)
|
||||
drr("ImporteRetISR") = Math.Round(ClienteRetISR * TotalCalculableImpuestos, NumeroDecimales)
|
||||
drr("ImporteIEPS") = Math.Round(Dr("PorcentajeIEPS").ToString.ToDecimal * TotalCalculableImpuestos, NumeroDecimales)
|
||||
drr("IEPS") = Dr("ImporteIEPS")
|
||||
drr("Descuento") = Descuento
|
||||
'drr("Obs") = StrTamanios.ToString() + Dr("Obs").ToString()
|
||||
'drr("Total") = (Dr("Cantidad").ToString.ToDecimal * PUActual)
|
||||
'drr("TotalImporte") = Math.Round(Dr("Cantidad").ToString.ToDecimal * PUActual, NumeroDecimales)
|
||||
|
||||
'If PUActual <= 0 Then
|
||||
' Dim drt As DataRow() = TmpDT.Select("Consec = " & Dr("Consec").ToString)
|
||||
' TmpDT.Rows.Remove(drt(0))
|
||||
'Else
|
||||
' Dim drt As DataRow() = TmpDT.Select("Consec = " & Dr("Consec").ToString)
|
||||
' Dim drr As DataRow = drt(0)
|
||||
' 'drr("PU") = PUActual
|
||||
' drr("ImporteIVA") = Math.Round(Dr("PorcentajeIVA").ToString.ToDecimal * TotalCalculableImpuestos, NumeroDecimales)
|
||||
' drr("ImporteRetIVA") = Math.Round(ClienteRetIVA * TotalCalculableImpuestos, NumeroDecimales)
|
||||
' drr("ImporteRetISR") = Math.Round(ClienteRetISR * TotalCalculableImpuestos, NumeroDecimales)
|
||||
' drr("ImporteIEPS") = Math.Round(Dr("PorcentajeIEPS").ToString.ToDecimal * TotalCalculableImpuestos, NumeroDecimales)
|
||||
' drr("IEPS") = Dr("ImporteIEPS")
|
||||
' 'drr("Total") = (Dr("Cantidad").ToString.ToDecimal * PUActual)
|
||||
' 'drr("TotalImporte") = Math.Round(Dr("Cantidad").ToString.ToDecimal * PUActual, NumeroDecimales)
|
||||
'End If
|
||||
|
||||
If TotalCargos <= 0 Then
|
||||
Exit For
|
||||
End If
|
||||
|
||||
Reference in New Issue
Block a user