342 lines
17 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 System.Data;
using Consulenza.ReportCommon;
using Consulenza.ReportWriter.Business.CHART_PDF;
using Consulenza.ReportWriter.Business.Entity;
using System.Collections.Generic;
using System.Linq;
namespace Consulenza.ReportWriter.Manager.Section.Unica
{
/// <summary>
/// S30.PatrimonioAltriIstitutiDistribuzionePerIntermediario idSezione = 73
/// </summary>
public class S30 : Entity.Section
{
public S30(EnvironmentFacade environmentFacade, int idSection)
: base(environmentFacade, idSection)
{
try
{
Draw();
}
catch (Exception ex)
{
SectionLogger.Write("S30", ex.Message, SectionLoggerMessageLevel.E, EnvironmentFacade.ReportEnvironment);
}
}
/// <summary>
/// Scheda3. Avvertenze
/// </summary>
//protected override sealed void OLD_Draw()
//{
// var dati = GetDataSet();
// #region Testo introduttivo grafico
// AddElement(new SpacePDF(20));
// AddElement(new FormattedTextAreaPDF(getTesto1(), EnvironmentFacade.RendererFacade.XLeftLimit) {FontSize=7, TextHorizontalAlign = ceTe.DynamicPDF.TextAlign.Justify });
// AddElement(new SpacePDF(15));
// #endregion
// #region Tabella Patrimonio
// var tabellaPatrimonio = new TablePDF(EnvironmentFacade.RendererFacade.XLeftLimit, dati.Tables[0])
// {
// Style = Style.ConsulenzaUnica,
// Header = false,
// Footer = false,
// AlternateRow = false,
// RowHeight = 25
// };
// tabellaPatrimonio.Columns.Add(new ColumnPDF("descrizione", 190, HorizontalAlignmentType.Sinistra, true, true, 7, ColumnType.Testo, "descrizione", string.Empty));
// tabellaPatrimonio.Columns.Add(new ColumnPDF("valore", 330, HorizontalAlignmentType.Sinistra, false, false, 7, ColumnType.Testo, "valore", string.Empty) { PaddingLeft = 5 });
// AddElement(tabellaPatrimonio);
// AddElement(new SpacePDF(25));
// #endregion
// #region Grafico a barre
// AddElement(new FormattedTextAreaPDF("Intermediario", EnvironmentFacade.RendererFacade.XLeftLimit, 100) { BackGroundColor = ColorPDF.Standard_Grigio_SfondoColonnaTabella, FontBold = true, FontSize = 7, FontColor = ColorPDF.ConsulenzaUnica_Rosso, AutoIncrementYWritable = false, BackGroundMarginLeft = 5 });
// AddElement(new FormattedTextAreaPDF(string.Format("Distribuzione ({0})", isControvalore() ? "€" : "%"), EnvironmentFacade.RendererFacade.XLeftLimit + 110, 410) { BackGroundColor = ColorPDF.Standard_Grigio_SfondoColonnaTabella, FontBold = true, FontSize = 7, FontColor = ColorPDF.ConsulenzaUnica_Rosso, BackGroundMarginLeft = 5 });
// AddElement(new SpacePDF(10));
// var dtGraficoBarre = dati.Tables[1];
// var graficoBarre = new StackedPDF(EnvironmentFacade.RendererFacade.XLeftLimit + 110, 1F)
// {
// HeightSingleBar = 25,
// Width = 400,
// LabelFormatAxisY = isControvalore() ? FormatType.Intero : FormatType.Decimale2,
// ShowLineAxisX = true,
// PageBreak = true,
// DinamicFloatXEtichettaLateraleBarra = true,
// MinorGridAxisY = true,
// RemoveWhiteSpaceToTheRightAxisX = true,
// RemoveWhiteSpaceBetweenChartAndAxisX = true,
// MarginAxisY = 0,
// MarginAxisYFromTop = 0
// };
// var serieCollezione = new List<Serie> { new Serie { Name = "Intermediario", Border = true } };
// foreach (DataRow item in dtGraficoBarre.Rows)
// {
// serieCollezione[0].Points.Add(new Point
// {
// ShowLabelAxisY = true,
// LabelAxisY = isControvalore() ? Helper.FormatCurrency(item["ControvalorePercentuale"].ToString()) : Helper.FormatDecimal(item["ControvalorePercentuale"].ToString(), 2),
// FontSizeLabelAxisY = 7,
// Color = new ColorPDF(Convert.ToInt32(item["Red"]), Convert.ToInt32(item["Green"]), Convert.ToInt32(item["Blue"])),
// Value = isControvalore() ? (Convert.ToDouble(item["ControvalorePercentuale"]) == 0 ? 0.01 : Convert.ToDouble(item["ControvalorePercentuale"])) : Convert.ToDouble(item["ControvalorePercentuale"]) == 0 ? 0.01 : Convert.ToDouble(item["ControvalorePercentuale"]), // Convert.ToDouble(Helper.FormatPercentage(Convert.ToDecimal(item["Percentuale"]), 2)),
// ShowLabelAxisX = true,
// LabelAxisX = item["Intermediario"].ToString(),
// FontSizeLabelAxisX = 7,
// FontBoldLabelAxisY = false
// });
// }
// graficoBarre.SeriesCollection = serieCollezione;
// AddElement(graficoBarre);
// #endregion
// #region Nota del Patrimonio altri Istituti
// if (GetNote1().Length > 0)
// {
// AddElement(new SpacePDF(30));
// AddElement(new FormattedTextAreaPDF(GetNote1(), EnvironmentFacade.RendererFacade.XLeftLimit) { FontSize = 6, TextHorizontalAlign = ceTe.DynamicPDF.TextAlign.Justify });
// }
// #endregion
//}
protected override sealed void Draw()
{
var dati = GetDataSet();
#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
#region Testo introduttivo grafico
#region Modifiche 20190628 per Evolutiva
//AddElement(new SpacePDF(20));
#endregion
AddElement(new FormattedTextAreaPDF(getTesto1(), EnvironmentFacade.RendererFacade.XLeftLimit) { FontSize = 7, TextHorizontalAlign = ceTe.DynamicPDF.TextAlign.Justify });
AddElement(new SpacePDF(15));
#endregion
#region Tabella Patrimonio
var tabellaPatrimonio = new TablePDF(EnvironmentFacade.RendererFacade.XLeftLimit, dati.Tables[0])
{
Style = Style.ConsulenzaUnica,
Header = false,
Footer = false,
AlternateRow = false,
RowHeight = 25
};
tabellaPatrimonio.Columns.Add(new ColumnPDF("descrizione", 190, HorizontalAlignmentType.Sinistra, true, true, 7, ColumnType.Testo, "descrizione", string.Empty));
tabellaPatrimonio.Columns.Add(new ColumnPDF("valore", 330, HorizontalAlignmentType.Sinistra, false, false, 7, ColumnType.Testo, "valore", string.Empty) { PaddingLeft = 5 });
AddElement(tabellaPatrimonio);
AddElement(new SpacePDF(25));
#endregion
#region Grafico a barre
AddElement(new FormattedTextAreaPDF("Intermediario", EnvironmentFacade.RendererFacade.XLeftLimit, 100) { BackGroundColor = ColorPDF.Standard_Grigio_SfondoColonnaTabella, FontBold = true, FontSize = 7, FontColor = ColorPDF.ConsulenzaUnica_Rosso, AutoIncrementYWritable = false, BackGroundMarginLeft = 5 });
AddElement(new FormattedTextAreaPDF(string.Format("Distribuzione ({0})", isControvalore() ? "€" : "%"), EnvironmentFacade.RendererFacade.XLeftLimit + 110, 410) { BackGroundColor = ColorPDF.Standard_Grigio_SfondoColonnaTabella, FontBold = true, FontSize = 7, FontColor = ColorPDF.ConsulenzaUnica_Rosso, BackGroundMarginLeft = 5 });
AddElement(new SpacePDF(10));
var dtGraficoBarre = dati.Tables[1];
var graficoBarre = new StackedPDF(EnvironmentFacade.RendererFacade.XLeftLimit + 110, 1F)
{
HeightSingleBar = 25,
Width = 400,
LabelFormatAxisY = isControvalore() ? FormatType.Intero : FormatType.Decimale2,
ShowLineAxisX = true,
PageBreak = true,
DinamicFloatXEtichettaLateraleBarra = true,
MinorGridAxisY = true,
RemoveWhiteSpaceToTheRightAxisX = true,
RemoveWhiteSpaceBetweenChartAndAxisX = true,
MarginAxisY = 0,
MarginAxisYFromTop = 0
};
var serieCollezione = new List<Serie> { new Serie { Name = "Intermediario", Border = true } };
foreach (DataRow item in dtGraficoBarre.Rows)
{
serieCollezione[0].Points.Add(new Point
{
ShowLabelAxisY = true,
LabelAxisY = isControvalore() ? Helper.FormatCurrency(item["ControvalorePercentuale"].ToString()) : Helper.FormatDecimal(item["ControvalorePercentuale"].ToString(), 2),
FontSizeLabelAxisY = 7,
Color = new ColorPDF(Convert.ToInt32(item["Red"]), Convert.ToInt32(item["Green"]), Convert.ToInt32(item["Blue"])),
Value = isControvalore() ? (Convert.ToDouble(item["ControvalorePercentuale"]) == 0 ? 0.01 : Convert.ToDouble(item["ControvalorePercentuale"])) : Convert.ToDouble(item["ControvalorePercentuale"]) == 0 ? 0.01 : Convert.ToDouble(item["ControvalorePercentuale"]), // Convert.ToDouble(Helper.FormatPercentage(Convert.ToDecimal(item["Percentuale"]), 2)),
ShowLabelAxisX = true,
LabelAxisX = item["Intermediario"].ToString(),
FontSizeLabelAxisX = 7,
FontBoldLabelAxisY = false
});
}
graficoBarre.SeriesCollection = serieCollezione;
AddElement(graficoBarre);
#endregion
#region Nota del Patrimonio altri Istituti
if (GetNote1().Length > 0)
{
AddElement(new SpacePDF(30));
AddElement(new FormattedTextAreaPDF(GetNote1(), EnvironmentFacade.RendererFacade.XLeftLimit) { FontSize = 6, TextHorizontalAlign = ceTe.DynamicPDF.TextAlign.Justify });
}
#endregion
}
protected sealed override DataTable GetDataTable()
{
return null;
}
protected override DataSet GetDataSet()
{
var ds = new DataSet();
var displayInfo = datiSeiUnico.displayInfos().intermediariDisplayInfos.ToList();
string Complessivo = datiSeiUnico.patrimonioUnit().patrimonioTerzi.patrimonioTerziBean.risorseFinanziarieTerzi.ToString();
var intermediariAsterisco = datiSeiUnico.patrimonioUnit().patrimonioTerzi.patrimonioTerziBean.intermediari;
#region Patrimonio altri Istituti
var dtPatrimonio = new DataTable();
dtPatrimonio.Columns.Add(new DataColumn("Descrizione", typeof(string)));
dtPatrimonio.Columns.Add(new DataColumn("Valore", typeof(string)));
var testoPatrimonio = string.Format("Patrimonio altri Istituti (€){0}", (GetNote1().Length>0 ? "*" : ""));
dtPatrimonio.Rows.Add(testoPatrimonio, Helper.FormatCurrency(datiSeiUnico.TRZ_TOTALEPOSITIVO.ToString()));
ds.Tables.Add(dtPatrimonio);
#endregion
#region Intermediari
var intermediari = datiSeiUnico.patrimonioUnit().patrimonioTerzi.intermediario;
var dtIntermediari = new DataTable();
dtIntermediari.Columns.Add(new DataColumn("Intermediario", typeof(string)));
dtIntermediari.Columns.Add(new DataColumn("Red", typeof(int)));
dtIntermediari.Columns.Add(new DataColumn("Green", typeof(int)));
dtIntermediari.Columns.Add(new DataColumn("Blue", typeof(int)));
dtIntermediari.Columns.Add(new DataColumn("ControvalorePercentuale", typeof(decimal)));
// dtIntermediari.Columns.Add(new DataColumn("Percentuale", typeof(decimal)));
dtIntermediari.Columns.Add(new DataColumn("Ordinamento", typeof(int)));
foreach (var item in intermediari.elencoSlice)
{
var mapDisplayInfo = displayInfo.FirstOrDefault(o => o.key.Equals(item.codice)).value;
var colore = new ColorPDF(mapDisplayInfo.fill);
var ordinamento = mapDisplayInfo.order;
bool contocorrentenegativo = intermediariAsterisco.FirstOrDefault(o => o.idIntermediario == Convert.ToInt32(item.chiaveAggragazione)).contoCorrentiNegativi != null && intermediariAsterisco.FirstOrDefault(o => o.idIntermediario == Convert.ToInt32(item.chiaveAggragazione)).contoCorrentiNegativi != 0 ? true : false;
dtIntermediari.Rows.Add(contocorrentenegativo ? item.descrizione+"*" : item.descrizione, colore.Red, colore.Green, colore.Blue, isControvalore() ? item.ctv : item.peso * 100, ordinamento);
}
ds.Tables.Add(dtIntermediari.AsEnumerable().OrderBy(r => r.Field<int>("Ordinamento")).CopyToDataTable());
#endregion
return ds;
}
public virtual bool isControvalore(){return !GetOption<Opzione3>().Valore;}
public virtual string getTesto1() {
return !isControvalore() ?
Helper.ReplaceVariables(GetText().Rows[0]["testo1"].ToString(), base.EnvironmentFacade.ReportEnvironment) :
Helper.ReplaceVariables(GetText().Rows[0]["testo2"].ToString(), base.EnvironmentFacade.ReportEnvironment);
}
public virtual string GetNote1(){
string nota = "";
if (datiSeiUnico.TRZ_CCN != 0) {
nota += datiSeiUnico.FormatDecimal("(*) Il controvalore esclude il saldo negativo dei conti correnti ({0} €).", datiSeiUnico.TRZ_CCN);
}
return nota;
}
}
}