1366 lines
76 KiB
C#
1366 lines
76 KiB
C#
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;
|
|
using Consulenza.ReportWriter.Business.CUSTOM_PDF.ConsulenzaUnica;
|
|
using Consulenza.DataServices.fideuram.data.service;
|
|
|
|
namespace Consulenza.ReportWriter.Manager.Section.Unica
|
|
{
|
|
public class S61 : Entity.Section
|
|
{
|
|
/// <summary>
|
|
///S61.PropostaRappresentazioneValute idSezione = 104
|
|
/// </summary>
|
|
|
|
public S61(EnvironmentFacade environmentFacade, int idSection)
|
|
: base(environmentFacade, idSection)
|
|
{
|
|
try
|
|
{
|
|
if (!datiSeiUnico.isVincolo("prodottiCasa_rappespvalPro"))
|
|
Draw();
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
SectionLogger.Write("S61", ex.Message, SectionLoggerMessageLevel.E, EnvironmentFacade.ReportEnvironment);
|
|
}
|
|
}
|
|
|
|
protected override sealed void Draw()
|
|
{
|
|
var dati = GetDataSet();
|
|
bool isAdeguata = datiSeiUnico.flagAdeguatezzaPro();
|
|
string signValue = "(%)";
|
|
|
|
AddElement(new PagePDF(PagePDF.PagePDFType.Generic));
|
|
|
|
var intestazione = new SectionHeadingPDF(
|
|
(isAdeguata ? "Proposta" : "Operazioni richieste") + ": rappresentazione per valute",
|
|
|
|
EnvironmentFacade.RendererFacade.XLeftLimit,
|
|
EnvironmentFacade.RendererFacade.YUpperLimit,
|
|
EnvironmentFacade.ReportEnvironment.FontFamily);
|
|
|
|
AddElement(intestazione.ToElement());
|
|
|
|
|
|
#region fgrafico valute
|
|
if (TabellaSintesi() && dati.Tables["valute"].Rows.Count > 0)
|
|
{
|
|
|
|
if (getTesto1().Length > 0)
|
|
{
|
|
AddElement(new SpacePDF(20));
|
|
AddElement(new FormattedTextAreaPDF(getTesto1(), EnvironmentFacade.RendererFacade.XLeftLimit) { FontSize = 7, TextHorizontalAlign = ceTe.DynamicPDF.TextAlign.Justify });
|
|
AddElement(new SpacePDF(20));
|
|
}
|
|
|
|
FormattedTextAreaPDF captionAttuale = new FormattedTextAreaPDF("Controvalore attuale (€)", EnvironmentFacade.RendererFacade.XLeftLimit, 130) { FontSize = 7, BackGroundMarginLeft = 5, BackGroundColor = ColorPDF.Standard_Grigio_SfondoColonnaTabella, FontColor = ColorPDF.Nero, FontBold = true, AutoIncrementYWritable = false };
|
|
AddElement(captionAttuale);
|
|
FormattedTextAreaPDF ctvAttuale = new FormattedTextAreaPDF(Helper.FormatCurrency(dati.Tables["labelControvalore"].Rows[0]["ctvAttuale"].ToString()), EnvironmentFacade.RendererFacade.XLeftLimit + 150) { FontSize = 7, BackGroundColor = ColorPDF.Bianco, AutoIncrementYWritable = false };
|
|
AddElement(ctvAttuale);
|
|
FormattedTextAreaPDF captionProposto = new FormattedTextAreaPDF("Controvalore " + (isAdeguata ? "proposto (€)" : "prospettico (€)"), EnvironmentFacade.RendererFacade.XLeftLimit + 280, 140) { FontSize = 7, BackGroundMarginLeft = 5, BackGroundColor = ColorPDF.Standard_Grigio_SfondoColonnaTabella, FontColor = ColorPDF.Nero, FontBold = true, AutoIncrementYWritable = false };
|
|
AddElement(captionProposto);
|
|
FormattedTextAreaPDF ctvProposto = new FormattedTextAreaPDF(Helper.FormatCurrency(dati.Tables["labelControvalore"].Rows[0]["ctvProposto"].ToString()), EnvironmentFacade.RendererFacade.XLeftLimit + 440) { FontSize = 7, BackGroundColor = ColorPDF.Bianco, AutoIncrementYWritable = true };
|
|
AddElement(ctvProposto);
|
|
|
|
AddElement(new SpacePDF(20));
|
|
|
|
|
|
|
|
AddElement(new FormattedTextAreaPDF("Valuta", EnvironmentFacade.RendererFacade.XLeftLimit, 130) { BackGroundColor = ColorPDF.Standard_Grigio_SfondoColonnaTabella, FontBold = true, FontSize = 7, FontColor = ColorPDF.ConsulenzaUnica_Rosso, AutoIncrementYWritable = false, BackGroundMarginLeft = 5 });
|
|
AddElement(new FormattedTextAreaPDF("Portafoglio attuale " + signValue, EnvironmentFacade.RendererFacade.XLeftLimit + 140, 190) { BackGroundColor = ColorPDF.Standard_Grigio_SfondoColonnaTabella, FontBold = true, FontSize = 7, FontColor = ColorPDF.ConsulenzaUnica_Rosso, AutoIncrementYWritable = false, BackGroundMarginLeft = 5 });
|
|
AddElement(new FormattedTextAreaPDF("Portafoglio " + (isAdeguata ? "proposto " : "prospettico ") + signValue, EnvironmentFacade.RendererFacade.XLeftLimit + 340, 190) { BackGroundColor = ColorPDF.Standard_Grigio_SfondoColonnaTabella, FontBold = true, FontSize = 7, FontColor = ColorPDF.ConsulenzaUnica_Rosso, BackGroundMarginLeft = 5 });
|
|
|
|
AddElement(new SpacePDF(15));
|
|
//tmp for test
|
|
//dati.Tables["valute"].Rows[0]["ValoreAttuale"] = 0;
|
|
|
|
var tabellaValute = new TablePDF(EnvironmentFacade.RendererFacade.XLeftLimit, dati.Tables["valute"])
|
|
{
|
|
Style = Style.ConsulenzaUnica,
|
|
Header = false,
|
|
Footer = false,
|
|
AlternateRow = false,
|
|
RowHeight = 28,
|
|
ShowSeparationLines = false
|
|
|
|
};
|
|
tabellaValute.Columns.Add(new ColumnPDF("img", 15, HorizontalAlignmentType.Destra, false, false, 7, ColumnType.Immagine, "", "") { PaddingLeft = 15, ScaleColumnTypeImage = 0.5F, FontSize = 7 });
|
|
tabellaValute.Columns.Add(new ColumnPDF("descrizione", 130, HorizontalAlignmentType.Sinistra, false, false, 7, ColumnType.Testo, "Valuta", "") { HeaderFontSize = 7, PaddingLeft = 25, DeltaYContent = -7, FontSize = 7 });
|
|
tabellaValute.Columns.Add(new ColumnPDF("portafoglioattuale", 180, HorizontalAlignmentType.Nonimpostato, false, false, 7, ColumnType.Objectpdf, "ValoreAttuale", "") { HeaderFontSize = 7, DeltaYContent = 2 });
|
|
tabellaValute.Columns.Add(new ColumnPDF("portafoglioproposto", 180, HorizontalAlignmentType.Nonimpostato, false, false, 7, ColumnType.Objectpdf, "ValoreProposto", string.Empty) { PaddingLeft = 20, HeaderFontSize = 7, DeltaYContent = 2 });
|
|
|
|
int i = 0;
|
|
var list = new List<double>();
|
|
list.Add(Convert.ToDouble(dati.Tables["valute"].AsEnumerable().Max(x => x["ValoreAttuale"])));
|
|
list.Add(Convert.ToDouble(dati.Tables["valute"].AsEnumerable().Max(x => x["ValoreProposto"])));
|
|
var max = (float)Helper.Round(list.Max());
|
|
|
|
float larghezzaBarra = 0;
|
|
float larghezzaSpazioTestoPercentuale = 0;
|
|
float larghezzaMinimaSpazioTestoPercentuale = 35;
|
|
float deltaXBarra = 0;
|
|
var width = 0;
|
|
float additionalSpaceBetwenBarsAndLabels = 4;
|
|
|
|
#region barra colonna Portafoglioattuale
|
|
float minValueAttuale = (float)Convert.ToDecimal(dati.Tables["valute"].Rows.Cast<DataRow>().Min(x => x["ValoreAttuale"]));
|
|
float maxValueAttuale = (float)Convert.ToDecimal(dati.Tables["valute"].Rows.Cast<DataRow>().Max(x => x["ValoreAttuale"]));
|
|
int minValueWidthAttuale = Helper.GetNumericStringWidth(Helper.FormatDecimal(minValueAttuale.ToString(), 2));
|
|
if (minValueAttuale >= 0)
|
|
{
|
|
minValueWidthAttuale = 0;
|
|
}
|
|
int maxValueWidthAttuale = Helper.GetNumericStringWidth(Helper.FormatDecimal(maxValueAttuale.ToString(), 2));
|
|
float rangeAttuale = (maxValueAttuale - minValueAttuale);
|
|
float xOffsetAttuale = 0;
|
|
float widthAttuale = tabellaValute.Columns[2].Width - 15;
|
|
if (minValueAttuale < 0)
|
|
{
|
|
float minBarWidthAttuale = Helper.GetWidthProportional(Math.Abs(minValueAttuale), rangeAttuale, widthAttuale - minValueWidthAttuale - maxValueWidthAttuale);
|
|
xOffsetAttuale += minValueWidthAttuale + minBarWidthAttuale;
|
|
}
|
|
#endregion
|
|
|
|
#region barra colonna Portafoglioproposto
|
|
float minValueProposto = (float)Convert.ToDecimal(dati.Tables["valute"].Rows.Cast<DataRow>().Min(x => x["ValoreProposto"]));
|
|
float maxValueProposto = (float)Convert.ToDecimal(dati.Tables["valute"].Rows.Cast<DataRow>().Max(x => x["ValoreProposto"]));
|
|
int minValueWidthProposto = Helper.GetNumericStringWidth(Helper.FormatDecimal(minValueProposto.ToString(), 2));
|
|
if (minValueProposto >= 0)
|
|
{
|
|
minValueWidthProposto = 0;
|
|
}
|
|
int maxValueWidthProposto = Helper.GetNumericStringWidth(Helper.FormatDecimal(maxValueProposto.ToString(), 2));
|
|
float rangeProposto = (maxValueProposto - minValueProposto);
|
|
float xOffsetProposto = 0;
|
|
float widthProposto = tabellaValute.Columns[3].Width - 15;
|
|
if (minValueProposto < 0)
|
|
{
|
|
float minBarWidthProposto = Helper.GetWidthProportional(Math.Abs(minValueProposto), rangeProposto, widthProposto - minValueWidthProposto - maxValueWidthProposto);
|
|
xOffsetProposto += minValueWidthProposto + minBarWidthProposto;
|
|
}
|
|
#endregion
|
|
|
|
|
|
|
|
foreach (DataRow row in dati.Tables["valute"].Rows)
|
|
{
|
|
tabellaValute.Cells[0, i].Value = string.Format("Flags\\{0}.png", row["Valuta"].ToString());
|
|
tabellaValute.Cells[0, i].HorizontalAlignment = HorizontalAlignmentType.Destra;
|
|
|
|
#region barra colonna Portafoglioattuale
|
|
var coloreAttuale = new ColorPDF(255, 255, 255);
|
|
var ValoreAttuale = "";
|
|
float currentValue = (float)Convert.ToDecimal(row["ValoreAttuale"]);
|
|
|
|
if (row["ShowValoreAttuale"].Equals("S") && currentValue != 0)
|
|
{
|
|
coloreAttuale = new ColorPDF(Convert.ToInt32(row["Red"]), Convert.ToInt32(row["Green"]), Convert.ToInt32(row["Blue"]));
|
|
ValoreAttuale = Helper.FormatDecimal(row["ValoreAttuale"].ToString(), 2);
|
|
}
|
|
|
|
float barWidth = Helper.GetWidthProportional(Math.Abs(Convert.ToDouble(row["ValoreAttuale"]) == 0 ? (float)0.01 : (float)Convert.ToDouble(row["ValoreAttuale"])), rangeAttuale, widthAttuale - minValueWidthAttuale - maxValueWidthAttuale);
|
|
int stringWidth = Helper.GetNumericStringWidth(ValoreAttuale);
|
|
|
|
if (currentValue >= 0)
|
|
{
|
|
tabellaValute.Cells[2, i].ValueObjectList = new List<Business.Entity.ObjectPDF>()
|
|
{
|
|
new RectanglePDF(0, 12, barWidth, coloreAttuale)
|
|
{
|
|
DeltaY = 2,
|
|
DeltaX = xOffsetAttuale
|
|
},
|
|
new FormattedTextAreaPDF(ValoreAttuale, 0, stringWidth)
|
|
{
|
|
DeltaY = 2,
|
|
TextHorizontalAlign = ceTe.DynamicPDF.TextAlign.Right,
|
|
DeltaX = xOffsetAttuale + barWidth + additionalSpaceBetwenBarsAndLabels,
|
|
FontSize = 7
|
|
}
|
|
};
|
|
}
|
|
else
|
|
{
|
|
tabellaValute.Cells[2, i].ValueObjectList = new List<Business.Entity.ObjectPDF>()
|
|
{
|
|
new RectanglePDF(0, 12, barWidth, coloreAttuale)
|
|
{
|
|
DeltaY = 2,
|
|
DeltaX = xOffsetAttuale - barWidth - 1
|
|
},
|
|
new FormattedTextAreaPDF(ValoreAttuale, 0, stringWidth)
|
|
{
|
|
DeltaY = 2,
|
|
TextHorizontalAlign = ceTe.DynamicPDF.TextAlign.Right,
|
|
DeltaX = xOffsetAttuale - barWidth - stringWidth - 1 - additionalSpaceBetwenBarsAndLabels,
|
|
FontSize = 7
|
|
}
|
|
};
|
|
}
|
|
#endregion
|
|
|
|
#region barra colonna Portafoglio proposto
|
|
var coloreProposto = new ColorPDF(255, 255, 255);
|
|
var ValoreProposto = "";
|
|
float currentValueProposto = (float)Convert.ToDecimal(row["ValoreProposto"]);
|
|
|
|
if (row["ShowValoreProposto"].Equals("S"))
|
|
{
|
|
coloreProposto = new ColorPDF(Convert.ToInt32(row["Red"]), Convert.ToInt32(row["Green"]), Convert.ToInt32(row["Blue"]));
|
|
ValoreProposto = Helper.FormatDecimal(row["ValoreProposto"].ToString(), 2);
|
|
}
|
|
|
|
float barWidthProposto = Helper.GetWidthProportional(Math.Abs(Convert.ToDouble(row["ValoreProposto"]) == 0 ? (float)0.01 : (float)Convert.ToDouble(row["ValoreProposto"])), rangeProposto, widthProposto - minValueWidthProposto - maxValueWidthProposto);
|
|
int stringWidthProposto = Helper.GetNumericStringWidth(ValoreProposto);
|
|
|
|
if (currentValueProposto >= 0)
|
|
{
|
|
tabellaValute.Cells[3, i].ValueObjectList = new List<Business.Entity.ObjectPDF>()
|
|
{
|
|
new RectanglePDF(0, 12, barWidthProposto, coloreProposto)
|
|
{
|
|
DeltaY = 2,
|
|
DeltaX = xOffsetProposto
|
|
},
|
|
new FormattedTextAreaPDF(ValoreProposto, 0, stringWidthProposto)
|
|
{
|
|
DeltaY = 2,
|
|
TextHorizontalAlign = ceTe.DynamicPDF.TextAlign.Right,
|
|
DeltaX = xOffsetProposto + barWidthProposto + additionalSpaceBetwenBarsAndLabels,
|
|
FontSize = 7
|
|
}
|
|
};
|
|
}
|
|
else
|
|
{
|
|
tabellaValute.Cells[3, i].ValueObjectList = new List<Business.Entity.ObjectPDF>()
|
|
{
|
|
new RectanglePDF(0, 12, barWidthProposto, coloreProposto)
|
|
{
|
|
DeltaY = 2,
|
|
DeltaX = xOffsetProposto - barWidthProposto - 1
|
|
},
|
|
new FormattedTextAreaPDF(ValoreProposto, 0, stringWidthProposto)
|
|
{
|
|
DeltaY = 2,
|
|
TextHorizontalAlign = ceTe.DynamicPDF.TextAlign.Right,
|
|
DeltaX = xOffsetProposto - barWidthProposto - stringWidthProposto - 1 - additionalSpaceBetwenBarsAndLabels,
|
|
FontSize = 7
|
|
}
|
|
};
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//var coloreProposto = new ColorPDF(255, 255, 255);
|
|
//var ValoreProposto = "";
|
|
|
|
//if (row["ShowValoreProposto"].Equals("S"))
|
|
//{
|
|
// coloreProposto = new ColorPDF(Convert.ToInt32(row["Red"]), Convert.ToInt32(row["Green"]), Convert.ToInt32(row["Blue"]));
|
|
// ValoreProposto = Helper.FormatDecimal(row["ValoreProposto"].ToString(), 2);
|
|
//}
|
|
//width = tabellaValute.Columns[3].Width - 50;
|
|
//larghezzaBarra = Helper.GetWidthProportional(Convert.ToDouble(row["ValoreProposto"]) == 0 ? (float)0.01 : (float)Convert.ToDouble(row["ValoreProposto"]), max, tabellaValute.Columns[3].Width);
|
|
//larghezzaSpazioTestoPercentuale = tabellaValute.Columns[3].Width - larghezzaBarra;
|
|
//deltaXBarra = larghezzaBarra;
|
|
//if (Convert.ToDouble(row["ValoreProposto"]) == 0)
|
|
//{
|
|
// tabellaValute.Cells[3, i].ValueObjectList = new List<Business.Entity.ObjectPDF>()
|
|
// {
|
|
// new RectanglePDF(12, 1 , ColorPDF.Bianco){DeltaY = 4},
|
|
// new FormattedTextAreaPDF(Helper.FormatDecimal(row["ValoreProposto"].ToString(), 2), deltaXBarra-10, 35)
|
|
// {
|
|
// DeltaY = 4,
|
|
// TextHorizontalAlign = ceTe.DynamicPDF.TextAlign.Right,
|
|
// DeltaX = deltaXBarra-8,
|
|
// FontSize = 7
|
|
// }
|
|
// };
|
|
//}
|
|
//else
|
|
//{
|
|
// tabellaValute.Cells[3, i].ValueObjectList = new List<Business.Entity.ObjectPDF>()
|
|
// {
|
|
// new RectanglePDF(12, larghezzaBarra , coloreProposto){DeltaY = 2},
|
|
// new FormattedTextAreaPDF(ValoreProposto, deltaXBarra, 35)
|
|
// {
|
|
// DeltaY =2,
|
|
// TextHorizontalAlign = ceTe.DynamicPDF.TextAlign.Left,
|
|
// DeltaX = larghezzaBarra+7,
|
|
// FontSize = 7
|
|
// }
|
|
// };
|
|
//}
|
|
#endregion
|
|
i++;
|
|
}
|
|
AddElement(tabellaValute);
|
|
|
|
string note = "*";
|
|
if (GetNota1().Length > 0)
|
|
{
|
|
tabellaValute.Notes.Add(
|
|
new TableNotePDF(TableNotePDF.TableNotePositionType.PièDiTabella,
|
|
GetNota1(),
|
|
new[] { "" },
|
|
string.Empty,
|
|
TableNotePDF.TableNoteAsteriskPositionType.CorpoTabella)
|
|
{ FontSize = 6, TextHorizontalAlign = ceTe.DynamicPDF.TextAlign.Justify }
|
|
);
|
|
captionAttuale.Text += note;
|
|
note += "*";
|
|
}
|
|
|
|
if (GetNota2().Length > 0)
|
|
{
|
|
// AddElement(new SpacePDF(10));
|
|
tabellaValute.Notes.Add(
|
|
new TableNotePDF(TableNotePDF.TableNotePositionType.PièDiTabella,
|
|
GetNota2(),
|
|
new[] { "" },
|
|
string.Empty,
|
|
TableNotePDF
|
|
.TableNoteAsteriskPositionType.CorpoTabella)
|
|
{ FontSize = 6, TextHorizontalAlign = ceTe.DynamicPDF.TextAlign.Justify }
|
|
);
|
|
captionProposto.Text += note;
|
|
note += "*";
|
|
}
|
|
}
|
|
#endregion
|
|
|
|
|
|
// Fix #4453
|
|
//if (!isPrimeSei() && dati.Tables["prodottiPerArea"].Rows.Count > 0)
|
|
//{
|
|
// AddElement(new PagePDF(PagePDF.PagePDFType.Generic));
|
|
// AddElement(new SpacePDF(20));
|
|
//}
|
|
//else
|
|
AddElement(new SpacePDF(20));
|
|
#region Tabella Prodotti X Area
|
|
if (TabellaDettaglio() && dati.Tables["prodottiPerArea"].Rows.Count > 0)
|
|
{
|
|
if (getTesto2().Length > 0)
|
|
{
|
|
AddElement(new FormattedTextAreaPDF(getTesto2(), EnvironmentFacade.RendererFacade.XLeftLimit) { FontSize = 7, TextHorizontalAlign = ceTe.DynamicPDF.TextAlign.Justify });
|
|
AddElement(new SpacePDF(15));
|
|
}
|
|
#region largezza e visibilità colonne
|
|
|
|
var numeroColonneVisibili = dati.Tables["valute"].Rows.Count;
|
|
if (numeroColonneVisibili > 7)
|
|
numeroColonneVisibili = 7;
|
|
|
|
const int larghezzaColonnaImmagine = 15;
|
|
const int larghezzaColonnaControvalore = 70;
|
|
const int larghezzaColonnaSingolaValuta = 45;
|
|
|
|
var larghezzaColonnaDescrizione = 520 - (larghezzaColonnaImmagine + larghezzaColonnaControvalore) - (larghezzaColonnaSingolaValuta * numeroColonneVisibili);
|
|
|
|
#endregion
|
|
|
|
//DataView dtord = new DataView(dati.Tables["prodottiPerArea"]) { Sort = "OrdinamentoAreaBisogno, ControvaloreAttuale DESC" };
|
|
//var dd = dtord.ToTable();
|
|
|
|
var tabellaProdottiPerArea = new TablePDF(EnvironmentFacade.RendererFacade.XLeftLimit, dati.Tables["prodottiPerArea"])
|
|
{
|
|
Style = Style.ConsulenzaUnica,
|
|
Header = true,
|
|
Footer = true,
|
|
ShowSeparationLines = true,
|
|
AlternateRow = false,
|
|
HeaderHeight = 30,
|
|
PageBreak = true,
|
|
HeaderMargin = 2,
|
|
RowHeight = 25,
|
|
WhiteSpacesHorizontalSeparator = true
|
|
|
|
};
|
|
|
|
#region Columns e FooterColumns
|
|
|
|
// Modifica per Saving Map
|
|
tabellaProdottiPerArea.Columns.Add(new ColumnPDF("SavingMap", 10, HorizontalAlignmentType.Sinistra, false, false, 6, ColumnType.Immagine, "SavingMap", string.Empty) { DeltaYContent = 11, ScaleColumnTypeImage = 0.50F, HeaderBackgroundColor = ColorPDF.Bianco });
|
|
// Fine Modifica
|
|
|
|
tabellaProdottiPerArea.Columns.Add(new ColumnPDF("Immagine", larghezzaColonnaImmagine + larghezzaColonnaDescrizione - 10, HorizontalAlignmentType.Sinistra, false, false, 6, ColumnType.Objectpdf, string.Empty, string.Empty) { FontSize = 6, HeaderFontSize = 7, DeltaYContent = 4, PaddingLeft = 2, HeaderBackgroundColor = ColorPDF.Bianco, HeaderVerticalAlignment = VerticalAlignmentType.Centrato });
|
|
|
|
tabellaProdottiPerArea.Columns.Add(new ColumnPDF("ControvaloreProposto", larghezzaColonnaControvalore, HorizontalAlignmentType.Sinistra, false, true, 6, ColumnType.Decimale, "ControvaloreProposto", "Controvalore<br>" + (isAdeguata ? "proposto " : "prospettico ") + "(€)") { FontSize = 6, HeaderFontSize = 7, HeaderFontColor = ColorPDF.Nero, HeaderPaddingLeft = 4, PaddingRight = 4, HeaderBackgroundColor = ColorPDF.Bianco });
|
|
|
|
|
|
DataTable dt = new DataTable();
|
|
dt = dati.Tables["prodotti"].Clone();
|
|
//dt.Columns.Remove("FontBold");
|
|
//dt.Columns.Remove("ReplaceIfZero");
|
|
dt.Columns.Remove("CanLastRow");
|
|
dt.Columns.Remove("IsTotal");
|
|
dt.Columns.Remove("IsSubTotal");
|
|
DataColumnCollection dcc = dt.Columns;
|
|
for (int c = 0; c < numeroColonneVisibili; c++)
|
|
{
|
|
string valuta = "";
|
|
|
|
valuta = dcc[c + 9].ColumnName;
|
|
tabellaProdottiPerArea.Columns.Add(new ColumnPDF(valuta, larghezzaColonnaSingolaValuta, HorizontalAlignmentType.Destra, false, true, 6, ColumnType.Testo, valuta, string.Format("{0} (%)", valuta))
|
|
{
|
|
HeaderBackgroundColor = ColorPDF.Bianco,
|
|
HeaderFontColor = ColorPDF.Nero,
|
|
HeaderPaddingRight = 5,
|
|
BackgroundColor = ColorPDF.Bianco,
|
|
PaddingRight = 5,
|
|
HeaderFontSize = 7,
|
|
FontSize = 6,
|
|
HeaderVerticalAlignment = VerticalAlignmentType.Basso,
|
|
HeaderGroupWidth = larghezzaColonnaSingolaValuta,
|
|
HeaderGroupPathImage = string.Format("Flags\\{0}.png", valuta),
|
|
HeaderGroupScaleImage = 0.4F,
|
|
HeaderGroupTextDeltaX = 10,
|
|
HeaderGroupTextDeltaY = -10,
|
|
HeaderGroupBorderLine = false
|
|
});
|
|
|
|
}
|
|
|
|
int o = 0;
|
|
foreach (DataRow rw in dati.Tables["prodottiPerArea"].Rows)
|
|
{
|
|
bool isTotal = Convert.ToBoolean(rw["IsTotal"]);
|
|
bool isSubTotal = Convert.ToBoolean(rw["IsSubTotal"]);
|
|
bool fontBold = Convert.ToBoolean(rw["FontBold"]);
|
|
if (isTotal || isSubTotal || fontBold)
|
|
{
|
|
|
|
|
|
for (int c = 0; c < tabellaProdottiPerArea.Columns.Count; c++)
|
|
{
|
|
tabellaProdottiPerArea.Cells[c, o].BackgroundColor = ColorPDF.Standard_Grigio_SfondoColonnaTabella;
|
|
tabellaProdottiPerArea.Cells[c, o].FontBold = true;
|
|
tabellaProdottiPerArea.Cells[c, o].FontColor = ColorPDF.Nero;
|
|
|
|
}
|
|
|
|
if (isTotal)
|
|
{
|
|
// Simboli dell'area di bisogno
|
|
var listaOggetti = new List<ObjectPDF>
|
|
{
|
|
new RectanglePDF(8, 8, ColorPDF.GetBy_AreaBisogno(rw["CodiceAreaBisogno"].ToString())){DeltaY = 4},
|
|
new FormattedTextAreaPDF
|
|
{
|
|
Text = new AreaBisogno(rw["CodiceAreaBisogno"].ToString()).Abbreviazione,
|
|
FontBold = true,
|
|
FontColor = ColorPDF.Bianco,
|
|
DeltaX = 2,
|
|
FontSize=7,
|
|
DeltaY = 2
|
|
},
|
|
new FormattedTextAreaPDF
|
|
{
|
|
Text = new AreaBisogno(rw["CodiceAreaBisogno"].ToString()).Nome,
|
|
FontBold = true,
|
|
FontColor = ColorPDF.Nero,
|
|
DeltaX = 12F,
|
|
FontSize=6,
|
|
DeltaY = 2
|
|
}
|
|
};
|
|
tabellaProdottiPerArea.Cells[1, o].ValueObjectList.AddRange(listaOggetti);
|
|
}
|
|
if (isSubTotal || fontBold)
|
|
{
|
|
var stringa = rw["DescrizioneProdotto"].ToString();
|
|
tabellaProdottiPerArea.Cells[0, o].ValueObject = new FormattedTextAreaPDF
|
|
{
|
|
Text = stringa,
|
|
FontBold = true,
|
|
FontColor = ColorPDF.Nero,
|
|
DeltaX = 2F,
|
|
FontSize = 6,
|
|
Width = larghezzaColonnaImmagine + larghezzaColonnaDescrizione + 5,
|
|
DeltaY = 2
|
|
};
|
|
}
|
|
|
|
}
|
|
else
|
|
{
|
|
var stringa = rw["DescrizioneProdotto"].ToString();
|
|
tabellaProdottiPerArea.Cells[1, o].ValueObject = new FormattedTextAreaPDF
|
|
{
|
|
Text = stringa,
|
|
FontBold = false,
|
|
FontColor = ColorPDF.Nero,
|
|
DeltaX = 2F,
|
|
FontSize = 6,
|
|
DeltaY = stringa.Contains("Patrimonio") ? 1.5F : stringa.Length < 42 ? 1.8F : 1.3F,//3,
|
|
Width = larghezzaColonnaImmagine + larghezzaColonnaDescrizione + 5
|
|
};
|
|
}
|
|
|
|
o++;
|
|
}
|
|
|
|
int a = 0;
|
|
foreach (var item in dati.Tables["prodottiPerArea"].Rows)
|
|
{
|
|
for (int b = 1; b < tabellaProdottiPerArea.Columns.Count; b++)
|
|
{
|
|
tabellaProdottiPerArea.Cells[b, a].HorizontalAlignment = HorizontalAlignmentType.Destra;
|
|
}
|
|
a++;
|
|
}
|
|
#endregion
|
|
|
|
AddElement(tabellaProdottiPerArea);
|
|
}
|
|
#endregion
|
|
|
|
}
|
|
|
|
protected sealed override DataTable GetDataTable()
|
|
{
|
|
return null;
|
|
}
|
|
|
|
|
|
protected sealed override DataSet GetDataSet()
|
|
{
|
|
#region Dataset
|
|
var ds = new DataSet();
|
|
|
|
ds.Tables.Add(new DataTable("labelControvalore"));
|
|
ds.Tables.Add(new DataTable("valute"));
|
|
|
|
ds.Tables.Add(new DataTable("prodotti"));
|
|
|
|
ds.Tables["labelControvalore"].Columns.Add("ctvAttuale", typeof(decimal));
|
|
ds.Tables["labelControvalore"].Columns.Add("ctvProposto", typeof(decimal));
|
|
|
|
ds.Tables["valute"].Columns.Add(new DataColumn("Valuta", typeof(string)));
|
|
ds.Tables["valute"].Columns.Add(new DataColumn("Red", typeof(int)));
|
|
ds.Tables["valute"].Columns.Add(new DataColumn("Green", typeof(int)));
|
|
ds.Tables["valute"].Columns.Add(new DataColumn("Blue", typeof(int)));
|
|
ds.Tables["valute"].Columns.Add(new DataColumn("ValoreAttuale", typeof(decimal)));
|
|
ds.Tables["valute"].Columns.Add(new DataColumn("ValoreProposto", typeof(decimal)));
|
|
ds.Tables["valute"].Columns.Add(new DataColumn("ShowValoreAttuale", typeof(string)));
|
|
ds.Tables["valute"].Columns.Add(new DataColumn("ShowValoreProposto", typeof(string)));
|
|
|
|
|
|
ds.Tables["prodotti"].Columns.Add(new DataColumn("CodiceAreaBisogno", typeof(string)));
|
|
ds.Tables["prodotti"].Columns.Add(new DataColumn("DescrizioneAreaBisogno", typeof(string)));
|
|
ds.Tables["prodotti"].Columns.Add(new DataColumn("OrdinamentoAreaBisogno", typeof(int)));
|
|
ds.Tables["prodotti"].Columns.Add(new DataColumn("DescrizioneProgetto", typeof(string)));
|
|
|
|
ds.Tables["prodotti"].Columns.Add(new DataColumn("SavingMap", typeof(string)));
|
|
|
|
ds.Tables["prodotti"].Columns.Add(new DataColumn("DescrizioneProdotto", typeof(string)));
|
|
ds.Tables["prodotti"].Columns.Add(new DataColumn("ControvaloreProposto", typeof(decimal)));
|
|
ds.Tables["prodotti"].Columns.Add(new DataColumn("FontBold", typeof(bool)));
|
|
ds.Tables["prodotti"].Columns.Add(new DataColumn("ReplaceIfZero", typeof(string)));
|
|
ds.Tables["prodotti"].Columns.Add(new DataColumn("CanLastRow", typeof(bool)));
|
|
ds.Tables["prodotti"].Columns.Add(new DataColumn("IsTotal", typeof(bool)));
|
|
ds.Tables["prodotti"].Columns.Add(new DataColumn("IsSubTotal", typeof(bool)));
|
|
|
|
#endregion
|
|
|
|
int ColumnsProdotti = 10;
|
|
|
|
const string stringReplaceIfZero = " ";
|
|
|
|
|
|
|
|
|
|
var dataDettaglioProdotti = datiSeiUnico.propostaUnit().dettaglioProdotti.dettaglioProdotti;
|
|
var displayInfos = datiSeiUnico.displayInfos();
|
|
var dataPiramideModello = datiSeiUnico.piramideModelloUnit().piramideModello.areaModello;
|
|
var valutePropostaTutte = datiSeiUnico.propostaUnit().esposizioneValutariaTutte;
|
|
var valutePropostaPrincipali = datiSeiUnico.propostaUnit().esposizioneValutaria;
|
|
var valueAttualeTutte = datiSeiUnico.patrimonioUnit().patrimonioCasa.esposizioneValutariaTutte;
|
|
var totaliPatrimonio = valutePropostaPrincipali.totaliPatrimonio;
|
|
#region TabellaSintesi
|
|
//if (TabellaSintesi())
|
|
{
|
|
ds.Tables["labelControvalore"].Rows.Add(
|
|
Helper.FormatCurrency(datiSeiUnico.ATTUTALE_TOTALEPOSITIVO.ToString()),
|
|
Helper.FormatCurrency(datiSeiUnico.PROPOSTO_TOTALEPOSITIVO.ToString().ToString())
|
|
);
|
|
|
|
ColorPDF coloreEur = new ColorPDF(displayInfos.espoValutariaDisplayInfos.First(o => o.key == "EUR").value.fill);
|
|
ColorPDF coloreNoEur = new ColorPDF(displayInfos.espoValutariaDisplayInfos.First(o => o.key == "NOEUR").value.fill);
|
|
|
|
|
|
var items = isPrimeSei() ?
|
|
(from slice in valutePropostaPrincipali.distribuzione.elencoSlice
|
|
where slice.sliceRappresentabile
|
|
select new
|
|
{
|
|
codice = slice.codice,
|
|
Red = slice.codice.Equals("EUR") ? coloreEur.Red : coloreNoEur.Red,
|
|
Green = slice.codice.Equals("EUR") ? coloreEur.Green : coloreNoEur.Green,
|
|
Blue = slice.codice.Equals("EUR") ? coloreEur.Blue : coloreNoEur.Blue,
|
|
ValoreAttuale = (from o in valueAttualeTutte.distribuzione.elencoSlice where o.codice == slice.codice && o.sliceRappresentabile select o).LastOrDefault(),
|
|
ValoreProposta = slice,
|
|
}).Select(o => new
|
|
{
|
|
codice = o.codice,
|
|
Red = o.Red,
|
|
Green = o.Green,
|
|
Blue = o.Blue,
|
|
ValoreAttuale = o.ValoreAttuale != null ?
|
|
presenzaContocorrenteInMonterio() ?
|
|
o.ValoreAttuale.pesoCC * 100 :
|
|
o.ValoreAttuale.peso * 100 :
|
|
0m,
|
|
ValoreProposta = o.ValoreProposta != null ?
|
|
presenzaContocorrenteInMonterio() ?
|
|
o.ValoreProposta.pesoCC * 100 :
|
|
o.ValoreProposta.peso * 100 :
|
|
0m,
|
|
ShowValoreAttuale = o.ValoreAttuale != null ? "S" : "N",
|
|
ShowValoreProposta = o.ValoreProposta != null ? "S" : "N"
|
|
}).OrderByDescending(o => Math.Abs(o.ValoreProposta)).ThenByDescending(n => Math.Abs(n.ValoreAttuale))
|
|
: (from codice in
|
|
(from o in valutePropostaTutte.distribuzione.elencoSlice where o.sliceRappresentabile select o.codice)
|
|
.Union(from o in valueAttualeTutte.distribuzione.elencoSlice where o.sliceRappresentabile select o.codice)
|
|
select new
|
|
{
|
|
codice = codice,
|
|
Red = codice.Equals("EUR") ? coloreEur.Red : coloreNoEur.Red,
|
|
Green = codice.Equals("EUR") ? coloreEur.Green : coloreNoEur.Green,
|
|
Blue = codice.Equals("EUR") ? coloreEur.Blue : coloreNoEur.Blue,
|
|
ValoreAttuale = (from o in valueAttualeTutte.distribuzione.elencoSlice where o.codice == codice && o.sliceRappresentabile select o).LastOrDefault(),
|
|
ValoreProposta = (from o in valutePropostaTutte.distribuzione.elencoSlice where o.codice == codice && o.sliceRappresentabile select o).LastOrDefault(),
|
|
}).Select(o => new
|
|
{
|
|
codice = o.codice,
|
|
Red = o.Red,
|
|
Green = o.Green,
|
|
Blue = o.Blue,
|
|
ValoreAttuale = o.ValoreAttuale != null ?
|
|
presenzaContocorrenteInMonterio() ?
|
|
o.ValoreAttuale.pesoCC * 100 :
|
|
o.ValoreAttuale.peso * 100 :
|
|
0m,
|
|
ValoreProposta = o.ValoreProposta != null ?
|
|
presenzaContocorrenteInMonterio() ?
|
|
o.ValoreProposta.pesoCC * 100 :
|
|
o.ValoreProposta.peso * 100 :
|
|
0m,
|
|
ShowValoreAttuale = o.ValoreAttuale != null ? "S" : "N",
|
|
ShowValoreProposta = o.ValoreProposta != null ? "S" : "N"
|
|
}).OrderByDescending(o => Math.Abs(o.ValoreProposta)).ThenByDescending(n => Math.Abs(n.ValoreAttuale));
|
|
|
|
|
|
|
|
int ii = 0;
|
|
foreach (var itemValuta in from o in items where o.codice != "OTHER" select o)
|
|
{
|
|
ds.Tables["valute"].Rows.Add(
|
|
itemValuta.codice,
|
|
itemValuta.Red,
|
|
itemValuta.Green,
|
|
itemValuta.Blue,
|
|
itemValuta.ValoreAttuale,
|
|
itemValuta.ValoreProposta,
|
|
itemValuta.ShowValoreAttuale,
|
|
itemValuta.ShowValoreProposta
|
|
);
|
|
ii++;
|
|
if (ii == 6 && isPrimeSei())
|
|
break;
|
|
}
|
|
if (isPrimeSei())
|
|
{
|
|
var other = (from o in items where o.codice == "OTHER" select o).LastOrDefault();
|
|
if (other != null)
|
|
{
|
|
var valoreAttuale = (from o in valueAttualeTutte.distribuzione.elencoSlice
|
|
where (from p in valutePropostaPrincipali.distribuzione.elencoSlice select p.codice).Contains(o.codice) && o.sliceRappresentabile
|
|
select o)
|
|
.Sum(o => presenzaContocorrenteInMonterio() ?
|
|
o.pesoCC * 100 :
|
|
o.peso * 100
|
|
);
|
|
|
|
ds.Tables["valute"].Rows.Add(
|
|
"Altre",
|
|
other.Red,
|
|
other.Green,
|
|
other.Blue,
|
|
(from o in valueAttualeTutte.distribuzione.elencoSlice
|
|
where !(from p in valutePropostaPrincipali.distribuzione.elencoSlice select p.codice).Contains(o.codice) && o.sliceRappresentabile
|
|
select o)
|
|
.Sum(o => presenzaContocorrenteInMonterio() ?
|
|
o.pesoCC * 100 :
|
|
o.peso * 100),
|
|
other.ValoreProposta,
|
|
(from o in valueAttualeTutte.distribuzione.elencoSlice
|
|
where !(from p in valutePropostaPrincipali.distribuzione.elencoSlice select p.codice).Contains(o.codice) && o.sliceRappresentabile
|
|
select o)
|
|
.Sum(o => presenzaContocorrenteInMonterio() ?
|
|
o.pesoCC * 100 :
|
|
o.peso * 100) != null ? "S" : "N",
|
|
other.ShowValoreProposta
|
|
);
|
|
}
|
|
ii = 0;
|
|
foreach (var slice in from o in items where o.codice != "OTHER" select o)
|
|
{
|
|
ds.Tables["prodotti"].Columns.Add(new DataColumn(slice.codice, typeof(string)));
|
|
ii++;
|
|
if (ii == 6)
|
|
break;
|
|
}
|
|
if (other != null)
|
|
{
|
|
ds.Tables["prodotti"].Columns.Add(new DataColumn("Altre", typeof(string)));
|
|
}
|
|
|
|
|
|
}
|
|
}
|
|
#endregion
|
|
|
|
#region TabellaDettaglio
|
|
if (TabellaDettaglio())
|
|
{
|
|
#region Prodotti (solo dati)
|
|
int j = 0;
|
|
if (!isPrimeSei())
|
|
{
|
|
foreach (var slice in from o in valutePropostaPrincipali.distribuzione.elencoSlice
|
|
where o.codice != "OTHER" && o.sliceRappresentabile
|
|
orderby presenzaContocorrenteInMonterio() ? Math.Abs(o.ctvCC) : Math.Abs(o.ctv) descending
|
|
select o)
|
|
{
|
|
ds.Tables["prodotti"].Columns.Add(new DataColumn(slice.codice, typeof(string)));
|
|
j++;
|
|
if (j == 6)
|
|
break;
|
|
}
|
|
ds.Tables["prodotti"].Columns.Add(new DataColumn("Altre", typeof(string)));
|
|
}
|
|
foreach (var itemValuta in from o in valutePropostaPrincipali.distribuzionePerProdotti.listaProdotti select o)
|
|
{
|
|
|
|
var itemPosizione = dataDettaglioProdotti.FirstOrDefault(o => o.chiaveAggregazione.Equals(itemValuta.chiaveAggregazione));
|
|
var itemPiramideModello = dataPiramideModello.FirstOrDefault(o => o.area.ToLower().Trim().Equals(itemPosizione.area.ToLower().Trim()));
|
|
if (itemPosizione.ctvPro != 0)
|
|
{
|
|
var rowProdotti = ds.Tables["prodotti"].NewRow();
|
|
|
|
rowProdotti["CodiceAreaBisogno"] = itemPosizione.area;
|
|
rowProdotti["OrdinamentoAreaBisogno"] = itemPiramideModello.ordinamento;
|
|
rowProdotti["DescrizioneAreaBisogno"] = itemPosizione.descAreaEstesa;
|
|
rowProdotti["DescrizioneProgetto"] = itemPosizione.nomeProgetto;
|
|
|
|
if (itemPosizione.savingMap)
|
|
//if (itemPosizione.prodotto.nomeProdotto.Substring(0, 2) == "FV")
|
|
rowProdotti["SavingMap"] = "SavingMap.png";
|
|
else
|
|
rowProdotti["SavingMap"] = "";
|
|
|
|
rowProdotti["DescrizioneProdotto"] = itemPosizione.prodotto.nomeProdotto;
|
|
|
|
rowProdotti["ControvaloreProposto"] = Helper.FormatCurrency(itemPosizione.ctvPro.ToString());
|
|
rowProdotti["FontBold"] = false;
|
|
rowProdotti["ReplaceIfZero"] = stringReplaceIfZero;
|
|
rowProdotti["CanLastRow"] = true;
|
|
|
|
rowProdotti["IsTotal"] = false;
|
|
rowProdotti["IsSubTotal"] = false;
|
|
|
|
bool ccNa = itemValuta.tipoProdotto.ToUpper() == "CC" && !presenzaContocorrenteInMonterio();
|
|
if (itemValuta.rappresentabile)
|
|
{
|
|
foreach (rsSliceLight slice in itemValuta.listaSlice.OrderByDescending(s => s.ctv))
|
|
{
|
|
if (ds.Tables["prodotti"].Columns.Contains(slice.descrizione))
|
|
{
|
|
rowProdotti[slice.descrizione] = ccNa ? "n.a." : Helper.FormatDecimal((slice.pesoSuPosizione * 100).ToString(), 2);
|
|
}
|
|
else if (slice.descrizione.Equals("OTHER"))
|
|
{
|
|
rowProdotti["Altre"] = ccNa ? "n.a." : Helper.FormatDecimal((slice.pesoSuPosizione * 100).ToString(), 2);
|
|
}
|
|
}
|
|
}
|
|
else
|
|
{
|
|
|
|
for (int c = ColumnsProdotti; c < ds.Tables["prodotti"].Columns.Count; c++)
|
|
{
|
|
if (ds.Tables["prodotti"].Columns[c].ColumnName != "IsTotal" && ds.Tables["prodotti"].Columns[c].ColumnName != "IsSubTotal")
|
|
rowProdotti[c] = "n.d.";
|
|
}
|
|
|
|
}
|
|
|
|
|
|
ds.Tables["prodotti"].Rows.Add(rowProdotti);
|
|
}
|
|
}
|
|
|
|
|
|
#endregion
|
|
|
|
#region Prodotti raggruppati per area
|
|
|
|
var dtProdottiPerArea = ds.Tables["prodotti"].Clone(); // Clono la struttura
|
|
dtProdottiPerArea.TableName = "prodottiPerArea";
|
|
ds.Tables.Add(dtProdottiPerArea);
|
|
|
|
var viewAree = new DataView(ds.Tables["prodotti"].AsEnumerable().Where(o => o.Field<decimal>("ControvaloreProposto") != 0).CopyToDataTable()) { Sort = "OrdinamentoAreaBisogno" };
|
|
var dtAree = viewAree.ToTable(true, "CodiceAreaBisogno", "DescrizioneAreaBisogno", "OrdinamentoAreaBisogno");
|
|
|
|
//var viewProgetti = new DataView(ds.Tables["prodotti"]);
|
|
//var dtProgetti = viewProgetti.ToTable(true, "DescrizioneProgetto");
|
|
|
|
var area = string.Empty;
|
|
var progetto = string.Empty;
|
|
var chiaveprogetto = "";
|
|
foreach (DataRow rowAreaProgetto in dtAree.Rows)
|
|
{
|
|
area = rowAreaProgetto["CodiceAreaBisogno"].ToString();
|
|
|
|
if (new AreaBisogno(area).Visibile)
|
|
{
|
|
//Progetti
|
|
var viewProgetti = new DataView(ds.Tables["prodotti"].Select("CodiceAreaBisogno='" + area + "'").OrderByDescending(o => o.Field<decimal>("ControvaloreProposto")).CopyToDataTable());
|
|
|
|
var dtProgetti = viewProgetti.ToTable(true, "DescrizioneProgetto");
|
|
var bIntestazioneArea = true; // la riga di intestazione dell'area va stampata una sola volta.
|
|
var bItestazioneProgetto = area == "Inv" || area == "Pre"; // la riga di intestazione del progetto va stampata solo per area Inv e Pre.
|
|
|
|
DataRow rowProdottiPerArea;
|
|
foreach (DataRow itemProgetto in dtProgetti.Rows)
|
|
{
|
|
progetto = itemProgetto["DescrizioneProgetto"].ToString();
|
|
// Subset di prodotti filtrati per Area/Progetto
|
|
var totalecontrovaloreArea = datiSeiUnico.propostaUnit().esposizioneValutaria.distribuzioneAree.FirstOrDefault(o => o.area == area && o.chiaveProgetto == null).distribuzione.totaleCtv;
|
|
//ds.Tables["prodotti"].Select("CodiceAreaBisogno='" + area + "'").CopyToDataTable().AsEnumerable().Sum(p => p.Field<decimal>("ControvaloreProposto"));
|
|
var dtArea = ds.Tables["prodotti"].Select("CodiceAreaBisogno='" + area + "' AND " + string.Format("DescrizioneProgetto ='{0}'", itemProgetto["DescrizioneProgetto"].ToString().Replace("'", "''"))).OrderByDescending(o => o.Field<decimal>("ControvaloreProposto")).CopyToDataTable();
|
|
var dtAreaProgetto = ds.Tables["prodotti"].Select("CodiceAreaBisogno='" + area + "' AND " + string.Format("DescrizioneProgetto ='{0}'", itemProgetto["DescrizioneProgetto"].ToString().Replace("'", "''"))).CopyToDataTable();
|
|
chiaveprogetto = dataDettaglioProdotti.FirstOrDefault(o => o.nomeProgetto == progetto).codProgetto.ToString();
|
|
if (bIntestazioneArea)
|
|
{
|
|
#region riga con background grigio di intestazione per ogni area
|
|
|
|
rowProdottiPerArea = ds.Tables["prodottiPerArea"].NewRow();
|
|
rowProdottiPerArea["CodiceAreaBisogno"] = rowAreaProgetto["CodiceAreaBisogno"];
|
|
rowProdottiPerArea["DescrizioneProdotto"] = rowAreaProgetto["DescrizioneAreaBisogno"];
|
|
rowProdottiPerArea["ControvaloreProposto"] = totalecontrovaloreArea;
|
|
rowProdottiPerArea["OrdinamentoAreaBisogno"] = rowAreaProgetto["OrdinamentoAreaBisogno"];
|
|
rowProdottiPerArea["FontBold"] = true;
|
|
rowProdottiPerArea["ReplaceIfZero"] = stringReplaceIfZero;
|
|
rowProdottiPerArea["CanLastRow"] = false;
|
|
rowProdottiPerArea["IsTotal"] = true;
|
|
rowProdottiPerArea["IsSubTotal"] = false;
|
|
|
|
var pippo = datiSeiUnico.propostaUnit().esposizioneValutaria.distribuzioneAree.FirstOrDefault(o => o.area.Equals(rowAreaProgetto["CodiceAreaBisogno"]) && o.chiaveProgetto == null);
|
|
foreach (var item in pippo.distribuzione.elencoSlice)
|
|
{
|
|
if (item.sliceRappresentabile)
|
|
{
|
|
if (ds.Tables["prodotti"].Columns.Contains(item.descrizione))
|
|
{
|
|
rowProdottiPerArea[item.descrizione] = Helper.FormatDecimal(((presenzaContocorrenteInMonterio() ? item.pesoCC : item.peso) * 100).ToString(), 2);
|
|
}
|
|
else if (item.descrizione.Equals("OTHER"))
|
|
{
|
|
rowProdottiPerArea["Altre"] = Helper.FormatDecimal(((presenzaContocorrenteInMonterio() ? item.pesoCC : item.peso) * 100).ToString(), 2);
|
|
}
|
|
//var perc = ;
|
|
//rowProdottiPerArea[item.codice] = perc; // dtArea.AsEnumerable().Sum(x => x.Field<decimal>(item.codice));
|
|
//rowProdottiPerArea[item.codice + "String"] = Helper.FormatCurrency(rowProdottiPerArea[item.codice].ToString());
|
|
}
|
|
}
|
|
|
|
|
|
ds.Tables["prodottiPerArea"].Rows.Add(rowProdottiPerArea);
|
|
bIntestazioneArea = false;
|
|
#endregion
|
|
}
|
|
|
|
if (bItestazioneProgetto)
|
|
{
|
|
#region Riga con background grigio di intestazione per ogni Progetto
|
|
var totaleprogetto = datiSeiUnico.propostaUnit().esposizioneValutaria.distribuzioneAree.FirstOrDefault(o => o.area == area && o.chiaveProgetto == chiaveprogetto).distribuzione.totaleCtv;
|
|
rowProdottiPerArea = ds.Tables["prodottiPerArea"].NewRow();
|
|
rowProdottiPerArea["CodiceAreaBisogno"] = rowAreaProgetto["CodiceAreaBisogno"];
|
|
rowProdottiPerArea["DescrizioneProdotto"] = progetto;
|
|
rowProdottiPerArea["OrdinamentoAreaBisogno"] = rowAreaProgetto["OrdinamentoAreaBisogno"];
|
|
rowProdottiPerArea["ControvaloreProposto"] = totaleprogetto;
|
|
var pippopro = datiSeiUnico.propostaUnit().esposizioneValutaria.distribuzioneAree.FirstOrDefault(o => o.area.Equals(rowAreaProgetto["CodiceAreaBisogno"]) && o.chiaveProgetto == chiaveprogetto);
|
|
foreach (var item in pippopro.distribuzione.elencoSlice)
|
|
{
|
|
if (item.sliceRappresentabile)
|
|
{
|
|
if (ds.Tables["prodotti"].Columns.Contains(item.descrizione))
|
|
{
|
|
rowProdottiPerArea[item.descrizione] = Helper.FormatDecimal(((presenzaContocorrenteInMonterio() ? item.pesoCC : item.peso) * 100).ToString(), 2);
|
|
}
|
|
else if (item.descrizione.Equals("OTHER"))
|
|
{
|
|
rowProdottiPerArea["Altre"] = Helper.FormatDecimal(((presenzaContocorrenteInMonterio() ? item.pesoCC : item.peso) * 100).ToString(), 2);
|
|
}
|
|
//var perc = ;
|
|
//rowProdottiPerArea[item.codice] = perc; // dtArea.AsEnumerable().Sum(x => x.Field<decimal>(item.codice));
|
|
//rowProdottiPerArea[item.codice + "String"] = Helper.FormatCurrency(rowProdottiPerArea[item.codice].ToString());
|
|
}
|
|
}
|
|
rowProdottiPerArea["FontBold"] = true;
|
|
rowProdottiPerArea["ReplaceIfZero"] = stringReplaceIfZero;
|
|
rowProdottiPerArea["CanLastRow"] = false;
|
|
rowProdottiPerArea["IsTotal"] = false;
|
|
rowProdottiPerArea["IsSubTotal"] = true;
|
|
ds.Tables["prodottiPerArea"].Rows.Add(rowProdottiPerArea);
|
|
|
|
#endregion
|
|
}
|
|
|
|
// I prodotti della dtProdotti vengono mergiati sulla dtProdottiPerArea
|
|
|
|
ds.Tables["prodottiPerArea"].Merge(dtArea);
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
#region areacc
|
|
decimal OC = datiSeiUnico.PROPOSTO_OC;
|
|
var CCN = from o in dataDettaglioProdotti where o.area.ToUpper().Equals("CC") && o.ctvPro < 0 orderby o.ctvPro descending select o;
|
|
var EF = from o in dataDettaglioProdotti where o.area.ToUpper().Equals("SELF") && o.ctvPro < 0 && o.prodotto.codSottoprodotto.Equals("L191") orderby o.ctvPro descending select o;
|
|
var ET = from o in dataDettaglioProdotti where o.area.ToUpper().Equals("SELF") && o.ctvPro < 0 && o.prodotto.codSottoprodotto.Equals("L192") orderby o.ctvPro descending select o;
|
|
|
|
//AC
|
|
var FO = from o in dataDettaglioProdotti where o.area.ToUpper().Equals("SELF") && o.ctvPro < 0 && o.prodotto.codSottoprodotto.Equals("V301") orderby o.ctvPro descending select o;
|
|
|
|
//AC
|
|
bool totaleRisorse = CCN.Count() > 0 || OC != 0 || EF.Count() > 0 || ET.Count() > 0||FO.Count()>0;
|
|
|
|
if (totaleRisorse)
|
|
{
|
|
#region Totale risorse allocate
|
|
DataRow rowProdottiPerArea = ds.Tables["prodottiPerArea"].NewRow();
|
|
rowProdottiPerArea["CodiceAreaBisogno"] = "";
|
|
rowProdottiPerArea["DescrizioneAreaBisogno"] = "";
|
|
rowProdottiPerArea["OrdinamentoAreaBisogno"] = Int32.MaxValue;
|
|
rowProdottiPerArea["DescrizioneProgetto"] = "";
|
|
rowProdottiPerArea["DescrizioneProdotto"] = "Totale risorse allocate";
|
|
rowProdottiPerArea["ControvaloreProposto"] = totaliPatrimonio.risorseFinanziarie;
|
|
rowProdottiPerArea["FontBold"] = true;
|
|
rowProdottiPerArea["ReplaceIfZero"] = "";
|
|
rowProdottiPerArea["CanLastRow"] = false;
|
|
rowProdottiPerArea["IsTotal"] = false;
|
|
rowProdottiPerArea["IsSubTotal"] = false;
|
|
foreach (DataColumn dr in ds.Tables["prodottiPerArea"].Columns)
|
|
{
|
|
string columnName = !dr.ColumnName.Equals("Altre") ? dr.ColumnName : "OTHER";
|
|
var r = valutePropostaPrincipali.distribuzione.elencoSlice.LastOrDefault(o => o.codice == columnName);
|
|
if (r != null)
|
|
{
|
|
rowProdottiPerArea[dr.ColumnName] = datiSeiUnico.FormatDecimal("{0}", (presenzaContocorrenteInMonterio() ? r.pesoCC : r.peso) * 100);
|
|
}
|
|
};
|
|
ds.Tables["prodottiPerArea"].Rows.Add(rowProdottiPerArea);
|
|
#endregion
|
|
|
|
if (OC != 0)
|
|
{
|
|
#region
|
|
rowProdottiPerArea = ds.Tables["prodottiPerArea"].NewRow();
|
|
rowProdottiPerArea["CodiceAreaBisogno"] = "";
|
|
rowProdottiPerArea["OrdinamentoAreaBisogno"] = Int32.MaxValue;
|
|
rowProdottiPerArea["DescrizioneAreaBisogno"] = "";
|
|
rowProdottiPerArea["DescrizioneProgetto"] = "";
|
|
rowProdottiPerArea["DescrizioneProdotto"] = "Operazioni incorso";
|
|
rowProdottiPerArea["ControvaloreProposto"] = OC;
|
|
rowProdottiPerArea["FontBold"] = false;
|
|
rowProdottiPerArea["ReplaceIfZero"] = stringReplaceIfZero;
|
|
rowProdottiPerArea["CanLastRow"] = true;
|
|
rowProdottiPerArea["IsTotal"] = false;
|
|
rowProdottiPerArea["IsSubTotal"] = false;
|
|
for (int c = ColumnsProdotti; c < ds.Tables["prodotti"].Columns.Count; c++)
|
|
{
|
|
if (ds.Tables["prodotti"].Columns[c].ColumnName != "IsTotal" && ds.Tables["prodotti"].Columns[c].ColumnName != "IsSubTotal")
|
|
rowProdottiPerArea[c] = "n.d.";
|
|
}
|
|
ds.Tables["prodottiPerArea"].Rows.Add(rowProdottiPerArea);
|
|
#endregion
|
|
}
|
|
|
|
#region
|
|
foreach (var item in CCN)
|
|
{
|
|
rowProdottiPerArea = ds.Tables["prodottiPerArea"].NewRow();
|
|
rowProdottiPerArea["CodiceAreaBisogno"] = "";
|
|
rowProdottiPerArea["OrdinamentoAreaBisogno"] = Int32.MaxValue;
|
|
rowProdottiPerArea["DescrizioneAreaBisogno"] = "";
|
|
rowProdottiPerArea["DescrizioneProgetto"] = "";
|
|
rowProdottiPerArea["DescrizioneProdotto"] = item.prodotto.nomeProdotto;
|
|
|
|
rowProdottiPerArea["ControvaloreProposto"] = item.ctvPro;
|
|
rowProdottiPerArea["FontBold"] = false;
|
|
rowProdottiPerArea["ReplaceIfZero"] = stringReplaceIfZero;
|
|
rowProdottiPerArea["CanLastRow"] = true;
|
|
rowProdottiPerArea["IsTotal"] = false;
|
|
rowProdottiPerArea["IsSubTotal"] = false;
|
|
for (int c = ColumnsProdotti; c < ds.Tables["prodotti"].Columns.Count; c++)
|
|
{
|
|
if (ds.Tables["prodotti"].Columns[c].ColumnName != "IsTotal" && ds.Tables["prodotti"].Columns[c].ColumnName != "IsSubTotal")
|
|
rowProdottiPerArea[c] = "n.d.";
|
|
}
|
|
ds.Tables["prodottiPerArea"].Rows.Add(rowProdottiPerArea);
|
|
|
|
}
|
|
#endregion
|
|
|
|
#region
|
|
foreach (var item in EF)
|
|
{
|
|
rowProdottiPerArea = ds.Tables["prodottiPerArea"].NewRow();
|
|
rowProdottiPerArea["CodiceAreaBisogno"] = "";//
|
|
rowProdottiPerArea["OrdinamentoAreaBisogno"] = Int32.MaxValue;
|
|
rowProdottiPerArea["DescrizioneAreaBisogno"] = "";
|
|
rowProdottiPerArea["DescrizioneProgetto"] = "";
|
|
rowProdottiPerArea["DescrizioneProdotto"] = item.prodotto.nomeProdotto;
|
|
|
|
rowProdottiPerArea["ControvaloreProposto"] = item.ctvPro;
|
|
rowProdottiPerArea["FontBold"] = false;
|
|
rowProdottiPerArea["ReplaceIfZero"] = stringReplaceIfZero;
|
|
rowProdottiPerArea["CanLastRow"] = true;
|
|
rowProdottiPerArea["IsTotal"] = false;
|
|
rowProdottiPerArea["IsSubTotal"] = false;
|
|
for (int c = ColumnsProdotti; c < ds.Tables["prodotti"].Columns.Count; c++)
|
|
{
|
|
if (ds.Tables["prodotti"].Columns[c].ColumnName != "IsTotal" && ds.Tables["prodotti"].Columns[c].ColumnName != "IsSubTotal")
|
|
rowProdottiPerArea[c] = "n.d.";
|
|
}
|
|
ds.Tables["prodottiPerArea"].Rows.Add(rowProdottiPerArea);
|
|
|
|
}
|
|
#endregion
|
|
|
|
#region
|
|
foreach (var item in ET)
|
|
{
|
|
rowProdottiPerArea = ds.Tables["prodottiPerArea"].NewRow();
|
|
rowProdottiPerArea["CodiceAreaBisogno"] = "";
|
|
rowProdottiPerArea["OrdinamentoAreaBisogno"] = Int32.MaxValue;
|
|
rowProdottiPerArea["DescrizioneAreaBisogno"] = "";
|
|
rowProdottiPerArea["DescrizioneProgetto"] = "";
|
|
rowProdottiPerArea["DescrizioneProdotto"] = item.prodotto.nomeProdotto;
|
|
rowProdottiPerArea["ControvaloreProposto"] = item.ctvPro;
|
|
rowProdottiPerArea["FontBold"] = false;
|
|
rowProdottiPerArea["ReplaceIfZero"] = stringReplaceIfZero;
|
|
rowProdottiPerArea["CanLastRow"] = true;
|
|
rowProdottiPerArea["IsTotal"] = false;
|
|
rowProdottiPerArea["IsSubTotal"] = false;
|
|
for (int c = ColumnsProdotti; c < ds.Tables["prodotti"].Columns.Count; c++)
|
|
{
|
|
if (ds.Tables["prodotti"].Columns[c].ColumnName != "IsTotal" && ds.Tables["prodotti"].Columns[c].ColumnName != "IsSubTotal")
|
|
rowProdottiPerArea[c] = "n.d.";
|
|
}
|
|
ds.Tables["prodottiPerArea"].Rows.Add(rowProdottiPerArea);
|
|
|
|
}
|
|
#endregion
|
|
|
|
//AC
|
|
#region
|
|
foreach (var item in FO)
|
|
{
|
|
rowProdottiPerArea = ds.Tables["prodottiPerArea"].NewRow();
|
|
rowProdottiPerArea["CodiceAreaBisogno"] = "";
|
|
rowProdottiPerArea["OrdinamentoAreaBisogno"] = Int32.MaxValue;
|
|
rowProdottiPerArea["DescrizioneAreaBisogno"] = "";
|
|
rowProdottiPerArea["DescrizioneProgetto"] = "";
|
|
rowProdottiPerArea["DescrizioneProdotto"] = item.prodotto.nomeProdotto;
|
|
rowProdottiPerArea["ControvaloreProposto"] = item.ctvPro;
|
|
rowProdottiPerArea["FontBold"] = false;
|
|
rowProdottiPerArea["ReplaceIfZero"] = stringReplaceIfZero;
|
|
rowProdottiPerArea["CanLastRow"] = true;
|
|
rowProdottiPerArea["IsTotal"] = false;
|
|
rowProdottiPerArea["IsSubTotal"] = false;
|
|
for (int c = ColumnsProdotti; c < ds.Tables["prodotti"].Columns.Count; c++)
|
|
{
|
|
if (ds.Tables["prodotti"].Columns[c].ColumnName != "IsTotal" && ds.Tables["prodotti"].Columns[c].ColumnName != "IsSubTotal")
|
|
rowProdottiPerArea[c] = "n.d.";
|
|
}
|
|
ds.Tables["prodottiPerArea"].Rows.Add(rowProdottiPerArea);
|
|
|
|
}
|
|
#endregion
|
|
|
|
}
|
|
#endregion
|
|
|
|
#region footer
|
|
//var prodottiPerAreaFooter = ds.Tables["prodottiPerArea"].Clone(); // Clono la struttura
|
|
//prodottiPerAreaFooter.TableName = "prodottiPerAreaFooter";
|
|
//ds.Tables.Add(prodottiPerAreaFooter);
|
|
|
|
DataRow drFooter = ds.Tables["prodottiPerArea"].NewRow();
|
|
drFooter["CodiceAreaBisogno"] = "";
|
|
drFooter["DescrizioneAreaBisogno"] = "";
|
|
drFooter["OrdinamentoAreaBisogno"] = Int32.MaxValue;
|
|
drFooter["DescrizioneProgetto"] = "";
|
|
drFooter["DescrizioneProdotto"] = "Portafoglio " + (datiSeiUnico.flagAdeguatezzaPro() ? "proposto" : "prospettico");
|
|
drFooter["ControvaloreProposto"] = datiSeiUnico.propostaUnit().esposizioneValutaria.totaliPatrimonio.patrimonioTotaleRFA;// totaliPatrimonio.risorseFinanziarie + totaliPatrimonio.liqEligoFondiNeg + totaliPatrimonio.liqEligoTitoliNeg + totaliPatrimonio.partiteViaggianti + totaliPatrimonio.contoCorrenteNegativo;
|
|
drFooter["FontBold"] = true;
|
|
drFooter["ReplaceIfZero"] = "";
|
|
drFooter["CanLastRow"] = false;
|
|
drFooter["IsTotal"] = false;
|
|
drFooter["IsSubTotal"] = false;
|
|
|
|
foreach (DataColumn dr in ds.Tables["prodottiPerArea"].Columns)
|
|
{
|
|
string columnName = !dr.ColumnName.Equals("Altre") ? dr.ColumnName : "OTHER";
|
|
var r = valutePropostaPrincipali.distribuzione.elencoSlice.LastOrDefault(o => o.codice == columnName);
|
|
if (r != null)
|
|
{
|
|
drFooter[dr.ColumnName] = totaleRisorse ? "" : datiSeiUnico.FormatDecimal("{0}", (presenzaContocorrenteInMonterio() ? r.pesoCC : r.peso) * 100);
|
|
}
|
|
};
|
|
ds.Tables["prodottiPerArea"].Rows.Add(drFooter);
|
|
#endregion
|
|
|
|
#endregion
|
|
}
|
|
#endregion
|
|
|
|
return ds;
|
|
|
|
}
|
|
public virtual bool TabellaSintesi() { return GetOption<Opzione4_1>().Valore; }
|
|
public virtual bool TabellaDettaglio() { return GetOption<Opzione4_3>().Valore; }
|
|
public virtual bool presenzaContocorrenteInMonterio()
|
|
{
|
|
return GetOption<Opzione4_2>().Valore;
|
|
}
|
|
public virtual bool isPrimeSei()
|
|
{
|
|
return GetOption<Opzione6_1>().DettaglioValute == DettaglioValute.PrimeSei;
|
|
}
|
|
public virtual string getTesto1()
|
|
{
|
|
bool isAdeguata = datiSeiUnico.flagAdeguatezzaPro();
|
|
string nota = "";
|
|
if (isAdeguata)
|
|
nota = datiSeiUnico.FormatBanca("Nei grafici sottostanti è riportato il confronto, sulla base delle principali valute, tra il patrimonio che lei attualmente detiene presso $/Banca/$ (\"portafoglio attuale\") e il patrimonio derivante dalla presente proposta (\"portafoglio proposto\"), con evidenza dell'esposizione, in termini percentuali, del singolo patrimonio a ciascuna valuta.");
|
|
else
|
|
nota = datiSeiUnico.FormatBanca("Nei grafici sottostanti è riportato il confronto, sulla base delle principali valute, tra il patrimonio che lei attualmente detiene presso $/Banca/$ (\"portafoglio attuale\") e il patrimonio derivante dalle operazioni da lei richieste al suo private banker (\"portafoglio prospettico\"), con evidenza dell'esposizione, in termini percentuali, del singolo patrimonio a ciascuna valuta.");
|
|
|
|
return nota;
|
|
}
|
|
|
|
public virtual string GetNota1()
|
|
{
|
|
|
|
decimal contoCorrenteNegativo = datiSeiUnico.ATTUTALE_CCN;
|
|
decimal liqEligoFondiNeg = datiSeiUnico.ATTUTALE_GPELIGOFONDI;
|
|
decimal liqEligoTitoliNeg = datiSeiUnico.ATTUTALE_GPELIGOTITOLI;
|
|
|
|
// 20181009 AC
|
|
decimal liqTuoFoglioNeg = datiSeiUnico.ATTUTALE_TUOFOGLIO;
|
|
//--20181009
|
|
|
|
string nota = "";
|
|
string token = " ";
|
|
|
|
// 20181009 AC
|
|
//if (contoCorrenteNegativo != 0 || liqEligoFondiNeg != 0 || liqEligoTitoliNeg != 0)
|
|
if (contoCorrenteNegativo != 0 || liqEligoFondiNeg != 0 || liqEligoTitoliNeg != 0 || liqTuoFoglioNeg != 0)
|
|
//--20181009
|
|
{
|
|
nota += "Il controvalore del portafoglio attuale esclude il saldo negativo";
|
|
|
|
if (contoCorrenteNegativo != 0)
|
|
{
|
|
nota += token + "dei conti correnti (" + Helper.FormatCurrencyWithSymbol(contoCorrenteNegativo.ToString()) + ")";
|
|
token = ", ";
|
|
}
|
|
// 20181009 AC
|
|
if (liqTuoFoglioNeg != 0)
|
|
{
|
|
nota += token + "della liquidità sottostante Il Mio Foglio (" + Helper.FormatCurrencyWithSymbol(liqTuoFoglioNeg.ToString()) + ")";
|
|
token = ", ";
|
|
}
|
|
//--20181009
|
|
if (liqEligoFondiNeg != 0)
|
|
{
|
|
nota += token + "della liquidità sottostante la GP Eligo Fondi (" + Helper.FormatCurrencyWithSymbol(liqEligoFondiNeg.ToString()) + ")";
|
|
token = ", ";
|
|
}
|
|
if (liqEligoTitoliNeg != 0)
|
|
{
|
|
nota += token + "della liquidità sottostante la GP Eligo Titoli (" + Helper.FormatCurrencyWithSymbol(liqEligoTitoliNeg.ToString()) + ")";
|
|
token = ", ";
|
|
}
|
|
nota += ". ";
|
|
token = "";
|
|
}
|
|
|
|
var esposizionevalutaria = datiSeiUnico.patrimonioUnit().patrimonioCasa.esposizioneValutariaTutte.distribuzione;
|
|
|
|
|
|
decimal gradoCopertura = presenzaContocorrenteInMonterio() ? esposizionevalutaria.coverageCC * 100 : esposizionevalutaria.coverage * 100;
|
|
decimal totaleNonRappr = esposizionevalutaria.totaleNonRappr;
|
|
decimal contoCorrente = presenzaContocorrenteInMonterio() ? 0 : datiSeiUnico.ATTUTALE_CC;
|
|
decimal partiteViaggianti = datiSeiUnico.ATTUTALE_OC;
|
|
|
|
if (gradoCopertura < 100)
|
|
{
|
|
nota += "Grado di copertura (%) della rappresentazione grafica per esposizione valutaria del portafoglio attuale pari a " + Helper.FormatDecimal(gradoCopertura.ToString(), 2) + ":";
|
|
token = " ";
|
|
|
|
if (totaleNonRappr != 0 || contoCorrente != 0 || partiteViaggianti != 0)
|
|
{
|
|
nota += token + "non sono considerati";
|
|
if (totaleNonRappr != 0)
|
|
{
|
|
nota += token + "i prodotti non rappresentabili (" + Helper.FormatCurrencyWithSymbol(totaleNonRappr.ToString()) + ")";
|
|
token = ", ";
|
|
}
|
|
if (contoCorrente != 0)
|
|
{
|
|
nota += token + "i conti correnti (" + Helper.FormatCurrencyWithSymbol(contoCorrente.ToString()) + ")";
|
|
token = ", ";
|
|
}
|
|
if (partiteViaggianti != 0)
|
|
{
|
|
nota += token + "gli importi relativi alle operazioni in corso (" + Helper.FormatCurrencyWithSymbol(partiteViaggianti.ToString()) + ")";
|
|
token = ", ";
|
|
}
|
|
nota += ". ";
|
|
}
|
|
}
|
|
return nota;
|
|
}
|
|
public virtual string GetNota2()
|
|
{
|
|
|
|
decimal contoCorrenteNegativo = datiSeiUnico.PROPOSTO_CCN;
|
|
decimal liqEligoFondiNeg = datiSeiUnico.PROPOSTO_GPELIGOFONDI;
|
|
decimal liqEligoTitoliNeg = datiSeiUnico.PROPOSTO_GPELIGOTITOLI;
|
|
|
|
// 20181009 AC
|
|
decimal liqTuoFoglioNeg = datiSeiUnico.PROPOSTO_TUOFOGLIO;
|
|
//--20181009 AC
|
|
|
|
string nota = "";
|
|
string token = " ";
|
|
|
|
// 20181009 AC
|
|
//if (contoCorrenteNegativo != 0 || liqEligoFondiNeg != 0 || liqEligoTitoliNeg != 0)
|
|
if (contoCorrenteNegativo != 0 || liqEligoFondiNeg != 0 || liqEligoTitoliNeg != 0 || liqTuoFoglioNeg != 0)
|
|
//--20181009 AC
|
|
{
|
|
nota += "Il controvalore del portafoglio " + (datiSeiUnico.flagAdeguatezzaPro() ? "proposto" : "prospettico") + " esclude il saldo negativo";
|
|
|
|
if (contoCorrenteNegativo != 0)
|
|
{
|
|
nota += token + "dei conti correnti (" + Helper.FormatCurrencyWithSymbol(contoCorrenteNegativo.ToString()) + ")";
|
|
token = ", ";
|
|
}
|
|
// 20181009 AC
|
|
if (liqTuoFoglioNeg != 0)
|
|
{
|
|
nota += token + "della liquidità sottostante Il Mio Foglio (" + Helper.FormatCurrencyWithSymbol(liqTuoFoglioNeg.ToString()) + ")";
|
|
token = ", ";
|
|
}
|
|
//--20181009 AC
|
|
if (liqEligoFondiNeg != 0)
|
|
{
|
|
nota += token + "della liquidità sottostante la GP Eligo Fondi (" + Helper.FormatCurrencyWithSymbol(liqEligoFondiNeg.ToString()) + ")";
|
|
token = ", ";
|
|
}
|
|
if (liqEligoTitoliNeg != 0)
|
|
{
|
|
nota += token + "della liquidità sottostante la GP Eligo Titoli (" + Helper.FormatCurrencyWithSymbol(liqEligoTitoliNeg.ToString()) + ")";
|
|
token = ", ";
|
|
}
|
|
nota += ". ";
|
|
token = "";
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var esposizionevalutaria = datiSeiUnico.propostaUnit().esposizioneValutariaTutte.distribuzione;
|
|
decimal gradoCopertura = presenzaContocorrenteInMonterio() ? esposizionevalutaria.coverageCC * 100 : esposizionevalutaria.coverage * 100;
|
|
decimal totaleNonRappr = esposizionevalutaria.totaleNonRappr;
|
|
decimal contoCorrente = presenzaContocorrenteInMonterio() ? 0 : datiSeiUnico.PROPOSTO_CC;
|
|
decimal partiteViaggianti = datiSeiUnico.PROPOSTO_OC;
|
|
|
|
|
|
if (gradoCopertura < 100)
|
|
{
|
|
nota += "Grado di copertura (%) della rappresentazione grafica per esposizione valutaria del portafoglio " + (datiSeiUnico.flagAdeguatezzaPro() ? "proposto" : "prospettico") + " pari a " + Helper.FormatDecimal(gradoCopertura.ToString(), 2) + ":";
|
|
token = " ";
|
|
|
|
if (totaleNonRappr != 0 || contoCorrente != 0 || partiteViaggianti != 0)
|
|
{
|
|
nota += token + "non sono considerati ";
|
|
if (totaleNonRappr != 0)
|
|
{
|
|
nota += token + "i prodotti non rappresentabili (" + Helper.FormatCurrencyWithSymbol(totaleNonRappr.ToString()) + ")";
|
|
token = ", ";
|
|
}
|
|
if (contoCorrente != 0)
|
|
{
|
|
nota += token + "i conti correnti (" + Helper.FormatCurrencyWithSymbol(contoCorrente.ToString()) + ")";
|
|
token = ", ";
|
|
}
|
|
if (partiteViaggianti != 0)
|
|
{
|
|
nota += token + "gli importi relativi alle operazioni in corso (" + Helper.FormatCurrencyWithSymbol(partiteViaggianti.ToString()) + ")";
|
|
token = ", ";
|
|
}
|
|
nota += ". ";
|
|
}
|
|
}
|
|
return nota;
|
|
}
|
|
|
|
public virtual string getTesto2()
|
|
{
|
|
bool isAdeguata = datiSeiUnico.flagAdeguatezzaPro();
|
|
string nota = "";
|
|
if (isAdeguata)
|
|
nota = datiSeiUnico.FormatBanca("Nella tabella sottostante sono riportati i prodotti che, sulla base della presente proposta, concorrono alla determinazione del suo patrimonio, con evidenza dell'esposizione, in termini percentuali, alle principali valute. I prodotti sono raggruppati per area di bisogno e, dove necessario, per progetto di investimento.");
|
|
else
|
|
nota = datiSeiUnico.FormatBanca("Nella tabella sottostante sono riportati i prodotti che, sulla base delle operazioni da lei richieste al suo private banker, concorrono alla determinazione del suo patrimonio, con evidenza dell'esposizione, in termini percentuali, alle principali valute. I prodotti sono raggruppati per area di bisogno e, dove necessario, per progetto di investimento.");
|
|
return nota;
|
|
}
|
|
}
|
|
}
|