217 lines
12 KiB
C#
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

using System;
using Consulenza.ReportWriter.Business;
using Consulenza.ReportWriter.Business.OBJ_PDF;
using Consulenza.ReportWriter.Business.Entity;
using System.Collections.Generic;
using System.Data;
using Consulenza.ReportCommon;
using System.Linq;
namespace Consulenza.ReportWriter.Manager.Section.Unica
{
/// <summary>
/// S36.PatrimonioAltriIstitutiProdottiNonRappresentabili idSezione = 79
/// </summary>
public class S36 : Entity.Section
{
public S36(EnvironmentFacade environmentFacade, int idSection)
: base(environmentFacade, idSection)
{
try
{
Draw();
}
catch (Exception ex)
{
SectionLogger.Write("S36", ex.Message, SectionLoggerMessageLevel.E, EnvironmentFacade.ReportEnvironment);
}
}
//protected override sealed void OLD_Draw()
//{
// var dati = GetDataSet();
// if (dati.Tables["prodotti"].Rows.Count > 0)
// {
// AddElement(new SpacePDF(20));
// AddElement(new FormattedTextAreaPDF(getTesto(), EnvironmentFacade.RendererFacade.XLeftLimit) { FontSize = 7, TextHorizontalAlign = ceTe.DynamicPDF.TextAlign.Justify });
// AddElement(new SpacePDF(15));
// #region Tabella dei prodotti non rappresentabili
// var tabella = new TablePDF(EnvironmentFacade.RendererFacade.XLeftLimit, dati.Tables["prodotti"], dati.Tables["prodottiFooter"])
// {
// Style = Style.ConsulenzaUnica,
// AlternateRow = false,
// HeaderHeight = 30
// };
// //tabella.Columns.Add(new ColumnPDF("Datasottoscrizione", 90, HorizontalAlignmentType.Sinistra, false, false,7, ColumnType.Testo, "Datasottoscrizione", "Data<br> sottoscrizione") { HeaderFontSize = 7 });
// tabella.Columns.Add(new ColumnPDF("Intermediario", 120+90, HorizontalAlignmentType.Sinistra, false, false, 7, ColumnType.Testo, "Intermediario", "Intermediario") { HeaderFontSize =7 });
// tabella.Columns.Add(new ColumnPDF("Prodotto", 160, HorizontalAlignmentType.Sinistra, false, false, 7, ColumnType.Testo, "Prodotto", "Descrizione") { HeaderFontSize = 7 });
// tabella.FooterColumns.Add(new ColumnPDF("Totale", 370, HorizontalAlignmentType.Sinistra, true, true, 7, ColumnType.Testo));
// tabella.Columns.Add(new ColumnPDF("Controvalore", 90, HorizontalAlignmentType.Destra, false, false,7, ColumnType.Decimale, "Controvalore", "Controvalore (€)") { HeaderFontSize = 7 });
// tabella.FooterColumns.Add(new ColumnPDF("Controvalore", 90, HorizontalAlignmentType.Destra, true, true, 7, ColumnType.Decimale));
// tabella.Columns.Add(new ColumnPDF("VaR", 60, HorizontalAlignmentType.Destra, false, false,7, ColumnType.Testo, "VaR", "VaR (%)") { HeaderFontSize = 7 });
// tabella.FooterColumns.Add(new ColumnPDF("vuoto", 60, HorizontalAlignmentType.Destra, true, true, 7, ColumnType.Testo));
// AddElement(tabella);
// #endregion
// }
//}
protected override sealed void Draw()
{
var dati = GetDataSet();
if (dati.Tables["prodotti"].Rows.Count > 0)
{
AddElement(new SpacePDF(20));
AddElement(new FormattedTextAreaPDF(getTesto(), EnvironmentFacade.RendererFacade.XLeftLimit) { FontSize = 7, TextHorizontalAlign = ceTe.DynamicPDF.TextAlign.Justify });
AddElement(new SpacePDF(15));
#region Tabella dei prodotti non rappresentabili
var tabella = new TablePDF(EnvironmentFacade.RendererFacade.XLeftLimit, dati.Tables["prodotti"], dati.Tables["prodottiFooter"])
{
Style = Style.ConsulenzaUnica,
AlternateRow = false,
HeaderHeight = 30
};
//tabella.Columns.Add(new ColumnPDF("Datasottoscrizione", 90, HorizontalAlignmentType.Sinistra, false, false,7, ColumnType.Testo, "Datasottoscrizione", "Data<br> sottoscrizione") { HeaderFontSize = 7 });
tabella.Columns.Add(new ColumnPDF("Intermediario", 120 + 90, HorizontalAlignmentType.Sinistra, false, false, 7, ColumnType.Testo, "Intermediario", "Intermediario") { HeaderFontSize = 7 });
tabella.Columns.Add(new ColumnPDF("Prodotto", 160, HorizontalAlignmentType.Sinistra, false, false, 7, ColumnType.Testo, "Prodotto", "Descrizione") { HeaderFontSize = 7 });
tabella.FooterColumns.Add(new ColumnPDF("Totale", 370, HorizontalAlignmentType.Sinistra, true, true, 7, ColumnType.Testo));
tabella.Columns.Add(new ColumnPDF("Controvalore", 90, HorizontalAlignmentType.Destra, false, false, 7, ColumnType.Decimale, "Controvalore", "Controvalore (€)") { HeaderFontSize = 7 });
tabella.FooterColumns.Add(new ColumnPDF("Controvalore", 90, HorizontalAlignmentType.Destra, true, true, 7, ColumnType.Decimale));
tabella.Columns.Add(new ColumnPDF("VaR", 60, HorizontalAlignmentType.Destra, false, false, 7, ColumnType.Testo, "VaR", "VaR (%)") { HeaderFontSize = 7 });
tabella.FooterColumns.Add(new ColumnPDF("vuoto", 60, HorizontalAlignmentType.Destra, true, true, 7, ColumnType.Testo));
AddElement(tabella);
#endregion
#region Modifiche 20190628 per Evolutiva
string sVerticalText;
if (EnvironmentFacade.ReportEnvironment.ReportType.Equals(ReportType.Unica_Nucleo))
{
sVerticalText = "";
}
else
{
sVerticalText = "Le eventuali informazioni riguardanti investimenti da lei detenuti presso altri intermediari vengono elaborate secondo le indicazioni da lei ";
if (EnvironmentFacade.ReportEnvironment.PrivateBanker.CodiceRete.Equals("F"))
{
sVerticalText = sVerticalText + "fornite e/ o disponibili sul mercato, per le quali Fideuram non garantisce la completezza e la veridicità. ";
sVerticalText = sVerticalText + "La preghiamo di comunicare a Fideuram ogni successiva variazione a tali informazioni, al fine di consentire a Fideuram la correzione e laggiornamento dei dati contenuti ";
sVerticalText = sVerticalText + "nel presente report.Gli investimenti detenuti presso altri intermediari vengono utilizzati da Fideuram con finalità meramente informative e secondo le indicazioni da lei fornite, ";
sVerticalText = sVerticalText + "in modo da offrire una rappresentazione unitaria degli investimenti, senza con ciò formare oggetto di raccomandazioni personalizzate o di rendicontazione ufficiale.";
}
else
{
sVerticalText = sVerticalText + "fornite e/ o disponibili sul mercato, per le quali Sanpaolo Invest SIM non garantisce la completezza e la veridicità. ";
sVerticalText = sVerticalText + "La preghiamo di comunicare a Sanpaolo Invest SIM ogni successiva variazione a tali informazioni, al fine di consentire a Sanpaolo Invest SIM la correzione e laggiornamento dei dati contenuti ";
sVerticalText = sVerticalText + "nel presente report.Gli investimenti detenuti presso altri intermediari vengono utilizzati da Sanpaolo Invest SIM con finalità meramente informative e secondo le indicazioni da lei fornite, ";
sVerticalText = sVerticalText + "in modo da offrire una rappresentazione unitaria degli investimenti, senza con ciò formare oggetto di raccomandazioni personalizzate o di rendicontazione ufficiale.";
}
}
FormattedTextAreaPDF testoPaginaVerticale = null;
testoPaginaVerticale = new FormattedTextAreaPDF(sVerticalText, EnvironmentFacade.RendererFacade.XLeftLimit - 35, 620)
{
TextHorizontalAlign = ceTe.DynamicPDF.TextAlign.Justify,
FontSize = 5,
TextVerticalDirection = true,
Y = 745
};
var listaOggettiDaRipetere = new List<ObjectPDF> { testoPaginaVerticale };
AddElement(listaOggettiDaRipetere);
AddElement(new RepeaterPDF(listaOggettiDaRipetere));
#endregion
}
}
/// <summary>
/// Recupera i dati necessari alla Section restituendo un DataTable.
/// </summary>
/// <returns></returns>
protected sealed override DataTable GetDataTable()
{
return null;
}
/// <summary>
/// Recupera i dati necessari alla Section restituendo un DataSet.
/// </summary>
/// <returns></returns>
protected sealed override DataSet GetDataSet()
{
var ds = new DataSet();
ds.Tables.Add(new DataTable("prodotti"));
ds.Tables.Add(new DataTable("prodottiFooter"));
var patrimonioTerzi = datiSeiUnico.patrimonioUnit().patrimonioTerzi; //new DataServices.PatrimonioTerzi(chiaveClientePb);
var prodottiNonRappresentabiliPerAsset = patrimonioTerzi.assetClass.distribuzionePerProdotti.listaProdotti.Where(o => o.rappresentabile == false).ToList();
#region Prodotti
//ds.Tables["prodotti"].Columns.Add(new DataColumn("Datasottoscrizione", typeof(string)));
ds.Tables["prodotti"].Columns.Add(new DataColumn("Intermediario", typeof(string)));
ds.Tables["prodotti"].Columns.Add(new DataColumn("Prodotto", typeof(string)));
ds.Tables["prodotti"].Columns.Add(new DataColumn("Controvalore", typeof(decimal)));
ds.Tables["prodotti"].Columns.Add(new DataColumn("VaR", typeof(string)));
foreach (var item in prodottiNonRappresentabiliPerAsset)
{
var itemPosizione = patrimonioTerzi.dettaglioProdotti.dettaglioProdotti.FirstOrDefault(o => o.chiaveProdottoTerzi.Equals(item.chiaveAggregazione));
ds.Tables["prodotti"].Rows.Add(
//itemPosizione.dtSottoscrizione.ToShortDateString(), //Datasottoscrizione //TODO
itemPosizione.nomeIntermediario, //Intermediario
itemPosizione.prodotto.nomeProdotto, //Prodotto
itemPosizione.ctv, //Controvalore
itemPosizione.prodotto.varDecodificato); //VaR
}
#endregion
#region Totale prodotti
ds.Tables["prodottiFooter"].Columns.Add(new DataColumn("Totale", typeof(string)));
ds.Tables["prodottiFooter"].Columns.Add(new DataColumn("Controvalore", typeof(decimal)));
ds.Tables["prodottiFooter"].Columns.Add(new DataColumn("vuoto", typeof(string)));
if (ds.Tables["prodotti"].Rows.Count != 0)
{
ds.Tables["prodottiFooter"].Rows.Add(
"Totale prodotti non rappresentabili",
Helper.FormatCurrency(patrimonioTerzi.assetClass.distribuzione.totaleNonRappr.ToString()),
""//"n.c." // TODO;
);
}
#endregion
return ds;
}
public virtual string getTesto()
{
return "Nella tabella sottostante sono riportati i prodotti che lei detiene presso altri Istituti, che non è stato possibile rappresentare in termini di asset allocation.";
}
}
}