679 lines
38 KiB
C#
679 lines
38 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
|
|
using PDFGenerator.Presentation.Section;
|
|
using PDFGenerator;
|
|
using PDFGenerator.Presentation.Section.Tables;
|
|
using PDFGenerator.Presentation.Section.Charts;
|
|
using PDFGenerator.BusinessLayer;
|
|
using PDFGenerator.BusinessLayer.DataSection;
|
|
using System.Data;
|
|
using ceTe.DynamicPDF;
|
|
using PDFGenerator.Entity;
|
|
using ceTe.DynamicPDF.PageElements;
|
|
|
|
namespace PDFGenerator.Presentation.Section
|
|
{
|
|
public class FD190: SIstogramma, ISezione
|
|
{
|
|
string Titolo = string.Empty;
|
|
string _testotitolo;
|
|
string _testointroduttivo;
|
|
string _testoAlternativo;
|
|
NLog.Logger logger = NLog.LogManager.GetCurrentClassLogger();
|
|
|
|
public FD190()
|
|
{
|
|
//
|
|
// TODO: Add constructor logic here
|
|
//
|
|
}
|
|
|
|
/// <summary>
|
|
/// Testo introduttivo della sezione.
|
|
/// </summary>
|
|
public string TestoIntroduttivo
|
|
{
|
|
get
|
|
{
|
|
return _testointroduttivo;
|
|
}
|
|
set
|
|
{
|
|
_testointroduttivo = value;
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// Testo del titolo della sezione.
|
|
/// </summary>
|
|
public string TestoTitolo
|
|
{
|
|
get
|
|
{
|
|
return _testotitolo;
|
|
}
|
|
set
|
|
{
|
|
_testotitolo = value;
|
|
}
|
|
}
|
|
|
|
public string TestoAlternativo
|
|
{
|
|
get { return _testoAlternativo; }
|
|
set { _testoAlternativo = value; }
|
|
}
|
|
|
|
public void setTitolo(string label)
|
|
{
|
|
Titolo = label;
|
|
}
|
|
|
|
public void writeSezione(DataThread dataThread)
|
|
{
|
|
DocumentPDF document = dataThread.DocumentPDF;
|
|
DatiTabella datiHeaderCaratteristiche = new DatiTabella();
|
|
DatiTabella datiHeaderPercentualeAttuale = new DatiTabella();
|
|
DatiTabella datiMacroAsset = new DatiTabella();
|
|
Tabella tab = new Tabella(document.getMargineLeft(), document.getLastPos());
|
|
|
|
DataSet set = dataThread.Data.DatiSezione;
|
|
|
|
// Titolo della sezione
|
|
//logger.Info("Titolo della sezione " + Titolo);
|
|
//document.setPageTitolo(Titolo);
|
|
|
|
// Testo del paragrafo
|
|
logger.Info("Titolo della sezione " + _testointroduttivo);
|
|
document.setLastPos(-40);
|
|
document.setSezTitolo(dataThread.SezioneReport.Titolo);
|
|
document.setChapterHeader(string.Concat(_testointroduttivo.Replace("/$Banca$/", dataThread.NomeRete), "<br>"), 0, 520, 8);
|
|
|
|
#region Sezione per stampare solo l'header della tabella
|
|
logger.Info("Scrittura di solo header della tabella Titolo della seconda tabella " + _testointroduttivo);
|
|
DataSet _ds = new DataSet();
|
|
DataTable _dt = new DataTable();
|
|
_dt.Columns.Add("Macro Asset Class", typeof(System.String));
|
|
_dt.Columns.Add("Portafoglio modello (%)", typeof(System.String));
|
|
_dt.Columns.Add("Portafoglio attuale (%)", typeof(System.String));
|
|
|
|
_ds.Tables.Add(_dt);
|
|
DataRow dr = _dt.NewRow();
|
|
dr[0] = "";
|
|
dr[1] = "";
|
|
dr[2] = "";
|
|
|
|
_dt.Rows.Add(dr);
|
|
|
|
datiHeaderCaratteristiche.table = _ds.Tables[0];
|
|
|
|
datiHeaderCaratteristiche.setY(document.getLastPos() + 10);
|
|
datiHeaderCaratteristiche.setX(document.getMargineLeft());
|
|
|
|
datiHeaderCaratteristiche.setHeader(true);
|
|
datiHeaderCaratteristiche.setCellSpace(10);
|
|
datiHeaderCaratteristiche.setCell(150, ceTe.DynamicPDF.TextAlign.Left, Globals.OpenTypeFontVerdanaB, false);
|
|
datiHeaderCaratteristiche.setCell(150, ceTe.DynamicPDF.TextAlign.Left, Globals.OpenTypeFontVerdanaB, false);
|
|
datiHeaderCaratteristiche.setCell(150, ceTe.DynamicPDF.TextAlign.Left, Globals.OpenTypeFontVerdanaB, false);
|
|
|
|
tab.ColoreDirectBankB = "green";
|
|
|
|
document.InsertTable(tab.getTabella(datiHeaderCaratteristiche));
|
|
|
|
ceTe.DynamicPDF.Merger.ImportedPage page1 = document.getCurrentPage();
|
|
#endregion
|
|
|
|
#region Grafico Portafoglio modello
|
|
logger.Info("FD190 - Inizio impostazione grafico Portafoglio modello");
|
|
List<IValoriSerieS190> listaValoriPesoRelativo = new List<IValoriSerieS190>();
|
|
foreach (var item in set.Tables["MacroAssetClass"].AsEnumerable())
|
|
{
|
|
IValoriSerieS190 IvaloriSeriePesoRelativo = new IValoriSerieS190();
|
|
IvaloriSeriePesoRelativo.chiave = item[0].ToString();
|
|
IvaloriSeriePesoRelativo.valore = Convert.ToDecimal(item[4]);
|
|
IvaloriSeriePesoRelativo.colore = System.Drawing.Color.FromArgb((int)item["Red"], (int)item["Green"], (int)item["Blue"]);
|
|
listaValoriPesoRelativo.Add(IvaloriSeriePesoRelativo);
|
|
}
|
|
|
|
////double altezzaGraficoPesoRischio_Prodotto = 15 * (tabellaDati.Datasource.Rows.Count + 0.5);
|
|
IstoFarfallaS190 graficoCaratteristiche = new IstoFarfallaS190(320, 200); //92 //85 750 //158
|
|
graficoCaratteristiche.DocumentPDF = document;
|
|
graficoCaratteristiche.PositionX = 200; //145
|
|
graficoCaratteristiche.PositionY = Convert.ToInt32(document.getLastPos() + 22); //32 //38 //42 //542;
|
|
graficoCaratteristiche.AxisY_LineColor = true;
|
|
graficoCaratteristiche.AxisY_Hide = true; //false;
|
|
graficoCaratteristiche.AxysX_Increment = Convert.ToDecimal(1);
|
|
graficoCaratteristiche.AxisY_DashStyle = Dundas.Charting.WebControl.ChartDashStyle.DashDot;
|
|
graficoCaratteristiche.isShadowOffset = false; // Abilita l'ombreggiatura delle barre per ESG è fissato a 40
|
|
graficoCaratteristiche.isPixelPointWidth = "40"; // serve per dimensionare l'altezza delle barre
|
|
graficoCaratteristiche.BorderLineColor = System.Drawing.Color.FromArgb(0, 0, 0);
|
|
graficoCaratteristiche.BorderLineWidth = 10;
|
|
SerieIstoFarfallaS190 seriePesoRelativo = new SerieIstoFarfallaS190();
|
|
|
|
seriePesoRelativo = new SerieIstoFarfallaS190();
|
|
seriePesoRelativo.Name = "Caratteristiche%";
|
|
seriePesoRelativo.Values = listaValoriPesoRelativo;
|
|
seriePesoRelativo.ElementPosition = new Dundas.Charting.WebControl.ElementPosition(1F, -5F, 50.7F, 90F); //105f
|
|
//seriePesoRelativo.ElementPosition = new Dundas.Charting.WebControl.ElementPosition(1F, -5F, 50.7F, 120F); // ultimo parametro per aumentare lo spazio tra le barre
|
|
seriePesoRelativo.AxisY_CustumizedByValues = false;
|
|
seriePesoRelativo.ReverseAxisY = false;
|
|
seriePesoRelativo.Axisy_Interval = 10;
|
|
|
|
graficoCaratteristiche.SerieList.Add(seriePesoRelativo);
|
|
|
|
logger.Info("FD190 - Inizio scrittura Portafoglio Modello");
|
|
// Disegno il grafico
|
|
//graficoCaratteristiche.Draw();
|
|
logger.Info("FD190 - Fine grafico Portafoglio Modello ");
|
|
#endregion
|
|
|
|
#region Grafico Portafoglio Attuale
|
|
logger.Info("FD190 - Inizio impostazione grafico Portafoglio Attuale");
|
|
List<IValoriSerieS190> listaValoriPortafoglioAttuale = new List<IValoriSerieS190>();
|
|
foreach (var item in set.Tables["MacroAssetClass"].AsEnumerable())
|
|
{
|
|
IValoriSerieS190 IvaloriSeriePesoAttuale = new IValoriSerieS190();
|
|
IvaloriSeriePesoAttuale.chiave = item[0].ToString();
|
|
IvaloriSeriePesoAttuale.valore = Convert.ToDecimal(item[3]);
|
|
IvaloriSeriePesoAttuale.colore = System.Drawing.Color.FromArgb((int)item["Red"], (int)item["Green"], (int)item["Blue"]);
|
|
listaValoriPortafoglioAttuale.Add(IvaloriSeriePesoAttuale);
|
|
}
|
|
|
|
IstoFarfallaS190 graficoPortafoglioAttuale = new IstoFarfallaS190(320, 200); //92 //85 //750 158
|
|
graficoPortafoglioAttuale.DocumentPDF = document;
|
|
graficoPortafoglioAttuale.PositionX = 360;
|
|
graficoPortafoglioAttuale.PositionY = Convert.ToInt32(document.getLastPos() + 22); //32 //38 //42 //542;
|
|
graficoPortafoglioAttuale.AxisY_LineColor = true;
|
|
graficoPortafoglioAttuale.AxisY_Hide = true; //false;
|
|
graficoPortafoglioAttuale.AxysX_Increment = Convert.ToDecimal(1);
|
|
graficoPortafoglioAttuale.AxisY_DashStyle = Dundas.Charting.WebControl.ChartDashStyle.DashDot;
|
|
graficoPortafoglioAttuale.isShadowOffset = false; // Abilita l'ombreggiatura delle barre per ESG è fissato a 40
|
|
graficoPortafoglioAttuale.isPixelPointWidth = "40"; // serve per dimensionare l'altezza delle barre
|
|
graficoPortafoglioAttuale.BorderLineColor = System.Drawing.Color.FromArgb(0, 0, 0);
|
|
graficoPortafoglioAttuale.BorderLineWidth = 10;
|
|
|
|
|
|
SerieIstoFarfallaS190 seriePortafoglioAttuale = new SerieIstoFarfallaS190();
|
|
seriePortafoglioAttuale = new SerieIstoFarfallaS190();
|
|
seriePortafoglioAttuale.Name = "PortafoglioAttuale%";
|
|
seriePortafoglioAttuale.Values = listaValoriPortafoglioAttuale;
|
|
seriePortafoglioAttuale.ElementPosition = new Dundas.Charting.WebControl.ElementPosition(1F, -5F, 50.7F, 90F);
|
|
//seriePortafoglioAttuale.ElementPosition = new Dundas.Charting.WebControl.ElementPosition(1F, -5F, 50.7F, 120F); // ultimo parametro per aumentare lo spazio tra le barre
|
|
seriePortafoglioAttuale.AxisY_CustumizedByValues = false;
|
|
seriePortafoglioAttuale.ReverseAxisY = false;
|
|
seriePortafoglioAttuale.Axisy_Interval =10;
|
|
seriePortafoglioAttuale.AxisY_MinimumValue = (double)set.Tables["MacroAssetClass"].AsEnumerable().Min(mm => mm.Field<decimal>("Percentuale"));
|
|
seriePortafoglioAttuale.AxisY_MaximumValue = (double)set.Tables["MacroAssetClass"].AsEnumerable().Max(mm => mm.Field<decimal>("Percentuale"));
|
|
|
|
graficoPortafoglioAttuale.SerieList.Add(seriePortafoglioAttuale);
|
|
|
|
logger.Info("FD190 - Inizio scrittura Portafoglio Attuale");
|
|
// Disegno il grafico
|
|
graficoPortafoglioAttuale.Draw(); //// Pino Test 15/09/2022
|
|
logger.Info("FD190 - Fine grafico Portafoglio Attuale ");
|
|
#endregion
|
|
|
|
|
|
// Inserisco riga bianca per effetto distanziatore
|
|
logger.Info("Inizio inserimento riga bianca sotto caratteristiche");
|
|
//ceTe.DynamicPDF.Merger.ImportedPage page1 = document.getCurrentPage();
|
|
page1.Elements.Add(new ceTe.DynamicPDF.PageElements.Rectangle(document.getMargineLeft(), document.getLastPos() + 22, 500, 6, 0, new RgbColor(255, 255, 255)));
|
|
|
|
ceTe.DynamicPDF.Merger.ImportedPage page = document.getCurrentPage();
|
|
|
|
page.Elements.Add(new ceTe.DynamicPDF.PageElements.Rectangle(document.getMargineLeft(), document.getLastPos() + 168, 500, 6, 0, new RgbColor(255, 255, 255)));
|
|
|
|
#region Elenco MacroAsset
|
|
/****** Inserimento tabella con le due colonne e con la colonna delle Caratteristiche riempita ********/
|
|
logger.Info("Inizio inserimento tabella Macro Asset");
|
|
datiMacroAsset.table = set.Tables["MacroAssetClass"];
|
|
Tabella tabellaMacroAsset = new Tabella(document.getMargineLeft(), document.getLastPos() + 78, 0, -2, 0.009F); //90 68
|
|
|
|
tabellaMacroAsset.Datasource = datiMacroAsset.table;
|
|
tabellaMacroAsset.Header = false;
|
|
tabellaMacroAsset.DimensioneLinea = 0;
|
|
tabellaMacroAsset.AltezzaCella = 30; //35;
|
|
tabellaMacroAsset.Colonne.Add(new Colonna("AssetClassName", "Asset Class", 150, TipoAllineamento.SINISTRA, false, 9, false, TipoColonna.TESTO));
|
|
tabellaMacroAsset.Draw(datiMacroAsset, document);
|
|
logger.Info("Fine inserimento tabella MacroAsset");
|
|
/***********************************************************************************************************/
|
|
#endregion
|
|
|
|
|
|
#region per usare una writeSezione dedicata
|
|
//datiMacroAsset.table = set.Tables["MacroAssetClass"];
|
|
//Tabella tabellaCaratteristiche = new Tabella(document.getMargineLeft() + 15, document.getLastPos() + 85, 0, -2, 0.009F);
|
|
|
|
//tabellaCaratteristiche.Datasource = datiMacroAsset.table;
|
|
//tabellaCaratteristiche.Header = false;
|
|
//tabellaCaratteristiche.DimensioneLinea = 0;
|
|
//tabellaCaratteristiche.AltezzaCella = 42; //25;
|
|
//tabellaCaratteristiche.Colonne.Add(new Colonna("AssetClassName", "Asset Class", 170, TipoAllineamento.DESTRA, true, 9, false, TipoColonna.TESTO));
|
|
////tabellaCaratteristiche.Colonne.Add(new Colonna("PercentualeESG", "Distribuzione (%)", 170, TipoAllineamento.DESTRA, false, 9, false, TipoColonna.TESTO));
|
|
////document.InsertTable(tab.getTabella(datiMacroAsset));
|
|
////tabellaCaratteristiche.Draw(datiMacroAsset, document);
|
|
|
|
//base.DirectBanker = "S";
|
|
//base.tabMacroAssetClass = set.Tables["MacroAssetClass"];
|
|
|
|
//base.writeSezione190(dataThread);
|
|
#endregion
|
|
}
|
|
|
|
public void writeSezioneFD190(DataThread dataThread)
|
|
{
|
|
DatiTabella datiHeaderCaratteristiche = new DatiTabella();
|
|
|
|
document = dataThread.DocumentPDF;
|
|
|
|
DataSet set = dataThread.Data.DatiSezione;
|
|
|
|
#region Titolo e Testo del paragrafo
|
|
//logger.Info("Titolo della sezione " + _testointroduttivo);
|
|
//document.setLastPos(-40);
|
|
//document.setSezTitolo(dataThread.SezioneReport.Titolo);
|
|
//document.setChapterHeader(string.Concat(_testointroduttivo.Replace("/$Banca$/", dataThread.NomeRete), "<br>"), 0, 520, 8);
|
|
#endregion
|
|
|
|
|
|
#region Sezione per stampare solo l'header della tabella
|
|
//logger.Info("Scrittura di solo header della tabella Titolo della seconda tabella " + _testointroduttivo);
|
|
//DataSet _ds = new DataSet();
|
|
//DataTable _dt = new DataTable();
|
|
//_dt.Columns.Add("Macro Asset Class", typeof(System.String));
|
|
//_dt.Columns.Add("Portafoglio modello (%)", typeof(System.String));
|
|
//_dt.Columns.Add("Portafoglio attuale (%)", typeof(System.String));
|
|
|
|
//_ds.Tables.Add(_dt);
|
|
//DataRow dr = _dt.NewRow();
|
|
//dr[0] = "";
|
|
//dr[1] = "";
|
|
//dr[2] = "";
|
|
|
|
//_dt.Rows.Add(dr);
|
|
|
|
//datiHeaderCaratteristiche.table = _ds.Tables[0];
|
|
|
|
//datiHeaderCaratteristiche.setY(document.getLastPos() + 10);
|
|
//datiHeaderCaratteristiche.setX(document.getMargineLeft());
|
|
|
|
//datiHeaderCaratteristiche.setHeader(true);
|
|
//datiHeaderCaratteristiche.setCellSpace(10);
|
|
//datiHeaderCaratteristiche.setCell(150, ceTe.DynamicPDF.TextAlign.Left, Globals.OpenTypeFontVerdanaB, false);
|
|
//datiHeaderCaratteristiche.setCell(150, ceTe.DynamicPDF.TextAlign.Left, Globals.OpenTypeFontVerdanaB, false);
|
|
//datiHeaderCaratteristiche.setCell(150, ceTe.DynamicPDF.TextAlign.Left, Globals.OpenTypeFontVerdanaB, false);
|
|
|
|
//Tabella tab = new Tabella(document.getMargineLeft(), document.getLastPos());
|
|
|
|
//tab.ColoreDirectBankB = "green";
|
|
|
|
//document.InsertTable(tab.getTabella(datiHeaderCaratteristiche));
|
|
|
|
//ceTe.DynamicPDF.Merger.ImportedPage page1 = document.getCurrentPage();
|
|
#endregion
|
|
|
|
tabMacroAssetClass = set.Tables[0];
|
|
|
|
base.DirectBanker = "S";
|
|
|
|
base.writeSezione190(dataThread);
|
|
|
|
}
|
|
|
|
public void writeSezione190New(DataThread dataThread)
|
|
{
|
|
DocumentPDF document = dataThread.DocumentPDF;
|
|
DatiTabella datiHeaderCaratteristiche = new DatiTabella();
|
|
//DatiTabella datiHeaderPercentualeAttuale = new DatiTabella();
|
|
//DatiTabella datiMacroAsset = new DatiTabella();
|
|
//Tabella tab = new Tabella(document.getMargineLeft(), document.getLastPos());
|
|
|
|
DataSet set = dataThread.Data.DatiSezione;
|
|
DataTable dati = set.Tables[0];
|
|
|
|
// Testo del paragrafo
|
|
logger.Info("Titolo della sezione " + _testointroduttivo);
|
|
document.setLastPos(-40);
|
|
document.setSezTitolo(dataThread.SezioneReport.Titolo);
|
|
document.setChapterHeader(string.Concat(_testointroduttivo.Replace("/$Banca$/", dataThread.NomeRete), "<br>"), 0, 520, 8);
|
|
|
|
base.DirectBanker = "S";
|
|
|
|
#region Tabella con Grafici
|
|
|
|
document.setLastPos(150);
|
|
|
|
datiHeaderCaratteristiche.table = dati;
|
|
datiHeaderCaratteristiche.setCellSpace(10);
|
|
|
|
var tabellaAsset = new TablePDFEvolution(document.getMargineLeft(),230, dati)
|
|
{
|
|
Style = Style.ConsulenzaUnica,
|
|
Header = true,
|
|
Footer = false,
|
|
AlternateRow = false,
|
|
RowHeight = 28,
|
|
ShowSeparationLines = false,
|
|
PageBreak = true,
|
|
HeaderTextHorizontalAlign = HorizontalAlignmentType.Destra,
|
|
ShowBorderHeader = true,
|
|
};
|
|
tabellaAsset.Columns.Add(new ColumnPDF("AssetClassName", 150, HorizontalAlignmentType.Sinistra, false, false, 7, ColumnType.Testo, "AssetClassName", "Macro Asset class") { HeaderFontSize = 7, FontSize = 7 });
|
|
tabellaAsset.Columns.Add(new ColumnPDF("percentuale_modello", 185, HorizontalAlignmentType.Sinistra, false, false, 7, ColumnType.Testo, "percentuale_modello", "Portafoglio modello (%)") { HeaderFontSize = 7, HeaderPaddingLeft = 0, PaddingLeft = 3, DeltaYContent = 2, FontSize = 7 }); //{ HeaderPaddingRight = 80, PaddingRight = 20, HeaderFontSize = 7, DeltaYContent = 2, FontSize = 7});
|
|
tabellaAsset.Columns.Add(new ColumnPDF("percentuale", 185, HorizontalAlignmentType.Sinistra, false, false, 7, ColumnType.Testo, "percentuale", "Portafoglio attuale (%)") { HeaderFontSize = 7, HeaderPaddingLeft = 0, PaddingLeft = 3, DeltaYContent = 2, FontSize = 7 });
|
|
|
|
|
|
//ceTe.DynamicPDF.Merger.ImportedPage page = document.getCurrentPage();
|
|
|
|
//page.Elements.Add(tabellaAsset);
|
|
|
|
|
|
var list = new List<double>();
|
|
list.Add(Convert.ToDouble(dati.AsEnumerable().Max(x => x["percentuale_modello"])));
|
|
list.Add(Convert.ToDouble(dati.AsEnumerable().Max(x => x["percentuale"])));
|
|
list.Add(Convert.ToDouble(dati.AsEnumerable().Min(x => x["percentuale_modello"])));
|
|
list.Add(Convert.ToDouble(dati.AsEnumerable().Min(x => x["percentuale"])));
|
|
var max = (float)Math.Round(list.Max());
|
|
var min = (float)Math.Round(list.Min());
|
|
|
|
#region Old codice onDemand
|
|
//int o = 0;
|
|
|
|
//float larghezzaBarra = 0;
|
|
//float deltaXBarra = 0;
|
|
//var width = 0;
|
|
|
|
//if ((float)Math.Round(list.Min()) < 0)
|
|
//{
|
|
// foreach (DataRow row in dati.Rows)
|
|
// {
|
|
// float larghezzaBarraMinNeg = 0;
|
|
// var colore = new ColorPDF(Convert.ToInt32(row["Red"]), Convert.ToInt32(row["Green"]), Convert.ToInt32(row["Blue"]));
|
|
|
|
// #region barra colonna Percentuale Modello
|
|
// width = tabellaAsset.Columns[1].Width;
|
|
// larghezzaBarra = UtilityBusinessLayer.GetWidthProportional(Convert.ToDouble(row["percentuale_modello"]) == 0 ? (float)0.01 : (float)Convert.ToDouble(row["percentuale_modello"]), max, width - 50); // Modifica width Andrea prima non ci stava il -50
|
|
// larghezzaBarraMinNeg = UtilityBusinessLayer.GetWidthProportional(min, max - min, width - 50);
|
|
// tabellaAsset.Columns[1].HorizontalAlignment = HorizontalAlignmentType.Sinistra;
|
|
// deltaXBarra = larghezzaBarra - larghezzaBarraMinNeg + 15;
|
|
// if (Convert.ToDouble(row["percentuale_modello"]) == 0)
|
|
// {
|
|
// deltaXBarra = larghezzaBarra + 1;
|
|
// tabellaAsset.Cells[1, o].ValueObjectList = new List<ObjectPDF>()
|
|
// {
|
|
|
|
// //new FormattedTextAreaPDF(isControvalore() ? Helper.FormatCurrency(row["PercentualeControvaloreModello"].ToString()) : Helper.FormatDecimal(row["PercentualeControvaloreModello"].ToString(), 2), deltaXBarra-10, isControvalore()? 50 : 35)
|
|
// new FormattedTextAreaPDF(UtilityBusinessLayer.FormatCurrency(row["percentuale_modello"].ToString()), deltaXBarra-10, 50)
|
|
// {
|
|
// DeltaY = 4,
|
|
// TextHorizontalAlign = ceTe.DynamicPDF.TextAlign.Right,
|
|
// //DeltaX = isControvalore() ? deltaXBarra+20 : deltaXBarra+5,
|
|
// DeltaX = - larghezzaBarraMinNeg,
|
|
// FontSize = 7
|
|
// },
|
|
// new RectanglePDF(12, 1, ColorPDF.Bianco){DeltaY = 4}
|
|
// };
|
|
// }
|
|
// else
|
|
// {
|
|
// if (larghezzaBarra < 0)
|
|
// {
|
|
// deltaXBarra = larghezzaBarraMinNeg - 14;
|
|
// tabellaAsset.Cells[1, o].ValueObjectList = new List<ObjectPDF>()
|
|
// {
|
|
|
|
// //new FormattedTextAreaPDF(isControvalore() ? Helper.FormatCurrency(row["PercentualeControvaloreModello"].ToString()) : Helper.FormatDecimal(row["PercentualeControvaloreModello"].ToString(), 2), deltaXBarra, isControvalore()? 50 : 35)
|
|
// new FormattedTextAreaPDF(UtilityBusinessLayer.FormatCurrency(row["percentuale_modello"].ToString()), deltaXBarra-10, 50)
|
|
// {
|
|
// DeltaY = 4,
|
|
// TextHorizontalAlign = ceTe.DynamicPDF.TextAlign.Right,
|
|
// DeltaX = deltaXBarra,
|
|
// FontSize = 7
|
|
// },
|
|
// new RectanglePDF(12, larghezzaBarra , colore){DeltaY = 4, DeltaX = -larghezzaBarraMinNeg + 22}
|
|
// };
|
|
// }
|
|
// else
|
|
// {
|
|
// tabellaAsset.Cells[1, o].ValueObjectList = new List<ObjectPDF>()
|
|
// {
|
|
|
|
// //new FormattedTextAreaPDF(isControvalore() ? Helper.FormatCurrency(row["PercentualeControvaloreModello"].ToString()) : Helper.FormatDecimal(row["PercentualeControvaloreModello"].ToString(), 2), deltaXBarra, isControvalore()? 50 : 35)
|
|
// new FormattedTextAreaPDF(UtilityBusinessLayer.FormatCurrency(row["percentuale_modello"].ToString()), deltaXBarra-10, 50)
|
|
// {
|
|
// DeltaY = 4,
|
|
// TextHorizontalAlign = ceTe.DynamicPDF.TextAlign.Right,
|
|
// DeltaX = deltaXBarra,
|
|
// FontSize = 7
|
|
// },
|
|
// new RectanglePDF(12, larghezzaBarra , colore){DeltaY = 4, DeltaX = -larghezzaBarraMinNeg + 22}
|
|
// };
|
|
// }
|
|
|
|
|
|
|
|
// }
|
|
// #endregion
|
|
|
|
|
|
// #region barra colonna Percentuale Attuale
|
|
// width = tabellaAsset.Columns[2].Width;
|
|
// larghezzaBarra = UtilityBusinessLayer.GetWidthProportional(Convert.ToDouble(row["percentuale"]) == 0 ? (float)0.01 : (float)Convert.ToDouble(row["percentuale"]), max, width - 50);
|
|
// larghezzaBarraMinNeg = UtilityBusinessLayer.GetWidthProportional(min, max - min, width - 50);
|
|
// deltaXBarra = larghezzaBarra - larghezzaBarraMinNeg + 15;
|
|
// if (Convert.ToDouble(row["percentuale"]) == 0)
|
|
// {
|
|
// deltaXBarra = larghezzaBarra + 1;
|
|
// tabellaAsset.Cells[2, o].ValueObjectList = new List<ObjectPDF>()
|
|
// {
|
|
|
|
// new RectanglePDF(12, 1 , ColorPDF.Bianco){DeltaY = 4, DeltaX = -larghezzaBarraMinNeg},
|
|
// //new FormattedTextAreaPDF(isControvalore() ? Helper.FormatCurrency(row["PercentualeControvaloreAttuale"].ToString()) :Helper.FormatDecimal(row["PercentualeControvaloreAttuale"].ToString(), 2), deltaXBarra-10, isControvalore()? 50 : 35)
|
|
// new FormattedTextAreaPDF(UtilityBusinessLayer.FormatCurrency(row["percentuale"].ToString()), deltaXBarra-10, 50)
|
|
// {
|
|
// DeltaY = 4,
|
|
// TextHorizontalAlign = ceTe.DynamicPDF.TextAlign.Right,
|
|
// //DeltaX = isControvalore() ? deltaXBarra-10 : deltaXBarra-8,
|
|
// DeltaX = - larghezzaBarraMinNeg,
|
|
// FontSize = 7
|
|
// }
|
|
// };
|
|
// }
|
|
// else
|
|
// {
|
|
// if (larghezzaBarra < 0)
|
|
// {
|
|
// deltaXBarra = larghezzaBarraMinNeg - 14;
|
|
// tabellaAsset.Cells[2, o].ValueObjectList = new List<ObjectPDF>()
|
|
// {
|
|
// new RectanglePDF(12, larghezzaBarra , colore){DeltaY = 4, DeltaX = -larghezzaBarraMinNeg + 22},
|
|
// //new FormattedTextAreaPDF(isControvalore() ? Helper.FormatCurrency(row["PercentualeControvaloreAttuale"].ToString()) :Helper.FormatDecimal(row["PercentualeControvaloreAttuale"].ToString(), 2), deltaXBarra, isControvalore()? 50 : 35)
|
|
// new FormattedTextAreaPDF(UtilityBusinessLayer.FormatCurrency(row["percentuale"].ToString()), deltaXBarra-10, 50)
|
|
// {
|
|
// DeltaY = 4,
|
|
// TextHorizontalAlign = ceTe.DynamicPDF.TextAlign.Right,
|
|
// DeltaX = deltaXBarra,
|
|
// FontSize = 7
|
|
// }
|
|
// };
|
|
// }
|
|
// else
|
|
// {
|
|
// tabellaAsset.Cells[2, o].ValueObjectList = new List<ObjectPDF>()
|
|
// {
|
|
// new RectanglePDF(12, larghezzaBarra , colore){DeltaY = 4, DeltaX = -larghezzaBarraMinNeg + 22},
|
|
// //new FormattedTextAreaPDF(isControvalore() ? Helper.FormatCurrency(row["PercentualeControvaloreAttuale"].ToString()) :Helper.FormatDecimal(row["PercentualeControvaloreAttuale"].ToString(), 2), deltaXBarra, isControvalore()? 50 : 35)
|
|
// new FormattedTextAreaPDF(UtilityBusinessLayer.FormatCurrency(row["percentuale"].ToString()), deltaXBarra, 50)
|
|
// {
|
|
// DeltaY = 4,
|
|
// TextHorizontalAlign = ceTe.DynamicPDF.TextAlign.Right,
|
|
// DeltaX = deltaXBarra,
|
|
// FontSize = 7
|
|
// }
|
|
// };
|
|
// }
|
|
// }
|
|
// #endregion
|
|
// o++;
|
|
// }
|
|
//}
|
|
//else
|
|
// foreach (DataRow row in dati.Rows)
|
|
// {
|
|
|
|
// var colore = new ColorPDF(Convert.ToInt32(row["Red"]), Convert.ToInt32(row["Green"]), Convert.ToInt32(row["Blue"]));
|
|
|
|
// #region barra colonna Portafogliomodello
|
|
// width = tabellaAsset.Columns[1].Width;
|
|
// larghezzaBarra = UtilityBusinessLayer.GetWidthProportional(Convert.ToDouble(row["percentuale_modello"]) == 0 ? (float)0.01 : (float)Convert.ToDouble(row["percentuale_modello"]), max, width - 30); // Modifica width Andrea
|
|
|
|
// /**************************** Modifica aladdin Andrea *************************************************************************/
|
|
// tabellaAsset.Columns[1].HorizontalAlignment = HorizontalAlignmentType.Sinistra;
|
|
// //deltaXBarra = -larghezzaBarra + (isControvalore() ? 0 : 7);
|
|
// deltaXBarra = larghezzaBarra + 1;
|
|
// /**************************************************************************************************************************************/
|
|
// if (Convert.ToDouble(row["percentuale_modello"]) == 0)
|
|
// {
|
|
// tabellaAsset.Cells[1, o].ValueObjectList = new List<ObjectPDF>()
|
|
// {
|
|
|
|
// new FormattedTextAreaPDF(UtilityBusinessLayer.FormatCurrency(row["percentuale_modello"].ToString()), deltaXBarra-10, 50)
|
|
// {
|
|
// DeltaY = 4,
|
|
// //*************************************** Modifiche Aladdin Andrea barre ************************************//
|
|
// //TextHorizontalAlign = ceTe.DynamicPDF.TextAlign.Left,
|
|
// TextHorizontalAlign = ceTe.DynamicPDF.TextAlign.Right,
|
|
// //********************************************************************************************************//,
|
|
// DeltaX = deltaXBarra+30,
|
|
// FontSize = 7
|
|
// },
|
|
// new RectanglePDF(12, 1 , ColorPDF.Bianco){DeltaY = 4}
|
|
// };
|
|
// }
|
|
// else
|
|
// {
|
|
// if (larghezzaBarra < 0)
|
|
// {
|
|
// deltaXBarra = -larghezzaBarra - 20;
|
|
// tabellaAsset.Cells[1, o].ValueObjectList = new List<ObjectPDF>()
|
|
// {
|
|
|
|
// //new FormattedTextAreaPDF(isControvalore() ? Helper.FormatCurrency(row["PercentualeControvaloreModello"].ToString()) : Helper.FormatDecimal(row["PercentualeControvaloreModello"].ToString(), 2), deltaXBarra, isControvalore()? 50 : 35)
|
|
// new FormattedTextAreaPDF(UtilityBusinessLayer.FormatCurrency(row["percentuale_modello"].ToString()), deltaXBarra, 50)
|
|
// {
|
|
// DeltaY = 4,
|
|
// //*************************************** Modifiche Aladdin Andrea barre ************************************//
|
|
// //TextHorizontalAlign = ceTe.DynamicPDF.TextAlign.Left,
|
|
// TextHorizontalAlign = ceTe.DynamicPDF.TextAlign.Right,
|
|
// //********************************************************************************************************//
|
|
// DeltaX = deltaXBarra,
|
|
// FontSize = 7
|
|
// },
|
|
// new RectanglePDF(12, larghezzaBarra , colore){DeltaY = 4, DeltaX = -larghezzaBarra -10}
|
|
// };
|
|
|
|
// }
|
|
// else
|
|
// {
|
|
// tabellaAsset.Cells[1, o].ValueObjectList = new List<ObjectPDF>()
|
|
// {
|
|
|
|
// //new FormattedTextAreaPDF(isControvalore() ? Helper.FormatCurrency(row["PercentualeControvaloreModello"].ToString()) : Helper.FormatDecimal(row["PercentualeControvaloreModello"].ToString(), 2), deltaXBarra, isControvalore()? 50 : 35)
|
|
// new FormattedTextAreaPDF(UtilityBusinessLayer.FormatCurrency(row["percentuale_modello"].ToString()), deltaXBarra, 50)
|
|
// {
|
|
// DeltaY = 4,
|
|
// //*************************************** Modifiche Aladdin Andrea barre ************************************//
|
|
// //TextHorizontalAlign = ceTe.DynamicPDF.TextAlign.Left,
|
|
// TextHorizontalAlign = ceTe.DynamicPDF.TextAlign.Right,
|
|
// //********************************************************************************************************//
|
|
// DeltaX = deltaXBarra,
|
|
// FontSize = 7
|
|
// },
|
|
// new RectanglePDF(12, larghezzaBarra , colore){DeltaY = 4}
|
|
// };
|
|
// }
|
|
|
|
// }
|
|
// #endregion
|
|
|
|
|
|
// #region barra colonna Portafoglioattuale
|
|
// width = tabellaAsset.Columns[2].Width;
|
|
// larghezzaBarra = UtilityBusinessLayer.GetWidthProportional(Convert.ToDouble(row["percentuale"]) == 0 ? (float)0.01 : (float)Convert.ToDouble(row["percentuale"]), max, width - 30); //Modifica width Andrea
|
|
// deltaXBarra = larghezzaBarra + 3;
|
|
// if (Convert.ToDouble(row["percentuale"]) == 0)
|
|
// {
|
|
// tabellaAsset.Cells[2, o].ValueObjectList = new List<ObjectPDF>()
|
|
// {
|
|
|
|
// new RectanglePDF(12, 1 , ColorPDF.Bianco){DeltaY = 4},
|
|
// //new FormattedTextAreaPDF(isControvalore() ? Helper.FormatCurrency(row["PercentualeControvaloreAttuale"].ToString()) :Helper.FormatDecimal(row["PercentualeControvaloreAttuale"].ToString(), 2), deltaXBarra-10, isControvalore()? 50 : 35)
|
|
// new FormattedTextAreaPDF(UtilityBusinessLayer.FormatCurrency(row["percentuale"].ToString()), deltaXBarra-10, 50)
|
|
// {
|
|
// DeltaY = 4,
|
|
// TextHorizontalAlign = ceTe.DynamicPDF.TextAlign.Right,
|
|
// DeltaX = deltaXBarra-35,
|
|
// FontSize = 7
|
|
// }
|
|
// };
|
|
// }
|
|
// else
|
|
// {
|
|
// if (larghezzaBarra < 0)
|
|
// {
|
|
// deltaXBarra = -larghezzaBarra - 20;
|
|
// tabellaAsset.Cells[2, o].ValueObjectList = new List<ObjectPDF>()
|
|
// {
|
|
// new RectanglePDF(12, larghezzaBarra , colore){DeltaY = 4, DeltaX = -larghezzaBarra - 10},
|
|
// //new FormattedTextAreaPDF(isControvalore() ? Helper.FormatCurrency(row["PercentualeControvaloreAttuale"].ToString()) :Helper.FormatDecimal(row["PercentualeControvaloreAttuale"].ToString(), 2), deltaXBarra, isControvalore()? 50 : 35)
|
|
// new FormattedTextAreaPDF(UtilityBusinessLayer.FormatCurrency(row["percentuale"].ToString()), deltaXBarra,50)
|
|
// {
|
|
// DeltaY = 4,
|
|
// TextHorizontalAlign = ceTe.DynamicPDF.TextAlign.Right,
|
|
// DeltaX = deltaXBarra,
|
|
// FontSize = 7
|
|
// }
|
|
// };
|
|
// }
|
|
// else
|
|
// {
|
|
// tabellaAsset.Cells[2, o].ValueObjectList = new List<ObjectPDF>()
|
|
// {
|
|
// new RectanglePDF(12, larghezzaBarra , colore){DeltaY = 4},
|
|
// //new FormattedTextAreaPDF(isControvalore() ? Helper.FormatCurrency(row["PercentualeControvaloreAttuale"].ToString()) :Helper.FormatDecimal(row["PercentualeControvaloreAttuale"].ToString(), 2), deltaXBarra, isControvalore()? 50 : 35)
|
|
// new FormattedTextAreaPDF(UtilityBusinessLayer.FormatCurrency(row["percentuale"].ToString()), deltaXBarra,50)
|
|
// {
|
|
// DeltaY = 4,
|
|
// TextHorizontalAlign = ceTe.DynamicPDF.TextAlign.Right,
|
|
// DeltaX = deltaXBarra,
|
|
// FontSize = 7
|
|
// }
|
|
// };
|
|
|
|
// }
|
|
|
|
// }
|
|
// #endregion
|
|
// o++;
|
|
// }
|
|
|
|
#endregion
|
|
|
|
tabellaAsset.min = min;
|
|
tabellaAsset.max = max;
|
|
|
|
tabellaAsset.minValorePercentuale = (float)Convert.ToDouble(dati.AsEnumerable().Min(x => x["percentuale"]));
|
|
tabellaAsset.maxValorePercentuale = (float)Convert.ToDouble(dati.AsEnumerable().Max(x => x["percentuale"]));
|
|
|
|
tabellaAsset.minValorePercentualeModello = (float)Convert.ToDouble(dati.AsEnumerable().Min(x => x["percentuale_modello"]));
|
|
tabellaAsset.maxValorePercentualeModello = (float)Convert.ToDouble(dati.AsEnumerable().Max(x => x["percentuale_modello"]));
|
|
|
|
tabellaAsset.Draw(datiHeaderCaratteristiche, document);
|
|
#endregion
|
|
}
|
|
}
|
|
}
|