215 lines
9.7 KiB
VB.net
215 lines
9.7 KiB
VB.net
Imports System.Web.UI.DataVisualization.Charting
|
|
Imports DocumentFormat.OpenXml.Office2010.Excel
|
|
Imports Extensiones
|
|
Imports System.Data
|
|
Partial Class Prospectos_RepMetas2
|
|
Inherits ClsPaginas
|
|
|
|
|
|
Public Property CveProspecto As Integer
|
|
Get
|
|
Return CType(ViewState("CveProspecto"), Integer)
|
|
End Get
|
|
Set(value As Integer)
|
|
ViewState("CveProspecto") = value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property DtEncuesta As DataTable
|
|
Get
|
|
Return CType(ViewState("DtEncuesta"), DataTable)
|
|
End Get
|
|
Set(value As DataTable)
|
|
ViewState("DtEncuesta") = value
|
|
End Set
|
|
End Property
|
|
|
|
|
|
Protected Sub Page_Load(sender As Object, e As EventArgs) Handles Me.Load
|
|
If Not Page.IsPostBack Then
|
|
|
|
CveProspecto = IfNull(Request("CveProspecto"), "820088").ToString.ToEntero
|
|
CargaDatos()
|
|
DdlEncuesta.DataSource = GlobalDTProspectosEncuestas(UsuarioActual.CveEmpresa).FiltraParametros("CveEncuesta IN (32,48)")
|
|
DdlEncuesta.DataBind()
|
|
CargaEncuestas()
|
|
End If
|
|
End Sub
|
|
|
|
Private Sub CargaDatos()
|
|
Dim Prosp As New ClsProspectos
|
|
|
|
If Prosp.GetProspectos(CveProspecto, "-1", "-1", -1, -1, -1, -1, -1, -1, UsuarioActual.CveEmpresa) Then
|
|
LblNombre.Text = String.Format("{0} {1} {2}", Prosp.ApellidoPaterno, Prosp.ApellidoMaterno, Prosp.Nombres)
|
|
|
|
'If Prosp.GetProspectosHijos(CveProspecto, UsuarioActual.CveEmpresa, 1) > 0 Then
|
|
|
|
' Gv.DataSource = Prosp.DtResultados
|
|
|
|
'End If
|
|
End If
|
|
|
|
|
|
|
|
Prosp.Dispose()
|
|
Gv.DataBind()
|
|
End Sub
|
|
|
|
|
|
Public Sub CargaEncuestas()
|
|
Dim ObjProspectos As New ClsProspectos
|
|
|
|
|
|
Dim CvePersona As Integer = CveProspecto
|
|
|
|
|
|
If ObjProspectos.GetRepEncuestasEstatus(DdlEncuesta.SelectedValue.ToEntero, If(CvePersona > 0, CvePersona, 2476), UsuarioActual.CveEmpresa) Then
|
|
If ObjProspectos.DtResultados.Rows.Count > 0 Then
|
|
|
|
Dim dtt As DataTable = ObjProspectos.DtResultados
|
|
|
|
GvEstatus.DataSource = dtt
|
|
GvEstatus.DataBind()
|
|
|
|
' ChtPie.Series("Default").Points.DataBindXY(dtt.AsEnumerable, "Agrupador", dtt.AsEnumerable, "Total")
|
|
Dim yValues As Double() = {65.62, 75.54, 60.45, 55.73, 70.42}
|
|
Dim xValues As String() = {"France", "Canada", "UK", "USA", "Italy"}
|
|
Dim xValores As New ArrayList
|
|
Dim yValores As New ArrayList
|
|
For Each dr As DataRow In dtt.FiltraParametros("Estatus >= 0").Rows
|
|
yValores.Add(dr("Total").ToString.ToDouble)
|
|
xValores.Add(dr("EncuestaEstatus").ToString)
|
|
Next
|
|
|
|
ChtGral.Series("Default").Points.DataBindXY(xValores, yValores)
|
|
ChtGral.Series(0)("PieDrawingStyle") = "Concave"
|
|
ChtGral.ChartAreas("ChartArea1").Area3DStyle.Enable3D = True
|
|
ChtGral.Visible = True
|
|
End If
|
|
End If
|
|
|
|
If ObjProspectos.GetRepEncuestasRedesMetas(DdlEncuesta.SelectedValue.ToEntero, CvePersona, UsuarioActual.CveEmpresa) Then
|
|
|
|
DtEncuesta = ObjProspectos.DtResultados
|
|
|
|
|
|
|
|
'LtlAgrupador.Text = DdlAgrupador.SelectedItem.Text
|
|
'If DdlAgrupador.SelectedValue = "5" Then
|
|
' ChtPie.Visible = True
|
|
' If ObjProspectos.DtResultados.Rows.Count > 0 Then
|
|
|
|
' Dim dtt As DataTable = ObjProspectos.DtResultados.FiltraParametros("Porcentaje < 100")
|
|
' 'en el caso de sin clasificacion, elimino el primer registro poruqe viene duplicado de la consulta, porque se tiene que ignorar un groupingset
|
|
' ObjProspectos.DtResultados.Rows.RemoveAt(1)
|
|
' ViewState("DTProspectos") = ObjProspectos.DtResultados
|
|
|
|
' ' ChtPie.Series("Default").Points.DataBindXY(dtt.AsEnumerable, "Agrupador", dtt.AsEnumerable, "Total")
|
|
' Dim yValues As Double() = {65.62, 75.54, 60.45, 55.73, 70.42}
|
|
' Dim xValues As String() = {"France", "Canada", "UK", "USA", "Italy"}
|
|
' Dim xValores As New ArrayList
|
|
' Dim yValores As New ArrayList
|
|
' For Each dr As DataRow In dtt.Rows
|
|
' yValores.Add(dr("Total").ToString.ToDouble)
|
|
' xValores.Add(dr("Respuesta").ToString)
|
|
' Next
|
|
|
|
' ChtPie.Series("Default").Points.DataBindXY(xValores, yValores)
|
|
' ChtPie.Series(0)("PieDrawingStyle") = "Concave"
|
|
' ChtPie.ChartAreas("ChartArea1").Area3DStyle.Enable3D = True
|
|
' End If
|
|
'Else
|
|
|
|
'End If
|
|
Me.GvE.DataSource = DtEncuesta.FiltraParametros("CvePregunta > 0 AND CveRespuesta = -1 and NumRespuestas > 0 AND PreguntaEstatus = 'True'")
|
|
ViewState("DTProspectos") = ObjProspectos.DtResultados
|
|
|
|
Else
|
|
Me.GvE.DataSource = Nothing
|
|
End If
|
|
ObjProspectos.Dispose()
|
|
GvE.DataBind()
|
|
|
|
End Sub
|
|
|
|
|
|
|
|
Protected Sub DdlEncuesta_SelectedIndexChanged(sender As Object, e As EventArgs) Handles DdlEncuesta.SelectedIndexChanged
|
|
CargaEncuestas()
|
|
End Sub
|
|
|
|
Protected Sub GvE_RowDataBound(sender As Object, e As GridViewRowEventArgs) Handles GvE.RowDataBound
|
|
If e.Row.RowType = DataControlRowType.DataRow Then
|
|
|
|
e.Row.FCGridView("GvE").DataSource = DtEncuesta.FiltraParametros(String.Format("CvePregunta = {0} AND (CveRespuesta > 0 OR CveRespuesta = -2)", e.Row.DBCampo("CvePregunta")))
|
|
e.Row.FCGridView("GvE").DataBind()
|
|
|
|
|
|
Dim dtt As DataTable = DtEncuesta.FiltraParametros(String.Format("Porcentaje < 100 And CvePregunta = {0} AND (CveRespuesta > 0 OR CveRespuesta = -2)", e.Row.DBCampo("CvePregunta")))
|
|
'en el caso de sin clasificacion, elimino el primer registro poruqe viene duplicado de la consulta, porque se tiene que ignorar un groupingset
|
|
|
|
|
|
' ChtPie.Series("Default").Points.DataBindXY(dtt.AsEnumerable, "Agrupador", dtt.AsEnumerable, "Total")
|
|
Dim yValues As Double() = {65.62, 75.54, 60.45, 55.73, 70.42}
|
|
Dim xValues As String() = {"France", "Canada", "UK", "USA", "Italy"}
|
|
Dim xValores As New ArrayList
|
|
Dim yValores As New ArrayList
|
|
For Each dr As DataRow In dtt.Rows
|
|
yValores.Add(dr("Total").ToString.ToDouble)
|
|
xValores.Add(dr("Respuesta").ToString)
|
|
Next
|
|
|
|
CType(e.Row.FindControl("ChtPie"), DataVisualization.Charting.Chart).Series("Default").Points.DataBindXY(xValores, yValores)
|
|
CType(e.Row.FindControl("ChtPie"), DataVisualization.Charting.Chart).Series(0)("PieDrawingStyle") = "Concave"
|
|
CType(e.Row.FindControl("ChtPie"), DataVisualization.Charting.Chart).ChartAreas("ChartArea1").Area3DStyle.Enable3D = True
|
|
|
|
End If
|
|
End Sub
|
|
|
|
Protected Sub Gv_RowDataBound(sender As Object, e As GridViewRowEventArgs) Handles Gv.RowDataBound
|
|
If e.Row.RowType = DataControlRowType.DataRow Then
|
|
|
|
e.Row.FCLiteral("LitPor").Text = (e.Row.DBCampo("Hijos").ToDouble / e.Row.DBCampo("MetaGlobal").ToDouble * 100).FormatoNumero(0)
|
|
|
|
If e.Row.DBCampo("UltimoIngreso") <> "" AndAlso e.Row.DBCampo("UltimoIngreso") < Now.AddDays(-10) Then
|
|
e.Row.Cells(4).ForeColor = System.Drawing.Color.Red
|
|
e.Row.Cells(4).ToolTip = "Ultimo ingreso mayor a 10 dias"
|
|
End If
|
|
If e.Row.DBCampo("FechaIng") <> "" AndAlso e.Row.DBCampo("FechaIng").ToDate < Now.AddDays(-14) AndAlso e.Row.DBCampo("Hijos").ToEntero = 0 Then
|
|
e.Row.Cells(0).BackColor = System.Drawing.Color.Red
|
|
e.Row.Cells(0).ToolTip = String.Format("No se han ingresado hijos. Fecha de ingreso: {0}", e.Row.DBCampo("FechaIng").ToDate.ToShortDateString)
|
|
End If
|
|
If e.Row.DBCampo("Hijos").ToEntero = 0 Then
|
|
e.Row.FCHyperLink("Hpl").NavigateUrl = ""
|
|
End If
|
|
|
|
|
|
End If
|
|
End Sub
|
|
|
|
Protected Sub GvEE_RowDataBound(sender As Object, e As GridViewRowEventArgs)
|
|
If e.Row.RowType = DataControlRowType.DataRow Then
|
|
|
|
' e.Row.FCLiteral("LitPor").Text = (e.Row.DBCampo("Hijos").ToDouble / e.Row.DBCampo("Meta").ToDouble * 100).FormatoNumero(0)
|
|
|
|
e.Row.FCHyperLink("LtlCantidad").NavigateUrl = String.Format("/Prospectos/RepEncuestasDetalle.aspx?CveMunicipio={0}&Seccion={1}&Sexo={2}&IFE={3}&CveEncuesta={4}&CvePregunta={5}&CveRespuesta={6}&CveProspectoPadre={7}",
|
|
e.Row.DBCampo("CveMunicipio"), e.Row.DBCampo("Seccion"), e.Row.DBCampo("Sexo"), e.Row.DBCampo("IFE"), e.Row.DBCampo("CveEncuesta"), e.Row.DBCampo("CvePregunta"), e.Row.DBCampo("CveRespuesta"), e.Row.DBCampo("CveProspectoPadre"))
|
|
|
|
End If
|
|
End Sub
|
|
|
|
Protected Sub GvEstatus_RowDataBound(sender As Object, e As GridViewRowEventArgs) Handles GvEstatus.RowDataBound
|
|
If e.Row.RowType = DataControlRowType.DataRow Then
|
|
|
|
|
|
e.Row.FCHyperLink("LtlCantidad").NavigateUrl = String.Format("/Prospectos/RepEncuestasRedesDetalle.aspx?CveMunicipio={0}&Seccion={1}&Sexo={2}&IFE={3}&CveEncuesta={4}&CvePregunta={5}&CveRespuesta={6}&CveEvento={7}&CveProspectoPadre={8}&Estatus={9}",
|
|
-1, -1, -1, -1, e.Row.DBCampo("CveEncuesta"), -1, -1, -1, CveProspecto, e.Row.DBCampo("Estatus"))
|
|
If e.Row.DBCampo("Estatus") = "-1" Then
|
|
e.Row.CssClass = "SubTotales2"
|
|
e.Row.Cells(1).HorizontalAlign = HorizontalAlign.Center
|
|
End If
|
|
End If
|
|
End Sub
|
|
|
|
End Class
|