1145 lines
57 KiB
C#
1145 lines
57 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using Consulenza.ExternalServices;
|
|
using Consulenza.ReportWriter.Business;
|
|
using Consulenza.ReportWriter.Business.OBJ_PDF;
|
|
using System.Data;
|
|
using Consulenza.ReportWriter.Business.CHART_PDF;
|
|
using Consulenza.ReportCommon;
|
|
using Consulenza.ReportWriter.Business.Entity;
|
|
using System.Text;
|
|
using ceTe.DynamicPDF;
|
|
|
|
namespace Consulenza.ReportWriter.Manager.Section.Immobiliare.MonitoraggioNucleo
|
|
{
|
|
/// <summary>
|
|
/// Scheda 15
|
|
/// </summary>
|
|
public class S15 : Entity.Section
|
|
{
|
|
//public virtual bool presenzaContocorrenteInMonterio() { return GetOption<Opzione4_2>().Valore; }
|
|
|
|
public S15(EnvironmentFacade environmentFacade, int idSection)
|
|
: base(environmentFacade, idSection)
|
|
{
|
|
try
|
|
{
|
|
Draw();
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
SectionLogger.Write("S15", ex.Message, SectionLoggerMessageLevel.E, EnvironmentFacade.ReportEnvironment);
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// Scheda15. Analisi del rischio - Diversificazione del patrimonio
|
|
/// </summary>
|
|
protected override sealed void Draw()
|
|
{
|
|
|
|
var dataset = GetDataSet();
|
|
|
|
#region Pagina 1
|
|
AddElement(new SpacePDF(40));
|
|
var titolo1 = new FormattedTextAreaPDF(getTesto1(), 35, 700) { FontSize = 10, FontColor = ColorPDF.Immobiliare_Grigio_TestoStandard, TextHorizontalAlign = ceTe.DynamicPDF.TextAlign.Left };
|
|
AddElement(titolo1);
|
|
// OGGI AddElement(new SpacePDF(20));
|
|
AddElement(new SpacePDF(10));
|
|
|
|
#region Tabella
|
|
|
|
var tabellaPatrimonio = new TablePDF(35, dataset.Tables["patrimonio"], dataset.Tables["patrimonioFooter"])
|
|
{
|
|
//Style = Style.Immobiliare,
|
|
//AlternateRow = false,
|
|
//HeaderHeight = 15,
|
|
//RowHeight = 10,
|
|
//ShowBorderLastLine = true
|
|
Style = Style.Immobiliare,
|
|
AlternateRow = false,
|
|
HeaderHeight = 15,
|
|
RowHeight = 10,
|
|
ShowBorderLastLine = false,
|
|
ShowBorderLastLineInPageBreak = false,
|
|
ShowBorderHeader = false
|
|
};
|
|
|
|
tabellaPatrimonio.Columns.Add(new ColumnPDF("descrizione", 170, HorizontalAlignmentType.Sinistra, false, false, 7, ColumnType.Testo, "Descrizione", "Patrimonio complessivo") { DeltaYContent = 1 });
|
|
tabellaPatrimonio.Columns.Add(new ColumnPDF("valore", 130, HorizontalAlignmentType.Destra, false, false, 7, ColumnType.Testo, "Valore", "Valore totale (€)") { DeltaYContent = 1 });
|
|
tabellaPatrimonio.Columns.Add(new ColumnPDF("peso", 100, HorizontalAlignmentType.Destra, false, false, 7, ColumnType.Testo, "Peso", "Peso (%)") { DeltaYContent = 1 });
|
|
|
|
tabellaPatrimonio.FooterColumns.Add(new ColumnPDF("descrizione", 170, HorizontalAlignmentType.Sinistra, false, false, 7, ColumnType.Testo));
|
|
tabellaPatrimonio.FooterColumns.Add(new ColumnPDF("valore", 130, HorizontalAlignmentType.Destra, false, false, 7, ColumnType.Testo));
|
|
tabellaPatrimonio.FooterColumns.Add(new ColumnPDF("peso", 100, HorizontalAlignmentType.Destra, false, false, 7, ColumnType.Testo));
|
|
|
|
if (getNota2().Length > 0 || getNota3().Length > 0)
|
|
tabellaPatrimonio.Notes.Add(new TableNotePDF(TableNotePDF.TableNotePositionType.PièDiTabella, getNota2() + getNota3()) { FontSize = 7, DeltaY = 3 });
|
|
|
|
#endregion
|
|
|
|
int i = 0;
|
|
foreach (DataRow rw in dataset.Tables["patrimonio"].Rows)
|
|
{
|
|
if (!dataset.Tables["patrimonio"].Rows[i]["Descrizione"].ToString().Contains("<B>"))
|
|
tabellaPatrimonio.Cells[0, i].XContentOffset = 10;
|
|
i++;
|
|
}
|
|
|
|
AddElement(tabellaPatrimonio);
|
|
AddElement(new SpacePDF(20));
|
|
|
|
if (dataset.Tables["composizionePatrimonio"].Rows.Count > 0 )
|
|
{
|
|
var tabellaComposizione = new TablePDF(35, dataset.Tables["composizionePatrimonio"].AsEnumerable().OrderBy(x => x.Field<int>("ordinamento")).CopyToDataTable(),
|
|
dataset.Tables["composizionePatrimonioFooter"])
|
|
{
|
|
//Style = Style.Immobiliare,
|
|
//AlternateRow = false,
|
|
//HeaderHeight = 15,
|
|
//RowHeight = 10,
|
|
//ShowBorderLastLine = true,
|
|
Style = Style.Immobiliare,
|
|
AlternateRow = false,
|
|
HeaderHeight = 15,
|
|
RowHeight = 10,
|
|
ShowBorderLastLine = false,
|
|
ShowBorderLastLineInPageBreak = false,
|
|
ShowBorderHeader = false
|
|
};
|
|
|
|
tabellaComposizione.Columns.Add(new ColumnPDF("composizione", 170, HorizontalAlignmentType.Sinistra, false, false, 7, ColumnType.Testo, "Composizione", "Composizione patrimonio finanziario") { DeltaYContent = 1 });
|
|
tabellaComposizione.Columns.Add(new ColumnPDF("valore", 130, HorizontalAlignmentType.Destra, false, false, 7, ColumnType.Testo, "Valore", "Valore totale (€)") { DeltaYContent = 1 });
|
|
tabellaComposizione.Columns.Add(new ColumnPDF("peso", 100, HorizontalAlignmentType.Destra, false, false, 7, ColumnType.Testo, "Peso", "Peso (%)") { DeltaYContent = 1 });
|
|
|
|
tabellaComposizione.FooterColumns.Add(new ColumnPDF("composizione", 170, HorizontalAlignmentType.Sinistra, false, false, 7, ColumnType.Testo));
|
|
tabellaComposizione.FooterColumns.Add(new ColumnPDF("valore", 130, HorizontalAlignmentType.Destra, false, false, 7, ColumnType.Testo));
|
|
tabellaComposizione.FooterColumns.Add(new ColumnPDF("peso", 100, HorizontalAlignmentType.Destra, false, false, 7, ColumnType.Testo));
|
|
|
|
if (getNota4().Length > 0)
|
|
tabellaComposizione.Notes.Add(new TableNotePDF(TableNotePDF.TableNotePositionType.PièDiTabella, getNota4()) { FontSize = 7, DeltaY = 3 });
|
|
|
|
AddElement(tabellaComposizione);
|
|
}
|
|
|
|
#endregion
|
|
|
|
AddElement(new ResetterYPDF());
|
|
#region Grafico torta
|
|
|
|
var serieTorta = new List<Serie>();
|
|
|
|
foreach (var row in dataset.Tables["torta"].AsEnumerable())
|
|
{
|
|
serieTorta.Add(new Serie { Name = row["tipologia"].ToString() });
|
|
|
|
serieTorta[0].Points.Add(new Point
|
|
{
|
|
LabelAxisX = row["tipologia"].ToString(),
|
|
//Value = Convert.ToDouble(row["peso"]),
|
|
Value = Convert.ToDouble(Helper.FormatDecimal(Convert.ToDecimal(row["peso"]).ToString(),1)),
|
|
Color = getColor(row["tipologia"].ToString()),
|
|
ShowLabelAxisX = false,
|
|
ShowLabelAxisY = false,
|
|
FontSizeLabelAxisX = 10,
|
|
FontSizeLabelAxisY = 10
|
|
});
|
|
|
|
}
|
|
#endregion
|
|
|
|
var torta = new PiePDF(40 + tabellaPatrimonio.Width, 0.2F)
|
|
{
|
|
Width = 340,
|
|
Height = 340,
|
|
SeriesCollection = serieTorta,
|
|
StartAngle = 270,
|
|
ShowLabelPoints = true,
|
|
Style3DEnabled = false,
|
|
AutoIncrementYWritable = true,
|
|
LabelDecimalDigitsCount = 1,
|
|
FontLabelSize = 5f,
|
|
CustomPlottingHeight = 50,
|
|
CustomPlottingWidth = 50,
|
|
CustomPlottingX = 25,
|
|
CustomPlottingY = 7,
|
|
UseCustomPlotting = true,
|
|
};
|
|
|
|
//AddElement(new SpacePDF(95));
|
|
//AddElement(torta);
|
|
|
|
//var tortaTitolo = new FormattedTextAreaPDF(string.Format("{0}", "Patrimonio complessivo"), 130 + tabellaPatrimonio.Width) { FontColor = ColorPDF.Immobiliare_Grigio_TestoStandard, FontSize = 10, FontBold = true, AutoIncrementYWritable = true, DeltaY = -2 };
|
|
//AddElement(new SpacePDF(-10));
|
|
//AddElement(tortaTitolo);
|
|
|
|
AddElement(new SpacePDF(70));
|
|
var tortaTitolo = new FormattedTextAreaPDF(string.Format("{0}", "Patrimonio complessivo"), 130 + tabellaPatrimonio.Width) { FontColor = ColorPDF.Immobiliare_Grigio_TestoStandard, FontSize = 10, FontBold = true, AutoIncrementYWritable = true, DeltaY = -2 };
|
|
|
|
AddElement(tortaTitolo);
|
|
|
|
AddElement(torta);
|
|
|
|
|
|
|
|
|
|
var xLegenda1 = 0;
|
|
var xLegenda2 = 0;
|
|
|
|
if (dataset.Tables["composizionePatrimonio"].Rows.Count > 0)
|
|
{
|
|
xLegenda1 = 55 + (int)tabellaPatrimonio.Width;
|
|
xLegenda2 = 215 + (int)tabellaPatrimonio.Width;
|
|
}
|
|
else
|
|
{
|
|
//xLegenda1 = 85 + (int)tabellaPatrimonio.Width;
|
|
xLegenda2 = 145 + (int)tabellaPatrimonio.Width;
|
|
}
|
|
|
|
ColorPDF coloriUsoAbitativo = new ColorPDF(207, 220, 210);
|
|
ColorPDF coloriStrumentale = new ColorPDF(167, 192, 168);
|
|
ColorPDF coloriInvestimento = new ColorPDF(115, 152, 109);
|
|
ColorPDF coloriNonSpecificata = new ColorPDF(245, 245, 220);
|
|
ColorPDF coloriFideuram = new ColorPDF(174, 150, 81);
|
|
ColorPDF coloriTerzi = new ColorPDF(215, 206, 169);
|
|
|
|
float _yLegend = 340;
|
|
foreach (var row in dataset.Tables["torta"].AsEnumerable())
|
|
{
|
|
switch(row["indice"].ToString()) {
|
|
|
|
case "U":
|
|
var legendaUsoAbitativoRettangolo = new RectanglePDF(xLegenda2, 12, 17, coloriUsoAbitativo) { AutoIncrementYWritable = false, Y = _yLegend };
|
|
var legendaUsoAbitativoTesto = new FormattedTextAreaPDF(string.Format("{0}", "Immobili d'uso abitativo"), xLegenda2 + 25) { FontSize = 7, AutoIncrementYWritable = false, DeltaY = 0, Y = _yLegend };
|
|
|
|
AddElement(legendaUsoAbitativoRettangolo);
|
|
AddElement(legendaUsoAbitativoTesto);
|
|
_yLegend += 15;
|
|
break;
|
|
|
|
case "PF":
|
|
var legendaFideuram = new RectanglePDF(xLegenda1, 12, 17, coloriFideuram) { AutoIncrementYWritable = false, Y = _yLegend };
|
|
var legendaFideuramTesto = new FormattedTextAreaPDF(string.Format("{0}", "Patrimonio finanziario Fideuram"), xLegenda1 + 25) { FontSize = 7, AutoIncrementYWritable = false, DeltaY = 0, Y = _yLegend };
|
|
|
|
AddElement(legendaFideuram);
|
|
AddElement(legendaFideuramTesto);
|
|
if (dataset.Tables["torta"].AsEnumerable().Any(x => x.Field<string>("indice").Equals("PT")))
|
|
_yLegend += 15;
|
|
break;
|
|
|
|
case "S":
|
|
var legendaStrumentaleRettangolo = new RectanglePDF(xLegenda2, 12, 17, coloriStrumentale) { AutoIncrementYWritable = false, Y = _yLegend };
|
|
var legendaStrumentaleTesto = new FormattedTextAreaPDF(string.Format("{0}", "Immobili strumentali"), xLegenda2 + 25) { FontSize = 7, AutoIncrementYWritable = false, DeltaY = 0, Y = _yLegend };
|
|
|
|
AddElement(legendaStrumentaleRettangolo);
|
|
AddElement(legendaStrumentaleTesto);
|
|
_yLegend += 15;
|
|
break;
|
|
|
|
case "PT":
|
|
var legendaTerzi = new RectanglePDF(xLegenda1, 12, 17, coloriTerzi) { AutoIncrementYWritable = false, Y = _yLegend };
|
|
var legendaTerziTesto = new FormattedTextAreaPDF(string.Format("{0}", "Patrimonio finanziario altri istituti"), xLegenda1 + 25) { FontSize = 7, AutoIncrementYWritable = false, DeltaY = 0, Y = _yLegend };
|
|
|
|
AddElement(legendaTerzi);
|
|
AddElement(legendaTerziTesto);
|
|
if (dataset.Tables["torta"].AsEnumerable().Any(x => x.Field<string>("indice").Equals("S") || x.Field<string>("indice").Equals("NS")
|
|
|| x.Field<string>("indice").Equals("U") || x.Field<string>("indice").Equals("I")))
|
|
_yLegend = 340;
|
|
break;
|
|
|
|
case "I":
|
|
var legendaInvestimentoRettangolo = new RectanglePDF(xLegenda2, 12, 17, coloriInvestimento) { AutoIncrementYWritable = false, Y = _yLegend };
|
|
var legendaInvestimentoTesto = new FormattedTextAreaPDF(string.Format("{0}", "Immobili d'investimento"), xLegenda2 + 25) { FontSize = 7, AutoIncrementYWritable = true, DeltaY = 0, Y = _yLegend };
|
|
|
|
AddElement(legendaInvestimentoRettangolo);
|
|
AddElement(legendaInvestimentoTesto);
|
|
_yLegend += 15;
|
|
break;
|
|
|
|
case "NS":
|
|
var legendaNonSpecificataRettangolo = new RectanglePDF(xLegenda2, 12, 17, coloriNonSpecificata) { AutoIncrementYWritable = false, Y = _yLegend };
|
|
var legendaNonSpecificataTesto = new FormattedTextAreaPDF(string.Format("{0}", "Finalità non specificata"), xLegenda2 + 25) { FontSize = 7, AutoIncrementYWritable = true, DeltaY = 0, Y = _yLegend };
|
|
|
|
AddElement(legendaNonSpecificataRettangolo);
|
|
AddElement(legendaNonSpecificataTesto);
|
|
_yLegend += 15;
|
|
break;
|
|
}
|
|
}
|
|
|
|
float startFrameX = tabellaPatrimonio.X + tabellaPatrimonio.Width + 10;
|
|
float startFrameY = 79;
|
|
//addFrame(startFrameX, startFrameX + 305, startFrameY, startFrameY + 320);
|
|
addFrame(startFrameX, startFrameX + 320, startFrameY, startFrameY + 325);
|
|
|
|
AddElement(new PagePDF(PagePDF.PagePDFType.Generic));
|
|
var pagina2 = GetDataSet2();
|
|
|
|
var border = new RectanglePDF(332, 700, new ColorPDF(0, 0, 0))
|
|
{
|
|
Y = 105,
|
|
X = 40,
|
|
BorderColor = new ColorPDF(196, 196, 186),
|
|
BorderStyle = LineStylePDF.Solid,
|
|
BorderWidth = 0.75f,
|
|
Color = new ColorPDF(255, 255, 255),
|
|
AutoIncrementYWritable = false
|
|
};
|
|
AddElement(border);
|
|
|
|
DrawDiamondBar(570, 175, 100, 233, pagina2.Tables[1].Rows[0][2].ToString());
|
|
|
|
AddElement(new SpacePDF(40));
|
|
var titolo2 = new FormattedTextAreaPDF(getTesto2(), 35, 750) { FontSize = 10, FontColor = ColorPDF.Immobiliare_Grigio_TestoStandard };
|
|
|
|
AddElement(titolo2);
|
|
AddElement(new SpacePDF(20));
|
|
|
|
var titoloRiquadro = new FormattedTextAreaPDF("Diversificazione del patrimonio complessivo", 40, 700)
|
|
{ FontSize = 10,
|
|
FontColor = ColorPDF.Bianco,
|
|
FontBold = true,
|
|
//BackGroundColor = ColorPDF.Immobiliare_Grigio_TitoloPiccolo,
|
|
BackGroundColor = new ColorPDF(196, 196, 186),
|
|
DeltaX = 5,
|
|
FixedHeight = 5,
|
|
DeltaY = 2 };
|
|
var titolo2_2 = new FormattedTextAreaPDF(getTesto2_2(), 40, 400) { AutoIncrementYWritable = true, FontSize = 9, FontColor = ColorPDF.Immobiliare_Grigio_TestoStandard, DeltaX = 5, TextHorizontalAlign = ceTe.DynamicPDF.TextAlign.Justify };
|
|
|
|
if (pagina2.Tables[0].Rows[1]["grado"].ToString().Trim() == "0,00" && pagina2.Tables[1].Rows[0]["gradoFooter"].ToString().Trim() == "0,00")
|
|
DrawCustomTable(50, 325, 105, 400, pagina2.Tables[0].Rows[0]["grado"].ToString(),
|
|
"n.c.",
|
|
"n.c.");
|
|
else
|
|
DrawCustomTable(50, 325, 105, 400, pagina2.Tables[0].Rows[0]["grado"].ToString(),
|
|
pagina2.Tables[0].Rows[1]["grado"].ToString(),
|
|
pagina2.Tables[1].Rows[0]["gradoFooter"].ToString());
|
|
|
|
TablePDF tablePDF = new TablePDF(40, pagina2.Tables[0], pagina2.Tables[1])
|
|
{
|
|
Style = Style.Immobiliare,
|
|
AlternateRow = false,
|
|
HeaderHeight = 25,
|
|
RowHeight = 25,
|
|
Footer = true,
|
|
PageBreak = true,
|
|
IndexesOfRowLinesToIgnoreSeparators = new List<int>() { 0,1,2},
|
|
ShowSeparationLines = false,
|
|
HideLastSeparationLine = true,
|
|
HideFirstSeparationLine = true,
|
|
ShowBorderLastLine = false,
|
|
ShowBorderLastLineInPageBreak = false,
|
|
ShowFooterSeparationLines = false,
|
|
ShowBorderContent = false,
|
|
ShowBorderFooter = false,
|
|
ShowBorderHeader = false
|
|
};
|
|
|
|
tablePDF.Columns.Add(new ColumnPDF("immagine", 55, HorizontalAlignmentType.Destra, false, true, 11, ColumnType.Immagine, "immagine", "") { HeaderFontBold = true, ScaleColumnTypeImage = 0.1F, DeltaYContent = 7, PaddingLeft = -10 });
|
|
tablePDF.Columns.Add(new ColumnPDF("patrimonio", 145, HorizontalAlignmentType.Sinistra, false, true, 11, ColumnType.Testo, "patrimonio", "") { FontBold = false, HeaderFontBold = true, DeltaYContent = 1 });
|
|
tablePDF.Columns.Add(new ColumnPDF("grado", 190, HorizontalAlignmentType.Centrato, false, true, 11, ColumnType.Testo, "grado", "Diversificazione") { FontBold = false, HeaderFontBold = true, HeaderFontSize = 10, DeltaYContent = 1 });
|
|
|
|
tablePDF.FooterColumns.Add(new ColumnPDF("immagineFooter", 55, HorizontalAlignmentType.Destra, false, false, 12, ColumnType.Immagine) { ScaleColumnTypeImage = 0.12F, DeltaYContent = 2, PaddingLeft = -10 });
|
|
tablePDF.FooterColumns.Add(new ColumnPDF("patrimonioFooter", 145, HorizontalAlignmentType.Sinistra, false, false, 12, ColumnType.Testo) { FontBold = true });
|
|
tablePDF.FooterColumns.Add(new ColumnPDF("gradoFooter", 190, HorizontalAlignmentType.Centrato, false, false, 12, ColumnType.Testo) { FontBold = true, PaddingLeft = 2 });
|
|
tablePDF.FooterCells[0, 0].Value = "Diamond.png";
|
|
|
|
|
|
var titoloGradient = new FormattedTextAreaPDF("Patrimonio complessivo", 530, 300) { AutoIncrementYWritable = false, Y = 130, FontSize = 10, FontColor = ColorPDF.Immobiliare_Grigio_TestoStandard, FontBold = true };
|
|
var imageGradient = new ImagePDF(550, 0.70F, "patrimonioComplessivoChart.png") { AutoIncrementYWritable = false, Y = 160 };
|
|
|
|
AddElement(titoloRiquadro);
|
|
AddElement(new SpacePDF(10));
|
|
AddElement(titolo2_2);
|
|
AddElement(new SpacePDF(20));
|
|
|
|
AddElement(titoloGradient);
|
|
|
|
|
|
var nota = new FormattedTextAreaPDF(getNota1(), 60, 400) { Y = EnvironmentFacade.RendererFacade.YLowerLimit - 20, FontSize = 6, FontColor = ColorPDF.Nero, TextHorizontalAlign = ceTe.DynamicPDF.TextAlign.Justify };
|
|
AddElement(nota);
|
|
|
|
|
|
|
|
}
|
|
|
|
public void addFrame(float XupSx, float XupDx, float Yup, float Ydown)
|
|
{
|
|
|
|
var horizontalTopLine = new LinePDF(XupSx, Yup, XupDx, Yup, 0.5F, ColorPDF.Immobiliare_Grigio_TitoloPiccolo) { AutoIncrementYWritable = false };
|
|
AddElement(horizontalTopLine);
|
|
var horizontalBottomLine = new LinePDF(XupSx, Ydown, XupDx, Ydown, 0.5F, ColorPDF.Immobiliare_Grigio_TitoloPiccolo) { AutoIncrementYWritable = false };
|
|
AddElement(horizontalBottomLine);
|
|
var verticalLeftLine = new LinePDF(XupSx, Yup, XupSx, Ydown, 0.5F, ColorPDF.Immobiliare_Grigio_TitoloPiccolo) { AutoIncrementYWritable = false };
|
|
AddElement(verticalLeftLine);
|
|
var verticalRightLine = new LinePDF(XupDx, Yup, XupDx, Ydown, 0.5F, ColorPDF.Immobiliare_Grigio_TitoloPiccolo) { AutoIncrementYWritable = false };
|
|
AddElement(verticalRightLine);
|
|
}
|
|
|
|
private string getTesto1()
|
|
{
|
|
string testo = "";
|
|
testo = "Di seguito è rappresentato il patrimonio complessivo distinto tra patrimonio finanziario e immobiliare.";
|
|
return testo;
|
|
}
|
|
|
|
private string getTesto2()
|
|
{
|
|
string testo = "";
|
|
testo = "Di seguito è rappresentata la diversificazione del patrimonio complessivo, di quello finanziario e di quello immobiliare.";
|
|
return testo;
|
|
}
|
|
|
|
private string getTesto2_2()
|
|
{
|
|
string testo = "";
|
|
//testo = "La <B>diversificazione del patrimonio complessivo*</B> è calcolata sulla base della diversificazione della <B>componente finanziaria</B> "
|
|
// + "e di quella immobiliare, in base alla relativa rischiosità e al relativo controvalore.<BR>";
|
|
//testo += "Al grado di diversificazione complessiva constribuisce anche il livello di <B>correlazione</B> complessiva tra le due componenti patrimoniali: "
|
|
// + "in generale, diversificare un portafoglio tra asset non correlati consente di ridurre il livello complessivo di rischio.<BR>";
|
|
//testo += "La correlazione fra le due componenti (finanziaria e immobiliare) viene ipotizzata <B>nulla</B>, <B>in ottica prudenziale</B>, "
|
|
// + "qualora risultino <B>storicamente non correlate</B> (correlazione storica negativa fra asset finanziari e immobiliari).<BR><BR>";
|
|
//testo += "Inoltre, qualora il <B>nucleo di riferimento</B> sia composto da <B>più soggetti</B> con portafogli finanziari distinti "
|
|
// + "e per i quali il livello di rischio e di diversificazione siano stimati sui <B>singoli portafogli</B>, gli indicatori complessivi (di rischio e diversificazione) "
|
|
// + "vengono determinati come media ponderata per il controvalore dei singoli portafogli.<BR>";
|
|
//testo += "Tale approccio prudenziale risulta coerente con le proprietà statistiche della misura di rischio utilizzata (Value at Risk) che implica la possibilità "
|
|
// + "che all'aumentare della diversificazione complessiva dei portafogli analizzati congiuntamente, il rischio complessivo non si riduca di conseguenza.";
|
|
|
|
testo = "La diversificazione del patrimonio complessivo* è calcolata sulla base della diversificazione della componente finanziaria "
|
|
+ "e di quella immobiliare, in base alla relativa rischiosità e al relativo controvalore.<BR>";
|
|
testo += "Alla diversificazione complessiva contribuisce anche il livello di correlazione complessiva tra le due componenti patrimoniali: "
|
|
+ "in generale, diversificare un portafoglio tra asset non correlati consente di ridurre il livello complessivo di rischio.<BR>";
|
|
testo += "La correlazione fra le due componenti (finanziaria e immobiliare) viene ipotizzata nulla, in ottica prudenziale, "
|
|
+ "qualora risultino storicamente non correlate (correlazione storica negativa fra asset finanziari e immobiliari).<BR><BR>";
|
|
testo += "Inoltre, qualora il nucleo di riferimento sia composto da più soggetti con portafogli finanziari distinti "
|
|
+ "e per i quali il livello di rischio e di diversificazione siano stimati sui singoli portafogli, gli indicatori complessivi (di rischio e diversificazione) "
|
|
+ "vengono determinati come media ponderata per il controvalore dei singoli portafogli.<BR>";
|
|
testo += "Tale approccio prudenziale risulta coerente con le proprietà statistiche della misura di rischio utilizzata (Value at Risk) che implica la possibilità "
|
|
+ "che all'aumentare della diversificazione complessiva dei portafogli analizzati congiuntamente, il rischio complessivo non si riduca di conseguenza.";
|
|
|
|
return testo;
|
|
}
|
|
|
|
private string getNota1()
|
|
{
|
|
string testo = "";
|
|
testo = "* Il patrimonio complessivo considera il patrimonio finanziario e il patrimonio immobiliare.";
|
|
return testo;
|
|
}
|
|
|
|
public virtual string getNota2()
|
|
{
|
|
|
|
string nota = "";
|
|
string token = "";
|
|
|
|
decimal CCN_CASA = datiSeiUnico.CASA_CCN;
|
|
decimal GPELIGOFONDI_CASA = datiSeiUnico.CASA_GPELIGOFONDI;
|
|
decimal GPELIGTITOLI_CASA = datiSeiUnico.CASA_GPELIGTITOLI;
|
|
|
|
|
|
if (CCN_CASA != 0 || GPELIGOFONDI_CASA != 0 || GPELIGTITOLI_CASA != 0)
|
|
{
|
|
nota += token + "Il controvalore esclude il saldo negativo";
|
|
token = " ";
|
|
if (CCN_CASA != 0)
|
|
{
|
|
nota += token + datiSeiUnico.FormatDecimal("dei conti correnti ({0} €)", CCN_CASA);
|
|
token = ", ";
|
|
}
|
|
if (GPELIGOFONDI_CASA != 0)
|
|
{
|
|
nota += token + datiSeiUnico.FormatDecimal("della liquidità sottostante la GP Eligo Fondi ({0} €)", GPELIGOFONDI_CASA);
|
|
token = ", ";
|
|
}
|
|
if (GPELIGTITOLI_CASA != 0)
|
|
{
|
|
nota += token + datiSeiUnico.FormatDecimal("della liquidità sottostante la GP Eligo Titoli ({0} €)", GPELIGTITOLI_CASA);
|
|
token = ", ";
|
|
}
|
|
nota += ".";
|
|
token = " ";
|
|
}
|
|
return nota;
|
|
}
|
|
|
|
public virtual string getNota3()
|
|
{
|
|
string nota = "";
|
|
if (datiSeiUnico.TRZ_CCN != 0)
|
|
{
|
|
nota += getNota2().Length > 0 ? "<BR>" : "";
|
|
nota += datiSeiUnico.FormatDecimal("(*" + (getNota2().Length > 0 ? "*" : "") + ") Il controvalore esclude il saldo negativo dei conti correnti ({0} €).", datiSeiUnico.TRZ_CCN);
|
|
|
|
}
|
|
return nota;
|
|
}
|
|
|
|
public virtual string getNota4()
|
|
{
|
|
//string nota = "";
|
|
//if (datiSeiUnico.FNZ_OC != 0)
|
|
//{
|
|
// nota = datiSeiUnico.FormatDecimal("Grado di copertura pari a xx,xx%: non sono considerati i prodotti non rappresentabili ({0} €).", datiSeiUnico.FNZ_OC);
|
|
// //“(*) Grado di copertura pari a xx,xx%: non sono considerati [i prodotti non rappresentabili (x.xxx,xx €)][,] [gli importi relativi alle operazioni in corso (x.xxx,xx €)].”
|
|
//}
|
|
//return nota;
|
|
|
|
string nota = "";
|
|
string token = "";
|
|
var macroAssetClass = datiSeiUnico.patrimonioUnit().patrimonioFinanziario.macroAssetClass;
|
|
|
|
if (macroAssetClass != null && macroAssetClass.distribuzione != null)
|
|
{
|
|
//decimal GC = (presenzaContocorrenteInMonterio() ? macroAssetClass.distribuzione.coverageCC : macroAssetClass.distribuzione.coverage) * 100;
|
|
decimal GC = macroAssetClass.distribuzione.coverageCC * 100;
|
|
|
|
decimal OC_CASA = datiSeiUnico.CASA_OC;
|
|
//decimal CC_CASA = presenzaContocorrenteInMonterio() ? 0 : datiSeiUnico.CASA_CC;
|
|
decimal CC_CASA = datiSeiUnico.CASA_CC;
|
|
|
|
decimal PNR_CASA = 0;
|
|
if (datiSeiUnico.patrimonioUnit().patrimonioCasa.macroAssetClass != null && datiSeiUnico.patrimonioUnit().patrimonioCasa.macroAssetClass.distribuzione != null)
|
|
PNR_CASA = datiSeiUnico.patrimonioUnit().patrimonioCasa.macroAssetClass.distribuzione.totaleNonRappr;
|
|
|
|
//decimal CC_TERZI = presenzaContocorrenteInMonterio() ? 0 : datiSeiUnico.TRZ_CC;
|
|
decimal CC_TERZI = datiSeiUnico.TRZ_CC;
|
|
|
|
decimal PNR_TERZI = 0;
|
|
if (datiSeiUnico.patrimonioUnit().patrimonioTerzi.macroAssetClass != null && datiSeiUnico.patrimonioUnit().patrimonioTerzi.macroAssetClass.distribuzione != null)
|
|
PNR_TERZI = datiSeiUnico.patrimonioUnit().patrimonioTerzi.macroAssetClass.distribuzione.totaleNonRappr;
|
|
|
|
if (GC < 100)
|
|
{
|
|
nota += token + datiSeiUnico.FormatDecimal("Grado di copertura (%) della rappresentazione grafica per macro asset class pari a {0}", GC);
|
|
token = ": ";
|
|
if (PNR_CASA != 0 || CC_CASA != 0 || OC_CASA != 0 || PNR_TERZI != 0 || CC_TERZI != 0)
|
|
{
|
|
nota += token + "non sono considerati";
|
|
token = " ";
|
|
if (PNR_CASA != 0 || CC_CASA != 0 || OC_CASA != 0)
|
|
{
|
|
if (PNR_CASA != 0)
|
|
{
|
|
nota += token + datiSeiUnico.FormatDecimal("i prodotti non rappresentabili ({0} €)", PNR_CASA);
|
|
token = ", ";
|
|
}
|
|
if (CC_CASA != 0)
|
|
{
|
|
nota += token + datiSeiUnico.FormatDecimal("i conti correnti ({0} €)", CC_CASA);
|
|
token = ", ";
|
|
}
|
|
if (OC_CASA != 0)
|
|
{
|
|
nota += token + datiSeiUnico.FormatDecimal("gli importi relativi alle operazioni in corso ({0} €)", OC_CASA);
|
|
token = ", ";
|
|
}
|
|
token = " ";
|
|
nota += token + "del patrimonio $/Banca/$";
|
|
token = ", ";
|
|
}
|
|
if (PNR_TERZI != 0 || CC_TERZI != 0)
|
|
{
|
|
if (PNR_TERZI != 0)
|
|
{
|
|
nota += token + datiSeiUnico.FormatDecimal("i prodotti non rappresentabili ({0} €)", PNR_TERZI);
|
|
token = ", ";
|
|
}
|
|
if (CC_TERZI != 0)
|
|
{
|
|
nota += token + datiSeiUnico.FormatDecimal("i conti correnti ({0} €)", CC_TERZI);
|
|
token = ", ";
|
|
}
|
|
token = " ";
|
|
nota += token + "del patrimonio altri Istituti";
|
|
token = ", ";
|
|
}
|
|
}
|
|
|
|
//if (GC < 100)
|
|
//{
|
|
// nota += token + datiSeiUnico.FormatDecimal("Grado di copertura (%) della rappresentazione grafica per macro asset class pari a {0}", GC);
|
|
// token = ": ";
|
|
// if (PNR_TERZI != 0 || CC_TERZI != 0)
|
|
// {
|
|
// nota += token + "non sono considerati";
|
|
// token = " ";
|
|
|
|
// if (PNR_TERZI != 0 || CC_TERZI != 0)
|
|
// {
|
|
// if (PNR_TERZI != 0)
|
|
// {
|
|
// nota += token + datiSeiUnico.FormatDecimal("i prodotti non rappresentabili ({0} €)", PNR_TERZI);
|
|
// token = ", ";
|
|
// }
|
|
// if (CC_TERZI != 0)
|
|
// {
|
|
// nota += token + datiSeiUnico.FormatDecimal("i conti correnti ({0} €)", CC_TERZI);
|
|
// token = ", ";
|
|
// }
|
|
// token = ", ";
|
|
// }
|
|
// }
|
|
|
|
|
|
nota += ".";
|
|
token = " ";
|
|
}
|
|
}
|
|
nota = !nota.Equals("") ? " " + nota : nota;
|
|
return datiSeiUnico.FormatBanca(nota);
|
|
|
|
}
|
|
|
|
private void DrawDiamondBar(int x, int y, int width, int height, string val)
|
|
{
|
|
var border = new RectanglePDF(height + 40, width + 120, new ColorPDF(0, 0, 0))
|
|
{
|
|
Height = height + 75,
|
|
Width = width + 130,
|
|
X = x - 90,
|
|
Y = y - 55,
|
|
BorderColor = new ColorPDF(196, 196, 186),
|
|
BorderStyle = LineStylePDF.Solid,
|
|
BorderWidth = 0.75f,
|
|
Color = new ColorPDF(255,255,255),
|
|
AutoIncrementYWritable = false
|
|
};
|
|
AddElement(border);
|
|
|
|
double value = double.Parse(val.Replace("%", ""))/100;
|
|
var textMax = new FormattedTextAreaPDF("Max:100", x + width / 2, width / 2)
|
|
{
|
|
FontColor = new ColorPDF(91, 88, 79),
|
|
TextHorizontalAlign = ceTe.DynamicPDF.TextAlign.Right,
|
|
FontSize = 10,
|
|
FontBold = true,
|
|
Y = y - 14,
|
|
AutoIncrementYWritable = false,
|
|
};
|
|
AddElement(textMax);
|
|
AddElement(new LinePDF(x, x + width, 0.5f, new ColorPDF(System.Drawing.Color.Black))
|
|
{
|
|
Color = new ColorPDF(91, 88, 79),
|
|
Y1 = y - 1,
|
|
Y2 = y - 1,
|
|
AutoIncrementYWritable = false
|
|
});
|
|
AddElement(new ImagePDF(x, 1, "gradientbar.png")
|
|
{
|
|
Y = y,
|
|
Width = width / 2,
|
|
Height = height,
|
|
AutoIncrementYWritable = false
|
|
});
|
|
AddElement(new LinePDF(x, x + width, 0.5f, new ColorPDF(System.Drawing.Color.Black))
|
|
{
|
|
Color = new ColorPDF(91, 88, 79),
|
|
Y1 = y + height,
|
|
Y2 = y + height,
|
|
AutoIncrementYWritable = false
|
|
});
|
|
var textMin = new FormattedTextAreaPDF("Min:0 ", x + width / 2, width / 2)
|
|
{
|
|
FontColor = new ColorPDF(91, 88, 79),
|
|
TextHorizontalAlign = ceTe.DynamicPDF.TextAlign.Right,
|
|
FontSize = 10,
|
|
FontBold = true,
|
|
Y = y + height - 13,
|
|
AutoIncrementYWritable = false
|
|
};
|
|
AddElement(textMin);
|
|
var triangleImg = new ImagePDF(x - 26, 0.2f, "triangle_big.png")
|
|
{
|
|
//AutoIncrementYWritable = false,
|
|
//Y = y + height * (100 - (float)value) / 100 - 8
|
|
AutoIncrementYWritable = false,
|
|
Y = y + height * (100 - (float)value * 100) / 100 - 8
|
|
};
|
|
AddElement(triangleImg);
|
|
//var valueElement = new FormattedTextAreaPDF(((int)(value * 100)).ToString("D") + "%", x - 80, 50)
|
|
//var valueElement = new FormattedTextAreaPDF((value * 100).ToString(), x - 80, 50)
|
|
|
|
var valueElement = new FormattedTextAreaPDF();
|
|
if (value == 0)
|
|
valueElement = new FormattedTextAreaPDF("n.c.", x - 80, 50)
|
|
{
|
|
FontColor = new ColorPDF(91, 88, 79),
|
|
TextHorizontalAlign = ceTe.DynamicPDF.TextAlign.Right,
|
|
FontSize = 10,
|
|
FontBold = true,
|
|
Y = y + height * (100 - (float)value * 100) / 100 - 6,
|
|
AutoIncrementYWritable = false
|
|
};
|
|
else
|
|
valueElement = new FormattedTextAreaPDF(Convert.ToDecimal(value * 100).ToString("#,##0.00").ToString(), x - 80, 50)
|
|
{
|
|
FontColor = new ColorPDF(91, 88, 79),
|
|
TextHorizontalAlign = ceTe.DynamicPDF.TextAlign.Right,
|
|
FontSize = 10,
|
|
FontBold = true,
|
|
Y = y + height * (100 - (float)value * 100) / 100 - 6,
|
|
AutoIncrementYWritable = false
|
|
};
|
|
|
|
AddElement(valueElement);
|
|
|
|
//var imagePdf = new ImagePDF(x - 52, 0.2f, "Diamond.png")
|
|
//{
|
|
// Y = y + height * (100 - (float)value * 100) / 100 - 30,
|
|
// AutoIncrementYWritable = false
|
|
//};
|
|
var imagePdf = new ImagePDF(x - 56, 0.2f, "Diamond.png")
|
|
{
|
|
//Y = y + height * (100 - (float)value) / 100 - 30,
|
|
Y = y + height * (100 - (float)value * 100) / 100 - 30,
|
|
AutoIncrementYWritable = false
|
|
};
|
|
|
|
AddElement(imagePdf);
|
|
}
|
|
|
|
|
|
private void DrawCustomTable(int x, int y, int height, int width, string val1, string val2, string val3)
|
|
{
|
|
val1 = val1.Replace("%", "");
|
|
val2 = val2.Replace("%", "");
|
|
val3 = val3.Replace("%", "");
|
|
|
|
var border = new RectanglePDF(height, width, new ColorPDF(0, 0, 0))
|
|
{
|
|
Y = y,
|
|
X = x,
|
|
BorderColor = new ColorPDF(196, 196, 186),
|
|
BorderStyle = LineStylePDF.Solid,
|
|
BorderWidth = 0.75f,
|
|
Color = new ColorPDF(255, 255, 255),
|
|
AutoIncrementYWritable = false
|
|
};
|
|
AddElement(border);
|
|
|
|
|
|
var row0col1 = new FormattedTextAreaPDF("Diversificazione", x + 240, 150)
|
|
{
|
|
AutoIncrementYWritable = false,
|
|
Y = y + 10,
|
|
FontSize = 10,
|
|
FontColor = ColorPDF.Immobiliare_Grigio_TestoStandard,
|
|
FontBold = true,
|
|
TextHorizontalAlign = TextAlign.Right
|
|
};
|
|
var lineTitle = new LinePDF(x + 290, x + 390, 0.75f, new ColorPDF(196, 196, 186))
|
|
{
|
|
Y1 = y + 25,
|
|
Y2 = y + 25
|
|
};
|
|
AddElement(lineTitle);
|
|
AddElement(new ImagePDF(x + 20, 0.13f, "StimaValore.png")
|
|
{
|
|
AutoIncrementYWritable = false,
|
|
Y = y + 32
|
|
});
|
|
var row1col0 = new FormattedTextAreaPDF("Patrimonio finanziario", x + 40, 150)
|
|
{
|
|
AutoIncrementYWritable = false,
|
|
Y = y + 35,
|
|
FontSize = 10,
|
|
FontColor = ColorPDF.Immobiliare_Grigio_TestoStandard,
|
|
FontBold = true,
|
|
TextHorizontalAlign = TextAlign.Left
|
|
};
|
|
var row1col1 = new FormattedTextAreaPDF(val1, x + 340, 50)
|
|
{
|
|
AutoIncrementYWritable = false,
|
|
Y = y + 35,
|
|
FontSize = 10,
|
|
FontColor = ColorPDF.Immobiliare_Grigio_TestoStandard,
|
|
FontBold = true,
|
|
TextHorizontalAlign = TextAlign.Right
|
|
};
|
|
|
|
AddElement(new ImagePDF(x + 20, 0.13f, "Fabbricati.png")
|
|
{
|
|
AutoIncrementYWritable = false,
|
|
Y = y + 52
|
|
});
|
|
var row2col0 = new FormattedTextAreaPDF("Patrimonio immobiliare", x + 40, 150)
|
|
{
|
|
AutoIncrementYWritable = false,
|
|
Y = y + 55,
|
|
FontSize = 10,
|
|
FontColor = ColorPDF.Immobiliare_Grigio_TestoStandard,
|
|
FontBold = true,
|
|
TextHorizontalAlign = TextAlign.Left
|
|
};
|
|
var row2col1 = new FormattedTextAreaPDF(val2, x + 340, 50)
|
|
{
|
|
AutoIncrementYWritable = false,
|
|
Y = y + 55,
|
|
FontSize = 10,
|
|
FontColor = ColorPDF.Immobiliare_Grigio_TestoStandard,
|
|
FontBold = true,
|
|
TextHorizontalAlign = TextAlign.Right
|
|
};
|
|
|
|
var longLine = new LinePDF(x + 10, x + 390, 0.75f, new ColorPDF(196, 196, 186))
|
|
{
|
|
Y1 = y + 74,
|
|
Y2 = y + 74
|
|
};
|
|
AddElement(longLine);
|
|
|
|
AddElement(new ImagePDF(x + 20, 0.13f, "Diamond.png")
|
|
{
|
|
AutoIncrementYWritable = false,
|
|
Y = y + 80
|
|
});
|
|
var row3col0 = new FormattedTextAreaPDF("Patrimonio complessivo", x + 40, 200)
|
|
{
|
|
AutoIncrementYWritable = false,
|
|
Y = y + 80,
|
|
FontSize = 10,
|
|
FontColor = ColorPDF.Immobiliare_Grigio_TestoStandard,
|
|
FontBold = true,
|
|
TextHorizontalAlign = TextAlign.Left
|
|
};
|
|
var row3col1 = new FormattedTextAreaPDF(val3, x + 340, 50)
|
|
{
|
|
AutoIncrementYWritable = false,
|
|
Y = y + 80,
|
|
FontSize = 10,
|
|
FontColor = ColorPDF.Immobiliare_Grigio_TestoStandard,
|
|
FontBold = true,
|
|
TextHorizontalAlign = TextAlign.Right
|
|
};
|
|
|
|
AddElement(row0col1);
|
|
AddElement(row1col0);
|
|
AddElement(row1col1);
|
|
AddElement(row2col0);
|
|
AddElement(row2col1);
|
|
AddElement(row3col0);
|
|
AddElement(row3col1);
|
|
}
|
|
|
|
/// <summary>
|
|
/// Recupera i dati necessari alla Section restituendo un DataTable.
|
|
/// </summary>
|
|
/// <returns></returns>
|
|
protected override DataTable GetDataTable()
|
|
{
|
|
return null;
|
|
}
|
|
|
|
protected DataSet GetDataSet2()
|
|
{
|
|
var parametri = new List<Parametro>
|
|
{
|
|
new Parametro
|
|
{
|
|
Direction = ParameterDirection.Input,
|
|
DbType = DbType.Int64,
|
|
ParameterName = "@chiaveNucleo",
|
|
Value = EnvironmentFacade.ReportEnvironment.NucleoImmobiliare.ChiaveNucleo
|
|
}
|
|
};
|
|
|
|
var dsOriginal = DataAccess.ExecuteDataSetStoredProcedure(DBProvider.SqlServerConsulenzaUnica, "REP_ImmobiliareMonitoraggio_S_AnalisiRischioDiversificazione", parametri);
|
|
if (dsOriginal.Tables[0].Rows.Count == 0)
|
|
return null;
|
|
|
|
DataTable data = new DataTable();
|
|
data.Columns.Add("immagine", typeof(string));
|
|
data.Columns.Add("patrimonio", typeof(string));
|
|
data.Columns.Add("grado", typeof(string));
|
|
|
|
DataTable dataFooter = new DataTable();
|
|
dataFooter.Columns.Add("immagineFooter", typeof(string));
|
|
dataFooter.Columns.Add("patrimonioFooter", typeof(string));
|
|
dataFooter.Columns.Add("gradoFooter", typeof(string));
|
|
|
|
// ES INDICATORI DI DIVERSIFICAZIONE 11.05.2018
|
|
//data.Rows.Add("StimaValore.png", "Patrimonio finanziario", Helper.FormatPercentage(Convert.ToDecimal(dsOriginal.Tables[0].Rows[0]["GradoFinanziario"]) * 100, 0));
|
|
//data.Rows.Add("Fabbricati.png", "Patrimonio immobiliare", Helper.FormatPercentage(Convert.ToDecimal(dsOriginal.Tables[0].Rows[0]["GradoImmobiliare"]) * 100, 0));
|
|
//dataFooter.Rows.Add("Diamond.png", "Patrimonio complessivo", Helper.FormatPercentage(Math.Abs(Convert.ToDecimal(dsOriginal.Tables[0].Rows[0]["GradoComplessivo"]) * 100), 0));
|
|
|
|
data.Rows.Add("StimaValore.png", "Patrimonio finanziario", Helper.FormatDecimal((Convert.ToDecimal(dsOriginal.Tables[0].Rows[0]["GradoFinanziario"]) * 100).ToString(), 2));
|
|
data.Rows.Add("Fabbricati.png", "Patrimonio immobiliare", Helper.FormatDecimal((Convert.ToDecimal(dsOriginal.Tables[0].Rows[0]["GradoImmobiliare"]) * 100).ToString(), 2));
|
|
dataFooter.Rows.Add("Diamond.png", "Patrimonio complessivo", Helper.FormatDecimal((Convert.ToDecimal(dsOriginal.Tables[0].Rows[0]["GradoComplessivo"]) * 100).ToString(), 2));
|
|
|
|
//var _GradoFinanziario = datiSeiUnico.rischioUnit().rischio.rischioMercatoCredito.bancaFideuram.stat.diversificazione;
|
|
//var _GradoComplessivo = datiSeiUnico.rischioUnit().rischio.rischioMercatoCredito.totale.stat.diversificazione;
|
|
|
|
//data.Rows.Add("StimaValore.png", "Patrimonio finanziario", Helper.FormatPercentage(Convert.ToDecimal(_GradoFinanziario) * 100, 0));
|
|
//data.Rows.Add("Fabbricati.png", "Patrimonio immobiliare", Helper.FormatPercentage(Convert.ToDecimal(dsOriginal.Tables[0].Rows[0]["GradoImmobiliare"]) * 100, 0));
|
|
//dataFooter.Rows.Add("Diamond.png", "Patrimonio complessivo", Helper.FormatPercentage(Math.Abs(Convert.ToDecimal(_GradoComplessivo) * 100), 0));
|
|
|
|
DataSet set = new DataSet();
|
|
set.Tables.Add(data);
|
|
set.Tables.Add(dataFooter);
|
|
|
|
return set;
|
|
}
|
|
|
|
/// <summary>
|
|
/// Recupera i dati necessari alla Section restituendo un DataSet.
|
|
/// </summary>
|
|
/// <returns></returns>
|
|
protected override DataSet GetDataSet()
|
|
{
|
|
//var datiSei = datiSeiUnico;
|
|
//var finanziarioFideuram = datiSeiUnico.CASA_TOTALE;
|
|
//var finanziarioTerzi = datiSeiUnico.TRZ_TOTALE;
|
|
//var immobiliare = 0;
|
|
//var totale = finanziarioFideuram + finanziarioTerzi + immobiliare;
|
|
//var pesoFideuram = finanziarioFideuram * 100 / totale;
|
|
//var pesoTerzi = finanziarioTerzi * 100 / totale;
|
|
//var pesoImmobiliare = immobiliare * 100 / totale;
|
|
//decimal totaleFinanziario = 0;
|
|
var parametri = new List<Parametro>
|
|
{
|
|
new Parametro
|
|
{
|
|
Direction = ParameterDirection.Input,
|
|
DbType = DbType.Int64,
|
|
ParameterName = "chiaveNucleo",
|
|
Value = EnvironmentFacade.ReportEnvironment.NucleoImmobiliare.ChiaveNucleo
|
|
}
|
|
};
|
|
|
|
var dsOriginal = DataAccess.ExecuteDataSetStoredProcedure(DBProvider.SqlServerConsulenzaUnica, "REP_Nucleo_Immobiliare_S2_Sintesi", parametri);
|
|
if (dsOriginal.Tables[0].Rows.Count == 0)
|
|
return null;
|
|
|
|
var datiSei = datiSeiUnico;
|
|
|
|
decimal nTotale = 0;
|
|
for (int k = 0; k < dsOriginal.Tables[0].Rows.Count; k++)
|
|
{
|
|
nTotale = nTotale + Convert.ToDecimal(dsOriginal.Tables[0].Rows[k]["ValoreStimatoTotale"]);
|
|
}
|
|
var finanziarioFideuram = datiSeiUnico.CASA_TOTALEPOSITIVO;
|
|
var finanziarioTerzi = datiSeiUnico.TRZ_TOTALE;
|
|
var immobiliare = nTotale;
|
|
var totale = finanziarioFideuram + finanziarioTerzi + immobiliare;
|
|
var pesoFideuram = finanziarioFideuram * 100 / totale;
|
|
var pesoTerzi = finanziarioTerzi * 100 / totale;
|
|
var pesoImmobiliare = immobiliare * 100 / totale;
|
|
decimal totaleFinanziario = 0;
|
|
|
|
//dsOriginal = DataAccess.ExecuteDataSetStoredProcedure(DBProvider.SqlServerConsulenzaUnica, "REP_ImmobiliareMonitoraggio_S_AnalisiRischioSintesi", parametri);
|
|
dsOriginal = DataAccess.ExecuteDataSetStoredProcedure(DBProvider.SqlServerConsulenzaUnica, "REP_ImmobiliareMonitoraggio_S_DettaglioFabbricatiNucleo", parametri);
|
|
if (dsOriginal.Tables[2].Rows.Count == 0)
|
|
return null;
|
|
|
|
DataSet ds = new DataSet();
|
|
ds.Tables.Add(new DataTable("patrimonio"));
|
|
ds.Tables.Add(new DataTable("patrimonioFooter"));
|
|
ds.Tables.Add(new DataTable("composizionePatrimonio"));
|
|
ds.Tables.Add(new DataTable("composizionePatrimonioFooter"));
|
|
ds.Tables.Add(new DataTable("torta"));
|
|
|
|
//ds.Tables["patrimonio"].Columns.Add(new DataColumn("space", typeof(string)));
|
|
ds.Tables["patrimonio"].Columns.Add(new DataColumn("Descrizione", typeof(string)));
|
|
ds.Tables["patrimonio"].Columns.Add(new DataColumn("Valore", typeof(string)));
|
|
ds.Tables["patrimonio"].Columns.Add(new DataColumn("Peso", typeof(string)));
|
|
|
|
ds.Tables["patrimonioFooter"].Columns.Add(new DataColumn("Descrizione", typeof(string)));
|
|
ds.Tables["patrimonioFooter"].Columns.Add(new DataColumn("Valore", typeof(string)));
|
|
ds.Tables["patrimonioFooter"].Columns.Add(new DataColumn("Peso", typeof(string)));
|
|
|
|
ds.Tables["composizionePatrimonio"].Columns.Add(new DataColumn("Composizione", typeof(string)));
|
|
ds.Tables["composizionePatrimonio"].Columns.Add(new DataColumn("Valore", typeof(string)));
|
|
ds.Tables["composizionePatrimonio"].Columns.Add(new DataColumn("Peso", typeof(string)));
|
|
ds.Tables["composizionePatrimonio"].Columns.Add(new DataColumn("Ordinamento", typeof(int)));
|
|
|
|
ds.Tables["composizionePatrimonioFooter"].Columns.Add(new DataColumn("Composizione", typeof(string)));
|
|
ds.Tables["composizionePatrimonioFooter"].Columns.Add(new DataColumn("Valore", typeof(string)));
|
|
ds.Tables["composizionePatrimonioFooter"].Columns.Add(new DataColumn("Peso", typeof(string)));
|
|
|
|
ds.Tables["torta"].Columns.Add(new DataColumn("indice", typeof(string)));
|
|
ds.Tables["torta"].Columns.Add(new DataColumn("tipologia", typeof(string)));
|
|
ds.Tables["torta"].Columns.Add(new DataColumn("peso", typeof(decimal)));
|
|
|
|
|
|
// Check se Totale > di 100
|
|
decimal nTotalePercento = Convert.ToDecimal(Helper.FormatDecimal(pesoTerzi.ToString(), 1)) + Convert.ToDecimal(Helper.FormatDecimal(pesoFideuram.ToString(), 1)) + Convert.ToDecimal(Helper.FormatDecimal(pesoImmobiliare.ToString(), 1));
|
|
|
|
if (nTotalePercento > 100)
|
|
{
|
|
if (pesoFideuram != 0)
|
|
pesoFideuram = pesoFideuram - Convert.ToDecimal(0.1);
|
|
else
|
|
pesoTerzi = pesoTerzi - Convert.ToDecimal(0.1);
|
|
}
|
|
if (nTotalePercento < 100)
|
|
{
|
|
if (pesoFideuram != 0)
|
|
pesoFideuram = pesoFideuram + Convert.ToDecimal(0.1);
|
|
else
|
|
pesoTerzi = pesoTerzi + Convert.ToDecimal(0.1);
|
|
}
|
|
// Fine Check
|
|
|
|
// TOTALI PATRIMONIO
|
|
if (finanziarioFideuram != 0)
|
|
ds.Tables["patrimonio"].Rows.Add("<B>Patrimonio finanziario Fideuram" + (getNota2().Length > 0 ? "*" : "") + "</B>", "<B>" + Helper.FormatCurrency(finanziarioFideuram.ToString()) + "</B>", "<B>" + Helper.FormatPercentage(pesoFideuram, 1) + "</B>");
|
|
if (finanziarioTerzi != 0)
|
|
ds.Tables["patrimonio"].Rows.Add("<B>Patrimonio finanziario altri Istituti" + (getNota3().Length <= 0 ? "" : (getNota2().Length > 0 ? "**" : "*")) + "</B>", "<B>" + Helper.FormatCurrency(finanziarioTerzi.ToString()) + "</B>", "<B>" + Helper.FormatPercentage(pesoTerzi, 1) + "</B>");
|
|
if(immobiliare != 0)
|
|
ds.Tables["patrimonio"].Rows.Add("<B>Patrimonio immobiliare</B>", "<B>" + Helper.FormatCurrency(immobiliare.ToString()) + "</B>", "<B>" + Helper.FormatPercentage(pesoImmobiliare, 1) + "</B>");
|
|
|
|
if (pesoFideuram != 0)
|
|
ds.Tables["torta"].Rows.Add("PF", "<B>Patrimonio finanziario Fideuram</B>", pesoFideuram);
|
|
if (pesoTerzi != 0)
|
|
ds.Tables["torta"].Rows.Add("PT", "<B>Patrimonio finanziario altri Istituti</B>", pesoTerzi);
|
|
|
|
// CALCOLO PER COMPOSIZIONE PATRIMONIO IMMOBILIARE
|
|
decimal nTotaleImmobiliare = 0;
|
|
for (int k = 0; k < dsOriginal.Tables[2].Rows.Count; k++)
|
|
{
|
|
var nPercentuale = Convert.ToDecimal(dsOriginal.Tables[2].Rows[k]["totale"].ToString()) * 100 / totale;
|
|
nTotaleImmobiliare = nTotaleImmobiliare + Convert.ToDecimal(Helper.FormatDecimal(Convert.ToDecimal(nPercentuale).ToString(), 1));
|
|
}
|
|
|
|
bool bMax = false;
|
|
bool bMin = false;
|
|
|
|
if (nTotaleImmobiliare > Convert.ToDecimal(Helper.FormatDecimal(Convert.ToDecimal(pesoImmobiliare).ToString(), 1)))
|
|
bMax = true;
|
|
else
|
|
{
|
|
if (nTotaleImmobiliare < Convert.ToDecimal(Helper.FormatDecimal(Convert.ToDecimal(pesoImmobiliare).ToString(), 1)))
|
|
bMin = true;
|
|
}
|
|
|
|
// DIVISIONE PATRIMONIO IMMOBILIARE
|
|
for (int k = 0; k < dsOriginal.Tables[2].Rows.Count; k++)
|
|
{
|
|
var percentuale = Convert.ToDecimal(dsOriginal.Tables[2].Rows[k]["totale"]) * 100 / totale;
|
|
if (bMax == true)
|
|
{
|
|
percentuale = percentuale - Convert.ToDecimal(0.1);
|
|
bMax = false;
|
|
}
|
|
else
|
|
{
|
|
if (bMin == true)
|
|
{
|
|
percentuale = percentuale + Convert.ToDecimal(0.1);
|
|
bMin = false;
|
|
}
|
|
}
|
|
ds.Tables["patrimonio"].Rows.Add(getTipologia(dsOriginal.Tables[2].Rows[k]["codFinalita"].ToString()), Helper.FormatCurrency(dsOriginal.Tables[2].Rows[k]["totale"].ToString()), Helper.FormatPercentage(percentuale, 1));
|
|
ds.Tables["torta"].Rows.Add(dsOriginal.Tables[2].Rows[k]["codFinalita"].ToString(), getTipologia(dsOriginal.Tables[2].Rows[k]["codFinalita"].ToString()), Helper.FormatDecimal(percentuale.ToString(), 1));
|
|
|
|
//ds.Tables["patrimonio"].Rows.Add(getTipologia(dsOriginal.Tables[2].Rows[k]["codFinalita"].ToString()), Helper.FormatCurrency(dsOriginal.Tables[2].Rows[k]["totale"].ToString()), Helper.FormatPercentage(Convert.ToDecimal(dsOriginal.Tables[2].Rows[k]["totale"]) * 100 / totale, 1));
|
|
//ds.Tables["torta"].Rows.Add(dsOriginal.Tables[2].Rows[k]["codFinalita"].ToString(), getTipologia(dsOriginal.Tables[2].Rows[k]["codFinalita"].ToString()), Helper.FormatDecimal((Convert.ToDecimal(dsOriginal.Tables[2].Rows[k]["totale"]) * 100 / totale).ToString(), 1));
|
|
}
|
|
|
|
// TOTALI PATRIMONIO - FOOTER
|
|
ds.Tables["patrimonioFooter"].Rows.Add("<B>Totale</B>", "<B>" + Helper.FormatCurrency(totale.ToString()) + "</B>", "<B>100,0%</B>");
|
|
|
|
var assetClass = datiSeiUnico.patrimonioUnit().patrimonioFinanziario.macroAssetClass.distribuzione.elencoSlice;
|
|
var displayInfo = datiSeiUnico.displayInfos().macroAssetDisplayInfos.ToList();
|
|
|
|
// CALCOLO PER COMPOSIZIONE PATRIMONIO
|
|
decimal nTotalePatrimonio = 0;
|
|
foreach (var itemDistribuzione in assetClass)
|
|
{
|
|
if (itemDistribuzione.sliceRappresentabile)
|
|
{
|
|
var percentuale = (itemDistribuzione.pesoCC) * 100;
|
|
nTotalePatrimonio = nTotalePatrimonio + Convert.ToDecimal(Helper.FormatDecimal(Convert.ToDecimal(percentuale).ToString(), 1));
|
|
}
|
|
}
|
|
bMax = false;
|
|
bMin = false;
|
|
|
|
if (nTotalePatrimonio > 100)
|
|
bMax = true;
|
|
else
|
|
{
|
|
if (nTotalePatrimonio < 100 && nTotalePatrimonio != 0)
|
|
bMin = true;
|
|
}
|
|
|
|
foreach (var itemDistribuzione in assetClass)
|
|
{
|
|
if (itemDistribuzione.sliceRappresentabile)
|
|
{
|
|
var mapDisplayInfo = displayInfo.FirstOrDefault(o => o.key.Equals(itemDistribuzione.codice)).value;
|
|
var ordinamento = mapDisplayInfo.order;
|
|
|
|
var controvalore = itemDistribuzione.ctvCC;
|
|
var percentuale = (itemDistribuzione.pesoCC) * 100;
|
|
if (bMax == true)
|
|
{
|
|
percentuale = percentuale - Convert.ToDecimal(0.1);
|
|
bMax=false;
|
|
}
|
|
else
|
|
{
|
|
if (bMin == true)
|
|
{
|
|
percentuale = percentuale + Convert.ToDecimal(0.1);
|
|
bMin=false;
|
|
}
|
|
}
|
|
totaleFinanziario += controvalore;
|
|
ds.Tables["composizionePatrimonio"].Rows.Add(itemDistribuzione.descrizione, Helper.FormatCurrency(controvalore.ToString()), Helper.FormatPercentage(Convert.ToDecimal(percentuale), 1), ordinamento);
|
|
}
|
|
}
|
|
|
|
//ds.Tables["composizionePatrimonioFooter"].Rows.Add("<B>Totale</B>", "<B>" + Helper.FormatCurrency(totaleFinanziario.ToString()) + "</B>", "<B>100,0%</B>");
|
|
if (datiSeiUnico.CASA_CCN != 0)
|
|
ds.Tables["composizionePatrimonioFooter"].Rows.Add("<B>Totale" + (getNota4().Length > 0 ? " **" : "") + "</B>", "<B>" + Helper.FormatCurrency(totaleFinanziario.ToString()) + "</B>", "<B>100,0%</B>");
|
|
else
|
|
ds.Tables["composizionePatrimonioFooter"].Rows.Add("<B>Totale" + (getNota4().Length > 0 ? " *" : "") + "</B>", "<B>" + Helper.FormatCurrency(totaleFinanziario.ToString()) + "</B>", "<B>100,0%</B>");
|
|
|
|
return ds;
|
|
}
|
|
|
|
public string getTipologia(string tipologia)
|
|
{
|
|
switch (tipologia)
|
|
{
|
|
case "U":
|
|
return "Immobili d'uso abitativo";
|
|
case "I":
|
|
return "Immobili d'investimento";
|
|
case "S":
|
|
return "Immobili strumentali";
|
|
case "NS":
|
|
return "Finalità non specificata";
|
|
default:
|
|
return "";
|
|
}
|
|
}
|
|
|
|
public ColorPDF getColor(string tipologia)
|
|
{
|
|
|
|
switch (tipologia)
|
|
{
|
|
case "Immobili d'uso abitativo":
|
|
return new ColorPDF(207, 220, 210);
|
|
case "Immobili d'investimento":
|
|
return new ColorPDF(115, 152, 109);
|
|
case "Immobili strumentali":
|
|
return new ColorPDF(167, 192, 168);
|
|
case "Finalità non specificata":
|
|
return new ColorPDF(245, 245, 220);
|
|
case "<B>Patrimonio finanziario Fideuram</B>":
|
|
return new ColorPDF(174, 150, 81);
|
|
case "<B>Patrimonio finanziario altri Istituti</B>":
|
|
return new ColorPDF(215, 206, 169);
|
|
default:
|
|
return new ColorPDF(255, 255, 255);
|
|
}
|
|
}
|
|
}
|
|
}
|