Commit inicial Ventas Productivo
This commit is contained in:
147
Prospectos/RedesArbol.aspx.vb
Normal file
147
Prospectos/RedesArbol.aspx.vb
Normal file
@@ -0,0 +1,147 @@
|
||||
Option Explicit On
|
||||
Option Strict On
|
||||
|
||||
Imports System.Data
|
||||
Imports Extensiones
|
||||
|
||||
Partial Class Prospectos_RedesArbol
|
||||
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(True)
|
||||
ImgPersonalizar.Attributes.Add("onclick", "$('#DivPersonalizar').show(1000); PosicionaObjeto(this.id,'DivPersonalizar');")
|
||||
End If
|
||||
|
||||
End Sub
|
||||
Public Sub CargaDatos(Optional RecargaArbol As Boolean = False)
|
||||
Dim ObjProspectos As New ClsProspectos
|
||||
|
||||
Dim InicioPadre As Integer = 0
|
||||
If CveProspectoSeleccionado > 0 Then
|
||||
InicioPadre = CveProspectoSeleccionado
|
||||
|
||||
'Dim node As New TreeNode
|
||||
'node.Text = String.Format("<span>{0} ({1})</span>", dr("NombreCompleto"), dr("Hijos"))
|
||||
'node.Value = dr("CveProspecto").ToString
|
||||
'AddNodes(node)
|
||||
'TV.Nodes.Add(node)
|
||||
End If
|
||||
|
||||
If RecargaArbol Then
|
||||
TV.Nodes.Clear()
|
||||
If ObjProspectos.GetProspectosArbol(0, UsuarioActual.CveEmpresa) Then
|
||||
DtDatos = ObjProspectos.DtResultados
|
||||
|
||||
Dim dt As DataTable = getNodosHijos(InicioPadre)
|
||||
For Each dr As DataRow In dt.Rows
|
||||
Dim node As New TreeNode
|
||||
node.Text = String.Format("<span>{0} ({1})</span>", dr("NombreCompleto"), dr("Hijos"))
|
||||
node.Value = dr("CveProspecto").ToString
|
||||
AddNodes(node)
|
||||
TV.Nodes.Add(node)
|
||||
Next
|
||||
|
||||
End If
|
||||
End If
|
||||
|
||||
|
||||
|
||||
ObjProspectos.Dispose()
|
||||
|
||||
|
||||
UPDatos.Update()
|
||||
End Sub
|
||||
|
||||
|
||||
|
||||
#Region "Arbol"
|
||||
|
||||
Private Sub AddNodes(ByRef node As TreeNode)
|
||||
Dim dt As New DataTable
|
||||
dt = getNodosHijos(node.Value.ToEntero)
|
||||
For Each dr As DataRow In dt.Rows
|
||||
Dim nNode As New TreeNode
|
||||
nNode.Text = String.Format("<span style='color:{2};'>{0} {1}</span>", dr("NombreCompleto"), If(dr("Hijos").ToString.ToEntero > 0, String.Format("({0})", dr("Hijos")), ""), Colores(dr("Level").ToString.ToEntero))
|
||||
nNode.Value = dr("CveProspecto").ToString
|
||||
If dr("level").ToString.ToEntero > 1 Then nNode.Expanded = False
|
||||
AddNodes(nNode)
|
||||
node.ChildNodes.Add(nNode)
|
||||
Next
|
||||
End Sub
|
||||
|
||||
Private Function Colores(Numero As Integer) As String
|
||||
Dim Retorno As String = ""
|
||||
Select Case Numero
|
||||
Case 1 : Retorno = "red"
|
||||
Case 2 : Retorno = "#228B22"
|
||||
Case 3 : Retorno = "#4B0082"
|
||||
Case 4 : Retorno = "#808000"
|
||||
Case 5 : Retorno = "#8B4513"
|
||||
End Select
|
||||
Return Retorno
|
||||
End Function
|
||||
|
||||
|
||||
Private Function getNodosHijos(CveProspecto As Integer) As DataTable
|
||||
Return DtDatos.FiltraParametros(String.Format("CveProspectoPadre = {0}", CveProspecto))
|
||||
End Function
|
||||
#End Region
|
||||
'Protected Sub LnkDatos_Click(sender As Object, e As EventArgs) Handles LnkDatos.Click
|
||||
' PnlDatos.Visible = True
|
||||
' PnlArbol.Visible = False
|
||||
'End Sub
|
||||
|
||||
'Protected Sub LnkArbol_Click(sender As Object, e As EventArgs) Handles LnkArbol.Click
|
||||
' PnlDatos.Visible = False
|
||||
' PnlArbol.Visible = True
|
||||
'End Sub
|
||||
|
||||
Protected Sub TV_SelectedNodeChanged(sender As Object, e As EventArgs) Handles TV.SelectedNodeChanged
|
||||
' Alert(TV.SelectedValue)
|
||||
CveProspectoSeleccionado = TV.SelectedValue.ToEntero
|
||||
RegistraScript("window.open('/Prospectos/CatProspectosDetalle.aspx?CveProspectoPadre=" & CveProspectoSeleccionado & "','_blank')")
|
||||
CargaDatos()
|
||||
|
||||
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
|
||||
Reference in New Issue
Block a user