520 lines
30 KiB
C#
520 lines
30 KiB
C#
using System;
|
|
using Consulenza.ReportWriter.Business;
|
|
using Consulenza.ReportWriter.Business.OBJ_PDF;
|
|
using System.Data;
|
|
using Consulenza.ReportWriter.Business.Entity;
|
|
using Consulenza.ReportWriter.Business.CHART_PDF;
|
|
using System.Collections.Generic;
|
|
using Consulenza.ReportCommon;
|
|
using Consulenza.ReportWriter.Manager.Integration;
|
|
using System.Linq;
|
|
using Consulenza.ReportWriter.Business.CUSTOM_PDF.ConsulenzaUnica;
|
|
using Consulenza.DataServices.fideuram.data.service;
|
|
namespace Consulenza.ReportWriter.Manager.Section.Unica
|
|
{
|
|
/// <summary>
|
|
/// S28.ProgettoUniversitaFigliDettaglioPortafoglioModello idSezione = 71
|
|
/// </summary>
|
|
public class S28 : Entity.Section
|
|
{
|
|
public string TitoloProgetto { get; set; }
|
|
public long ChiaveProgetto { get; set; }
|
|
|
|
private ColorPDF _scenarioPess = ColorPDF.Rosso;//new ColorPDF(233, 202, 133);
|
|
private ColorPDF _scenarioOtt = new ColorPDF(114, 174, 198);
|
|
private ColorPDF _scenarioMed = new ColorPDF(0, 0, 0);
|
|
|
|
public S28(EnvironmentFacade environmentFacade, int idSection)
|
|
: base(environmentFacade, idSection)
|
|
{
|
|
try
|
|
{
|
|
Draw();
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
SectionLogger.Write("S28", ex.Message, SectionLoggerMessageLevel.E, EnvironmentFacade.ReportEnvironment);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
protected override sealed void Draw()
|
|
{
|
|
var dati = GetDataSet();
|
|
|
|
for (int i = 0; i < dati.Tables["NomeProgetto"].Rows.Count; i++)
|
|
{
|
|
TitoloProgetto = dati.Tables["NomeProgetto"].Rows[i]["NomeProgetto"].ToString();
|
|
string titolospezzato = TitoloProgetto.Length > 23 ? TitoloProgetto.Substring(0, 23)+"..." : TitoloProgetto;
|
|
ChiaveProgetto = long.Parse(dati.Tables["NomeProgetto"].Rows[i]["ChiaveProgetto"].ToString());
|
|
AddElement(new PagePDF(PagePDF.PagePDFType.Generic));
|
|
|
|
var intestazione = new SectionHeadingPDF(
|
|
"Progetto «" + titolospezzato + "»: dettaglio portafoglio modello",
|
|
|
|
EnvironmentFacade.RendererFacade.XLeftLimit,
|
|
EnvironmentFacade.RendererFacade.YUpperLimit,
|
|
EnvironmentFacade.ReportEnvironment.FontFamily);
|
|
|
|
AddElement(intestazione.ToElement());
|
|
|
|
|
|
AddElement(new SpacePDF(20));
|
|
if (getTestoIntro().Length > 0)
|
|
{
|
|
AddElement(new FormattedTextAreaPDF(getTestoIntro(), EnvironmentFacade.RendererFacade.XLeftLimit) {FontSize=7, TextHorizontalAlign = ceTe.DynamicPDF.TextAlign.Justify });
|
|
AddElement(new SpacePDF(15));
|
|
}
|
|
|
|
#region Patrimonio
|
|
var tabellaPatrimonio = new TablePDF(EnvironmentFacade.RendererFacade.XLeftLimit, dati.Tables["labelControvalore" + i])
|
|
{
|
|
Style = Style.ConsulenzaUnica,
|
|
Header = false,
|
|
Footer = false,
|
|
AlternateRow = false,
|
|
RowHeight = 25
|
|
};
|
|
tabellaPatrimonio.Columns.Add(new ColumnPDF("controvalore", 130, HorizontalAlignmentType.Sinistra, true, true, 7, ColumnType.Testo, "controvalore", string.Empty) { PaddingLeft = 1 });
|
|
tabellaPatrimonio.Columns.Add(new ColumnPDF("valore", 130, HorizontalAlignmentType.Destra, false, false, 7, ColumnType.Testo, "valore", string.Empty) { PaddingRight = 15, BackgroundColor = ColorPDF.Bianco });
|
|
tabellaPatrimonio.Columns.Add(new ColumnPDF("descrizione", 130, HorizontalAlignmentType.Sinistra, true, true, 7, ColumnType.Testo, "descrizione", string.Empty) { PaddingLeft = 5 });
|
|
tabellaPatrimonio.Columns.Add(new ColumnPDF("val", 125, HorizontalAlignmentType.Destra, false, false, 7, ColumnType.Testo, "val", string.Empty) { PaddingRight = 15, BackgroundColor = ColorPDF.Bianco });
|
|
|
|
int e = 0;
|
|
foreach (DataRow dro in dati.Tables["labelControvalore" + i].Rows)
|
|
{
|
|
tabellaPatrimonio.Cells[2, e].BackgroundColor = dro["descrizione"].ToString() == "" ? ColorPDF.Bianco : ColorPDF.Standard_Grigio_SfondoColonnaTabella;
|
|
e++;
|
|
}
|
|
|
|
//AddElement(new SpacePDF(15));
|
|
AddElement(tabellaPatrimonio);
|
|
//FormattedTextAreaPDF captionOrizzTemp = new FormattedTextAreaPDF("Orizzonte temporale", EnvironmentFacade.RendererFacade.XLeftLimit, 130) { FontSize = 7, BackGroundMarginLeft = 5, BackGroundColor = ColorPDF.Standard_Grigio_SfondoColonnaTabella, FontColor = ColorPDF.Nero, FontBold = true, AutoIncrementYWritable = false };
|
|
//AddElement(captionOrizzTemp);
|
|
//FormattedTextAreaPDF orizzTemp = new FormattedTextAreaPDF(dati.Tables["labelControvalore" + i].Rows[0]["OrizzonteTemporale"].ToString(), EnvironmentFacade.RendererFacade.XLeftLimit + 150) { FontSize = 7, BackGroundColor = ColorPDF.Bianco, AutoIncrementYWritable = false };
|
|
//AddElement(orizzTemp);
|
|
|
|
//FormattedTextAreaPDF captionRischioMercato = new FormattedTextAreaPDF("Rischio mercato (VaR %)", EnvironmentFacade.RendererFacade.XLeftLimit + 280, 140) { FontSize = 7, BackGroundMarginLeft = 5, BackGroundColor = ColorPDF.Standard_Grigio_SfondoColonnaTabella, FontColor = ColorPDF.Nero, FontBold = true, AutoIncrementYWritable = false };
|
|
//AddElement(captionRischioMercato);
|
|
//FormattedTextAreaPDF varMercato = new FormattedTextAreaPDF(dati.Tables["labelControvalore" + i].Rows[0]["RischioMercato"].ToString(), EnvironmentFacade.RendererFacade.XLeftLimit + 480) { FontSize = 7, BackGroundColor = ColorPDF.Bianco, AutoIncrementYWritable = true };
|
|
//AddElement(varMercato);
|
|
|
|
#endregion
|
|
|
|
|
|
AddElement(new SpacePDF(25));
|
|
|
|
AddElement(new FormattedTextAreaPDF(isAssetClass() ? "Asset class (%)" : "Macro asset class (%)", EnvironmentFacade.RendererFacade.XLeftLimit, 255) { FontSize = 7, BackGroundColor = ColorPDF.Standard_Grigio_SfondoColonnaTabella, FontBold = true, FontColor = ColorPDF.ConsulenzaUnica_Rosso, AutoIncrementYWritable = false, BackGroundMarginLeft = 5 });
|
|
AddElement(new FormattedTextAreaPDF("Possibile evoluzione del rendimento", EnvironmentFacade.RendererFacade.XLeftLimit + 260, 255) { FontSize = 7, BackGroundColor = ColorPDF.Standard_Grigio_SfondoColonnaTabella, FontBold = true, FontColor = ColorPDF.ConsulenzaUnica_Rosso, AutoIncrementYWritable = true, BackGroundMarginLeft = 5 });
|
|
|
|
|
|
AddElement(new RectanglePDF(EnvironmentFacade.RendererFacade.XLeftLimit, dati.Tables["assetClass" + i].Rows.Count * 30 + 20, 255, ColorPDF.Bianco) { BorderWidth = 0.5F, BorderColor = ColorPDF.ConsulenzaUnica_Grigio_SfondoColonnaHeaderFooterTabella, AutoIncrementYWritable = false });
|
|
|
|
#region barre
|
|
|
|
var graficoBarre = new StackedPDF(EnvironmentFacade.RendererFacade.XLeftLimit + 110, 1F)
|
|
{
|
|
HeightSingleBar = 30,
|
|
Width = 140,
|
|
LabelFormatAxisY = FormatType.Intero,
|
|
ShowLabelAxisY = false,
|
|
ShowLineAxisY = false,
|
|
ShowLineAxisX = true,
|
|
ShowLabelPoints = true,
|
|
AutoIncrementYWritable = false,
|
|
BorderLineTop = true,
|
|
BorderLineX = 1,
|
|
BorderLineWidth = 1,
|
|
DinamicFloatXEtichettaLateraleBarra = true
|
|
};
|
|
var serieCollezione = new List<Serie> { new Serie { Name = "Patrimoni", Border = true, BorderWidth = 1, PointWidth = "0.6" } };
|
|
Double maxValuePerc = 0.0;
|
|
foreach (DataRow item in dati.Tables["assetClass" + i].Rows)
|
|
{
|
|
if (Convert.ToDouble(item["Percentuale"]) > maxValuePerc)
|
|
{
|
|
maxValuePerc = Convert.ToDouble(item["Percentuale"]);
|
|
}
|
|
serieCollezione[0].Points.Add(new Point
|
|
{
|
|
|
|
ShowLabelAxisY = true,
|
|
LabelAxisY = Helper.FormatDecimal(item["Percentuale"].ToString(), 2),//non vogliono il simbolo %
|
|
FontSizeLabelAxisY = 7,
|
|
|
|
Color = new ColorPDF(Convert.ToInt32(item["Red"]), Convert.ToInt32(item["Green"]), Convert.ToInt32(item["Blue"])),
|
|
Value = Convert.ToDouble(item["Percentuale"]) == 0 ? 0.01 : Convert.ToDouble(item["Percentuale"]),
|
|
|
|
ShowLabelAxisX = true,
|
|
LabelAxisX = string.Format("{0}<BR/>", item["Patrimonio"].ToString()),
|
|
FontSizeLabelAxisX = 7,
|
|
FontColorLabelAxisX = ColorPDF.Nero,
|
|
FontBoldLabelAxisX = false,
|
|
FontBoldLabelAxisY = false
|
|
});
|
|
}
|
|
|
|
graficoBarre.SeriesCollection = serieCollezione;
|
|
graficoBarre.MaximumValueAxisY = maxValuePerc + 11;
|
|
#endregion
|
|
AddElement(graficoBarre);
|
|
// AddElement(graficoBarre);
|
|
AddElement(new RectanglePDF(EnvironmentFacade.RendererFacade.XLeftLimit + 260, 140, 255, ColorPDF.Bianco) { BorderWidth = 0.5F, BorderColor = ColorPDF.ConsulenzaUnica_Grigio_SfondoColonnaHeaderFooterTabella,AutoIncrementYWritable=false });
|
|
AddElement(new SpacePDF(6));
|
|
#region grafico combination
|
|
var graficoCombination = new CombinationPDF(EnvironmentFacade.RendererFacade.XLeftLimit + 300, 1F)
|
|
{
|
|
Height = 100,
|
|
Width = 190,
|
|
MinorGridAxisY = true,
|
|
//showZeroInLabel = true,
|
|
MarginAxisY = 0,
|
|
ShowLineAxisY = true,
|
|
ShowLabelAxisY = true,
|
|
LabelFormatAxisY = FormatType.Percentuale,
|
|
LabelFormatAxisX = FormatType.DataShort,
|
|
ShowLineAxisX = true,
|
|
IntervalNumberAxisX = 5
|
|
|
|
};
|
|
|
|
// creo le Serie
|
|
var serieCombination = new List<Serie>()
|
|
{
|
|
new Serie { Name = "Ottimistico", Type = Dundas.Charting.WebControl.SeriesChartType.Line, BorderWidth = 6 },
|
|
new Serie { Name = "Pessimistico", Type = Dundas.Charting.WebControl.SeriesChartType.Line, BorderWidth = 6},
|
|
new Serie() { Name = "Medio", Type = Dundas.Charting.WebControl.SeriesChartType.Line, BorderWidth = 6 }
|
|
};
|
|
var dts = dati.Tables["evoluzioneRendimento" + i].AsEnumerable().OrderBy(o => o.Field<DateTime>("Data")).CopyToDataTable();
|
|
// valorizzo le Serie
|
|
foreach (DataRow item in dts.Rows)
|
|
{
|
|
|
|
#region Serie Ottimistico
|
|
serieCombination[0].Points.Add(new Point
|
|
{
|
|
Color = _scenarioOtt,// new ColorPDF(114, 174, 198),
|
|
Values = new ValuesPointXY(Convert.ToDateTime(item["Data"]).ToOADate(), Convert.ToDouble(item["Ottimistico"])) { },
|
|
ShowLabelAxisY = false,
|
|
FontSizeLabelAxisX = 7,
|
|
FontSizeLabelAxisY = 7,
|
|
LabelAxisY = Helper.FormatPercentage(Convert.ToDecimal(item["Ottimistico"]), 2),
|
|
FontBoldLabelAxisY = false,
|
|
FontBoldLabelAxisX = false,
|
|
ShowLabelAxisX = false
|
|
});
|
|
#endregion
|
|
|
|
#region Serie Pessimistico
|
|
serieCombination[1].Points.Add(new Point
|
|
{
|
|
Color = _scenarioPess,// new ColorPDF(233, 202, 133),
|
|
Values = new ValuesPointXY(Convert.ToDateTime(item["Data"]).ToOADate(), Convert.ToDouble(item["Pessimistico"])),
|
|
ShowLabelAxisY = false,
|
|
LabelAxisY = Helper.FormatPercentage(Convert.ToDecimal(item["Pessimistico"]), 2),
|
|
FontSizeLabelAxisY =7,
|
|
FontSizeLabelAxisX = 7,
|
|
FontBoldLabelAxisY = false,
|
|
FontBoldLabelAxisX = false,
|
|
ShowLabelAxisX = false
|
|
});
|
|
#endregion
|
|
|
|
#region Serie Media
|
|
if (presenzaColonnaScenarioMedio())
|
|
{
|
|
serieCombination[2].Points.Add(new Point
|
|
{
|
|
Color = _scenarioMed,// new ColorPDF(0, 0, 0),
|
|
Values = new ValuesPointXY(Convert.ToDateTime(item["Data"]).ToOADate(), Convert.ToDouble(item["Medio"])),
|
|
ShowLabelAxisY = false,
|
|
LabelAxisY = Helper.FormatPercentage(Convert.ToDecimal(item["Medio"]), 2),
|
|
FontSizeLabelAxisY = 7,
|
|
FontBoldLabelAxisY = false,
|
|
FontBoldLabelAxisX = false,
|
|
FontSizeLabelAxisX = 7,
|
|
ShowLabelAxisX = false
|
|
});
|
|
}
|
|
#endregion
|
|
}
|
|
#endregion
|
|
// aggiungo le Serie al grafico
|
|
graficoCombination.SeriesCollection = serieCombination;
|
|
|
|
//aggiungo il grafico alla pagina
|
|
AddElement(new SpacePDF(15));
|
|
|
|
AddElement(graficoCombination);
|
|
|
|
#region scenari
|
|
|
|
var dtscenari = new DataTable();
|
|
dtscenari.Columns.Add("Rettangolo", typeof(string));
|
|
dtscenari.Columns.Add("Descrizione", typeof(string));
|
|
dtscenari.Columns.Add("Valore", typeof(string));
|
|
|
|
foreach (DataRow ro in dati.Tables["scenari" + i].Rows)
|
|
{
|
|
dtscenari.Rows.Add("", ro["Descrizione"].ToString(), Helper.FormatCurrency(Convert.ToDecimal(ro["Valore"]).ToString()));
|
|
}
|
|
|
|
var tabellaScenari = new TablePDF(EnvironmentFacade.RendererFacade.XLeftLimit + 260, dtscenari)
|
|
{
|
|
Style = Style.ConsulenzaUnica,
|
|
Header = true,
|
|
Footer = true,
|
|
AlternateRow = false,
|
|
RowHeight = 25,
|
|
HideLastSeparationLine = false
|
|
};
|
|
//tabellaScenari.Columns.Add(new ColumnPDF("img", 15, HorizontalAlignmentType.Sinistra, false, false, 8, ColumnType.Objectpdf, "Rettangolo", "") { PaddingLeft = 5, DeltaYContent = 12 });
|
|
tabellaScenari.Columns.Add(new ColumnPDF("descr", 165, HorizontalAlignmentType.Sinistra, false, false, 7, ColumnType.Objectpdf, "Descrizione", "Scenari possibili") { PaddingLeft = 5, HeaderFontSize = 7, FontSize = 7 });
|
|
tabellaScenari.Columns.Add(new ColumnPDF("valore", 90, HorizontalAlignmentType.Destra, false, false, 7, ColumnType.Testo, "Valore", "A scadenza (%)") { HeaderFontSize = 7, FontSize = 7 });
|
|
|
|
for (int l=0;l<dtscenari.Rows.Count;l++)
|
|
{
|
|
DataRow row = dtscenari.Rows[l];
|
|
ColorPDF colorPDF = row["Descrizione"].ToString().Equals("Ottimistico") ? _scenarioOtt :
|
|
row["Descrizione"].ToString().Equals("Pessimistico") ? _scenarioPess :
|
|
row["Descrizione"].ToString().Equals("Medio") ? _scenarioMed :
|
|
new ColorPDF(255,255,255);
|
|
tabellaScenari.Cells[0, l].ValueObjectList.Add(new RectanglePDF(2, 15, colorPDF) {DeltaY = 12 });
|
|
tabellaScenari.Cells[0, l].ValueObjectList.Add(new FormattedTextAreaPDF() { Text = row["Descrizione"].ToString(), DeltaX = 19, DeltaY = 4, FontSize = 7 });
|
|
|
|
|
|
}
|
|
|
|
#endregion
|
|
|
|
AddElement(new SpacePDF(40));
|
|
AddElement(tabellaScenari);
|
|
#region statistiche
|
|
if (presenzaTabellaStatistiche())
|
|
{
|
|
var tabellaStatistiche = new TablePDF(EnvironmentFacade.RendererFacade.XLeftLimit + 260, dati.Tables["statistiche" + i])
|
|
{
|
|
Style = Style.ConsulenzaUnica,
|
|
Header = true,
|
|
Footer = true,
|
|
AlternateRow = false,
|
|
RowHeight = 25,
|
|
HideLastSeparationLine = false
|
|
//ShowBorderLastLine = true
|
|
};
|
|
tabellaStatistiche.Columns.Add(new ColumnPDF("descrst", 165, HorizontalAlignmentType.Sinistra, false, false, 7, ColumnType.Testo, "Descrizione", "Statistiche") { PaddingLeft = 5, HeaderFontSize = 7, FontSize = 7 });
|
|
tabellaStatistiche.Columns.Add(new ColumnPDF("valorest", 90, HorizontalAlignmentType.Destra, false, false, 7, ColumnType.Testo, "Valore", "") { PaddingLeft = 5, HeaderFontSize = 7, FontSize = 7, PaddingRight=4 });
|
|
|
|
AddElement(new SpacePDF(10));
|
|
AddElement(tabellaStatistiche);
|
|
}
|
|
#endregion
|
|
}
|
|
}
|
|
/// <summary>
|
|
/// Recupera i dati necessari alla Section restituendo un DataTable.
|
|
/// </summary>
|
|
/// <returns></returns>
|
|
protected sealed override DataTable GetDataTable()
|
|
{
|
|
return null;
|
|
}
|
|
|
|
/// <summary>
|
|
/// Recupera i dati necessari alla Section restituendo un DataSet.
|
|
/// </summary>
|
|
/// <returns></returns>
|
|
protected override DataSet GetDataSet()
|
|
{
|
|
var ds = new DataSet();
|
|
|
|
ds.Tables.Add(new DataTable("NomeProgetto"));
|
|
ds.Tables["NomeProgetto"].Columns.Add(new DataColumn("NomeProgetto", typeof(string)));
|
|
ds.Tables["NomeProgetto"].Columns.Add(new DataColumn("ChiaveProgetto", typeof(string)));
|
|
// datiSeiUnico.pianificazioneUnit().pianificazioneVerticale.aree.ctvProgetto
|
|
var areaModelloInv = (datiSeiUnico.piramideModelloUnit().piramideModello.areaModello.Where(o => o.area.Equals("Inv"))).First();//.pr.Where(o => o.area.Equals("Inv")).ToList();
|
|
var listaProgettiSignificativi = areaModelloInv.progettiPiramideModello.ToList();
|
|
var listaProgettiInvestimento = datiSeiUnico.pianificazioneUnit().pianificazioneOrizzontale.Where(o => o.portafoglioModello.area.Equals("Inv")).ToList();
|
|
var listaProgettiCtv = datiSeiUnico.pianificazioneUnit().pianificazioneVerticale.aree.FirstOrDefault(o => o.area.Equals("Inv")).progetti.ToList();
|
|
|
|
if (listaProgettiInvestimento != null)
|
|
{
|
|
var displayInfoM = datiSeiUnico.displayInfos().macroAssetDisplayInfos.ToList();
|
|
var displayInfoA = datiSeiUnico.displayInfos().assetDisplayInfos.ToList();
|
|
int i = 0;
|
|
foreach (progettoPianificazioneBean prog in from o in listaProgettiCtv
|
|
join a in listaProgettiInvestimento on o.chiaveProgetto equals a.chiaveProgetto
|
|
orderby o.ctvProgetto descending, o.varPianificato descending, o.portafoglioModello.orizzonteTemporale descending, a.nomeProgetto ascending
|
|
select o) {
|
|
var item = listaProgettiInvestimento.Where(p => p.chiaveProgetto == prog.chiaveProgetto).First();
|
|
//var item2 = listaProgettiSignificativi.Where(p => p.chiaveProgettoMod == item.chiavePrgMod).First();
|
|
|
|
|
|
ds.Tables["NomeProgetto"].Rows.Add(item.nomeProgetto, item.chiaveProgetto);
|
|
#region tabelle
|
|
string labelcontrovalore = "labelControvalore" + i;
|
|
string assetclass = "assetClass" + i;
|
|
string evoluzioneRendimento = "evoluzioneRendimento" + i;
|
|
string scenari = "scenari" + i;
|
|
string statistiche = "statistiche" + i;
|
|
ds.Tables.Add(new DataTable(labelcontrovalore));
|
|
ds.Tables.Add(new DataTable(assetclass));
|
|
ds.Tables.Add(new DataTable(evoluzioneRendimento));
|
|
ds.Tables.Add(new DataTable(scenari));
|
|
ds.Tables.Add(new DataTable(statistiche));
|
|
#endregion
|
|
#region patrimonio controvalore
|
|
ds.Tables[labelcontrovalore].Columns.Add("controvalore", typeof(string));
|
|
ds.Tables[labelcontrovalore].Columns.Add("valore", typeof(string));
|
|
ds.Tables[labelcontrovalore].Columns.Add("descrizione", typeof(string));
|
|
ds.Tables[labelcontrovalore].Columns.Add("val", typeof(string));
|
|
ds.Tables[labelcontrovalore].Rows.Add(
|
|
"Orizzonte temporale",
|
|
item.portafoglioModello.orizzonteTemporale.ToString() + (int.Parse(item.portafoglioModello.orizzonteTemporale.ToString()) > 1 ? " anni" : " anno"),
|
|
"Rischio Mercato (VaR %)",
|
|
Helper.FormatDecimal(item.varPianificatoDec, 2));
|
|
|
|
#endregion
|
|
#region portafoglio modello
|
|
var portafogliomodello = item.portafoglioModello;
|
|
var coni = item.cono.ToList();
|
|
var valoriAssetModello = isAssetClass() ? portafogliomodello.distribuzioniPtfModello.Where(l => l.asset.livello == 2).ToList() : portafogliomodello.distribuzioniPtfModello.Where(l => l.asset.livello == 1).ToList();
|
|
|
|
ds.Tables[assetclass].Columns.Add(new DataColumn("Patrimonio", typeof(string)));
|
|
ds.Tables[assetclass].Columns.Add(new DataColumn("Red", typeof(int)));
|
|
ds.Tables[assetclass].Columns.Add(new DataColumn("Green", typeof(int)));
|
|
ds.Tables[assetclass].Columns.Add(new DataColumn("Blue", typeof(int)));
|
|
ds.Tables[assetclass].Columns.Add(new DataColumn("Percentuale", typeof(decimal)));
|
|
//ds.Tables[assetclass].Columns.Add(new DataColumn("Ordinamento", typeof(int)));
|
|
|
|
|
|
|
|
if (isAssetClass())
|
|
{
|
|
foreach (var valore in from c in displayInfoA
|
|
join l in valoriAssetModello on c.key equals l.asset.asset
|
|
orderby c.value.order
|
|
select new
|
|
{
|
|
|
|
l.asset.descrizione,
|
|
new ColorPDF(c.value.fill).Red,
|
|
new ColorPDF(c.value.fill).Green,
|
|
new ColorPDF(c.value.fill).Blue,
|
|
l.percentuale
|
|
})
|
|
{
|
|
ds.Tables[assetclass].Rows.Add(
|
|
|
|
valore.descrizione,
|
|
valore.Red,
|
|
valore.Green,
|
|
valore.Blue,
|
|
valore.percentuale * 100
|
|
);
|
|
}
|
|
}
|
|
else
|
|
{
|
|
|
|
foreach (var valore in from c in displayInfoM
|
|
join l in valoriAssetModello on c.key equals l.asset.asset
|
|
orderby c.value.order
|
|
select new
|
|
{
|
|
|
|
l.asset.descrizione,
|
|
new ColorPDF(c.value.fill).Red,
|
|
new ColorPDF(c.value.fill).Green,
|
|
new ColorPDF(c.value.fill).Blue,
|
|
l.percentuale
|
|
})
|
|
{
|
|
ds.Tables[assetclass].Rows.Add(
|
|
|
|
valore.descrizione,
|
|
valore.Red,
|
|
valore.Green,
|
|
valore.Blue,
|
|
valore.percentuale * 100
|
|
);
|
|
}
|
|
}
|
|
// ds.Tables.Add(ds.Tables[assetclass].AsEnumerable().OrderBy(r => r.Field<int>("Ordinamento")).CopyToDataTable());
|
|
#endregion
|
|
#region evoluzione rendimento
|
|
|
|
ds.Tables[evoluzioneRendimento].Columns.Add(new DataColumn("Data", typeof(DateTime)));
|
|
ds.Tables[evoluzioneRendimento].Columns.Add(new DataColumn("Ottimistico", typeof(decimal)));
|
|
ds.Tables[evoluzioneRendimento].Columns.Add(new DataColumn("Pessimistico", typeof(decimal)));
|
|
|
|
|
|
if (presenzaColonnaScenarioMedio())
|
|
ds.Tables[evoluzioneRendimento].Columns.Add(new DataColumn("Medio", typeof(decimal)));
|
|
|
|
foreach (var cono in coni)
|
|
{
|
|
if (presenzaColonnaScenarioMedio())
|
|
ds.Tables[evoluzioneRendimento].Rows.Add(cono.dtRiferimento, Convert.ToDecimal(cono.quantileSup * 100), Convert.ToDecimal(cono.quantileInf * 100), Convert.ToDecimal(cono.quantileInter * 100));
|
|
else
|
|
ds.Tables[evoluzioneRendimento].Rows.Add(cono.dtRiferimento, Convert.ToDecimal(cono.quantileSup * 100), Convert.ToDecimal(cono.quantileInf * 100));
|
|
}
|
|
#endregion
|
|
#region scenari
|
|
|
|
var valoreott = coni.AsEnumerable().OrderByDescending(x => x.dtRiferimento).First().quantileSup;
|
|
var valorepes = coni.AsEnumerable().OrderByDescending(x => x.dtRiferimento).First().quantileInf;
|
|
var valoremed = coni.AsEnumerable().OrderByDescending(x => x.dtRiferimento).First().quantileInter;
|
|
|
|
ds.Tables[scenari].Columns.Add(new DataColumn("Descrizione", typeof(string)));
|
|
ds.Tables[scenari].Columns.Add(new DataColumn("Valore", typeof(decimal)));
|
|
ds.Tables[scenari].Rows.Add("Ottimistico", Convert.ToDecimal(valoreott * 100));
|
|
if (presenzaColonnaScenarioMedio())
|
|
ds.Tables[scenari].Rows.Add("Medio", Convert.ToDecimal(valoremed * 100));
|
|
ds.Tables[scenari].Rows.Add("Pessimistico", Convert.ToDecimal(valorepes * 100));
|
|
|
|
|
|
#endregion
|
|
|
|
#region statistiche
|
|
if (presenzaTabellaStatistiche())
|
|
{
|
|
ds.Tables[statistiche].Columns.Add(new DataColumn("Descrizione", typeof(string)));
|
|
ds.Tables[statistiche].Columns.Add(new DataColumn("Valore", typeof(string)));
|
|
ds.Tables[statistiche].Rows.Add("Tempo minimo di investimento",item.minTimeDec);//poi vediamo se un valore è 1 anno e 2 mesi e perdita stimata in percentuale....mah
|
|
ds.Tables[statistiche].Rows.Add("Perdita massima stimata (%)", Helper.FormatDecimal((item.maxLoss * 100).ToString(),2));
|
|
|
|
}
|
|
#endregion
|
|
i++;
|
|
}
|
|
}
|
|
return ds;
|
|
|
|
}
|
|
|
|
public virtual bool isAssetClass()
|
|
{
|
|
return GetOption<Opzione3>().Valore;
|
|
}
|
|
|
|
public virtual bool presenzaColonnaScenarioMedio()
|
|
{
|
|
return GetOption<Opzione4_1>().Valore;
|
|
}
|
|
|
|
public virtual bool presenzaTabellaStatistiche()
|
|
{
|
|
return GetOption<Opzione4_2>().Valore;
|
|
}
|
|
|
|
public virtual string getTestoIntro()
|
|
{
|
|
return isAssetClass() ?
|
|
presenzaColonnaScenarioMedio() ? "In questa scheda sono riportate le informazioni di dettaglio relative al portafoglio modello associato al progetto di investimento \"" + TitoloProgetto + "\": orizzonte temporale, livello di rischio in termini di Rischio Mercato (VaR), asset allocation, possibile evoluzione del rendimento sulla base di tre scenari simulati (ottimistico, medio, pessimistico)." : "In questa scheda sono riportate le informazioni di dettaglio relative al portafoglio modello associato al progetto di investimento \"" + TitoloProgetto + "\": orizzonte temporale, livello di rischio in termini di Rischio Mercato (VaR), asset allocation, possibile evoluzione del rendimento sulla base di due scenari simulati (ottimistico, pessimistico)." :
|
|
presenzaColonnaScenarioMedio() ? "In questa scheda sono riportate le informazioni di dettaglio relative al portafoglio modello associato al progetto di investimento \"" + TitoloProgetto + "\": orizzonte temporale, livello di rischio in termini di Rischio Mercato (VaR), macro asset allocation, possibile evoluzione del rendimento sulla base di tre scenari simulati (ottimistico, medio, pessimistico)." : "In questa scheda sono riportate le informazioni di dettaglio relative al portafoglio modello associato al progetto di investimento \"" + TitoloProgetto + "\": orizzonte temporale, livello di rischio in termini di Rischio Mercato (VaR), macro asset allocation, possibile evoluzione del rendimento sulla base di due scenari simulati (ottimistico, pessimistico).";
|
|
}
|
|
}
|
|
}
|