diff --git a/Ashx/SIGWeb.ashx b/Ashx/SIGWeb.ashx index 43e27b789..e8a6152a1 100644 --- a/Ashx/SIGWeb.ashx +++ b/Ashx/SIGWeb.ashx @@ -70,6 +70,8 @@ Public Class SIGWeb : Implements IHttpHandler, IRequiresSessionState ActualizaPrePoliza(context) Case "getpersonal" getpersonal(context) + Case "getcuentascontables" + GetCuentasContables(context) Case "getcontratos" GetContratos(context) Case "GettingCURP" @@ -558,6 +560,15 @@ 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 @@ -593,11 +604,6 @@ 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)) @@ -606,14 +612,24 @@ 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("CveProveedor").ColumnName = "id" DtRetorno.Columns("NombreCortoProveedor").ColumnName = "text" retorno = JsonConvert.SerializeObject(DtRetorno).ToString context.Response.Write(retorno) + DtRetorno.Dispose() Else context.Response.Write("[]") End If - DtRetorno.Dispose() + Return retorno End Function #End Region @@ -1147,11 +1163,6 @@ 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}%'") @@ -1159,6 +1170,7 @@ 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 @@ -1205,4 +1217,47 @@ 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 \ No newline at end of file