Contabilizacion desde api net core
This commit is contained in:
105
Ashx/SIGWeb.ashx
105
Ashx/SIGWeb.ashx
@@ -8,6 +8,12 @@ Imports Extensiones
|
||||
Imports System.IO
|
||||
|
||||
Public Class SIGWeb : Implements IHttpHandler, IRequiresSessionState
|
||||
'TEMPORAL, DEBE SER REEMPLAZADO POR EL MODELO DE LA LIBRERIA
|
||||
Public Class MResponseModel(Of T)
|
||||
Public Property IsSuccess As Boolean
|
||||
Public Property Message As String
|
||||
Public Property Result As T
|
||||
End Class
|
||||
|
||||
Public Sub ProcessRequest(ByVal context As HttpContext) Implements IHttpHandler.ProcessRequest
|
||||
If context.Request("metodo") IsNot Nothing AndAlso context.Request("metodo").ToString() = "GetTokenAngular" Then
|
||||
@@ -51,13 +57,14 @@ Public Class SIGWeb : Implements IHttpHandler, IRequiresSessionState
|
||||
Dim CveEmpresa As Integer = context.Request("CveEmpresa").ToString().ToEntero()
|
||||
GuardaLog(String.Format("?metodo=Contabilizapoliza&CvePrePoliza={0}&CveUsuario={1}&CveEmpresa ={2}", CvePrePoliza, CveUsuario, CveEmpresa))
|
||||
ActualizaPrePoliza(context)
|
||||
Dim obj As New ADSNetLibrary.SIGAPI.Models.ResponseModel(Of Object)()
|
||||
|
||||
Dim obj As New MResponseModel(Of Object)()
|
||||
obj.Result = DateTime.Now.ToString()
|
||||
Dim retorno = JsonConvert.SerializeObject(obj).ToString()
|
||||
context.Response.Write(retorno)
|
||||
context.Response.StatusCode = 200
|
||||
Case "RevisaConexion"
|
||||
Dim obj As New ADSNetLibrary.SIGAPI.Models.ResponseModel(Of Object)()
|
||||
Dim obj As New MResponseModel(Of Object)()
|
||||
obj.Result = DateTime.Now.ToString()
|
||||
Dim retorno = JsonConvert.SerializeObject(obj).ToString()
|
||||
context.Response.Write(retorno)
|
||||
@@ -92,8 +99,6 @@ Public Class SIGWeb : Implements IHttpHandler, IRequiresSessionState
|
||||
ActualizaPrePoliza(context)
|
||||
Case "getpersonal"
|
||||
getpersonal(context)
|
||||
Case "getcuentascontables"
|
||||
GetCuentasContables(context)
|
||||
Case "getcontratos"
|
||||
GetContratos(context)
|
||||
Case "GettingCURP"
|
||||
@@ -214,7 +219,7 @@ Public Class SIGWeb : Implements IHttpHandler, IRequiresSessionState
|
||||
Dim CveEmpresa As Integer = context.Request("CveEmpresa").ToString.ToEntero
|
||||
Dim CveUsuario As Integer = context.Request("CveUsuario").ToString.ToEntero
|
||||
Dim Empresa As New Empresa
|
||||
Dim ObjConta As New ClsContabilidad
|
||||
|
||||
Dim Retorno As Integer = 0
|
||||
|
||||
Dim ObjEmpresa As New ClsSisEmpresas()
|
||||
@@ -224,19 +229,22 @@ Public Class SIGWeb : Implements IHttpHandler, IRequiresSessionState
|
||||
ObjEmpresa.Dispose()
|
||||
Dim IdPoliza As Integer = -1
|
||||
|
||||
ObjConta.GetPrePoliza(CvePrePoliza, CveEmpresa)
|
||||
IdPoliza = ObjConta.DtResultados.FiltroPrimeroValor("IdPoliza", "").ToEntero
|
||||
Dim ObjConta As New ClsContabilidad
|
||||
Try
|
||||
ObjConta.GetPrePoliza(CvePrePoliza, CveEmpresa)
|
||||
IdPoliza = ObjConta.DtResultados.FiltroPrimeroValor("IdPoliza", "").ToEntero
|
||||
If IdPoliza > 0 Then
|
||||
ObjConta.UpdatePrePolizasDetalleBloquear(CvePrePoliza, False)
|
||||
End If
|
||||
|
||||
If IdPoliza > 0 Then
|
||||
|
||||
ObjConta.UpdatePrePolizasDetalleBloquear(CvePrePoliza, False)
|
||||
If ObjConta.ContabilizarPrePoliza(CvePrePoliza, CveUsuario, Empresa, pIDPoliza:=IdPoliza) Then
|
||||
If ObjConta.ContabilizarPrePoliza(CvePrePoliza, CveUsuario, Empresa, pIDPoliza:=If(IdPoliza > 0, IdPoliza, -1)) Then
|
||||
Retorno = 200
|
||||
End If
|
||||
Else
|
||||
Retorno = 200
|
||||
End If
|
||||
Catch ex As Exception
|
||||
GuardaLogAD(ex.ToString())
|
||||
End Try
|
||||
ObjConta.Dispose()
|
||||
|
||||
Empresa = Nothing
|
||||
'context.Response.Write(CveUsuario.ToString())
|
||||
context.Response.StatusCode = Retorno
|
||||
@@ -582,15 +590,6 @@ Public Class SIGWeb : Implements IHttpHandler, IRequiresSessionState
|
||||
End If
|
||||
|
||||
If DtRetorno IsNot Nothing AndAlso DtRetorno.Rows.Count > 0 Then
|
||||
'Dim i As Integer = 0 'limpieza de columnas
|
||||
'While i < DtRetorno.Columns.Count
|
||||
' If Not DtRetorno.Columns(i).ColumnName.Contiene("CveProveedor", "NombreCortoProveedor") Then
|
||||
' DtRetorno.Columns.RemoveAt(i)
|
||||
' Else
|
||||
' i = i + 1
|
||||
' End If
|
||||
'End While
|
||||
|
||||
DtRetorno.Columns("CveCliente").ColumnName = "id"
|
||||
DtRetorno.Columns(ColumnaNombre).ColumnName = "text"
|
||||
retorno = JsonConvert.SerializeObject(DtRetorno).ToString
|
||||
@@ -626,6 +625,11 @@ Public Class SIGWeb : Implements IHttpHandler, IRequiresSessionState
|
||||
ObjProveedores.Dispose()
|
||||
End If
|
||||
|
||||
'Dim ObjProveedores As New ClsCompProveedores
|
||||
'If ObjProveedores.GetProveedores(ClsCompProveedores.TipoConsulta.ParaUsoEnEmpresa, -1, "-1", Name, "-1", "-1", "-1", "-1", "-1", -1, CveEmpresa) Then
|
||||
' DtRetorno = ObjProveedores.DtResultados
|
||||
'End If
|
||||
'ObjProveedores.Dispose()
|
||||
Dim dt As DataTable = DirectCast(context.Application(AppNombre), DataTable) '.FiltraParametros(String.Format("CveEmpresa = {0}", CveEmpresa))
|
||||
If dt IsNot Nothing AndAlso dt.Rows.Count > 0 Then
|
||||
DtRetorno = dt.FiltraParametros(String.Format("NombreCortoProveedor like '%{0}%'", Name))
|
||||
@@ -651,7 +655,7 @@ Public Class SIGWeb : Implements IHttpHandler, IRequiresSessionState
|
||||
Else
|
||||
context.Response.Write("[]")
|
||||
End If
|
||||
|
||||
DtRetorno.Dispose()
|
||||
Return retorno
|
||||
End Function
|
||||
#End Region
|
||||
@@ -740,6 +744,10 @@ Public Class SIGWeb : Implements IHttpHandler, IRequiresSessionState
|
||||
If Pagina.Contiene("ventas/ventas", "oc/oc", "inv/traspaso") AndAlso CveEmpresa.Contiene(72, 80, 119, 140, 141, 152, 153, 159, 160, 161, 162, 163, 166) Then
|
||||
UsaGlobal = False
|
||||
|
||||
'If CveEmpresa.Contiene(140, 141) And Pagina.Contiene("ventas/ventas") Then
|
||||
' AplicaParaVenta = 1
|
||||
'End If
|
||||
|
||||
Dim objInv As New ClsInventarios
|
||||
If objInv.GetExistenciasProductosLike(Name, CveClasificacion, CveSubProyecto, Estatus.ToEntero, AplicaParaVenta, CveEmpresa, CveMarca) Then
|
||||
|
||||
@@ -1185,6 +1193,11 @@ Public Class SIGWeb : Implements IHttpHandler, IRequiresSessionState
|
||||
ObjPersonal.Dispose()
|
||||
End If
|
||||
|
||||
'Dim ObjProveedores As New ClsCompProveedores
|
||||
'If ObjProveedores.GetProveedores(ClsCompProveedores.TipoConsulta.ParaUsoEnEmpresa, -1, "-1", Name, "-1", "-1", "-1", "-1", "-1", -1, CveEmpresa) Then
|
||||
' DtRetorno = ObjProveedores.DtResultados
|
||||
'End If
|
||||
'ObjProveedores.Dispose()
|
||||
Dim dt As DataTable = DirectCast(context.Application(AppNombre), DataTable).FiltraParametros($"CveEmpresa = {CveEmpresa}")
|
||||
If dt IsNot Nothing AndAlso dt.Rows.Count > 0 Then
|
||||
DtRetorno = dt.FiltraParametros($"NombreCompleto like '%{Name}%'")
|
||||
@@ -1192,7 +1205,6 @@ Public Class SIGWeb : Implements IHttpHandler, IRequiresSessionState
|
||||
End If
|
||||
|
||||
If DtRetorno IsNot Nothing AndAlso DtRetorno.Rows.Count > 0 Then
|
||||
|
||||
DtRetorno.Columns("CvePersonal").ColumnName = "id"
|
||||
DtRetorno.Columns("NombreCompleto").ColumnName = "text"
|
||||
retorno = JsonConvert.SerializeObject(DtRetorno).ToString
|
||||
@@ -1239,47 +1251,4 @@ Public Class SIGWeb : Implements IHttpHandler, IRequiresSessionState
|
||||
Return retorno
|
||||
End Function
|
||||
#End Region
|
||||
|
||||
#Region "Get Cuentas"
|
||||
Private Function GetCuentasContables(ByVal context As HttpContext) As String
|
||||
Dim retorno As String = ""
|
||||
Dim DtRetorno As DataTable = Nothing
|
||||
|
||||
Dim usuario As Usuario = UsuarioActual(context)
|
||||
Dim CveEmpresa As String
|
||||
If IsNothing(usuario) Then
|
||||
context.Response.Write("")
|
||||
Else
|
||||
CveEmpresa = usuario.CveEmpresa
|
||||
|
||||
Dim Name = IfNull(context.Request("Name"), "-1").ToString
|
||||
Dim ObjConta As New ClsContabilidad
|
||||
If ObjConta.GetCuentas(-1, "-1", 1, CveEmpresa, Nombre:=Name) Then
|
||||
DtRetorno = ObjConta.DtResultados
|
||||
End If
|
||||
ObjConta.Dispose()
|
||||
|
||||
End If
|
||||
|
||||
If DtRetorno IsNot Nothing AndAlso DtRetorno.Rows.Count > 0 Then
|
||||
Dim i As Integer = 0 'limpieza de columnas
|
||||
While i < DtRetorno.Columns.Count
|
||||
If Not DtRetorno.Columns(i).ColumnName.Contiene("CveCuenta", "CtaCodigo") Then
|
||||
DtRetorno.Columns.RemoveAt(i)
|
||||
Else
|
||||
i = i + 1
|
||||
End If
|
||||
End While
|
||||
DtRetorno.Columns("CveCuenta").ColumnName = "id"
|
||||
DtRetorno.Columns("CtaCodigo").ColumnName = "text"
|
||||
retorno = JsonConvert.SerializeObject(DtRetorno).ToString
|
||||
context.Response.Write(retorno)
|
||||
Else
|
||||
context.Response.Write("[]")
|
||||
End If
|
||||
|
||||
DtRetorno.Dispose()
|
||||
Return retorno
|
||||
End Function
|
||||
#End Region
|
||||
End Class
|
||||
Reference in New Issue
Block a user