Ventas. -- método y forma de pago

- PV, ajustes en garantía
This commit is contained in:
rrene
2019-11-11 18:40:03 -07:00
parent 59cb7565ec
commit 5e14ef0ed8
3 changed files with 34 additions and 51 deletions

View File

@@ -2941,7 +2941,7 @@
<label for="<%= TxtPoliza.ClientID.ToString()%>">Poliza:</label>
</div>
</div>
<div class="col-md-3">
<div class="col-md-4">
<div class="form-group form-md-line-input input-iconright">
<asp:TextBox ID="TxtImporteAjuste" CssClass="form-control" runat="server" Enabled="false" MaxLength="50"></asp:TextBox>
<asp:RequiredFieldValidator ID="RFVImporteAjuste" runat="server" ControlToValidate="TxtImporteAjuste" Display="None" ErrorMessage="<b><span style='text-decoration: underline'>ERROR:</span></b><br />El campo <b>''Importe''</b> es necesario, por favor ingréselo." ValidationGroup="GrpAddVenta"></asp:RequiredFieldValidator>
@@ -2949,17 +2949,8 @@
<ajax:FilteredTextBoxExtender ID="FTBEImporteAjuste" runat="server" TargetControlID="TxtImporteAjuste" FilterType="Custom, Numbers" ValidChars="." />
<label for="<%= TxtImporteAjuste.ClientID.ToString()%>">Importe:</label>
</div>
</div>
<div class="col-md-3">
<div class="form-group form-md-line-input input-iconright">
<asp:TextBox ID="TxtDescuentoAjuste" CssClass="form-control" runat="server" Enabled="false" MaxLength="50"></asp:TextBox>
<asp:RequiredFieldValidator ID="RFVDescuentoAjuste" runat="server" ControlToValidate="TxtDescuentoAjuste" Display="None" ErrorMessage="<b><span style='text-decoration: underline'>ERROR:</span></b><br />El campo <b>''Descuento''</b> es necesario, por favor ingréselo." ValidationGroup="GrpAddVenta"></asp:RequiredFieldValidator>
<ajax:ValidatorCalloutExtender ID="VCEDescuentoAjuste" runat="server" HighlightCssClass="vco" TargetControlID="RFVDescuentoAjuste"></ajax:ValidatorCalloutExtender>
<ajax:FilteredTextBoxExtender ID="FTBEDescuentoAjuste" runat="server" TargetControlID="TxtDescuentoAjuste" FilterType="Custom, Numbers" ValidChars=".," />
<label for="<%= TxtImporteAjuste.ClientID.ToString()%>">Descuento:</label>
</div>
</div>
<div class="col-md-3">
</div>
<div class="col-md-4">
<asp:Button ID="BtnCalcularImporteAjuste" CssClass="btn green-haze btn-outline btn-circle btn-sm" OnClick="BtnCalcularImporteAjuste_Click" runat="server" Text="Recalcular" />
</div>
</div>

View File

@@ -5161,9 +5161,24 @@ Partial Class PV
Contador += 1
Next
TxtPUFactura.Text = PUFactura.FormatoNumero(2)
End If
If Not DdlPSAjuste.SelectedValue.ToEntero > 0 AndAlso DdlFacturas.SelectedValue.ToEntero > 0 Then
If DdlPSAjuste.SelectedValue.ToEntero > 0 AndAlso Not DdlFacturas.SelectedValue.ToEntero > 0 Then
Dim Index As Integer = DdlPSAjuste.SelectedIndex
Dim CvePSParametro As Integer = DdlPSAjuste.SelectedValue.ToEntero
Dim PrecioSugerido As Decimal = 0
Dim drPS As DataRow = GlobalDTPS(UsuarioActual.CveEmpresa, CvePS:=CvePSParametro).FiltroPrimero("")
If drPS IsNot Nothing Then
PrecioSugerido = drPS("Precio").ToString.ToDecimal
End If
TxtPUFactura.Text = PrecioSugerido.FormatoNumero(2)
End If
If Not DdlPSAjuste.SelectedValue.ToEntero > 0 AndAlso DdlFacturas.SelectedValue.ToEntero > 0 Then
TxtPUFactura.Text = ""
End If
@@ -5188,16 +5203,16 @@ Partial Class PV
If ObjAcum.GarantiasMesesGet(-1, UsuarioActual.CveEmpresa, CveMarca, DdlTipoUso.SelectedValue.ToEntero, TxtMesesUso.Text.ToEntero) Then
If ObjAcum.DtResultados.Rows.Count > 0 Then
TxtPorcentajeAjuste.Text = (ObjAcum.DtResultados.Rows(0)("Valor").ToString.ToDouble / 100).ToString
TxtImporteAjuste.Text = (TxtPorcentajeAjuste.Text.ToDouble * TxtPrecio.Text.ToDouble).FormatoNumero
TxtImporteAjuste.Text = (TxtPorcentajeAjuste.Text.ToDouble * TxtPUFactura.Text.ToDouble).FormatoNumero
Dim CargoActual As Decimal = 0
Dim CargoAnterior As Decimal = 0
Dim CargoVendido As Decimal = 0
Dim CargoGarantia As Decimal = 0
Dim CveTamaño As Integer = 0
If DdlPSAjuste.SelectedValue.ToEntero > 0 Then
Dim Dr As DataRow = GlobalDTPS(UsuarioActual.CveEmpresa, DdlPSAjuste.SelectedValue.ToEntero).Rows(0)
If Dr IsNot Nothing Then
CargoAnterior = Dr("Cargo").ToString.ToDecimal
CargoGarantia = Dr("Cargo").ToString.ToDecimal
End If
End If
@@ -5208,24 +5223,22 @@ Partial Class PV
End If
End If
If GlobalDTAcumTamaños.FiltraParametros($"CveEmpresa = {UsuarioActual.CveEmpresa} AND CveTamaño = {CveTamaño}").Rows(0) IsNot Nothing AndAlso GlobalDTAcumTamaños.FiltraParametros($"CveEmpresa = {UsuarioActual.CveEmpresa} AND CveTamaño = {CveTamaño}").Rows.Count > 0 Then
Dim DrCargo As DataRow = GlobalDTAcumTamaños.FiltraParametros($"CveEmpresa = {UsuarioActual.CveEmpresa} AND CveTamaño = {CveTamaño}").Rows(0)
If DrCargo IsNot Nothing Then
CargoActual = DrCargo("Cargo").ToString.ToDecimal
CargoVendido = DrCargo("Cargo").ToString.ToDecimal
End If
End If
'el ajuste no puede ser mayor al precio de lo vendido de nuevo
If (TxtPrecio.Text.ToDouble - ((TxtPrecio.Text.ToDouble - TxtImporteAjuste.Text.ToDouble) - (CargoActual - CargoAnterior))) < 0 Then
TxtDescuentoAjuste.Text = TxtPrecio.Text
If (TxtPrecio.Text.ToDouble - ((TxtPUFactura.Text.ToDouble - TxtImporteAjuste.Text.ToDouble) - (CargoVendido - CargoGarantia))) < 0 Then
TxtImporteAjuste.Text = "0.00"
CargoAnterior = CargoActual
CargoGarantia = CargoVendido
End If
TxtImporteAjuste.ToolTip = $"La diferencia de ajuste fue: {(TxtPrecio.Text.ToDouble - TxtImporteAjuste.Text.ToDouble).FormatoNumero()}. La diferencia de tamaños fue: {(CargoVendido - CargoGarantia).FormatoNumero}."
TxtImporteAjuste.Text = ((TxtImporteAjuste.Text.ToDouble) - (CargoVendido - CargoGarantia)).FormatoNumero
TxtDescuentoAjuste.Text = ((TxtPrecio.Text.ToDouble - TxtImporteAjuste.Text.ToDouble) - (CargoActual - CargoAnterior)).FormatoNumero
TxtDescuentoAjuste.ToolTip = $"La diferencia de ajuste fue: {(TxtPrecio.Text.ToDouble - TxtImporteAjuste.Text.ToDouble).FormatoNumero()}. La diferencia de tamaños fue: {(CargoActual - CargoAnterior).FormatoNumero}."
End If
End If
ObjAcum.Dispose()
@@ -5233,31 +5246,6 @@ Partial Class PV
UpAjuste.Update()
End Sub
'Private Function AsignaPUFijo(CvePS As Integer) As Double
' Select Case CvePS
' Case 360449
' Return 500
' Case 360450
' Return 1000
' Case 360451
' Return 2000
' Case 360452
' Return 3000
' Case 360453
' Return 4000
' Case 360455
' Return 5000
' Case 365353
' Return 6000
' Case 360454
' Return 1500 'lth. acumulador
' Case 370810
' Return 2500 'lth. 1872
' Case Else
' Return 5000
' End Select
'End Function
Private Sub GuardaAjuste()
TxtPrecio.Text = TxtPrecio.Text
UpAjuste.Update()
@@ -5340,7 +5328,8 @@ Partial Class PV
End If
End If
Dr("Descuento") = Math.Round((TxtPrecio.Text.ToDouble - TxtImporteAjuste.Text.ToDouble) - (CargoActual - CargoAnterior), NumeroDecimales)
Dr("Descuento") = Math.Round(TxtImporteAjuste.Text.ToDouble, NumeroDecimales)
'Dr("Descuento") = Math.Round((TxtPrecio.Text.ToDouble - TxtImporteAjuste.Text.ToDouble) + (CargoActual - CargoAnterior), NumeroDecimales)
If Dr("Descuento").ToString.ToDouble > TxtPrecio.Text.ToDouble Then Dr("Descuento") = TxtPrecio.Text.ToDouble
Dim TotalCalculableImpuestos As Decimal = (Dr("Cantidad").ToString.ToDecimal * (Dr("PU").ToString.ToDecimal)) - Dr("Descuento").ToString.ToDecimal

View File

@@ -4425,6 +4425,9 @@ Partial Class Ventas
Private Sub CargaFormaPago(CveMetodoPago As Integer)
'FACTURACION 3.3
'permiso para desbloquear la relación entre Método de pago y forma de pago
If UsuarioActual.TienePermisoProceso(282) Then CveMetodoPago = -1
Dim dtt As DataTable = Nothing
If CveMetodoPago > 0 Then
dtt = GlobalDTVtaFormaPago.FiltraParametros(If(CveMetodoPago = 1, " CveFormaPago <> 20 ", "CveFormaPago = 20"))