131 lines
6.0 KiB
VB.net
131 lines
6.0 KiB
VB.net
Option Explicit On
|
|
Option Strict On
|
|
|
|
Imports System.Data
|
|
Imports Extensiones
|
|
|
|
Partial Class Prospectos_CatProspectosRedesMetas
|
|
Inherits ClsPaginas
|
|
|
|
Private Property DtDatos As DataTable
|
|
Get
|
|
Return DirectCast(ViewState("DtDatos"), DataTable)
|
|
End Get
|
|
Set(value As DataTable)
|
|
ViewState("DtDatos") = value
|
|
End Set
|
|
End Property
|
|
|
|
|
|
Private Property CveProspectoSeleccionado As Integer
|
|
Get
|
|
Return ViewState("CveProspectoSeleccionado").ToString.ToEntero
|
|
End Get
|
|
Set(value As Integer)
|
|
ViewState("CveProspectoSeleccionado") = value
|
|
End Set
|
|
End Property
|
|
|
|
Protected Sub Page_Load(sender As Object, e As System.EventArgs) Handles Me.Load
|
|
|
|
If Not Page.IsPostBack Then
|
|
ViewState("Orden") = ""
|
|
CveProspectoSeleccionado = -1 'UsuarioActual.CveProspecto
|
|
|
|
DdlClasificacion.DataSource = GlobalDTProspectosClasificaciones(UsuarioActual.CveEmpresa) : DdlClasificacion.DataBind()
|
|
DdlZona.DataSource = GlobalDTProspectosSupervisores(UsuarioActual.CveEmpresa) : DdlZona.DataBind()
|
|
DdlRegion.DataSource = GlobalDTProspectosCoordinadores(DdlZona.SelectedValue.ToEntero, UsuarioActual.CveEmpresa) : DdlRegion.DataBind()
|
|
DdlMunicipioFiltro.DataSource = GlobalDTGralMunicipios("26") : DdlMunicipioFiltro.DataBind()
|
|
|
|
CargaDatos()
|
|
|
|
End If
|
|
|
|
End Sub
|
|
Public Sub CargaDatos()
|
|
Dim ObjProspectos As New ClsProspectos
|
|
If ObjProspectos.GetProspectosAgrupadosMetas(DdlClasificacion.SelectedValue.ToEntero, DdlEscolaridad.SelectedValue.ToEntero, DdlIFE.SelectedValue.ToEntero, DdlSexo.SelectedValue.ToEntero, DdlZona.SelectedValue.ToEntero, DdlRegion.SelectedValue.ToEntero, _
|
|
DdlMunicipioFiltro.SelectedValue.ToEntero, -1, DdlAuditado.SelectedValue.ToEntero, CveProspectoSeleccionado, DdlAgrupador.SelectedValue.ToEntero, UsuarioActual.CveEmpresa) Then
|
|
ViewState("DTProspectos") = ObjProspectos.DtResultados
|
|
Else
|
|
Me.GvDatos.DataSource = Nothing
|
|
End If
|
|
|
|
ObjProspectos.Dispose()
|
|
UPDatos.Update()
|
|
|
|
If ViewState("Orden").ToString() <> String.Empty Then
|
|
CargaGrid(ViewState("Orden").ToString())
|
|
Else
|
|
CargaGrid("")
|
|
End If
|
|
End Sub
|
|
|
|
Private Sub CargaGrid(Orden As String)
|
|
If Orden <> String.Empty Then
|
|
Dim DV As New DataView(CType(ViewState("DTProspectos"), DataTable), "", Orden, DataViewRowState.CurrentRows)
|
|
GvDatos.DataSource = DV.ToTable()
|
|
DV.Dispose()
|
|
Else
|
|
GvDatos.DataSource = CType(ViewState("DTProspectos"), DataTable)
|
|
End If
|
|
GvDatos.DataBind()
|
|
End Sub
|
|
|
|
Protected Sub GvDatos_RowDataBound(sender As Object, e As System.Web.UI.WebControls.GridViewRowEventArgs) Handles GvDatos.RowDataBound
|
|
If e.Row.RowType = DataControlRowType.Header Then
|
|
e.Row.Cells(0).Text = DdlAgrupador.SelectedItem.Text
|
|
ElseIf e.Row.RowType = DataControlRowType.DataRow Then
|
|
If e.Row.RowIndex = 0 Then
|
|
e.Row.Cells(0).Width = Unit.Pixel(450)
|
|
e.Row.Cells(1).Width = Unit.Pixel(80)
|
|
e.Row.Cells(2).Width = Unit.Pixel(80)
|
|
e.Row.Cells(3).Width = Unit.Pixel(80)
|
|
|
|
End If
|
|
e.Row.Cells(0).HorizontalAlign = HorizontalAlign.Left
|
|
If e.Row.DBCampo("CveSupervisor").ToEntero > 0 AndAlso e.Row.DBCampo("CveCoordinador").ToEntero = 0 AndAlso (e.Row.DBCampo("CveAgrupador") = "" And e.Row.DBCampo("MesAnioIng") = "-1") Then
|
|
Dim TotalMetas As Integer = CType(GvDatos.DataSource, DataTable).SUM("Meta", "CveSupervisor=" & e.Row.DBCampo("CveSupervisor")).ToEntero
|
|
e.Row.Cells(3).Text = String.Format("{0}%", (e.Row.DBCampo("NumSupervisores").ToDouble / TotalMetas * 100).FormatoNumero)
|
|
e.Row.Cells(2).Text = TotalMetas.ToString.FormatoNumero(0)
|
|
'e.Row.Cells(1).Text = e.Row.DBCampo("NumSupervisores")
|
|
'e.Row.Cells(1).HorizontalAlign = HorizontalAlign.Center
|
|
|
|
|
|
e.Row.CssClass = "Totales"
|
|
e.Row.Height = 22
|
|
' e.Row.Font.Size = 12
|
|
e.Row.Cells(0).Font.Size = 12
|
|
Else
|
|
If e.Row.DBCampo("CveCoordinador").ToEntero > 0 AndAlso e.Row.DBCampo("NumSupervisores").ToEntero > 0 AndAlso (e.Row.DBCampo("CveAgrupador") = "" And e.Row.DBCampo("MesAnioIng") = "-1") Then
|
|
e.Row.Cells(3).Text = String.Format("{0}%", (e.Row.DBCampo("NumSupervisores").ToDouble / e.Row.DBCampo("Meta").ToDouble * 100).FormatoNumero)
|
|
'e.Row.Cells(1).Text = e.Row.DBCampo("NumCoordinadores")
|
|
'e.Row.Cells(1).HorizontalAlign = HorizontalAlign.Center
|
|
e.Row.CssClass = "SubTotales"
|
|
e.Row.Height = 20
|
|
End If
|
|
End If
|
|
|
|
|
|
|
|
'e.Row.FCLiteral("LtlNombres").Text = "<a class=""Texto"" href=""/Prospectos/Prospectos.aspx?CveProspecto=" & e.Row.DBCampo("CveProspecto") & """>" & e.Row.FCLiteral("LtlNombres").Text & "</a>"
|
|
'e.Row.FCLiteral("LtlRFC").Text = "<a class=""Texto"" href=""/Prospectos/Prospectos.aspx?CveProspecto=" & e.Row.DBCampo("CveProspecto") & """>" & e.Row.FCLiteral("LtlRFC").Text & "</a>"
|
|
|
|
'e.Row.FCLiteral("LtlTelefono").Text = "<a class=""Texto"" href=""/Ventas/Clientes.aspx?CveCliente=" & e.Row.DBCampo("CveCliente") & """>" & e.Row.FCLiteral("LtlTelefono").Text & "</a>"
|
|
|
|
End If
|
|
End Sub
|
|
|
|
|
|
Protected Sub DdlZona_SelectedIndexChanged(sender As Object, e As EventArgs) Handles DdlZona.SelectedIndexChanged
|
|
DdlRegion.Items.Clear()
|
|
DdlRegion.Items.Add(New ListItem("Todos", "-1"))
|
|
DdlRegion.DataSource = GlobalDTProspectosCoordinadores(DdlZona.SelectedValue.ToEntero, UsuarioActual.CveEmpresa) : DdlRegion.DataBind()
|
|
End Sub
|
|
|
|
Protected Sub BtnConsultar_Click(sender As Object, e As EventArgs) Handles BtnConsultar.Click
|
|
CargaDatos()
|
|
End Sub
|
|
|
|
End Class
|