Validacion de existencias. bloquear facturacion del modulo de cotizacion
This commit is contained in:
@@ -6231,7 +6231,13 @@ Partial Class Ventas
|
|||||||
|
|
||||||
'SI LA VENTA YA ESTA REGISTRADA NO DEBE HABILITAR ACCIONES
|
'SI LA VENTA YA ESTA REGISTRADA NO DEBE HABILITAR ACCIONES
|
||||||
If CveVenta <= 0 Then
|
If CveVenta <= 0 Then
|
||||||
LnkRemisiones.Visible = If(UsuarioActual.TienePermisoProceso(199), True, False) : LnkOCs.Visible = True : LnkCotizaciones.Visible = True : LnkPedido2SinFacturar.Visible = True : InicializaAplicarNCMasiva()
|
Dim EsModuloCotizacion As Boolean = False
|
||||||
|
If Request("Op") IsNot Nothing AndAlso Request("Op").ToString() = "Cot" Then
|
||||||
|
EsModuloCotizacion = True
|
||||||
|
End If
|
||||||
|
If Not EsModuloCotizacion Then
|
||||||
|
LnkRemisiones.Visible = If(UsuarioActual.TienePermisoProceso(199), True, False) : LnkOCs.Visible = True : LnkCotizaciones.Visible = True : LnkPedido2SinFacturar.Visible = True : InicializaAplicarNCMasiva()
|
||||||
|
End If
|
||||||
End If
|
End If
|
||||||
|
|
||||||
If UsuarioActual.Empresa.CvePlataforma = 2 Then LnkOCs.Visible = False
|
If UsuarioActual.Empresa.CvePlataforma = 2 Then LnkOCs.Visible = False
|
||||||
@@ -7120,7 +7126,13 @@ Partial Class Ventas
|
|||||||
|
|
||||||
'SI LA VENTA YA ESTA REGISTRADA NO DEBE HABILITAR ACCIONES
|
'SI LA VENTA YA ESTA REGISTRADA NO DEBE HABILITAR ACCIONES
|
||||||
If CveVenta <= 0 Then
|
If CveVenta <= 0 Then
|
||||||
LnkRemisiones.Visible = If(UsuarioActual.TienePermisoProceso(199), True, False) : LnkOCs.Visible = True : LnkCotizaciones.Visible = True : LnkPedido2SinFacturar.Visible = True : InicializaAplicarNCMasiva()
|
Dim EsModuloCotizacion As Boolean = False
|
||||||
|
If Request("Op") IsNot Nothing AndAlso Request("Op").ToString() = "Cot" Then
|
||||||
|
EsModuloCotizacion = True
|
||||||
|
End If
|
||||||
|
If Not EsModuloCotizacion Then
|
||||||
|
LnkRemisiones.Visible = If(UsuarioActual.TienePermisoProceso(199), True, False) : LnkOCs.Visible = True : LnkCotizaciones.Visible = True : LnkPedido2SinFacturar.Visible = True : InicializaAplicarNCMasiva()
|
||||||
|
End If
|
||||||
End If
|
End If
|
||||||
|
|
||||||
ObjCliente.Dispose()
|
ObjCliente.Dispose()
|
||||||
@@ -7693,10 +7705,31 @@ Partial Class Ventas
|
|||||||
If ValidaExistencia AndAlso DdlTipoComprobante.SelectedValue <> "Cot" And ChkSinExistencia.Checked = False AndAlso Not RegistroxOC Then
|
If ValidaExistencia AndAlso DdlTipoComprobante.SelectedValue <> "Cot" And ChkSinExistencia.Checked = False AndAlso Not RegistroxOC Then
|
||||||
'VALIDA EXISTENCIA
|
'VALIDA EXISTENCIA
|
||||||
If UsuarioActual.CveEmpresa.Contiene({72, 80, 119, 140, 153}) Then
|
If UsuarioActual.CveEmpresa.Contiene({72, 80, 119, 140, 153}) Then
|
||||||
If Existencia - TmpDT.SUM("Cantidad", $"CvePS = {CvePS} AND (EntregaDirecta IS NULL OR EntregaDirecta < 1)") < TxtCantidad.Text.ToDouble Then
|
'SI ES VENTA NUEVA TOMA EN CUENTA LO DEL TMPDT
|
||||||
Alert("No cuenta con la cantidad suficiente en inventario. Cuenta con " + Existencia.FormatoNumero(2) + ".", TipoMensaje.MsgAdvertencia)
|
If CveVenta <= 0 Then
|
||||||
Exit Sub
|
If Existencia - TmpDT.SUM("Cantidad", $"CvePS = {CvePS} AND (EntregaDirecta IS NULL OR EntregaDirecta < 1)") < TxtCantidad.Text.ToDouble Then
|
||||||
|
Alert("No cuenta con la cantidad suficiente en inventario. Cuenta con " + Existencia.FormatoNumero(2) + ".", TipoMensaje.MsgAdvertencia)
|
||||||
|
Exit Sub
|
||||||
|
End If
|
||||||
|
Else
|
||||||
|
If DdlTipoComprobante.SelectedValue = "Rem" Then
|
||||||
|
Dim CantidadVenta As Double = 0
|
||||||
|
Using ObjVentas As New ClsVentas
|
||||||
|
If ObjVentas.GetVentaDetalle(CveVenta) Then
|
||||||
|
CantidadVenta = ObjVentas.DtResultados.SUM("Cantidad", $"CvePS = {CvePS}")
|
||||||
|
End If
|
||||||
|
End Using
|
||||||
|
|
||||||
|
'SUMA LO YA RESTADO EN PENDIENTE POR SURTIR QUE PERTENESCA A LA VENTA.
|
||||||
|
'PARA QUE NO RESTE LA EXISTENCIA 2 VECES Y PUEDAS COMPARAR LO REAL
|
||||||
|
If (Existencia + CantidadVenta) - TmpDT.SUM("Cantidad", $"CvePS = {CvePS} AND (EntregaDirecta IS NULL OR EntregaDirecta < 1)") < TxtCantidad.Text.ToDouble Then
|
||||||
|
Alert("No cuenta con la cantidad suficiente en inventario. Cuenta con " + Existencia.FormatoNumero(2) + ".", TipoMensaje.MsgAdvertencia)
|
||||||
|
Exit Sub
|
||||||
|
End If
|
||||||
|
End If
|
||||||
|
|
||||||
End If
|
End If
|
||||||
|
|
||||||
End If
|
End If
|
||||||
End If
|
End If
|
||||||
|
|
||||||
@@ -14352,7 +14385,7 @@ Partial Class Ventas
|
|||||||
|
|
||||||
Dim DebeGenerarMovimiento As Boolean = TmpDT.COUNT("CvePS", "CveTipoPS = 2") > 0
|
Dim DebeGenerarMovimiento As Boolean = TmpDT.COUNT("CvePS", "CveTipoPS = 2") > 0
|
||||||
'VERIFICA QUE SE REALIZO EL MOVIMIENTO DE ALMACEN
|
'VERIFICA QUE SE REALIZO EL MOVIMIENTO DE ALMACEN
|
||||||
If DebeGenerarMovimiento AndAlso UsuarioActual.Empresa.Funcionalidad(558) = "1" AndAlso UsuarioActual.Empresa.Funcionalidad(567) = "1" AndAlso factura.TipoDocto.Contiene("Ing", "Egs", "Rem") Then
|
If DebeGenerarMovimiento AndAlso UsuarioActual.Empresa.Funcionalidad(558) = "1" AndAlso UsuarioActual.Empresa.Funcionalidad(567) = "1" AndAlso factura.TipoDocto.Contiene("Ing", "Rem") Then
|
||||||
If Not (ObjInventario.GetInv_Mov(factura.CveVenta, UsuarioActual.CveEmpresa) AndAlso ObjInventario.DtResultados.Rows.Count > 0) Then
|
If Not (ObjInventario.GetInv_Mov(factura.CveVenta, UsuarioActual.CveEmpresa) AndAlso ObjInventario.DtResultados.Rows.Count > 0) Then
|
||||||
OcurrioError = True
|
OcurrioError = True
|
||||||
ErrorList.Add("Ocurrió un error al verificar inventario.<br />Revise su factura y cualquier detalle comuníquese a Soporte Técnico")
|
ErrorList.Add("Ocurrió un error al verificar inventario.<br />Revise su factura y cualquier detalle comuníquese a Soporte Técnico")
|
||||||
@@ -17583,10 +17616,29 @@ Partial Class Ventas
|
|||||||
If DdlTipoComprobante.SelectedValue <> "Cot" And ChkSinExistencia.Checked = False Then
|
If DdlTipoComprobante.SelectedValue <> "Cot" And ChkSinExistencia.Checked = False Then
|
||||||
'VALIDA EXISTENCIA
|
'VALIDA EXISTENCIA
|
||||||
If UsuarioActual.CveEmpresa.Contiene({72, 80, 119, 153, 140}) Then
|
If UsuarioActual.CveEmpresa.Contiene({72, 80, 119, 153, 140}) Then
|
||||||
If Existencia - TmpDT.SUM("Cantidad", $"CvePS = {CvePS} AND (EntregaDirecta IS NULL OR EntregaDirecta < 1)") < TxtCantidad.Text.ToDouble Then
|
If CveVenta <= 0 OrElse Me.EsCreaApartirDe Then
|
||||||
Alert("No cuenta con la cantidad suficiente en inventario. Cuenta con " + Existencia.FormatoNumero(2) + ".", TipoMensaje.MsgAdvertencia)
|
If Existencia - TmpDT.SUM("Cantidad", $"CvePS = {CvePS} AND (EntregaDirecta IS NULL OR EntregaDirecta < 1)") < TxtCantidad.Text.ToDouble Then
|
||||||
Return False
|
Alert("No cuenta con la cantidad suficiente en inventario. Cuenta con " + Existencia.FormatoNumero(2) + ".", TipoMensaje.MsgAdvertencia)
|
||||||
|
Return False
|
||||||
|
End If
|
||||||
|
Else
|
||||||
|
If DdlTipoComprobante.SelectedValue = "Rem" Then
|
||||||
|
Dim CantidadVenta As Double = 0
|
||||||
|
Using ObjVentasE As New ClsVentas
|
||||||
|
If ObjVentasE.GetVentaDetalle(CveVenta) Then
|
||||||
|
CantidadVenta = ObjVentasE.DtResultados.SUM("Cantidad", $"CvePS = {CvePS}")
|
||||||
|
End If
|
||||||
|
End Using
|
||||||
|
|
||||||
|
'SUMA LO YA RESTADO EN PENDIENTE POR SURTIR QUE PERTENESCA A LA VENTA.
|
||||||
|
'PARA QUE NO RESTE LA EXISTENCIA 2 VECES Y PUEDAS COMPARAR LO REAL
|
||||||
|
If (Existencia + CantidadVenta) - TmpDT.SUM("Cantidad", $"CvePS = {CvePS} And (EntregaDirecta Is NULL Or EntregaDirecta < 1)") < TxtCantidad.Text.ToDouble Then
|
||||||
|
Alert("No cuenta con la cantidad suficiente en inventario. Cuenta con " + Existencia.FormatoNumero(2) + ".", TipoMensaje.MsgAdvertencia)
|
||||||
|
Return False
|
||||||
|
End If
|
||||||
|
End If
|
||||||
End If
|
End If
|
||||||
|
|
||||||
End If
|
End If
|
||||||
End If
|
End If
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user