224 lines
14 KiB
C#
224 lines
14 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Text;
|
|
using ceTe.DynamicPDF.Text;
|
|
using System.Collections;
|
|
using ceTe.DynamicPDF;
|
|
using PDFGenerator.Presentation.Section.Tables;
|
|
using PDFGenerator.Presentation.Section.Charts;
|
|
using PDFGenerator.BusinessLayer.DataSection;
|
|
using System.Data;
|
|
using PDFGenerator.BusinessLayer;
|
|
using ceTe.DynamicPDF.PageElements;
|
|
|
|
|
|
namespace PDFGenerator.Presentation.Section
|
|
{
|
|
class S143 : ISezione
|
|
{
|
|
public void writeSezione(DataThread dataThread)
|
|
{
|
|
DocumentPDF document = dataThread.DocumentPDF;
|
|
DataSetS143 set = (DataSetS143)dataThread.Data.DatiSezione;
|
|
|
|
|
|
float Xtable = document.getMargineLeft();
|
|
float Ytable = document.getLastPos();
|
|
int dFont = 9;
|
|
int wCol1 = 100;
|
|
int wCol2 = 95;
|
|
int wCol3 = 65;
|
|
int hGrafico = 190; //150;
|
|
|
|
if (document.checkMargin(250))
|
|
document.addPage();
|
|
|
|
|
|
document.setSezTitolo(dataThread.SezioneReport.Titolo);
|
|
document.setChapterHeader(dataThread.SezioneReport.TestoIntroduttivo.Replace("/$Banca$/", dataThread.NomeRete).Replace("Sanpaolo Invest", "Fideuram S.p.A., commercializzati tramite la rete di private banker Sanpaolo Invest"), 0, 520, 8);
|
|
|
|
|
|
Ytable = document.getLastPos();
|
|
|
|
#region GRAFICO
|
|
//DatiGrafico dati = new DatiGrafico();
|
|
//dati.dataTab = set.Emittente;
|
|
//dati.setHeight(hGrafico);
|
|
//dati.setWidth(hGrafico);
|
|
//Torta isto = new Torta();
|
|
//document.InsertGrafico(isto.getGrafico(dati), Xtable + wCol1 + wCol2 + wCol3 + 50, Ytable - 11);
|
|
|
|
#endregion
|
|
|
|
#region Tabella Rating
|
|
|
|
|
|
if (set.EmittenteRap.Rows.Count > 0)
|
|
{
|
|
DatiTabella datitabRap = new DatiTabella(set.EmittenteRap);
|
|
Tabella tabellaDatiRap = new Tabella(Xtable, Ytable);
|
|
tabellaDatiRap.Header = true;
|
|
tabellaDatiRap.Colonne.Add(new Colonna("tipoEmittente", "Emittente", wCol1, TipoAllineamento.SINISTRA, false, dFont, false, TipoColonna.IMMAGINE_E_TESTO));
|
|
tabellaDatiRap.Colonne.Add(new Colonna("Controvalore", "Controvalore €", wCol2, TipoAllineamento.DESTRA, false, dFont, false));
|
|
tabellaDatiRap.Colonne.Add(new Colonna("Percentage", "Peso %", wCol3, TipoAllineamento.DESTRA, false, dFont, false));
|
|
tabellaDatiRap.Draw(datitabRap, document);
|
|
//SIMBOLI
|
|
int nPallino = 1;
|
|
float yPallino = Ytable + tabellaDatiRap.AltezzaCella;
|
|
float xPallino = Xtable;
|
|
ceTe.DynamicPDF.Merger.ImportedPage page = document.getCurrentPage();
|
|
foreach (DataRow drSimbolo in tabellaDatiRap.Datasource.Rows)
|
|
{
|
|
RgbColor color =
|
|
new RgbColor(byte.Parse(drSimbolo["Red"].ToString()), byte.Parse(drSimbolo["Green"].ToString()), byte.Parse(drSimbolo["Blue"].ToString()));
|
|
ceTe.DynamicPDF.PageElements.Circle simbolo =
|
|
new ceTe.DynamicPDF.PageElements.Circle(xPallino, yPallino, 10 / 1.8F, color, color);
|
|
page.Elements.Add(simbolo);
|
|
yPallino += tabellaDatiRap.AltezzaCella;
|
|
nPallino++;
|
|
}
|
|
Ytable += (datitabRap.GetRowDim() * (datitabRap.getNumRow() + 1)) + document.getSectionSpace();
|
|
|
|
|
|
/************************ Modifiche per Aladdin grafici a barre -- Pino**********************/
|
|
DatiGrafico dati = new DatiGrafico();
|
|
dati.dataTab = set.Emittente;
|
|
//dati.setHeight(Convert.ToSingle(datitab.getHeaderDim()) + (datitab.GetRowDim()));
|
|
dati.setHeight(Convert.ToSingle(datitabRap.getHeaderDim()) + (datitabRap.GetRowDim() * (datitabRap.getNumRow() + 1)));
|
|
dati.setWidth(hGrafico);
|
|
Istogramma isto = new Istogramma();
|
|
document.InsertGrafico(isto.getGrafico(dati), 320, document.getLastPos() - (datitabRap.getHeaderDim() / 2));
|
|
|
|
// Barra suil grafico
|
|
document.getCurrentPage().Elements.Add(new ceTe.DynamicPDF.PageElements.Rectangle(320, (document.getLastPos() + (datitabRap.GetRowDim() * (datitabRap.getNumRow()) + (datitabRap.getHeaderDim() / 2)) + 2), 190, 23, 0, new RgbColor(232, 236, 237)));
|
|
|
|
//// Scrittura del footer sul grafico
|
|
FormatNum format = new FormatNum();
|
|
ArrayList Labels = format.CreateCustomPerc148(dati.getValMax(),dati.getValMin());
|
|
float passo = 40.0F;
|
|
for (int ii = 0; ii <= Labels.Count - 1; ++ii)
|
|
if (ii == 0)
|
|
document.getCurrentPage().Elements.Add(new ceTe.DynamicPDF.PageElements.Label(Labels[ii].ToString(), 235F + ii, (document.getLastPos() + (datitabRap.GetRowDim() * (datitabRap.getNumRow()) + (datitabRap.getHeaderDim() / 2)) + 5), 100, 10, Globals.OpenTypeFontVerdana, 8, ceTe.DynamicPDF.TextAlign.Right, ceTe.DynamicPDF.CmykColor.Black));
|
|
else
|
|
document.getCurrentPage().Elements.Add(new ceTe.DynamicPDF.PageElements.Label(Labels[ii].ToString(), 245F + (passo * ii), (document.getLastPos() + (datitabRap.GetRowDim() * (datitabRap.getNumRow()) + (datitabRap.getHeaderDim() / 2)) + 5), 100, 10, Globals.OpenTypeFontVerdana, 8, ceTe.DynamicPDF.TextAlign.Right, ceTe.DynamicPDF.CmykColor.Black));
|
|
|
|
/********************************************************************************************/
|
|
|
|
|
|
}
|
|
|
|
|
|
if (set.EmittenteRap.Rows.Count > 0 && set.EmittenteNoRap.Rows.Count > 0) {
|
|
DatiTabella datitabRapT = new DatiTabella(set.TotaleRap);
|
|
Tabella tabellaDatiRapT = new Tabella(Xtable, Ytable);
|
|
tabellaDatiRapT.Header = false;
|
|
tabellaDatiRapT.Colonne.Add(new Colonna("Descrizione", "", wCol1, TipoAllineamento.SINISTRA, true, dFont, true));
|
|
tabellaDatiRapT.Colonne.Add(new Colonna("Controvalore", "", wCol2, TipoAllineamento.DESTRA, true, dFont, true));
|
|
tabellaDatiRapT.Colonne.Add(new Colonna("Percentage", "", wCol3, TipoAllineamento.DESTRA, true, dFont, true));
|
|
tabellaDatiRapT.Draw(datitabRapT, document);
|
|
Ytable += (datitabRapT.GetRowDim() * (datitabRapT.getNumRow()));
|
|
set.Totale[0]["Percentage"] = DBNull.Value;
|
|
|
|
|
|
|
|
/************************ Modifiche per Aladdin grafici a barre -- Pino**********************/
|
|
//DatiGrafico dati = new DatiGrafico();
|
|
//dati.dataTab = set.Emittente;
|
|
////dati.setHeight(Convert.ToSingle(datitab.getHeaderDim()) + (datitab.GetRowDim()));
|
|
//dati.setHeight(Convert.ToSingle(datitabRapT.getHeaderDim()) + (datitabRapT.GetRowDim() * (datitabRapT.getNumRow() + 1)));
|
|
//dati.setWidth(hGrafico);
|
|
//Istogramma isto = new Istogramma();
|
|
//document.InsertGrafico(isto.getGrafico(dati), 320, document.getLastPos() - (datitabRapT.getHeaderDim() / 2));
|
|
|
|
//// Barra suil grafico
|
|
//document.getCurrentPage().Elements.Add(new ceTe.DynamicPDF.PageElements.Rectangle(320, (document.getLastPos() + (datitabRapT.GetRowDim() * (datitabRapT.getNumRow()) + (datitabRapT.getHeaderDim() / 2)) + 2), 190, 23, 0, new RgbColor(232, 236, 237)));
|
|
|
|
////// Scrittura del footer sul grafico
|
|
//FormatNum format = new FormatNum();
|
|
//ArrayList Labels = format.CreateCustomPerc148(dati.getValMax(),dati.getValMin());
|
|
//float passo = 40.0F;
|
|
//for (int ii = 0; ii <= Labels.Count - 1; ++ii)
|
|
// if (ii == 0)
|
|
// document.getCurrentPage().Elements.Add(new ceTe.DynamicPDF.PageElements.Label(Labels[ii].ToString(), 235F + ii, (document.getLastPos() + (datitabRapT.GetRowDim() * (datitabRapT.getNumRow()) + (datitabRapT.getHeaderDim() / 2)) + 5), 100, 10, Globals.OpenTypeFontVerdana, 8, ceTe.DynamicPDF.TextAlign.Right, ceTe.DynamicPDF.CmykColor.Black));
|
|
// else
|
|
// document.getCurrentPage().Elements.Add(new ceTe.DynamicPDF.PageElements.Label(Labels[ii].ToString(), 245F + (passo * ii), (document.getLastPos() + (datitabRapT.GetRowDim() * (datitabRapT.getNumRow()) + (datitabRapT.getHeaderDim() / 2)) + 5), 100, 10, Globals.OpenTypeFontVerdana, 8, ceTe.DynamicPDF.TextAlign.Right, ceTe.DynamicPDF.CmykColor.Black));
|
|
|
|
/********************************************************************************************/
|
|
}
|
|
|
|
|
|
if (set.EmittenteNoRap.Rows.Count > 0)
|
|
{
|
|
DatiTabella datitabNoRap = new DatiTabella(set.EmittenteNoRap);
|
|
Tabella tabellaDatiNoRap = new Tabella(Xtable, Ytable);
|
|
tabellaDatiNoRap.Header = set.EmittenteRap.Rows.Count > 0 ? false : true;
|
|
tabellaDatiNoRap.Colonne.Add(new Colonna("tipoEmittente", "Emittente", wCol1, TipoAllineamento.SINISTRA, false, dFont, false, TipoColonna.IMMAGINE_E_TESTO));
|
|
tabellaDatiNoRap.Colonne.Add(new Colonna("Controvalore", "Controvalore €", wCol2, TipoAllineamento.DESTRA, false, dFont, false));
|
|
tabellaDatiNoRap.Colonne.Add(new Colonna("Percentage", "Peso %", wCol3, TipoAllineamento.DESTRA, false, dFont, false));
|
|
tabellaDatiNoRap.Draw(datitabNoRap, document);
|
|
//SIMBOLI
|
|
int nPallino = 1;
|
|
float yPallino = Ytable + tabellaDatiNoRap.AltezzaCella - (set.EmittenteRap.Rows.Count > 0 ? datitabNoRap.GetRowDim() + document.getSectionSpace() : 0);
|
|
float xPallino = Xtable;
|
|
ceTe.DynamicPDF.Merger.ImportedPage page = document.getCurrentPage();
|
|
foreach (DataRow drSimbolo in tabellaDatiNoRap.Datasource.Rows)
|
|
{
|
|
RgbColor color =
|
|
new RgbColor(byte.Parse(drSimbolo["Red"].ToString()), byte.Parse(drSimbolo["Green"].ToString()), byte.Parse(drSimbolo["Blue"].ToString()));
|
|
ceTe.DynamicPDF.PageElements.Circle simbolo =
|
|
new ceTe.DynamicPDF.PageElements.Circle(xPallino, yPallino, 10 / 1.8F, color, color);
|
|
page.Elements.Add(simbolo);
|
|
yPallino += tabellaDatiNoRap.AltezzaCella;
|
|
nPallino++;
|
|
}
|
|
Ytable += (datitabNoRap.GetRowDim() * (datitabNoRap.getNumRow()));
|
|
Ytable += set.EmittenteRap.Rows.Count > 0 ? 0 : datitabNoRap.GetRowDim() + document.getSectionSpace();
|
|
|
|
|
|
/************************ Modifiche per Aladdin grafici a barre -- Pino**********************/
|
|
//DatiGrafico dati = new DatiGrafico();
|
|
//dati.dataTab = set.Emittente;
|
|
////dati.setHeight(Convert.ToSingle(datitab.getHeaderDim()) + (datitab.GetRowDim()));
|
|
//dati.setHeight(Convert.ToSingle(datitabNoRap.getHeaderDim()) + (datitabNoRap.GetRowDim() * (datitabNoRap.getNumRow() + 1)));
|
|
//dati.setWidth(hGrafico);
|
|
//Istogramma isto = new Istogramma();
|
|
//document.InsertGrafico(isto.getGrafico(dati), 320, document.getLastPos() - (datitabNoRap.getHeaderDim() / 2));
|
|
|
|
//// Barra suil grafico
|
|
//document.getCurrentPage().Elements.Add(new ceTe.DynamicPDF.PageElements.Rectangle(320, (document.getLastPos() + (datitabNoRap.GetRowDim() * (datitabNoRap.getNumRow()) + (datitabNoRap.getHeaderDim() / 2)) + 2), 190, 23, 0, new RgbColor(232, 236, 237)));
|
|
|
|
////// Scrittura del footer sul grafico
|
|
//FormatNum format = new FormatNum();
|
|
//ArrayList Labels = format.CreateCustomPerc148(dati.getValMax(), dati.getValMin());
|
|
//float passo = 40.0F;
|
|
//for (int ii = 0; ii <= Labels.Count - 1; ++ii)
|
|
// if (ii == 0)
|
|
// document.getCurrentPage().Elements.Add(new ceTe.DynamicPDF.PageElements.Label(Labels[ii].ToString(), 235F + ii, (document.getLastPos() + (datitabNoRap.GetRowDim() * (datitabNoRap.getNumRow()) + (datitabNoRap.getHeaderDim() / 2)) + 5), 100, 10, Globals.OpenTypeFontVerdana, 8, ceTe.DynamicPDF.TextAlign.Right, ceTe.DynamicPDF.CmykColor.Black));
|
|
// else
|
|
// document.getCurrentPage().Elements.Add(new ceTe.DynamicPDF.PageElements.Label(Labels[ii].ToString(), 245F + (passo * ii), (document.getLastPos() + (datitabNoRap.GetRowDim() * (datitabNoRap.getNumRow()) + (datitabNoRap.getHeaderDim() / 2)) + 5), 100, 10, Globals.OpenTypeFontVerdana, 8, ceTe.DynamicPDF.TextAlign.Right, ceTe.DynamicPDF.CmykColor.Black));
|
|
|
|
/********************************************************************************************/
|
|
}
|
|
|
|
|
|
|
|
//TOTALE
|
|
DatiTabella datitabT = new DatiTabella(set.Totale);
|
|
Tabella tabellaDatiT = new Tabella(Xtable, Ytable);
|
|
tabellaDatiT.Header = false;
|
|
tabellaDatiT.Colonne.Add(new Colonna("Descrizione", "", wCol1, TipoAllineamento.SINISTRA, true, dFont, true));
|
|
tabellaDatiT.Colonne.Add(new Colonna("Controvalore", "", wCol2, TipoAllineamento.DESTRA, true, dFont, true));
|
|
tabellaDatiT.Colonne.Add(new Colonna("Percentage", "", wCol3, TipoAllineamento.DESTRA, true, dFont, true));
|
|
tabellaDatiT.Draw(datitabT, document);
|
|
|
|
|
|
#endregion
|
|
|
|
document.setLastPos(hGrafico);
|
|
|
|
|
|
|
|
}
|
|
}
|
|
}
|