619 lines
23 KiB
C#
619 lines
23 KiB
C#
using System;
|
|
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
|
|
{
|
|
#region "PROPIEDADES"
|
|
private string Agrupador
|
|
{
|
|
get { return (ViewState["Agrupador"] == null) ? "" : (ViewState["Agrupador"]).ToString(); }
|
|
set { ViewState["Agrupador"] = value; }
|
|
}
|
|
|
|
private DataTable DtColor
|
|
{
|
|
get { return DtColor = (DataTable)ViewState["DtColor"]; }
|
|
set { ViewState["DtColor"] = value; }
|
|
}
|
|
|
|
private DataTable DtDatos
|
|
{
|
|
get { return DtDatos = (DataTable)ViewState["DtDatos"]; }
|
|
set { ViewState["DtDatos"] = value; }
|
|
}
|
|
|
|
private DataTable DtMedioCaptacion
|
|
{
|
|
get
|
|
{
|
|
return (DataTable)ViewState["DtMedioCaptacion"];
|
|
}
|
|
|
|
set
|
|
{
|
|
ViewState["DtMedioCaptacion"] = value;
|
|
}
|
|
}
|
|
|
|
private DataTable DtProbabilidadAcercamiento
|
|
{
|
|
get
|
|
{
|
|
return (DataTable)ViewState["DtProbabilidadAcercamiento"];
|
|
}
|
|
|
|
set
|
|
{
|
|
ViewState["DtProbabilidadAcercamiento"] = value;
|
|
}
|
|
}
|
|
#endregion
|
|
|
|
protected void Page_Load(object sender, EventArgs e)
|
|
{
|
|
if (!IsPostBack)
|
|
{
|
|
DateTime startOfWeek = DateTime.Today.AddDays(-1 * (int)(DateTime.Today.DayOfWeek));
|
|
TxtFechaInicio.Text = startOfWeek.ToString("dd/MM/yyyy");
|
|
TxtFechaFin.Text = startOfWeek.AddDays(7).ToString("dd/MM/yyyy");
|
|
CargaDdl();
|
|
cargarDatos();
|
|
CreaDtColor();
|
|
}
|
|
}
|
|
|
|
|
|
protected void CargaDdl()
|
|
{
|
|
ClsCRM ObjCRM = new ClsCRM();
|
|
DdlTipoProceso.DataSource = null;
|
|
DdlVendedor.DataSource = null;
|
|
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;
|
|
}
|
|
DdlVendedor.DataSource = get_GlobalDTVendedores(UsuarioActual.CveEmpresa);
|
|
if (ObjCRM.GetMedioCaptacion(UsuarioActual.CveEmpresa))
|
|
{
|
|
DdlMedioCaptacion.Items.Clear();
|
|
DdlMedioCaptacion.DataSource = ObjCRM.DtResultados;
|
|
DtMedioCaptacion = ObjCRM.DtResultados;
|
|
}
|
|
if (ObjCRM.GetProbabilidadAcercamiento(UsuarioActual.CveEmpresa, -1))
|
|
{
|
|
DdlProbabilidad.DataSource = ObjCRM.DtResultados;
|
|
DtProbabilidadAcercamiento = ObjCRM.DtResultados;
|
|
}
|
|
ObjCRM.Dispose();
|
|
|
|
DdlTipoProceso.DataBind();
|
|
DdlVendedor.DataBind();
|
|
DdlMedioCaptacion.DataBind();
|
|
DdlProbabilidad.DataBind();
|
|
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);
|
|
|
|
int c;
|
|
string CveTipoProceso = Request["CveTipoProceso"];
|
|
bool isNumericC = int.TryParse(CveTipoProceso, out c);
|
|
|
|
if (isNumeric && isNumericC)
|
|
{
|
|
DdlProbabilidad.SelectedValue = CveProbabilidadAcercamiento;
|
|
DdlTipoProceso.SelectedValue = CveTipoProceso;
|
|
}
|
|
upDatosRepA.Update();
|
|
}
|
|
protected void cargarDatos()
|
|
{
|
|
int cveTipoProceso = DdlTipoProceso.SelectedValue.ToEntero();
|
|
int idgrupo1 = DdlGrupo1.SelectedValue.ToEntero();
|
|
int idgrupo2 = DdlGrupo2.SelectedValue.ToEntero();
|
|
string fechaIni = TxtFechaInicio.Text.Length > 0 ? TxtFechaInicio.Text.ToDateTime().ToString("yyyy/MM/dd") : "";
|
|
string fechaFin = TxtFechaFin.Text.Length > 0 ? TxtFechaFin.Text.ToDateTime().ToString("yyyy/MM/dd") : "";
|
|
int cveVendedor = DdlVendedor.SelectedValue.ToEntero();
|
|
int cveMedioCaptacion = DdlMedioCaptacion.SelectedValue.ToEntero();
|
|
int cveProbabilidadAcercamiento = DdlProbabilidad.SelectedValue.ToEntero();
|
|
ClsCRM ObjCRM = new ClsCRM();
|
|
GVRepAcercamientosEtapas.Columns.Clear();
|
|
|
|
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];
|
|
DtDatos= ObjCRM.DSResultados.Tables[0];
|
|
BoundField test = new BoundField();
|
|
test.DataField = "Grupo1";
|
|
test.HeaderText = "";
|
|
|
|
|
|
|
|
HyperLinkField hypt = new HyperLinkField();
|
|
hypt.DataTextField = $"Total";
|
|
hypt.HeaderText = $"Total";
|
|
hypt.DataNavigateUrlFields = new string[] { "CveGrupo1", "CveGrupo2", "Grupo1" };
|
|
string strfilstros =string.Format("&cveVendedor={0}&cveMedioCaptacion={1}&cveProbabilidadAcercamiento={2}", cveVendedor, cveMedioCaptacion, cveProbabilidadAcercamiento);
|
|
hypt.DataNavigateUrlFormatString = $"/CRM/RepAcercamientosProcesosDetalle.aspx?CveTipoProceso={DdlTipoProceso.SelectedValue}&CveGrupo1={DdlGrupo1.SelectedValue}&FechaInicio={TxtFechaInicio.Text}&FechaFin={TxtFechaFin.Text}{strfilstros}";
|
|
switch (idgrupo1)
|
|
{
|
|
case 1:
|
|
test.HeaderText = "Vendedor";
|
|
Agrupador = "Vendedor";
|
|
break;
|
|
case 2:
|
|
test.HeaderText = "Medio de Captación";
|
|
Agrupador = "Medio de Captación";
|
|
break;
|
|
case 3:
|
|
test.HeaderText = "Probabilidad de Acercamiento";
|
|
Agrupador = "Probabilidad de Acercamiento";
|
|
break;
|
|
case 4:
|
|
test.HeaderText = "Fecha";
|
|
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);
|
|
|
|
GVRepAcercamientosEtapas.Columns.Add(hypt);
|
|
foreach (DataRow row in dte.Rows)
|
|
{
|
|
HyperLinkField hyp = new HyperLinkField();
|
|
hyp.DataTextField = $"C_{row["CveEtapaProceso"]}";
|
|
hyp.HeaderText = $"{row["EtapaProceso"]}";
|
|
hyp.DataNavigateUrlFields = new string[]{ "CveGrupo1","CveGrupo2"};
|
|
hyp.DataNavigateUrlFormatString = $"/CRM/RepAcercamientosProcesosDetalle.aspx?CveTipoProceso={DdlGrupo1.SelectedValue}&CveGrupo1={{0}}&CveGrupo2={{1}}&FechaInicio={TxtFechaInicio.Text}&FechaFin={TxtFechaFin.Text}&cveEtapaProceso={row["CveEtapaProceso"]}";
|
|
GVRepAcercamientosEtapas.Columns.Add(hyp);
|
|
}
|
|
}
|
|
else
|
|
{
|
|
GVRepAcercamientosEtapas.DataSource = null;
|
|
|
|
}
|
|
ObjCRM.Dispose();
|
|
GVRepAcercamientosEtapas.DataBind();
|
|
upDatosRepA.Update();
|
|
}
|
|
|
|
|
|
protected void LnkConsultar_Click(object sender, EventArgs e)
|
|
{
|
|
cargarDatos();
|
|
}
|
|
|
|
private void CreaDtColor()
|
|
{
|
|
DtColor = new DataTable();
|
|
DtColor.Columns.Add("Color");
|
|
DataRow RowColor = null;
|
|
RowColor = DtColor.NewRow();
|
|
RowColor["Color"] = "#FF0F00";
|
|
DtColor.Rows.Add(RowColor);
|
|
RowColor = null;
|
|
RowColor = DtColor.NewRow();
|
|
RowColor["Color"] = "#FF6600";
|
|
DtColor.Rows.Add(RowColor);
|
|
RowColor = null;
|
|
RowColor = DtColor.NewRow();
|
|
RowColor["Color"] = "#FF9E01";
|
|
DtColor.Rows.Add(RowColor);
|
|
RowColor = null;
|
|
RowColor = DtColor.NewRow();
|
|
RowColor["Color"] = "#FCD202";
|
|
DtColor.Rows.Add(RowColor);
|
|
RowColor = null;
|
|
RowColor = DtColor.NewRow();
|
|
RowColor["Color"] = "#F8FF01";
|
|
DtColor.Rows.Add(RowColor);
|
|
RowColor = null;
|
|
RowColor = DtColor.NewRow();
|
|
RowColor["Color"] = "#B0DE09";
|
|
DtColor.Rows.Add(RowColor);
|
|
RowColor = null;
|
|
RowColor = DtColor.NewRow();
|
|
RowColor["Color"] = "#04D215";
|
|
DtColor.Rows.Add(RowColor);
|
|
RowColor = null;
|
|
RowColor = DtColor.NewRow();
|
|
RowColor["Color"] = "#0D8ECF";
|
|
DtColor.Rows.Add(RowColor);
|
|
RowColor = null;
|
|
RowColor = DtColor.NewRow();
|
|
RowColor["Color"] = "#0D52D1";
|
|
DtColor.Rows.Add(RowColor);
|
|
RowColor = null;
|
|
RowColor = DtColor.NewRow();
|
|
RowColor["Color"] = "#2A0CD0";
|
|
DtColor.Rows.Add(RowColor);
|
|
RowColor = null;
|
|
RowColor = DtColor.NewRow();
|
|
RowColor["Color"] = "#8A0CCF";
|
|
DtColor.Rows.Add(RowColor);
|
|
RowColor = null;
|
|
RowColor = DtColor.NewRow();
|
|
RowColor["Color"] = "#CD0D74";
|
|
DtColor.Rows.Add(RowColor);
|
|
RowColor = null;
|
|
RowColor = DtColor.NewRow();
|
|
RowColor["Color"] = "#754DEB";
|
|
DtColor.Rows.Add(RowColor);
|
|
RowColor = null;
|
|
RowColor = DtColor.NewRow();
|
|
RowColor["Color"] = "#DDDDDD";
|
|
DtColor.Rows.Add(RowColor);
|
|
RowColor = null;
|
|
RowColor = DtColor.NewRow();
|
|
RowColor["Color"] = "#999999";
|
|
DtColor.Rows.Add(RowColor);
|
|
RowColor = null;
|
|
RowColor = DtColor.NewRow();
|
|
RowColor["Color"] = "#333333";
|
|
DtColor.Rows.Add(RowColor);
|
|
RowColor = null;
|
|
RowColor = DtColor.NewRow();
|
|
RowColor["Color"] = "#000000";
|
|
DtColor.Rows.Add(RowColor);
|
|
}
|
|
|
|
protected void LnkVerGrafica_Click(object sender, EventArgs e)
|
|
{
|
|
if (DtDatos != null)
|
|
{
|
|
if (DtDatos.Rows.Count < 1)
|
|
{
|
|
Alert("No hay datos disponibles", ModExtensiones.TipoMensaje.MsgAdvertencia);
|
|
return;
|
|
}
|
|
LblTituloGrafica.Text = $"Agrupado por: {Agrupador}";
|
|
RegistraScript("$('#DivModalGrafica').modal('show')");
|
|
CambioGrafica();
|
|
}
|
|
else
|
|
{
|
|
Alert("No hay datos disponibles", ModExtensiones.TipoMensaje.MsgAdvertencia);
|
|
}
|
|
}
|
|
|
|
protected void DdlGrafica_SelectedIndexChanged(object sender, EventArgs e)
|
|
{
|
|
CambioGrafica();
|
|
}
|
|
|
|
private void CambioGrafica()
|
|
{
|
|
DataTable Dt = new DataTable();
|
|
Dt.Columns.Add("Texto");
|
|
Dt.Columns.Add("Valor");
|
|
Dt.Columns.Add("Color");
|
|
|
|
int RowColorIndex = 0;
|
|
foreach (DataRow Dr in DtDatos.Rows)
|
|
{
|
|
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()
|
|
select new
|
|
{
|
|
Texto = s["Texto"].ToString(),
|
|
Valor = s["Valor"].ToString().ToDouble(),
|
|
Color = s["Color"].ToString()
|
|
};
|
|
var json = Newtonsoft.Json.JsonConvert.SerializeObject(query);
|
|
switch (DdlGrafica.SelectedValue.ToEntero())
|
|
{
|
|
case 1:
|
|
RegistraScript($"CargaGraficaBarras({json})", "22");
|
|
break;
|
|
case 2:
|
|
RegistraScript($"CargaGraficaPastel({json})", "22");
|
|
break;
|
|
case 3:
|
|
RegistraScript($"CargaGraficaLineas({json})", "22");
|
|
break;
|
|
}
|
|
UPModalProd.Update();
|
|
}
|
|
|
|
protected void DdlTipoProceso_Change(object sender, EventArgs e)
|
|
{
|
|
DdlMedioCaptacion.Items.Clear();
|
|
DdlMedioCaptacion.DataSource = DtMedioCaptacion.FiltraParametros(String.Format("CveTipoProceso = {0}", DdlTipoProceso.SelectedValue.ToEntero()));
|
|
DdlMedioCaptacion.DataBind();
|
|
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 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);
|
|
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(Document doc)
|
|
{
|
|
int numeroDeColumnas = GVRepAcercamientosEtapas.Columns.Count;
|
|
PdfPTable table = new PdfPTable(numeroDeColumnas);
|
|
table.WidthPercentage = 100f;
|
|
|
|
float[] anchoColumnas = this.ColumnasWidth();
|
|
table.SetWidths(anchoColumnas);
|
|
|
|
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;
|
|
}
|
|
|
|
private float[] ColumnasWidth()
|
|
{
|
|
int CantidadColumnas = GVRepAcercamientosEtapas.Columns.Count;
|
|
float[] ColumnsWidth = new float[CantidadColumnas];
|
|
|
|
int cursor = 0;
|
|
DataControlFieldCollection ColumnsCollection = GVRepAcercamientosEtapas.Columns;
|
|
foreach (DataControlField columns in ColumnsCollection)
|
|
{
|
|
if (columns.HeaderText == "Total")
|
|
{
|
|
ColumnsWidth[cursor] = 20f;
|
|
}else
|
|
{
|
|
ColumnsWidth[cursor] = 80f;
|
|
}
|
|
|
|
cursor++;
|
|
}
|
|
|
|
return ColumnsWidth;
|
|
}
|
|
|
|
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)
|
|
{
|
|
|
|
}
|
|
|
|
protected void GVRepAcercamientosEtapas_RowDataBound(object sender, GridViewRowEventArgs e)
|
|
{
|
|
if (e.Row.RowType == DataControlRowType.DataRow)
|
|
{
|
|
if (e.Row.DataKey("Grupo1") == "Total")
|
|
{
|
|
e.Row.CssClass = "Totales";
|
|
|
|
}
|
|
}
|
|
}
|
|
|
|
} |