carga de trabajo del CRM 12/01/21

This commit is contained in:
Antonio Gonzalez
2021-01-16 14:58:43 -07:00
parent 3fdc55f766
commit ca9001af9e
6 changed files with 1672 additions and 651 deletions

View File

@@ -5,7 +5,8 @@
<asp:Content ID="Content2" ContentPlaceHolderID="Css" runat="Server">
<style>
.Filtros {
padding: 10px;background-color: #95A5A6;
padding: 10px;
background-color: #95A5A6;
}
.Filtros label, .Filtros .form-group.form-md-line-input .form-control ~ label {
@@ -39,7 +40,17 @@
<li>
<asp:LinkButton ID="LnkVerGrafica" OnClick="LnkVerGrafica_Click" runat="server" Text="<i class='fa fa-bar-chart' style='font-style:bold'></i> Gráfica"></asp:LinkButton>
</li>
<li>
<asp:LinkButton ID="LnkPDF" OnClick="LnkPDF_Click" runat="server" Text="<i class='fa fa-file-pdf-o' style='font-weight:bold;'></i> PDF" ></asp:LinkButton>
</li>
<li>
<asp:LinkButton ID="LnkExcel" OnClick="LnkExcel_Click" runat="server" Text="<i class='fa fa-file-excel-o' style='font-weight:bold;'></i> Excel" ></asp:LinkButton>
</li>
</ContentTemplate>
<Triggers>
<asp:PostBackTrigger ControlID="LnkPDF" />
<asp:PostBackTrigger ControlID="LnkExcel" />
</Triggers>
</asp:UpdatePanel>
</asp:Content>
<asp:Content ID="Content6" ContentPlaceHolderID="HA" runat="Server">
@@ -47,148 +58,54 @@
<asp:Content ID="Content7" ContentPlaceHolderID="C" runat="Server">
<asp:UpdatePanel ID="upDatosRepA" runat="server" UpdateMode="Conditional">
<ContentTemplate>
<%--<div class="Filtros portlet solid grey-cascade portlet-filter">
<div class="row">
<div class="col-md-2" style="width: 85%">
<div class="row">
<div class="col-sm-3" style="width: 25%">
<div class="form-group form-md-line-input input-iconright">
<asp:DropDownList ID="DdlTipoProceso" runat="server" DataTextField="TipoProceso" DataValueField="CveTipoProceso" CssClass="form-control input-sm select2me Widthall" OnSelectedIndexChanged="DdlTipoProceso_Change" AutoPostBack="true" Width="100%"></asp:DropDownList>
<asp:Label runat="server" Text="Proceso:" AssociatedControlID="DdlTipoProceso"></asp:Label>
</div>
</div>
<div class="col-sm-3" style="width: 25%">
<div class="form-group form-md-line-input input-iconright">
<asp:DropDownList ID="DdlVendedor" runat="server" DataTextField="Vendedor" DataValueField="CveVendedor" CssClass="form-control input-sm select2me Widthall" Width="100%"></asp:DropDownList>
<asp:Label runat="server" Text="Vendedor:" AssociatedControlID="DdlVendedor"></asp:Label>
</div>
</div>
<div class="col-sm-3" style="width: 25%">
<div class="form-group form-md-line-input input-iconright">
<asp:DropDownList ID="DdlMedioCaptacion" runat="server" DataTextField="MedioCaptacion" DataValueField="CveMedioCaptacion" CssClass="form-control input-sm select2me Widthall" Width="100%"></asp:DropDownList>
<asp:Label runat="server" Text="Medio de Captación:" AssociatedControlID="DdlMedioCaptacion"></asp:Label>
</div>
</div>
<div class="col-md-2" style="width: 25%">
<div class="form-group form-md-line-input input-iconright">
<asp:DropDownList ID="DdlProbabilidad" runat="server" DataTextField="ProbabilidadAcercamiento" DataValueField="CveProbabilidadAcercamiento" CssClass="form-control input-sm select2me Widthall" Width="100%"></asp:DropDownList>
<asp:Label runat="server" Text="Probabilidad:" AssociatedControlID="DdlProbabilidad"></asp:Label>
</div>
</div>
</div>
<div class="row">
<div class="col-md-2" style="padding-left: 15px; width: 25%">
<div class="form-group form-md-line-input input-iconright" style="width: 100%">
<asp:DropDownList ID="DdlGrupo1" runat="server" CssClass="form-control input-sm select2me Widthall" Width="100%">
<asp:ListItem Value="1" Text="Vendedor" Selected="true"></asp:ListItem>
<asp:ListItem Value="2" Text="Medio de Captación"></asp:ListItem>
<asp:ListItem Value="3" Text="Probabilidad de Acercamiento"></asp:ListItem>
<asp:ListItem Value="4" Text="Fecha"></asp:ListItem>
<asp:ListItem Value="5" Text="Sucursal"></asp:ListItem>
</asp:DropDownList>
<asp:Label runat="server" Text="Agrupado Por:" AssociatedControlID="DdlGrupo1"></asp:Label>
</div>
</div>
<div class="col-md-3" style="display: none; width: 25%">
<div class="form-group form-md-line-input input-iconright" style="width: 100%">
<asp:DropDownList ID="DdlGrupo2" runat="server" CssClass="form-control input-sm select2me Widthall" Style="width: 100%">
<asp:ListItem Value="-1" Text="Ninguno" Selected="True"></asp:ListItem>
<asp:ListItem Value="1" Text="Vendedor"></asp:ListItem>
<asp:ListItem Value="2" Text="Medio Captacion"></asp:ListItem>
<asp:ListItem Value="3" Text="Probabilidad de Acercamiento"></asp:ListItem>
<asp:ListItem Value="4" Text="Fecha"></asp:ListItem>
<asp:ListItem Value="5" Text="Sucursal"></asp:ListItem>
</asp:DropDownList>
<asp:Label runat="server" Text="Agrupado Por(2):" AssociatedControlID="DdlGrupo2"></asp:Label>
</div>
</div>
<div class="col-md-2" style="width: 25%">
<div class="">
<asp:Label runat="server" Text="Fecha Inicio:" AssociatedControlID="TxtFechaInicio"></asp:Label>
<div class="input-group input-sm input-small date date-picker " data-date-format="dd/mm/yyyy" style="width: 120px !important; padding: 0px; margin-bottom: -10px; padding-bottom: 10px;">
<asp:TextBox ID="TxtFechaInicio" runat="server" CssClass="form-control" CausesValidation="true" Width="98%" MaxLength="10"></asp:TextBox>
<span class="input-group-btn ">
<asp:LinkButton ID="imgFechaInicio" class="btn default " Text="<i class='fa fa-calendar'></i>" runat="server"></asp:LinkButton>
</span>
</div>
<ajax:MaskedEditExtender ID="MEEFechaSolicitudI" runat="server" TargetControlID="TxtFechaInicio" Mask="99/99/9999" MaskType="Date" DisplayMoney="Left" AcceptNegative="Left"></ajax:MaskedEditExtender>
<ajax:CalendarExtender runat="server" ID="CEFechaSolicitudI" TargetControlID="TxtFechaInicio" PopupButtonID="imgFechaInicio" PopupPosition="BottomRight" Enabled="True"></ajax:CalendarExtender>
</div>
</div>
<div class="col-md-2" style="width: 25%">
<div class="">
<asp:Label runat="server" Text="Fecha Fin:" AssociatedControlID="TxtFechaFin"></asp:Label>
<div class="input-group input-sm input-small date date-picker " data-date-format="dd/mm/yyyy" style="width: 120px !important; padding: 0px; margin-bottom: -10px; padding-bottom: 10px;">
<asp:TextBox ID="TxtFechaFin" runat="server" CssClass="form-control" CausesValidation="true" Width="98%" MaxLength="10"></asp:TextBox>
<span class="input-group-btn ">
<asp:LinkButton ID="imgFechaFin" class="btn default " Text="<i class='fa fa-calendar'></i>" runat="server"></asp:LinkButton>
</span>
</div>
<ajax:MaskedEditExtender ID="MEEFechaSolicitudF" runat="server" TargetControlID="TxtFechaFin" Mask="99/99/9999" MaskType="Date" DisplayMoney="Left" AcceptNegative="Left"></ajax:MaskedEditExtender>
<ajax:CalendarExtender runat="server" ID="CEFechaSolicitudF" TargetControlID="TxtFechaFin" PopupButtonID="imgFechaFin" PopupPosition="BottomRight" Enabled="True"></ajax:CalendarExtender>
</div>
</div>
</div>
<div class="portlet solid grey-cascade portlet-filter">
<div class="portlet-title portlet-filterT smalltitle">
<div class="tools">
<asp:Button ID="BtnConsultar" runat="server" Text="Consultar" OnClick="LnkConsultar_Click" class="btn btn-primary" ValidationGroup="Valida" />
<a href="javascript:;" class="expand"></a>
</div>
<div class="col-md-2" style="width: 138px">
<div class="col-sm-1 text-right" style="width: 138px">
<br />
<asp:LinkButton ID="LnkConsultar" OnClick="LnkConsultar_Click" runat="server" CssClass="btn btn-default">Consultar</asp:LinkButton>
<div class="titlefiltros caption">
<div class="row" style="margin-left: 10px;">
<asp:Label class="col-md-1 " style="width: 100px; margin-top: 5px;" runat="server" Text="Proceso:" AssociatedControlID="DdlTipoProceso"></asp:Label>
<div class="col-md-2">
<asp:DropDownList ID="DdlTipoProceso" runat="server" DataTextField="TipoProceso" DataValueField="CveTipoProceso" CssClass="form-control input-sm select2me Widthall"></asp:DropDownList>
</div>
<asp:Label class="col-md-1 " style="width: 90px; margin-top: 5px;" runat="server" Text="Vendedor:" AssociatedControlID="DdlVendedor"></asp:Label>
<div class="col-md-2">
<asp:DropDownList ID="DdlVendedor" runat="server" DataTextField="Vendedor" DataValueField="CveVendedor" CssClass="form-control input-sm select2me Widthall"></asp:DropDownList>
</div>
<asp:Label class="col-md-1 " style="width: 90px; margin-top: 5px;" runat="server" Text="Medio de Captación:" AssociatedControlID="DdlMedioCaptacion"></asp:Label>
<div class="col-md-2">
<asp:DropDownList ID="DdlMedioCaptacion" runat="server" DataTextField="MedioCaptacion" DataValueField="CveMedioCaptacion" CssClass="form-control input-sm select2me Widthall"></asp:DropDownList>
</div>
<asp:Label class="col-md-1 " style="width: 90px; margin-top: 5px;" runat="server" Text="Probabilidad:" AssociatedControlID="DdlProbabilidad"></asp:Label>
<div class="col-md-2">
<asp:DropDownList ID="DdlProbabilidad" runat="server" DataTextField="ProbabilidadAcercamiento" DataValueField="CveProbabilidadAcercamiento" CssClass="form-control input-sm select2me Widthall"></asp:DropDownList>
</div>
</div>
</div>
</div>
</div>--%>
<div class="Filtros">
<div class="row">
<div class="col-sm-3">
<div class="form-group form-md-line-input input-iconright">
<asp:DropDownList ID="DdlTipoProceso" runat="server" DataTextField="TipoProceso" DataValueField="CveTipoProceso" CssClass="form-control input-sm select2me Widthall"></asp:DropDownList>
<asp:Label runat="server" Text="Proceso:" AssociatedControlID="DdlTipoProceso"></asp:Label>
</div>
</div>
<div class="col-sm-3">
<div class="form-group form-md-line-input input-iconright">
<asp:DropDownList ID="DdlVendedor" runat="server" DataTextField="Vendedor" DataValueField="CveVendedor" CssClass="form-control input-sm select2me Widthall"></asp:DropDownList>
<asp:Label runat="server" Text="Vendedor:" AssociatedControlID="DdlVendedor"></asp:Label>
</div>
</div>
<div class="col-sm-3">
<div class="form-group form-md-line-input input-iconright">
<asp:DropDownList ID="DdlMedioCaptacion" runat="server" DataTextField="MedioCaptacion" DataValueField="CveMedioCaptacion" CssClass="form-control input-sm select2me Widthall"></asp:DropDownList>
<asp:Label runat="server" Text="Medio de Captación:" AssociatedControlID="DdlMedioCaptacion"></asp:Label>
</div>
</div>
<div class="col-md-2">
<div class="form-group form-md-line-input input-iconright">
<asp:DropDownList ID="DdlProbabilidad" runat="server" DataTextField="ProbabilidadAcercamiento" DataValueField="CveProbabilidadAcercamiento" CssClass="form-control input-sm select2me Widthall"></asp:DropDownList>
<asp:Label runat="server" Text="Probabilidad:" AssociatedControlID="DdlProbabilidad"></asp:Label>
</div>
</div>
<div class="col-sm-1 text-right">
<br />
<asp:LinkButton ID="LnkConsultar" OnClick="LnkConsultar_Click" runat="server" CssClass="btn btn-default">Consultar</asp:LinkButton>
</div>
</div>
<div class="row">
<div class="col-md-3">
<div class="form-group form-md-line-input input-iconright">
<asp:DropDownList ID="DdlGrupo1" runat="server" CssClass="form-control input-sm select2me Widthall">
<div class="portlet-body" style="display: none;">
<div class="row" style="margin-left: 10px; margin-top: 10px;">
<asp:Label class="col-md-1 " style="width: 100px; margin-top: 5px;" runat="server" Text="Agrupado Por:" AssociatedControlID="DdlGrupo1"></asp:Label>
<div class="col-md-2">
<asp:DropDownList ID="DdlGrupo1" runat="server" Width="100%" CssClass="form-control input-sm select2me Widthall">
<asp:ListItem Value="1" Text="Vendedor" Selected="true"></asp:ListItem>
<asp:ListItem Value="2" Text="Medio de Captación"></asp:ListItem>
<asp:ListItem Value="3" Text="Probabilidad de Acercamiento"></asp:ListItem>
<asp:ListItem Value="4" Text="Fecha"></asp:ListItem>
<asp:ListItem Value="5" Text="Sucursal"></asp:ListItem>
<asp:ListItem Value="6" Text="Giro"></asp:ListItem>
<asp:ListItem Value="7" Text="Producto Servicio"></asp:ListItem>
</asp:DropDownList>
<asp:Label runat="server" Text="Agrupado Por:" AssociatedControlID="DdlGrupo1"></asp:Label>
</div>
</div>
<div class="col-md-3" style="display:none;">
<div class="form-group form-md-line-input input-iconright">
<asp:DropDownList ID="DdlGrupo2" runat="server" CssClass="form-control input-sm select2me Widthall">
<asp:Label class="col-md-1 " style="width: 110px; margin-top: 5px;" runat="server" Text="Agrupado Por(2):" AssociatedControlID="DdlGrupo2"></asp:Label>
<div class="col-md-2">
<asp:DropDownList ID="DdlGrupo2" runat="server" Width="100%" CssClass="form-control input-sm select2me Widthall">
<asp:ListItem Value="-1" Text="Ninguno" Selected="True"></asp:ListItem>
<asp:ListItem Value="1" Text="Vendedor"></asp:ListItem>
<asp:ListItem Value="2" Text="Medio Captacion"></asp:ListItem>
@@ -196,13 +113,11 @@
<asp:ListItem Value="4" Text="Fecha"></asp:ListItem>
<asp:ListItem Value="5" Text="Sucursal"></asp:ListItem>
</asp:DropDownList>
<asp:Label runat="server" Text="Agrupado Por(2):" AssociatedControlID="DdlGrupo2"></asp:Label>
</div>
</div>
<div class="col-md-2">
<div class="">
<asp:Label runat="server" Text="Fecha Inicio:" AssociatedControlID="TxtFechaInicio"></asp:Label>
<div class="input-group input-sm input-small date date-picker " data-date-format="dd/mm/yyyy" style="width: 120px !important; padding: 0px; margin-bottom: -10px; padding-bottom: 10px;">
<asp:Label class="col-md-1 " style="width: 90px; margin-top: 5px;" runat="server" Text="Fecha Inicio:" AssociatedControlID="TxtFechaInicio"></asp:Label>
<div class="col-sm-1">
<div class="input-group input-sm input-small date date-picker " data-date-format="dd/mm/yyyy" style="width: 120px !important; padding: 0px; margin-top:5px">
<asp:TextBox ID="TxtFechaInicio" runat="server" CssClass="form-control" CausesValidation="true" Width="98%" MaxLength="10"></asp:TextBox>
<span class="input-group-btn ">
<asp:LinkButton ID="imgFechaInicio" class="btn default " Text="<i class='fa fa-calendar'></i>" runat="server"></asp:LinkButton>
@@ -211,11 +126,10 @@
<ajax:MaskedEditExtender ID="MEEFechaSolicitudI" runat="server" TargetControlID="TxtFechaInicio" Mask="99/99/9999" MaskType="Date" DisplayMoney="Left" AcceptNegative="Left"></ajax:MaskedEditExtender>
<ajax:CalendarExtender runat="server" ID="CEFechaSolicitudI" TargetControlID="TxtFechaInicio" PopupButtonID="imgFechaInicio" PopupPosition="BottomRight" Enabled="True"></ajax:CalendarExtender>
</div>
</div>
<div class="col-md-2">
<div class="">
<asp:Label runat="server" Text="Fecha Fin:" AssociatedControlID="TxtFechaFin"></asp:Label>
<div class="input-group input-sm input-small date date-picker " data-date-format="dd/mm/yyyy" style="width: 120px !important; padding: 0px; margin-bottom: -10px; padding-bottom: 10px;">
<asp:Label class="col-md-1 " style="width: 90px; margin-top: 5px;" runat="server" Text="Fecha Fin:" AssociatedControlID="TxtFechaFin"></asp:Label>
<div class="col-sm-1">
<div class="input-group input-sm input-small date date-picker " data-date-format="dd/mm/yyyy" style="width: 120px !important; padding: 0px; margin-top:5px">
<asp:TextBox ID="TxtFechaFin" runat="server" CssClass="form-control" CausesValidation="true" Width="98%" MaxLength="10"></asp:TextBox>
<span class="input-group-btn ">
<asp:LinkButton ID="imgFechaFin" class="btn default " Text="<i class='fa fa-calendar'></i>" runat="server"></asp:LinkButton>
@@ -224,10 +138,21 @@
<ajax:MaskedEditExtender ID="MEEFechaSolicitudF" runat="server" TargetControlID="TxtFechaFin" Mask="99/99/9999" MaskType="Date" DisplayMoney="Left" AcceptNegative="Left"></ajax:MaskedEditExtender>
<ajax:CalendarExtender runat="server" ID="CEFechaSolicitudF" TargetControlID="TxtFechaFin" PopupButtonID="imgFechaFin" PopupPosition="BottomRight" Enabled="True"></ajax:CalendarExtender>
</div>
</div>
<div class="row">
<asp:Label class="col-md-1 " style="width: 124px; margin-top: 5px;" runat="server" Text="Producto Servicio:" AssociatedControlID="DdlPS"></asp:Label>
<div class="col-md-2">
<ADS:Dropdownlost runat="server" ID="DdlPS" CssStyle="width:100%" CssClassDdl="form-control select2me" DataTextField="PSCodigo" DataValueField="CvePS" />
</div>
<asp:Label class="col-md-1 " style="width: 90px; margin-top: 5px;" runat="server" Text="Giro:" AssociatedControlID="DdlGiroClasificacion"></asp:Label>
<div class="col-md-2">
<asp:DropDownList ID="DdlGiroClasificacion" Width="100%" runat="server" DataValueField="CveClienteClasificacion" DataTextField="ClienteClasificacion" AppendDataBoundItems="true" CssClass="form-control select2me"></asp:DropDownList>
</div>
</div>
</div>
</div>
<asp:GridView ID="GVRepAcercamientosEtapas" runat="server" GridLines="None" CssClass="table table-hover table-striped ScrollAD Widthall GVRep" AutoGenerateColumns="False"
DataKeyNames="CveGrupo1,Grupo1,CveGrupo2,Grupo2" ShowHeaderWhenEmpty="true">
<Columns>
@@ -264,6 +189,7 @@
<asp:DropDownList ID="DdlGrafica" runat="server" AutoPostBack="true" OnSelectedIndexChanged="DdlGrafica_SelectedIndexChanged" AppendDataBoundItems="true" Class="table-group-action-input form-control input-inline input-small input-sm select2me">
<asp:ListItem Selected="True" Text="Barras" Value="1"></asp:ListItem>
<asp:ListItem Text="Pastel" Value="2"></asp:ListItem>
<asp:ListItem Text="Línea" Value="3"></asp:ListItem>
</asp:DropDownList>
</div>
</div>
@@ -345,6 +271,41 @@
});
}
function CargaGraficaLineas(data) {
var chart = AmCharts.makeChart("chartdiv", {
"type": "serial",
"theme": "light",
"dataProvider": data,
"startDuration": 2,
"valueAxes": [{
"position": "left",
"title": "Ventas"
}],
"graphs": [{
"balloonText": "[[category]]: <b>[[value]]</b>",
"type": "line",
"valueField": "Valor",
"bullet": "round",
}],
"depth3D": 20,
"angle": 30,
"chartCursor": {
"categoryBalloonEnabled": false,
"cursorAlpha": 0,
"zoomable": false
},
"categoryField": "Texto",
"categoryAxis": {
"gridPosition": "start",
"labelRotation": 90
},
"export": {
"enabled": true
}
});
}
</script>
</asp:Content>

View File

@@ -3,9 +3,12 @@ using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.IO;
using System.Web.UI.WebControls;
using System.Data;
using Extensiones;
using iTextSharp.text.pdf;
using iTextSharp.text;
public partial class CRM_RepAcercamientosProcesos : ClsPaginas
{
@@ -77,6 +80,11 @@ public partial class CRM_RepAcercamientosProcesos : ClsPaginas
DdlMedioCaptacion.DataSource = null;
DdlProbabilidad.DataSource = null;
DdlPS.setEsWebService(true);
DdlPS.SelectedValue = "-1";
DdlPS.SelectedText = "Seleccione";
if (ObjCRM.GetTipoProceso(UsuarioActual.CveEmpresa, 1))
{
DdlTipoProceso.DataSource = ObjCRM.DtResultados;
@@ -99,15 +107,20 @@ public partial class CRM_RepAcercamientosProcesos : ClsPaginas
DdlVendedor.DataBind();
DdlMedioCaptacion.DataBind();
DdlProbabilidad.DataBind();
DdlVendedor.Items.Insert(0, new ListItem("Seleccione ", "-1"));
DdlMedioCaptacion.Items.Insert(0, new ListItem("Seleccione ", "-1"));
DdlProbabilidad.Items.Insert(0, new ListItem("Seleccione ", "-1"));
DdlTipoProceso.Items.Insert(0, new ListItem("Seleccione", "-1"));
DdlVendedor.Items.Insert(0, new System.Web.UI.WebControls.ListItem("Seleccione ", "-1"));
DdlMedioCaptacion.Items.Insert(0, new System.Web.UI.WebControls.ListItem("Seleccione ", "-1"));
DdlProbabilidad.Items.Insert(0, new System.Web.UI.WebControls.ListItem("Seleccione ", "-1"));
DdlTipoProceso.Items.Insert(0, new System.Web.UI.WebControls.ListItem("Seleccione", "-1"));
DdlVendedor.SelectedValue = "-1";
DdlMedioCaptacion.SelectedValue = "-1";
DdlProbabilidad.SelectedValue = "-1";
DdlTipoProceso.SelectedIndex = 0;
DataTable dtGiroClasificaciones = get_GlobalDTClienteClasificaciones(UsuarioActual.CveEmpresa);
DdlGiroClasificacion.DataSource = dtGiroClasificaciones;
DdlGiroClasificacion.DataBind();
DdlGiroClasificacion.Items.Insert(0, new System.Web.UI.WebControls.ListItem("Seleccione", "-1"));
int n;
string CveProbabilidadAcercamiento = Request["CveProbabilidadAcercamiento"];
bool isNumeric = int.TryParse(CveProbabilidadAcercamiento, out n);
@@ -136,7 +149,7 @@ public partial class CRM_RepAcercamientosProcesos : ClsPaginas
ClsCRM ObjCRM = new ClsCRM();
GVRepAcercamientosEtapas.Columns.Clear();
if (ObjCRM.RepAcercamientosEtapas(UsuarioActual.CveEmpresa, cveTipoProceso, idgrupo1, idgrupo2, fechaIni, fechaFin, cveVendedor, cveMedioCaptacion, cveProbabilidadAcercamiento))
if (ObjCRM.RepAcercamientosEtapas(UsuarioActual.CveEmpresa, cveTipoProceso, idgrupo1, idgrupo2, fechaIni, fechaFin, cveVendedor, cveMedioCaptacion, cveProbabilidadAcercamiento,CvePS:DdlPS.SelectedValue.ToEntero(),CveGiroClasificacion:DdlGiroClasificacion.SelectedValue.ToEntero()))
{
DataTable dte = ObjCRM.DSResultados.Tables[1];
GVRepAcercamientosEtapas.DataSource = ObjCRM.DSResultados.Tables[0];
@@ -172,6 +185,14 @@ public partial class CRM_RepAcercamientosProcesos : ClsPaginas
Agrupador = "Fecha";
hypt.DataNavigateUrlFormatString = $"/CRM/RepAcercamientosProcesosDetalle.ASPX?CveTipoProceso={DdlGrupo1.SelectedValue}&CveGrupo1={{0}}&CveGrupo2={{1}}&FechaInicio={{2}}&FechaFin={{2}}{strfilstros}";
break;
case 6:
test.HeaderText = "Giro";
Agrupador = "Giro";
break;
case 7:
test.HeaderText = "Producto Servicio";
Agrupador = "Producto Servicio";
break;
}
GVRepAcercamientosEtapas.Columns.Add(test);
@@ -310,13 +331,17 @@ public partial class CRM_RepAcercamientosProcesos : ClsPaginas
int RowColorIndex = 0;
foreach (DataRow Dr in DtDatos.Rows)
{
DataRow Row = Dt.NewRow();
Row["Texto"] = $"{Dr["Grupo1"].ToString()}";
Row["Valor"] = Dr["TOTAL"].ToString().FormatoNumero();
Row["Color"] = DtColor.Rows[RowColorIndex]["Color"].ToString();
Dt.Rows.Add(Row);
RowColorIndex++;
if (RowColorIndex == 17) { RowColorIndex = 0; }
string Texto = Dr["Grupo1"].ToString();
if (Texto != "Total")
{
DataRow Row = Dt.NewRow();
Row["Texto"] = $"{Texto}";
Row["Valor"] = Dr["TOTAL"].ToString().FormatoNumero();
Row["Color"] = DtColor.Rows[RowColorIndex]["Color"].ToString();
Dt.Rows.Add(Row);
RowColorIndex++;
if (RowColorIndex == 17) { RowColorIndex = 0; }
}
}
var query = from s in Dt.AsEnumerable()
@@ -335,6 +360,9 @@ public partial class CRM_RepAcercamientosProcesos : ClsPaginas
case 2:
RegistraScript($"CargaGraficaPastel({json})", "22");
break;
case 3:
RegistraScript($"CargaGraficaLineas({json})", "22");
break;
}
UPModalProd.Update();
}
@@ -344,13 +372,209 @@ public partial class CRM_RepAcercamientosProcesos : ClsPaginas
DdlMedioCaptacion.Items.Clear();
DdlMedioCaptacion.DataSource = DtMedioCaptacion.FiltraParametros(String.Format("CveTipoProceso = {0}", DdlTipoProceso.SelectedValue.ToEntero()));
DdlMedioCaptacion.DataBind();
DdlMedioCaptacion.Items.Insert(0, new ListItem("Seleccione", "-1"));
DdlMedioCaptacion.Items.Insert(0, new System.Web.UI.WebControls.ListItem("Seleccione", "-1"));
DdlProbabilidad.Items.Clear();
DdlProbabilidad.DataSource = DtProbabilidadAcercamiento.FiltraParametros(String.Format("CveTipoProceso = {0}", DdlTipoProceso.SelectedValue.ToEntero()));
DdlProbabilidad.DataBind();
DdlProbabilidad.Items.Insert(0, new ListItem("Seleccione", "-1"));
DdlProbabilidad.Items.Insert(0, new System.Web.UI.WebControls.ListItem("Seleccione", "-1"));
upDatosRepA.Update();
}
protected void LnkPDF_Click(object sender, EventArgs e)
{
Document doc = new Document();
MemoryStream m = new MemoryStream();
PdfWriter Writer = PdfWriter.GetInstance(doc,m);
doc.Open();
PdfPTable header = this.crearHeader();
doc.Add(header);
Paragraph Filtros = this.filtrosDelReporte();
doc.Add(Filtros);
PdfPTable table = this.convertirReporteATabla();
doc.Add(table);
doc.Close();
Writer.Flush();
ImprimirbytesPDF(m.GetBuffer(), "Reporte de Procesos Acercamientos ", "PDF");
}
private PdfPTable crearHeader()
{
//Imagen de la empresa
iTextSharp.text.Image pic = iTextSharp.text.Image.GetInstance(String.Format("{0}/Logo.png", UsuarioActual.Empresa.Ruta));
pic.ScalePercent(20f);
BaseColor bordesBlancos = new BaseColor(255, 255, 255);
PdfPTable tableHeader = new PdfPTable(7);
tableHeader.WidthPercentage = 100f;
PdfPCell imageCell = new PdfPCell(pic);
imageCell.UseVariableBorders = true;
imageCell.BorderColor = bordesBlancos;
imageCell.Colspan = 2;
imageCell.Rowspan = 2;
tableHeader.AddCell(imageCell);
PdfPCell empresaCell = new PdfPCell(new Phrase(UsuarioActual.Empresa.Empresa));
empresaCell.UseVariableBorders = true;
empresaCell.BorderColor = bordesBlancos;
empresaCell.Colspan = 3;
empresaCell.HorizontalAlignment = Element.ALIGN_MIDDLE;
empresaCell.VerticalAlignment = Element.ALIGN_MIDDLE;
tableHeader.AddCell(empresaCell);
PdfPCell celdaVacia = new PdfPCell();
celdaVacia.UseVariableBorders = true;
celdaVacia.BorderColor = bordesBlancos;
tableHeader.AddCell(celdaVacia);
tableHeader.AddCell(celdaVacia);
PdfPCell reporteNombreCell = new PdfPCell(new Phrase("Reporte de Procesos Acercamientos "));
reporteNombreCell.UseVariableBorders = true;
reporteNombreCell.BorderColor = bordesBlancos;
reporteNombreCell.Colspan = 3;
reporteNombreCell.HorizontalAlignment = Element.ALIGN_MIDDLE;
reporteNombreCell.VerticalAlignment = Element.ALIGN_MIDDLE;
tableHeader.AddCell(reporteNombreCell);
tableHeader.AddCell(celdaVacia);
tableHeader.AddCell(celdaVacia);
return tableHeader;
}
private Paragraph filtrosDelReporte()
{
Font fontLabelFiltro = FontFactory.GetFont("Arial", 9f, Font.BOLD);
Font fontValueFiltro = FontFactory.GetFont("Arial", 9f, Font.NORMAL);
Chunk ProcesoChunk = new Chunk("Proceso: ", fontLabelFiltro);
Chunk VendedorChunk = new Chunk(" Vendedor: ", fontLabelFiltro);
Chunk MedioCaptacionChunk = new Chunk(" Medio de Captación: ", fontLabelFiltro);
Chunk ProbabilidadChunk = new Chunk(" Probabilidad: ", fontLabelFiltro);
Chunk AgrupadoPorChunk = new Chunk(" Agrupado Por: ", fontLabelFiltro);
Chunk AgrupadoPor2Chunk = new Chunk(" Agrupado Por(2): ", fontLabelFiltro);
Chunk FechaInicioChunk = new Chunk(" Fecha Inicio: ", fontLabelFiltro);
Chunk FechaFinChunk = new Chunk(" Fecha Fin: ", fontLabelFiltro);
Chunk ProductoServicioChunk = new Chunk(" Producto Servicio: ", fontLabelFiltro);
Chunk GiroChunk = new Chunk(" Giro: ", fontLabelFiltro);
//Proceso Phrase
Phrase ProcesoPhrase = new Phrase();
ProcesoPhrase.Add(ProcesoChunk);
ProcesoPhrase.Add(new Chunk((DdlTipoProceso.SelectedValue == "-1"?"Todos":DdlTipoProceso.SelectedItem.Text), fontValueFiltro));
//Vendedor Phrase
Phrase VendedorPhrase = new Phrase();
VendedorPhrase.Add(VendedorChunk);
VendedorPhrase.Add(new Chunk((DdlVendedor.SelectedValue == "-1" ? "Todos" : DdlVendedor.SelectedItem.Text), fontValueFiltro));
//Medio Captación Phrase
Phrase MedioCaptacionPhrase = new Phrase();
MedioCaptacionPhrase.Add(MedioCaptacionChunk);
MedioCaptacionPhrase.Add(new Chunk((DdlMedioCaptacion.SelectedValue == "-1" ? "Todos" : DdlMedioCaptacion.SelectedItem.Text), fontValueFiltro));
//Probabilidad Phrase
Phrase ProbabilidadPhrase = new Phrase();
ProbabilidadPhrase.Add(ProbabilidadChunk);
ProbabilidadPhrase.Add(new Chunk((DdlProbabilidad.SelectedValue == "-1" ? "Todos" : DdlProbabilidad.SelectedItem.Text), fontValueFiltro));
//Agrupado Por Phrase
Phrase AgrupadoPorPhrase = new Phrase();
AgrupadoPorPhrase.Add(AgrupadoPorChunk);
AgrupadoPorPhrase.Add(new Chunk((DdlGrupo1.SelectedValue == "-1" ? "Todos" : DdlGrupo1.SelectedItem.Text), fontValueFiltro));
//Agrupado Por(2) Phrase
Phrase AgrupadoPor2Phrase = new Phrase(AgrupadoPor2Chunk);
AgrupadoPor2Phrase.Add(AgrupadoPor2Chunk);
AgrupadoPor2Phrase.Add(new Chunk((DdlGrupo2.SelectedValue == "-1" ? "Todos" : DdlGrupo2.SelectedItem.Text), fontValueFiltro));
//Fecha Inicio Phrase
Phrase FechaInicioPhrase = new Phrase();
FechaInicioPhrase.Add(FechaInicioChunk);
FechaInicioPhrase.Add(new Chunk(TxtFechaInicio.Text, fontValueFiltro));
//Fecha Fin Phrase
Phrase FechaFinPhrase = new Phrase();
FechaFinPhrase.Add(FechaFinChunk);
FechaFinPhrase.Add(new Chunk(TxtFechaFin.Text, fontValueFiltro));
//Producto Servicio Phrase
Phrase ProductoServicioPhrase = new Phrase();
ProductoServicioPhrase.Add(ProductoServicioChunk);
ProductoServicioPhrase.Add(new Chunk((DdlPS.SelectedValue == "-1" ? "Todos" : DdlPS.SelectedText), fontValueFiltro));
//Giro Phrase
Phrase GiroPhrase = new Phrase();
GiroPhrase.Add(GiroChunk);
GiroPhrase.Add(new Chunk((DdlGiroClasificacion.SelectedValue == "-1" ? "Todos" : DdlGiroClasificacion.SelectedItem.Text), fontValueFiltro));
Paragraph Filtros = new Paragraph();
Filtros.Add(ProcesoPhrase);
Filtros.Add(VendedorPhrase);
Filtros.Add(MedioCaptacionPhrase);
Filtros.Add(ProbabilidadPhrase);
Filtros.Add(AgrupadoPorPhrase);
Filtros.Add(AgrupadoPor2Phrase);
Filtros.Add(FechaInicioPhrase);
Filtros.Add(FechaFinPhrase);
Filtros.Add(ProductoServicioPhrase);
Filtros.Add(GiroPhrase);
Filtros.Add("\n");
Filtros.Add("\n");
Filtros.Add("\n");
Filtros.Add("\n");
return Filtros;
}
private PdfPTable convertirReporteATabla()
{
int numeroDeColumnas = GVRepAcercamientosEtapas.Columns.Count;
PdfPTable table = new PdfPTable(numeroDeColumnas);
table.WidthPercentage = 100f;
BaseColor headerBackGroundColor = new BaseColor(240,240,240);
Font fuente = FontFactory.GetFont("Arial", 9f);
foreach(DataControlField columns in GVRepAcercamientosEtapas.Columns)
{
string header = columns.HeaderText;
PdfPCell headerCell = new PdfPCell(new Phrase(header, fuente));
headerCell.BackgroundColor = headerBackGroundColor;
table.AddCell(headerCell);
}
foreach (GridViewRow row in GVRepAcercamientosEtapas.Rows)
{
foreach (TableCell celda in row.Cells)
{
if (celda.Controls.Count > 0)
{
HyperLink control = (HyperLink)celda.Controls[0];
table.AddCell(new Phrase(control.Text,fuente));
}else
{
table.AddCell(new Phrase(celda.Text,fuente));
}
}
}
return table;
}
protected void LnkExcel_Click(object sender, EventArgs e)
{
GVRepAcercamientosEtapas.ExportToExcelGembox("Reporte de Rechazos de Acercamiento", UsuarioActual, "", "", "Reporte de Rechazos de Acercamiento", "", -1);
}
public override void VerifyRenderingInServerForm(Control control)
{
}
}

View File

@@ -35,7 +35,17 @@
<li>
<asp:LinkButton ID="LnkVerGrafica" OnClick="LnkVerGrafica_Click" runat="server" Text="<i class='fa fa-bar-chart' style='font-style:bold'></i> Gráfica"></asp:LinkButton>
</li>
<li>
<asp:LinkButton ID="LnkPDF" OnClick="LnkPDF_Click" runat="server" Text="<i class='fa fa-file-pdf-o' style='font-weight:bold;'></i> PDF" ></asp:LinkButton>
</li>
<li>
<asp:LinkButton ID="LnkExcel" OnClick="LnkExcel_Click" runat="server" Text="<i class='fa fa-file-excel-o' style='font-weight:bold;'></i> Excel" ></asp:LinkButton>
</li>
</ContentTemplate>
<Triggers>
<asp:PostBackTrigger ControlID="LnkPDF" />
<asp:PostBackTrigger ControlID="LnkExcel" />
</Triggers>
</asp:UpdatePanel>
</asp:Content>
<asp:Content ID="Content5" ContentPlaceHolderID="H" runat="Server">
@@ -45,54 +55,54 @@
<asp:Content ID="Content7" ContentPlaceHolderID="C" runat="Server">
<asp:UpdatePanel ID="upDatosRepA" runat="server" UpdateMode="Conditional">
<ContentTemplate>
<div class="Filtros">
<div class="row">
<div class="col-sm-3">
<div class="form-group form-md-line-input input-iconright">
<asp:DropDownList ID="DdlTipoProceso" runat="server" DataTextField="TipoProceso" DataValueField="CveTipoProceso" CssClass="form-control input-sm select2me Widthall"></asp:DropDownList>
<asp:Label runat="server" Text="Proceso:" AssociatedControlID="DdlTipoProceso"></asp:Label>
<div class="portlet solid grey-cascade portlet-filter">
<div class="portlet-title portlet-filterT smalltitle">
<div class="tools">
<asp:Button ID="BtnConsultar" runat="server" Text="Consultar" OnClick="LnkConsultar_Click" class="btn btn-primary" ValidationGroup="Valida" />
<a href="javascript:;" class="expand"></a>
</div>
<div class="titlefiltros caption">
<div class="row" style="margin-left: 10px;">
<asp:Label class="col-md-1 " style="width: 100px; margin-top: 5px;" runat="server" Text="Proceso:" AssociatedControlID="DdlTipoProceso"></asp:Label>
<div class="col-md-2">
<asp:DropDownList ID="DdlTipoProceso" runat="server" DataTextField="TipoProceso" DataValueField="CveTipoProceso" CssClass="form-control input-sm select2me Widthall"></asp:DropDownList>
</div>
<asp:Label class="col-md-1 " style="width: 100px; margin-top: 5px;" runat="server" Text="Vendedor:" AssociatedControlID="DdlVendedor"></asp:Label>
<div class="col-md-2">
<asp:DropDownList ID="DdlVendedor" runat="server" DataTextField="Vendedor" DataValueField="CveVendedor" CssClass="form-control input-sm select2me Widthall"></asp:DropDownList>
</div>
<asp:Label class="col-md-1 " style="width: 100px; margin-top: 5px;" runat="server" Text="Medio de Captación:" AssociatedControlID="DdlMedioCaptacion"></asp:Label>
<div class="col-md-2">
<asp:DropDownList ID="DdlMedioCaptacion" runat="server" DataTextField="MedioCaptacion" DataValueField="CveMedioCaptacion" CssClass="form-control input-sm select2me Widthall"></asp:DropDownList>
</div>
<asp:Label class="col-md-1 " style="width: 100px; margin-top: 5px;" runat="server" Text="Probabilidad:" AssociatedControlID="DdlProbabilidad"></asp:Label>
<div class="col-md-2">
<asp:DropDownList ID="DdlProbabilidad" runat="server" DataTextField="ProbabilidadAcercamiento" DataValueField="CveProbabilidadAcercamiento" CssClass="form-control input-sm select2me Widthall"></asp:DropDownList>
</div>
</div>
</div>
<div class="col-sm-3">
<div class="form-group form-md-line-input input-iconright">
<asp:DropDownList ID="DdlVendedor" runat="server" DataTextField="Vendedor" DataValueField="CveVendedor" CssClass="form-control input-sm select2me Widthall"></asp:DropDownList>
<asp:Label runat="server" Text="Vendedor:" AssociatedControlID="DdlVendedor"></asp:Label>
</div>
</div>
<div class="col-sm-3">
<div class="form-group form-md-line-input input-iconright">
<asp:DropDownList ID="DdlMedioCaptacion" runat="server" DataTextField="MedioCaptacion" DataValueField="CveMedioCaptacion" CssClass="form-control input-sm select2me Widthall"></asp:DropDownList>
<asp:Label runat="server" Text="Medio de Captación:" AssociatedControlID="DdlMedioCaptacion"></asp:Label>
</div>
</div>
<div class="col-md-2">
<div class="form-group form-md-line-input input-iconright">
<asp:DropDownList ID="DdlProbabilidad" runat="server" DataTextField="ProbabilidadAcercamiento" DataValueField="CveProbabilidadAcercamiento" CssClass="form-control input-sm select2me Widthall"></asp:DropDownList>
<asp:Label runat="server" Text="Probabilidad:" AssociatedControlID="DdlProbabilidad"></asp:Label>
</div>
</div>
<div class="col-sm-1 text-right">
<br />
<asp:LinkButton ID="LnkConsultar" OnClick="LnkConsultar_Click" runat="server" CssClass="btn btn-default">Consultar</asp:LinkButton>
</div>
</div>
<div class="row">
<div class="col-md-3">
<div class="form-group form-md-line-input input-iconright">
<asp:DropDownList ID="DdlGrupo1" runat="server" CssClass="form-control input-sm select2me Widthall">
</div>
<div class="portlet-body" style="display: none;">
<div class="row" style="margin-left: 10px; margin-top: 10px;">
<asp:Label class="col-md-1 " style="width: 100px; margin-top: 5px;" runat="server" Text="Agrupado Por:" AssociatedControlID="DdlGrupo1"></asp:Label>
<div class="col-md-2">
<asp:DropDownList ID="DdlGrupo1" runat="server" Width="100%" CssClass="form-control input-sm select2me Widthall">
<asp:ListItem Value="1" Text="Vendedor" Selected="true"></asp:ListItem>
<asp:ListItem Value="2" Text="Medio de Captación"></asp:ListItem>
<asp:ListItem Value="3" Text="Probabilidad de Acercamiento"></asp:ListItem>
<asp:ListItem Value="4" Text="Fecha"></asp:ListItem>
<asp:ListItem Value="5" Text="Sucursal"></asp:ListItem>
<asp:ListItem Value="6" Text="Giro"></asp:ListItem>
<asp:ListItem Value="7" Text="Producto Servicio"></asp:ListItem>
</asp:DropDownList>
<asp:Label runat="server" Text="Agrupado Por:" AssociatedControlID="DdlGrupo1"></asp:Label>
</div>
</div>
<div class="col-md-3" style="display:none;">
<div class="form-group form-md-line-input input-iconright">
<asp:DropDownList ID="DdlGrupo2" runat="server" CssClass="form-control input-sm select2me Widthall">
<asp:Label class="col-md-1 " style="width: 110px; margin-top: 5px;" runat="server" Text="Agrupado Por(2):" AssociatedControlID="DdlGrupo2"></asp:Label>
<div class="col-md-2">
<asp:DropDownList ID="DdlGrupo2" runat="server" Width="100%" CssClass="form-control input-sm select2me Widthall">
<asp:ListItem Value="-1" Text="Ninguno" Selected="True"></asp:ListItem>
<asp:ListItem Value="1" Text="Vendedor"></asp:ListItem>
<asp:ListItem Value="2" Text="Medio Captacion"></asp:ListItem>
@@ -100,13 +110,11 @@
<asp:ListItem Value="4" Text="Fecha"></asp:ListItem>
<asp:ListItem Value="5" Text="Sucursal"></asp:ListItem>
</asp:DropDownList>
<asp:Label runat="server" Text="Agrupado Por(2):" AssociatedControlID="DdlGrupo2"></asp:Label>
</div>
</div>
<div class="col-md-2">
<div class="">
<asp:Label runat="server" Text="Fecha Inicio:" AssociatedControlID="TxtFechaInicio"></asp:Label>
<div class="input-group input-sm input-small date date-picker " data-date-format="dd/mm/yyyy" style="width: 120px !important; padding: 0px; margin-bottom: -10px; padding-bottom: 10px;">
<asp:Label class="col-md-1 " style="width: 100px; margin-top: 5px;" runat="server" Text="Fecha Inicio:" AssociatedControlID="TxtFechaInicio"></asp:Label>
<div class="col-md-2">
<div class="input-group input-sm input-small date date-picker " data-date-format="dd/mm/yyyy" style="width: 120px !important; padding: 0px; margin-top: 5px;">
<asp:TextBox ID="TxtFechaInicio" runat="server" CssClass="form-control" CausesValidation="true" Width="98%" MaxLength="10"></asp:TextBox>
<span class="input-group-btn ">
<asp:LinkButton ID="imgFechaInicio" class="btn default " Text="<i class='fa fa-calendar'></i>" runat="server"></asp:LinkButton>
@@ -115,11 +123,10 @@
<ajax:MaskedEditExtender ID="MEEFechaSolicitudI" runat="server" TargetControlID="TxtFechaInicio" Mask="99/99/9999" MaskType="Date" DisplayMoney="Left" AcceptNegative="Left"></ajax:MaskedEditExtender>
<ajax:CalendarExtender runat="server" ID="CEFechaSolicitudI" TargetControlID="TxtFechaInicio" PopupButtonID="imgFechaInicio" PopupPosition="BottomRight" Enabled="True"></ajax:CalendarExtender>
</div>
</div>
<div class="col-md-2">
<div class="">
<asp:Label runat="server" Text="Fecha Fin:" AssociatedControlID="TxtFechaFin"></asp:Label>
<div class="input-group input-sm input-small date date-picker " data-date-format="dd/mm/yyyy" style="width: 120px !important; padding: 0px; margin-bottom: -10px; padding-bottom: 10px;">
<asp:Label class="col-md-1 " style="width: 100px; margin-top: 5px;" runat="server" Text="Fecha Fin:" AssociatedControlID="TxtFechaFin"></asp:Label>
<div class="col-md-2">
<div class="input-group input-sm input-small date date-picker " data-date-format="dd/mm/yyyy" style="width: 120px !important; padding: 0px; margin-top: 5px;">
<asp:TextBox ID="TxtFechaFin" runat="server" CssClass="form-control" CausesValidation="true" Width="98%" MaxLength="10"></asp:TextBox>
<span class="input-group-btn ">
<asp:LinkButton ID="imgFechaFin" class="btn default " Text="<i class='fa fa-calendar'></i>" runat="server"></asp:LinkButton>
@@ -128,10 +135,87 @@
<ajax:MaskedEditExtender ID="MEEFechaSolicitudF" runat="server" TargetControlID="TxtFechaFin" Mask="99/99/9999" MaskType="Date" DisplayMoney="Left" AcceptNegative="Left"></ajax:MaskedEditExtender>
<ajax:CalendarExtender runat="server" ID="CEFechaSolicitudF" TargetControlID="TxtFechaFin" PopupButtonID="imgFechaFin" PopupPosition="BottomRight" Enabled="True"></ajax:CalendarExtender>
</div>
</div>
<div class="row">
<asp:Label class="col-md-1 " style="width: 124px; margin-top: 5px;" runat="server" Text="Producto Servicio:" AssociatedControlID="DdlPS"></asp:Label>
<div class="col-md-2">
<ADS:Dropdownlost runat="server" ID="DdlPS" CssStyle="width:100%" CssClassDdl="form-control select2me" DataTextField="PSCodigo" DataValueField="CvePS" />
</div>
<asp:Label class="col-md-1 " style="width: 100px; margin-top: 5px;" runat="server" Text="Giro:" AssociatedControlID="DdlGiroClasificacion"></asp:Label>
<div class="col-md-2">
<asp:DropDownList ID="DdlGiroClasificacion" runat="server" DataValueField="CveClienteClasificacion" DataTextField="ClienteClasificacion" AppendDataBoundItems="true" CssClass="form-control select2me"></asp:DropDownList>
</div>
</div>
</div>
</div>
<%--<div class="Filtros">
<div class="row">
<div class="col-sm-3">
<div class="form-group form-md-line-input input-iconright">
</div>
</div>
<div class="col-sm-3">
<div class="form-group form-md-line-input input-iconright">
</div>
</div>
<div class="col-sm-3">
<div class="form-group form-md-line-input input-iconright">
</div>
</div>
<div class="col-md-2">
<div class="form-group form-md-line-input input-iconright">
</div>
</div>
<div class="col-sm-1 text-right">
<br />
</div>
</div>
<div class="row">
<div class="col-md-3">
<div class="form-group form-md-line-input input-iconright">
</div>
</div>
<div class="col-md-3" style="display:none;">
<div class="form-group form-md-line-input input-iconright">
</div>
</div>
<div class="col-md-2">
<div class="">
</div>
</div>
<div class="col-md-2">
<div class="">
</div>
</div>
</div>
<div class="row">
<div class="col-md-3">
</div>
<div class="col-md-3">
</div>
</div>
</div>--%>
<asp:GridView ID="GVRepAcercamientosEtapas" runat="server" GridLines="None" CssClass="table table-hover table-striped ScrollAD Widthall GVRep" AutoGenerateColumns="False"
DataKeyNames="CveGrupo1,Grupo1,CveGrupo2,Grupo2" ShowHeaderWhenEmpty="true">
@@ -169,6 +253,7 @@
<asp:DropDownList ID="DdlGrafica" runat="server" AutoPostBack="true" OnSelectedIndexChanged="DdlGrafica_SelectedIndexChanged" AppendDataBoundItems="true" Class="table-group-action-input form-control input-inline input-small input-sm select2me">
<asp:ListItem Selected="True" Text="Barras" Value="1"></asp:ListItem>
<asp:ListItem Text="Pastel" Value="2"></asp:ListItem>
<asp:ListItem Text="Línea" Value="3"></asp:ListItem>
</asp:DropDownList>
</div>
</div>
@@ -249,6 +334,41 @@
});
}
function CargaGraficaLineas(data) {
var chart = AmCharts.makeChart("chartdiv", {
"type": "serial",
"theme": "light",
"dataProvider": data,
"startDuration": 2,
"valueAxes": [{
"position": "left",
"title": "Ventas"
}],
"graphs": [{
"balloonText": "[[category]]: <b>[[value]]</b>",
"type": "line",
"valueField": "Valor",
"bullet": "round",
}],
"depth3D": 20,
"angle": 30,
"chartCursor": {
"categoryBalloonEnabled": false,
"cursorAlpha": 0,
"zoomable": false
},
"categoryField": "Texto",
"categoryAxis": {
"gridPosition": "start",
"labelRotation": 90
},
"export": {
"enabled": true
}
});
}
</script>
</asp:Content>

View File

@@ -6,6 +6,9 @@ using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using Extensiones;
using iTextSharp.text.pdf;
using iTextSharp.text;
using System.IO;
public partial class CRM_RepAcercamientosRechazos : ClsPaginas
{
@@ -77,6 +80,15 @@ public partial class CRM_RepAcercamientosRechazos : ClsPaginas
DdlMedioCaptacion.DataSource = null;
DdlProbabilidad.DataSource = null;
DdlPS.setEsWebService(true);
DdlPS.SelectedValue = "-1";
DdlPS.SelectedText = "Seleccione";
DataTable dtGiroClasificaciones = get_GlobalDTClienteClasificaciones(UsuarioActual.CveEmpresa);
DdlGiroClasificacion.DataSource = dtGiroClasificaciones;
DdlGiroClasificacion.DataBind();
DdlGiroClasificacion.Items.Insert(0, new System.Web.UI.WebControls.ListItem("Seleccione", "-1"));
if (ObjCRM.GetTipoProceso(UsuarioActual.CveEmpresa, 1))
{
DdlTipoProceso.DataSource = ObjCRM.DtResultados;
@@ -98,15 +110,16 @@ public partial class CRM_RepAcercamientosRechazos : ClsPaginas
DdlVendedor.DataBind();
DdlMedioCaptacion.DataBind();
DdlProbabilidad.DataBind();
DdlVendedor.Items.Insert(0, new ListItem("Seleccione ", "-1"));
DdlMedioCaptacion.Items.Insert(0, new ListItem("Seleccione ", "-1"));
DdlProbabilidad.Items.Insert(0, new ListItem("Seleccione ", "-1"));
DdlVendedor.Items.Insert(0, new System.Web.UI.WebControls.ListItem("Seleccione ", "-1"));
DdlMedioCaptacion.Items.Insert(0, new System.Web.UI.WebControls.ListItem("Seleccione ", "-1"));
DdlProbabilidad.Items.Insert(0, new System.Web.UI.WebControls.ListItem("Seleccione ", "-1"));
DdlVendedor.SelectedValue = "-1";
DdlMedioCaptacion.SelectedValue = "-1";
DdlProbabilidad.SelectedValue = "-1";
DdlTipoProceso.SelectedIndex = 0;
upDatosRepA.Update();
}
protected void cargarDatos()
{
int cveTipoProceso = DdlTipoProceso.SelectedValue.ToEntero();
@@ -120,7 +133,7 @@ public partial class CRM_RepAcercamientosRechazos : ClsPaginas
ClsCRM ObjCRM = new ClsCRM();
GVRepAcercamientosEtapas.Columns.Clear();
if (ObjCRM.RepAcercamientosRechazos(UsuarioActual.CveEmpresa, cveTipoProceso, idgrupo1, idgrupo2, fechaIni, fechaFin, cveVendedor, cveMedioCaptacion, cveProbabilidadAcercamiento))
if (ObjCRM.RepAcercamientosRechazos(UsuarioActual.CveEmpresa, cveTipoProceso, idgrupo1, idgrupo2, fechaIni, fechaFin, cveVendedor, cveMedioCaptacion, cveProbabilidadAcercamiento, CvePS:DdlPS.SelectedValue.ToEntero(), CveGiroClasificacion:DdlGiroClasificacion.SelectedValue.ToEntero()))
{
DataTable dte = ObjCRM.DSResultados.Tables[1];
GVRepAcercamientosEtapas.DataSource = ObjCRM.DSResultados.Tables[0];
@@ -299,13 +312,17 @@ public partial class CRM_RepAcercamientosRechazos : ClsPaginas
int RowColorIndex = 0;
foreach (DataRow Dr in DtDatos.Rows)
{
DataRow Row = Dt.NewRow();
Row["Texto"] = $"{Dr["Grupo1"].ToString()}";
Row["Valor"] = Dr["TOTAL"].ToString().FormatoNumero();
Row["Color"] = DtColor.Rows[RowColorIndex]["Color"].ToString();
Dt.Rows.Add(Row);
RowColorIndex++;
if (RowColorIndex == 17) { RowColorIndex = 0; }
string Texto = Dr["Grupo1"].ToString();
if (Texto != "Total")
{
DataRow Row = Dt.NewRow();
Row["Texto"] = $"{Texto}";
Row["Valor"] = Dr["TOTAL"].ToString().FormatoNumero();
Row["Color"] = DtColor.Rows[RowColorIndex]["Color"].ToString();
Dt.Rows.Add(Row);
RowColorIndex++;
if (RowColorIndex == 17) { RowColorIndex = 0; }
}
}
var query = from s in Dt.AsEnumerable()
@@ -324,6 +341,9 @@ public partial class CRM_RepAcercamientosRechazos : ClsPaginas
case 2:
RegistraScript($"CargaGraficaPastel({json})", "22");
break;
case 3:
RegistraScript($"CargaGraficaLineas({json})", "22");
break;
}
UPModalProd.Update();
}
@@ -333,13 +353,210 @@ public partial class CRM_RepAcercamientosRechazos : ClsPaginas
DdlMedioCaptacion.Items.Clear();
DdlMedioCaptacion.DataSource = DtMedioCaptacion.FiltraParametros(String.Format("CveTipoProceso = {0}", DdlTipoProceso.SelectedValue.ToEntero()));
DdlMedioCaptacion.DataBind();
DdlMedioCaptacion.Items.Insert(0, new ListItem("Seleccione", "-1"));
DdlMedioCaptacion.Items.Insert(0, new System.Web.UI.WebControls.ListItem("Seleccione", "-1"));
DdlProbabilidad.Items.Clear();
DdlProbabilidad.DataSource = DtProbabilidadAcercamiento.FiltraParametros(String.Format("CveTipoProceso = {0}", DdlTipoProceso.SelectedValue.ToEntero()));
DdlProbabilidad.DataBind();
DdlProbabilidad.Items.Insert(0, new ListItem("Seleccione", "-1"));
DdlProbabilidad.Items.Insert(0, new System.Web.UI.WebControls.ListItem("Seleccione", "-1"));
upDatosRepA.Update();
}
protected void LnkPDF_Click(object sender, EventArgs e)
{
Document doc = new Document();
MemoryStream m = new MemoryStream();
PdfWriter Writer = PdfWriter.GetInstance(doc, m);
doc.Open();
PdfPTable header = this.crearHeader();
doc.Add(header);
Paragraph filtros = this.filtrosDelReporte();
doc.Add(filtros);
PdfPTable table = this.convertirReporteATabla();
doc.Add(table);
doc.Close();
Writer.Flush();
ImprimirbytesPDF(m.GetBuffer(), "Reporte de Rechazos Acercamientos", "PDF");
}
private PdfPTable crearHeader()
{
//Imagen de la empresa
iTextSharp.text.Image pic = iTextSharp.text.Image.GetInstance(String.Format("{0}/Logo.png", UsuarioActual.Empresa.Ruta));
pic.ScalePercent(20f);
BaseColor bordesBlancos = new BaseColor(255, 255, 255);
PdfPTable tableHeader = new PdfPTable(7);
tableHeader.WidthPercentage = 100f;
PdfPCell imageCell = new PdfPCell(pic);
imageCell.UseVariableBorders = true;
imageCell.BorderColor = bordesBlancos;
imageCell.Colspan = 2;
imageCell.Rowspan = 2;
tableHeader.AddCell(imageCell);
PdfPCell empresaCell = new PdfPCell(new Phrase(UsuarioActual.Empresa.Empresa));
empresaCell.UseVariableBorders = true;
empresaCell.BorderColor = bordesBlancos;
empresaCell.Colspan = 3;
empresaCell.HorizontalAlignment = Element.ALIGN_MIDDLE;
empresaCell.VerticalAlignment = Element.ALIGN_MIDDLE;
tableHeader.AddCell(empresaCell);
PdfPCell celdaVacia = new PdfPCell();
celdaVacia.UseVariableBorders = true;
celdaVacia.BorderColor = bordesBlancos;
tableHeader.AddCell(celdaVacia);
tableHeader.AddCell(celdaVacia);
PdfPCell reporteNombreCell = new PdfPCell(new Phrase("Reporte de Rechazos Acercamientos"));
reporteNombreCell.UseVariableBorders = true;
reporteNombreCell.BorderColor = bordesBlancos;
reporteNombreCell.Colspan = 3;
reporteNombreCell.HorizontalAlignment = Element.ALIGN_MIDDLE;
reporteNombreCell.VerticalAlignment = Element.ALIGN_MIDDLE;
tableHeader.AddCell(reporteNombreCell);
tableHeader.AddCell(celdaVacia);
tableHeader.AddCell(celdaVacia);
return tableHeader;
}
private Paragraph filtrosDelReporte()
{
Font fontLabelFiltro = FontFactory.GetFont("Arial", 9f, Font.BOLD);
Font fontValueFiltro = FontFactory.GetFont("Arial", 9f, Font.NORMAL);
Chunk ProcesoChunk = new Chunk("Proceso: ", fontLabelFiltro);
Chunk VendedorChunk = new Chunk(" Vendedor: ", fontLabelFiltro);
Chunk MedioCaptacionChunk = new Chunk(" Medio de Captación: ", fontLabelFiltro);
Chunk ProbabilidadChunk = new Chunk(" Probabilidad: ", fontLabelFiltro);
Chunk AgrupadoPorChunk = new Chunk(" Agrupado Por: ", fontLabelFiltro);
//Chunk AgrupadoPor2Chunk = new Chunk(" Agrupado Por(2): ", fontLabelFiltro);
Chunk FechaInicioChunk = new Chunk(" Fecha Inicio: ", fontLabelFiltro);
Chunk FechaFinChunk = new Chunk(" Fecha Fin: ", fontLabelFiltro);
Chunk ProductoServicioChunk = new Chunk(" Producto Servicio: ", fontLabelFiltro);
Chunk GiroChunk = new Chunk(" Giro: ", fontLabelFiltro);
//Proceso Phrase
Phrase ProcesoPhrase = new Phrase();
ProcesoPhrase.Add(ProcesoChunk);
ProcesoPhrase.Add(new Chunk((DdlTipoProceso.SelectedValue == "-1" ? "Todos" : DdlTipoProceso.SelectedItem.Text), fontValueFiltro));
//Vendedor Phrase
Phrase VendedorPhrase = new Phrase();
VendedorPhrase.Add(VendedorChunk);
VendedorPhrase.Add(new Chunk((DdlVendedor.SelectedValue == "-1" ? "Todos" : DdlVendedor.SelectedItem.Text), fontValueFiltro));
//Medio Captación Phrase
Phrase MedioCaptacionPhrase = new Phrase();
MedioCaptacionPhrase.Add(MedioCaptacionChunk);
MedioCaptacionPhrase.Add(new Chunk((DdlMedioCaptacion.SelectedValue == "-1" ? "Todos" : DdlMedioCaptacion.SelectedItem.Text), fontValueFiltro));
//Probabilidad Phrase
Phrase ProbabilidadPhrase = new Phrase();
ProbabilidadPhrase.Add(ProbabilidadChunk);
ProbabilidadPhrase.Add(new Chunk((DdlProbabilidad.SelectedValue == "-1" ? "Todos" : DdlProbabilidad.SelectedItem.Text), fontValueFiltro));
//Agrupado Por Phrase
Phrase AgrupadoPorPhrase = new Phrase();
AgrupadoPorPhrase.Add(AgrupadoPorChunk);
AgrupadoPorPhrase.Add(new Chunk((DdlGrupo1.SelectedValue == "-1" ? "Todos" : DdlGrupo1.SelectedItem.Text), fontValueFiltro));
//Agrupado Por(2) Phrase
//Phrase AgrupadoPor2Phrase = new Phrase(AgrupadoPor2Chunk);
//AgrupadoPor2Phrase.Add(AgrupadoPor2Chunk);
//AgrupadoPor2Phrase.Add(new Chunk((DdlGrupo2.SelectedValue == "-1" ? "Todos" : DdlGrupo2.SelectedItem.Text), fontValueFiltro));
//Fecha Inicio Phrase
Phrase FechaInicioPhrase = new Phrase();
FechaInicioPhrase.Add(FechaInicioChunk);
FechaInicioPhrase.Add(new Chunk(TxtFechaInicio.Text, fontValueFiltro));
//Fecha Fin Phrase
Phrase FechaFinPhrase = new Phrase();
FechaFinPhrase.Add(FechaFinChunk);
FechaFinPhrase.Add(new Chunk(TxtFechaFin.Text, fontValueFiltro));
//Producto Servicio Phrase
Phrase ProductoServicioPhrase = new Phrase();
ProductoServicioPhrase.Add(ProductoServicioChunk);
ProductoServicioPhrase.Add(new Chunk((DdlPS.SelectedValue == "-1" ? "Todos" : DdlPS.SelectedText), fontValueFiltro));
//Giro Phrase
Phrase GiroPhrase = new Phrase();
GiroPhrase.Add(GiroChunk);
GiroPhrase.Add(new Chunk((DdlGiroClasificacion.SelectedValue == "-1" ? "Todos" : DdlGiroClasificacion.SelectedItem.Text), fontValueFiltro));
Paragraph Filtros = new Paragraph();
Filtros.Add(ProcesoPhrase);
Filtros.Add(VendedorPhrase);
Filtros.Add(MedioCaptacionPhrase);
Filtros.Add(ProbabilidadPhrase);
Filtros.Add(AgrupadoPorPhrase);
//Filtros.Add(AgrupadoPor2Phrase);
Filtros.Add(FechaInicioPhrase);
Filtros.Add(FechaFinPhrase);
Filtros.Add(ProductoServicioPhrase);
Filtros.Add(GiroPhrase);
Filtros.Add("\n");
Filtros.Add("\n");
Filtros.Add("\n");
Filtros.Add("\n");
return Filtros;
}
private PdfPTable convertirReporteATabla()
{
int numeroDeColumnas = GVRepAcercamientosEtapas.Columns.Count;
PdfPTable table = new PdfPTable(numeroDeColumnas);
table.WidthPercentage = 100f;
BaseColor headerBackGroundColor = new BaseColor(240, 240, 240);
Font fuente = FontFactory.GetFont("Arial", 9f);
foreach (DataControlField columns in GVRepAcercamientosEtapas.Columns)
{
string header = columns.HeaderText;
PdfPCell headerCell = new PdfPCell(new Phrase(header, fuente));
headerCell.BackgroundColor = headerBackGroundColor;
table.AddCell(headerCell);
}
foreach (GridViewRow row in GVRepAcercamientosEtapas.Rows)
{
foreach (TableCell celda in row.Cells)
{
if (celda.Controls.Count > 0)
{
HyperLink control = (HyperLink)celda.Controls[0];
table.AddCell(new Phrase(control.Text, fuente));
}
else
{
table.AddCell(new Phrase(celda.Text, fuente));
}
}
}
return table;
}
protected void LnkExcel_Click(object sender, EventArgs e)
{
GVRepAcercamientosEtapas.ExportToExcelGembox("Reporte de Rechazos de Acercamiento", UsuarioActual, "", "", "Reporte de Rechazos de Acercamiento", "", -1);
}
public override void VerifyRenderingInServerForm(Control control)
{
}
}