modificacion para buscar usuario ingresado
This commit is contained in:
@@ -39,12 +39,15 @@ Public Class E48 : Implements IHttpHandler, IRequiresSessionState
|
||||
Dim RespuestaError As New FidelityAppsResponseError
|
||||
Dim TieneError As Boolean = False
|
||||
Dim JsonRequest As JObject = Nothing
|
||||
Dim UsuarioActual As Usuario = ValidaUsuarioSistema(100, CveEmpresa)
|
||||
Dim ObjInventario As New ClsInventarios
|
||||
Dim ObjConta As New ClsContabilidad(ObjInventario.IniciaTransacSQL())
|
||||
Dim CveMovimiento As Integer = 0
|
||||
Dim Mensaje As String = ""
|
||||
Dim SinExistencia As String = "No hay existencias suficientes del producto: "
|
||||
Dim ObjUsuarios As New ClsSisUsuarios
|
||||
Dim CveUsuario As Integer
|
||||
Dim UsuarioActual As Usuario = ValidaUsuarioSistema(100, CveEmpresa)
|
||||
|
||||
|
||||
Dim ErrorAC As Boolean = False
|
||||
Dim ErrorMovInv As Boolean = False
|
||||
@@ -68,29 +71,34 @@ Public Class E48 : Implements IHttpHandler, IRequiresSessionState
|
||||
RespuestaError.Message = "Ocurrió un error al obtener el cuerpo de los parametros"
|
||||
End If
|
||||
|
||||
If Not TieneError AndAlso Not String.IsNullOrEmpty(JsonRequest("fecha")) AndAlso Not String.IsNullOrEmpty(JsonRequest("usuario")) AndAlso Not String.IsNullOrEmpty(JsonRequest("almacen")) AndAlso Not String.IsNullOrEmpty(JsonRequest("entrega")) AndAlso
|
||||
Not String.IsNullOrEmpty(JsonRequest("observaciones")) AndAlso Not String.IsNullOrEmpty(JsonRequest("productos")) Then
|
||||
If Not TieneError AndAlso Not String.IsNullOrEmpty(JsonRequest("fecha")) Then
|
||||
Dim Inv As New ClsInventarios
|
||||
Dim ObjProductosServicios As New ClsProductosServicios()
|
||||
Dim ObjContaAC As ClsContPAQi = Nothing
|
||||
Dim tFolio As Integer = Inv.GetFolioSiguiente(3, CveEmpresa)
|
||||
Dim observaciones As String = JsonRequest("observaciones").ToString()
|
||||
Dim observaciones As String = IIf(JsonRequest("observaciones").ToString() <> "", JsonRequest("observaciones").ToString(), "Salida Almacen")
|
||||
Dim CveAlmacen As Integer = 7
|
||||
Dim IDPoliza As Integer = 0
|
||||
|
||||
Dim Fecha As Date = JsonRequest("fecha").ToString().ToDate
|
||||
Dim usuario As String = JsonRequest("usuario").ToString()
|
||||
If ObjUsuarios.GetUsuariosEmpresas(-1) Then
|
||||
CveUsuario = ObjUsuarios.DtResultados.FiltroPrimeroValor("CveUsuario", String.Format("Usuario = '{0}' ", usuario)).ToEntero
|
||||
If CveUsuario > 0 Then
|
||||
UsuarioActual = ValidaUsuarioSistema(CveUsuario, CveEmpresa)
|
||||
Else
|
||||
Mensaje = "No se encontro el usuario ingresado"
|
||||
TieneError = True
|
||||
End If
|
||||
End If
|
||||
Dim Fecha As Date = JsonRequest("fecha").ToString().ToDate
|
||||
Dim almacen As String = JsonRequest("almacen").ToString()
|
||||
Dim Recibe As String = JsonRequest("entrega").ToString()
|
||||
Dim GlobalDTInvConceptos As DataTable
|
||||
Dim CveModalidad As Integer = GlobalDTAlmacen(UsuarioActual.CveEmpresa, CveAlmacen:=CveAlmacen).FiltroPrimeroValor("CveModalidad").ToEntero()
|
||||
|
||||
Dim EsContabilizable As Boolean = (CveModalidad = 1)
|
||||
Dim EsContabilizable As Boolean = True
|
||||
If Inv.GetConceptos Then GlobalDTInvConceptos = Inv.DtResultados Else GlobalDTInvConceptos = Nothing
|
||||
If Not TieneError Then
|
||||
Try
|
||||
|
||||
Dim CvePrePoliza As Integer = ObjConta.AddPrePolizas("ASHX/E48", 53, 0, 0, 1, Fecha, observaciones, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, CveTipoPoliza:=3)
|
||||
CveMovimiento = ObjInventario.AddMovimiento(CveAlmacen, 3, 1, Fecha, tFolio, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, -1, -1, -1, -1, Observaciones:=observaciones, Recibio:=Recibe, Modulo:="ASHX/E48")
|
||||
Dim CvePrePoliza As Integer = ObjConta.AddPrePolizas("ASHX/E48", 53, 0, 0, 1, Fecha, observaciones, UsuarioActual.CveUsuario, CveEmpresa, CveTipoPoliza:=3)
|
||||
CveMovimiento = ObjInventario.AddMovimiento(CveAlmacen, 3, 1, Fecha, tFolio, UsuarioActual.CveUsuario, CveEmpresa, -1, -1, -1, -1, Observaciones:=observaciones, Recibio:=Recibe, Modulo:="ASHX/E48")
|
||||
|
||||
If CveMovimiento <= 0 OrElse CvePrePoliza <= 0 Then
|
||||
RespuestaError.Message = "No se pudo almacenar el movimiento correctamente"
|
||||
@@ -108,7 +116,7 @@ Public Class E48 : Implements IHttpHandler, IRequiresSessionState
|
||||
|
||||
Dim Cantidad As Double = JsonPS("cantidad").ToString.ToDouble()
|
||||
Dim CvePS As Integer = GlobalDTPSSimplificado(Codigo:=JsonPS("codigo").ToString()).FiltroPrimeroValor("CvePS").ToEntero()
|
||||
Dim DrPS As DataRow = GlobalDTPS(UsuarioActual.CveEmpresa, CvePS:=CvePS).FiltroPrimero("")
|
||||
Dim DrPS As DataRow = GlobalDTPS(CveEmpresa, CvePS:=CvePS).FiltroPrimero("")
|
||||
Dim CveUM As Integer
|
||||
If ObjProductosServicios.GetPS(CvePS, -1, CveEmpresa) Then
|
||||
If ObjProductosServicios.DtResultados.Rows.Count > 0 Then
|
||||
@@ -119,7 +127,6 @@ Public Class E48 : Implements IHttpHandler, IRequiresSessionState
|
||||
|
||||
If Not ObjInventario.AddMovimientoDetalle(CveMovimiento, Cantidad, CveUM, CvePS, 0, Observaciones:=observaciones, CveUsuarioModifico:=UsuarioActual.CveUsuario) Then
|
||||
Mensaje = "Error al guardar los movimientos"
|
||||
RespuestaError.Message = Mensaje
|
||||
|
||||
ErrorMovInv = True
|
||||
Exit For
|
||||
@@ -128,21 +135,19 @@ Public Class E48 : Implements IHttpHandler, IRequiresSessionState
|
||||
If UsuarioActual.TienePermisoProceso(114) Then
|
||||
If ObjInventario.GetExistenciasPS(CvePS, CveUM, CveEmpresa, CveAlmacen, FechaMovto:=String.Format("{0} 00:00", Fecha.ToString("yyyy/MM/dd"))) >= Cantidad Then
|
||||
Mensaje = "Error al guardar los movimientos"
|
||||
RespuestaError.Message = Mensaje
|
||||
ErrorMovInv = True
|
||||
Exit For
|
||||
End If
|
||||
Else
|
||||
SinExistencia += String.Format("{0}, ", JsonPS("codigo").ToString())
|
||||
RespuestaError.Message = SinExistencia
|
||||
ErrorMovInv = True : Exit For
|
||||
ErrorMovInv = True
|
||||
End If
|
||||
|
||||
End If
|
||||
Cont += 1
|
||||
Next
|
||||
Mensaje = SinExistencia
|
||||
'Registro la prepóliza
|
||||
If Not ErrorMovInv AndAlso ObjInventario.GetMovimientosDetalle(CveMovimiento, UsuarioActual.CveEmpresa) Then
|
||||
If Not ErrorMovInv AndAlso ObjInventario.GetMovimientosDetalle(CveMovimiento, CveEmpresa) Then
|
||||
Dim tValorInventario As Decimal = ObjInventario.DtResultados.SUMD("Total", "").RoundSQL()
|
||||
Dim tValorOtro As Decimal = tValorInventario
|
||||
Dim idCtaContable As Integer = 0
|
||||
@@ -151,7 +156,7 @@ Public Class E48 : Implements IHttpHandler, IRequiresSessionState
|
||||
Dim TipoMovtoOtro As Boolean = True
|
||||
Dim tCveSubProyecto As Integer = -1
|
||||
|
||||
Dim drA2 As DataRow = GlobalDTAlmacen(UsuarioActual.CveEmpresa).FiltroPrimero(String.Format("CveAlmacen = {0}", CveAlmacen))
|
||||
Dim drA2 As DataRow = GlobalDTAlmacen(CveEmpresa).FiltroPrimero(String.Format("CveAlmacen = {0}", CveAlmacen))
|
||||
If drA2 IsNot Nothing Then
|
||||
idCtaContable = drA2("IdCtaContable").ToString.ToEntero
|
||||
tCveSubProyecto = drA2("CveSubProyecto").ToString.ToEntero
|
||||
@@ -205,8 +210,7 @@ Public Class E48 : Implements IHttpHandler, IRequiresSessionState
|
||||
If AC.GetPresupuestoEgresos(-1, True, UsuarioActual.Empresa.EjercicioActual, UsuarioActual.CveEmpresa) Then
|
||||
DtPresupuestos = AC.DtResultados.Copy
|
||||
Else
|
||||
Alert("Ocurrió un error al cargar los Presupuestos. Por favor vuelva a cargar la página", TipoMensaje.MsgError)
|
||||
RegistraScript("playsonidito('142608__autistic-lucario__error.wav')")
|
||||
Mensaje = "Ocurrió un error al cargar los Presupuestos. Por favor vuelva a cargar la página"
|
||||
End If
|
||||
AC.Dispose()
|
||||
|
||||
@@ -300,6 +304,7 @@ Public Class E48 : Implements IHttpHandler, IRequiresSessionState
|
||||
|
||||
TieneError = True
|
||||
End Try
|
||||
End If
|
||||
|
||||
ObjInventario.Dispose() 'elimino la instancia
|
||||
If ObjContaAC IsNot Nothing Then ObjContaAC.Dispose()
|
||||
|
||||
Reference in New Issue
Block a user