596 lines
27 KiB
C#
596 lines
27 KiB
C#
using System;
|
|
using Consulenza.ReportWriter.Business;
|
|
using Consulenza.ReportWriter.Business.OBJ_PDF;
|
|
using System.Data;
|
|
using Consulenza.ReportCommon;
|
|
using Consulenza.ReportWriter.Business.CHART_PDF;
|
|
using System.Collections.Generic;
|
|
using Consulenza.ReportWriter.Business.Entity;
|
|
using System.Linq;
|
|
using Consulenza.DataServices.fideuram.data.service;
|
|
using Dundas.Charting.WebControl;
|
|
|
|
namespace Consulenza.ReportWriter.Manager.Section.Unica
|
|
{
|
|
public class S70 : Entity.Section
|
|
{
|
|
|
|
|
|
/// <summary>
|
|
/// S70.MonitoraggioAreaExtraRendimento idSezione = 113
|
|
/// </summary>
|
|
public S70(EnvironmentFacade environmentFacade, int idSection)
|
|
: base(environmentFacade, idSection)
|
|
{
|
|
try
|
|
{
|
|
|
|
Draw();
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
SectionLogger.Write("S70", ex.Message, SectionLoggerMessageLevel.E, EnvironmentFacade.ReportEnvironment);
|
|
}
|
|
}
|
|
|
|
protected override sealed void Draw()
|
|
{
|
|
var dati = GetDataSet();
|
|
// 1st table
|
|
var dati1 = dati.Tables["risorseApportate"].Clone();
|
|
var dati2 = dati.Tables["risorseApportate"].Clone();
|
|
var dati3 = dati.Tables["risorseApportate"].Clone();
|
|
dati1.Rows.Clear();
|
|
dati2.Rows.Clear();
|
|
dati3.Rows.Clear();
|
|
|
|
for (int i = 0; i < 3; i++)
|
|
{
|
|
dati1.Rows.Add(dati.Tables["risorseApportate"].Rows[i].ItemArray);
|
|
}
|
|
for (int i = 3; i < 5; i++)
|
|
{
|
|
dati2.Rows.Add(dati.Tables["risorseApportate"].Rows[i].ItemArray);
|
|
}
|
|
for (int i = 5; i < dati.Tables["risorseApportate"].Rows.Count; i++)
|
|
{
|
|
dati3.Rows.Add(dati.Tables["risorseApportate"].Rows[i].ItemArray);
|
|
}
|
|
|
|
var serieCombination = new List<Serie>();
|
|
|
|
#region Tabella delle Risorse Apportate
|
|
|
|
var tabellaRisorseApportate = new TablePDF(EnvironmentFacade.RendererFacade.XLeftLimit, dati1)
|
|
{
|
|
Style = Style.ConsulenzaUnica,
|
|
Header = true,
|
|
Footer = false,
|
|
AlternateRow = false,
|
|
RowHeight = 25,
|
|
ID = "d1",
|
|
HeaderMargin = 3
|
|
};
|
|
tabellaRisorseApportate.Columns.Add(new ColumnPDF("descrizione", 145, HorizontalAlignmentType.Sinistra, true, false, 7, ColumnType.Testo, "descrizione", string.Empty));
|
|
tabellaRisorseApportate.Columns.Add(new ColumnPDF("valore", 75, HorizontalAlignmentType.Destra, false, false, 7, ColumnType.Testo, "valore", string.Empty)
|
|
{ PaddingLeft = 5 });
|
|
|
|
tabellaRisorseApportate.Row[0].BackgroundGray = false;
|
|
tabellaRisorseApportate.Row[0].Visible = false;
|
|
tabellaRisorseApportate.HeaderText = dati.Tables["risorseApportate"].Rows[0].ItemArray[0] + " " + dati.Tables["risorseApportate"].Rows[0].ItemArray[1];
|
|
AddElement(tabellaRisorseApportate);
|
|
|
|
var rectangleGray1 = new RectanglePDF(EnvironmentFacade.RendererFacade.XLeftLimit + 145, 1, 75, new ColorPDF(232, 236, 237))
|
|
{
|
|
AutoIncrementYWritable = false,
|
|
DeltaY = -1
|
|
};
|
|
var rectangleGray2 = new RectanglePDF(EnvironmentFacade.RendererFacade.XLeftLimit + 145, 1, 75, new ColorPDF(232, 236, 237))
|
|
{
|
|
AutoIncrementYWritable = false,
|
|
DeltaY = 53.3f
|
|
};
|
|
|
|
AddElement(rectangleGray1);
|
|
AddElement(rectangleGray2);
|
|
var tabellaRisorseApportate2 = new TablePDF(EnvironmentFacade.RendererFacade.XLeftLimit + 45, dati2)
|
|
{
|
|
Style = Style.ConsulenzaUnica,
|
|
Header = false,
|
|
Footer = false,
|
|
AlternateRow = false,
|
|
RowHeight = 25,
|
|
ID = "d2",
|
|
YOffset = 1f
|
|
};
|
|
tabellaRisorseApportate2.ShowSeparationLines = true;
|
|
tabellaRisorseApportate2.WidthSeparationLines = 0.2f;
|
|
|
|
tabellaRisorseApportate2.Columns.Add(new ColumnPDF("descrizione", 100, HorizontalAlignmentType.Sinistra, true, false, 7, ColumnType.Testo, "descrizione", string.Empty));
|
|
tabellaRisorseApportate2.Columns.Add(new ColumnPDF("valore", 75, HorizontalAlignmentType.Destra, false, false, 7, ColumnType.Testo, "valore", string.Empty)
|
|
{ PaddingLeft = 5 });
|
|
AddElement(tabellaRisorseApportate2);
|
|
|
|
var tabellaRisorseApportate3 = new TablePDF(EnvironmentFacade.RendererFacade.XLeftLimit, dati3)
|
|
{
|
|
Style = Style.ConsulenzaUnica,
|
|
Header = false,
|
|
Footer = false,
|
|
AlternateRow = false,
|
|
RowHeight = 25,
|
|
ID = "d3",
|
|
YOffset = 2f
|
|
};
|
|
tabellaRisorseApportate3.Columns.Add(new ColumnPDF("descrizione", 145, HorizontalAlignmentType.Sinistra, true, false, 7, ColumnType.Testo, "descrizione", string.Empty));
|
|
tabellaRisorseApportate3.Columns.Add(new ColumnPDF("valore", 75, HorizontalAlignmentType.Destra, false, false, 7, ColumnType.Testo, "valore", string.Empty)
|
|
{ PaddingLeft = 5 });
|
|
AddElement(tabellaRisorseApportate3);
|
|
|
|
|
|
if (GetNote1().Length > 0)
|
|
{
|
|
AddElement(new SpacePDF(7));
|
|
AddElement(new FormattedTextAreaPDF(GetNote1(), EnvironmentFacade.RendererFacade.XLeftLimit, 520) {FontSize=6, TextHorizontalAlign = ceTe.DynamicPDF.TextAlign.Justify });
|
|
AddElement(new SpacePDF(15));
|
|
}
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
AddElement(new ResetterYPDF());
|
|
AddElement(new SpacePDF(90));
|
|
|
|
#region Grafico Risorse Apportate
|
|
|
|
AddElement(new FormattedTextAreaPDF("Valori espressi in migliaia di euro", EnvironmentFacade.RendererFacade.XLeftLimit, 520) {FontSize=7, TextHorizontalAlign = ceTe.DynamicPDF.TextAlign.Right });
|
|
AddElement(new SpacePDF(7));
|
|
|
|
var coloreSerieRisorseApportate = new ColorPDF(95, 215, 95); //TODO
|
|
var coloreSerieControvaloreMonetario = ColorPDF.Nero; //TODO
|
|
|
|
var graficoCombination = new CombinationPDF(EnvironmentFacade.RendererFacade.XLeftLimit + 260, 1F)
|
|
{
|
|
Height = 190,
|
|
Width = 260,
|
|
MinorGridAxisY = true,
|
|
ShowLegend = false,
|
|
LegendWidthColumns = new List<int> { 20, 5, 100 },
|
|
LegendSymbolHeight = 5,
|
|
LegendDeltaX = 50,
|
|
LegendFontSizeText = 7,
|
|
LegendSymbolDeltaY = 7,
|
|
|
|
MarginAxisY = 0,
|
|
ShowLineAxisY = true,
|
|
ShowLabelAxisY = true,
|
|
LabelFormatAxisY = FormatType.Intero,
|
|
IntervalNumberAxisY = 5,
|
|
StartFromZeroAxisY = true,
|
|
|
|
LabelFormatAxisX = FormatType.Data,
|
|
ShowLineAxisX = true,
|
|
ShowLabelAxisX = false,
|
|
IntervalNumberAxisX = 4
|
|
};
|
|
|
|
|
|
serieCombination = new List<Serie>()
|
|
{
|
|
new Serie { Name = "RisorseApportate", Type = Dundas.Charting.WebControl.SeriesChartType.Area, Text = "Risorse apportate", Color = coloreSerieRisorseApportate },
|
|
new Serie { Name = "ControvaloreMonitorato", Type = Dundas.Charting.WebControl.SeriesChartType.Line, BorderWidth = 3, Text = "Controvalore monitorato", Color = coloreSerieControvaloreMonetario }
|
|
|
|
};
|
|
|
|
|
|
foreach (DataRow item in dati.Tables["risorseApportateMonitorato"].Rows)
|
|
{
|
|
|
|
|
|
#region Serie RisorseApportate
|
|
serieCombination[0].Points.Add(new Point
|
|
{
|
|
Color = coloreSerieRisorseApportate,
|
|
Values = new ValuesPointXY(Convert.ToDateTime(item["Data"]).ToOADate(), Convert.ToDouble(item["RisorseApportate"])),
|
|
ShowLabelAxisY = false,
|
|
LabelAxisY = "RisorseApportate",
|
|
FontSizeLabelAxisY = 8,
|
|
FontBoldLabelAxisY = false,
|
|
ShowLabelAxisX = false,
|
|
});
|
|
#endregion
|
|
|
|
|
|
#region Serie ControvaloreMonitorato
|
|
serieCombination[1].Points.Add(new Point
|
|
{
|
|
Color = coloreSerieControvaloreMonetario,
|
|
Values = new ValuesPointXY(Convert.ToDateTime(item["Data"]).ToOADate(), Convert.ToDouble(item["ControvaloreMonitorato"])),
|
|
ShowLabelAxisY = false,
|
|
LabelAxisY = "ControvaloreMonitorato",
|
|
FontSizeLabelAxisY = 8,
|
|
FontBoldLabelAxisY = false,
|
|
ShowLabelAxisX = false
|
|
});
|
|
#endregion
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
graficoCombination.SeriesCollection = serieCombination;
|
|
|
|
AddElement(graficoCombination);
|
|
AddElement(new SpacePDF(5));
|
|
AddElement(new RectanglePDF(EnvironmentFacade.RendererFacade.XLeftLimit + 270, 10, 20, coloreSerieControvaloreMonetario) { AutoIncrementYWritable = false });
|
|
AddElement(new FormattedTextAreaPDF("Controvalore monitorato", EnvironmentFacade.RendererFacade.XLeftLimit + 270 + 25) { AutoIncrementYWritable = false, FontSize =7 });
|
|
AddElement(new RectanglePDF(EnvironmentFacade.RendererFacade.XLeftLimit + 270 + 130, 10, 20, coloreSerieRisorseApportate) { AutoIncrementYWritable = false });
|
|
AddElement(new FormattedTextAreaPDF("Risorse apportate", EnvironmentFacade.RendererFacade.XLeftLimit + 270 + 155) { AutoIncrementYWritable = false, FontSize = 7 });
|
|
AddElement(new SpacePDF(15));
|
|
#endregion
|
|
|
|
|
|
if (GraficoRendimentoCumulato())
|
|
{
|
|
#region Grafico Rendimento Cumulato
|
|
|
|
AddElement(new SpacePDF(20));
|
|
AddElement(new FormattedTextAreaPDF(getTesto2(), EnvironmentFacade.RendererFacade.XLeftLimit) {FontSize=7, TextHorizontalAlign = ceTe.DynamicPDF.TextAlign.Justify });
|
|
AddElement(new SpacePDF(20));
|
|
|
|
//AddElement(new FormattedTextAreaPDF("%", EnvironmentFacade.RendererFacade.XLeftLimit) { TextVerticalDirection = true, DeltaY = 100 });
|
|
|
|
var coloreSerieRendimentoCumulato = ColorPDF.Nero;
|
|
var coloreSerieScenarioPessimistico = ColorPDF.Rosso;
|
|
var coloreSerieScenarioOttimistico = ColorPDF.Blu;
|
|
|
|
var graficoCombination_RendimentoCumulato = new CombinationPDF(EnvironmentFacade.RendererFacade.XLeftLimit + 30, 1F)
|
|
{
|
|
Height = 185,
|
|
Width = 470,
|
|
|
|
MinorGridAxisY = true,
|
|
//BugFix #3758 - Distanziamento voci legenda
|
|
LegendWidthColumns = new List<int> { 12, 5, 110 },
|
|
LegendSymbolHeight = 1,
|
|
ShowLegend = false,
|
|
LegendFontSizeText = 7,
|
|
LegendSymbolDeltaY = 9,
|
|
LegendDeltaX = !ConoEvoluzione() ? 230 : RendimentoCumulanto() ? 130 : 180,
|
|
showZeroInLabel = true,
|
|
MarginAxisY = 0,
|
|
|
|
ShowLineAxisY = true,
|
|
ShowLabelAxisY = true,
|
|
LabelFormatAxisY = FormatType.Decimale2,
|
|
|
|
ShowLineAxisX = true,
|
|
ShowLabelAxisX = true,
|
|
LabelFormatAxisX = FormatType.DataShort,
|
|
LegendYOffset = 6,
|
|
SeriesCollection = new List<Serie>(),
|
|
ChartBaseWidth = 840,
|
|
ChartBaseHeight = 350,
|
|
};
|
|
|
|
#region Serie ScenarioOttimistico
|
|
|
|
Serie ScenarioOttimistico = new Serie()
|
|
{
|
|
Name = "ScenarioOttimistico",
|
|
Type = Dundas.Charting.WebControl.SeriesChartType.Line,
|
|
Color = coloreSerieScenarioOttimistico,
|
|
BorderWidth = 2,
|
|
Text = "Scenario ottimistico ",
|
|
ShowInLegend = ConoEvoluzione()
|
|
};
|
|
graficoCombination_RendimentoCumulato.SeriesCollection.Add(ScenarioOttimistico);
|
|
#endregion
|
|
#region Serie RendimentoCumulato_Punto
|
|
Serie RendimentoCumulato_Punto = new Serie()
|
|
{
|
|
Name = "RendimentoCumulato_Punto",
|
|
Type = Dundas.Charting.WebControl.SeriesChartType.Point,
|
|
Text = "",
|
|
BorderWidth = 2,
|
|
Color = coloreSerieRendimentoCumulato,
|
|
ShowInLegend = false,
|
|
AutoCalculateLastPointLabelPosition = true
|
|
};
|
|
graficoCombination_RendimentoCumulato.SeriesCollection.Add(RendimentoCumulato_Punto);
|
|
#endregion
|
|
#region Serie RendimentoCumulato_Linea
|
|
Serie RendimentoCumulato_Linea = new Serie()
|
|
{
|
|
Name = "RendimentoCumulato_Linea",
|
|
Type = Dundas.Charting.WebControl.SeriesChartType.Line,
|
|
Color = coloreSerieRendimentoCumulato,
|
|
BorderWidth = 2,
|
|
Text = "Rendimento cumulato ",
|
|
ShowInLegend = RendimentoCumulanto(),
|
|
AutoCalculateLastPointLabelPosition = true
|
|
};
|
|
graficoCombination_RendimentoCumulato.SeriesCollection.Add(RendimentoCumulato_Linea);
|
|
#endregion
|
|
#region Serie ScenarioPessimistico
|
|
Serie ScenarioPessimistico = new Serie()
|
|
{
|
|
Name = "ScenarioPessimistico",
|
|
Type = Dundas.Charting.WebControl.SeriesChartType.Line,
|
|
Color = coloreSerieScenarioPessimistico,
|
|
BorderWidth = 2,
|
|
Text = "Scenario pessimistico",
|
|
ShowInLegend = ConoEvoluzione()
|
|
};
|
|
graficoCombination_RendimentoCumulato.SeriesCollection.Add(ScenarioPessimistico);
|
|
#endregion
|
|
|
|
foreach (DataRow item in dati.Tables["rendimentoCumulato"].Rows)
|
|
{
|
|
#region Serie RendimentoCumulato_Punto
|
|
RendimentoCumulato_Punto.Points.Add(new Point
|
|
{
|
|
Color = coloreSerieRendimentoCumulato,
|
|
Values = new ValuesPointXY(Convert.ToDateTime(item["Data"]).ToOADate(), Convert.ToDouble(item["Percentuale"])),
|
|
Visible = false,
|
|
Label = string.Format("Rend. cumulato {0}", Helper.FormatPercentage(Convert.ToDecimal(item["Percentuale"]), 2)),
|
|
Font = new System.Drawing.Font("verdana", 8.8F)
|
|
});
|
|
#endregion
|
|
#region Serie RendimentoCumulato_Linea
|
|
RendimentoCumulato_Linea.Points.Add(new Point
|
|
{
|
|
Color = coloreSerieRendimentoCumulato,
|
|
Values = new ValuesPointXY(Convert.ToDateTime(item["Data"]).ToOADate(), Convert.ToDouble(item["Percentuale"])),
|
|
Visible = RendimentoCumulanto()
|
|
});
|
|
#endregion
|
|
}
|
|
|
|
var punto = RendimentoCumulato_Punto.Points.Last();
|
|
if (punto != null)
|
|
{
|
|
punto.Marker = new PointMarker()
|
|
{
|
|
MarkerStyle = MarkerStyle.Circle,
|
|
MarkerColor = System.Drawing.Color.Black,
|
|
MarkerSize = 2.5f
|
|
};
|
|
punto.Visible = true;
|
|
}
|
|
|
|
foreach (DataRow item in dati.Tables["Cono"].Rows)
|
|
{
|
|
#region Serie Scenario pessimistico
|
|
|
|
ScenarioPessimistico.Points.Add(new Point
|
|
{
|
|
Color = coloreSerieScenarioPessimistico,
|
|
Values = new ValuesPointXY(Convert.ToDateTime(item["Data"]).ToOADate(), Convert.ToDouble(item["ScenarioPessimistico"])),
|
|
Visible = ConoEvoluzione()
|
|
});
|
|
|
|
#endregion
|
|
|
|
#region Serie Scenario ottimistico
|
|
|
|
ScenarioOttimistico.Points.Add(new Point
|
|
{
|
|
Color = coloreSerieScenarioOttimistico,
|
|
Values = new ValuesPointXY(Convert.ToDateTime(item["Data"]).ToOADate(), Convert.ToDouble(item["ScenarioOttimistico"])),
|
|
Visible = ConoEvoluzione()
|
|
});
|
|
|
|
#endregion
|
|
}
|
|
AddElement(graficoCombination_RendimentoCumulato);
|
|
#region Legenda
|
|
AddElement(new SpacePDF(25));
|
|
|
|
//#region Legenda 1
|
|
float xLegenda = base.EnvironmentFacade.RendererFacade.XLeftLimit + 100;
|
|
//AddElement(new RectanglePDF(0.5F, 20, coloreSerieScenarioOttimistico) { DeltaY = 4, X = xLegenda, AutoIncrementYWritable = false });
|
|
xLegenda += 120;
|
|
//var ftaNomeLabel = new FormattedTextAreaPDF
|
|
//{
|
|
// Text = "Scenario ottimistico",
|
|
// FontColor = ColorPDF.Nero,
|
|
// DeltaX = 12F,
|
|
// AutoIncrementYWritable = false,
|
|
// X = xLegenda,
|
|
// FontSize = 7
|
|
//};
|
|
//xLegenda += 10 + (ftaNomeLabel.Text.Length * 5) + (10 - ftaNomeLabel.Text.Length);
|
|
//AddElement(ftaNomeLabel);
|
|
//#endregion
|
|
|
|
#region Legenda 2
|
|
//if (!RendimentoCumulanto())
|
|
{
|
|
//AddElement(new CirclePDF(11, 11, coloreSerieRendimentoCumulato) { DeltaY = 0, X = xLegenda, AutoIncrementYWritable = false });
|
|
AddElement(new RectanglePDF(0.5F, 20, coloreSerieRendimentoCumulato) { DeltaY = 4, X = xLegenda, AutoIncrementYWritable = false });
|
|
xLegenda += 21;
|
|
var ftaNomeLabel = new FormattedTextAreaPDF
|
|
{
|
|
Text = "Rendimento cumulato",
|
|
FontColor = ColorPDF.Nero,
|
|
DeltaX = 5F,
|
|
AutoIncrementYWritable = false,
|
|
X = xLegenda,
|
|
FontSize = 7
|
|
};
|
|
//xLegenda += 10 + (ftaNomeLabel.Text.Length * 5) + (10 - ftaNomeLabel.Text.Length);
|
|
xLegenda += 10 + (ftaNomeLabel.Text.Length * 5) + (10 - ftaNomeLabel.Text.Length);
|
|
AddElement(ftaNomeLabel);
|
|
}
|
|
//else
|
|
//{
|
|
// AddElement(new RectanglePDF(0.5F, 20, coloreSerieRendimentoCumulato) { DeltaY = 4, X = xLegenda, AutoIncrementYWritable = false });
|
|
// xLegenda += 12;
|
|
// ftaNomeLabel = new FormattedTextAreaPDF
|
|
// {
|
|
// Text = "Rendimento cumulato",
|
|
// FontColor = ColorPDF.Nero,
|
|
// DeltaX = 12F,
|
|
// AutoIncrementYWritable = false,
|
|
// X = xLegenda,
|
|
// FontSize = 7
|
|
// };
|
|
// xLegenda += 10 + (ftaNomeLabel.Text.Length * 5) + (10 - ftaNomeLabel.Text.Length);
|
|
// AddElement(ftaNomeLabel);
|
|
//}
|
|
#endregion
|
|
|
|
//#region Legenda 3
|
|
//AddElement(new RectanglePDF(0.5F, 20, coloreSerieScenarioPessimistico) { DeltaY = 4, X = xLegenda, AutoIncrementYWritable = false });
|
|
//xLegenda += 12;
|
|
//ftaNomeLabel = new FormattedTextAreaPDF
|
|
//{
|
|
// Text = "Scenario pessimistico",
|
|
// FontColor = ColorPDF.Nero,
|
|
// DeltaX = 12F,
|
|
// AutoIncrementYWritable = false,
|
|
// X = xLegenda,
|
|
// FontSize = 7
|
|
//};
|
|
//xLegenda += 10 + (ftaNomeLabel.Text.Length * 5) + (10 - ftaNomeLabel.Text.Length);
|
|
//AddElement(ftaNomeLabel);
|
|
//#endregion
|
|
|
|
#endregion
|
|
|
|
#endregion
|
|
}
|
|
}
|
|
|
|
protected sealed override DataTable GetDataTable()
|
|
{
|
|
return null;
|
|
}
|
|
|
|
|
|
protected sealed override DataSet GetDataSet()
|
|
{
|
|
var ds = new DataSet();
|
|
ds.Tables.Add(new DataTable("risorseApportate"));
|
|
ds.Tables.Add(new DataTable("risorseApportateMonitorato"));
|
|
ds.Tables.Add(new DataTable("rendimentoCumulato"));
|
|
ds.Tables.Add(new DataTable("Cono"));
|
|
|
|
ds.Tables["risorseApportate"].Columns.Add(new DataColumn("Descrizione", typeof(string)));
|
|
ds.Tables["risorseApportate"].Columns.Add(new DataColumn("Valore", typeof(string)));
|
|
|
|
|
|
ds.Tables["risorseApportateMonitorato"].Columns.Add(new DataColumn("Data", typeof(DateTime)));
|
|
ds.Tables["risorseApportateMonitorato"].Columns.Add(new DataColumn("ControvaloreMonitorato", typeof(decimal)));
|
|
ds.Tables["risorseApportateMonitorato"].Columns.Add(new DataColumn("RisorseApportate", typeof(decimal)));
|
|
|
|
|
|
ds.Tables["rendimentoCumulato"].Columns.Add(new DataColumn("Data", typeof(DateTime)));
|
|
ds.Tables["rendimentoCumulato"].Columns.Add(new DataColumn("Percentuale", typeof(decimal)));
|
|
|
|
ds.Tables["Cono"].Columns.Add(new DataColumn("Data", typeof(DateTime)));
|
|
ds.Tables["Cono"].Columns.Add(new DataColumn("ScenarioOttimistico", typeof(decimal)));
|
|
ds.Tables["Cono"].Columns.Add(new DataColumn("ScenarioPessimistico", typeof(decimal)));
|
|
|
|
var rendimentiCumulati = new andamentoRendimento[0];
|
|
var progetto = new progettoMon();
|
|
var rendimento = new rendimentoProgetto();
|
|
var controvaloreMonitorato_RisorseApportate = new ctvRisorse[0];
|
|
var conoPianificazione = new conoBean[0];
|
|
try
|
|
{
|
|
var areaMonitorata = datiSeiUnico.monitoraggioUnit().monitoraggio.FirstOrDefault();
|
|
progetto = areaMonitorata.progetti[0];
|
|
rendimento = progetto.rendimentoProgetto;
|
|
controvaloreMonitorato_RisorseApportate = progetto.ctvRisorse != null ? progetto.ctvRisorse : new ctvRisorse[0];
|
|
rendimentiCumulati = progetto.andamentiRedimenti;
|
|
conoPianificazione = new conoBean[0];
|
|
}
|
|
catch
|
|
{
|
|
|
|
}
|
|
|
|
#region Tabella e Grafico delle risorse apportate
|
|
|
|
|
|
|
|
ds.Tables["risorseApportate"].Rows.Add("<b>MONITORAGGIO ATTIVATO IL</b>", string.Format("<b>{0}</b>", rendimento.dtAvvio.ToShortDateString()));
|
|
ds.Tables["risorseApportate"].Rows.Add(string.Format("<b>Controvalore (€){0}</b> <br> (Aggiornato il {1})", GetNote1().Length > 0 ? "*" : "", rendimento.dtCtv.ToShortDateString()), string.Format("<b>{0}</b>", Helper.FormatCurrency(rendimento.ctvMonitorato.ToString())));
|
|
ds.Tables["risorseApportate"].Rows.Add("<b>Risorse apportate (€)</b>", string.Format("<b>{0}</b>", Helper.FormatCurrency(rendimento.risorseApportate.ToString())));
|
|
ds.Tables["risorseApportate"].Rows.Add("Apporti iniziali", Helper.FormatCurrency(rendimento.apportoIniziale.ToString()));
|
|
ds.Tables["risorseApportate"].Rows.Add("Movimenti successivi", Helper.FormatCurrency(rendimento.movimentiSuccessivi.ToString()));
|
|
ds.Tables["risorseApportate"].Rows.Add("<b>Plus/Minusvalenza (€)</b>", Helper.FormatCurrency(rendimento.minusPlusAreaProgetto.ToString()));
|
|
ds.Tables["risorseApportate"].Rows.Add("<b>Cedole/Dividendi (€)</b>", Helper.FormatCurrency(rendimento.cedoleDividendi.ToString()));
|
|
ds.Tables["risorseApportate"].Rows.Add("<b>Guadagno/Perdita totale (€)</b>", Helper.FormatCurrency((rendimento.minusPlusAreaProgetto + rendimento.cedoleDividendi).ToString()));
|
|
string rendimentoAnnualizzato = rendimento.rendimentoAnnualizzato != 0 ? "<br>(" + Helper.FormatDecimal(rendimento.rendimentoAnnualizzato.ToString(), 2) + " % su base annua)" : "";
|
|
if (FlagBaseAnnua())
|
|
ds.Tables["risorseApportate"].Rows.Add("<b>Rendimento cumulato (%)</b>", Helper.FormatDecimal(rendimento.rendAvvio.ToString(), 2) + rendimentoAnnualizzato);
|
|
else
|
|
ds.Tables["risorseApportate"].Rows.Add("<b>Rendimento cumulato (%)</b>", Helper.FormatDecimal(rendimento.rendAvvio.ToString(), 2));
|
|
//ds.Tables["risorseApportate"].Columns[0].
|
|
|
|
|
|
foreach (var item in from o in controvaloreMonitorato_RisorseApportate orderby o.dtValorizzazione select o)
|
|
{
|
|
ds.Tables["risorseApportateMonitorato"].Rows.Add(
|
|
item.dtValorizzazione,
|
|
item.ctv / 1000,
|
|
item.risorseAssociate / 1000);
|
|
}
|
|
|
|
#endregion
|
|
|
|
if (GraficoRendimentoCumulato())
|
|
{
|
|
#region Grafico del rendimento cumulato
|
|
|
|
foreach (var item in from o in rendimentiCumulati orderby o.dtRendimento select o)
|
|
{
|
|
ds.Tables["rendimentoCumulato"].Rows.Add(
|
|
item.dtRendimento,
|
|
item.percentuale
|
|
);
|
|
};
|
|
|
|
foreach (var item in from o in conoPianificazione orderby o.dtRiferimento select o)
|
|
{
|
|
ds.Tables["Cono"].Rows.Add(
|
|
item.dtRiferimento,
|
|
item.quantileSup * 100,
|
|
item.quantileInf * 100
|
|
|
|
);
|
|
}
|
|
|
|
|
|
#endregion
|
|
}
|
|
|
|
return ds;
|
|
}
|
|
|
|
public virtual bool GraficoRendimentoCumulato() { return GetOption<Opzione4>().Valore; }
|
|
public virtual bool FlagBaseAnnua() { return GetOption<Opzione4_1>().Valore; }
|
|
public virtual bool ConoEvoluzione() { return false; }
|
|
public virtual bool RendimentoCumulanto() { return true; }
|
|
|
|
public virtual string GetNote1()
|
|
{
|
|
string nota = "";
|
|
var areaMonitorata = datiSeiUnico.monitoraggioUnit().monitoraggio.FirstOrDefault();
|
|
var progetto = areaMonitorata.progetti[0];
|
|
if (progetto.scarti != null && progetto.scarti.Length > 0)
|
|
nota += "(*) Il controvalore esclude alcuni prodotti che non è stato possibile considerare nel calcolo dei rendimenti.";
|
|
return nota;
|
|
}
|
|
public virtual string getTesto2()
|
|
{
|
|
string testo = "Il grafico riporta l'evoluzione del rendimento cumulato delle risorse da lei apportate all'area Extra Rendimento, a partire dalla data di avvio del monitoraggio.";
|
|
return testo;
|
|
}
|
|
}
|
|
}
|