1290 lines
76 KiB
C#
1290 lines
76 KiB
C#
using System;
|
||
using Consulenza.ReportWriter.Business;
|
||
using Consulenza.ReportWriter.Business.OBJ_PDF;
|
||
using System.Data;
|
||
using Consulenza.ReportCommon;
|
||
using System.Collections.Generic;
|
||
using Consulenza.ReportWriter.Business.CHART_PDF;
|
||
using Consulenza.ReportWriter.Business.Entity;
|
||
using System.Linq;
|
||
using Consulenza.ReportWriter.Business.CUSTOM_PDF.ConsulenzaUnica;
|
||
|
||
namespace Consulenza.ReportWriter.Manager.Section.Unica
|
||
{
|
||
public class S64 : Entity.Section
|
||
{
|
||
|
||
/// <summary>
|
||
///S64.PropostaRischioMercatoVSDiversificazione idSezione = 107
|
||
/// </summary>
|
||
bool presenzaColonnaGradoCopertura;
|
||
|
||
private bool _visualizzaRischioMercatoVsDiversificazione = false;
|
||
private bool _visualizzaRischioMercatoVsDivPortafoglio = true;
|
||
private bool _visualizzaRischioMercatoVsDivRischioMercato = false;
|
||
|
||
public S64(EnvironmentFacade environmentFacade, int idSection)
|
||
: base(environmentFacade, idSection)
|
||
{
|
||
try
|
||
{
|
||
////Adriano 20180502 se non si tratta di Proposta Unica, ma di Proposta PO (ReportId per Proposta Unica è 5), la scheda RischioMercatoVsDivRischioMercato non va mostrata
|
||
//if (environmentFacade.ReportEnvironment.ReportId != 5)
|
||
//{
|
||
// _visualizzaRischioMercatoVsDivPortafoglio = true;
|
||
// _visualizzaRischioMercatoVsDivRischioMercato = false;
|
||
//}
|
||
//else
|
||
//{
|
||
// _visualizzaRischioMercatoVsDivPortafoglio = GetOption<Opzione4_7>().Valore;
|
||
// _visualizzaRischioMercatoVsDivRischioMercato = GetOption<Opzione4_8>().Valore;
|
||
// if(!_visualizzaRischioMercatoVsDivPortafoglio && !_visualizzaRischioMercatoVsDivRischioMercato)
|
||
// {
|
||
// _visualizzaRischioMercatoVsDivPortafoglio = true;
|
||
// _visualizzaRischioMercatoVsDivRischioMercato = false;
|
||
// }
|
||
//}
|
||
|
||
_visualizzaRischioMercatoVsDivPortafoglio = GetOption<Opzione4_7>().Valore;
|
||
_visualizzaRischioMercatoVsDivRischioMercato = GetOption<Opzione4_8>().Valore;
|
||
if (!_visualizzaRischioMercatoVsDivPortafoglio && !_visualizzaRischioMercatoVsDivRischioMercato)
|
||
{
|
||
_visualizzaRischioMercatoVsDivPortafoglio = true;
|
||
_visualizzaRischioMercatoVsDivRischioMercato = false;
|
||
}
|
||
|
||
Draw();
|
||
}
|
||
catch (Exception ex)
|
||
{
|
||
SectionLogger.Write("S64", ex.Message, SectionLoggerMessageLevel.E, EnvironmentFacade.ReportEnvironment);
|
||
}
|
||
}
|
||
|
||
protected override sealed void Draw()
|
||
{
|
||
var dati = GetDataSet();
|
||
bool isAdeguata = datiSeiUnico.flagAdeguatezzaPro();
|
||
|
||
var testi = GetText();
|
||
var series = new List<Serie>();
|
||
var series1 = new List<Serie>();
|
||
var series2 = new List<Serie>();
|
||
|
||
|
||
#region Diversificazione
|
||
if (_visualizzaRischioMercatoVsDiversificazione)
|
||
{
|
||
AddElement(new PagePDF(PagePDF.PagePDFType.Generic));
|
||
var intestazione = new SectionHeadingPDF(
|
||
(isAdeguata ? "Proposta" : "Operazioni richieste") + ": rischio mercato vs diversificazione",
|
||
|
||
EnvironmentFacade.RendererFacade.XLeftLimit,
|
||
EnvironmentFacade.RendererFacade.YUpperLimit,
|
||
EnvironmentFacade.ReportEnvironment.FontFamily);
|
||
|
||
AddElement(intestazione.ToElement());
|
||
|
||
if (GetTesto1().Length > 0)
|
||
{
|
||
AddElement(new SpacePDF(20));
|
||
AddElement(new FormattedTextAreaPDF(GetTesto1(), EnvironmentFacade.RendererFacade.XLeftLimit) { FontSize = 7, TextHorizontalAlign = ceTe.DynamicPDF.TextAlign.Justify });
|
||
AddElement(new SpacePDF(20));
|
||
}
|
||
|
||
AddElement(new FormattedTextAreaPDF("Rischio Mercato (VaR %)", EnvironmentFacade.RendererFacade.XLeftLimit + 110) { FontBold = true, FontSize = 7 });
|
||
AddElement(new SpacePDF(7));
|
||
|
||
var labelPersonalizzateAsseY = new List<CombinationPDFCustomLabel>();
|
||
foreach (DataRow rowX in dati.Tables["soglieY"].Rows)
|
||
{
|
||
labelPersonalizzateAsseY.Add(new CombinationPDFCustomLabel { Text = rowX["Testo"].ToString(), Value = Convert.ToDouble(rowX["Valore"]) });
|
||
}
|
||
|
||
#region Grafico VaR Diversificazione
|
||
|
||
// var graficoCombination = new CombinationPDF(EnvironmentFacade.RendererFacade.XLeftLimit + 150, 1F)
|
||
var graficoCombination = new CombinationPDF(EnvironmentFacade.RendererFacade.XLeftLimit + 115, 1F)
|
||
{
|
||
Height = 200,
|
||
Width = 350,
|
||
MinorGridAxisY = false,
|
||
BackImage = "ChartGradient_VarDiversificazione.png",
|
||
MarginAxisY = 0,
|
||
ShowLineAxisY = true,
|
||
ShowLabelAxisY = true,
|
||
LabelFormatAxisY = FormatType.Decimale2,
|
||
//Adriano
|
||
IntervalNumberAxisY = dati.Tables[2].Rows.Count,
|
||
//--Adriano
|
||
//originale:
|
||
//IntervalNumberAxisY = 5,
|
||
StartFromZeroAxisY = true,
|
||
IndicatorAxisY = new CombinationPDFIndicator()
|
||
{
|
||
Text = "Rischio Mercato (VaR) massimo",
|
||
Value = Convert.ToDouble(dati.Tables["cliente"].Rows[0]["VarMassimoProfilo"]),
|
||
DeltaX = -120, DeltaYText = -10 },
|
||
//Adriano
|
||
MaximumValueAxisY = dati.Tables[2].Rows.Count > 5 ? 53 : 30,
|
||
//--Adriano
|
||
//originale:
|
||
//MaximumValueAxisY = 30, // valore fisso
|
||
//IntervalNumberAxisY = 5,
|
||
//StartFromZeroAxisY = true,
|
||
//IndicatorAxisY = new CombinationPDFIndicator()
|
||
//{
|
||
// Text = "Rischio Mercato (VaR) massimo",
|
||
// Value = Convert.ToDouble(dati.Tables["cliente"].Rows[0]["VarMassimoProfilo"]),
|
||
// DeltaX = -115,
|
||
// DeltaYText = -10
|
||
//},
|
||
|
||
CustomLabelAxisY = labelPersonalizzateAsseY,
|
||
|
||
LabelFormatAxisX = FormatType.Intero,
|
||
ShowLineAxisX = true,
|
||
ShowLabelAxisX = true,
|
||
StartFromZeroAxisX = true,
|
||
MaximumValueAxisX = 100,
|
||
IntervalNumberAxisX = 10
|
||
};
|
||
|
||
// creo le Serie
|
||
var d = dati.Tables["rischio"].AsEnumerable().OrderByDescending(o => o.Field<int>("Numero")).CopyToDataTable();
|
||
foreach (DataRow item in d.Rows)
|
||
{
|
||
// lets leave this serie (with visible = false, so that the chart doesnt dissapear)
|
||
series.Add(
|
||
new Serie
|
||
{
|
||
//il name è fatto così perchè se si stampano 63 e 64 che hanno stessi codicipatrimonio nei grafici, il nome viene registrato e va in errore perchè già presente..
|
||
Name = series.FirstOrDefault(o => o.Name.Equals(item["CodicePatrimonio"].ToString())) != null ? item["CodicePatrimonio"].ToString() + 1 : item["CodicePatrimonio"].ToString(),
|
||
Type = Dundas.Charting.WebControl.SeriesChartType.Point,
|
||
MarkerImage = item["CodicePatrimonio"].ToString().Equals("PA") ? "PallinoPortafoglioAttuale2_new.png" : "PallinoPortafoglioProposto2_new.png",
|
||
Points = new List<Point>() {
|
||
new Point {
|
||
Values = new ValuesPointXY(Convert.ToDouble(item["Diversificazione"]), Convert.ToDouble(item["VaR"])),
|
||
ShowLabelAxisY = false,
|
||
ShowLabelAxisX = false,
|
||
Visible = false
|
||
}
|
||
},
|
||
}
|
||
);
|
||
// adding element to new Markers feature
|
||
graficoCombination.Markers.Add(new Marker()
|
||
{
|
||
Image = item["CodicePatrimonio"].ToString().Equals("PA") ? "PallinoPortafoglioAttuale2_new.png" : "PallinoPortafoglioProposto2_new.png",
|
||
Width = 15,
|
||
Height = 15,
|
||
//Scale = 1,
|
||
X = (float)Convert.ToDouble(item["Diversificazione"]),
|
||
Y = (float)Convert.ToDouble(item["VaR"]) > 30 ? 30 : (float)Convert.ToDouble(item["VaR"])
|
||
});
|
||
};
|
||
// this point is needed so that horizontal dashed lines dont dissapepar
|
||
// it is visible, but it's X and Y equals -10
|
||
// and it makes it invisible for user
|
||
series.Add(
|
||
new Serie
|
||
{
|
||
//il name è fatto così perchè se si stampano 63 e 64 che hanno stessi codicipatrimonio nei grafici, il nome viene registrato e va in errore perchè già presente..
|
||
Name = "tmpSerieNeededByDashedHorizontalLines",
|
||
Type = Dundas.Charting.WebControl.SeriesChartType.Point,
|
||
Points = new List<Point>() {
|
||
new Point {
|
||
Values = new ValuesPointXY(-10, -10),
|
||
ShowLabelAxisY = false,
|
||
ShowLabelAxisX = false,
|
||
Visible = true
|
||
}
|
||
},
|
||
}
|
||
);
|
||
|
||
|
||
// aggiungo le Serie al grafico
|
||
graficoCombination.SeriesCollection = series;
|
||
|
||
AddElement(graficoCombination);
|
||
|
||
#endregion
|
||
|
||
AddElement(new SpacePDF(15));
|
||
AddElement(new FormattedTextAreaPDF("Diversificazione (%)", EnvironmentFacade.RendererFacade.XLeftLimit + 230) { FontBold = true, FontSize = 7 });
|
||
AddElement(new SpacePDF(20));
|
||
|
||
// Stesso spazio con S63
|
||
AddElement(new SpacePDF(20));
|
||
|
||
#region Tabella
|
||
|
||
var tabella = new TablePDF(EnvironmentFacade.RendererFacade.XLeftLimit, dati.Tables["rischio"])
|
||
{
|
||
Style = Style.ConsulenzaUnica,
|
||
AlternateRow = false,
|
||
ShowSeparationLines = true,
|
||
RowHeight = 27,
|
||
Footer = false,
|
||
HeaderHeight = 30,
|
||
ShowBorderLastLine = true
|
||
};
|
||
|
||
tabella.Columns.Add(new ColumnPDF("ImmaginePatrimonio", 15, HorizontalAlignmentType.Sinistra, false, false, 7, ColumnType.Immagine, "ImmaginePatrimonio", string.Empty) { DeltaYContent = 6.5F, ScaleColumnTypeImage = 0.27F });
|
||
if (presenzaColonnaGradoCopertura)
|
||
tabella.Columns.Add(new ColumnPDF("Patrimonio", 110, HorizontalAlignmentType.Sinistra, false, false, 7, ColumnType.Testo, "Patrimonio", "Portafoglio") { HeaderPaddingLeft = 10, PaddingLeft = 10, HeaderFontSize = 7 });
|
||
else
|
||
tabella.Columns.Add(new ColumnPDF("Patrimonio", 185, HorizontalAlignmentType.Sinistra, false, false, 7, ColumnType.Testo, "Patrimonio", "Portafoglio") { HeaderPaddingLeft = 10, PaddingLeft = 10, HeaderFontSize = 7 });
|
||
tabella.Columns.Add(new ColumnPDF("Controvalore", 90, HorizontalAlignmentType.Sinistra, false, false, 7, ColumnType.Decimale, "Controvalore", "Controvalore (€)") { HeaderFontSize = 7, PaddingRight = 4 });
|
||
tabella.Columns.Add(new ColumnPDF("Var", 60, HorizontalAlignmentType.Sinistra, false, false, 7, ColumnType.Testo, "VaRString", "VaR (%)") { HeaderFontSize = 7, PaddingRight = 4 });
|
||
|
||
tabella.Columns.Add(new ColumnPDF("Diversificazione", 90, HorizontalAlignmentType.Sinistra, false, false, 7, ColumnType.Decimale, "Diversificazione", "Diversificazione (%)") { HeaderFontSize = 7, PaddingRight = 4 });
|
||
if (presenzaColonnaGradoCopertura)
|
||
tabella.Columns.Add(new ColumnPDF("GradoCopertura", 80, HorizontalAlignmentType.Sinistra, false, false, 7, ColumnType.Decimale, "GradoCopertura", "Grado di <br>copertura (%)") { HeaderFontSize = 7, PaddingRight = 4 });
|
||
tabella.Columns.Add(new ColumnPDF("Adeguatezza", 75, HorizontalAlignmentType.Centrato, false, false, 7, ColumnType.Testo, "AdeguatezzaString", "Adeguatezza") { HeaderFontSize = 7, PaddingRight = 2 });
|
||
|
||
int i = 0;
|
||
int colonna = 0;
|
||
foreach (DataRow r in tabella.DataSource.Rows)
|
||
{
|
||
if (presenzaColonnaGradoCopertura)
|
||
colonna = 6;
|
||
else
|
||
colonna = 5;
|
||
switch (r["AdeguatezzaString"].ToString())
|
||
{
|
||
case "Adeguato":
|
||
tabella.Cells[colonna, i].FontColor = ColorPDF.Verde;
|
||
break;
|
||
case "Non adeguato":
|
||
tabella.Cells[colonna, i].FontColor = ColorPDF.Rosso;
|
||
break;
|
||
default:
|
||
tabella.Cells[colonna, i].FontColor = ColorPDF.Nero;
|
||
break;
|
||
}
|
||
//var colorAdeguatezza = Convert.ToBoolean(r["Adeguatezza"]) ? new ColorPDF(0, 176, 70) : new ColorPDF(255, 0, 0);
|
||
//if(presenzaColonnaGradoCopertura)
|
||
// tabella.Cells[6, i].FontColor = colorAdeguatezza;
|
||
//else
|
||
// tabella.Cells[5, i].FontColor = colorAdeguatezza;
|
||
|
||
tabella.Cells[2, i].HorizontalAlignment =
|
||
tabella.Cells[3, i].HorizontalAlignment =
|
||
tabella.Cells[4, i].HorizontalAlignment = HorizontalAlignmentType.Destra;
|
||
if (presenzaColonnaGradoCopertura)
|
||
tabella.Cells[5, i].HorizontalAlignment = HorizontalAlignmentType.Destra;
|
||
i++;
|
||
}
|
||
|
||
AddElement(tabella);
|
||
|
||
#endregion
|
||
|
||
|
||
if (GetNota1().Length > 0 || GetNota2().Length > 0)
|
||
tabella.Notes.Add(
|
||
new TableNotePDF(TableNotePDF.TableNotePositionType.PièDiTabella,
|
||
GetNota1() + GetNota2(),
|
||
new[] { "" },
|
||
string.Empty,
|
||
TableNotePDF.TableNoteAsteriskPositionType.CorpoTabella)
|
||
{ FontSize = 6, TextHorizontalAlign = ceTe.DynamicPDF.TextAlign.Justify, DeltaY = 5 }
|
||
);
|
||
|
||
if (GetNota3().Length > 0)
|
||
{
|
||
AddElement(new SpacePDF(GetNota1().Length + GetNota2().Length > 0 ? 10 : 5));
|
||
AddElement(new FormattedTextAreaPDF(GetNota3(), EnvironmentFacade.RendererFacade.XLeftLimit) { FontSize = 6, TextHorizontalAlign = ceTe.DynamicPDF.TextAlign.Justify });
|
||
|
||
}
|
||
|
||
if (datiSeiUnico.rischioUnit().adeguatezza.adeguatezzaTopBean.datiPortafoglio != null && GetNota4().Length > 0)
|
||
{
|
||
AddElement(new SpacePDF(GetNota1().Length + GetNota2().Length > 0 || GetNota3().Length > 0 ? 10 : 5));
|
||
AddElement(new FormattedTextAreaPDF(GetNota4(), EnvironmentFacade.RendererFacade.XLeftLimit) { FontSize = 6, TextHorizontalAlign = ceTe.DynamicPDF.TextAlign.Justify });
|
||
|
||
}
|
||
|
||
if (GetNota5().Length > 0)
|
||
{
|
||
AddElement(new SpacePDF(GetNota1().Length + GetNota2().Length > 0 || GetNota3().Length > 0 || GetNota4().Length > 0 ? 10 : 5));
|
||
AddElement(new FormattedTextAreaPDF(GetNota5(), EnvironmentFacade.RendererFacade.XLeftLimit) { FontSize = 6, TextHorizontalAlign = ceTe.DynamicPDF.TextAlign.Justify });
|
||
|
||
}
|
||
|
||
if (GetNota6().Length > 0)
|
||
{
|
||
AddElement(new SpacePDF(GetNota1().Length + GetNota2().Length > 0 || GetNota3().Length > 0 || GetNota4().Length > 0 || GetNota5().Length > 0 ? 10 : 5));
|
||
AddElement(new FormattedTextAreaPDF(GetNota6(), EnvironmentFacade.RendererFacade.XLeftLimit) { FontSize = 6, TextHorizontalAlign = ceTe.DynamicPDF.TextAlign.Justify });
|
||
|
||
}
|
||
|
||
if (datiSeiUnico.rischioUnit().adeguatezza.adeguatezzaTopBean.flagfiduciariaPluriMandato)
|
||
{
|
||
string testonota637 = isAdeguata ? "La valutazione di adeguatezza del \"portafoglio attuale\" e del \"portafoglio proposto\" in termini di \"Rischio Mercato (VaR)\" e di \"Rischio Credito\" prende in considerazione il patrimonio detenuto presso $/Banca/$ da tutti i mandati fiduciari associati al medesimo fiduciante a cui appartiene il mandato " + datiSeiUnico.getClienteReport().codiceMandato + ", insieme al patrimonio del mandato " + datiSeiUnico.getClienteReport().codiceMandato + " derivante dalla presente proposta (limitatamente al \"portafoglio proposto\"). Gli indicatori \"Rischio Mercato (VaR)\" e \"Rischio Credito\", invece, sono calcolati considerando esclusivamente i prodotti detenuti dal mandato " + datiSeiUnico.getClienteReport().codiceMandato + ", insieme alle operazioni effettuate nella presente proposta. "
|
||
: "La valutazione di adeguatezza del \"portafoglio attuale\" e del \"portafoglio prospettico\" in termini di \"Rischio Mercato (VaR)\" e di \"Rischio Credito\" prende in considerazione il patrimonio detenuto presso $/Banca/$ da tutti i mandati fiduciari associati al medesimo fiduciante a cui appartiene il mandato " + datiSeiUnico.getClienteReport().codiceMandato + ", insieme al patrimonio del mandato " + datiSeiUnico.getClienteReport().codiceMandato + " derivante dalle operazioni da lei richieste al suo private banker (limitatamente al \"portafoglio prospettico\"). Gli indicatori \"Rischio Mercato (VaR)\" e \"Rischio Credito\", invece, sono calcolati considerando esclusivamente i prodotti detenuti dal mandato " + datiSeiUnico.getClienteReport().codiceMandato + ", insieme alle operazioni da lei richieste al suo private banker. ";
|
||
AddElement(new SpacePDF(GetNota1().Length + GetNota2().Length > 0 || GetNota3().Length > 0 || GetNota4().Length > 0 || GetNota5().Length > 0 || GetNota6().Length > 0 ? 10 : 5));
|
||
AddElement(new FormattedTextAreaPDF(datiSeiUnico.FormatBanca(testonota637), EnvironmentFacade.RendererFacade.XLeftLimit) { FontSize = 6, TextHorizontalAlign = ceTe.DynamicPDF.TextAlign.Justify });
|
||
}
|
||
|
||
if (GetNota7().Length > 0)
|
||
{
|
||
AddElement(new SpacePDF(datiSeiUnico.rischioUnit().adeguatezza.adeguatezzaTopBean.flagfiduciariaPluriMandato || GetNota1().Length + GetNota2().Length > 0 || GetNota3().Length > 0 || GetNota4().Length > 0 || GetNota5().Length > 0 || GetNota7().Length > 0 ? 10 : 5));
|
||
AddElement(new FormattedTextAreaPDF(GetNota7(), EnvironmentFacade.RendererFacade.XLeftLimit) { FontSize = 6, TextHorizontalAlign = ceTe.DynamicPDF.TextAlign.Justify });
|
||
|
||
}
|
||
|
||
AddElement(new FormattedTextAreaPDF("Area di pericolo", EnvironmentFacade.RendererFacade.XLeftLimit + 155 - 35) { Y = 217, FontSize = 7, FontBold = true, FontColor = ColorPDF.Bianco, AbsolutePosition = true });
|
||
AddElement(new FormattedTextAreaPDF("Area di equilibrio", EnvironmentFacade.RendererFacade.XLeftLimit + 290 - 35) { Y = 305, FontSize = 7, FontBold = true, FontColor = ColorPDF.Bianco, AbsolutePosition = true });
|
||
AddElement(new FormattedTextAreaPDF("Area di sicurezza", EnvironmentFacade.RendererFacade.XLeftLimit + 425 - 35) { Y = 375, FontSize = 7, FontBold = true, FontColor = ColorPDF.Bianco, AbsolutePosition = true });
|
||
}
|
||
#endregion Diversificazione
|
||
|
||
#region Diversificazione portafoglio
|
||
|
||
if (_visualizzaRischioMercatoVsDivPortafoglio)
|
||
{
|
||
|
||
AddElement(new PagePDF(PagePDF.PagePDFType.Generic));
|
||
var intestazione1 = new SectionHeadingPDF(
|
||
(isAdeguata ? "Proposta" : "Operazioni richieste") + ": rischio mercato vs diversificazione di portafoglio",
|
||
|
||
EnvironmentFacade.RendererFacade.XLeftLimit,
|
||
EnvironmentFacade.RendererFacade.YUpperLimit,
|
||
EnvironmentFacade.ReportEnvironment.FontFamily);
|
||
|
||
AddElement(intestazione1.ToElement());
|
||
|
||
if (GetTesto1().Length > 0)
|
||
{
|
||
AddElement(new SpacePDF(20));
|
||
AddElement(new FormattedTextAreaPDF(GetTesto1(), EnvironmentFacade.RendererFacade.XLeftLimit) { FontSize = 7, TextHorizontalAlign = ceTe.DynamicPDF.TextAlign.Justify });
|
||
AddElement(new SpacePDF(20));
|
||
}
|
||
|
||
#region Grafico VaR Diversificazione di portafoglio
|
||
|
||
AddElement(new FormattedTextAreaPDF("Rischio Mercato (VaR %)", EnvironmentFacade.RendererFacade.XLeftLimit + 110) { FontBold = true, FontSize = 7 });
|
||
AddElement(new SpacePDF(7));
|
||
|
||
var labelPersonalizzateAsseY1 = new List<CombinationPDFCustomLabel>();
|
||
foreach (DataRow rowX in dati.Tables["soglieY"].Rows)
|
||
{
|
||
labelPersonalizzateAsseY1.Add(new CombinationPDFCustomLabel { Text = rowX["Testo"].ToString(), Value = Convert.ToDouble(rowX["Valore"]) });
|
||
}
|
||
|
||
|
||
//var graficoCombination1 = new CombinationPDF(EnvironmentFacade.RendererFacade.XLeftLimit + 150, 1F)
|
||
var graficoCombination1 = new CombinationPDF(EnvironmentFacade.RendererFacade.XLeftLimit + 115, 1F)
|
||
{
|
||
Height = 200,
|
||
Width = 350,
|
||
MinorGridAxisY = false,
|
||
BackImage = "ChartGradient_VarDiversificazione.png",
|
||
MarginAxisY = 0,
|
||
ShowLineAxisY = true,
|
||
ShowLabelAxisY = true,
|
||
LabelFormatAxisY = FormatType.Decimale2,
|
||
IntervalNumberAxisY = dati.Tables[2].Rows.Count,
|
||
StartFromZeroAxisY = true,
|
||
IndicatorAxisY = new CombinationPDFIndicator()
|
||
{
|
||
Text = "Rischio Mercato (VaR) massimo",
|
||
Value = Convert.ToDouble(dati.Tables["cliente"].Rows[0]["VarMassimoProfilo"]),
|
||
DeltaX = -115,
|
||
DeltaYText = -10
|
||
},
|
||
MaximumValueAxisY = dati.Tables[2].Rows.Count > 5 ? 53 : 30,
|
||
CustomLabelAxisY = labelPersonalizzateAsseY1,
|
||
|
||
LabelFormatAxisX = FormatType.Intero,
|
||
ShowLineAxisX = true,
|
||
ShowLabelAxisX = true,
|
||
StartFromZeroAxisX = true,
|
||
MaximumValueAxisX = 100,
|
||
IntervalNumberAxisX = 10
|
||
};
|
||
|
||
// creo le Serie
|
||
var d1 = dati.Tables["rischio"].AsEnumerable().OrderByDescending(o => o.Field<int>("Numero")).CopyToDataTable();
|
||
foreach (DataRow item in d1.Rows)
|
||
{
|
||
// lets leave this serie (with visible = false, so that the chart doesnt dissapear)
|
||
series1.Add(
|
||
new Serie
|
||
{
|
||
//il name è fatto così perchè se si stampano 63 e 64 che hanno stessi codicipatrimonio nei grafici, il nome viene registrato e va in errore perchè già presente..
|
||
Name = series1.FirstOrDefault(o => o.Name.Equals(item["CodicePatrimonio"].ToString())) != null ? item["CodicePatrimonio"].ToString() + 1 : item["CodicePatrimonio"].ToString(),
|
||
Type = Dundas.Charting.WebControl.SeriesChartType.Point,
|
||
MarkerImage = item["CodicePatrimonio"].ToString().Equals("PA") ? "PallinoPortafoglioAttuale2_new.png" : "PallinoPortafoglioProposto2_new.png",
|
||
Points = new List<Point>() {
|
||
new Point {
|
||
Values = new ValuesPointXY(Convert.ToDouble(item["Diversificazione"]), Convert.ToDouble(item["VaR"])),
|
||
ShowLabelAxisY = false,
|
||
ShowLabelAxisX = false,
|
||
Visible = false
|
||
}
|
||
},
|
||
}
|
||
);
|
||
// adding element to new Markers feature
|
||
graficoCombination1.Markers.Add(new Marker()
|
||
{
|
||
Image = item["CodicePatrimonio"].ToString().Equals("PA") ? "PallinoPortafoglioAttuale2_new.png" : "PallinoPortafoglioProposto2_new.png",
|
||
Width = 15,
|
||
Height = 15,
|
||
//Scale = 1,
|
||
X = (float)Convert.ToDouble(item["DiversificazionePortafoglio"]),
|
||
Y = (float)Convert.ToDouble(item["VaR"]) > 30 ? 30 : (float)Convert.ToDouble(item["VaR"])
|
||
});
|
||
};
|
||
// this point is needed so that horizontal dashed lines dont dissapepar
|
||
// it is visible, but it's X and Y equals -10
|
||
// and it makes it invisible for user
|
||
series1.Add(
|
||
new Serie
|
||
{
|
||
//il name è fatto così perchè se si stampano 63 e 64 che hanno stessi codicipatrimonio nei grafici, il nome viene registrato e va in errore perchè già presente..
|
||
Name = "tmpSerieNeededByDashedHorizontalLines",
|
||
Type = Dundas.Charting.WebControl.SeriesChartType.Point,
|
||
Points = new List<Point>() {
|
||
new Point {
|
||
Values = new ValuesPointXY(-10, -10),
|
||
ShowLabelAxisY = false,
|
||
ShowLabelAxisX = false,
|
||
Visible = true
|
||
}
|
||
},
|
||
}
|
||
);
|
||
|
||
|
||
// aggiungo le Serie al grafico
|
||
graficoCombination1.SeriesCollection = series1;
|
||
|
||
AddElement(graficoCombination1);
|
||
|
||
#endregion
|
||
|
||
AddElement(new SpacePDF(15));
|
||
AddElement(new FormattedTextAreaPDF("Diversificazione di portafoglio", EnvironmentFacade.RendererFacade.XLeftLimit + 230) { FontBold = true, FontSize = 7 });
|
||
AddElement(new SpacePDF(20));
|
||
|
||
// Stesso spazio con S63
|
||
AddElement(new SpacePDF(20));
|
||
|
||
#region Tabella
|
||
|
||
var tabella1 = new TablePDF(EnvironmentFacade.RendererFacade.XLeftLimit, dati.Tables["rischio"])
|
||
{
|
||
Style = Style.ConsulenzaUnica,
|
||
AlternateRow = false,
|
||
ShowSeparationLines = true,
|
||
RowHeight = 27,
|
||
Footer = false,
|
||
HeaderHeight = 30,
|
||
ShowBorderLastLine = true
|
||
};
|
||
|
||
tabella1.Columns.Add(new ColumnPDF("ImmaginePatrimonio", 15, HorizontalAlignmentType.Sinistra, false, false, 7, ColumnType.Immagine, "ImmaginePatrimonio", string.Empty) { DeltaYContent = 6.5F, ScaleColumnTypeImage = 0.27F });
|
||
if (presenzaColonnaGradoCopertura)
|
||
tabella1.Columns.Add(new ColumnPDF("Patrimonio", 110, HorizontalAlignmentType.Sinistra, false, false, 7, ColumnType.Testo, "Patrimonio", "Portafoglio") { HeaderPaddingLeft = 10, PaddingLeft = 10, HeaderFontSize = 7 });
|
||
else
|
||
tabella1.Columns.Add(new ColumnPDF("Patrimonio", 185, HorizontalAlignmentType.Sinistra, false, false, 7, ColumnType.Testo, "Patrimonio", "Portafoglio") { HeaderPaddingLeft = 10, PaddingLeft = 10, HeaderFontSize = 7 });
|
||
tabella1.Columns.Add(new ColumnPDF("Controvalore", 90, HorizontalAlignmentType.Sinistra, false, false, 7, ColumnType.Decimale, "Controvalore", "Controvalore (€)") { HeaderFontSize = 7, PaddingRight = 4 });
|
||
tabella1.Columns.Add(new ColumnPDF("Var", 60, HorizontalAlignmentType.Sinistra, false, false, 7, ColumnType.Testo, "VaRString", "VaR (%)") { HeaderFontSize = 7, PaddingRight = 4 });
|
||
|
||
tabella1.Columns.Add(new ColumnPDF("Diversificazione", 90, HorizontalAlignmentType.Sinistra, false, false, 7, ColumnType.Decimale, "DiversificazionePortafoglio", "Diversificazione<br>di portafoglio") { HeaderFontSize = 7, PaddingRight = 4 });
|
||
if (presenzaColonnaGradoCopertura)
|
||
tabella1.Columns.Add(new ColumnPDF("GradoCopertura", 80, HorizontalAlignmentType.Sinistra, false, false, 7, ColumnType.Decimale, "GradoCopertura", "Grado di <br>copertura (%)") { HeaderFontSize = 7, PaddingRight = 4 });
|
||
tabella1.Columns.Add(new ColumnPDF("Adeguatezza", 75, HorizontalAlignmentType.Centrato, false, false, 7, ColumnType.Testo, "AdeguatezzaString", "Adeguatezza") { HeaderFontSize = 7, PaddingRight = 2 });
|
||
|
||
var index1 = 0;
|
||
int colonna1 = 0;
|
||
foreach (DataRow r in tabella1.DataSource.Rows)
|
||
{
|
||
if (presenzaColonnaGradoCopertura)
|
||
colonna1 = 6;
|
||
else
|
||
colonna1 = 5;
|
||
switch (r["AdeguatezzaString"].ToString())
|
||
{
|
||
case "Adeguato":
|
||
tabella1.Cells[colonna1, index1].FontColor = ColorPDF.Verde;
|
||
break;
|
||
case "Non adeguato":
|
||
tabella1.Cells[colonna1, index1].FontColor = ColorPDF.Rosso;
|
||
break;
|
||
default:
|
||
tabella1.Cells[colonna1, index1].FontColor = ColorPDF.Nero;
|
||
break;
|
||
}
|
||
//var colorAdeguatezza = Convert.ToBoolean(r["Adeguatezza"]) ? new ColorPDF(0, 176, 70) : new ColorPDF(255, 0, 0);
|
||
//if(presenzaColonnaGradoCopertura)
|
||
// tabella.Cells[6, index1].FontColor = colorAdeguatezza;
|
||
//else
|
||
// tabella.Cells[5, index1].FontColor = colorAdeguatezza;
|
||
|
||
tabella1.Cells[2, index1].HorizontalAlignment =
|
||
tabella1.Cells[3, index1].HorizontalAlignment =
|
||
tabella1.Cells[4, index1].HorizontalAlignment = HorizontalAlignmentType.Destra;
|
||
if (presenzaColonnaGradoCopertura)
|
||
tabella1.Cells[5, index1].HorizontalAlignment = HorizontalAlignmentType.Destra;
|
||
index1++;
|
||
}
|
||
|
||
AddElement(tabella1);
|
||
|
||
#endregion
|
||
|
||
|
||
if (GetNota1().Length > 0 || GetNota2().Length > 0)
|
||
tabella1.Notes.Add(
|
||
new TableNotePDF(TableNotePDF.TableNotePositionType.PièDiTabella,
|
||
GetNota1() + GetNota2(),
|
||
new[] { "" },
|
||
string.Empty,
|
||
TableNotePDF.TableNoteAsteriskPositionType.CorpoTabella)
|
||
{ FontSize = 6, TextHorizontalAlign = ceTe.DynamicPDF.TextAlign.Justify, DeltaY = 5 }
|
||
);
|
||
|
||
if (GetNota3().Length > 0)
|
||
{
|
||
AddElement(new SpacePDF(GetNota1().Length + GetNota2().Length > 0 ? 10 : 5));
|
||
AddElement(new FormattedTextAreaPDF(GetNota3(), EnvironmentFacade.RendererFacade.XLeftLimit) { FontSize = 6, TextHorizontalAlign = ceTe.DynamicPDF.TextAlign.Justify });
|
||
|
||
}
|
||
|
||
if (datiSeiUnico.rischioUnit().adeguatezza.adeguatezzaTopBean.datiPortafoglio != null && GetNota4().Length > 0)
|
||
{
|
||
AddElement(new SpacePDF(GetNota1().Length + GetNota2().Length > 0 || GetNota3().Length > 0 ? 10 : 5));
|
||
AddElement(new FormattedTextAreaPDF(GetNota4(), EnvironmentFacade.RendererFacade.XLeftLimit) { FontSize = 6, TextHorizontalAlign = ceTe.DynamicPDF.TextAlign.Justify });
|
||
|
||
}
|
||
|
||
if (GetNota5().Length > 0)
|
||
{
|
||
AddElement(new SpacePDF(GetNota1().Length + GetNota2().Length > 0 || GetNota3().Length > 0 || GetNota4().Length > 0 ? 10 : 5));
|
||
AddElement(new FormattedTextAreaPDF(GetNota5(), EnvironmentFacade.RendererFacade.XLeftLimit) { FontSize = 6, TextHorizontalAlign = ceTe.DynamicPDF.TextAlign.Justify });
|
||
|
||
}
|
||
|
||
if (GetNota6().Length > 0)
|
||
{
|
||
AddElement(new SpacePDF(GetNota1().Length + GetNota2().Length > 0 || GetNota3().Length > 0 || GetNota4().Length > 0 || GetNota5().Length > 0 ? 10 : 5));
|
||
AddElement(new FormattedTextAreaPDF(GetNota6(), EnvironmentFacade.RendererFacade.XLeftLimit) { FontSize = 6, TextHorizontalAlign = ceTe.DynamicPDF.TextAlign.Justify });
|
||
|
||
}
|
||
|
||
if (datiSeiUnico.rischioUnit().adeguatezza.adeguatezzaTopBean.flagfiduciariaPluriMandato)
|
||
{
|
||
string testonota637 = isAdeguata ? "La valutazione di adeguatezza del \"portafoglio attuale\" e del \"portafoglio proposto\" in termini di \"Rischio Mercato (VaR)\" e di \"Rischio Credito\" prende in considerazione il patrimonio detenuto presso $/Banca/$ da tutti i mandati fiduciari associati al medesimo fiduciante a cui appartiene il mandato " + datiSeiUnico.getClienteReport().codiceMandato + ", insieme al patrimonio del mandato " + datiSeiUnico.getClienteReport().codiceMandato + " derivante dalla presente proposta (limitatamente al \"portafoglio proposto\"). Gli indicatori \"Rischio Mercato (VaR)\" e \"Rischio Credito\", invece, sono calcolati considerando esclusivamente i prodotti detenuti dal mandato " + datiSeiUnico.getClienteReport().codiceMandato + ", insieme alle operazioni effettuate nella presente proposta. "
|
||
: "La valutazione di adeguatezza del \"portafoglio attuale\" e del \"portafoglio prospettico\" in termini di \"Rischio Mercato (VaR)\" e di \"Rischio Credito\" prende in considerazione il patrimonio detenuto presso $/Banca/$ da tutti i mandati fiduciari associati al medesimo fiduciante a cui appartiene il mandato " + datiSeiUnico.getClienteReport().codiceMandato + ", insieme al patrimonio del mandato " + datiSeiUnico.getClienteReport().codiceMandato + " derivante dalle operazioni da lei richieste al suo private banker (limitatamente al \"portafoglio prospettico\"). Gli indicatori \"Rischio Mercato (VaR)\" e \"Rischio Credito\", invece, sono calcolati considerando esclusivamente i prodotti detenuti dal mandato " + datiSeiUnico.getClienteReport().codiceMandato + ", insieme alle operazioni da lei richieste al suo private banker. ";
|
||
AddElement(new SpacePDF(GetNota1().Length + GetNota2().Length > 0 || GetNota3().Length > 0 || GetNota4().Length > 0 || GetNota5().Length > 0 || GetNota6().Length > 0 ? 10 : 5));
|
||
AddElement(new FormattedTextAreaPDF(datiSeiUnico.FormatBanca(testonota637), EnvironmentFacade.RendererFacade.XLeftLimit) { FontSize = 6, TextHorizontalAlign = ceTe.DynamicPDF.TextAlign.Justify });
|
||
}
|
||
|
||
if (GetNota7().Length > 0)
|
||
{
|
||
AddElement(new SpacePDF(datiSeiUnico.rischioUnit().adeguatezza.adeguatezzaTopBean.flagfiduciariaPluriMandato || GetNota1().Length + GetNota2().Length > 0 || GetNota3().Length > 0 || GetNota4().Length > 0 || GetNota5().Length > 0 || GetNota7().Length > 0 ? 10 : 5));
|
||
AddElement(new FormattedTextAreaPDF(GetNota7(), EnvironmentFacade.RendererFacade.XLeftLimit) { FontSize = 6, TextHorizontalAlign = ceTe.DynamicPDF.TextAlign.Justify });
|
||
|
||
}
|
||
|
||
AddElement(new FormattedTextAreaPDF("Area di pericolo", EnvironmentFacade.RendererFacade.XLeftLimit + 155 - 35) { Y = 217, FontSize = 7, FontBold = true, FontColor = ColorPDF.Bianco, AbsolutePosition = true });
|
||
AddElement(new FormattedTextAreaPDF("Area di equilibrio", EnvironmentFacade.RendererFacade.XLeftLimit + 290 - 35) { Y = 305, FontSize = 7, FontBold = true, FontColor = ColorPDF.Bianco, AbsolutePosition = true });
|
||
AddElement(new FormattedTextAreaPDF("Area di sicurezza", EnvironmentFacade.RendererFacade.XLeftLimit + 425 - 35) { Y = 375, FontSize = 7, FontBold = true, FontColor = ColorPDF.Bianco, AbsolutePosition = true });
|
||
|
||
}
|
||
#endregion Diversificazione portafoglio
|
||
|
||
#region Diversificazione Rischio Mercato
|
||
if (_visualizzaRischioMercatoVsDivRischioMercato)
|
||
{
|
||
//Se è stata visualizzata la sezione precedente "Portafoglio" va aggiunta una nuova pagina
|
||
//if (_visualizzaRischioMercatoVsDivPortafoglio)
|
||
AddElement(new PagePDF(PagePDF.PagePDFType.Generic));
|
||
|
||
var intestazione2 = new SectionHeadingPDF(
|
||
(isAdeguata ? "Proposta" : "Operazioni richieste") + ": rischio mercato vs diversificazione di rischio mercato",
|
||
|
||
EnvironmentFacade.RendererFacade.XLeftLimit,
|
||
EnvironmentFacade.RendererFacade.YUpperLimit,
|
||
EnvironmentFacade.ReportEnvironment.FontFamily);
|
||
|
||
AddElement(intestazione2.ToElement());
|
||
|
||
if (GetTesto1().Length > 0)
|
||
{
|
||
AddElement(new SpacePDF(20));
|
||
AddElement(new FormattedTextAreaPDF(GetTesto1(), EnvironmentFacade.RendererFacade.XLeftLimit) { FontSize = 7, TextHorizontalAlign = ceTe.DynamicPDF.TextAlign.Justify });
|
||
AddElement(new SpacePDF(20));
|
||
}
|
||
|
||
#region Grafico VaR Diversificazione di rischio mercato
|
||
|
||
|
||
AddElement(new FormattedTextAreaPDF("Rischio Mercato (VaR %)", EnvironmentFacade.RendererFacade.XLeftLimit + 110) { FontBold = true, FontSize = 7 });
|
||
AddElement(new SpacePDF(7));
|
||
|
||
var labelPersonalizzateAsseY2 = new List<CombinationPDFCustomLabel>();
|
||
foreach (DataRow rowX in dati.Tables["soglieY"].Rows)
|
||
{
|
||
labelPersonalizzateAsseY2.Add(new CombinationPDFCustomLabel { Text = rowX["Testo"].ToString(), Value = Convert.ToDouble(rowX["Valore"]) });
|
||
}
|
||
|
||
//var graficoCombination2 = new CombinationPDF(EnvironmentFacade.RendererFacade.XLeftLimit + 150, 1F)
|
||
var graficoCombination2 = new CombinationPDF(EnvironmentFacade.RendererFacade.XLeftLimit + 115, 1F)
|
||
{
|
||
Height = 200,
|
||
Width = 350,
|
||
MinorGridAxisY = false,
|
||
BackImage = "ChartGradient_VarDiversificazione.png",
|
||
MarginAxisY = 0,
|
||
ShowLineAxisY = true,
|
||
ShowLabelAxisY = true,
|
||
LabelFormatAxisY = FormatType.Decimale2,
|
||
IntervalNumberAxisY = dati.Tables[2].Rows.Count,
|
||
StartFromZeroAxisY = true,
|
||
IndicatorAxisY = new CombinationPDFIndicator()
|
||
{
|
||
Text = "Rischio Mercato (VaR) massimo",
|
||
Value = Convert.ToDouble(dati.Tables["cliente"].Rows[0]["VarMassimoProfilo"]),
|
||
DeltaX = -115,
|
||
DeltaYText = -10
|
||
},
|
||
MaximumValueAxisY = dati.Tables[2].Rows.Count > 5 ? 53 : 30,
|
||
CustomLabelAxisY = labelPersonalizzateAsseY2,
|
||
|
||
LabelFormatAxisX = FormatType.Intero,
|
||
ShowLineAxisX = true,
|
||
ShowLabelAxisX = true,
|
||
StartFromZeroAxisX = true,
|
||
MaximumValueAxisX = 100,
|
||
IntervalNumberAxisX = 10
|
||
};
|
||
|
||
// creo le Serie
|
||
var d2 = dati.Tables["rischio"].AsEnumerable().OrderByDescending(o => o.Field<int>("Numero")).CopyToDataTable();
|
||
foreach (DataRow item in d2.Rows)
|
||
{
|
||
// lets leave this serie (with visible = false, so that the chart doesnt dissapear)
|
||
series2.Add(
|
||
new Serie
|
||
{
|
||
//il name è fatto così perchè se si stampano 63 e 64 che hanno stessi codicipatrimonio nei grafici, il nome viene registrato e va in errore perchè già presente..
|
||
Name = series2.FirstOrDefault(o => o.Name.Equals(item["CodicePatrimonio"].ToString())) != null ? item["CodicePatrimonio"].ToString() + 1 : item["CodicePatrimonio"].ToString(),
|
||
Type = Dundas.Charting.WebControl.SeriesChartType.Point,
|
||
MarkerImage = item["CodicePatrimonio"].ToString().Equals("PA") ? "PallinoPortafoglioAttuale2_new.png" : "PallinoPortafoglioProposto2_new.png",
|
||
Points = new List<Point>() {
|
||
new Point {
|
||
Values = new ValuesPointXY(Convert.ToDouble(item["DiversificazioneRischioMercato"]), Convert.ToDouble(item["VaR"])),
|
||
ShowLabelAxisY = false,
|
||
ShowLabelAxisX = false,
|
||
Visible = false
|
||
}
|
||
},
|
||
}
|
||
);
|
||
// adding element to new Markers feature
|
||
graficoCombination2.Markers.Add(new Marker()
|
||
{
|
||
Image = item["CodicePatrimonio"].ToString().Equals("PA") ? "PallinoPortafoglioAttuale2_new.png" : "PallinoPortafoglioProposto2_new.png",
|
||
Width = 15,
|
||
Height = 15,
|
||
//Scale = 1,
|
||
X = (float)Convert.ToDouble(item["DiversificazioneRischioMercato"]),
|
||
Y = (float)Convert.ToDouble(item["VaR"]) > 30 ? 30 : (float)Convert.ToDouble(item["VaR"])
|
||
});
|
||
};
|
||
// this point is needed so that horizontal dashed lines dont dissapepar
|
||
// it is visible, but it's X and Y equals -10
|
||
// and it makes it invisible for user
|
||
series2.Add(
|
||
new Serie
|
||
{
|
||
//il name è fatto così perchè se si stampano 63 e 64 che hanno stessi codicipatrimonio nei grafici, il nome viene registrato e va in errore perchè già presente..
|
||
Name = "tmpSerieNeededByDashedHorizontalLines",
|
||
Type = Dundas.Charting.WebControl.SeriesChartType.Point,
|
||
Points = new List<Point>() {
|
||
new Point {
|
||
Values = new ValuesPointXY(-10, -10),
|
||
ShowLabelAxisY = false,
|
||
ShowLabelAxisX = false,
|
||
Visible = true
|
||
}
|
||
},
|
||
}
|
||
);
|
||
|
||
|
||
// aggiungo le Serie al grafico
|
||
graficoCombination2.SeriesCollection = series2;
|
||
|
||
AddElement(graficoCombination2);
|
||
|
||
#endregion
|
||
|
||
AddElement(new SpacePDF(15));
|
||
AddElement(new FormattedTextAreaPDF("Diversificazione di rischio mercato", EnvironmentFacade.RendererFacade.XLeftLimit + 230) { FontBold = true, FontSize = 7 });
|
||
AddElement(new SpacePDF(20));
|
||
|
||
// Stesso spazio con S63
|
||
AddElement(new SpacePDF(20));
|
||
#region Tabella
|
||
|
||
var tabella2 = new TablePDF(EnvironmentFacade.RendererFacade.XLeftLimit, dati.Tables["rischio"])
|
||
{
|
||
Style = Style.ConsulenzaUnica,
|
||
AlternateRow = false,
|
||
ShowSeparationLines = true,
|
||
RowHeight = 27,
|
||
Footer = false,
|
||
HeaderHeight = 30,
|
||
ShowBorderLastLine = true
|
||
};
|
||
|
||
tabella2.Columns.Add(new ColumnPDF("ImmaginePatrimonio", 15, HorizontalAlignmentType.Sinistra, false, false, 7, ColumnType.Immagine, "ImmaginePatrimonio", string.Empty) { DeltaYContent = 6.5F, ScaleColumnTypeImage = 0.27F });
|
||
if (presenzaColonnaGradoCopertura)
|
||
tabella2.Columns.Add(new ColumnPDF("Patrimonio", 110, HorizontalAlignmentType.Sinistra, false, false, 7, ColumnType.Testo, "Patrimonio", "Portafoglio") { HeaderPaddingLeft = 10, PaddingLeft = 10, HeaderFontSize = 7 });
|
||
else
|
||
tabella2.Columns.Add(new ColumnPDF("Patrimonio", 185, HorizontalAlignmentType.Sinistra, false, false, 7, ColumnType.Testo, "Patrimonio", "Portafoglio") { HeaderPaddingLeft = 10, PaddingLeft = 10, HeaderFontSize = 7 });
|
||
tabella2.Columns.Add(new ColumnPDF("Controvalore", 90, HorizontalAlignmentType.Sinistra, false, false, 7, ColumnType.Decimale, "Controvalore", "Controvalore (€)") { HeaderFontSize = 7, PaddingRight = 4 });
|
||
tabella2.Columns.Add(new ColumnPDF("Var", 60, HorizontalAlignmentType.Sinistra, false, false, 7, ColumnType.Testo, "VaRString", "VaR (%)") { HeaderFontSize = 7, PaddingRight = 4 });
|
||
|
||
tabella2.Columns.Add(new ColumnPDF("Diversificazione", 90, HorizontalAlignmentType.Sinistra, false, false, 7, ColumnType.Decimale, "DiversificazioneRischioMercato", "Diversificazione<br>di rischio mercato") { HeaderFontSize = 7, PaddingRight = 4 });
|
||
if (presenzaColonnaGradoCopertura)
|
||
tabella2.Columns.Add(new ColumnPDF("GradoCopertura", 80, HorizontalAlignmentType.Sinistra, false, false, 7, ColumnType.Decimale, "GradoCopertura", "Grado di <br>copertura (%)") { HeaderFontSize = 7, PaddingRight = 4 });
|
||
tabella2.Columns.Add(new ColumnPDF("Adeguatezza", 75, HorizontalAlignmentType.Centrato, false, false, 7, ColumnType.Testo, "AdeguatezzaString", "Adeguatezza") { HeaderFontSize = 7, PaddingRight = 2 });
|
||
|
||
var index2 = 0;
|
||
int colonna2 = 0;
|
||
foreach (DataRow r in tabella2.DataSource.Rows)
|
||
{
|
||
if (presenzaColonnaGradoCopertura)
|
||
colonna2 = 6;
|
||
else
|
||
colonna2 = 5;
|
||
switch (r["AdeguatezzaString"].ToString())
|
||
{
|
||
case "Adeguato":
|
||
tabella2.Cells[colonna2, index2].FontColor = ColorPDF.Verde;
|
||
break;
|
||
case "Non adeguato":
|
||
tabella2.Cells[colonna2, index2].FontColor = ColorPDF.Rosso;
|
||
break;
|
||
default:
|
||
tabella2.Cells[colonna2, index2].FontColor = ColorPDF.Nero;
|
||
break;
|
||
}
|
||
//var colorAdeguatezza = Convert.ToBoolean(r["Adeguatezza"]) ? new ColorPDF(0, 176, 70) : new ColorPDF(255, 0, 0);
|
||
//if(presenzaColonnaGradoCopertura)
|
||
// tabella.Cells[6, index2].FontColor = colorAdeguatezza;
|
||
//else
|
||
// tabella.Cells[5, index2].FontColor = colorAdeguatezza;
|
||
|
||
tabella2.Cells[2, index2].HorizontalAlignment =
|
||
tabella2.Cells[3, index2].HorizontalAlignment =
|
||
tabella2.Cells[4, index2].HorizontalAlignment = HorizontalAlignmentType.Destra;
|
||
if (presenzaColonnaGradoCopertura)
|
||
tabella2.Cells[5, index2].HorizontalAlignment = HorizontalAlignmentType.Destra;
|
||
index2++;
|
||
}
|
||
|
||
AddElement(tabella2);
|
||
|
||
#endregion
|
||
|
||
|
||
if (GetNota1().Length > 0 || GetNota2().Length > 0)
|
||
tabella2.Notes.Add(
|
||
new TableNotePDF(TableNotePDF.TableNotePositionType.PièDiTabella,
|
||
GetNota1() + GetNota2(),
|
||
new[] { "" },
|
||
string.Empty,
|
||
TableNotePDF.TableNoteAsteriskPositionType.CorpoTabella)
|
||
{ FontSize = 6, TextHorizontalAlign = ceTe.DynamicPDF.TextAlign.Justify, DeltaY = 5 }
|
||
);
|
||
|
||
if (GetNota3().Length > 0)
|
||
{
|
||
AddElement(new SpacePDF(GetNota1().Length + GetNota2().Length > 0 ? 10 : 5));
|
||
AddElement(new FormattedTextAreaPDF(GetNota3(), EnvironmentFacade.RendererFacade.XLeftLimit) { FontSize = 6, TextHorizontalAlign = ceTe.DynamicPDF.TextAlign.Justify });
|
||
|
||
}
|
||
|
||
if (datiSeiUnico.rischioUnit().adeguatezza.adeguatezzaTopBean.datiPortafoglio != null && GetNota4().Length > 0)
|
||
{
|
||
AddElement(new SpacePDF(GetNota1().Length + GetNota2().Length > 0 || GetNota3().Length > 0 ? 10 : 5));
|
||
AddElement(new FormattedTextAreaPDF(GetNota4(), EnvironmentFacade.RendererFacade.XLeftLimit) { FontSize = 6, TextHorizontalAlign = ceTe.DynamicPDF.TextAlign.Justify });
|
||
|
||
}
|
||
|
||
if (GetNota5().Length > 0)
|
||
{
|
||
AddElement(new SpacePDF(GetNota1().Length + GetNota2().Length > 0 || GetNota3().Length > 0 || GetNota4().Length > 0 ? 10 : 5));
|
||
AddElement(new FormattedTextAreaPDF(GetNota5(), EnvironmentFacade.RendererFacade.XLeftLimit) { FontSize = 6, TextHorizontalAlign = ceTe.DynamicPDF.TextAlign.Justify });
|
||
|
||
}
|
||
|
||
if (GetNota6().Length > 0)
|
||
{
|
||
AddElement(new SpacePDF(GetNota1().Length + GetNota2().Length > 0 || GetNota3().Length > 0 || GetNota4().Length > 0 || GetNota5().Length > 0 ? 10 : 5));
|
||
AddElement(new FormattedTextAreaPDF(GetNota6(), EnvironmentFacade.RendererFacade.XLeftLimit) { FontSize = 6, TextHorizontalAlign = ceTe.DynamicPDF.TextAlign.Justify });
|
||
|
||
}
|
||
|
||
if (datiSeiUnico.rischioUnit().adeguatezza.adeguatezzaTopBean.flagfiduciariaPluriMandato)
|
||
{
|
||
string testonota637 = isAdeguata ? "La valutazione di adeguatezza del \"portafoglio attuale\" e del \"portafoglio proposto\" in termini di \"Rischio Mercato (VaR)\" e di \"Rischio Credito\" prende in considerazione il patrimonio detenuto presso $/Banca/$ da tutti i mandati fiduciari associati al medesimo fiduciante a cui appartiene il mandato " + datiSeiUnico.getClienteReport().codiceMandato + ", insieme al patrimonio del mandato " + datiSeiUnico.getClienteReport().codiceMandato + " derivante dalla presente proposta (limitatamente al \"portafoglio proposto\"). Gli indicatori \"Rischio Mercato (VaR)\" e \"Rischio Credito\", invece, sono calcolati considerando esclusivamente i prodotti detenuti dal mandato " + datiSeiUnico.getClienteReport().codiceMandato + ", insieme alle operazioni effettuate nella presente proposta. "
|
||
: "La valutazione di adeguatezza del \"portafoglio attuale\" e del \"portafoglio prospettico\" in termini di \"Rischio Mercato (VaR)\" e di \"Rischio Credito\" prende in considerazione il patrimonio detenuto presso $/Banca/$ da tutti i mandati fiduciari associati al medesimo fiduciante a cui appartiene il mandato " + datiSeiUnico.getClienteReport().codiceMandato + ", insieme al patrimonio del mandato " + datiSeiUnico.getClienteReport().codiceMandato + " derivante dalle operazioni da lei richieste al suo private banker (limitatamente al \"portafoglio prospettico\"). Gli indicatori \"Rischio Mercato (VaR)\" e \"Rischio Credito\", invece, sono calcolati considerando esclusivamente i prodotti detenuti dal mandato " + datiSeiUnico.getClienteReport().codiceMandato + ", insieme alle operazioni da lei richieste al suo private banker. ";
|
||
AddElement(new SpacePDF(GetNota1().Length + GetNota2().Length > 0 || GetNota3().Length > 0 || GetNota4().Length > 0 || GetNota5().Length > 0 || GetNota6().Length > 0 ? 10 : 5));
|
||
AddElement(new FormattedTextAreaPDF(datiSeiUnico.FormatBanca(testonota637), EnvironmentFacade.RendererFacade.XLeftLimit) { FontSize = 6, TextHorizontalAlign = ceTe.DynamicPDF.TextAlign.Justify });
|
||
}
|
||
|
||
if (GetNota7().Length > 0)
|
||
{
|
||
AddElement(new SpacePDF(datiSeiUnico.rischioUnit().adeguatezza.adeguatezzaTopBean.flagfiduciariaPluriMandato || GetNota1().Length + GetNota2().Length > 0 || GetNota3().Length > 0 || GetNota4().Length > 0 || GetNota5().Length > 0 || GetNota7().Length > 0 ? 10 : 5));
|
||
AddElement(new FormattedTextAreaPDF(GetNota7(), EnvironmentFacade.RendererFacade.XLeftLimit) { FontSize = 6, TextHorizontalAlign = ceTe.DynamicPDF.TextAlign.Justify });
|
||
|
||
}
|
||
|
||
AddElement(new FormattedTextAreaPDF("Area di pericolo", EnvironmentFacade.RendererFacade.XLeftLimit + 155 - 35) { Y = 217, FontSize = 7, FontBold = true, FontColor = ColorPDF.Bianco, AbsolutePosition = true });
|
||
AddElement(new FormattedTextAreaPDF("Area di equilibrio", EnvironmentFacade.RendererFacade.XLeftLimit + 290 - 35) { Y = 305, FontSize = 7, FontBold = true, FontColor = ColorPDF.Bianco, AbsolutePosition = true });
|
||
AddElement(new FormattedTextAreaPDF("Area di sicurezza", EnvironmentFacade.RendererFacade.XLeftLimit + 425 - 35) { Y = 375, FontSize = 7, FontBold = true, FontColor = ColorPDF.Bianco, AbsolutePosition = true });
|
||
}
|
||
}
|
||
#endregion Diversificazione Rischio Mercato
|
||
|
||
/// <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 sealed override DataSet GetDataSet()
|
||
{
|
||
#region Dataset + tabelle
|
||
var ds = new DataSet();
|
||
ds.Tables.Add(new DataTable("rischio"));
|
||
ds.Tables.Add(new DataTable("cliente"));
|
||
ds.Tables.Add(new DataTable("soglieY"));
|
||
#endregion
|
||
|
||
#region Estrazione dati
|
||
//profilo finanziario cliente/nucleo
|
||
var varMassimoProfiloCliente = datiSeiUnico.piramideModelloUnit().questionarioMifid.profileVarMax;
|
||
|
||
//Adriano
|
||
#region Cliente professionale
|
||
var cliente = datiSeiUnico.clienteUnit().anagrafica;
|
||
|
||
bool profiloProfessionale;
|
||
bool profiloAggressivo;
|
||
bool profiloProfessionaleAggressivo;
|
||
|
||
var profiler = new Profiler(cliente);
|
||
|
||
profiloProfessionale = profiler.ProfiloProfessionale;
|
||
profiloAggressivo = profiler.ProfiloAggressivo;
|
||
profiloProfessionaleAggressivo = profiler.ProfiloProfessionaleAggressivo;
|
||
|
||
//Adriano per test:
|
||
//profiloProfessionale = true;
|
||
//profiloAggressivo = true;
|
||
//profiloProfessionaleAggressivo = true;
|
||
|
||
#endregion
|
||
|
||
// Verificare il valore fornito dal WS, che potrebbe essere già corretto
|
||
if (profiloProfessionaleAggressivo)
|
||
varMassimoProfiloCliente = 50;
|
||
//--Adriano
|
||
#region RC
|
||
var adegRischioCreditoAttuale = (from o in datiSeiUnico.rischioUnit().adeguatezza.adeguatezzaTopBean.listaAdeguatezza where o.id == "RC" select o).LastOrDefault();
|
||
var adegRischioCreditoProposto = (from o in datiSeiUnico.propostaUnit().stAdequatezza.listaDettagliAdeguatezza where o.idDescIndicatore == "RC" select o).LastOrDefault();
|
||
#endregion
|
||
|
||
#region RM
|
||
var adegRischioMercatoAttuale = (from o in datiSeiUnico.rischioUnit().adeguatezza.adeguatezzaTopBean.listaAdeguatezza where o.id == "RM" select o).LastOrDefault();
|
||
var adegRischioMercatoProposto = (from o in datiSeiUnico.propostaUnit().stAdequatezza.listaDettagliAdeguatezza where o.idDescIndicatore == "RM" select o).LastOrDefault();
|
||
#endregion
|
||
|
||
var rischio = datiSeiUnico.rischioUnit().rischio.rischioMercatoCredito;
|
||
var datiPortaglioAttuale = datiSeiUnico.rischioUnit().adeguatezza.adeguatezzaTopBean.datiPortafoglio;
|
||
var portafoglioproposto = datiSeiUnico.propostaUnit().stDettaglioProposta;
|
||
var datiAdeguatezzaProposta = datiSeiUnico.propostaUnit().stAdequatezza;
|
||
#endregion
|
||
if (datiPortaglioAttuale != null)
|
||
presenzaColonnaGradoCopertura = datiPortaglioAttuale.copertura < 100 || portafoglioproposto.copertura < 100;
|
||
else
|
||
presenzaColonnaGradoCopertura = false;
|
||
|
||
#region Rischio
|
||
|
||
ds.Tables["rischio"].Columns.Add(new DataColumn("Numero", typeof(int)));
|
||
ds.Tables["rischio"].Columns.Add(new DataColumn("Patrimonio", typeof(string)));
|
||
ds.Tables["rischio"].Columns.Add(new DataColumn("CodicePatrimonio", typeof(string)));
|
||
ds.Tables["rischio"].Columns.Add(new DataColumn("ImmaginePatrimonio", typeof(string)));
|
||
ds.Tables["rischio"].Columns.Add(new DataColumn("Controvalore", typeof(decimal)));
|
||
ds.Tables["rischio"].Columns.Add(new DataColumn("VaR", typeof(decimal)));
|
||
ds.Tables["rischio"].Columns.Add(new DataColumn("VaRString", typeof(string)));
|
||
ds.Tables["rischio"].Columns.Add(new DataColumn("Diversificazione", typeof(decimal)));
|
||
ds.Tables["rischio"].Columns.Add(new DataColumn("DiversificazionePortafoglio", typeof(decimal)));
|
||
ds.Tables["rischio"].Columns.Add(new DataColumn("DiversificazioneRischioMercato", typeof(decimal)));
|
||
ds.Tables["rischio"].Columns.Add(new DataColumn("GradoCopertura", typeof(decimal)));
|
||
ds.Tables["rischio"].Columns.Add(new DataColumn("Adeguatezza", typeof(bool)));
|
||
ds.Tables["rischio"].Columns.Add(new DataColumn("AdeguatezzaString", typeof(string)));
|
||
#region Attuale
|
||
|
||
if (datiPortaglioAttuale != null)
|
||
{
|
||
ds.Tables["rischio"].Rows.Add(
|
||
1, //NumeroPatrimonio
|
||
"Portafoglio attuale" + (GetNota1().Length > 0 ? "*" : ""), //Patrimonio
|
||
"PA", //CodicePortafoglio
|
||
"PallinoPortafoglioAttuale_new.png", //pallino
|
||
datiSeiUnico.ATTUTALE_TOTALEPOSITIVO, //Controvalore
|
||
datiPortaglioAttuale.valoreVaR, //VaR
|
||
adegRischioMercatoAttuale.patrimonioFideuram == "n.c." ?
|
||
adegRischioMercatoAttuale.patrimonioFideuram = "n.c."
|
||
: adegRischioMercatoAttuale.patrimonioFideuram.Replace(".", ","), //VaRString
|
||
//Diversificazione
|
||
datiPortaglioAttuale.beneficioDiversificazione,
|
||
//Diversificazione di Portafoglio
|
||
rischio.diversicazioneCasa.beneficio.Count() > 0 ?
|
||
rischio.diversicazioneCasa.beneficio.FirstOrDefault(o => o.key.ToUpper().Equals("BENEFICIO")).value
|
||
: 0,
|
||
//Diversificazione del Rischio Mercato
|
||
rischio.diversicazioneCasa.beneficio.Count() > 0 ?
|
||
rischio.diversicazioneCasa.beneficio.FirstOrDefault(o => o.key.ToUpper().Equals("DIVERSIFICAZIONERISCHIOMERCATO")).value
|
||
: 0,
|
||
|
||
//rischio.diversicazioneCasa.beneficio.FirstOrDefault(o => o.key.ToUpper().Equals("BENEFICIO")).value,
|
||
//rischio.diversicazioneCasa.beneficio.FirstOrDefault(o => o.key.ToUpper().Equals("DIVERSIFICAZIONERISCHIOMERCATO")).value,
|
||
|
||
datiPortaglioAttuale.copertura, //GradoCopertura
|
||
adegRischioMercatoAttuale.isAdeguato,
|
||
//!adegRischioCreditoAttuale.isAdeguatoSpecified ? "n.a." : (datiPortaglioAttuale.copertura > 0 ? adegRischioMercatoAttuale.isAdeguato ? "Adeguato" : "Non adeguato" : "n.c.")//AdeguatezzaString
|
||
!adegRischioCreditoAttuale.isAdeguatoSpecified ? "n.a." : (adegRischioCreditoAttuale.isAdeguato && adegRischioMercatoAttuale.isAdeguato ? "Adeguato" : "Non adeguato") //AdeguatezzaString
|
||
);
|
||
}
|
||
#endregion
|
||
|
||
#region Proposto
|
||
|
||
ds.Tables["rischio"].Rows.Add(
|
||
2, //NumeroPatrimonio
|
||
"Portafoglio " + (datiSeiUnico.flagAdeguatezzaPro() ? "proposto" : "prospettico") + (GetNota2().Length > 0 ? "*" : ""), //Patrimonio
|
||
"PP", //CodicePortafoglio
|
||
"PallinoPortafoglioProposto_new.png", //pallino
|
||
datiSeiUnico.PROPOSTO_TOTALEPOSITIVO, //Controvalore
|
||
portafoglioproposto.rischioMercato, //VaR
|
||
portafoglioproposto.rischioMercatoDec, //VaRString
|
||
//Diversificazione
|
||
Math.Round(portafoglioproposto.diversificazione, 2),
|
||
//Diversificazione Portafoglio proposto
|
||
//34.82, // ->
|
||
portafoglioproposto.diversificazioneProposta.FirstOrDefault(o => o.key.ToUpper().Equals("BENEFICIO")).value,
|
||
//Diversificazione Rischio Mercato proposto
|
||
//34.82,
|
||
portafoglioproposto.diversificazioneProposta.FirstOrDefault(o => o.key.ToUpper().Equals("DIVERSIFICAZIONERISCHIOMERCATO")).value,
|
||
Math.Round(portafoglioproposto.copertura, 2), //GradoCopertura
|
||
adegRischioMercatoProposto.flagAdeguatezza, //Adeguatezza TODO
|
||
!adegRischioMercatoProposto.flagAdeguatezzaSpecified ? "n.a." : (adegRischioMercatoProposto.flagAdeguatezza ? "Adeguato" : "Non adeguato") //AdeguatezzaString
|
||
); //Adeguatezza
|
||
#endregion
|
||
|
||
#endregion
|
||
|
||
#region Cliente
|
||
|
||
ds.Tables["cliente"].Columns.Add(new DataColumn("VarMassimoProfilo", typeof(decimal)));
|
||
ds.Tables["cliente"].Rows.Add(varMassimoProfiloCliente);
|
||
|
||
#endregion
|
||
|
||
#region Soglie Asse Y
|
||
ds.Tables["soglieY"].Columns.Add(new DataColumn("Valore", typeof(decimal)));
|
||
ds.Tables["soglieY"].Columns.Add(new DataColumn("Testo", typeof(string)));
|
||
|
||
//Adriano
|
||
if (profiloProfessionaleAggressivo)
|
||
{
|
||
ds.Tables["soglieY"].Rows.Add(5, "5,00");
|
||
ds.Tables["soglieY"].Rows.Add(10, "10,00");
|
||
ds.Tables["soglieY"].Rows.Add(15, "15,00");
|
||
ds.Tables["soglieY"].Rows.Add(20, "20,00");
|
||
ds.Tables["soglieY"].Rows.Add(25, "25,00");
|
||
ds.Tables["soglieY"].Rows.Add(30, "30,00");
|
||
ds.Tables["soglieY"].Rows.Add(35, "35,00");
|
||
ds.Tables["soglieY"].Rows.Add(40, "40,00");
|
||
ds.Tables["soglieY"].Rows.Add(45, "45,00");
|
||
ds.Tables["soglieY"].Rows.Add(50, "50,00");
|
||
}
|
||
else
|
||
{
|
||
ds.Tables["soglieY"].Rows.Add(2, "2,00");
|
||
ds.Tables["soglieY"].Rows.Add(4.5, "4,50");
|
||
ds.Tables["soglieY"].Rows.Add(9.5, "9,50");
|
||
ds.Tables["soglieY"].Rows.Add(15, "15,00");
|
||
ds.Tables["soglieY"].Rows.Add(27, "27,00");
|
||
}
|
||
//--Adriano
|
||
//originale:
|
||
//ds.Tables["soglieY"].Rows.Add(2, "2,00");
|
||
//ds.Tables["soglieY"].Rows.Add(4.5, "4,50");
|
||
//ds.Tables["soglieY"].Rows.Add(9.5, "9,50");
|
||
//ds.Tables["soglieY"].Rows.Add(15, "15,00");
|
||
//ds.Tables["soglieY"].Rows.Add(27, "27,00");
|
||
|
||
#endregion
|
||
|
||
return ds;
|
||
}
|
||
|
||
public virtual string GetTesto1()
|
||
{
|
||
bool isAdeguata = datiSeiUnico.flagAdeguatezzaPro();
|
||
string testo = "";
|
||
string banca = "$/Banca/$";
|
||
banca = /*"altri Istituti";*/ banca.Replace("$/Banca/$", Helper.ReplaceVariables("$/Banca/$", EnvironmentFacade.ReportEnvironment));
|
||
testo = isAdeguata ?
|
||
"In questa scheda è riportato il confronto, in termini di Rischio Mercato (VaR) e di Diversificazione, tra il patrimonio che lei attualmente detiene presso " + banca + " (\"portafoglio attuale\") e il patrimonio derivante dalla presente proposta (\"portafoglio proposto\"). " :
|
||
"In questa scheda è riportato il confronto, in termini di Rischio Mercato (VaR) e di Diversificazione, tra il patrimonio che lei attualmente detiene presso " + banca + " (\"portafoglio attuale\") e il patrimonio derivante dalle operazioni da lei richieste al suo private banker (\"portafoglio prospettico\"). ";
|
||
|
||
return testo;
|
||
}
|
||
|
||
|
||
|
||
|
||
public virtual string GetNota1()
|
||
{
|
||
string nota = string.Empty;
|
||
|
||
// 20181009 AC
|
||
//if (getCCN_CASA() != 0 || getGPELIGOFONDI_CASA() != 0 || getGPELIGOTITOLI_CASA() != 0)
|
||
if (getCCN_CASA() != 0 || getGPELIGOFONDI_CASA() != 0 || getGPELIGOTITOLI_CASA() != 0 || getTUOFOGLIO_CASA() != 0)
|
||
//20181009 AC
|
||
{
|
||
nota = "Il controvalore del portafoglio attuale esclude il saldo negativo ";
|
||
if (getCCN_CASA() != 0)
|
||
nota += "dei conti correnti (" + Helper.FormatCurrency(getCCN_CASA().ToString()) + " €)";
|
||
// 20181009 AC
|
||
if (getTUOFOGLIO_CASA() != 0)
|
||
{
|
||
nota += getCCN_CASA() != 0 ? ", " : "";
|
||
nota += "della liquidità sottostante Il Mio Foglio (" + Helper.FormatCurrency(getTUOFOGLIO_CASA().ToString()) + "€)";
|
||
}
|
||
//--20181009 AC
|
||
if (getGPELIGOFONDI_CASA() != 0)
|
||
{
|
||
// 20181009 AC
|
||
//nota += getCCN_CASA() != 0 ? ", " : "";
|
||
nota += (getCCN_CASA() != 0 || getTUOFOGLIO_CASA() != 0) ? ", " : "";
|
||
//--20181009 AC
|
||
nota += "della liquidità sottostante la GP Eligo Fondi (" + Helper.FormatCurrency(getGPELIGOFONDI_CASA().ToString()) + "€)";
|
||
}
|
||
|
||
if (getGPELIGOTITOLI_CASA() != 0)
|
||
{
|
||
// 20181009 AC
|
||
//nota += (getCCN_CASA() != 0 || getGPELIGOFONDI_CASA() != 0) ? ", " : "";
|
||
nota += (getCCN_CASA() != 0 || getTUOFOGLIO_CASA() != 0 || getGPELIGOFONDI_CASA() != 0) ? ", " : "";
|
||
//--20181009 AC
|
||
nota += "della liquidità sottostante la GP Eligo Titoli (" + Helper.FormatCurrency(getGPELIGOTITOLI_CASA().ToString()) + "€)";
|
||
}
|
||
nota += ". ";
|
||
}
|
||
return nota;
|
||
}
|
||
|
||
public virtual string GetNota2()
|
||
{
|
||
string nota = "";
|
||
|
||
// 20181009 AC
|
||
//if (getPropostaCCN_CASA() != 0 || getPropostaGPELIGOFONDI_CASA() != 0 || getPropostaGPELIGOTITOLI_CASA() != 0)
|
||
if (getPropostaCCN_CASA() != 0 || getPropostaGPELIGOFONDI_CASA() != 0 || getPropostaGPELIGOTITOLI_CASA() != 0 || getPropostaTUOFOGLIO_CASA() != 0)
|
||
//--20181009
|
||
{
|
||
nota += "Il controvalore del portafoglio " + (datiSeiUnico.flagAdeguatezzaPro() ? "proposto" : "prospettico") + " esclude il saldo negativo ";
|
||
if (getPropostaCCN_CASA() != 0)
|
||
nota += "dei conti correnti (" + Helper.FormatCurrency(getTotaleNonRappr().ToString()) + " €)";
|
||
|
||
// 20181009 AC
|
||
if (getPropostaTUOFOGLIO_CASA() != 0)
|
||
{
|
||
nota += getCCN_CASA() != 0 ? ", " : "";
|
||
nota += "della liquidità sottostante Il Mio Foglio (" + Helper.FormatCurrency(getPropostaTUOFOGLIO_CASA().ToString()) + "€)";
|
||
}
|
||
//--20181009 AC
|
||
if (getPropostaGPELIGOFONDI_CASA() != 0)
|
||
{
|
||
// 20181009 AC
|
||
//nota += getCCN_CASA() != 0 ? ", " : "";
|
||
nota += (getCCN_CASA() != 0 || getPropostaTUOFOGLIO_CASA() != 0) ? ", " : "";
|
||
//--2018009 AC
|
||
nota += "della liquidità sottostante la GP Eligo Fondi (" + Helper.FormatCurrency(getPropostaGPELIGOFONDI_CASA().ToString()) + "€)";
|
||
}
|
||
|
||
if (getGPELIGOTITOLI_CASA() != 0)
|
||
{
|
||
// 20181009 AC
|
||
//nota += (getPropostaCCN_CASA() != 0 || getPropostaGPELIGOFONDI_CASA() != 0) ? ", " : "";
|
||
nota += (getPropostaCCN_CASA() != 0 || getPropostaTUOFOGLIO_CASA()!= 0 || getPropostaGPELIGOFONDI_CASA() != 0) ? ", " : "";
|
||
//--20181009 AC
|
||
nota += "della liquidità sottostante la GP Eligo Titoli (" + Helper.FormatCurrency(getPropostaGPELIGOTITOLI_CASA().ToString()) + "€)";
|
||
}
|
||
nota += ". ";
|
||
}
|
||
return nota;
|
||
}
|
||
|
||
public virtual string GetNota3()
|
||
{
|
||
|
||
foreach (var item in datiSeiUnico.propostaUnit().dettaglioOperazioni.elencoDettagliOperazioni)
|
||
{
|
||
foreach (var i in item.listaOperzioni)
|
||
{
|
||
if (i.investi != 0) return "";
|
||
}
|
||
}
|
||
string nota = "A prescindere dai singoli indicatori di rischio relativi al patrimonio derivante dalla presente proposta (";
|
||
nota += "\"portafoglio proposto\"), la proposta risulta adeguata in quanto contiene esclusivamente operazioni di vendita ";
|
||
nota += "/ liquidazione / riscatto, che non sono oggetto di valutazione di adeguatezza. ";
|
||
return nota;
|
||
}
|
||
|
||
public virtual string GetNota4()
|
||
{
|
||
string nota = "";
|
||
var GCproposto = datiSeiUnico.propostaUnit().stDettaglioProposta.copertura;
|
||
var coperturaDeltaRM = datiSeiUnico.propostaUnit().stAdequatezza.listaDettagliAdeguatezza.FirstOrDefault(x => x.idDescIndicatore.Equals("RM")).coperturaDelta;
|
||
var varProposto = datiSeiUnico.propostaUnit().stDettaglioProposta.rischioMercato;
|
||
var varAttuale = Convert.ToDecimal(datiSeiUnico.rischioUnit().adeguatezza.adeguatezzaTopBean.datiPortafoglio.valoreVaR);
|
||
var varMax = datiSeiUnico.piramideModelloUnit().questionarioMifid.profileVarMax;
|
||
|
||
|
||
bool prospetticoMigliorativoVar = varAttuale > varMax & varProposto < varAttuale & varProposto > varMax;
|
||
bool coperturaAdeguatezza = GCproposto < 90 & coperturaDeltaRM.Equals("100.00");
|
||
|
||
if (prospetticoMigliorativoVar || coperturaAdeguatezza)
|
||
{
|
||
nota = "La valutazione di adeguatezza in termini di Rischio Mercato (VaR) è stata effettuata verificando che il livello di Rischio Mercato (VaR) delle sole operazioni d’investimento";
|
||
nota += datiSeiUnico.flagAdeguatezzaPro() ?
|
||
" effettuate sia coerente con la soglia massima associata al suo profilo finanziario." :
|
||
" da lei richieste al suo private banker sia coerente con la soglia massima associata al suo profilo finanziario.";
|
||
}
|
||
|
||
return nota;
|
||
}
|
||
|
||
|
||
|
||
public virtual string GetNota5()
|
||
{
|
||
string nota = "";
|
||
|
||
var RM = !datiSeiUnico.propostaUnit().stAdequatezza.listaDettagliAdeguatezza.AsEnumerable().FirstOrDefault(o => o.idDescIndicatore == "RM").copertura.Equals("100.00");
|
||
var RC = false;
|
||
if (!datiSeiUnico.flagAdeguatezzaPro() && (RM || RC))
|
||
{
|
||
|
||
|
||
|
||
nota += "Il patrimonio derivante dalle operazioni da lei richieste al suo private banker (\"portafoglio prospettico\") risulta non adeguato al suo profilo finanziario in termini di " +
|
||
(RM ? RC ? "Rischio Mercato (VaR) e di Rischio Credito" : "Rischio Mercato (VaR)" : RC ? "Rischio Credito" : "") +
|
||
", in quanto le operazioni da lei richieste al suo private banker hanno ad oggetto uno o più prodotti per cui non è disponibile " +
|
||
(RM ? RC ? "il relativo livello di Rischio Mercato (VaR) e la relativa classe di Rischio Credito" : "il relativo livello di Rischio Mercato (VaR)" : RC ? "la relativa classe di Rischio Credito" : "") +
|
||
".";
|
||
|
||
|
||
|
||
}
|
||
return datiSeiUnico.FormatBanca(nota);
|
||
}
|
||
|
||
public virtual string GetNota6()
|
||
{
|
||
string nota = string.Empty;
|
||
if (datiSeiUnico.propostaUnit().stAdequatezza.flagAdeguatezzaMIFIDPro)
|
||
{
|
||
nota += "La valutazione di adeguatezza del patrimonio derivante dalla presente proposta (\"portafoglio proposto\") ";
|
||
nota += "non è necessaria in quanto tutti i prodotti oggetto delle operazioni di investimento effettuate non sono ";
|
||
nota += "soggetti alla valutazione di adeguatezza MiFID. ";
|
||
}
|
||
return nota;
|
||
}
|
||
|
||
public virtual string GetNota7()
|
||
{
|
||
string nota = string.Empty;
|
||
if (datiSeiUnico.propostaUnit().stAdequatezza.flagVarEccessivamenteAdeguatoPro)
|
||
{
|
||
nota += "Il patrimonio derivante dalla presente proposta (\"portafoglio proposto\") risulta adeguato al suo profilo ";
|
||
nota += "finanziario. Le segnaliamo, tuttavia, che il livello di Rischio Mercato (VaR) del patrimonio derivante dalla ";
|
||
nota += "presente proposta (\"portafoglio proposto\") si posiziona su un valore sensibilmente inferiore rispetto alla ";
|
||
nota += "soglia minima attribuita al suo profilo finanziario. ";
|
||
}
|
||
return nota;
|
||
}
|
||
|
||
public virtual decimal getCCN_CASA()
|
||
{
|
||
return datiSeiUnico.pianificazioneUnit().pianificazioneVerticale.contoCorrenteNegativo;
|
||
}
|
||
|
||
public virtual decimal getTotaleNonRappr()
|
||
{
|
||
return datiSeiUnico.patrimonioUnit().patrimonioCasa.esposizioneValutariaTutte.distribuzione.totaleNonRappr;
|
||
}
|
||
|
||
public virtual decimal getGPELIGOFONDI_CASA()
|
||
{
|
||
return datiSeiUnico.pianificazioneUnit().pianificazioneVerticale.liqEligoFondiNeg;
|
||
}
|
||
|
||
public virtual decimal getGPELIGOTITOLI_CASA()
|
||
{
|
||
return datiSeiUnico.pianificazioneUnit().pianificazioneVerticale.liqEligoTitoliNeg;
|
||
}
|
||
|
||
public virtual decimal getPropostaCCN_CASA()
|
||
{
|
||
return datiSeiUnico.propostaUnit().stDettaglioProposta.contoCorrenteNegativo;
|
||
}
|
||
|
||
public virtual decimal getPropostaGPELIGOFONDI_CASA()
|
||
{
|
||
return datiSeiUnico.propostaUnit().stDettaglioProposta.liqEligoFondiNeg;
|
||
}
|
||
|
||
public virtual decimal getPropostaGPELIGOTITOLI_CASA()
|
||
{
|
||
return datiSeiUnico.propostaUnit().stDettaglioProposta.liqEligoTitoliNeg;
|
||
}
|
||
|
||
// 20181009 AC
|
||
public virtual decimal getTUOFOGLIO_CASA() {
|
||
return datiSeiUnico.pianificazioneUnit().pianificazioneVerticale.liqFogliNeg;
|
||
}
|
||
|
||
public virtual decimal getPropostaTUOFOGLIO_CASA()
|
||
{
|
||
return datiSeiUnico.propostaUnit().stDettaglioProposta.liqFogliNeg; //<- SOSTITUIRE CON LA PROPRIETA' CORRETTA DI datiSeiUnico
|
||
}
|
||
//--20181009 AC
|
||
}
|
||
} |