968 lines
56 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 System.Collections.Generic;
using Consulenza.ReportWriter.Business.CHART_PDF;
using Consulenza.ReportWriter.Business.Entity;
using System.Linq;
using Consulenza.DataServices.fideuram.data.service;
namespace Consulenza.ReportWriter.Manager.Section.Unica
{
/// <summary>
/// S32.Patrimonio altri Istituti: rappresentazione per macro asset class idSezione = 75
/// </summary>
public class S32 : Entity.Section
{
private DataTable _testi;
private bool _presenzaColonnaControvaloreProdotto;
private int _numeroColonneMacroAsset = 0;
private const int larghezzaColonnaMacroAsset_Small = 60;
private const int larghezzaColonnaMacroAsset_Large = 65;
private Dictionary<string, int> larghezzaColonneMacroAsset_List = new Dictionary<string, int>();
public S32(EnvironmentFacade environmentFacade, int idSection)
: base(environmentFacade, idSection)
{
try
{
Draw();
}
catch (Exception ex)
{
SectionLogger.Write("S32", ex.Message, SectionLoggerMessageLevel.E, EnvironmentFacade.ReportEnvironment);
}
}
//protected override sealed void OLD_Draw()
//{
// var dati = GetDataSet();
// if (presenzaGraficoBarre())
// {
// #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 del patrimonio
// var tabellaPatrimonio = new TablePDF(EnvironmentFacade.RendererFacade.XLeftLimit, dati.Tables["patrimonio"])
// {
// 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) { HeaderFontSize=7});
// tabellaPatrimonio.Columns.Add(new ColumnPDF("valore", 330, HorizontalAlignmentType.Sinistra, false, false, 7, ColumnType.Testo, "valore", string.Empty) { PaddingLeft = 5, HeaderFontSize = 7 });
// AddElement(tabellaPatrimonio);
// AddElement(new SpacePDF(25));
// #endregion
// #region Grafico a barre
// //AddElement(new FormattedTextAreaPDF("Macro asset class", 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 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 dtGraficoBarre = dati.Tables["asset"].AsEnumerable().OrderBy(oo => oo.Field<int>("Ordinamento")).CopyToDataTable();
// var serieCollezione = new List<Serie> { new Serie { Name = "MacroAsset", Border = true } };
// graficoBarre.Headers.Add(new FormattedTextAreaPDF("Macro asset class", EnvironmentFacade.RendererFacade.XLeftLimit, 100) { BackGroundColor = ColorPDF.Standard_Grigio_SfondoColonnaTabella, FontBold = true, FontSize = 7, FontColor = ColorPDF.ConsulenzaUnica_Rosso, AutoIncrementYWritable = false, BackGroundMarginLeft = 5 });
// graficoBarre.Headers.Add(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 });
// foreach (DataRow item in dtGraficoBarre.Rows)
// {
// serieCollezione[0].Points.Add(new Point
// {
// ShowLabelAxisY = true,
// LabelAxisY = isControvalore() ? Helper.FormatCurrency(item["Controvalore"].ToString()) : Helper.FormatDecimal(item["Percentuale"].ToString(), 2),
// FontSizeLabelAxisY = 7,
// Color = new ColorPDF(Convert.ToInt32(item["Red"]), Convert.ToInt32(item["Green"]), Convert.ToInt32(item["Blue"])),
// Value = isControvalore() ? (Convert.ToDouble(item["Controvalore"]) == 0 ? 0.01 : Convert.ToDouble(item["Controvalore"])) : Convert.ToDouble(item["Percentuale"]) == 0 ? 0.01 : Convert.ToDouble(item["Percentuale"]),
// ShowLabelAxisX = true,
// LabelAxisX = item["MacroAsset"].ToString(),
// FontSizeLabelAxisX = 7,
// FontColorLabelAxisX = ColorPDF.Nero,
// FontBoldLabelAxisY = false
// });
// }
// graficoBarre.SeriesCollection = serieCollezione;
// if(isControvalore())
// graficoBarre.RemoveWhiteSpaceToTheRightAxisX = true;
// AddElement(graficoBarre);
// #endregion
// #region Nota del PatrimonioCasa
// if (GetNote1().Length > 0)
// {
// AddElement(new SpacePDF(20));
// AddElement(new FormattedTextAreaPDF(GetNote1(), EnvironmentFacade.RendererFacade.XLeftLimit) { FontSize = 6, TextHorizontalAlign = ceTe.DynamicPDF.TextAlign.Justify });
// }
// #endregion
// }
// if (presenzaTabella())
// {
// #region Testo introduttivo tabella prodotti
// AddElement(new SpacePDF(20));
// AddElement(new FormattedTextAreaPDF(getTesto2(), EnvironmentFacade.RendererFacade.XLeftLimit) {FontSize=7, TextHorizontalAlign = ceTe.DynamicPDF.TextAlign.Justify });
// AddElement(new SpacePDF(15));
// #endregion
// #region Tabella Prodotti X Intermediario
// #region largezza e visibilità colonne
// var larghezzaColonnaControvalore = _presenzaColonnaControvaloreProdotto ? 80 : 0;
// var larghezzaColonnaDescrizione = 520 - (larghezzaColonnaControvalore + (larghezzaColonneMacroAsset_List.Sum(o => o.Value)));
// #endregion
// var tabellaProdottiPerIntermediario = new TablePDF(EnvironmentFacade.RendererFacade.XLeftLimit, dati.Tables["prodottoPerIntermediario"], dati.Tables["prodottoPatrimonioAltro"])
// {
// Style = Style.ConsulenzaUnica,
// Header = true,
// Footer = true,
// AlternateRow = false,
// ShowSeparationLines = false,
// HeaderMargin = 2,
// WhiteSpacesHorizontalSeparator = true
// };
// #region Columns e FooterColumns
// tabellaProdottiPerIntermediario.Columns.Add(new ColumnPDF("DescrizioneProdottoIntermediario", larghezzaColonnaDescrizione, HorizontalAlignmentType.Sinistra, false, true, 6, ColumnType.Testo, "DescrizioneProdotto", string.Empty) { HeaderFontSize = 7, HeaderBackgroundColor = ColorPDF.Bianco, PaddingRight = 10 });
// tabellaProdottiPerIntermediario.FooterColumns.Add(new ColumnPDF("DescrizioneProdottoIntermediario", larghezzaColonnaDescrizione, HorizontalAlignmentType.Sinistra, false, true, 6, ColumnType.Testo) { HeaderFontSize = 7});
// if (_presenzaColonnaControvaloreProdotto)
// {
// tabellaProdottiPerIntermediario.Columns.Add(new ColumnPDF("ValoreProdotto", larghezzaColonnaControvalore, HorizontalAlignmentType.Sinistra, false, true, 6, ColumnType.Testo, "ValoreProdottoString", "Controvalore<BR>attuale (€)") { HeaderFontSize = 7, HeaderBackgroundColor = ColorPDF.Bianco, HeaderFontColor = ColorPDF.Nero,HeaderPaddingLeft=15, PaddingRight = 4 });
// tabellaProdottiPerIntermediario.FooterColumns.Add(new ColumnPDF("ValoreProdotto", larghezzaColonnaControvalore, HorizontalAlignmentType.Destra, false, true, 6, ColumnType.Testo) { HeaderFontSize = 7, PaddingRight =4 });
// }
// var dtAsset = dati.Tables["asset"].AsEnumerable().OrderBy(oo => oo.Field<int>("Ordinamento")).CopyToDataTable();
// int lastColumn = dtAsset.Rows.Count;
// int i = 1;
// foreach (DataRow item in dtAsset.Rows)
// {
// var colore = new ColorPDF(Convert.ToInt32(item["Red"]), Convert.ToInt32(item["Green"]), Convert.ToInt32(item["Blue"]));
// if (item[0].Equals("Obbligazionario") || item[0].Equals("Azionario") || item[0].Equals("Altro"))
// tabellaProdottiPerIntermediario.Columns.Add(new ColumnPDF(item["CodiceMacroAsset"].ToString(), larghezzaColonneMacroAsset_List[item["CodiceMacroAsset"].ToString()], HorizontalAlignmentType.Centrato, false, false, 6, ColumnType.Testo, item["CodiceMacroAsset"].ToString() + "String", item["MacroAsset"].ToString() + "<BR>(" + (isControvalore() ? "€" : "%")+")") { HeaderPaddingRight = 2, PaddingRight = 4, HeaderBackgroundColor = colore, BackgroundColor = colore, FontSize = 6, HeaderFontSize = 6, HeaderFontColor = ColorPDF.Bianco, FontColor = ColorPDF.Bianco, VerticalAlignment = VerticalAlignmentType.Centrato });
// else if (item[0].Equals("Monetario Valute Estere"))
// tabellaProdottiPerIntermediario.Columns.Add(new ColumnPDF(item["CodiceMacroAsset"].ToString(), larghezzaColonneMacroAsset_List[item["CodiceMacroAsset"].ToString()], HorizontalAlignmentType.Centrato, false, false, 6, ColumnType.Testo, item["CodiceMacroAsset"].ToString() + "String", item["MacroAsset"].ToString() + " (" + (isControvalore() ? "€" : "%") + ")") { HeaderBackgroundColor = colore, PaddingRight = 4, BackgroundColor = colore, HeaderFontSize = 6, FontSize = 6, HeaderFontColor = ColorPDF.Nero, VerticalAlignment = VerticalAlignmentType.Centrato });
// else
// tabellaProdottiPerIntermediario.Columns.Add(new ColumnPDF(item["CodiceMacroAsset"].ToString(), larghezzaColonneMacroAsset_List[item["CodiceMacroAsset"].ToString()], HorizontalAlignmentType.Centrato, false, false, 6, ColumnType.Testo, item["CodiceMacroAsset"].ToString() + "String", item["MacroAsset"].ToString() + "<BR>(" + (isControvalore() ? "€" : "%") + ")") { HeaderBackgroundColor = colore, PaddingRight = 4, BackgroundColor = colore, HeaderFontSize = 6, FontSize = 6, HeaderFontColor = ColorPDF.Nero, VerticalAlignment = VerticalAlignmentType.Centrato });
// //if(item[0].Equals("Altro"))
// // tabellaProdottiPerIntermediario.FooterColumns.Add(new ColumnPDF(item["CodiceMacroAsset"].ToString(), larghezzaColonneMacroAsset_List[item["CodiceMacroAsset"].ToString()], HorizontalAlignmentType.Destra, false, true, 6, ColumnType.Testo) { FontSize = 6, PaddingRight = 0 });
// // else
// tabellaProdottiPerIntermediario.FooterColumns.Add(new ColumnPDF(item["CodiceMacroAsset"].ToString(), larghezzaColonneMacroAsset_List[item["CodiceMacroAsset"].ToString()], HorizontalAlignmentType.Destra, false, true, 6, ColumnType.Testo) { FontSize = 6, PaddingRight = (i == lastColumn? -1 : 4) });
// i++;
// }
// int a = 0;
// foreach (var item in dati.Tables["prodottoPerIntermediario"].Rows)
// {
// for (int b = 1; b < tabellaProdottiPerIntermediario.Columns.Count; b++)
// {
// tabellaProdottiPerIntermediario.Cells[b, a].HorizontalAlignment = HorizontalAlignmentType.Destra;
// }
// a++;
// }
// #endregion
// #region Cells
// int r = 0;
// foreach (DataRow rw in dati.Tables["prodottoPerIntermediario"].Rows)
// {
// var isTotal = Convert.ToBoolean(rw["IsTotal"]);
// if (isTotal)
// {
// for (int c = 0; c < tabellaProdottiPerIntermediario.Columns.Count; c++)
// {
// tabellaProdottiPerIntermediario.Cells[c, r].BackgroundColor = ColorPDF.Standard_Grigio_SfondoColonnaTabella;
// tabellaProdottiPerIntermediario.Cells[c, r].FontBold = true;
// tabellaProdottiPerIntermediario.Cells[c, r].FontColor = ColorPDF.Nero;
// }
// }
// else
// for (int c = 0; c < tabellaProdottiPerIntermediario.Columns.Count; c++)
// {
// // FontColor Descrizione = Nero
// // FontColor Colonne Colorate = Bianco
// for (int col = 0; col < tabellaProdottiPerIntermediario.Columns.Count; col++)
// {
// if (tabellaProdottiPerIntermediario.Columns[col].Id == "OB" || tabellaProdottiPerIntermediario.Columns[col].Id == "AZ" || tabellaProdottiPerIntermediario.Columns[col].Id == "AL")
// tabellaProdottiPerIntermediario.Cells[col, r].FontColor = ColorPDF.Bianco;
// else
// tabellaProdottiPerIntermediario.Cells[col, r].FontColor = ColorPDF.Nero;
// if (col >= 2)
// tabellaProdottiPerIntermediario.Cells[col, r].HorizontalAlignment = HorizontalAlignmentType.Destra;
// }
// }
// r++;
// }
// #endregion
// tabellaProdottiPerIntermediario.ShowSeparationLines = false;
// tabellaProdottiPerIntermediario.WhiteSpacesHorizontalSeparator = false;
// AddElement(tabellaProdottiPerIntermediario);
// #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
if (presenzaGraficoBarre())
{
#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 del patrimonio
var tabellaPatrimonio = new TablePDF(EnvironmentFacade.RendererFacade.XLeftLimit, dati.Tables["patrimonio"])
{
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) { HeaderFontSize = 7 });
tabellaPatrimonio.Columns.Add(new ColumnPDF("valore", 330, HorizontalAlignmentType.Sinistra, false, false, 7, ColumnType.Testo, "valore", string.Empty) { PaddingLeft = 5, HeaderFontSize = 7 });
AddElement(tabellaPatrimonio);
AddElement(new SpacePDF(25));
#endregion
#region Grafico a barre
//AddElement(new FormattedTextAreaPDF("Macro asset class", 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 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 dtGraficoBarre = dati.Tables["asset"].AsEnumerable().OrderBy(oo => oo.Field<int>("Ordinamento")).CopyToDataTable();
var serieCollezione = new List<Serie> { new Serie { Name = "MacroAsset", Border = true } };
graficoBarre.Headers.Add(new FormattedTextAreaPDF("Macro asset class", EnvironmentFacade.RendererFacade.XLeftLimit, 100) { BackGroundColor = ColorPDF.Standard_Grigio_SfondoColonnaTabella, FontBold = true, FontSize = 7, FontColor = ColorPDF.ConsulenzaUnica_Rosso, AutoIncrementYWritable = false, BackGroundMarginLeft = 5 });
graficoBarre.Headers.Add(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 });
foreach (DataRow item in dtGraficoBarre.Rows)
{
serieCollezione[0].Points.Add(new Point
{
ShowLabelAxisY = true,
LabelAxisY = isControvalore() ? Helper.FormatCurrency(item["Controvalore"].ToString()) : Helper.FormatDecimal(item["Percentuale"].ToString(), 2),
FontSizeLabelAxisY = 7,
Color = new ColorPDF(Convert.ToInt32(item["Red"]), Convert.ToInt32(item["Green"]), Convert.ToInt32(item["Blue"])),
Value = isControvalore() ? (Convert.ToDouble(item["Controvalore"]) == 0 ? 0.01 : Convert.ToDouble(item["Controvalore"])) : Convert.ToDouble(item["Percentuale"]) == 0 ? 0.01 : Convert.ToDouble(item["Percentuale"]),
ShowLabelAxisX = true,
LabelAxisX = item["MacroAsset"].ToString(),
FontSizeLabelAxisX = 7,
FontColorLabelAxisX = ColorPDF.Nero,
FontBoldLabelAxisY = false
});
}
graficoBarre.SeriesCollection = serieCollezione;
if (isControvalore())
graficoBarre.RemoveWhiteSpaceToTheRightAxisX = true;
AddElement(graficoBarre);
#endregion
#region Nota del PatrimonioCasa
if (GetNote1().Length > 0)
{
AddElement(new SpacePDF(20));
AddElement(new FormattedTextAreaPDF(GetNote1(), EnvironmentFacade.RendererFacade.XLeftLimit) { FontSize = 6, TextHorizontalAlign = ceTe.DynamicPDF.TextAlign.Justify });
}
#endregion
}
if (presenzaTabella())
{
#region Testo introduttivo tabella prodotti
AddElement(new SpacePDF(20));
AddElement(new FormattedTextAreaPDF(getTesto2(), EnvironmentFacade.RendererFacade.XLeftLimit) { FontSize = 7, TextHorizontalAlign = ceTe.DynamicPDF.TextAlign.Justify });
AddElement(new SpacePDF(15));
#endregion
#region Tabella Prodotti X Intermediario
#region largezza e visibilità colonne
var larghezzaColonnaControvalore = _presenzaColonnaControvaloreProdotto ? 80 : 0;
var larghezzaColonnaDescrizione = 520 - (larghezzaColonnaControvalore + (larghezzaColonneMacroAsset_List.Sum(o => o.Value)));
#endregion
var tabellaProdottiPerIntermediario = new TablePDF(EnvironmentFacade.RendererFacade.XLeftLimit, dati.Tables["prodottoPerIntermediario"], dati.Tables["prodottoPatrimonioAltro"])
{
Style = Style.ConsulenzaUnica,
Header = true,
Footer = true,
AlternateRow = false,
ShowSeparationLines = false,
HeaderMargin = 2,
WhiteSpacesHorizontalSeparator = true
};
#region Columns e FooterColumns
tabellaProdottiPerIntermediario.Columns.Add(new ColumnPDF("DescrizioneProdottoIntermediario", larghezzaColonnaDescrizione, HorizontalAlignmentType.Sinistra, false, true, 6, ColumnType.Testo, "DescrizioneProdotto", string.Empty) { HeaderFontSize = 7, HeaderBackgroundColor = ColorPDF.Bianco, PaddingRight = 10 });
tabellaProdottiPerIntermediario.FooterColumns.Add(new ColumnPDF("DescrizioneProdottoIntermediario", larghezzaColonnaDescrizione, HorizontalAlignmentType.Sinistra, false, true, 6, ColumnType.Testo) { HeaderFontSize = 7 });
if (_presenzaColonnaControvaloreProdotto)
{
tabellaProdottiPerIntermediario.Columns.Add(new ColumnPDF("ValoreProdotto", larghezzaColonnaControvalore, HorizontalAlignmentType.Sinistra, false, true, 6, ColumnType.Testo, "ValoreProdottoString", "Controvalore<BR>attuale (€)") { HeaderFontSize = 7, HeaderBackgroundColor = ColorPDF.Bianco, HeaderFontColor = ColorPDF.Nero, HeaderPaddingLeft = 15, PaddingRight = 4 });
tabellaProdottiPerIntermediario.FooterColumns.Add(new ColumnPDF("ValoreProdotto", larghezzaColonnaControvalore, HorizontalAlignmentType.Destra, false, true, 6, ColumnType.Testo) { HeaderFontSize = 7, PaddingRight = 4 });
}
var dtAsset = dati.Tables["asset"].AsEnumerable().OrderBy(oo => oo.Field<int>("Ordinamento")).CopyToDataTable();
int lastColumn = dtAsset.Rows.Count;
int i = 1;
foreach (DataRow item in dtAsset.Rows)
{
var colore = new ColorPDF(Convert.ToInt32(item["Red"]), Convert.ToInt32(item["Green"]), Convert.ToInt32(item["Blue"]));
if (item[0].Equals("Obbligazionario") || item[0].Equals("Azionario") || item[0].Equals("Altro"))
tabellaProdottiPerIntermediario.Columns.Add(new ColumnPDF(item["CodiceMacroAsset"].ToString(), larghezzaColonneMacroAsset_List[item["CodiceMacroAsset"].ToString()], HorizontalAlignmentType.Centrato, false, false, 6, ColumnType.Testo, item["CodiceMacroAsset"].ToString() + "String", item["MacroAsset"].ToString() + "<BR>(" + (isControvalore() ? "€" : "%") + ")") { HeaderPaddingRight = 2, PaddingRight = 4, HeaderBackgroundColor = colore, BackgroundColor = colore, FontSize = 6, HeaderFontSize = 6, HeaderFontColor = ColorPDF.Bianco, FontColor = ColorPDF.Bianco, VerticalAlignment = VerticalAlignmentType.Centrato });
else if (item[0].Equals("Monetario Valute Estere"))
tabellaProdottiPerIntermediario.Columns.Add(new ColumnPDF(item["CodiceMacroAsset"].ToString(), larghezzaColonneMacroAsset_List[item["CodiceMacroAsset"].ToString()], HorizontalAlignmentType.Centrato, false, false, 6, ColumnType.Testo, item["CodiceMacroAsset"].ToString() + "String", item["MacroAsset"].ToString() + " (" + (isControvalore() ? "€" : "%") + ")") { HeaderBackgroundColor = colore, PaddingRight = 4, BackgroundColor = colore, HeaderFontSize = 6, FontSize = 6, HeaderFontColor = ColorPDF.Nero, VerticalAlignment = VerticalAlignmentType.Centrato });
else
tabellaProdottiPerIntermediario.Columns.Add(new ColumnPDF(item["CodiceMacroAsset"].ToString(), larghezzaColonneMacroAsset_List[item["CodiceMacroAsset"].ToString()], HorizontalAlignmentType.Centrato, false, false, 6, ColumnType.Testo, item["CodiceMacroAsset"].ToString() + "String", item["MacroAsset"].ToString() + "<BR>(" + (isControvalore() ? "€" : "%") + ")") { HeaderBackgroundColor = colore, PaddingRight = 4, BackgroundColor = colore, HeaderFontSize = 6, FontSize = 6, HeaderFontColor = ColorPDF.Nero, VerticalAlignment = VerticalAlignmentType.Centrato });
//if(item[0].Equals("Altro"))
// tabellaProdottiPerIntermediario.FooterColumns.Add(new ColumnPDF(item["CodiceMacroAsset"].ToString(), larghezzaColonneMacroAsset_List[item["CodiceMacroAsset"].ToString()], HorizontalAlignmentType.Destra, false, true, 6, ColumnType.Testo) { FontSize = 6, PaddingRight = 0 });
// else
tabellaProdottiPerIntermediario.FooterColumns.Add(new ColumnPDF(item["CodiceMacroAsset"].ToString(), larghezzaColonneMacroAsset_List[item["CodiceMacroAsset"].ToString()], HorizontalAlignmentType.Destra, false, true, 6, ColumnType.Testo) { FontSize = 6, PaddingRight = (i == lastColumn ? -1 : 4) });
i++;
}
int a = 0;
foreach (var item in dati.Tables["prodottoPerIntermediario"].Rows)
{
for (int b = 1; b < tabellaProdottiPerIntermediario.Columns.Count; b++)
{
tabellaProdottiPerIntermediario.Cells[b, a].HorizontalAlignment = HorizontalAlignmentType.Destra;
}
a++;
}
#endregion
#region Cells
int r = 0;
foreach (DataRow rw in dati.Tables["prodottoPerIntermediario"].Rows)
{
var isTotal = Convert.ToBoolean(rw["IsTotal"]);
if (isTotal)
{
for (int c = 0; c < tabellaProdottiPerIntermediario.Columns.Count; c++)
{
tabellaProdottiPerIntermediario.Cells[c, r].BackgroundColor = ColorPDF.Standard_Grigio_SfondoColonnaTabella;
tabellaProdottiPerIntermediario.Cells[c, r].FontBold = true;
tabellaProdottiPerIntermediario.Cells[c, r].FontColor = ColorPDF.Nero;
}
}
else
for (int c = 0; c < tabellaProdottiPerIntermediario.Columns.Count; c++)
{
// FontColor Descrizione = Nero
// FontColor Colonne Colorate = Bianco
for (int col = 0; col < tabellaProdottiPerIntermediario.Columns.Count; col++)
{
if (tabellaProdottiPerIntermediario.Columns[col].Id == "OB" || tabellaProdottiPerIntermediario.Columns[col].Id == "AZ" || tabellaProdottiPerIntermediario.Columns[col].Id == "AL")
tabellaProdottiPerIntermediario.Cells[col, r].FontColor = ColorPDF.Bianco;
else
tabellaProdottiPerIntermediario.Cells[col, r].FontColor = ColorPDF.Nero;
if (col >= 2)
tabellaProdottiPerIntermediario.Cells[col, r].HorizontalAlignment = HorizontalAlignmentType.Destra;
}
}
r++;
}
#endregion
tabellaProdottiPerIntermediario.ShowSeparationLines = false;
tabellaProdottiPerIntermediario.WhiteSpacesHorizontalSeparator = false;
AddElement(tabellaProdottiPerIntermediario);
#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("patrimonio"));
ds.Tables.Add(new DataTable("prodotto"));
ds.Tables.Add(new DataTable("asset"));
ds.Tables.Add(new DataTable("prodottoPerIntermediario"));
ds.Tables.Add(new DataTable("prodottoPatrimonioAltro"));
#region Estrazione Dati
var dataMacroAsset = datiSeiUnico.patrimonioUnit().patrimonioTerzi.macroAssetClass;
var dataDettaglioProdotti =datiSeiUnico.patrimonioUnit().patrimonioTerzi.dettaglioProdotti.dettaglioProdotti.ToList();
var displayInfo = datiSeiUnico.displayInfos().macroAssetDisplayInfos.ToList();
string risorseFinanziarieTerzi = datiSeiUnico.patrimonioUnit().patrimonioTerzi.patrimonioTerziBean.risorseFinanziarieTerzi.ToString();
bool ccNegPresent = datiSeiUnico.patrimonioUnit().patrimonioTerzi.patrimonioTerziBean.contoCorrentiNegativi != 0;
#endregion
const string stringReplaceIfZero = " ";
#region Patrimonio
var testoPatrimonio = string.Format("Patrimonio altri Istituti (€){0}", (GetNote1().Length>0 ? "*" : ""));
ds.Tables["patrimonio"].Columns.Add(new DataColumn("Descrizione", typeof(string)));
ds.Tables["patrimonio"].Columns.Add(new DataColumn("Valore", typeof(string)));
ds.Tables["patrimonio"].Rows.Add(testoPatrimonio, Helper.FormatCurrency(datiSeiUnico.TRZ_TOTALEPOSITIVO.ToString()));
#endregion
#region Prodotti
#region Definizione DataTable
ds.Tables["prodotto"].Columns.Add(new DataColumn("DescrizioneIntermediario", typeof(string)));
ds.Tables["prodotto"].Columns.Add(new DataColumn("DescrizioneProdotto", typeof(string)));
ds.Tables["prodotto"].Columns.Add(new DataColumn("ValoreProdotto", typeof(decimal)));
ds.Tables["prodotto"].Columns.Add(new DataColumn("ValoreProdottoString", typeof(string)));
foreach (var item in dataMacroAsset.distribuzione.elencoSlice)
{
if (item.sliceRappresentabile)
{
ds.Tables["prodotto"].Columns.Add(new DataColumn(item.codice, typeof(string)));
ds.Tables["prodotto"].Columns.Add(new DataColumn(item.codice + "String", typeof(string)));
}
}
ds.Tables["prodotto"].Columns.Add(new DataColumn("OrdinamentoIntermediario", typeof(decimal)));
// Colonne di formattazione
ds.Tables["prodotto"].Columns.Add(new DataColumn("FontBold", typeof(bool)));
ds.Tables["prodotto"].Columns.Add(new DataColumn("ReplaceIfZero", typeof(string)));
ds.Tables["prodotto"].Columns.Add(new DataColumn("CanLastRow", typeof(bool)));
ds.Tables["prodotto"].Columns.Add(new DataColumn("IsTotal", typeof(bool)));
#endregion
#region Popolamento DataTable
const string labelProdottiNonRappresentabili = "n.d.";
//var displayInfoI = datiSeiUnico.displayInfos().intermediariDisplayInfos;
foreach (var itemMacroAsset in dataMacroAsset.distribuzionePerProdotti.listaProdotti)
{
var itemPosizione = dataDettaglioProdotti.FirstOrDefault(o => o.chiaveProdottoTerzi.Equals(itemMacroAsset.chiaveAggregazione));
var flagProdottoRappresentabile = itemMacroAsset.rappresentabile;
var rowProdotti = ds.Tables["prodotto"].NewRow();
rowProdotti["DescrizioneIntermediario"] = itemPosizione.nomeIntermediario;
rowProdotti["DescrizioneProdotto"] = itemPosizione.prodotto.nomeProdotto;
rowProdotti["OrdinamentoIntermediario"] = Math.Round(Convert.ToDecimal(itemPosizione.ctv), 2);
rowProdotti["ValoreProdotto"] = Math.Round(Convert.ToDecimal(itemPosizione.ctv), 2);
rowProdotti["ValoreProdottoString"] = Helper.FormatCurrency(rowProdotti["ValoreProdotto"].ToString());
foreach (var item in dataMacroAsset.distribuzione.elencoSlice)
{
if (item.sliceRappresentabile)
{
if (!presenzaContocorrenteInMonterio() && itemPosizione.prodotto.contoCorrente)
//if (itemPosizione.prodotto.contoCorrente) BugFix #4661
{
rowProdotti[item.codice] = flagProdottoRappresentabile ? itemMacroAsset.listaSlice.Any(o => o.codice.Equals(item.codice)) ?
isControvalore() ?
"n.a." :
"n.a." :
"n.a." :
"n.a.";
}
else
{
rowProdotti[item.codice] = flagProdottoRappresentabile ? itemMacroAsset.listaSlice.Any(o => o.codice.Equals(item.codice)) ?
isControvalore() ?
Convert.ToDecimal(itemMacroAsset.listaSlice.FirstOrDefault(o => o.codice.Equals(item.codice)).ctv) :
Convert.ToDecimal(itemMacroAsset.listaSlice.FirstOrDefault(o => o.codice.Equals(item.codice)).pesoSuPosizione * 100) :
0 :
0;
}
rowProdotti[item.codice + "String"] = flagProdottoRappresentabile ? Helper.FormatCurrency(rowProdotti[item.codice].ToString()) : labelProdottiNonRappresentabili;
}
}
rowProdotti["FontBold"] = false;
rowProdotti["ReplaceIfZero"] = stringReplaceIfZero;
rowProdotti["CanLastRow"] = true;
rowProdotti["IsTotal"] = false;
ds.Tables["prodotto"].Rows.Add(rowProdotti);
}
#endregion
#endregion
#region MacroAsset
ds.Tables["asset"].Columns.Add(new DataColumn("MacroAsset", typeof(string)));
ds.Tables["asset"].Columns.Add(new DataColumn("CodiceMacroAsset", typeof(string)));
ds.Tables["asset"].Columns.Add(new DataColumn("Controvalore", typeof(string)));
ds.Tables["asset"].Columns.Add(new DataColumn("Percentuale", typeof(string)));
ds.Tables["asset"].Columns.Add(new DataColumn("Red", typeof(int)));
ds.Tables["asset"].Columns.Add(new DataColumn("Green", typeof(int)));
ds.Tables["asset"].Columns.Add(new DataColumn("Blue", typeof(int)));
ds.Tables["asset"].Columns.Add(new DataColumn("Ordinamento", typeof(int)));
foreach (var itemDistribuzione in dataMacroAsset.distribuzione.elencoSlice)
{
if (itemDistribuzione.sliceRappresentabile)
{
var mapDisplayInfo = displayInfo.FirstOrDefault(o => o.key.Equals(itemDistribuzione.codice)).value;
var colore = new ColorPDF(mapDisplayInfo.fill);
var ordinamento = mapDisplayInfo.order;
var controvalore = presenzaContocorrenteInMonterio() ? itemDistribuzione.ctvCC : itemDistribuzione.ctv;
var percentuale = (presenzaContocorrenteInMonterio() ? itemDistribuzione.pesoCC : itemDistribuzione.peso) * 100;
if (controvalore != 0)
{
larghezzaColonneMacroAsset_List.Add(
itemDistribuzione.codice,
(itemDistribuzione.codice.Equals("OB") || itemDistribuzione.codice.Equals("FX")) ? larghezzaColonnaMacroAsset_Large : larghezzaColonnaMacroAsset_Small
);
ds.Tables["asset"].Rows.Add(itemDistribuzione.descrizione, itemDistribuzione.codice, controvalore, percentuale, colore.Red, colore.Green, colore.Blue, ordinamento);
}
}
}
ds.Tables["asset"].AsEnumerable().OrderBy(r => r.Field<int>("Ordinamento")).CopyToDataTable();
// TO DO ORDINAMENTO
//ds.Tables.Add(dtMacroAsset.AsEnumerable().OrderBy(r => r.Field<int>("Ordinamento")).CopyToDataTable());
#endregion
#region Prodotti raggruppati per area
//var dtProdottiPerIntermediario = new DataTable();
//dtProdottiPerIntermediario = dtProdotti.Clone(); // Clono la struttura
//dtProdottiPerIntermediario.TableName = "dtProdottiPerIntermediario";
ds.Tables["prodottoPerIntermediario"].Columns.Add(new DataColumn("DescrizioneIntermediario", typeof(string)));
ds.Tables["prodottoPerIntermediario"].Columns.Add(new DataColumn("DescrizioneProdotto", typeof(string)));
ds.Tables["prodottoPerIntermediario"].Columns.Add(new DataColumn("ValoreProdotto", typeof(decimal)));
ds.Tables["prodottoPerIntermediario"].Columns.Add(new DataColumn("ValoreProdottoString", typeof(string)));
ds.Tables["prodottoPerIntermediario"].Columns.Add(new DataColumn("OrdinamentoIntermediario", typeof(decimal)));
ds.Tables["prodottoPerIntermediario"].Columns.Add(new DataColumn("FontBold", typeof(bool)));
ds.Tables["prodottoPerIntermediario"].Columns.Add(new DataColumn("ReplaceIfZero", typeof(string)));
ds.Tables["prodottoPerIntermediario"].Columns.Add(new DataColumn("CanLastRow", typeof(bool)));
ds.Tables["prodottoPerIntermediario"].Columns.Add(new DataColumn("IsTotal", typeof(bool)));
foreach (var item in dataMacroAsset.distribuzione.elencoSlice)
{
if (item.sliceRappresentabile)
{
ds.Tables["prodottoPerIntermediario"].Columns.Add(new DataColumn(item.codice, typeof(string)));
ds.Tables["prodottoPerIntermediario"].Columns.Add(new DataColumn(item.codice + "String", typeof(string)));
}
}
// Intermediari
var viewIntermediari = new DataView(ds.Tables["prodotto"].AsEnumerable().OrderByDescending(x => x.Field<decimal>("OrdinamentoIntermediario")).CopyToDataTable());
var dtIntermediari = viewIntermediari.ToTable(true, "DescrizioneIntermediario");
var intermediario = string.Empty;
#region Prodotti delle Risorse Finanziarie
var distribuzioneintermediario = dataMacroAsset.distribuzioneAree;
foreach (DataRow rowIntermediario in dtIntermediari.Rows)
{
intermediario = rowIntermediario["DescrizioneIntermediario"].ToString();
var distribuzione = dataMacroAsset.distribuzioneAree.FirstOrDefault(o => o.descrizioneArea.Equals(intermediario));
var bIntestazioneIntermediario = true; // la riga di intestazione dell'intermediario va stampata una sola volta.
DataRow rowProdottiPerIntermediario;
// Subset di prodotti filtrati per Intermediario
var dtIntermediario = ds.Tables["prodotto"].Select("DescrizioneIntermediario='" + intermediario.Replace("'", "''") + "'").OrderByDescending(x => x.Field<decimal>("ValoreProdotto")).CopyToDataTable();
if (bIntestazioneIntermediario)
{
#region Riga con background grigio di intestazione per ogni Intermediario
rowProdottiPerIntermediario = ds.Tables["prodottoPerIntermediario"].NewRow();
rowProdottiPerIntermediario["DescrizioneProdotto"] = intermediario;
rowProdottiPerIntermediario["OrdinamentoIntermediario"] = distribuzione.distribuzione.totaleCtv;
rowProdottiPerIntermediario["ValoreProdotto"] = distribuzione.distribuzione.totaleCtv;// dtIntermediario.AsEnumerable().Sum(x => x.Field<decimal>("ValoreProdotto"));
rowProdottiPerIntermediario["ValoreProdottoString"] =Helper.FormatCurrency(rowProdottiPerIntermediario["ValoreProdotto"].ToString());
foreach (var item in dataMacroAsset.distribuzione.elencoSlice)
{
if (item.sliceRappresentabile)
{
var slice = distribuzione.distribuzione.elencoSlice.FirstOrDefault(o => o.codice == item.codice);
var controvalore = slice != null ? (presenzaContocorrenteInMonterio() ? slice.ctvCC : slice.ctv) : -1;
var perc = slice != null ? (presenzaContocorrenteInMonterio() ? slice.pesoCC : slice.peso) * 100 : -1;
rowProdottiPerIntermediario[item.codice] = isControvalore() ? controvalore : perc;
rowProdottiPerIntermediario[item.codice + "String"] =slice != null ? Helper.FormatCurrency(rowProdottiPerIntermediario[item.codice].ToString()) : "";
}
}
rowProdottiPerIntermediario["FontBold"] = true;
rowProdottiPerIntermediario["ReplaceIfZero"] = stringReplaceIfZero;
rowProdottiPerIntermediario["CanLastRow"] = false;
rowProdottiPerIntermediario["IsTotal"] = true;
ds.Tables["prodottoPerIntermediario"].Rows.Add(rowProdottiPerIntermediario);
bIntestazioneIntermediario = false;
#endregion
}
// I prodotti della dtProdotti vengono mergiati sulla dtProdottiPerIntermediario
ds.Tables["prodottoPerIntermediario"].Merge(dtIntermediario);
}
#endregion
#endregion
int counter = 0;
_numeroColonneMacroAsset = ds.Tables["asset"].Rows.Count;
_presenzaColonnaControvaloreProdotto = _numeroColonneMacroAsset <= 5;
var indiceColonnaMacroAsset = _presenzaColonnaControvaloreProdotto ?3 : 2;
DataTable dtAsset = ds.Tables["asset"].AsEnumerable().OrderBy(op => op.Field<int>("Ordinamento")).CopyToDataTable();
ds.Tables["prodottoPatrimonioAltro"].Columns.Add(new DataColumn("Colonna1", typeof(string))); //Descrizione
if (_presenzaColonnaControvaloreProdotto)
ds.Tables["prodottoPatrimonioAltro"].Columns.Add(new DataColumn("Colonna2", typeof(string))); //ControvaloreProdotto
for (int i = 0; i <= dtAsset.Rows.Count - 1; i++) {
ds.Tables["prodottoPatrimonioAltro"].Columns.Add(new DataColumn(string.Format("Colonna{0}", i + indiceColonnaMacroAsset), typeof(string))); //Colonne MacroAsset dinamiche
}
ds.Tables["prodottoPatrimonioAltro"].Columns.Add(new DataColumn("FontBold", typeof(bool)));
ds.Tables["prodottoPatrimonioAltro"].Columns.Add(new DataColumn("BackgroundGray", typeof(bool)));
#region CCN - Dettaglio e totale
if (datiSeiUnico.TRZ_CCN!=0)
{
#region Totale risorse finanziarie
var rowProdottiPatrimonioAltro = ds.Tables["prodottoPatrimonioAltro"].NewRow();
rowProdottiPatrimonioAltro["Colonna1"] = "Totale risorse finanziarie";
if (_presenzaColonnaControvaloreProdotto)
rowProdottiPatrimonioAltro["Colonna2"] = Helper.FormatCurrency(datiSeiUnico.TRZ_SUBTOTALE.ToString());
counter = 0;
for (int i = 0; i <= dtAsset.Rows.Count - 1; i++)
{
var ca = dtAsset.Rows[counter]["CodiceMacroAsset"].ToString();
var controvalore = presenzaContocorrenteInMonterio() ? dataMacroAsset.distribuzione.elencoSlice.FirstOrDefault(o => o.codice == ca).ctvCC
: dataMacroAsset.distribuzione.elencoSlice.FirstOrDefault(o => o.codice == ca).ctv;
var perc = presenzaContocorrenteInMonterio() ? dataMacroAsset.distribuzione.elencoSlice.FirstOrDefault(o => o.codice == ca).pesoCC * 100
: dataMacroAsset.distribuzione.elencoSlice.FirstOrDefault(o => o.codice == ca).peso*100;
rowProdottiPatrimonioAltro[string.Format("Colonna{0}", i + indiceColonnaMacroAsset)] = Helper.FormatCurrency(isControvalore() ? controvalore.ToString() : perc.ToString());
counter++;
}
rowProdottiPatrimonioAltro["FontBold"] = true;
rowProdottiPatrimonioAltro["BackgroundGray"] = true;
ds.Tables["prodottoPatrimonioAltro"].Rows.Add(rowProdottiPatrimonioAltro);
#endregion
#region CCN
foreach (var item in from o in dataDettaglioProdotti where o.prodotto.contoCorrente == true && o.ctv < 0 orderby o.ctv select o)
{
rowProdottiPatrimonioAltro = ds.Tables["prodottoPatrimonioAltro"].NewRow();
rowProdottiPatrimonioAltro["Colonna1"] = item.prodotto.nomeProdotto;
if (_presenzaColonnaControvaloreProdotto)
rowProdottiPatrimonioAltro["Colonna2"] = Helper.FormatCurrency(item.ctv.ToString());
for (int i = 0; i <= dtAsset.Rows.Count - 1; i++)
{
rowProdottiPatrimonioAltro[string.Format("Colonna{0}", i + indiceColonnaMacroAsset)] = labelProdottiNonRappresentabili;
}
rowProdottiPatrimonioAltro["FontBold"] = false;
rowProdottiPatrimonioAltro["BackgroundGray"] = false;
ds.Tables["prodottoPatrimonioAltro"].Rows.Add(rowProdottiPatrimonioAltro);
}
#endregion
}
#endregion
#region Totale Patrimonio Terzi
var rowProdottiPatrimonioAltroPC = ds.Tables["prodottoPatrimonioAltro"].NewRow();
rowProdottiPatrimonioAltroPC["Colonna1"] = "Patrimonio altri Istituti";
if (_presenzaColonnaControvaloreProdotto)
rowProdottiPatrimonioAltroPC["Colonna2"] = Helper.FormatCurrency(datiSeiUnico.TRZ_TOTALE.ToString());
counter = 0;
for (int i = 0; i <= dtAsset.Rows.Count - 1; i++)
{
var ca = dtAsset.Rows[counter]["CodiceMacroAsset"].ToString();
var controvalore = presenzaContocorrenteInMonterio() ? dataMacroAsset.distribuzione.elencoSlice.FirstOrDefault(o => o.codice == ca).ctvCC
: dataMacroAsset.distribuzione.elencoSlice.FirstOrDefault(o => o.codice == ca).ctv;
var perc = presenzaContocorrenteInMonterio() ? dataMacroAsset.distribuzione.elencoSlice.FirstOrDefault(o => o.codice == ca).pesoCC * 100
: dataMacroAsset.distribuzione.elencoSlice.FirstOrDefault(o => o.codice == ca).peso * 100;
if (!ccNegPresent)
rowProdottiPatrimonioAltroPC[string.Format("Colonna{0}", i + indiceColonnaMacroAsset)] = Helper.FormatCurrency(isControvalore() ? controvalore.ToString() : perc.ToString());
else
rowProdottiPatrimonioAltroPC[string.Format("Colonna{0}", i + indiceColonnaMacroAsset)] = "";
counter++;
}
rowProdottiPatrimonioAltroPC["FontBold"] = true;
rowProdottiPatrimonioAltroPC["BackgroundGray"] = true;
ds.Tables["prodottoPatrimonioAltro"].Rows.Add(rowProdottiPatrimonioAltroPC);
#endregion
return ds;
}
public virtual bool presenzaGraficoBarre(){return GetOption<Opzione4_1>().Valore;}
public virtual bool presenzaTabella(){return GetOption<Opzione4_3>().Valore;}
public virtual bool isControvalore() { return !GetOption<Opzione3>().Valore; }
public virtual bool presenzaContocorrenteInMonterio() { return GetOption<Opzione4_2>().Valore; }
public virtual string getTesto1() {
return!isControvalore() ?
Helper.ReplaceVariables(GetText().Rows[0]["testo1"].ToString(), EnvironmentFacade.ReportEnvironment) :
Helper.ReplaceVariables(GetText().Rows[0]["testo2"].ToString(), EnvironmentFacade.ReportEnvironment);
}
public virtual string getTesto2()
{
return !isControvalore() ?
Helper.ReplaceVariables(GetText().Rows[0]["testo3"].ToString(), EnvironmentFacade.ReportEnvironment) :
Helper.ReplaceVariables(GetText().Rows[0]["testo4"].ToString(), EnvironmentFacade.ReportEnvironment);
}
public virtual string GetNote1()
{
string nota = "";
string token = "";
var macroAssetClass = datiSeiUnico.patrimonioUnit().patrimonioTerzi.macroAssetClass;
if (datiSeiUnico.TRZ_CCN != 0)
{
nota += datiSeiUnico.FormatDecimal("Il controvalore esclude il saldo negativo dei conti correnti ({0} €).", datiSeiUnico.TRZ_CCN);
token = " ";
}
decimal GC = (presenzaContocorrenteInMonterio() ? macroAssetClass.distribuzione.coverageCC : macroAssetClass.distribuzione.coverage) * 100;
decimal CC_TERZI = presenzaContocorrenteInMonterio() ? 0 : datiSeiUnico.TRZ_CC;
decimal PNR_TERZI = macroAssetClass.distribuzione.totaleNonRappr;
if (GC < 100)
{
nota += token + datiSeiUnico.FormatDecimal("Grado di copertura (%) della rappresentazione grafica per macro asset class pari a {0}", GC);
token = ": ";
if (PNR_TERZI != 0 || CC_TERZI != 0)
{
nota += token + "non sono considerati";
token = " ";
if (PNR_TERZI != 0 || CC_TERZI != 0)
{
if (PNR_TERZI != 0)
{
nota += token + datiSeiUnico.FormatDecimal("i prodotti non rappresentabili ({0} €)", PNR_TERZI);
token = ", ";
}
if (CC_TERZI != 0)
{
nota += token + datiSeiUnico.FormatDecimal("i conti correnti ({0} €)", CC_TERZI);
token = ", ";
}
token = ", ";
}
}
nota += ".";
token = " ";
}
nota = !nota.Equals("") ? "(*) " + nota : nota;
return datiSeiUnico.FormatBanca(nota);
}
}
}