Dashboard Indicadores
This commit is contained in:
55
General/Dashboard.aspx
Normal file
55
General/Dashboard.aspx
Normal file
@@ -0,0 +1,55 @@
|
||||
<%@ Page Title="" Language="VB" MasterPageFile="~/Site.master" AutoEventWireup="false" CodeFile="Dashboard.aspx.vb" Inherits="General_Dashboard" %>
|
||||
|
||||
<asp:Content ID="Content1" ContentPlaceHolderID="CP" Runat="Server">
|
||||
</asp:Content>
|
||||
<asp:Content ID="Content2" ContentPlaceHolderID="Css" Runat="Server">
|
||||
<style type="text/css">
|
||||
.dashboard-stat {
|
||||
padding: 15px;
|
||||
margin-bottom: 20px;
|
||||
border-radius: 4px;
|
||||
color: white;
|
||||
}
|
||||
.dashboard-stat .visual > i {
|
||||
font-size: 35px;
|
||||
opacity: 0.3;
|
||||
}
|
||||
.dashboard-stat .details {
|
||||
padding-right: 15px;
|
||||
}
|
||||
.blue { background: #3598dc; }
|
||||
.green { background: #32c5d2; }
|
||||
.purple { background: #8e44ad; }
|
||||
.red { background: #e7505a; }
|
||||
.indicador-valor { font-size: 24px; font-weight: bold; }
|
||||
.indicador-detalle { margin-top: 10px; }
|
||||
</style>
|
||||
</asp:Content>
|
||||
<asp:Content ID="Content3" ContentPlaceHolderID="E" Runat="Server">
|
||||
</asp:Content>
|
||||
<asp:Content ID="Content4" ContentPlaceHolderID="HB" Runat="Server">
|
||||
</asp:Content>
|
||||
<asp:Content ID="Content5" ContentPlaceHolderID="H" Runat="Server">
|
||||
</asp:Content>
|
||||
<asp:Content ID="Content6" ContentPlaceHolderID="HA" Runat="Server">
|
||||
</asp:Content>
|
||||
<asp:Content ID="Content7" ContentPlaceHolderID="C" Runat="Server">
|
||||
<asp:UpdatePanel ID="UPDashboard" runat="server">
|
||||
<ContentTemplate>
|
||||
<div class="row" id="DivIndicadores" runat="server">
|
||||
<!-- Aquí se generarán los indicadores -->
|
||||
</div>
|
||||
</ContentTemplate>
|
||||
</asp:UpdatePanel>
|
||||
</asp:Content>
|
||||
<asp:Content ID="Content8" ContentPlaceHolderID="JS" Runat="Server">
|
||||
<script type="text/javascript">
|
||||
function pageLoad() {
|
||||
$(document).ready(function(){
|
||||
// Inicializar tooltips
|
||||
$('.tooltips').tooltip();
|
||||
});
|
||||
}
|
||||
</script>
|
||||
</asp:Content>
|
||||
|
||||
101
General/Dashboard.aspx.vb
Normal file
101
General/Dashboard.aspx.vb
Normal file
@@ -0,0 +1,101 @@
|
||||
|
||||
Imports System.Data
|
||||
Imports Extensiones
|
||||
Imports System.Web.Services
|
||||
Imports Newtonsoft.Json
|
||||
Imports ADSNetLibrary.SIGAPI.Models.CRM.Request
|
||||
Imports ADSNetLibrary.SIGAPI.Services.CRM
|
||||
|
||||
Partial Class General_Dashboard
|
||||
Inherits ClsPaginas
|
||||
|
||||
Protected Sub Page_Load(sender As Object, e As EventArgs) Handles Me.Load
|
||||
If Not IsPostBack Then
|
||||
CargarIndicadores()
|
||||
End If
|
||||
End Sub
|
||||
|
||||
Private Sub CargarIndicadores()
|
||||
Dim Gral As New ClsGenerales
|
||||
Dim ds As DataSet = Gral.GetDashboardData(UsuarioActual.CveEmpresa)
|
||||
|
||||
If ds IsNot Nothing AndAlso ds.Tables.Count > 0 Then
|
||||
ProcesarDatosIndicadores(ds.Tables(0))
|
||||
End If
|
||||
End Sub
|
||||
|
||||
Private Sub ProcesarDatosIndicadores(dt As DataTable)
|
||||
If dt.Rows.Count > 0 Then
|
||||
Dim dr As DataRow = dt.Rows(0)
|
||||
|
||||
' Indicador Año
|
||||
MuestraIndicador(DivIndicadores, "blue", "fa fa-calendar", "Año Actual", dr("AcumAño").ToString.FormatoNumero(0), "#", "Acumulado",
|
||||
dr("AcumAñoPromedio").ToString.FormatoNumero(0), "#", "Promedio",
|
||||
dr("AcumAñoContado").ToString.FormatoNumero(0), "#", "Contado",
|
||||
dr("AcumAñoCredito").ToString.FormatoNumero(0), "#", "Crédito")
|
||||
|
||||
' Indicador Mes
|
||||
MuestraIndicador(DivIndicadores, "green", "fa fa-calendar-check-o", "Mes Actual",
|
||||
dr("AcumMes").ToString.FormatoNumero(0), "#", "Acumulado",
|
||||
dr("AcumMesPromedio").ToString.FormatoNumero(0), "#", "Promedio",
|
||||
dr("AcumMesContado").ToString.FormatoNumero(0), "#", "Contado",
|
||||
dr("AcumMesCredito").ToString.FormatoNumero(0), "#", "Crédito")
|
||||
|
||||
' Indicador Semana
|
||||
MuestraIndicador(DivIndicadores, "purple", "fa fa-calendar-minus-o", "Semana Actual",
|
||||
dr("AcumSemana").ToString.FormatoNumero(0), "#", "Acumulado",
|
||||
dr("AcumSemanaPromedio").ToString.FormatoNumero(0), "#", "Promedio",
|
||||
dr("AcumSemanaContado").ToString.FormatoNumero(0), "#", "Contado",
|
||||
dr("AcumSemanaCredito").ToString.FormatoNumero(0), "#", "Crédito")
|
||||
|
||||
|
||||
MuestraIndicador(DivIndicadores, "red", "fa fa-sun-o", "Hoy",
|
||||
"0".FormatoNumero(0), "#", "Acumulado",
|
||||
"0".FormatoNumero(0), "#", "Promedio",
|
||||
"0".FormatoNumero(0), "#", "Contado",
|
||||
"0".FormatoNumero(0), "#", "Crédito")
|
||||
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 class='col-lg-4 col-md-4 col-sm-6 col-xs-12'><div class='dashboard-stat {1}'><div class='visual'><i class='{2}' '=''></i></div>", DIV.InnerHtml, Color, Icono)
|
||||
htmldiv.AppendFormat("<div class='details'><div class='number'>{0}</div><div class='desc'><label class='indicadortipo1 tooltips' data-original-title='{1}'>{2}", Titulo, TitleComentario, Comentario)
|
||||
htmldiv.AppendFormat("</label></div></div><a class='more' href='{0}'>Ver Más <i class='m-icon-swapright m-icon-white'></i></a></div></div>", 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 class='col-lg-4 col-md-4 col-sm-6 col-xs-12'><div class='dashboard-stat {1}'><div class='visual'><i class='{2}' '=''></i></div>", DIV.InnerHtml, Color, Icono)
|
||||
htmldiv.AppendFormat("<div class='details'><div class='number'>{0}</div><div class='desc'>", Titulo)
|
||||
htmldiv.AppendFormat("<label class='indicadortipo2 col-md-6 tooltips' data-original-title='{0}'>{1}</label>", CT1, C1)
|
||||
htmldiv.AppendFormat("<label class='indicadortipo2 col-md-6 tooltips' data-original-title='{0}'>{1}</label>", CT2, C2)
|
||||
htmldiv.Append("</div></div><a class='more' href='javascript:;' data-toggle='dropdown' data-hover='dropdown' data-close-others='true' >Ver Más <i class='m-icon-swapright m-icon-white'></i></a>")
|
||||
htmldiv.AppendFormat("<ul class='dropdown-menu pull-right' style='margin:0px;' ><li><a href='{0}'>{1}</a></li><li><a href='{2}'>{3}</a></li>", CL1, CT1, CL2, CT2)
|
||||
htmldiv.Append("</ul></div></div>")
|
||||
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 class='col-lg-4 col-md-4 col-sm-6 col-xs-12'><div class='dashboard-stat {1}'><div class='visual'><i class='{2}' '=''></i></div>", DIV.InnerHtml, Color, Icono)
|
||||
htmldiv.AppendFormat("<div class='details'><div class='number'>{0}</div><div class='desc'><label class='indicadortipo4 col-md-6 tooltips' data-original-title=''></label>", Titulo)
|
||||
htmldiv.AppendFormat("<label class='indicadortipo4 col-md-6 tooltips' data-original-title='{0}'>{1}</label>", CT1, C1)
|
||||
htmldiv.AppendFormat("<label class='indicadortipo4 col-md-6 tooltips' data-original-title='{0}'>{1}</label>", CT2, C2)
|
||||
htmldiv.AppendFormat("<label class='indicadortipo4 col-md-6 tooltips' data-original-title='{0}'>{1}</label>", CT3, C3)
|
||||
htmldiv.Append("</div></div><a class='more' href='javascript:;' data-toggle='dropdown' data-hover='dropdown' data-close-others='true' >Ver Más <i class='m-icon-swapright m-icon-white'></i></a>")
|
||||
htmldiv.AppendFormat("<ul class='dropdown-menu pull-right' style='margin:0px;' ><li><a href='{0}'>{1}</a></li><li><a href='{2}'>{3}</a></li><li><a href='{4}'>{5}</a></li>", CL1, CT1, CL2, CT2, CL3, CT3)
|
||||
htmldiv.Append("</ul></div></div>")
|
||||
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 class='col-lg-4 col-md-4 col-sm-6 col-xs-12'><div class='dashboard-stat {1}'><div class='visual'><i class='{2}' '=''></i></div>", DIV.InnerHtml, Color, Icono)
|
||||
htmldiv.AppendFormat("<div class='details'><div class='number'>{0}</div><div class='desc'><label class='indicadortipo4 col-md-6 tooltips' data-original-title='{1}'>{2}</label>", Titulo, CT1, C1)
|
||||
htmldiv.AppendFormat("<label class='indicadortipo4 col-md-6 tooltips' data-original-title='{0}'>{1}</label>", CT2, C2)
|
||||
htmldiv.AppendFormat("<label class='indicadortipo4 col-md-6 tooltips' data-original-title='{0}'>{1}</label>", CT3, C3)
|
||||
htmldiv.AppendFormat("<label class='indicadortipo4 col-md-6 tooltips' data-original-title='{0}'>{1}</label>", CT4, C4)
|
||||
htmldiv.AppendFormat("</div></div><a class='more' href='{0}'>Ver Más <i class='m-icon-swapright m-icon-white'></i></a></div></div>", CL1)
|
||||
DIV.InnerHtml = htmldiv.ToString
|
||||
End Sub
|
||||
|
||||
End Class
|
||||
Reference in New Issue
Block a user