Verificar existencias al editar
This commit is contained in:
@@ -758,6 +758,15 @@ Partial Class PV
|
|||||||
End Set
|
End Set
|
||||||
End Property
|
End Property
|
||||||
|
|
||||||
|
Private Property CantidadAntesEdicion As Decimal
|
||||||
|
Get
|
||||||
|
Return If(IsNothing(ViewState("CantidadAntesEdicion")), "0", ViewState("CantidadAntesEdicion").ToString()).ToDecimal()
|
||||||
|
End Get
|
||||||
|
Set(value As Decimal)
|
||||||
|
ViewState("CantidadAntesEdicion") = value
|
||||||
|
End Set
|
||||||
|
End Property
|
||||||
|
|
||||||
#End Region
|
#End Region
|
||||||
|
|
||||||
#Region "PROPIEDADES CONTRATOS"
|
#Region "PROPIEDADES CONTRATOS"
|
||||||
@@ -1071,6 +1080,7 @@ Partial Class PV
|
|||||||
ViewState("ClienteRetIVA") = 0
|
ViewState("ClienteRetIVA") = 0
|
||||||
ViewState("ClienteRetISR") = 0
|
ViewState("ClienteRetISR") = 0
|
||||||
ViewState("EnviarCorreoCliente") = False
|
ViewState("EnviarCorreoCliente") = False
|
||||||
|
Me.CantidadAntesEdicion = 0
|
||||||
HdnPorcentajeDescuentoMaximo.Value = If(UsuarioActual.DescuentoAutorizado > 0, UsuarioActual.DescuentoAutorizado, 15).ToString()
|
HdnPorcentajeDescuentoMaximo.Value = If(UsuarioActual.DescuentoAutorizado > 0, UsuarioActual.DescuentoAutorizado, 15).ToString()
|
||||||
CveVentaDetalle = -1
|
CveVentaDetalle = -1
|
||||||
EstablecioFolio = False
|
EstablecioFolio = False
|
||||||
@@ -5125,7 +5135,15 @@ Partial Class PV
|
|||||||
If DdlTipoComprobante.SelectedValue <> "Cot" Then
|
If DdlTipoComprobante.SelectedValue <> "Cot" Then
|
||||||
'VALIDA EXISTENCIA
|
'VALIDA EXISTENCIA
|
||||||
If UsuarioActual.CveEmpresa.Contiene({1, 72, 80, 119, 140}) Then
|
If UsuarioActual.CveEmpresa.Contiene({1, 72, 80, 119, 140}) Then
|
||||||
If Existencia - TmpDT.SUM("Cantidad", $"CvePS = {CvePS}") < TxtCantidad.Text.ToDouble Then
|
Dim CantidadAgregada As Decimal = TmpDT.SUMD("Cantidad", $"CvePS = {CvePS}")
|
||||||
|
|
||||||
|
If Modalidad = "U" Then
|
||||||
|
CantidadAgregada = CantidadAgregada - CantidadAntesEdicion + TxtCantidad.Text.ToDecimal()
|
||||||
|
Else
|
||||||
|
CantidadAgregada = CantidadAgregada + TxtCantidad.Text.ToDecimal()
|
||||||
|
End If
|
||||||
|
|
||||||
|
If Existencia < CantidadAgregada Then
|
||||||
Alert("No cuenta con la cantidad suficiente en inventario. Cuenta con " + Existencia.FormatoNumero(2) + ".", TipoMensaje.MsgAdvertencia)
|
Alert("No cuenta con la cantidad suficiente en inventario. Cuenta con " + Existencia.FormatoNumero(2) + ".", TipoMensaje.MsgAdvertencia)
|
||||||
Return False
|
Return False
|
||||||
End If
|
End If
|
||||||
@@ -5229,6 +5247,7 @@ Partial Class PV
|
|||||||
End Sub
|
End Sub
|
||||||
Private Sub CargaAgregar()
|
Private Sub CargaAgregar()
|
||||||
Modalidad = "A"
|
Modalidad = "A"
|
||||||
|
CantidadAntesEdicion = 0
|
||||||
LnkAgregarPS.Text = "Agregar"
|
LnkAgregarPS.Text = "Agregar"
|
||||||
CargaBCI()
|
CargaBCI()
|
||||||
LimpiaAgregar()
|
LimpiaAgregar()
|
||||||
@@ -5268,6 +5287,7 @@ Partial Class PV
|
|||||||
End If
|
End If
|
||||||
DdlPSIndexChange(DdlPS.SelectedValue.ToEntero, DdlPS)
|
DdlPSIndexChange(DdlPS.SelectedValue.ToEntero, DdlPS)
|
||||||
DdlUnidadMedida.SelectedValueExist(GvRow.DataKey("CveUM"))
|
DdlUnidadMedida.SelectedValueExist(GvRow.DataKey("CveUM"))
|
||||||
|
CantidadAntesEdicion = GvRow.DataKey("Cantidad").ToDecimal()
|
||||||
TxtCantidad.Text = GvRow.DataKey("Cantidad")
|
TxtCantidad.Text = GvRow.DataKey("Cantidad")
|
||||||
|
|
||||||
'Dim TotalCargos As Decimal = 0
|
'Dim TotalCargos As Decimal = 0
|
||||||
@@ -5324,6 +5344,9 @@ Partial Class PV
|
|||||||
RegistraScript("$('#DivAddVenta').modal({backdrop: 'static', keyboard: false});", "EdicionVenta")
|
RegistraScript("$('#DivAddVenta').modal({backdrop: 'static', keyboard: false});", "EdicionVenta")
|
||||||
End Sub
|
End Sub
|
||||||
Protected Sub LnkAgregarPS_Click(sender As Object, e As EventArgs)
|
Protected Sub LnkAgregarPS_Click(sender As Object, e As EventArgs)
|
||||||
|
|
||||||
|
Dim DrPS As DataRow = GlobalDTPS(UsuarioActual.CveEmpresa, CvePS:=DdlPS.SelectedValue.ToEntero).FiltroPrimero("")
|
||||||
|
|
||||||
If ChkAjuste.Checked Then
|
If ChkAjuste.Checked Then
|
||||||
Dim FolioGarantia As MFolioGarantiaMensaje = ValidaFolioGarantia(DdlPSAjuste.SelectedValue.ToEntero(), DdlFolioGarantia.SelectedValue.ToEntero())
|
Dim FolioGarantia As MFolioGarantiaMensaje = ValidaFolioGarantia(DdlPSAjuste.SelectedValue.ToEntero(), DdlFolioGarantia.SelectedValue.ToEntero())
|
||||||
|
|
||||||
@@ -5337,25 +5360,34 @@ Partial Class PV
|
|||||||
Exit Sub
|
Exit Sub
|
||||||
End If
|
End If
|
||||||
|
|
||||||
If String.IsNullOrEmpty(TxtAnioVehiculo.Text.Trim()) Then
|
If DrPS IsNot Nothing Then
|
||||||
Alert("El campo año esta vacío.", TipoMensaje.MsgAdvertencia)
|
'SOLO DEBE AGREGAR POLIZA VIRTUAL SI ES ACUMULADOR
|
||||||
Exit Sub
|
If DrPS("CveClasificacion").ToString().ToEntero().Contiene(20520, 20522, 20513, 20511, 20521, 20512, 20514, 20229) Then
|
||||||
End If
|
If String.IsNullOrEmpty(TxtAnioVehiculo.Text.Trim()) Then
|
||||||
|
Alert("El campo año esta vacío.", TipoMensaje.MsgAdvertencia)
|
||||||
|
Exit Sub
|
||||||
|
End If
|
||||||
|
|
||||||
If TxtAnioVehiculo.Text.ToDecimal() < 1900 Then
|
If TxtAnioVehiculo.Text.ToDecimal() < 1900 Then
|
||||||
Alert("El campo año debe ser mayor a 1900.", TipoMensaje.MsgAdvertencia)
|
Alert("El campo año debe ser mayor a 1900.", TipoMensaje.MsgAdvertencia)
|
||||||
Exit Sub
|
Exit Sub
|
||||||
|
End If
|
||||||
|
End If
|
||||||
End If
|
End If
|
||||||
|
|
||||||
Else
|
Else
|
||||||
If Not String.IsNullOrEmpty(TxtAnioVehiculo.Text.Trim()) Then
|
If DrPS IsNot Nothing Then
|
||||||
If TxtAnioVehiculo.Text.ToDecimal() < 1900 Then
|
'SOLO DEBE AGREGAR POLIZA VIRTUAL SI ES ACUMULADOR
|
||||||
Alert("El año del vehiculo del vehículo no tiene el formato correcto.", TipoMensaje.MsgAdvertencia)
|
If DrPS("CveClasificacion").ToString().ToEntero().Contiene(20520, 20522, 20513, 20511, 20521, 20512, 20514, 20229) Then
|
||||||
Exit Sub
|
If Not String.IsNullOrEmpty(TxtAnioVehiculo.Text.Trim()) Then
|
||||||
|
If TxtAnioVehiculo.Text.ToDecimal() < 1900 Then
|
||||||
|
Alert("El año del vehiculo del vehículo no tiene el formato correcto.", TipoMensaje.MsgAdvertencia)
|
||||||
|
Exit Sub
|
||||||
|
End If
|
||||||
|
End If
|
||||||
End If
|
End If
|
||||||
End If
|
End If
|
||||||
End If
|
|
||||||
|
|
||||||
|
End If
|
||||||
|
|
||||||
|
|
||||||
If AgregarPS() Then
|
If AgregarPS() Then
|
||||||
|
|||||||
Reference in New Issue
Block a user