Imports System.Data Imports System.Globalization Imports Extensiones Imports System.Web.Services Imports Newtonsoft.Json Imports System.Drawing Imports ADSNetLibrary.SIGAPI.Models.CRM.Request Imports ADSNetLibrary.SIGAPI.Services.CRM Imports Telerik.Web.UI.Scheduler.Views Imports Microsoft.EntityFrameworkCore.Storage.ValueConversion.Internal 'Imports System.Reflection 'Imports Telerik.Web.UI Partial Class Inicio Inherits ClsPaginas Private Dias() As String = {"Domingo", "Lunes", "Martes", "Miércoles", "Jueves", "Viernes", "Sábado"} Public Function GetFacturasCanceladasPendientesWS(objventas As ClsVentas, RFC As String, CveEmpresa As Integer, Optional showalert As Boolean = True) As Boolean Dim retorno As Boolean = False Try Dim objServicio As New Cancelacion2022.CancelacionSoapClient() Dim resp As Cancelacion2022.StructCancel = objServicio.ObtienePendientes(RFC, "UserTest", "1234567890") If resp.Estado = 0 Then Dim XmlPendientes As String = System.Text.Encoding.UTF8.GetString(Convert.FromBase64String(resp.Xml)) Dim theReader As IO.StringReader = New IO.StringReader(XmlPendientes) Dim theDataSet As DataSet = New DataSet() theDataSet.ReadXml(theReader) If theDataSet.Tables(0).Rows(0)("Uuid").ToString() <> "null" Then Dim sb = New StringBuilder() For Each item As DataRow In theDataSet.Tables(0).Rows sb.AppendFormat("{0};", item("Uuid").ToString()) Next If objventas.GetFacturasCanceladasPendientes(sb.ToString(), CveEmpresa) Then retorno = True End If gvCancelaPendiente.DataSource = objventas.DtResultados Else If showalert Then Alert("No se encontraron cancelaciones pendientes", ModExtensiones.TipoMensaje.MsgError) End If End If Else Alert("Error al obtener cancelaciones pendientes: " & resp.Descripcion, ModExtensiones.TipoMensaje.MsgError) End If Catch ex As Exception retorno = False Me.OnError("Error al obtener cancelaciones pendientes: ", ex, "") End Try gvCancelaPendiente.DataBind() Return retorno End Function Private Sub cargaUnuaUno() GVPA_OI_UnoAUnoTableroGet.DataSource = New System.Data.DataTable() Using ObjPA_O As ClsOIEventos = New ClsOIEventos() If ObjPA_O.UnoAUnoTableroGet(UsuarioActual.CveEmpresa, DateTime.Now.ToString("yyyy/MM/dd"), UsuarioActual.CveUsuario) Then If ObjPA_O.DtResultados.COUNT("CveUnoaUno", "CveUnoaUno = -1") > 0 Then RegistraScript("$('#DvUnoaUno').modal();") End If End If GVPA_OI_UnoAUnoTableroGet.DataSource = ObjPA_O.DtResultados End Using GVPA_OI_UnoAUnoTableroGet.DataBind() End Sub Protected Sub Page_Load(sender As Object, e As System.EventArgs) Handles Me.Load If Not IsPostBack Then If Not IsNothing(Request("logout")) AndAlso Request("logout").ToString() = "1" Then Usuario.CerrarSession() Exit Sub End If cargaUnuaUno() 'Reporte de ventas sin registrar sig If UsuarioActual.TienePermisoProceso(287) Then Using objgral As New ClsGenerales objgral.RepConciliacionSatDetalleGET(UsuarioActual.CveEmpresa, "I", "", "", 10) If objgral.DtResultados.Rows.Count > 0 Then GvFoliosSAT.DataSource = objgral.DtResultados RegistraScript("$('#ModalMitoteresat').modal();", "mitoterosat") End If End Using GvFoliosSAT.DataBind() End If If UsuarioActual.CveUsuario = 100 Then 'Using objnom As New ClsNominas ' If objnom.GetNominasSinTimbrar() AndAlso objnom.DtResultados.Rows.Count > 0 Then ' GVNomPendientesxTimbrar.DataSource = objnom.DtResultados ' GVNomPendientesxTimbrar.DataBind() ' RegistraScript("$('#NominasSinTimbrar').modal();", "tikNominasSinTimbrar") ' End If 'End Using Using objventas As New ClsVentas If objventas.GETVentasPendientesdeTimbrar(UsuarioActual.CveEmpresa) AndAlso objventas.DtResultados.Rows.Count > 0 Then GVVtasPendientesxTimbrarSAT.DataSource = objventas.DtResultados GVVtasPendientesxTimbrarSAT.DataBind() RegistraScript("$('#ModalVtasPendientesxTimbrarSAT').modal();", "tikModalVtasPendientesxTimbrarSAT") End If If objventas.GETVentasPendientesdeCancelar(UsuarioActual.CveEmpresa) AndAlso objventas.DtResultados.Rows.Count > 0 Then GvCancelacionespendientesSAT.DataSource = objventas.DtResultados GvCancelacionespendientesSAT.DataBind() RegistraScript("$('#ModalVtasPendientesxCancelarSAT').modal();", "tikModalVtasPendientesxCancelarSAT") End If End Using End If 'Reporte de ventas pendientes de cancelar If UsuarioActual.TienePermisoProceso(288) Then Using objventas As New ClsVentas If (GetFacturasCanceladasPendientesWS(objventas, UsuarioActual.Empresa.RFC, UsuarioActual.CveEmpresa, False)) AndAlso objventas.DtResultados.Rows.Count > 0 Then RegistraScript("$('#ModalMitotereCancelaPendiente').modal();", "mitoterosatCanceladasPendientesWS") End If End Using End If 'RESTRICCION AD If Not IsNothing(Request("ADCod")) Then 'viene el msg encriptado, para sacar el modulo Dim Codigo As String = Decripta(Request("ADCod")) Dim Msg As String = "" If Codigo.Substring(0, 10) = "CveModulo=" Then Msg = "No tiene permisos de acceso al módulo:" & GlobalDTModulos().FiltroPrimeroValor("Modulo", Codigo) End If Alert(Msg, TipoMensaje.MsgAdvertencia) End If 'tiene prioridad que cambie de contrase;a primero antes de redireccionar a su pagina If UsuarioActual.Contraseña = (ContraseñaPredeterminadaEncriptada) OrElse UsuarioActual.ActCambiarContraseña Then Response.Redirect("/Sistemas/CatContrasenia.aspx") End If If UsuarioActual.Portal Then Response.Redirect("/Portal/ConsultaCliente.aspx") End If If UsuarioActual.CvePlataforma = 6 Then Response.Redirect("/PortalCliente/PortalCliente.aspx") End If If UsuarioActual.CvePlataforma = 7 Then Response.Redirect("/PortalProveedor/PortalProveedor.aspx") End If If UsuarioActual.Empresa.TipoContabilidad = 2 AndAlso UsuarioActual.Empresa.UsaContabilidad Then Dim ObjPolizas As New ClsContPAQi(UsuarioActual.Empresa) If ObjPolizas.GetPolizasCuadre() And ObjPolizas.DtResultados.Rows.Count > 0 Then Dim ObjNotificacion = ItemNotificaciones(String.Format("Polizas de cuadre {0}", ObjPolizas.DtResultados.Rows.Count), Ico:="icon-calculator", Tipo:="warning", Link:="/Contabilidad/RepPolizasCuadre.aspx") NotificacionesPendientes(ObjNotificacion) End If ObjPolizas.Dispose() End If 'C A R G A - A L E R T A S - O R D E N E S D E C O M P R A If UsuarioActual.CveUsuario <> 1459 Then Dim OC As New ClsOC If OC.GetOrdenesPendientes("-1", 0, UsuarioActual.CveEmpresa, -1, -1, -1, UsuarioActual.CveUsuario, -1) Then If (OC.DtResultados.Rows.Count > 0) Then Dim ObjNotificacion = ItemNotificaciones(String.Format("Orden de Compra por atender {0}", OC.DtResultados.Rows.Count), Ico:="fa fa-tags", Tipo:="warning", Link:="/OC/RepOC.aspx") NotificacionesPendientes(ObjNotificacion) End If End If OC.Dispose() End If ViewState("FechaSel") = Now.ToShortDateString 'Not UsuarioActual.CveEmpresa.Contiene(66, 74) OrElse 'Ventas no timbradas por centro de costo If UsuarioActual.TienePermisoProceso(208) Then MuestraNoTimbradasCentroCosto() 'Ventas sin correo enviado If UsuarioActual.TienePermisoProceso(319) Then MuestraVentasNoEnviadas() If UsuarioActual.TienePermisoProceso(271) Then MuestraVentasPUE() If UsuarioActual.TienePermisoProceso(270) Then MuestraComprasPUE() If UsuarioActual.TienePermisoProceso(343) Then MuestraPsProximosAVencer() If UsuarioActual.TienePermisoProceso(344) Then MuestraRSCOProximosAVencer() If (UsuarioActual.CveRol = 1062) Or (UsuarioActual.CveUsuario = 100) Then CargaGraficas() End If 'CargaTareas() If UsuarioActual.CveRol = 1 Then divInd.Visible = True CargaSubProyectos() End If 'MUESTRA CALENDARIO SOLO ROL ADMINISTRADOR-AD InicializaCalendar() If UsuarioActual.CveEmpresa = 72 Then DivDirectorioTelefonico.Visible = True CargaDirectorioTelefonico() Else DivDirectorioTelefonico.Visible = False End If 'CARGA COMUNICADO If UsuarioActual.TienePermisoProceso(224) Then LnkAgregar.Visible = True End If CargaComunicado() 'Evaluacion del proveedor CargaEvaluacionProveedor() CargaDocumentacion() If UsuarioActual.CveRol = 1 Or UsuarioActual.CveUsuario.Contiene(93, 1425, 2, 1606, 1472, 100, 1918) Then LnkInconsistencias.Visible = True End If IniializaDdlsOpcionesAgenda() End If End Sub Private Sub CargaCalendarioGraficas() If (UsuarioActual.CveRol = 1062) Or (UsuarioActual.CveUsuario = 100) Then CargaGraficas() End If InicializaCalendar() End Sub Private Sub CargaEvaluacionProveedor() If UsuarioActual.Empresa.Funcionalidad(560) = "1" Then Dim ObjProveedor As New ClsCompProveedores If ObjProveedor.GetEvaluacionesProveedores(-1, -1, UsuarioActual.CveEmpresa) Then If ObjProveedor.DtResultados.COUNT("CveEvaluacionProveedor", $"Evaluado = 0 AND CveUsuario={UsuarioActual.CveUsuario}") > 0 Then Dim Mensaje As String = "Hay evaluaciones pendientes de proveedores. ¿Desea realizarlas ahora?" Dim MsgAccionAceptar = "window.open(""/Compras/EvaluacionProveedor.aspx?CveProveedor=-1"");" Alert(Mensaje, TipoMensaje.MsgConfirmacion, JSBtnAceptar:=MsgAccionAceptar, TextoConfirmacion:="    Si    ", TextoCancelacion:="    No    ") End If End If ObjProveedor.Dispose() End If End Sub Private Sub MuestraVentasPUE() Dim objVentas As New ClsVentas Dim FechaInicio As Date = Now.AddYears(-2) LblVentasPUE.Text = "Facturas a partir de: " & FechaInicio.ToShortDateString If objVentas.GetPUESinPago(FechaInicio, Now, -1, -1, -1, UsuarioActual.CveEmpresa, UsuarioActual.CveUsuario) Then If objVentas.DtResultados.Rows.Count > 0 Then GvVtaPUE.DataSource = objVentas.DtResultados RegistraScript("$('#ModalVentasPUE').modal('show');", "showmodal4Incons") End If End If objVentas.Dispose() GvVtaPUE.DataBind() End Sub Private Sub MuestraComprasPUE() Dim objCompras As New ClsCompras Dim FechaInicio As Date = Now.AddYears(-2) LblComprasPUE.Text = "Facturas a partir de: " & FechaInicio.ToShortDateString If objCompras.GetPUESinPago(FechaInicio, Now, -1, -1, UsuarioActual.CveEmpresa, UsuarioActual.CveUsuario) Then If objCompras.DtResultados.Rows.Count > 0 Then GvCompPUE.DataSource = objCompras.DtResultados RegistraScript("$('#ModalComprasPUE').modal('show');", "showmodal3Incons") End If End If objCompras.Dispose() GvCompPUE.DataBind() End Sub Private Sub MuestraInconsistencias() Dim ObjP As New ClsContabilidad If ObjP.GetInconsistencias() Then If ObjP.DtResultados.Rows.Count > 0 Then LblInconsistenciasNum.Text = ObjP.DtResultados.Rows.Count GvIncons.DataSource = ObjP.DtResultados End If End If ObjP.Dispose() GvIncons.DataBind() uppincons.Update() RegistraScript("$('#ModalInconsistencias').modal('show');", "showmodalIncons") End Sub Private Sub MuestraNoTimbradasCentroCosto() Dim ObjSub As New ClsSubProyectos If ObjSub.GetNoTimbradasCentroCosto(UsuarioActual.CveEmpresa) Then If ObjSub.DtResultados.Rows.Count > 0 Then LblNoTimbradas.Text = ObjSub.DtResultados.Rows.Count GvNoTimbradasCentroCosto.DataSource = ObjSub.DtResultados RegistraScript("$('#ModalNoTimbradasCentroCosto').modal('show');", "showmodal2Incons") End If End If ObjSub.Dispose() GvNoTimbradasCentroCosto.DataBind() End Sub Private Sub MuestraVentasNoEnviadas() Dim ObjVentas As New ClsVentas If ObjVentas.GetVentasNoEnviadas(UsuarioActual.CveEmpresa) Then If ObjVentas.DtResultados.Rows.Count > 0 Then lblVentasSinEnviar.Text = ObjVentas.DtResultados.Rows.Count GvVentasEmail.DataSource = ObjVentas.DtResultados RegistraScript("$('#DvCorreoSinEnviar').modal('show');", "showmodal2Incons") End If End If ObjVentas.Dispose() GvVentasEmail.DataBind() End Sub Private Sub MuestraPsProximosAVencer() Dim ObjInventarios = New ClsInventarios If ObjInventarios.GetProductosCaducidad(-1, MinFecha, Now.AddDays(30), -1, -1, -1, "-1", UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, Opcion:=2, CveCompuesto:=-1) Then If ObjInventarios.DtResultados.Rows.Count > 0 Then GvModalPSPorCaducar.DataSource = ObjInventarios.DtResultados RegistraScript("$('#DVModalPSPorCaducar').modal('show');") Else GvModalPSPorCaducar.DataSource = Nothing End If Else GvModalPSPorCaducar.DataSource = Nothing End If ObjInventarios.Dispose() GvModalPSPorCaducar.DataBind() End Sub Private Sub MuestraRSCOProximosAVencer() Dim ObjInventarios As New ClsInventarios If ObjInventarios.RepCompuestosVigencia(-1, -1, MinFecha, Now.AddMonths(1), 1, UsuarioActual.CveEmpresa, -1, UsuarioActual.CveUsuario, True) Then If ObjInventarios.DtResultados.Rows.Count > 0 Then GvModalRSCOPorCaducar.DataSource = ObjInventarios.DtResultados RegistraScript("$('#DVModalRSCOPorCaducar').modal('show');") Else GvModalRSCOPorCaducar.DataSource = Nothing End If Else GvModalRSCOPorCaducar.DataSource = Nothing End If ObjInventarios.Dispose() GvModalRSCOPorCaducar.DataBind() End Sub Private Sub CargaSubProyectos() DdlSubproyectos.DataSource = GlobalDTSubProyectos(-1, CveEmpresa:=UsuarioActual.CveEmpresa) DdlSubproyectos.DataBind() DdlSubproyectos.Items.Insert(0, New ListItem("Todos", "-1")) DdlSubproyectos.SelectedIndex = 0 End Sub Private Sub CargaGraficas() ' sino tiene permisos, no genera trabajo If Not (UsuarioActual.TienePermisoIndicador(1) OrElse UsuarioActual.TienePermisoIndicador(2) OrElse UsuarioActual.TienePermisoIndicador(3) OrElse UsuarioActual.TienePermisoIndicador(4) OrElse UsuarioActual.TienePermisoIndicador(5) OrElse UsuarioActual.TienePermisoIndicador(6) OrElse UsuarioActual.TienePermisoIndicador(7) OrElse UsuarioActual.TienePermisoIndicador(8)) Then Exit Sub End If DivIndicadores.InnerHtml = "" Dim dtIndicadores As DataTable = Nothing Dim dtVentas As DataTable = Nothing Dim dtBancos As DataTable = Nothing Dim dtRH As DataTable = Nothing Dim dtBancosCuentas As DataTable = Nothing Dim Gral As New ClsGenerales Dim ds As DataSet = Gral.GetIndicadores(UsuarioActual.CveEmpresa) If ds IsNot Nothing AndAlso ds.Tables.Count > 0 Then dtIndicadores = ds.Tables(0) dtBancos = ds.Tables(1) dtBancosCuentas = ds.Tables(2) dtVentas = ds.Tables(3) dtRH = ds.Tables(4) Graficas.Visible = True DivIndicadores.Visible = True End If Gral.Dispose() If dtIndicadores IsNot Nothing AndAlso dtIndicadores.Rows.Count > 0 Then Dim dr As DataRow = dtIndicadores.Rows(0) Select Case DdlFiltroIndicador.SelectedValue Case "Ger" If UsuarioActual.TienePermisoIndicador(1) Then MuestraIndicador(DivIndicadores, "blue", "fa fa-automobile", "Ventas", dr("TotalVentas").ToString.FormatoNumero(0), "/Ventas/RepVentas.aspx", "Mes actual", dr("TotalVentasAcumulado").ToString.FormatoNumero(0), "link", "Anual") End If If UsuarioActual.TienePermisoIndicador(2) Then MuestraIndicador(DivIndicadores, "red-intense", "fa fa-bar-chart-o", "Compras", dr("TotalCompras").ToString.FormatoNumero(0), "/Compras/RepCompras.aspx", "Total Compras", dr("CxPVencido").ToString.FormatoNumero(0), "link", "Saldo Vencido", dr("CxPPorVencer").ToString.FormatoNumero(0), "link", "Saldo por vencer") End If If UsuarioActual.TienePermisoIndicador(3) Then MuestraIndicador(DivIndicadores, "green-haze", "fa fa-shopping-cart", "Bancos", String.Format("${0}", dr("TotalBancos").ToString.FormatoNumero), "/Bancos/RepSaldos.aspx", "") End If If UsuarioActual.TienePermisoIndicador(4) Then MuestraIndicador(DivIndicadores, "purple-plum", "fa fa-globe", "Crédito", String.Format("${0}", dr("TotalCredito").ToString.FormatoNumero), "", "") End If If UsuarioActual.TienePermisoIndicador(5) Then MuestraIndicador(DivIndicadores, "yellow", "fa fa-globe", "Inventario", String.Format("${0}", dr("TotalAlmacen").ToString.FormatoNumero), "/Inventarios/RepAlmacen.aspx", "") End If If UsuarioActual.TienePermisoIndicador(6) Then MuestraIndicador(DivIndicadores, "grey-cascade", "fa fa-globe", "Impuestos", String.Format("${0}", dr("TotalImpuestos").ToString.FormatoNumero), "", "") End If If UsuarioActual.TienePermisoIndicador(13) Then MuestraIndicador(DivIndicadores, "blue", "fa fa-globe", "Orden Producción", String.Format("{0}%", dr("TotalPorcentaje").ToString.FormatoNumero), "/CGame/RepAvance.aspx?Opcion=1", "") End If End Select If UsuarioActual.CveRol = 1 Then Select Case DdlFiltroIndicador.SelectedValue Case "RH" MuestraIndicador(DivIndicadores, "green-haze", "fa fa-bar-chart-o", "Plantilla", dr("RH_Personal_Total").ToString, "", "Total Personal", dr("RH_Personal_Adm").ToString.FormatoNumero(0), "link", "Per. Adm.", dr("RH_Personal_Guardia").ToString.FormatoNumero(0), "link", "Per. Guardia.") MuestraIndicador(DivIndicadores, "grey-cascade", "fa fa-globe", "Faltas", dr("RH_FaltasAnual").ToString.FormatoNumero(0), "", "Anual", dr("RH_FaltasMensual").ToString.FormatoNumero(0), "link", "Faltas Mensual", dr("RH_FaltasDia").ToString.FormatoNumero(0), "link", "Faltas de hoy") MuestraIndicador(DivIndicadores, "red-intense", "fa fa-globe", "Ausentismo", "8.23%", "", "") MuestraIndicador(DivIndicadores, "purple-plum", "fa fa-globe", "Rotación", "18.23%", "", "") MuestraIndicador(DivIndicadores, "yellow", "fa fa-globe", "Uniformes", "Diciembre: 29", "", "") 'MuestraGrafica(div_RHInd1, dtRH, "Sucursal", "Personal", "", "", "gh21", "") GeneraGraficaRH(dtRH, "Personal Requerido", "por centro de costo") GeneraGraficaRH2(dtRH, "Personal Actual", "por centro de costo") divGraficas1.Visible = True Case "Ger" MuestraIndicador(DivIndicadores, "green-haze", "fa fa-bar-chart-o", "Plantilla", dr("RH_Personal_Total").ToString, "", "Total Personal", dr("RH_Personal_Adm").ToString.FormatoNumero(0), "link", "Per. Adm.", dr("RH_Personal_Guardia").ToString.FormatoNumero(0), "link", "Per. Guardia.") End Select End If 'End If End If If UsuarioActual.TienePermisoIndicador(7) Then DvGraVentas.Visible = True MuestraGrafica(div_ventas, dtVentas, "NombreMes", "Importe", "", "", "gh2", "$M") Else DvGraVentas.Visible = False End If If UsuarioActual.TienePermisoIndicador(8) Then DvGraBancos.Visible = True If dtBancos IsNot Nothing Then MuestraGrafica(div_bancos, dtBancos, dtBancosCuentas, "NombreMes", "Importe", "", "", "gh1", "$", dtBancos.AVG("Importe").ToString.FormatoNumero) End If Else DvGraBancos.Visible = False End If Select Case DdlFiltroIndicador.SelectedValue Case "Ger" DvGraBancos.Visible = True DvGraVentas.Visible = True DivRHInd.Visible = False Case "RH" DivRHInd.Visible = True DvGraBancos.Visible = False DvGraVentas.Visible = False End Select dtIndicadores = Nothing dtBancos = Nothing dtBancosCuentas = Nothing dtVentas = Nothing dtRH = Nothing End Sub Private Sub GeneraGraficaRH(data As DataTable, Titulo As String, SubTitulo As String) 'remueve la columna CveSucursal data.Columns.RemoveAt(0) Dim json As String = ToJsonString(GraficaStandarB(data, "column", Titulo, $"
{SubTitulo}
", False)) Dim json2 As String = ToJsonString(GraficaStandar(data, "column", Titulo, $"
{SubTitulo}
", True)) 'Literal1.Text = json RegistraScript(String.Format("function CargaGrafica() {{$('#{2}').highcharts({0});}}function CargaGrafica2() {{$('#{2}').highcharts({1});}} CargaGrafica();", json, json2, div_RHInd1.ClientID), "grh1") End Sub Private Sub GeneraGraficaRH2(data As DataTable, Titulo As String, SubTitulo As String) 'remueve la columna CveSucursal 'data.Columns.RemoveAt(0) data.Columns.RemoveAt(2) Dim json As String = ToJsonString(GraficaStandarB(data, "column", Titulo, $"
{SubTitulo}
", False)) 'Dim json2 As String = ToJsonString(GraficaStandar(data, "column", Titulo, $"
{SubTitulo}
", True)) 'Literal1.Text = json RegistraScript(String.Format("function CargaGrafica3() {{$('#{2}').highcharts({0});}}function CargaGrafica4() {{$('#{2}').highcharts({1});}} CargaGrafica3();", json, "", divRHGrafica2.ClientID), "grh2") End Sub 'Private Sub CargaTareas() ' Dim ObjProspectos As New ClsOIEventos ' Dim FechaI, FechaF As DateTime ' Dim CveEventoEstatus As Integer = -1 ' FechaI = Now.AddDays(-180) ' FechaF = Now ' If ObjProspectos.GetRepEventos(-1, 1, -1, "-1", "-1", -1, -1, -1, 1, -1, -1, "-1", -1, -1, -1, -1, -1, -1, -1, -1, -1, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, FechaI, FechaF) Then ' Dim DT As DataTable = ObjProspectos.DtResultados.Clone ' If ChkOIPorHacer.Checked Then DT.Merge(ObjProspectos.DtResultados.FiltraParametros(String.Format("CveUsuarioPara = {0} ", UsuarioActual.CveUsuario))) ' If ChkOIAsigne.Checked Then DT.Merge(ObjProspectos.DtResultados.FiltraParametros(String.Format("CveUsuarioDe = {0} ", UsuarioActual.CveUsuario))) ' GvT.DataSource = DT ' End If ' ObjProspectos.Dispose() ' GvT.DataBind() 'End Sub 'Protected Sub GvT_RowDataBound(sender As Object, e As GridViewRowEventArgs) Handles GvT.RowDataBound ' If e.Row.RowType = DataControlRowType.DataRow Then ' Select Case UsuarioActual.CveUsuario.ToString ' Case e.Row.DBCampo("CveUsuarioPara") ' 'etiqueta de 'asignado' ' e.Row.FCLabel("LblTipo").CssClass = "label label-sm label-warning " ' e.Row.FCLabel("LblTipo").Text = "por hacer " ' Case e.Row.DBCampo("CveUsuarioDe") ' e.Row.FCLabel("LblTipo").CssClass = "label label-sm label-success" ' e.Row.FCLabel("LblTipo").Text = "Asigné" ' End Select ' End If 'End Sub Private Sub MuestraIndicador(DIV As HtmlGenericControl, Color As String, Icono As String, Titulo As String, Comentario As String, Link As String, TitleComentario As String) Dim htmldiv As New StringBuilder htmldiv.AppendFormat("{0}
", DIV.InnerHtml, Color, Icono) htmldiv.AppendFormat("
{0}
Ver Más
", Link) DIV.InnerHtml = htmldiv.ToString End Sub Private Sub MuestraIndicador(DIV As HtmlGenericControl, Color As String, Icono As String, Titulo As String, C1 As String, CL1 As String, CT1 As String, C2 As String, CL2 As String, CT2 As String) Dim htmldiv As New StringBuilder htmldiv.AppendFormat("{0}
", DIV.InnerHtml, Color, Icono) htmldiv.AppendFormat("
{0}
", Titulo) htmldiv.AppendFormat("", CT1, C1) htmldiv.AppendFormat("", CT2, C2) htmldiv.Append("
Ver Más ") htmldiv.AppendFormat("
") DIV.InnerHtml = htmldiv.ToString End Sub Private Sub MuestraIndicador(DIV As HtmlGenericControl, Color As String, Icono As String, Titulo As String, C1 As String, CL1 As String, CT1 As String, C2 As String, CL2 As String, CT2 As String, C3 As String, CL3 As String, CT3 As String) Dim htmldiv As New StringBuilder htmldiv.AppendFormat("{0}
", DIV.InnerHtml, Color, Icono) htmldiv.AppendFormat("
{0}
", Titulo) htmldiv.AppendFormat("", CT1, C1) htmldiv.AppendFormat("", CT2, C2) htmldiv.AppendFormat("", CT3, C3) htmldiv.Append("
Ver Más ") htmldiv.AppendFormat("
") DIV.InnerHtml = htmldiv.ToString End Sub Private Sub MuestraIndicador(DIV As HtmlGenericControl, Color As String, Icono As String, Titulo As String, C1 As String, CL1 As String, CT1 As String, C2 As String, CL2 As String, CT2 As String, C3 As String, CL3 As String, CT3 As String, C4 As String, CL4 As String, CT4 As String) Dim htmldiv As New StringBuilder htmldiv.AppendFormat("{0}
", DIV.InnerHtml, Color, Icono) htmldiv.AppendFormat("
{0}
", Titulo, CT1, C1) htmldiv.AppendFormat("", CT2, C2) htmldiv.AppendFormat("", CT3, C3) htmldiv.AppendFormat("", CT4, C4) htmldiv.AppendFormat("
Ver Más
", CL1) DIV.InnerHtml = htmldiv.ToString End Sub Private Sub MuestraGrafica(divcontainer As HtmlGenericControl, DTDatos As DataTable, ColTitle As String, ColValue As String, Titulo As String, SubTitulo As String, Optional Indicador As String = "gh", Optional XReferencia As String = "", Optional YReferencia As String = "") Dim Info As String = "" Dim SBJSScript As New StringBuilder If DTDatos IsNot Nothing AndAlso DTDatos.Rows.Count > 0 Then For Each DbRow As DataRow In DTDatos.Rows Info = String.Format("{2}['{1}',{0}],", DbRow(ColValue), DbRow(ColTitle), Info) Next Info = Info.Remove(Info.Length - 1, 1) SBJSScript.AppendFormat("graficahighcharts('{0}','{1}','{2}','{3}',[{4}],1,'{5}');", divcontainer.ClientID, Titulo, SubTitulo, YReferencia, Info, XReferencia) Else SBJSScript.AppendFormat("graficahighcharts('{0}','{1}','{2}','{3}',[{4}],1,'{5}');", divcontainer.ClientID, Titulo, SubTitulo, YReferencia, " ", XReferencia) End If RegistraScript(SBJSScript.ToString, Indicador) End Sub Private Sub MuestraGrafica(divcontainer As HtmlGenericControl, DTDatos As DataTable, DTPie As DataTable, ColTitle As String, ColValue As String, Titulo As String, SubTitulo As String, Indicador As String, XReferencia As String, Promedio As String, Optional YReferencia As String = "") Dim SBPie1 As New StringBuilder Dim SBPie2 As New StringBuilder Dim Info As String = "" Dim SBJSScript As New StringBuilder If DTDatos IsNot Nothing AndAlso DTDatos.Rows.Count > 0 Then For Each DbRow As DataRow In DTDatos.Rows Info = String.Format("{2}['{1}',{0}],", DbRow(ColValue), DbRow(ColTitle), Info) Next Info = Info.Remove(Info.Length - 1, 1) End If For Each DbRow As DataRow In DTPie.Rows If DbRow("Importe").ToString.ToDouble > 0 Then SBPie1.AppendFormat("{{ name:'{1}- {2}',y:{0} }},", DbRow("Importe"), DbRow("Banco"), DbRow("NumCuenta")) Next 'pesos y dolares Dim Dolares As Double = DTPie.SUM("Importe", "CveMoneda = 2") If Dolares > 0 Then SBPie2.AppendFormat("{{ name:'Dólares',y:{0} }},", Dolares) SBPie2.AppendFormat("{{ name:'Pesos',y:{0} }},", DTPie.SUM("Importe", "CveMoneda = 1")) End If If SBPie1.Length > 2 Then SBPie1 = SBPie1.Remove(SBPie1.Length - 1, 1) If SBPie2.Length > 2 Then SBPie2 = SBPie2.Remove(SBPie2.Length - 1, 1) SBJSScript.AppendFormat("graficahighcharts2('{0}','{1}','{2}','{3}',[{4}],1,'{5}','{6}',[{8}],[{7}]);", divcontainer.ClientID, Titulo, SubTitulo, YReferencia, Info, XReferencia, Promedio, SBPie1, SBPie2) RegistraScript(SBJSScript.ToString, Indicador) DTDatos.Dispose() End Sub Private Sub MuestraGrafica(DTDatos As DataTable, ColTitle As String, ColValue As String, TipoDato As String, DivId As String) Dim Info As String = "" If DTDatos IsNot Nothing AndAlso DTDatos.Rows.Count > 0 Then For Each DbRow As DataRow In DTDatos.Rows Info = String.Format("{2}['{0}',{1}],", DbRow(ColTitle), DbRow(ColValue), Info) Next Info = Info.Remove(Info.Length - 1, 1) Dim SBJSScript As New StringBuilder SBJSScript.AppendFormat("var datos=[{0}];graficaindex(datos,'{1}','{2}');", Info, DivId, TipoDato) RegistraScript(SBJSScript.ToString, "g1") End If End Sub Private Sub MuestraGrafica(DTDatos As DataTable, DTDatos2 As DataTable, ColTitle As String, ColValue As String, TipoDato As String, DivId As String) Dim Info As String = "" Dim Info2 As String = "" For Each DbRow As DataRow In DTDatos.Rows Info = String.Format("{2}['{0}',{1}],", DbRow(ColTitle), DbRow(ColValue), Info) Next For Each DbRow As DataRow In DTDatos2.Rows Info2 = String.Format("{2}['{0}',{1}],", DbRow(ColTitle), DbRow(ColValue), Info2) Next Info2 = Info2.Remove(Info2.Length - 1, 1) Info = Info.Remove(Info.Length - 1, 1) Dim SBJSScript As New StringBuilder SBJSScript.AppendFormat("var datos=[{0}];var datos2=[{3}];graficaindex2(datos,'{1}','{2}',datos2);", Info, DivId, TipoDato, Info2) RegistraScript(SBJSScript.ToString, "g2") End Sub Private Sub MuestraGraficaRM(divcontainer As HtmlGenericControl, DTDatos As DataTable, ColTitle As String, ColValue As String, Titulo As String, SubTitulo As String, Optional Indicador As String = "gh", Optional XReferencia As String = "", Optional YReferencia As String = "") Dim Info As String = "" Dim SBJSScript As New StringBuilder If DTDatos IsNot Nothing AndAlso DTDatos.Rows.Count > 0 Then For Each DbRow As DataRow In DTDatos.Rows Info = String.Format("{2}['{1}',{0}],", DbRow(ColValue), DbRow(ColTitle), Info) Next Info = Info.Remove(Info.Length - 1, 1) SBJSScript.AppendFormat("graficahighcharts2('{0}','{1}','{2}','{3}',[{4}],1,'{5}');", divcontainer.ClientID, Titulo, SubTitulo, YReferencia, Info, XReferencia) Else SBJSScript.AppendFormat("graficahighcharts2('{0}','{1}','{2}','{3}',[{4}],1,'{5}');", divcontainer.ClientID, Titulo, SubTitulo, YReferencia, " ", XReferencia) End If RegistraScript(SBJSScript.ToString, Indicador) End Sub Private Function CargaSesionesActivas() As String Dim SBSesiones As New StringBuilder Try Dim DicSesiones As Dictionary(Of String, HttpSessionState) = DirectCast(Application("s"), Dictionary(Of String, HttpSessionState)) If DicSesiones IsNot Nothing Then For Each DicItem As KeyValuePair(Of String, HttpSessionState) In DicSesiones 'gv.Add(New String() With { _ ' Key .SessionId = item.Key, _ ' Key .SessionKey = Nothing, _ ' Key .SessionValue = Nothing _ '}) SBSesiones.Append(DicItem.Key) If DicItem.Value IsNot Nothing AndAlso DicItem.Value.Count > 0 Then For Each DicKey As String In DicItem.Value.Keys SBSesiones.Append(DicItem.Key) SBSesiones.Append(DicKey) SBSesiones.Append(If(DicItem.Value(DicKey) IsNot Nothing, DicItem.Value(DicKey).ToString(), String.Empty)) 'gv.Add(New String() With { _ ' Key .SessionId = item.Key, _ ' Key .SessionKey = key, _ ' Key .SessionValue = If(item.Value(key) IsNot Nothing, item.Value(key).ToString(), String.Empty) _ '}) Next End If SBSesiones.Append("
") Next 'sessionValuesGrid.DataSource = gv 'sessionValuesGrid.DataBind() End If Catch End Try Return SBSesiones.ToString End Function #Region " FULL CALENDAR " Private Sub InicializaCalendar() RegistraScript("InitCalendar();") HdnU.Value = UsuarioActual.CveUsuario.ToString HdnE.Value = UsuarioActual.CveEmpresa.ToString DirectCast(Master.FindControl("TSM"), ScriptManager).EnablePageMethods = True CargaTiposAgenda() CheckRecurrencia.Attributes.Add("onclick", "CheckAdd(this);") End Sub Private Sub CargaDdlAcercamientoCRM() DdlAcercamientoCRM.Items.Clear() Dim cRMService = New CRMService(System.Configuration.ConfigurationManager.ConnectionStrings("Conexion").ConnectionString) Dim aceramientoGet = New RequestAcercamiento(UsuarioActual.CveEmpresa, CveEmpresaCRM:=DdlEmpresaCRM.SelectedValue.ToEntero) Dim objAcercamiento = cRMService.GetAceracamientoCRM(aceramientoGet) If objAcercamiento.IsSuccess Then DdlAcercamientoCRM.DataSource = objAcercamiento.Result DdlAcercamientoCRM.DataBind() End If DdlAcercamientoCRM.Items.Insert(0, New ListItem("Sin Seleccionar", "-1")) End Sub Private Sub CargaDdlContactoCRM() DdlContactoCRM.Items.Clear() Dim cRMService = New CRMService(System.Configuration.ConfigurationManager.ConnectionStrings("Conexion").ConnectionString) Dim contactoEmpresaCRM = New RequestContactoEmpresaCRM(DdlEmpresaCRM.SelectedValue.ToEntero, UsuarioActual.CveEmpresa, -1) Dim objServicio = cRMService.GetContactosEmpresasCRM(contactoEmpresaCRM) If objServicio.IsSuccess Then DdlContactoCRM.DataSource = objServicio.Result DdlContactoCRM.DataBind() End If DdlContactoCRM.Items.Insert(0, New ListItem("Sin Seleccionar", "-1")) End Sub Private Sub CargaTiposAgenda() Dim ObjEventos As New ClsOIEventos If ObjEventos.GetAgendaTipo() Then DdlAgedaTipo.DataSource = ObjEventos.DtResultados DdlAgedaTipo.DataBind() DdlAgedaTipo.Items.Insert(0, New ListItem("Seleccione", "-1")) Else Alert("Ocurrió un error al obtener los tipos de agenda. Por favor recargue la página", TipoMensaje.MsgError) End If ObjEventos.Dispose() End Sub Protected Sub BtnGuardar_Click(sender As Object, e As EventArgs) Dim ObjEventos As New ClsOIEventos Dim FechaInicio = TxtFechaInicioAgenda.Text.ToDateTime() Dim FechaFin = TxtFechaFinAgenda.Text.ToDateTime() Dim validacionesAgendaOpcionesOK = True RegistraScript("GetView();") Dim RecurrenciaTipo = 0, Frecuencia = -1, DiasSemana = "-1", Dias = -1, Mes = -1, RecurrenciaFin = "-1" If CheckRecurrencia.Checked Then RecurrenciaTipo = RBLRecurrencia.SelectedValue.ToEntero Frecuencia = TxtFrecuencia.Text.ToEntero 'OBTENEMOS LOS DIAS SELECCIONADOS EN LA OPCION DE RECURRENCIA POR SEMANA Select Case RecurrenciaTipo Case 3 Dim StringDias = "" For Each item As ListItem In CheckDiasSemana.Items If item.Selected Then If StringDias.Length > 0 Then StringDias += "," End If StringDias += item.Value End If Next If StringDias.Length > 0 Then DiasSemana = StringDias End If End Select 'If RBSinFechaFinAdd.Checked Then ' RecurrenciaFin = "-1" 'Else If RBNumeroOcurrencias.Checked Then RecurrenciaFin = TxtNumeroOcurrencias.Text ElseIf RBFechaFin.Checked Then RecurrenciaFin = TxtFechaFinRecurrencia.Text Else RecurrenciaFin = "-1" End If Else If HdnCveEvento.Value.ToEntero > 0 Then Frecuencia = -2 : DiasSemana = "-2" : Dias = -2 : Mes = -2 : RecurrenciaFin = "-2" End If End If '11/05/2018 - GASTO RECURRENTE Dim CveTipoEvento As Integer = IIf(ChkGastoRecurrente.Checked, 10, 2).ToString().ToEntero() Dim Importe As Double = Convert.ToDouble(IIf(ChkGastoRecurrente.Checked, TxtImporteGastoRecurrente.Text, "-1")) If HdnCveEvento.Value.ToEntero > 0 Then If ObjEventos.UpdateEvento(TxtAsuntoAgenda.Text, TxtDescripcionAgenda.Text, DdlPrioridad.SelectedValue.ToEntero, DdlAgedaTipo.SelectedValue.ToEntero, -1, FechaInicio, FechaFin, -1, "-1", HdnCveEvento.Value.ToEntero, "-1", RecurrenciaTipo, Frecuencia, DiasSemana, Dias, Mes, RecurrenciaFin, Importe:=Importe) Then Alert("El Evento se actualizó correctamente", TipoMensaje.MsgInformacion) Else Alert("Ocurrió un error al actualizar el evento", TipoMensaje.MsgAdvertencia) End If Else Dim CveCliente As Integer = -1 Dim CveProveedor As Integer = -1 Dim CvePersonal As Integer = -1 Dim CveEmpresaCRM As Integer = -1 Dim CveContactoCRM As Integer = -1 Dim CveAcercamientoCRM As Integer = -1 Dim Asunto As String = "" Select Case RBLAgendaOpcion.SelectedValue Case 1 CveCliente = DdlClientesWS.SelectedValue.ToEntero validacionesAgendaOpcionesOK = If(CveCliente > 0, True, False) Asunto = $"Cliente: {DdlClientesWS.SelectedText} {TxtAsuntoAgenda.Text}" Exit Select Case 2 CveProveedor = DdlProveedor.SelectedValue.ToEntero validacionesAgendaOpcionesOK = If(CveProveedor > 0, True, False) Asunto = $"Proveedor: {DdlProveedor.SelectedText} {TxtAsuntoAgenda.Text}" Exit Select Case 3 CvePersonal = DdlPersonal.SelectedValue.ToEntero validacionesAgendaOpcionesOK = If(CvePersonal > 0, True, False) Asunto = $"Personal: {DdlPersonal.SelectedItem.Text} {TxtAsuntoAgenda.Text}" Exit Select Case 4 CveEmpresaCRM = DdlEmpresaCRM.SelectedValue.ToEntero CveContactoCRM = DdlContactoCRM.SelectedValue.ToEntero CveAcercamientoCRM = DdlAcercamientoCRM.SelectedValue.ToEntero validacionesAgendaOpcionesOK = If(CveEmpresaCRM > 0, True, False) If CveContactoCRM > 0 Then Asunto = $"Contacto CRM: {DdlContactoCRM.SelectedItem.Text} {TxtAsuntoAgenda.Text}" End If If CveAcercamientoCRM > 0 Then Asunto = $"Acercamiento oportunidad CRM: {DdlAcercamientoCRM.SelectedItem.Text} {TxtAsuntoAgenda.Text}" End If If CveEmpresaCRM > 0 And CveAcercamientoCRM <= 0 And CveContactoCRM <= 0 Then Asunto = $"Prospecto CRM: {DdlEmpresaCRM.SelectedItem.Text} {TxtAsuntoAgenda.Text}" End If Exit Select Case Else Asunto = TxtAsuntoAgenda.Text End Select If validacionesAgendaOpcionesOK Then If ObjEventos.AddEventoAgenda(DdlAgedaTipo.SelectedValue.ToEntero, Asunto, TxtDescripcionAgenda.Text, DdlPrioridad.SelectedValue.ToEntero, FechaInicio, FechaFin, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, RecurrenciaTipo:=RecurrenciaTipo, Frecuencia:=Frecuencia, DiasSemana:=DiasSemana, Dia:=Dias, Mes:=Mes, RecurrenciaFin:=RecurrenciaFin, CveTipoEvento:=CveTipoEvento, Importe:=Importe, CveEmpresaCRM:=CveEmpresaCRM, CveContactoCRM:=CveContactoCRM, CveAcercamientoCRM:=CveAcercamientoCRM, CveCliente:=CveCliente, CveProveedor:=CveProveedor, CvePersonal:=CvePersonal) Then Alert("El Evento se guardó correctamente", TipoMensaje.MsgInformacion) Else Alert("Ocurrió un error al Guardar el evento", TipoMensaje.MsgAdvertencia) End If Else Dim MensajeAdvertencia As String = "" Select Case RBLAgendaOpcion.SelectedValue Case 1 MensajeAdvertencia = "Debe de seleccionar un cliente." Exit Select Case 2 MensajeAdvertencia = "Debe de seleccionar un proveedor." Exit Select Case 3 MensajeAdvertencia = "Debe de seleccionar un miembro de personal." Exit Select Case 4 MensajeAdvertencia = "Debe de seleccionar al menos una de las opciones de CRM." Exit Select Case Else End Select Alert(MensajeAdvertencia, TipoMensaje.MsgAdvertencia) RegistraScript("if($get('CheckRecurrencia').checked) {$('#UpRecurrencia').show()} else {$('#UpRecurrencia').hide()};", "100") End If End If ObjEventos.Dispose() If validacionesAgendaOpcionesOK Then RegistraScript("Calendario();SetView();$('#ModalAgenda').modal('hide');", "1234") LimpiaModalAgenda() End If End Sub Private Sub LimpiaModalAgenda() TxtDescripcionAgenda.Text = "" TxtAsuntoAgenda.Text = "" DdlPrioridad.SelectedValue = "1" TxtNumeroOcurrencias.Text = "" TxtFechaFinRecurrencia.Text = "" RBFechaFin.Checked = False RBNumeroOcurrencias.Checked = False RBLRecurrencia.SelectedValue = "1" CheckDiasSemana.ClearSelection() RBLRecurrencia_SelectedIndexChanged(RBLRecurrencia, EventArgs.Empty) TxtFrecuencia.Text = "1" 'LnkTituloLink.Text = "" UpModalAgenda.Update() End Sub Protected Sub BtnEliminar_Click(sender As Object, e As EventArgs) Dim ObjEventos As New ClsOIEventos RegistraScript("GetView();") If ObjEventos.RemoveEvento(HdnCveEvento.Value.ToEntero, UsuarioActual.CveEmpresa) Then RegistraScript("Calendario();SetView();$('#ModalAgenda').modal('hide');", "1234") Alert("El evento se eliminó correctamente", TipoMensaje.MsgInformacion) Else Alert("Ocurrió un error al eliminar el evento, por favor intente de nuevo.", TipoMensaje.MsgError) End If ObjEventos.Dispose() End Sub Public Shared Function EliminaEvento(CveEvento As Integer, CveEmpresa As Integer) As String Dim ObjEventos As New ClsOIEventos ObjEventos.RemoveEvento(CveEvento, CveEmpresa) ObjEventos.Dispose() Return CveEvento.ToString End Function Public Shared Function ActualizaEvento(ClsEvent As CalendarEvent) As String Dim ObjEventos As New ClsOIEventos Dim FechaInicio = DateTimeOffset.Parse(ClsEvent.start).DateTime Dim FechaFin = DateTimeOffset.Parse(ClsEvent.end).DateTime If ObjEventos.UpdateEvento("-1", "-1", -1, -1, -1, FechaInicio, FechaFin, -1, "-1", ClsEvent.id) Then End If ObjEventos.Dispose() Return "a" End Function Protected Sub RBLRecurrencia_SelectedIndexChanged(sender As Object, e As EventArgs) Select Case RBLRecurrencia.SelectedValue.ToEntero Case 1 LblTextoFrecuencia.Text = "Hora(s)" TrDiasSemanaAdd.Style("display") = "none" Case 2 LblTextoFrecuencia.Text = "Dia(s)" TrDiasSemanaAdd.Style("display") = "none" Case 3 LblTextoFrecuencia.Text = "Semana(s)" TrDiasSemanaAdd.Style("display") = "block" 'Chequea los dias seleccionados en la recurrencia For Each item As ListItem In CheckDiasSemana.Items If HdnDiasSemanaAgendar.Value.Contains(item.Value) Then item.Selected = True Else item.Selected = False End If Next Case 4 LblTextoFrecuencia.Text = "Mes(es)" TrDiasSemanaAdd.Style("display") = "none" Case 5 LblTextoFrecuencia.Text = "Año(s)" TrDiasSemanaAdd.Style("display") = "none" Case Else End Select UpRecurrencia.Update() End Sub Protected Sub BtnActualizaAdd_Click(sender As Object, e As EventArgs) RBLRecurrencia_SelectedIndexChanged(RBLRecurrencia, EventArgs.Empty) End Sub #End Region 'Protected Sub ChkOIAsigne_CheckedChanged(sender As Object, e As EventArgs) Handles ChkOIAsigne.CheckedChanged, ChkOIPorHacer.CheckedChanged ' CargaTareas() 'End Sub Protected Sub DdlFiltroIndicador_SelectedIndexChanged(sender As Object, e As EventArgs) End Sub Protected Sub BtnIndicador_Click(sender As Object, e As EventArgs) End Sub #Region "DIRECTORIO TELEFONICO" Private Sub CargaDirectorioTelefonico() Dim ObjPersonal As New ClsRH Me.RegistraScript("$get('DivActualizarEvento').style.display = 'true';") '$get('DivActualizarEvento').style.display = 'none'; If ObjPersonal.DirectorioTelefonicoGet(UsuarioActual.CveEmpresa) Then GvDirectorio.DataSource = ObjPersonal.DtResultados End If GvDirectorio.Columns(2).Visible = False ' 8/10/2018 - Se omite validacion de visibilidad de Columna Telefono Personal solo para usuario Dennise Cruz 'If UsuarioActual.CveUsuario = 1781 Then ' GvDirectorio.Columns(5).Visible = True 'Else ' GvDirectorio.Columns(5).Visible = False 'End If ObjPersonal.Dispose() GvDirectorio.DataBind() UPDatosDirectorio.Update() End Sub Protected Sub GvDirectorio_RowDataBound(sender As Object, e As GridViewRowEventArgs) If e.Row.RowType = DataControlRowType.DataRow Then If String.IsNullOrEmpty(e.Row.DBCampo("CvePersonal")) Then e.Row.Style("background-color") = "#F1B168" 'e.Row.FCHyperLink("HypDeptoPersonal").Style("text-decoration") = "none" 'e.Row.FCHyperLink("HypDeptoPersonal").ForeColor = Drawing.Color.Black Else 'e.Row.FCHyperLink("HypDeptoPersonal").NavigateUrl = String.Format("/RH/Personal.aspx?CvePersonal={0}", e.Row.DBCampo("CvePersonal")) End If End If End Sub #End Region #Region "Metodos Graficar" Public Function GraficaLineas(data As DataTable, Optional Titulo As String = "", Optional Subtitulo As String = "", Optional SinCols As String = "0", Optional VerValor As Boolean = False, Optional G1 As Boolean = False) As HighChart Dim grafica As New HighChart If Not IsNothing(data) Then grafica.chart = New Chart grafica.chart.type = "line" grafica.title = New Title grafica.title.text = Titulo grafica.subtitle = New Title grafica.subtitle.text = Subtitulo grafica.subtitle.useHTML = True grafica.yAxis = New Axis grafica.yAxis.title = New Title grafica.yAxis.title.text = " " grafica.xAxis = New Axis If VerValor Then grafica.plotOptions = New PlotOptions grafica.plotOptions.line = New Line grafica.plotOptions.line.dataLabels = New DataLabels grafica.plotOptions.line.dataLabels.enabled = True End If grafica.xAxis.categories = New List(Of String) Dim index As Integer = 0 Dim contador As Integer = 0 For Each col As DataColumn In data.Columns If contador = 0 Then index = contador Else grafica.xAxis.categories.Add(col.ColumnName) End If contador += 1 Next grafica.series = New List(Of Series) For Each row As DataRow In data.Rows Dim serie As New Series serie.data = New List(Of Object) Dim anterior As Double = 0 For i As Integer = 0 To data.Columns.Count - 1 If i = index Then serie.name = row(i).ToString() Else Dim actual = row(i).ToString().ToDouble serie.data.Add(actual) anterior = actual End If Next grafica.series.Add(serie) Next data.Dispose() End If Return grafica End Function Public Function GraficaStandar(data As DataTable, charttype As String, Optional Titulo As String = "", Optional Subtitulo As String = "", Optional VerValor As Boolean = False) As HighChart Dim grafica As New HighChart If Not IsNothing(data) Then grafica.chart = New Chart grafica.chart.type = charttype grafica.title = New Title grafica.title.text = Titulo grafica.subtitle = New Title grafica.subtitle.text = Subtitulo grafica.subtitle.useHTML = True grafica.yAxis = New Axis grafica.yAxis.title = New Title grafica.yAxis.title.text = " " grafica.xAxis = New Axis grafica.xAxis.categories = New List(Of String) Dim index As Integer = 0 Dim contador As Integer = 0 If charttype = "bar" Then For Each col As DataRow In data.Rows grafica.xAxis.categories.Add(col(0).ToString) contador += 1 Next grafica.series = New List(Of Series) For i As Integer = 1 To data.Columns.Count - 1 Dim serie As New Series serie.data = New List(Of Object) serie.name = data.Columns(i).ColumnName For Each row As DataRow In data.Rows serie.data.Add(row(i).ToString().ToDouble) Next If VerValor Then serie.dataLabels = New DataLabels serie.dataLabels.enabled = True End If grafica.series.Add(serie) Next Else For Each col As DataColumn In data.Columns If contador = 0 Then index = contador Else grafica.xAxis.categories.Add(col.ColumnName) End If contador += 1 Next grafica.series = New List(Of Series) For Each row As DataRow In data.Rows Dim serie As New Series serie.data = New List(Of Object) For i As Integer = 0 To data.Columns.Count - 1 If i = index Then serie.name = row(i).ToString() Else serie.data.Add(row(i).ToString().ToDouble) End If Next If VerValor Then serie.dataLabels = New DataLabels serie.dataLabels.enabled = True End If grafica.series.Add(serie) Next End If data.Dispose() End If Return grafica End Function Public Function GraficaStandarB(data As DataTable, charttype As String, Optional Titulo As String = "", Optional Subtitulo As String = "", Optional VerValor As Boolean = False) As HighChart Dim grafica As New HighChart If Not IsNothing(data) Then grafica.chart = New Chart grafica.chart.type = charttype grafica.title = New Title grafica.title.text = Titulo grafica.subtitle = New Title grafica.subtitle.text = Subtitulo grafica.subtitle.useHTML = True grafica.yAxis = New Axis grafica.yAxis.title = New Title grafica.yAxis.title.text = " " grafica.xAxis = New Axis grafica.xAxis.categories = New List(Of String) Dim index As Integer = 0 Dim contador As Integer = 0 If charttype = "bar" Then For Each col As DataRow In data.Rows grafica.xAxis.categories.Add(col(0).ToString) contador += 1 Next grafica.series = New List(Of Series) For i As Integer = 1 To data.Columns.Count - 1 Dim serie As New Series serie.data = New List(Of Object) serie.name = data.Columns(i).ColumnName For Each row As DataRow In data.Rows serie.data.Add(row(i).ToString().ToDouble) Next If VerValor Then serie.dataLabels = New DataLabels serie.dataLabels.enabled = True End If grafica.series.Add(serie) Next Else For Each col As DataRow In data.Rows grafica.xAxis.categories.Add(col(0).ToString) contador += 1 Next grafica.series = New List(Of Series) For x As Integer = 1 To data.Columns.Count - 1 Dim serie As New Series serie.data = New List(Of Object) serie.name = data.Columns(x).ColumnName For i As Integer = 0 To data.Rows.Count - 1 serie.data.Add(data.Rows(i)(x).ToString().ToDouble) Next grafica.series.Add(serie) Next End If End If Return grafica End Function Public Function GraficaStacked(data As DataTable, charttype As String, Optional Titulo As String = "", Optional Subtitulo As String = "", Optional VerValor As Boolean = False) As HighChart Dim grafica As HighChart grafica = GraficaStandar(data, charttype, Titulo, Subtitulo, VerValor) If IsNothing(grafica.plotOptions) Then grafica.plotOptions = New PlotOptions() End If If IsNothing(grafica.plotOptions.column) Then grafica.plotOptions.column = New Column End If grafica.plotOptions.column.stacking = "normal" If VerValor Then grafica.yAxis.stackLabels = New DataLabels grafica.yAxis.stackLabels.enabled = True 'grafica.yAxis.stackLabels.color = "#FFFFFF" grafica.yAxis.stackLabels.rotation = -90 grafica.yAxis.stackLabels.y = -35 End If Return grafica End Function Public Function ToJsonString(obj As Object) As String Dim settings As New JsonSerializerSettings settings.NullValueHandling = NullValueHandling.Ignore settings.Formatting = Formatting.Indented Return JsonConvert.SerializeObject(obj, settings).ToString End Function #End Region Protected Sub LnkIndicador_Click(sender As Object, e As EventArgs) CargaGraficas() End Sub #Region "COMUNICADO" Protected Sub LnkAgregar_Click(sender As Object, e As EventArgs) RegistraScript("$('#DvModalComunicado').modal('show');") End Sub Protected Sub CargaComunicado() Dim ObjEmpresa As ClsSisEmpresas = New ClsSisEmpresas DivComunicado.InnerHtml = "" If ObjEmpresa.GetComunicado(UsuarioActual.CveEmpresa) Then If ObjEmpresa.DtResultados.Rows.Count > 0 And ObjEmpresa.DtResultados(0)("Comunicado").ToString() <> "" Then DivComunicado.Visible = True Dim Comunicado As String = ObjEmpresa.DtResultados(0)("Comunicado").ToString() Dim ListaComunicados As String() = Comunicado.Split("|") Dim Turno As Integer = 1 For Each s As String In ListaComunicados If (Turno Mod 2) = 0 Then MuestraComunicado(DivComunicado, "purple-plum", "fa fa-bullhorn", "", s.ToString()) Else MuestraComunicado(DivComunicado, "grey-cascade", "fa fa-bullhorn", "", s.ToString()) End If Turno += 1 Next TxtComunicado.Text = ObjEmpresa.DtResultados(0)("Comunicado").ToString() Else DivComunicado.Visible = False 'DivComunicadoTexto.InnerHtml = "" TxtComunicado.Text = "" End If End If ObjEmpresa.Dispose() End Sub Protected Sub BtnActualizarComunicado_Click(sender As Object, e As EventArgs) Dim ObjEmpresa As ClsSisEmpresas = New ClsSisEmpresas If ObjEmpresa.UpdateComunicado(UsuarioActual.CveEmpresa, TxtComunicado.Text) Then Alert("Comunicado Actualizado Correctamente", TipoMensaje.MsgInformacion) RegistraScript("$('#DvModalComunicado').modal('hide');") End If ObjEmpresa.Dispose() CargaComunicado() UPComunicado.Update() End Sub Private Sub MuestraComunicado(DIV As HtmlGenericControl, Color As String, Icono As String, Titulo As String, Comentario As String) Dim htmldiv As New StringBuilder 'htmldiv.AppendFormat("{0}
", DIV.InnerHtml, Color, Icono) 'htmldiv.AppendFormat("
", "") htmldiv.AppendFormat("{2}

{0} {1}

", Titulo, Comentario, DIV.InnerHtml, Icono) DIV.InnerHtml = htmldiv.ToString End Sub #End Region Protected Sub BtnEvaluarProveedores_Click(sender As Object, e As EventArgs) End Sub Protected Sub LnkGuardarUnoaUno_Click(sender As Object, e As EventArgs) Dim fecha As String = DateTime.Now.ToString("yyyy/MM/dd") Dim continuar As Boolean = True Using ObjPA_O As ClsOIEventos = New ClsOIEventos() For Each gvrow As GridViewRow In GVPA_OI_UnoAUnoTableroGet.Rows If continuar Then Dim CveUnoaUnoPregunta As Integer = gvrow.DataKey("CveUnoaUnoPregunta").ToEntero() If CveUnoaUnoPregunta > 0 Then Dim Comentarios As String = gvrow.FCTextBox("TxtComentarios").Text continuar = ObjPA_O.UnoAUnoTableroAdd(UsuarioActual.CveEmpresa, fecha, UsuarioActual.CveUsuario, CveUnoaUnoPregunta, Comentarios) End If End If Next End Using If continuar Then Alert("Tus respuestas se han actualizado", ModExtensiones.TipoMensaje.ToastInformacion) End If RegistraScript("$('#DvUnoaUno').modal('hide')") End Sub #Region "DOCUMENTACION" Private Sub CargaDocumentacion() If UsuarioActual.CveEmpresa = 140 Then DVDescargasBDH.Visible = True Dim TmpDT = New DataTable() Dim ObjDoc As New ClsEdocumentacion If ObjDoc.DocumentacionGet(-1, -1, 1, UsuarioActual.Empresa.CveEmpresa, Modulo:=8) Then Dim dtt As New DataTable dtt = ObjDoc.DtResultados If dtt IsNot Nothing AndAlso dtt.Rows.Count > 0 Then TmpDT.Columns.Add(New DataColumn("Nombre", GetType(String))) TmpDT.Columns.Add(New DataColumn("Liga", GetType(String))) TmpDT.Columns.Add(New DataColumn("Nombre2", GetType(String))) TmpDT.Columns.Add(New DataColumn("Liga2", GetType(String))) 'Dim i As Integer = 0 'Dim Nombre As String = "" 'Dim Liga As String = "" Dim drr As DataRow For Each dr As DataRow In dtt.Rows If (dr("Consec").ToString.ToEntero Mod 2) = 1 Then 'primer renglón drr = TmpDT.NewRow drr("Nombre") = dr("Documentacion").ToString drr("Liga") = String.Format("/Compras/PopUpVerFactura.aspx?p={0}", Encripta(String.Format("op=File&File={0}\Formatos\{1}_{2}", UsuarioActual.Empresa.Ruta, dr("CveDocumentacion"), dr("DocumentacionFormato")).Replace("\", "/").Replace("//", "/"))) TmpDT.Rows.Add(drr) Else TmpDT.Rows((dr("Consec").ToString.ToEntero / 2) - 1)("Nombre2") = dr("Documentacion").ToString TmpDT.Rows((dr("Consec").ToString.ToEntero / 2) - 1)("Liga2") = String.Format("/Compras/PopUpVerFactura.aspx?p={0}", Encripta(String.Format("op=File&File={0}\Formatos\{1}_{2}", UsuarioActual.Empresa.Ruta, dr("CveDocumentacion"), dr("DocumentacionFormato")).Replace("\", "/").Replace("//", "/"))) End If Next End If End If ObjDoc.Dispose() GvDoc.DataSource = TmpDT GvDoc.DataBind() End If End Sub Protected Sub GvDoc_RowDataBound(sender As Object, e As GridViewRowEventArgs) If e.Row.RowType = DataControlRowType.DataRow Then If e.Row.DBCampo("Nombre2") <> "" Then e.Row.FindControl("divdoc20").Visible = True End If End If End Sub #End Region Protected Sub LnkInconsistencias_Click1(sender As Object, e As EventArgs) MuestraInconsistencias() End Sub Private Sub IniializaDdlsOpcionesAgenda() 'CLIENTES If UsuarioActual.Empresa.Funcionalidad(105) = "1" Then DdlClientesWS.setEsWebService(True) Else DdlClientesWS.setEsWebService(False) CargaClientes() End If 'PROVEEDORES If (UsuarioActual.Empresa.Funcionalidad(105) = "1") Then DdlProveedor.setEsWebService(True) DdlProveedor.Attributes.Add("data-metodo", "getproveedores") DdlProveedor.SelectedText = "Todos" DdlProveedor.SelectedValue = "-1" Else DdlProveedor.setEsWebService(False) DdlProveedor.ddl.DataSource = GlobalDTCompProveedores(UsuarioActual.CveEmpresa) DdlProveedor.ddl.DataBind() DdlProveedor.ddl.Items.Insert(0, New ListItem("Todos", "-1")) End If DdlProveedor.ddl.AutoPostBack = False DdlClientesWS.ddl.AutoPostBack = False 'PERSONAL DdlPersonal.DataSource = GlobalDTRHPersonal(UsuarioActual.CveEmpresa).FiltraParametros("CveEstatusPersonal=1") DdlPersonal.DataBind() DdlPersonal.Items.Insert(0, New ListItem("Seleccione Uno", "-1")) CargaDdlEmpresaCRM() RBLAgendaOpcion_SelectedIndexChanged(Nothing, Nothing) End Sub Private Sub CargaDdlEmpresaCRM() Dim cRMService = New CRMService(System.Configuration.ConfigurationManager.ConnectionStrings("Conexion").ConnectionString) Dim parametros = New RequestEmpresasCRM(UsuarioActual.CveEmpresa, -1, CveMedioCaptacion:=-1) Dim objServicio = cRMService.GetEmpresasCRM(parametros) If objServicio.IsSuccess Then DdlEmpresaCRM.DataSource = objServicio.Result DdlEmpresaCRM.DataBind() DdlEmpresaCRM.Items.Insert(0, New ListItem("Sin Seleccionar", "-1")) If objServicio.Result.Count > 0 Then DdlEmpresaCRM_SelectedIndexChanged(Nothing, Nothing) End If End If End Sub Protected Sub DdlEmpresaCRM_SelectedIndexChanged(sender As Object, e As EventArgs) CargaDdlAcercamientoCRM() CargaDdlContactoCRM() UpOpcionesAgenda.Update() End Sub Private Sub CargaClientes() If Not UsuarioActual.Empresa.Funcionalidad(105) = "1" Then DdlClientesWS.ddl.Items.Clear() DdlClientesWS.DataSource = GlobalDTCliente(UsuarioActual.CveEmpresa, -1) DdlClientesWS.DataBind() DdlClientesWS.ddl.Items.Insert(0, New ListItem("Todos", "-1")) End If End Sub Protected Sub RBLAgendaOpcion_SelectedIndexChanged(sender As Object, e As EventArgs) DdlClientesWS.ddl.SelectedValueExist(-1) DdlClientesWS.txtText.Value = "" DdlClientesWS.txtValue.Value = "-1" DdlProveedor.ddl.SelectedValueExist(-1) DdlProveedor.txtText.Value = "" DdlProveedor.txtValue.Value = "-1" DdlPersonal.SelectedValueExist(-1) DdlEmpresaCRM.SelectedValueExist(-1) DdlContactoCRM.SelectedValueExist(-1) DdlAcercamientoCRM.SelectedValueExist(-1) DVAgendaCliente.Visible = False DVAgendaProveedor.Visible = False DVAgendaPersonal.Visible = False DVAgendaCRM1.Visible = False DVAgendaCRM2.Visible = False Select Case RBLAgendaOpcion.SelectedValue.ToEntero Case 1 DVAgendaCliente.Visible = True Exit Select Case 2 DVAgendaProveedor.Visible = True Exit Select Case 3 DVAgendaPersonal.Visible = True Exit Select Case 4 DVAgendaCRM1.Visible = True DVAgendaCRM2.Visible = True Case Else 'Agenda End Select UpOpcionesAgenda.Update() End Sub End Class