using System;
using Consulenza.ReportWriter.Business;
using Consulenza.ReportWriter.Business.OBJ_PDF;
using System.Data;
using Consulenza.ReportCommon;
using Consulenza.ReportWriter.Business.CHART_PDF;
using System.Collections.Generic;
using Consulenza.ReportWriter.Business.Entity;
using System.Linq;
using Consulenza.DataServices.fideuram.data.service;
namespace Consulenza.ReportWriter.Manager.Section.Unica
{
///
/// Scheda 13. Patrimonio Fideuram: protezione del capitale. IdSezione 56
///
public class S13 : Entity.Section
{
public S13(EnvironmentFacade environmentFacade, int idSection)
: base(environmentFacade, idSection)
{
try
{
Draw();
}
catch (Exception ex)
{
SectionLogger.Write("S13", ex.Message, SectionLoggerMessageLevel.E, EnvironmentFacade.ReportEnvironment);
}
}
protected override sealed void Draw()
{
var dati = GetDataSet();
bool saltoPagina = false;
#region Piramide dei bisogni con l'Area Tutela
if (piramideBisogni())
{
#region Tabella delle Aree di Bisogno
var areaOrdinata = dati.Tables["area"].AsEnumerable().OrderBy(x => x.Field("Ordinamento")).CopyToDataTable();
var tabellaAree = new TablePDF(EnvironmentFacade.RendererFacade.XLeftLimit, areaOrdinata, dati.Tables["areaFooter"])
{
Style = Style.ConsulenzaUnica,
AlternateRow = false,
ShowSeparationLines = false,
RowsPadding = 0f,
RowHeight = 45f,
Footer = true,
HeaderHeight = 27,
HeaderMargin = 2,
FooterYOffset = 5F,
SpecifiedRowHeights = new List { 76, 50, 50, 49, 52, 44 }
};
for (int j = 0; j < tabellaAree.SpecifiedRowHeights.Count; j++)
{
tabellaAree.SpecifiedRowHeights[j] *= 0.5f;
}
//tabellaAree.Columns.Add(new ColumnPDF("Area2", 120, HorizontalAlignmentType.Sinistra, false, false, 7, ColumnType.Objectpdf, "Area", "Area di bisogno") { DeltaYContent = 2, ScaleColumnTypeImage = 1f, HeaderFontSize = 7, FontSize = 7 });
//tabellaAree.Columns.Add(new ColumnPDF("Controvalore", 90, HorizontalAlignmentType.Sinistra, false, false, 7, ColumnType.Testo, "Controvalore", "Controvalore (€)") { DeltaYContent = 5, HeaderFontSize = 7, FontSize = 7 });
//tabellaAree.Columns.Add(new ColumnPDF("ControvaloreProtetto", 90, HorizontalAlignmentType.Sinistra, false, false, 7, ColumnType.Testo, "ControvaloreProtetto", "Controvalore
protetto (€)") { DeltaYContent = 5, HeaderFontSize = 7, FontSize = 7, HeaderPaddingLeft = 4 });
//tabellaAree.Columns.Add(new ColumnPDF("ContributoPercentualeProtezioneObject", 220, HorizontalAlignmentType.Sinistra, false, false, 7, ColumnType.Objectpdf, "ContributoPercentualeProtezione", "Contributo alla protezione (%)") { DeltaYContent = 7, PaddingLeft = 10, HeaderPaddingLeft = 10, HeaderFontSize = 7, FontSize = 7 });
tabellaAree.Columns.Add(new ColumnPDF("Area2", 120, HorizontalAlignmentType.Centrato, false, false, 7, ColumnType.Objectpdf, "Area", "Area di bisogno") { DeltaYContent = 2, ScaleColumnTypeImage = 1f, HeaderFontSize = 7, FontSize = 7 });
tabellaAree.Columns.Add(new ColumnPDF("Controvalore", 90, HorizontalAlignmentType.Destra, false, false, 7, ColumnType.Testo, "Controvalore", "Controvalore (€)") { DeltaYContent = 5, HeaderFontSize = 7, FontSize = 7 });
tabellaAree.Columns.Add(new ColumnPDF("ControvaloreProtetto", 90, HorizontalAlignmentType.Destra, false, false, 7, ColumnType.Testo, "ControvaloreProtetto", "Controvalore
protetto (€)") { DeltaYContent = 5, HeaderFontSize = 7, FontSize = 7, HeaderPaddingLeft = 4 });
tabellaAree.Columns.Add(new ColumnPDF("ContributoPercentualeProtezioneObject", 220, HorizontalAlignmentType.Sinistra, false, false, 7, ColumnType.Objectpdf, "ContributoPercentualeProtezione", "Contributo alla protezione (%)") { DeltaYContent = 7, PaddingLeft = 10, HeaderPaddingLeft = 10, HeaderFontSize = 7, FontSize = 7 });
tabellaAree.FooterColumns.Add(new ColumnPDF("Area", 120, HorizontalAlignmentType.Sinistra, true, true, 7, ColumnType.Testo) { ScaleColumnTypeImage = 0.5F, FontSize = 7 });
tabellaAree.FooterColumns.Add(new ColumnPDF("Controvalore", 90, HorizontalAlignmentType.Destra, true, true, 7, ColumnType.Decimale) { FontSize = 7 });
tabellaAree.FooterColumns.Add(new ColumnPDF("ControvaloreProtetto", 90, HorizontalAlignmentType.Destra, true, true, 7, ColumnType.Decimale) { FontSize = 7 });
tabellaAree.FooterColumns.Add(new ColumnPDF("Spazio", 220, HorizontalAlignmentType.Destra, true, true, 7, ColumnType.Testo) { FontSize = 7 });
#region Nomi Area dell'immagine
for (int a = 0; a < areaOrdinata.Rows.Count; a++)
{
#region Immagine Piramide Modello
//tabellaAree.Cells[0, a].ValueObjectList.Add(new ImagePDF(0, 1, areaOrdinata.Rows[a].ItemArray[0].ToString())
//{
// DeltaX = 3,
// DeltaY = 0,
// Height = tabellaAree.SpecifiedRowHeights[a], //27 was here
// Width = 145
//});
var textArea = new FormattedTextAreaPDF(areaOrdinata.Rows[a].ItemArray[1].ToString(), 0)
{
DeltaY = 6f,
FontSize = 8f
};
var labelSize = Helper.GetNumericStringWidth(textArea.Text);
float addition = 0;
float additionY = 0;
switch (textArea.Text)
{
case "Investimento":
addition = 2.5f;
additionY = 1;
break;
case "Previdenza":
addition = 2.5f;
additionY = 1;
break;
case "Riserva":
addition = 1.5f;
additionY = 1;
break;
case "Liquidità":
addition = 0.5f;
additionY = 1;
break;
case "Extra Rendimento":
addition = 5.5f;
additionY = 7;
break;
case "Tutela":
addition = 6.5f;
break;
}
textArea.DeltaX = 106 + addition - labelSize;
textArea.DeltaY += additionY;
textArea.Text = Helper.FirstCharToUpper(textArea.Text);
tabellaAree.Cells[0, a].ValueObjectList.Add(textArea);
#endregion
}
var yRowContentOffsets = new List { 4, 0, 0, 0, 0, 0 };
int b = 0;
for (b = 0; b < tabellaAree.RowsCount; b++)
{
for (int j = 0; j < tabellaAree.Columns.Count; j++)
{
tabellaAree.Cells[j, b].YContentOffset += yRowContentOffsets[b];
}
}
#endregion
#region Grafico
int i = 0;
var list = new List();
list.Add(Convert.ToDouble(areaOrdinata.AsEnumerable().Max(x => x["ContributoProtezione"])));
var valoreMassimo = (float)Helper.Round(list.Max());
float larghezzaBarra = 0;
float larghezzaSpazioTestoPercentuale = 0;
float larghezzaMinimaSpazioTestoPercentuale = 35;
float deltaXBarra = 0;
foreach (DataRow row in areaOrdinata.Rows)
{
// Re-inserito da ES in data 17.10.2017
if (row.Field("Description").ToLower().Equals("tutela"))
{
tabellaAree.Cells[1, i].HorizontalAlignment = tabellaAree.Cells[2, i].HorizontalAlignment = HorizontalAlignmentType.Destra;
tabellaAree.Cells[0, i].ColSpan = 4;
continue;
}
// End
tabellaAree.Cells[1, i].HorizontalAlignment = tabellaAree.Cells[2, i].HorizontalAlignment = HorizontalAlignmentType.Destra;
tabellaAree.Cells[1, i].Value = Helper.FormatCurrency(row["Controvalore"].ToString());
tabellaAree.Cells[2, i].Value = Helper.FormatCurrency(row["ControvaloreProtetto"].ToString());
var colore = ColorPDF.GetBy_AreaBisogno("Tut");
#region barra colonna ContributoProtezione
larghezzaBarra = Helper.GetWidthProportional((float)Convert.ToDecimal(row["ContributoProtezione"]), valoreMassimo, tabellaAree.Columns[3].Width - 12);
larghezzaSpazioTestoPercentuale = tabellaAree.Columns[3].Width - larghezzaBarra;
deltaXBarra = larghezzaBarra + 10;
if (larghezzaSpazioTestoPercentuale < larghezzaMinimaSpazioTestoPercentuale)
{
deltaXBarra = (tabellaAree.Columns[3].Width - larghezzaMinimaSpazioTestoPercentuale - 2);
larghezzaSpazioTestoPercentuale = larghezzaMinimaSpazioTestoPercentuale;
}
tabellaAree.Cells[3, i].ValueObjectList = new List()
{
new RectanglePDF(12, larghezzaBarra, colore)
{
DeltaY = 5f + yRowContentOffsets[i] + (i == 0 ? 6 : 0)
},
new FormattedTextAreaPDF(Helper.FormatDecimal(row["ContributoProtezione"].ToString(),2), 0, larghezzaSpazioTestoPercentuale)
{
DeltaY = 3.25f + yRowContentOffsets[i] + (i == 0 ? 1 : 0),
TextHorizontalAlign = ceTe.DynamicPDF.TextAlign.Left,
DeltaX = deltaXBarra,
FontSize = 7
}
};
#endregion
i++;
}
#endregion
#endregion
if (getNota1(dati).Length > 0)
{
AddElement(new SpacePDF(15));
tabellaAree.Notes.Add(new TableNotePDF(TableNotePDF.TableNotePositionType.PièDiTabella, getNota1(dati), new[] { "VaR" }, string.Empty, TableNotePDF.TableNoteAsteriskPositionType.PieDiTabella) { FontSize = 6, TextHorizontalAlign = ceTe.DynamicPDF.TextAlign.Justify, DeltaY = 5 });
}
else
{
AddElement(new SpacePDF(15));
}
AddElement(new FormattedTextAreaPDF(getTesto1(), EnvironmentFacade.RendererFacade.XLeftLimit, 520) { FontSize = 7, TextHorizontalAlign = ceTe.DynamicPDF.TextAlign.Justify });
AddElement(new SpacePDF(10));
//AddElement(new LinePDF(113.3f, 228, 49.25f, 375, 3, new ColorPDF(0, 100, 45)));
//AddElement(new LinePDF(113.3f, 229.2f, 181.3f, 375, 3, new ColorPDF(0, 100, 45)));
AddElement(new ImagePDF(37, 0.11093333f, "entire_img_tutela2.png") { DeltaY = 31, AutoIncrementYWritable = false });
// 0.1110f good value
// 0.1143f good value
AddElement(tabellaAree);
AddElement(new PagePDF(PagePDF.PagePDFType.Generic));
}
#endregion
#region LINEE_PROTETTE
foreach (DataRow itemLinea in dati.Tables["LineeProtette"].Rows)
{
if (saltoPagina)
AddElement(new PagePDF(PagePDF.PagePDFType.Generic));
saltoPagina = true;
AddElement(new SpacePDF(20));
AddElement(new FormattedTextAreaPDF(LineeProtetteTitolo(itemLinea), EnvironmentFacade.RendererFacade.XLeftLimit) { FontBold = true, FontSize = 10, TextHorizontalAlign = ceTe.DynamicPDF.TextAlign.Left });
AddElement(new SpacePDF(10));
AddElement(new FormattedTextAreaPDF(LineeProtetteTesto1(itemLinea), EnvironmentFacade.RendererFacade.XLeftLimit) { FontSize = 7, TextHorizontalAlign = ceTe.DynamicPDF.TextAlign.Justify });
AddElement(new SpacePDF(10));
var coloreComponentePerformance = new ColorPDF(251, 161, 56);
var coloreProtezione = new ColorPDF(94, 213, 94);
#region Tabella
var dtTabella = new DataTable();
dtTabella.Columns.Add(new DataColumn("Oggetto", typeof(string)));
dtTabella.Columns.Add(new DataColumn("Descrizione", typeof(string)));
dtTabella.Columns.Add(new DataColumn("Valore", typeof(string)));
//#4863 dtTabella.Rows.Add("", "Versato netto (€)", Helper.FormatCurrency(itemLinea["VersatoNetto"].ToString()));
dtTabella.Rows.Add("", "Controvalore di riferimento* (€)", Helper.FormatCurrency(itemLinea["Controvalore"].ToString()));
dtTabella.Rows.Add("", "Componente di performance (€)", Helper.FormatCurrency(itemLinea["ComponentePerformance"].ToString()));
dtTabella.Rows.Add("", "Componente di protezione** (€)", Helper.FormatCurrency(itemLinea["ComponenteProtezione"].ToString()));
dtTabella.Rows.Add("", "Controvalore protetto (€)", Helper.FormatCurrency(itemLinea["ControvaloreProtetto"].ToString()));
dtTabella.Rows.Add("", "Data di riferimento", itemLinea["DataRiferimento"].ToString());
var tabella = new TablePDF(EnvironmentFacade.RendererFacade.XLeftLimit, dtTabella)
{
Style = Style.ConsulenzaUnica,
Header = false,
Footer = false,
AlternateRow = false,
RowHeight = 25,
ShowSeparationLines = false,
RowsPadding = 5,
AutoIncrementYWritable = false
};
//Colonne
tabella.Columns.Add(new ColumnPDF("oggetto", 25, HorizontalAlignmentType.Sinistra, true, true, 7, ColumnType.Objectpdf, "oggetto", string.Empty) { DeltaYContent = 5, HeaderFontSize = 7 });
tabella.Columns.Add(new ColumnPDF("descrizione", 145, HorizontalAlignmentType.Sinistra, true, true, 7, ColumnType.Testo, "descrizione", string.Empty) { HeaderFontSize = 7 });
tabella.Columns.Add(new ColumnPDF("valore", 85, HorizontalAlignmentType.Destra, false, true, 7, ColumnType.Testo, "valore", string.Empty) { PaddingLeft = 5, HeaderFontSize = 7 });
//Righe
tabella.Row[1].FontBold = false;
tabella.Row[2].FontBold = false;
tabella.Row[1].ForceStyleFontBold = true;
tabella.Row[2].ForceStyleFontBold = true;
//Celle
tabella.Cells[0, 1].BackgroundColor = ColorPDF.Bianco;
tabella.Cells[0, 2].BackgroundColor = ColorPDF.Bianco;
tabella.Cells[1, 1].BackgroundColor = ColorPDF.Bianco;
tabella.Cells[1, 2].BackgroundColor = ColorPDF.Bianco;
tabella.Cells[0, 1].ValueObject = new CirclePDF(13, 13, coloreComponentePerformance);
tabella.Cells[0, 2].ValueObject = new CirclePDF(13, 13, coloreProtezione);
AddElement(tabella);
#endregion
#region Grafico torta
#region Valorizzazione Serie
var serieTorta = new List();
serieTorta.Add(new Serie { Name = "Distribuzione" });
serieTorta[0].Points.Add(new Point
{
LabelAxisX = "ComponentePerformance",
Color = coloreComponentePerformance,
Value = Convert.ToDouble(itemLinea["PercentualePerformance"]),
ShowLabelAxisX = false,
ShowLabelAxisY = false
});
serieTorta[0].Points.Add(new Point
{
LabelAxisX = "ComponenteProtezione",
Color = coloreProtezione,
Value = Convert.ToDouble(itemLinea["PercentualeProtezione"]),
ShowLabelAxisX = false,
ShowLabelAxisY = false
});
#endregion
var torta = new PiePDF(base.EnvironmentFacade.RendererFacade.XLeftLimit + tabella.Width + 30, 1F)
{
Width = 240,
Height = 200,
SeriesCollection = serieTorta,
Style3DEnabled = true,
Style3DXAngle = 45
};
AddElement(torta);
#endregion
if (LineeProtetteNota1().Length > 0 || LineeProtetteNota2().Length > 0)
{
AddElement(new SpacePDF(torta.Width/2+35 /*+65 invece di +35 quando rimettono Versato Netto*/));
AddElement(new FormattedTextAreaPDF(LineeProtetteNota1(), EnvironmentFacade.RendererFacade.XLeftLimit) { FontSize = 6, TextHorizontalAlign = ceTe.DynamicPDF.TextAlign.Justify });
AddElement(new SpacePDF(5));
AddElement(new FormattedTextAreaPDF(LineeProtetteNota2(), EnvironmentFacade.RendererFacade.XLeftLimit) { FontSize = 6, TextHorizontalAlign = ceTe.DynamicPDF.TextAlign.Justify });
}
}
#endregion
#region Protetto
string[] nomiFondoProtetto = { "Interfund Crescita Protetta 80", "Fonditalia Crescita Protetta 80" };
foreach (string nomeFondoProtetto in nomiFondoProtetto)
{
TablePDF tabellaProtetto = null;
foreach (DataTable dtProtetto in dati.Tables)
{
if (dtProtetto.TableName.Equals("LineeProtette") ||
dtProtetto.TableName.Equals("area") ||
dtProtetto.TableName.Equals("areaFooter") ||
dtProtetto.Columns.Count == 0 ||
!dtProtetto.Rows[0]["nomeFondoProtetto"].Equals(nomeFondoProtetto))
continue;
if (tabellaProtetto == null)
{
if (saltoPagina)
AddElement(new PagePDF(PagePDF.PagePDFType.Generic));
saltoPagina = true;
AddElement(new SpacePDF(20));
AddElement(new FormattedTextAreaPDF(ProtettoTitolo(dtProtetto.Rows[0]), EnvironmentFacade.RendererFacade.XLeftLimit) { FontBold = true, FontSize = 10, TextHorizontalAlign = ceTe.DynamicPDF.TextAlign.Justify });
AddElement(new SpacePDF(10));
AddElement(new FormattedTextAreaPDF(ProtettoTesto(dtProtetto.Rows[0]), EnvironmentFacade.RendererFacade.XLeftLimit) { FontSize = 7, TextHorizontalAlign = ceTe.DynamicPDF.TextAlign.Justify });
AddElement(new SpacePDF(20));
}
tabellaProtetto = new TablePDF(EnvironmentFacade.RendererFacade.XLeftLimit, dtProtetto)
{
Style = Style.ConsulenzaUnica,
Header = true,
Footer = false,
AlternateRow = false,
RowHeight = 25,
HideLastSeparationLine = false
};
tabellaProtetto.Columns.Add(new ColumnPDF("NomeProdotto", 240, HorizontalAlignmentType.Sinistra, false, false, 7, ColumnType.Testo, "NomeProdotto", dtProtetto.Rows[0]["nomeContratto"] + "
Contratto " + dtProtetto.TableName) { HeaderFontSize = 7 });
tabellaProtetto.Columns.Add(new ColumnPDF("QuotaProdotto", 70, HorizontalAlignmentType.Sinistra, false, false, 7, ColumnType.Testo, "QuotaProdotto", "Quota (€)") { HeaderFontSize = 7, PaddingRight = 4 });
tabellaProtetto.Columns.Add(new ColumnPDF("NumeroQuoteProdotto", 70, HorizontalAlignmentType.Sinistra, false, false, 7, ColumnType.Testo, "NumeroQuoteProdotto", "Numero
quote") { HeaderFontSize = 7, PaddingRight = 4 });
tabellaProtetto.Columns.Add(new ColumnPDF("Controvaloreattuale", 70, HorizontalAlignmentType.Sinistra, false, false, 7, ColumnType.Testo, "Controvaloreattuale", "Controvalore
attuale (€)") { HeaderFontSize = 7, PaddingRight = 4 });
tabellaProtetto.Columns.Add(new ColumnPDF("Datariferimento", 70, HorizontalAlignmentType.Sinistra, false, false, 7, ColumnType.Testo, "Datariferimento", "Data di
riferimento") { HeaderFontSize = 7, PaddingRight = 4 });
for (int r = 0; r < dtProtetto.Rows.Count; r++)
{
tabellaProtetto.Cells[1, r].HorizontalAlignment =
tabellaProtetto.Cells[2, r].HorizontalAlignment =
tabellaProtetto.Cells[3, r].HorizontalAlignment =
tabellaProtetto.Cells[4, r].HorizontalAlignment = HorizontalAlignmentType.Destra;
}
AddElement(tabellaProtetto);
AddElement(new SpacePDF(20));
}
if (tabellaProtetto != null)
{
tabellaProtetto.Notes.Add(
new TableNotePDF(TableNotePDF.TableNotePositionType.PièDiTabella,
ProtettoNota(),
new[] { "" },
"",
TableNotePDF.TableNoteAsteriskPositionType.PieDiTabella) { FontSize = 6, TextHorizontalAlign = ceTe.DynamicPDF.TextAlign.Justify, DeltaY = 10 }
);
}
}
#endregion
}
protected sealed override DataTable GetDataTable()
{
return null;
}
protected sealed override DataSet GetDataSet()
{
#region Estrazione dati + servizi
var dettaglioContratti = datiSeiUnico.patrimonioUnit().patrimonioCasa.dettaglioContratti.elencoContratti != null ?
datiSeiUnico.patrimonioUnit().patrimonioCasa.dettaglioContratti.elencoContratti : new rsDettaglioContratto[0];
var pianificazione = datiSeiUnico.pianificazioneUnit().pianificazioneVerticale;
//var piramideModello = datiSeiUnico.piramideModelloUnit().piramideModello.areaModello.ToList().OrderBy(o => o.ordinamento).ToList().FindAll(o => o.visible == true);
var protezioneCapitale = datiSeiUnico.patrimonioUnit().patrimonioCasa.protezioneCapitale;
var displayInfoAree = datiSeiUnico.displayInfos().areeDisplayInfos.ToList();
#endregion
#region Definizione Dataset + Colonne
var ds = new DataSet();
ds.Tables.Add("area");
ds.Tables.Add("areaFooter");
ds.Tables.Add("LineeProtette");
ds.Tables["area"].Columns.Add(new DataColumn("Area", typeof(string)));
ds.Tables["area"].Columns.Add(new DataColumn("Description", typeof(string)));
ds.Tables["area"].Columns.Add(new DataColumn("Controvalore", typeof(decimal)));
ds.Tables["area"].Columns.Add(new DataColumn("ControvaloreProtetto", typeof(decimal)));
ds.Tables["area"].Columns.Add(new DataColumn("ContributoProtezione", typeof(decimal)));
ds.Tables["area"].Columns.Add(new DataColumn("Ordinamento", typeof(decimal)));
ds.Tables["areaFooter"].Columns.Add(new DataColumn("Area", typeof(string)));
ds.Tables["areaFooter"].Columns.Add(new DataColumn("Controvalore", typeof(decimal)));
ds.Tables["areaFooter"].Columns.Add(new DataColumn("ControvaloreProtetto", typeof(decimal)));
ds.Tables["areaFooter"].Columns.Add(new DataColumn("Spazio", typeof(string)));
ds.Tables["LineeProtette"].Columns.Add(new DataColumn("Linea", typeof(string)));
ds.Tables["LineeProtette"].Columns.Add(new DataColumn("Contratto", typeof(string)));
ds.Tables["LineeProtette"].Columns.Add(new DataColumn("VersatoNetto", typeof(decimal)));
ds.Tables["LineeProtette"].Columns.Add(new DataColumn("Controvalore", typeof(decimal)));
ds.Tables["LineeProtette"].Columns.Add(new DataColumn("ComponentePerformance", typeof(decimal)));
ds.Tables["LineeProtette"].Columns.Add(new DataColumn("ComponenteProtezione", typeof(decimal)));
ds.Tables["LineeProtette"].Columns.Add(new DataColumn("ControvaloreProtetto", typeof(decimal)));
ds.Tables["LineeProtette"].Columns.Add(new DataColumn("DataRiferimento", typeof(string)));
ds.Tables["LineeProtette"].Columns.Add(new DataColumn("PercentualePerformance", typeof(decimal)));
ds.Tables["LineeProtette"].Columns.Add(new DataColumn("PercentualeProtezione", typeof(decimal)));
ds.Tables["LineeProtette"].Columns.Add(new DataColumn("CodiceInterno", typeof(string)));
#endregion
#region Piramide
foreach (var item in protezioneCapitale.aree)
{
var displayInfoArea = displayInfoAree.FirstOrDefault(o => o.key.Equals(item.area.ToUpper())).value;
ds.Tables["area"].Rows.Add(
string.Format("{0}_tutela.png", new AreaBisogno(item.area).NomePerImmagine.ToLower()), //Area
item.descrizione,
item.ctv,
item.ctvProtetto,
item.pesoProtetto * 100,
displayInfoArea.order
);
}
ds.Tables["area"].Rows.Add(
string.Format("{0}_tutela.png", new AreaBisogno("Tut").NomePerImmagine.ToLower()), //Area
"Tutela",
0,
0,
0,
9999
);
#endregion
#region Piramide Footer
ds.Tables["areaFooter"].Rows.Add(
datiSeiUnico.FormatBanca("Patrimonio $/Banca/$"), //Descrizione
protezioneCapitale.ctv,
protezioneCapitale.ctvProtetto,
""
);
#endregion
#region LINEE PROTETTE
foreach (var item in from o in dettaglioContratti where o.tipoContratto.Equals("LINEE_PROTETTE") select o)
{
DataRow dr = ds.Tables["LineeProtette"].NewRow();
dr["Linea"] = item.nomeLinea;
dr["Contratto"] = item.codiceContratto;
dr["VersatoNetto"] = item.totaleCvn;
dr["Controvalore"] = item.ctvRiferimento;
dr["ComponentePerformance"] = item.ctvPerformance;
dr["ComponenteProtezione"] = item.ctvMonetari;
dr["ControvaloreProtetto"] = item.ctvProtetto;
dr["DataRiferimento"] = Convert.ToDateTime(item.dtRiferimento).ToShortDateString();
dr["PercentualePerformance"] = item.pesoPerformance * 100;
dr["PercentualeProtezione"] = item.pesoMonetari * 100;
dr["CodiceInterno"] = item.codiceInterno;
ds.Tables["LineeProtette"].Rows.Add(dr);
}
#endregion
#region PROTETTO
foreach (var item in from o in dettaglioContratti where o.tipoContratto.Equals("PROTETTO") select o)
{
ds.Tables.Add(item.codiceContratto);
ds.Tables[item.codiceContratto].Columns.Add(new DataColumn("nomeFondoProtetto", typeof(string)));
ds.Tables[item.codiceContratto].Columns.Add(new DataColumn("nomeContratto", typeof(string)));
ds.Tables[item.codiceContratto].Columns.Add(new DataColumn("codiceContratto", typeof(string)));
ds.Tables[item.codiceContratto].Columns.Add(new DataColumn("NomeProdotto", typeof(string)));
ds.Tables[item.codiceContratto].Columns.Add(new DataColumn("QuotaProdotto", typeof(string)));
ds.Tables[item.codiceContratto].Columns.Add(new DataColumn("NumeroQuoteProdotto", typeof(string)));
ds.Tables[item.codiceContratto].Columns.Add(new DataColumn("ControvaloreAttuale", typeof(string)));
ds.Tables[item.codiceContratto].Columns.Add(new DataColumn("DataRiferimento", typeof(string)));
DataRow dr = ds.Tables[item.codiceContratto].NewRow();
dr["nomeFondoProtetto"] = item.nomeFondoProtetto;
dr["nomeContratto"] = item.nomeContratto;
dr["codiceContratto"] = item.codiceContratto;
dr["NomeProdotto"] = item.nomeProdotto;
dr["QuotaProdotto"] = Helper.FormatDecimal(item.quotaProdotto.ToString(), 4);
dr["NumeroQuoteProdotto"] = item.numeroQuoteProdotto.ToString("C4").Replace("€ ", "");
dr["ControvaloreAttuale"] = Helper.FormatCurrency(item.ctvProdotto.ToString());
dr["DataRiferimento"] = Convert.ToDateTime(item.dtRiferimentoProdotto).ToShortDateString();
ds.Tables[item.codiceContratto].Rows.Add(dr);
dr = ds.Tables[item.codiceContratto].NewRow();
dr["nomeFondoProtetto"] = item.nomeFondoProtetto;
dr["nomeContratto"] = item.nomeContratto;
dr["codiceContratto"] = item.codiceContratto;
dr["NomeProdotto"] = "Quota massima";
dr["QuotaProdotto"] = Helper.FormatDecimal(item.quotaMax.ToString(), 4);
dr["NumeroQuoteProdotto"] = "-";
dr["ControvaloreAttuale"] = "-";
dr["DataRiferimento"] = Convert.ToDateTime(item.dtRiferimentoQuotaMax).ToShortDateString();
ds.Tables[item.codiceContratto].Rows.Add(dr);
dr = ds.Tables[item.codiceContratto].NewRow();
dr["nomeFondoProtetto"] = item.nomeFondoProtetto;
dr["nomeContratto"] = item.nomeContratto;
dr["codiceContratto"] = item.codiceContratto;
dr["NomeProdotto"] = "Quota e controvalore protetti*";
dr["QuotaProdotto"] = Helper.FormatDecimal(item.quotaProtetta.ToString(), 4);
dr["NumeroQuoteProdotto"] = item.numeroQuoteProtetta.ToString("C4").Replace("€ ", "");
dr["ControvaloreAttuale"] = Helper.FormatCurrency(item.ctvQuotaProtetta.ToString());
dr["DataRiferimento"] = "-";
ds.Tables[item.codiceContratto].Rows.Add(dr);
}
#endregion
return ds;
}
public virtual bool piramideBisogni() { return GetOption().Valore; }
public virtual bool dettaglioProdotti() { return GetOption().Valore; }
public virtual string LineeProtetteTitolo(DataRow itemLinea)
{
return itemLinea["Linea"].ToString() + " - contratto " + itemLinea["Contratto"].ToString();
}
public virtual string LineeProtetteTesto1(DataRow itemLinea)
{
//#4863 string nota = "Di seguito vengono riportati il versato netto, il controvalore di riferimento* e il controvalore protetto, disponibili al momento della produzione del report, della linea " + itemLinea["Linea"].ToString() + " sottostante alla unit linked Fideuram Vita Insieme (contratto " + itemLinea["Contratto"].ToString() + "). La linea prevede una protezione giornaliera del capitale pari all’80% del controvalore massimo raggiunto dalla data di partenza. In caso di movimentazione in entrata o in uscita sulla linea, il controvalore protetto viene incrementato per l’80% dell’importo movimentato in entrata, o ridotto per l’80% dell’importo movimentato in uscita. Si fornisce inoltre l’evidenza della ripartizione del controvalore di riferimento*, al momento della produzione del report, tra i fondi da lei selezionati (\"Componente di performance\") e i fondi monetari** dedicati alla tecnica di protezione.";
string nota = "Di seguito vengono riportati il controvalore di riferimento* e il controvalore protetto, disponibili al momento della produzione del report, della linea " + itemLinea["Linea"].ToString() + " sottostante alla unit linked Fideuram Vita Insieme (contratto " + itemLinea["Contratto"].ToString() + "). La linea prevede una protezione giornaliera del capitale pari all’80% del controvalore massimo raggiunto dalla data di partenza. In caso di movimentazione in entrata o in uscita sulla linea, il controvalore protetto viene incrementato per l’80% dell’importo movimentato in entrata, o ridotto per l’80% dell’importo movimentato in uscita. Si fornisce inoltre l’evidenza della ripartizione del controvalore di riferimento*, al momento della produzione del report, tra i fondi da lei selezionati (\"Componente di performance\") e i fondi monetari** dedicati alla tecnica di protezione.";
return nota;
}
public virtual string LineeProtetteTesto2()
{
string nota = "";
return nota;
}
public virtual string LineeProtetteNota1()
{
string nota = "";
nota += "(*) Il controvalore di riferimento è calcolato giornalmente da Fideuram Vita per la determinazione del controvalore protetto, e contabilizza, in base agli ultimi NAV disponibili, oltre alla valorizzazione per quote delle operazioni già perfezionate, anche eventuali versamenti e riscatti effettuati sulla linea e in via di perfezionamento. In tal senso, il controvalore di riferimento potrebbe divergere dal controvalore attuale della linea.";
return nota;
}
public virtual string LineeProtetteNota2()
{
string nota = "";
nota += "(**) Fondi monetari in Euro dedicati esclusivamente alla tecnica di protezione: la Compagnia, al fine di proteggere il capitale, può effettuare un’attività di ribilanciamento tra la componente della linea investita nei fondi da lei selezionati e la componente investita nei fondi monetari. La ripartizione tra le due componenti può variare giornalmente in funzione della tipologia dei fondi da lei selezionati e dell’andamento del mercato.";
return nota;
}
public virtual string getTesto1()
{
string testo = "In questa scheda è riportata l'allocazione corrente, sulle aree di bisogno, del patrimonio che lei detiene presso ";
testo += "$/Banca/$, con indicazione del controvalore dei prodotti* che prevedono, a \"Tutela\" del suo patrimonio, la protezione ";
testo += "in corso di contratto di una parte del capitale investito. Il grafico sulla destra rappresenta il contributo della singola ";
testo += "area alla determinazione del controvalore protetto* complessivo.";
return datiSeiUnico.FormatBanca(testo);
}
//public virtual string getNota1()
//{
// string testo = "Le linee protette \"$/Banca/$ Vita Insieme My Blue Protection 80\" e \"$/Banca/$ Vita Insieme My White Protection 80\" ";
// testo += "che lei detiene presso $/Banca/$, prevedono una protezione del capitale pari all’80% del controvalore massimo raggiunto dalla ";
// testo += "data di partenza: il \"controvalore protetto\" è stato distribuito sulle aree di bisogno sulla base del peso percentuale ";
// testo += "del controvalore del singolo fondo, rispetto al controvalore complessivo della linea, disponibile al momento della produzione ";
// testo += "del report.";
// return datiSeiUnico.FormatBanca(testo);
//}
public virtual string getNota1(DataSet ds)
{
string text = "";
string text2 = "";
string text3 = "";
string text4 = "";
bool isMultiramoProtetta=false;
int num = 0;
int num2 = 0;
foreach (DataRow itemLinea in ds.Tables["LineeProtette"].Rows)
{
if (num > 0)
{
text = text + " e \"" + this.LineeProtetteTitolo(itemLinea) + "\"";
}
else
{
text = text + "\"" + this.LineeProtetteTitolo(itemLinea) + "\"";
}
num++;
isMultiramoProtetta = itemLinea["CodiceInterno"].ToString() =="RF" ? true:false;
}
string[] array = new string[]
{
"Interfund Crescita Protetta 80",
"Fonditalia Crescita Protetta 80"
};
string[] array2 = array;
for (int i = 0; i < array2.Length; i++)
{
string obj = array2[i];
foreach (DataTable dataTable in ds.Tables)
{
if (!dataTable.TableName.Equals("LineeProtette") && !dataTable.TableName.Equals("area") && !dataTable.TableName.Equals("areaFooter") && dataTable.Columns.Count != 0 && dataTable.Rows[0]["nomeFondoProtetto"].Equals(obj))
{
if (num2 > 0)
{
text2 = text2 + " e \"" + dataTable.Rows[0]["nomeFondoProtetto"].ToString() + "\" ";
}
else
{
text2 = text2 + "\"" + dataTable.Rows[0]["nomeFondoProtetto"].ToString() + "\" ";
}
num2++;
}
}
}
switch (num)
{
case 0:
break;
case 1:
text3 = "La linea protetta ";
text3 += text;
text4 = " Il \"controvalore protetto\" della linea protetta " + text;
text4 += " è stato distribuito sulle aree di bisogno sulla base del peso percentuale ";
text4 += "del controvalore del singolo fondo, rispetto al controvalore complessivo della linea, disponibile al momento della produzione ";
text4 += "del report.";
break;
default:
text3 = "Le linee protette ";
text3 += text;
text4 = " Il \"controvalore protetto\" delle linee protette " + text;
text4 += " è stato distribuito sulle aree di bisogno sulla base del peso percentuale ";
text4 += "del controvalore del singolo fondo, rispetto al controvalore complessivo della linea, disponibile al momento della produzione ";
text4 += "del report.";
break;
}
string text5 = " che lei detiene presso $/Banca/$, $/s/$ ";
switch (num2)
{
case 0:
//text3 = "Il fondo ";
text3 += text5;
break;
case 1:
if (num > 0)
{
text3 = "I fondi ";
text3 = text3 + ", " + text2 + text5;
}
else
{
text3 = "Il fondo ";
text3 = text3 + text2 + text5;
}
break;
default:
if (num > 0)
{
text3 = "I fondi ";
text3 = text3 + ", " + text2 + text5;
}
else
{
text3 = "Il fondo ";
text3 = text3 + text2 + text5;
}
break;
}
if (num + num2 > 1)
{
text3 = text3.Replace("$/s/$", " prevedono ");
}
else
{
text3 = text3.Replace("$/s/$", " prevede ");
}
text3 = this.datiSeiUnico.FormatBanca(text3);
if (isMultiramoProtetta)
text3 += " una protezione del capitale pari all'85% del controvalore investito sul contratto.";
else
text3 += " una protezione del capitale pari all’80% del controvalore massimo raggiunto dalla data di partenza.";
if (num > 0)
{
text3 += text4;
}
return text3;
}
public virtual string getNota1old(DataSet ds)
{
string text = "\"";
string text2 = "";
string text3 = "";
string str = "";
int num = 0;
int num2 = 0;
bool flag = false;
foreach (DataRow itemLinea in ds.Tables["LineeProtette"].Rows)
{
if (num > 0)
{
text = text + " e " + this.LineeProtetteTitolo(itemLinea);
}
else
{
text = text + this.LineeProtetteTitolo(itemLinea) + "\"";
}
num++;
}
string[] array = new string[]
{
"Interfund Crescita Protetta 80",
"Fonditalia Crescita Protetta 80"
};
string[] array2 = array;
for (int i = 0; i < array2.Length; i++)
{
string obj = array2[i];
foreach (DataTable dataTable in ds.Tables)
{
if (!dataTable.TableName.Equals("LineeProtette") && !dataTable.TableName.Equals("area") && !dataTable.TableName.Equals("areaFooter") && dataTable.Columns.Count != 0 && dataTable.Rows[0]["nomeFondoProtetto"].Equals(obj))
{
if (num2 > 0)
{
text2 = text2 + " e " + dataTable.Rows[0]["nomeFondoProtetto"].ToString() + " ";
num2++;
}
else
{
text2 = text2 + dataTable.Rows[0]["nomeFondoProtetto"].ToString() + " ";
flag = true;
num2++;
}
}
}
}
switch (num)
{
case 0:
break;
case 1:
text3 = "La linea protetta ";
if (flag)
{
text2 = " e " + text2;
}
text3 += text;
text3 += " che lei detiene presso $/Banca/$, prevede";
str = "della linea protetta ";
break;
default:
text3 = "Le linee protette ";
if (flag)
{
text2 = " e " + text2;
}
text3 += text;
text3 += " che lei detiene presso $/Banca/$, prevedono";
str = "delle linee protette ";
break;
}
text3 += " una protezione del capitale pari all’80% del controvalore massimo raggiunto dalla data di partenza.";
text3 += " Il \"controvalore protetto\" ";
text3 += str;
text3 += text;
if (flag)
{
text3 += text2;
}
text3 += " è stato distribuito sulle aree di bisogno sulla base del peso percentuale ";
text3 += "del controvalore del singolo fondo, rispetto al controvalore complessivo della linea, disponibile al momento della produzione ";
text3 += "del report.";
return this.datiSeiUnico.FormatBanca(text3);
}
public virtual string ProtettoTitolo(DataRow itemProtetto)
{
return itemProtetto["nomeFondoProtetto"].ToString();
}
public virtual string ProtettoTesto(DataRow itemProtetto)
{
string nota = "In questa scheda vengono riportati la quota, il numero di quote e il controvalore del fondo " + itemProtetto["nomeFondoProtetto"] + ", disponibili al momento della produzione del report. Il fondo prevede una protezione del capitale pari all’80% della quota massima giornaliera raggiunta dalla data di partenza. Si fornisce, quindi, evidenza della quota massima raggiunta dal fondo, e della quota e del controvalore protetti*.";
return nota;
}
public virtual string ProtettoNota()
{
string nota = "La quota \"protetta\" è pari all’80% della quota massima giornaliera raggiunta dal fondo dalla data di partenza: la quota massima potrebbe variare in funzione delle condizioni di mercato. Il controvalore \"protetto\" è calcolato ipotizzando che il numero delle quote si mantenga costante nel tempo e sia quindi uguale a quello disponibile alla data di produzione del report: il numero delle quote potrebbe variare nel tempo in seguito a movimentazione da parte del cliente o in seguito ad attività di ribilanciamento, prevista dal contratto.";
return nota;
}
}
}