978 lines
58 KiB
C#
978 lines
58 KiB
C#
using System;
|
|
using Consulenza.ReportWriter.Business;
|
|
using Consulenza.ReportWriter.Business.OBJ_PDF;
|
|
using System.Data;
|
|
using Consulenza.ReportCommon;
|
|
using System.Linq;
|
|
using Consulenza.DataServices.fideuram.data.service;
|
|
using System.Collections.Generic;
|
|
using Consulenza.ReportWriter.Business.Entity;
|
|
|
|
namespace Consulenza.ReportWriter.Manager.Section.Unica
|
|
{
|
|
/// <summary>
|
|
/// Scheda 10. Nucleo: Patrimonio Fideuram: distribuzione su aree di bisogno. IdSezione 53
|
|
/// </summary>
|
|
public class S10 : Entity.Section
|
|
{
|
|
|
|
public S10(EnvironmentFacade environmentFacade, int idSection)
|
|
: base(environmentFacade, idSection)
|
|
{
|
|
try
|
|
{
|
|
Draw();
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
SectionLogger.Write("S10", ex.Message, SectionLoggerMessageLevel.E, EnvironmentFacade.ReportEnvironment);
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
///
|
|
/// </summary>
|
|
protected override sealed void Draw()
|
|
{
|
|
var dati = GetDataSet();
|
|
if (dati.Tables["area"].Rows.Count > 0)
|
|
{
|
|
#region Inizializzazione nota
|
|
//Adriano: richiamare la getNota passando le due tabelle
|
|
string nota = GetNota(dati.Tables["dettaglioNota"], dati.Tables["componentiNucleo"]);
|
|
//--Adriano
|
|
|
|
//Mette l'asterisco alla riga relativa al Patrimonio, se c'è una nota
|
|
if (!string.IsNullOrEmpty(nota))
|
|
{
|
|
DataRow dr = dati.Tables["componentiNucleo"].AsEnumerable().Where(x => x.Field<string>("ComponenteNucleo").ToString().Contains("Patrimonio")).FirstOrDefault();
|
|
if (dr != null)
|
|
{
|
|
dr["ComponenteNucleo"] += "*";
|
|
}
|
|
}
|
|
#endregion Inizializzazione nota
|
|
|
|
#region Intro
|
|
string TestoIntro = GetTestoIntro();
|
|
|
|
if (TestoIntro.Length > 0)
|
|
{
|
|
AddElement(new SpacePDF(20));
|
|
AddElement(new FormattedTextAreaPDF(TestoIntro, EnvironmentFacade.RendererFacade.XLeftLimit) { FontSize = 7, TextHorizontalAlign = ceTe.DynamicPDF.TextAlign.Justify });
|
|
}
|
|
#endregion Intro
|
|
|
|
#region Componenti Nucleo
|
|
#region tabella Componenti Nucleo
|
|
if (dati.Tables["componentiNucleo"].Rows.Count > 0)
|
|
{
|
|
//Adriano 20180111: ordinamento per numero ordine e poi per controvalore decrescente
|
|
//DataView dv = dati.Tables["componentiNucleo"].DefaultView;
|
|
//dv.Sort = "ControvaloreAttuale desc";
|
|
//DataTable sortedDT = dv.ToTable();
|
|
var sortedDT = dati.Tables["componentiNucleo"].AsEnumerable()
|
|
.OrderBy(r => r.Field<Int32>("Ordine"))
|
|
.ThenByDescending(r => r.Field<decimal>("ControvaloreAttuale"))
|
|
.CopyToDataTable();
|
|
//Adriano 20180111
|
|
|
|
TablePDF tabellaclientiNucleo = new TablePDF(EnvironmentFacade.RendererFacade.XLeftLimit, sortedDT)
|
|
{
|
|
Style = Style.ConsulenzaUnica,
|
|
Footer = false,
|
|
AlternateRow = false,
|
|
ShowBorderLastLine = false,
|
|
HeaderHeight = 27
|
|
};
|
|
|
|
tabellaclientiNucleo.Columns.Add(new ColumnPDF("ComponenteNucleo", 320, HorizontalAlignmentType.Sinistra, false, false, 7, ColumnType.Testo, "ComponenteNucleo", "Componente Nucleo") { HeaderFontSize = 7 });
|
|
tabellaclientiNucleo.Columns.Add(new ColumnPDF("ControvaloreAttuale", 106, HorizontalAlignmentType.Destra, false, false, 7, ColumnType.Decimale, "ControvaloreAttuale", "Controvalore<BR>attuale (€)") { HeaderFontSize = 7 });
|
|
tabellaclientiNucleo.Columns.Add(new ColumnPDF("PercentualeAttuale", 86, HorizontalAlignmentType.Destra, false, false, 7, ColumnType.Testo, "PercentualeAttuale", "% attuale") { HeaderFontSize = 7 });
|
|
|
|
AddElement(new SpacePDF(15));
|
|
AddElement(tabellaclientiNucleo);
|
|
|
|
}
|
|
#endregion tabella Componenti Nucleo
|
|
#endregion Componenti Nucleo
|
|
|
|
#region Sezione Piramide Aree di Bisogno
|
|
|
|
string TestoPiramide = GetTestoPiramide();
|
|
|
|
if (TestoPiramide.Length > 0)
|
|
{
|
|
AddElement(new SpacePDF(15));
|
|
AddElement(new FormattedTextAreaPDF(TestoPiramide, EnvironmentFacade.RendererFacade.XLeftLimit) { FontSize = 7, TextHorizontalAlign = ceTe.DynamicPDF.TextAlign.Justify });
|
|
}
|
|
|
|
//Adriano 20180108: l'asterisco non va messo
|
|
//Mette l'asterisco alla riga relativa al Patrimonio, se c'è una nota
|
|
//if (!string.IsNullOrEmpty(nota))
|
|
//{
|
|
// DataRow dr = dati.Tables["areaFooter"].AsEnumerable().Where(x => x.Field<string>("Area").ToString().Contains("Patrimonio")).FirstOrDefault();
|
|
// if (dr != null)
|
|
// {
|
|
// dr["Area"] += "*";
|
|
// }
|
|
//}
|
|
//--Adriano
|
|
|
|
var tabellaAree = new TablePDF(EnvironmentFacade.RendererFacade.XLeftLimit, dati.Tables["area"], dati.Tables["areaFooter"])
|
|
{
|
|
Style = Style.ConsulenzaUnica,
|
|
AlternateRow = false,
|
|
ShowSeparationLines = false,
|
|
RowsPadding = 10,
|
|
HeaderHeight = 27,
|
|
HeaderMargin = 2,
|
|
//RowHeight = 21.78f,
|
|
FooterYOffset = 4
|
|
};
|
|
|
|
//tabellaAree.Columns.Add(new ColumnPDF("Area2", 320, HorizontalAlignmentType.Sinistra, false, false, 7, ColumnType.Objectpdf, "Area", "Area di bisogno") { HeaderFontSize = 7, DeltaYContent = 2, ScaleColumnTypeImage = 0.66f });
|
|
//tabellaAree.Columns.Add(new ColumnPDF("ControvaloreAttuale", 106, HorizontalAlignmentType.Sinistra, false, false, 7, ColumnType.Decimale, "ControvaloreAttuale", "Controvalore<BR>attuale (€)") { HeaderFontSize = 7, DeltaYContent = 5, PaddingRight = 4 });
|
|
//tabellaAree.Columns.Add(new ColumnPDF("PercentualeAttuale", 86, HorizontalAlignmentType.Sinistra, false, false, 7, ColumnType.Decimale, "PercentualeAttuale", "% attuale") { HeaderFontSize = 7, DeltaYContent = 5, PaddingRight = 6 });
|
|
|
|
tabellaAree.Columns.Add(new ColumnPDF("Area2", 320, HorizontalAlignmentType.Sinistra, false, false, 7, ColumnType.Objectpdf, "Area", "Area di bisogno") { HeaderFontSize = 7, DeltaYContent = 2, ScaleColumnTypeImage = 0.66f });
|
|
tabellaAree.Columns.Add(new ColumnPDF("ControvaloreAttuale", 106, HorizontalAlignmentType.Destra, false, false, 7, ColumnType.Decimale, "ControvaloreAttuale", "Controvalore<BR>attuale (€)") { HeaderFontSize = 7, DeltaYContent = 5, PaddingRight = 4 });
|
|
tabellaAree.Columns.Add(new ColumnPDF("PercentualeAttuale", 86, HorizontalAlignmentType.Destra, false, false, 7, ColumnType.Testo, "PercentualeAttuale", "% attuale") { HeaderFontSize = 7, DeltaYContent = 5, PaddingRight = 6 });
|
|
|
|
tabellaAree.FooterColumns.Add(new ColumnPDF("Area", 320, HorizontalAlignmentType.Sinistra, false, true, 7, ColumnType.Testo));
|
|
tabellaAree.FooterColumns.Add(new ColumnPDF("ControvaloreAttuale", 106, HorizontalAlignmentType.Destra, false, true, 7, ColumnType.Decimale) { PaddingRight = 4 });
|
|
tabellaAree.FooterColumns.Add(new ColumnPDF("PercentualeAttuale", 86, HorizontalAlignmentType.Destra, false, true, 7, ColumnType.Testo) { PaddingRight = 2 });
|
|
int a = 0;
|
|
foreach (var item in dati.Tables["area"].Rows)
|
|
{
|
|
tabellaAree.Cells[1, a].HorizontalAlignment = HorizontalAlignmentType.Destra;
|
|
tabellaAree.Cells[2, a].HorizontalAlignment = HorizontalAlignmentType.Destra;
|
|
|
|
|
|
tabellaAree.Cells[0, a].ValueObjectList.Add(new ImagePDF(0, 1, dati.Tables["area"].Rows[a].ItemArray[0].ToString())
|
|
{
|
|
DeltaX = 3,
|
|
DeltaY = 0,
|
|
Scale = 0.66f,
|
|
Height = 27,
|
|
Width = 145
|
|
});
|
|
var textArea = new FormattedTextAreaPDF(dati.Tables["area"].Rows[a].ItemArray[1].ToString(), 0)
|
|
{
|
|
DeltaY = 8f,
|
|
FontSize = 8f
|
|
};
|
|
var labelSize = Helper.GetNumericStringWidth(textArea.Text);
|
|
float addition = 0;
|
|
switch (textArea.Text)
|
|
{
|
|
case "Investimento":
|
|
case "Previdenza":
|
|
addition = 3;
|
|
break;
|
|
case "Riserva":
|
|
addition = 2;
|
|
break;
|
|
case "Liquidità":
|
|
addition = 1;
|
|
break;
|
|
case "Extra Rendimento":
|
|
addition = 6;
|
|
break;
|
|
}
|
|
textArea.DeltaX = 76 + addition - labelSize;
|
|
textArea.Text = Helper.FirstCharToUpper(textArea.Text);
|
|
tabellaAree.Cells[0, a].ValueObjectList.Add(textArea);
|
|
|
|
a++;
|
|
}
|
|
|
|
AddElement(new SpacePDF(15));
|
|
|
|
AddElement(tabellaAree);
|
|
#endregion Tabella Aree Bisogno
|
|
|
|
#region Sezione Nota importi negativi
|
|
if (!string.IsNullOrEmpty(nota))
|
|
{
|
|
AddElement(new SpacePDF(15));
|
|
AddElement(new FormattedTextAreaPDF(string.Format("(*) {0}", nota), EnvironmentFacade.RendererFacade.XLeftLimit) { FontSize = 7, TextHorizontalAlign = ceTe.DynamicPDF.TextAlign.Justify });
|
|
}
|
|
#endregion
|
|
|
|
#region Sezione Contributo Cliente per Area
|
|
|
|
AddElement(new PagePDF());
|
|
|
|
string TestoTabella = GetTestoTabella();
|
|
if (TestoTabella.Length > 0)
|
|
{
|
|
AddElement(new SpacePDF(15));
|
|
AddElement(new FormattedTextAreaPDF(TestoTabella, EnvironmentFacade.RendererFacade.XLeftLimit) { FontSize = 7, TextHorizontalAlign = ceTe.DynamicPDF.TextAlign.Justify });
|
|
}
|
|
|
|
#region Tabella Dettaglio Contributo
|
|
DataTable dt = dati.Tables["dettaglioContributo"];
|
|
//dt.DefaultView.Sort = "codArea,Ordine,ControvaloreAttuale";
|
|
|
|
var newDataTable = dati.Tables["dettaglioContributo"].AsEnumerable()
|
|
.OrderBy(r => r.Field<Int32>("OrdineArea"))
|
|
//Adriano 20180111: ordinamento per OrdineArea, poi per ordine crescente di riga (testata, dettaglio) e poi per controvalore decrescente
|
|
//.ThenByDescending(r => r.Field<int>("ordine"))
|
|
.ThenBy(r => r.Field<int>("ordine"))
|
|
//--Adriano 20180111
|
|
.ThenByDescending((r => Math.Abs(Convert.ToDecimal(r.Field<Decimal>("ControvaloreAttuale")))))
|
|
.CopyToDataTable();
|
|
|
|
if (dati.Tables["dettaglioContributo"].Rows.Count > 0)
|
|
{
|
|
TablePDF tabelladettaglioContributo = new TablePDF(EnvironmentFacade.RendererFacade.XLeftLimit, newDataTable)// dati.Tables["dettaglioContributo"])
|
|
{
|
|
//Style = Style.ConsulenzaUnica,
|
|
//Footer = false,
|
|
//AlternateRow = false,
|
|
//ShowBorderLastLine = false,
|
|
//HeaderHeight = 27,
|
|
|
|
Style = Style.ConsulenzaUnica,
|
|
Footer = true,
|
|
AlternateRow = false,
|
|
ShowBorderLastLine = false,
|
|
HeaderHeight = 30,
|
|
HeaderMargin = 2
|
|
|
|
};
|
|
tabelladettaglioContributo.Columns.Add(new ColumnPDF("Immagine", 15, HorizontalAlignmentType.Sinistra, false, false, 6, ColumnType.Objectpdf, string.Empty, string.Empty) { HeaderFontSize = 7, PaddingLeft = 2 });
|
|
tabelladettaglioContributo.Columns.Add(new ColumnPDF("Area", 305, HorizontalAlignmentType.Sinistra, false, false, 7, ColumnType.Testo, "descrizioneArea", "Area di Bisogno") { HeaderFontSize = 7 });
|
|
tabelladettaglioContributo.Columns.Add(new ColumnPDF("ControvaloreAttuale", 106, HorizontalAlignmentType.Destra, false, false, 7, ColumnType.Decimale, "ControvaloreAttuale", "Controvalore<BR>Attuale (€)") { HeaderFontSize = 7 });
|
|
tabelladettaglioContributo.Columns.Add(new ColumnPDF("PercentualeAttuale", 86, HorizontalAlignmentType.Destra, false, false, 7, ColumnType.Testo, "PercentualeAttuale", "% Attuale") { HeaderFontSize = 7 });
|
|
|
|
// var dettaglioContributo = dati.Tables["dettaglioContributo"].AsEnumerable()
|
|
//.OrderByDescending(r => r.Field<string>("codArea"))
|
|
//.ThenByDescending(r => r.Field<int>("ordine"))
|
|
//.ThenByDescending(r => r.Field<Decimal>("ControvaloreAttuale"))
|
|
//.CopyToDataTable();
|
|
|
|
|
|
var dettaglioContributo = dati.Tables["dettaglioContributo"].AsEnumerable()
|
|
.OrderBy(r => r.Field<int>("OrdineArea"))
|
|
//Adriano 20180111: ordinamento per OrdineArea, poi per ordine crescente di riga (testata, dettaglio) e poi per controvalore decrescente
|
|
//.ThenByDescending(r => r.Field<int>("ordine"))
|
|
.ThenBy(r => r.Field<int>("ordine"))
|
|
//--Adriano 20180111
|
|
.ThenByDescending((r => Math.Abs(Convert.ToDecimal(r.Field<Decimal>("ControvaloreAttuale")))))
|
|
.CopyToDataTable();
|
|
|
|
|
|
for (int h = 0; h < dettaglioContributo.Rows.Count; h++) //dati.Tables["dettaglioContributo"].Rows.Count; h++)
|
|
{
|
|
|
|
DataRow dettaglio = dettaglioContributo.Rows[h];
|
|
if (String.IsNullOrEmpty(dettaglio["componenteNucleo"].ToString()) && !String.IsNullOrEmpty(dettaglio["codArea"].ToString()))
|
|
{
|
|
for (int c = 0; c < dettaglio.Table.Columns.Count; c++)
|
|
{
|
|
|
|
if (Convert.ToBoolean(dettaglio["BackgroundGray"]))
|
|
tabelladettaglioContributo.Cells[c, h].BackgroundColor = ColorPDF.ConsulenzaUnica_Grigio_SfondoColonnaHeaderFooterTabella;
|
|
}
|
|
string codArea = dettaglio["codArea"].ToString();
|
|
tabelladettaglioContributo.Cells[0, h].ColSpan = 2;
|
|
var listaOggetti = new List<ObjectPDF> {
|
|
new RectanglePDF(8,8, ColorPDF.GetBy_AreaBisogno(codArea)){DeltaY = 4.8F},
|
|
new FormattedTextAreaPDF
|
|
{
|
|
Text = codArea.Substring(0,1),
|
|
FontBold = true,
|
|
FontColor = ColorPDF.Bianco,
|
|
DeltaX = codArea.Substring(0,1).Equals("I")?2.3F:2.0F,
|
|
FontSize= 6,
|
|
DeltaY = 2.3F
|
|
},
|
|
new FormattedTextAreaPDF
|
|
{
|
|
Text = dettaglio["descrizioneArea"].ToString(),
|
|
FontBold = Convert.ToBoolean(dettaglio["FontBold"]),
|
|
FontColor = ColorPDF.Nero,
|
|
DeltaX = 14F,
|
|
FontSize= 6,
|
|
DeltaY = 2.2F
|
|
}
|
|
|
|
};
|
|
|
|
tabelladettaglioContributo.Cells[0, h].ValueObjectList.AddRange(listaOggetti);
|
|
tabelladettaglioContributo.Cells[0, h].YContentOffset = 10;
|
|
|
|
}
|
|
else if (!String.IsNullOrEmpty(dettaglio["componenteNucleo"].ToString()))
|
|
{
|
|
//tabelladettaglioContributo.Cells[0, 1].BackgroundColor = ColorPDF.ConsulenzaUnica_Grigio_SfondoColonnaHeaderFooterTabella;
|
|
//tabelladettaglioContributo.Cells[h, 1].Value = dettaglio["componenteNucleo"].ToString();
|
|
for (int c = 0; c < dettaglio.Table.Columns.Count; c++)
|
|
{
|
|
|
|
if (Convert.ToBoolean(dettaglio["BackgroundGray"]))
|
|
tabelladettaglioContributo.Cells[c, h].BackgroundColor = ColorPDF.ConsulenzaUnica_Grigio_SfondoColonnaHeaderFooterTabella;
|
|
}
|
|
}
|
|
else if (String.IsNullOrEmpty(dettaglio["componenteNucleo"].ToString()) && String.IsNullOrEmpty(dettaglio["codArea"].ToString()))
|
|
{
|
|
//tabelladettaglioContributo.Cells[0, 1].BackgroundColor = ColorPDF.ConsulenzaUnica_Grigio_SfondoColonnaHeaderFooterTabella;
|
|
//tabelladettaglioContributo.Cells[h, 1].Value = dettaglio["componenteNucleo"].ToString();
|
|
for (int c = 0; c < dettaglio.Table.Columns.Count; c++)
|
|
{
|
|
|
|
if (Convert.ToBoolean(dettaglio["BackgroundGray"]))
|
|
tabelladettaglioContributo.Cells[c, h].BackgroundColor = ColorPDF.ConsulenzaUnica_Grigio_SfondoColonnaHeaderFooterTabella;
|
|
}
|
|
}
|
|
}
|
|
AddElement(new SpacePDF(15));
|
|
AddElement(tabelladettaglioContributo);
|
|
AddElement(new SpacePDF(0));
|
|
|
|
}
|
|
#endregion
|
|
#endregion
|
|
}
|
|
}
|
|
|
|
protected sealed override DataTable GetDataTable()
|
|
{
|
|
return null;
|
|
}
|
|
|
|
protected override DataSet GetDataSet()
|
|
{
|
|
var ds = new DataSet();
|
|
ds.Tables.Add(new DataTable("area"));
|
|
ds.Tables.Add(new DataTable("areaFooter"));
|
|
ds.Tables.Add(new DataTable("componentiNucleo"));
|
|
ds.Tables.Add(new DataTable("dettaglioContributo"));
|
|
ds.Tables.Add(new DataTable("dettaglioNota"));
|
|
|
|
var pianificazione = datiSeiUnico.pianificazioneUnit().pianificazioneVerticale;
|
|
|
|
var listReturn = new List<rsPosizione>
|
|
{
|
|
|
|
// Operazioni in corso
|
|
new rsPosizione { prodotto = new rsProdotto() { nomeProdotto = "Operazioni in corso" }, ctv = datiSeiUnico.CASA_OC },
|
|
// CC Negativi
|
|
new rsPosizione { prodotto = new rsProdotto() { nomeProdotto = "Conto corrente" }, ctv = datiSeiUnico.CASA_CCN },
|
|
//Eligo Fondi
|
|
new rsPosizione { prodotto = new rsProdotto() { nomeProdotto = "Liquidità negativa GP Eligo" }, ctv = datiSeiUnico.CASA_GPELIGO }
|
|
|
|
// 20181009 AC
|
|
// Il Mio Foglio
|
|
,new rsPosizione { prodotto = new rsProdotto() { nomeProdotto = "Liquidità sottostante Il Mio Foglio" }, ctv = datiSeiUnico.CASA_TUOFOGLIO }
|
|
//--20181009 AC
|
|
|
|
};
|
|
|
|
var listaProdotti = listReturn.FindAll(o => o.ctv != 0);
|
|
|
|
ds.Tables["area"].Columns.Add(new DataColumn("Area", typeof(string)));
|
|
ds.Tables["area"].Columns.Add(new DataColumn("Description", typeof(string)));
|
|
ds.Tables["area"].Columns.Add(new DataColumn("ControvaloreAttuale", typeof(decimal)));
|
|
ds.Tables["area"].Columns.Add(new DataColumn("PercentualeAttuale", typeof(decimal)));
|
|
|
|
var areeDisplayInfos = datiSeiUnico.displayInfos().areeDisplayInfos;
|
|
|
|
foreach (var area in from o in areeDisplayInfos orderby o.value.order select o.key)
|
|
{
|
|
var areaInPianificazione = pianificazione.aree.FirstOrDefault(o => o.area.ToUpper().Equals(area));
|
|
if (areaInPianificazione != null && areaInPianificazione.area != "Pro")
|
|
{
|
|
ds.Tables["area"].Rows.Add(
|
|
string.Format("{0}.png", new AreaBisogno(areaInPianificazione.area).NomePerImmagine),
|
|
areaInPianificazione.descAreaEstesa,
|
|
areaInPianificazione.ctvArea,
|
|
//areaInPianificazione.percArea * 100);
|
|
Helper.FormatDecimal((areaInPianificazione.percArea * 100).ToString(), 2));
|
|
}
|
|
}
|
|
|
|
ds.Tables["areaFooter"].Columns.Add(new DataColumn("Area", typeof(string)));
|
|
ds.Tables["areaFooter"].Columns.Add(new DataColumn("ControvaloreAttuale", typeof(decimal)));
|
|
ds.Tables["areaFooter"].Columns.Add(new DataColumn("PercentualeAttuale", typeof(string)));
|
|
ds.Tables["areaFooter"].Columns.Add(new DataColumn("ReplaceIfZero", typeof(string)));
|
|
ds.Tables["areaFooter"].Columns.Add(new DataColumn("FontBold", typeof(bool)));
|
|
ds.Tables["areaFooter"].Columns.Add(new DataColumn("BackgroundGray", typeof(bool)));
|
|
|
|
// Totale del Patrimonio
|
|
if (listaProdotti.Count > 0)
|
|
{
|
|
ds.Tables["areaFooter"].Rows.Add(
|
|
"Totale risorse allocate",
|
|
datiSeiUnico.CASA_SUBTOTALE.ToString(),
|
|
Helper.FormatDecimal((pianificazione.percentualeTot * 100).ToString(), 2),
|
|
"-",
|
|
true,
|
|
true
|
|
);
|
|
|
|
//Dettaglio del Patrimonio Altro
|
|
foreach (var item in listaProdotti)
|
|
{
|
|
ds.Tables["areaFooter"].Rows.Add(
|
|
item.prodotto.nomeProdotto,
|
|
item.ctv,
|
|
"-",
|
|
"-",
|
|
false,
|
|
false
|
|
);
|
|
}
|
|
}
|
|
|
|
// Patrimonio Casa
|
|
ds.Tables["areaFooter"].Rows.Add(
|
|
string.Format("Patrimonio {0}", Helper.ReplaceVariables("$/Banca/$", EnvironmentFacade.ReportEnvironment)),
|
|
datiSeiUnico.CASA_TOTALE,
|
|
listaProdotti.Count > 0 ? "-" : Helper.FormatDecimal((pianificazione.percentualeTot * 100).ToString(), 2),
|
|
"-",
|
|
true,
|
|
true
|
|
);
|
|
|
|
ds.Tables["componentiNucleo"].Columns.Add(new DataColumn("ComponenteNucleo", typeof(string)));
|
|
ds.Tables["componentiNucleo"].Columns.Add(new DataColumn("ControvaloreAttuale", typeof(decimal)));
|
|
ds.Tables["componentiNucleo"].Columns.Add(new DataColumn("PercentualeAttuale", typeof(string)));
|
|
ds.Tables["componentiNucleo"].Columns.Add(new DataColumn("FontBold", typeof(bool)));
|
|
ds.Tables["componentiNucleo"].Columns.Add(new DataColumn("BackgroundGray", typeof(bool)));
|
|
ds.Tables["componentiNucleo"].Columns.Add(new DataColumn("Ordine", typeof(int)));
|
|
|
|
var dettaglioContributonucleo = datiSeiUnico.nucleiUnit().patrimonioCliente;
|
|
|
|
string[] areaOrder = new string[] { "EXT", "INV", "PRE", "RIS", "LIQ", "" };
|
|
|
|
//var dettaglioContributoOrderBYArea = from element in dettaglioContributonucleo.aree
|
|
// orderby element.area ascending
|
|
// select element;
|
|
|
|
var dettaglioContributoOrderBYArea = dettaglioContributonucleo.aree.OrderBy(x => { return Array.IndexOf(areaOrder, x.area.ToString().ToUpper()); });
|
|
|
|
#region lista dettagli contributi
|
|
|
|
ds.Tables["dettaglioContributo"].Columns.Add(new DataColumn("codArea", typeof(string)));
|
|
ds.Tables["dettaglioContributo"].Columns.Add(new DataColumn("descrizioneArea", typeof(string)));
|
|
ds.Tables["dettaglioContributo"].Columns.Add(new DataColumn("ControvaloreAttuale", typeof(decimal)));
|
|
ds.Tables["dettaglioContributo"].Columns.Add(new DataColumn("PercentualeAttuale", typeof(string)));
|
|
ds.Tables["dettaglioContributo"].Columns.Add(new DataColumn("componenteNucleo", typeof(string)));
|
|
ds.Tables["dettaglioContributo"].Columns.Add(new DataColumn("FontBold", typeof(bool)));
|
|
ds.Tables["dettaglioContributo"].Columns.Add(new DataColumn("BackgroundGray", typeof(bool)));
|
|
ds.Tables["dettaglioContributo"].Columns.Add(new DataColumn("Ordine", typeof(int)));
|
|
ds.Tables["dettaglioContributo"].Columns.Add(new DataColumn("OrdineArea", typeof(int)));
|
|
#endregion lista dettagli contributi
|
|
|
|
#region Definizione tabella Dettaglio Nota
|
|
ds.Tables["dettaglioNota"].Columns.Add(new DataColumn("Area", typeof(string)));
|
|
ds.Tables["dettaglioNota"].Columns.Add(new DataColumn("ComponenteNucleo", typeof(string)));
|
|
ds.Tables["dettaglioNota"].Columns.Add(new DataColumn("DescrizioneRiga", typeof(string)));
|
|
ds.Tables["dettaglioNota"].Columns.Add(new DataColumn("ControvaloreAttuale", typeof(decimal)));
|
|
ds.Tables["dettaglioNota"].Columns.Add(new DataColumn("PercentualeAttuale", typeof(string)));
|
|
#endregion
|
|
|
|
decimal totContributoArea = 0;
|
|
decimal totPercContributoArea = 0;
|
|
|
|
decimal totContributoAreaCorrente = 0;
|
|
decimal totPercContributoAreaCorrente = 0;
|
|
|
|
decimal totL191 = 0;
|
|
decimal totL192 = 0;
|
|
decimal totCC = 0;
|
|
decimal totOC = 0;
|
|
|
|
string nomeLinea191 = "";
|
|
string nomeLinea192 = "";
|
|
|
|
// 20181009 AC
|
|
decimal totV301 = 0;
|
|
string nomeV301 = "";
|
|
//--20181009 AC
|
|
|
|
//serve per ordinare la tabella del dettaglio contributo nella parte successiva alle Aree di Bisogno, quindi
|
|
//dopo la sequenza fissa (EXT, INV, PRE, RIS, LIQ) + Totale Risorse allocate, cioè dalla sesta posizione (ind. 5)
|
|
int ordineArea = 5;
|
|
|
|
//Adriano 20180112: verificare utilità, probabilmente da eliminare entrambi
|
|
//int ordinamento = 0;
|
|
//int ord = 0;
|
|
//--Adriano 20180112
|
|
|
|
//Compone la tabella dei contributi per aree di bisogno con le voci relative alle Aree (EXT, INV, PRE, RIS, LIQ)
|
|
//Adriano 20180124: AGGIUNGERE IL CODICE PER ESCLUDERE ANCHE LE OPERAZIONI IN CORSO !a.area.ToString().ToUpper().Equals("-")
|
|
foreach (var item in dettaglioContributoOrderBYArea.Where(a => !a.area.ToString().ToUpper().Equals("CC") && !a.area.ToString().ToUpper().Equals("SELF") && !a.area.ToString().ToUpper().Equals("-")))
|
|
//foreach (var item in dettaglioContributoOrderBYArea.Where(a => !a.area.ToString().ToUpper().Equals("CC") && !a.area.ToString().ToUpper().Equals("SELF")))
|
|
{
|
|
//foreach (var clienteNucleo in item.clienti.OrderByDescending(x => x.controvalore))
|
|
foreach (var clienteNucleo in item.clienti)
|
|
{
|
|
|
|
var cliente = clienteNucleo.nome + " " + clienteNucleo.cognome;
|
|
//Adriano, aggiunto per mettere solo le voci positive
|
|
if (clienteNucleo.controvalore != 0)
|
|
{
|
|
//Adriano 20180111: metto come campo ordine 1 nelle righe di dettaglio e 0 in quelle di testata
|
|
//ds.Tables["dettaglioContributo"].Rows.Add(item.area, cliente.ToString(), clienteNucleo.controvalore,
|
|
// Helper.FormatDecimal((clienteNucleo.percentuale * 100).ToString(), 2),
|
|
// cliente.ToString(), false, false, ordinamento, Array.IndexOf(areaOrder, item.area.ToString().ToUpper()));
|
|
|
|
ds.Tables["dettaglioContributo"].Rows.Add(item.area, cliente.ToString(), clienteNucleo.controvalore,
|
|
Helper.FormatDecimal((clienteNucleo.percentuale * 100).ToString(), 2),
|
|
cliente.ToString(), false, false, 1, Array.IndexOf(areaOrder, item.area.ToString().ToUpper()));
|
|
//--Adriano 20180111
|
|
|
|
totContributoAreaCorrente += clienteNucleo.controvalore;
|
|
totPercContributoAreaCorrente += clienteNucleo.percentuale;
|
|
//ordinamento++;
|
|
}
|
|
}
|
|
//Adriano 20180111: metto come campo ordine 1 nelle righe di dettaglio e 0 in quelle di testata
|
|
//ds.Tables["dettaglioContributo"].Rows.Add(item.area, item.descArea, totContributoAreaCorrente,
|
|
// Helper.FormatDecimal((totPercContributoAreaCorrente * 100).ToString(), 2),
|
|
// "", true, true, ordinamento, Array.IndexOf(areaOrder, item.area.ToString().ToUpper()));
|
|
|
|
ds.Tables["dettaglioContributo"].Rows.Add(item.area, item.descArea, totContributoAreaCorrente,
|
|
Helper.FormatDecimal((totPercContributoAreaCorrente * 100).ToString(), 2),
|
|
"", true, true, 0, Array.IndexOf(areaOrder, item.area.ToString().ToUpper()));
|
|
//--Adriano 20180111
|
|
|
|
totContributoArea += totContributoAreaCorrente;
|
|
totPercContributoArea += totPercContributoAreaCorrente;
|
|
totContributoAreaCorrente = 0;
|
|
totPercContributoAreaCorrente = 0;
|
|
//ord = ordinamento;
|
|
//ordinamento = 0;
|
|
}
|
|
|
|
//ord++;
|
|
|
|
//Adriano 20180111: metto come campo ordine 1 nelle righe di dettaglio e 0 in quelle di testata
|
|
//ds.Tables["dettaglioContributo"].Rows.Add("", "Totale Risorse Allocate", totContributoArea, Helper.FormatDecimal((totPercContributoArea * 100).ToString(), 2), "", true, true, ord, ordineArea);
|
|
ds.Tables["dettaglioContributo"].Rows.Add("", "Totale Risorse Allocate", totContributoArea, Helper.FormatDecimal((totPercContributoArea * 100).ToString(), 2), "", true, true, 0, ordineArea);
|
|
//--Adriano 20180111
|
|
|
|
//Parte della tabella coi valori negativi
|
|
|
|
//ordinamento = dettaglioContributoOrderBYArea.Where(a => a.area.ToString().ToUpper().Equals("CC") || a.area.ToString().ToUpper().Equals("SELF")).Count();
|
|
|
|
decimal totPatrimonio = totContributoArea;
|
|
|
|
totContributoArea = 0;
|
|
totPercContributoArea = 0;
|
|
|
|
totContributoAreaCorrente = 0;
|
|
totPercContributoAreaCorrente = 0;
|
|
string descrizione = "";
|
|
|
|
ordineArea++;
|
|
|
|
//Compone la tabella dei contributi per aree di bisogno con le voci relative ad eventuali Conti Correnti negativi e/o Self (GP Eligo Fondi/GP Eligo Titoli)
|
|
//Adriano 20180124: AGGIUNGERE IL CODICE PER INCLUDERE ANCHE LE OPERAZIONI IN CORSO
|
|
//foreach (var item in dettaglioContributoOrderBYArea.Where(a => a.area.ToString().ToUpper().Equals("CC") || a.area.ToString().ToUpper().Equals("SELF")).OrderBy(a => a.area))
|
|
foreach (var item in dettaglioContributoOrderBYArea.Where(a => a.area.ToString().ToUpper().Equals("CC") || a.area.ToString().ToUpper().Equals("SELF") || a.area.ToString().ToUpper().Equals("-")).OrderBy(a => a.area))
|
|
{
|
|
foreach (var clienteNucleo in item.clienti.OrderByDescending(x => x.controvalore))
|
|
{
|
|
var nomeCliente = clienteNucleo.nome + " " + clienteNucleo.cognome;
|
|
|
|
if (clienteNucleo.controvalore != 0)
|
|
{
|
|
//Adriano 20180125: Per includere le operazioni in corso
|
|
//Operazioni in corso
|
|
if (item.area.ToString().ToUpper().Equals("-"))
|
|
{
|
|
foreach (var pos in clienteNucleo.posizioni)
|
|
{
|
|
totOC += pos.dettaglioPortafoglio.ctv;
|
|
descrizione = string.Format("{0} - {1}", "Operazioni in corso", nomeCliente);
|
|
|
|
//Adriano 20180111: metto come campo ordine 1 nelle righe di dettaglio e 0 in quelle di testata
|
|
//ds.Tables["dettaglioContributo"].Rows.Add("", descrizione, pos.dettaglioPortafoglio.ctv, "-", "", true, false, ordinamento, ordineArea);
|
|
ds.Tables["dettaglioContributo"].Rows.Add("", descrizione, pos.dettaglioPortafoglio.ctv, "-", "", true, false, 1, ordineArea);
|
|
//--Adriano 20180111
|
|
}
|
|
}
|
|
//--Adriano 20180125
|
|
|
|
//CC
|
|
if (item.area.ToString().ToUpper().Equals("CC"))
|
|
{
|
|
//Adriano 20180110: per dettagiare anche le voci sui CC
|
|
//foreach (var pos in clienteNucleo.posizioni.Where(x => x.prodottoFinanziario.codSottoprodotto.ToString().ToUpper().Equals("SMA")))
|
|
foreach (var pos in clienteNucleo.posizioni)
|
|
{
|
|
totCC += pos.dettaglioPortafoglio.ctv;
|
|
descrizione = string.Format("{0} {1} - {2}", Helper.ReplaceVariables("$/Banca/$", EnvironmentFacade.ReportEnvironment), "C/C", nomeCliente);
|
|
|
|
//Adriano 20180111: metto come campo ordine 1 nelle righe di dettaglio e 0 in quelle di testata
|
|
//ds.Tables["dettaglioContributo"].Rows.Add("", descrizione, pos.dettaglioPortafoglio.ctv, "-", "", true, false, ordinamento, ordineArea);
|
|
ds.Tables["dettaglioContributo"].Rows.Add("", descrizione, pos.dettaglioPortafoglio.ctv, "-", "", true, false, 1, ordineArea);
|
|
//--Adriano 20180111
|
|
|
|
}
|
|
|
|
if (Math.Abs(totCC) > 0)
|
|
{
|
|
ds.Tables["dettaglioNota"].Rows.Add(item.area.ToString(), nomeCliente, clienteNucleo.nome, totCC, clienteNucleo.percentuale);
|
|
totCC = 0;
|
|
}
|
|
|
|
//--Adriano 20180110: per dettagiare anche le voci sui CC
|
|
|
|
//PRIMA DI DETTAGLIARE ANCHE I CC:
|
|
//descrizione = string.Format("{0} {1} - {2}", Helper.ReplaceVariables("$/Banca/$", EnvironmentFacade.ReportEnvironment), "C/C", nomeCliente);
|
|
//ds.Tables["dettaglioContributo"].Rows.Add("", descrizione, clienteNucleo.controvalore, "-", "", true, false, ordinamento, ordineArea++);
|
|
//ds.Tables["dettaglioNota"].Rows.Add(item.area.ToString(), nomeCliente, clienteNucleo.nome, clienteNucleo.controvalore, clienteNucleo.percentuale);
|
|
|
|
}
|
|
|
|
//SELF
|
|
if (item.area.ToString().ToUpper().Equals("SELF"))
|
|
{
|
|
//CICLA SUI GP ELIGO FONDI
|
|
foreach (var pos in clienteNucleo.posizioni.Where(x => x.prodottoFinanziario.codSottoprodotto.ToString().ToUpper().Equals("L191")))
|
|
{
|
|
totL191 += pos.dettaglioPortafoglio.ctv;
|
|
nomeLinea191 = pos.prodottoFinanziario.nomeLinea;
|
|
|
|
descrizione = string.Format("Liquidità {0} - {1}", pos.prodottoFinanziario.nomeLinea, nomeCliente);
|
|
|
|
//Adriano 20180111: metto come campo ordine 1 nelle righe di dettaglio e 0 in quelle di testata
|
|
//ds.Tables["dettaglioContributo"].Rows.Add("", descrizione, pos.dettaglioPortafoglio.ctv, "-", "", true, false, ordinamento, ordineArea);
|
|
ds.Tables["dettaglioContributo"].Rows.Add("", descrizione, pos.dettaglioPortafoglio.ctv, "-", "", true, false, 1, ordineArea);
|
|
//--Adriano 20180111
|
|
|
|
}
|
|
|
|
if (Math.Abs(totL191) > 0)
|
|
{
|
|
ds.Tables["dettaglioNota"].Rows.Add(item.area.ToString(), nomeCliente, nomeLinea191, totL191, clienteNucleo.percentuale);
|
|
totL191 = 0;
|
|
}
|
|
|
|
//CICLA SUI GP ELIGO TITOLI
|
|
foreach (var pos in clienteNucleo.posizioni.Where(x => x.prodottoFinanziario.codSottoprodotto.ToString().ToUpper().Equals("L192")))
|
|
{
|
|
totL192 += pos.dettaglioPortafoglio.ctv;
|
|
nomeLinea192 = pos.prodottoFinanziario.nomeLinea;
|
|
|
|
descrizione = string.Format("Liquidità {0} - {1}", pos.prodottoFinanziario.nomeLinea, nomeCliente);
|
|
|
|
//Adriano 20180111: metto come campo ordine 1 nelle righe di dettaglio e 0 in quelle di testata
|
|
//ds.Tables["dettaglioContributo"].Rows.Add("", descrizione, pos.dettaglioPortafoglio.ctv, "-", "", true, false, ordinamento, ordineArea);
|
|
ds.Tables["dettaglioContributo"].Rows.Add("", descrizione, pos.dettaglioPortafoglio.ctv, "-", "", true, false, 1, ordineArea);
|
|
//--Adriano 20180111
|
|
|
|
}
|
|
|
|
if (Math.Abs(totL192) > 0)
|
|
{
|
|
ds.Tables["dettaglioNota"].Rows.Add(item.area.ToString(), nomeCliente, nomeLinea192, totL192, clienteNucleo.percentuale);
|
|
totL192 = 0;
|
|
}
|
|
|
|
// 20181009 AC
|
|
// CICLA SU IL MIO FOGLIO
|
|
foreach (var pos in clienteNucleo.posizioni.Where(x => x.prodottoFinanziario.codSottoprodotto.ToString().ToUpper().Equals("V301")))
|
|
{
|
|
totV301 += pos.dettaglioPortafoglio.ctv;
|
|
nomeV301 = pos.prodottoFinanziario.nomeLinea;
|
|
|
|
descrizione = string.Format("Liquidità {0} - {1}", pos.prodottoFinanziario.nomeLinea, nomeCliente);
|
|
|
|
//Adriano 20180111: metto come campo ordine 1 nelle righe di dettaglio e 0 in quelle di testata
|
|
//ds.Tables["dettaglioContributo"].Rows.Add("", descrizione, pos.dettaglioPortafoglio.ctv, "-", "", true, false, ordinamento, ordineArea);
|
|
ds.Tables["dettaglioContributo"].Rows.Add("", descrizione, pos.dettaglioPortafoglio.ctv, "-", "", true, false, 1, ordineArea);
|
|
//--Adriano 20180111
|
|
|
|
}
|
|
|
|
if (Math.Abs(totV301) > 0)
|
|
{
|
|
ds.Tables["dettaglioNota"].Rows.Add(item.area.ToString(), nomeCliente, nomeV301, totV301, clienteNucleo.percentuale);
|
|
totV301 = 0;
|
|
}
|
|
//--20181009 AC
|
|
}
|
|
|
|
totContributoAreaCorrente += clienteNucleo.controvalore;
|
|
totPercContributoAreaCorrente += clienteNucleo.percentuale;
|
|
//ordinamento--;
|
|
}
|
|
}
|
|
ordineArea++;
|
|
}
|
|
|
|
//Adriano 20180111: metto come campo ordine 1 nelle righe di dettaglio e 0 in quelle di testata
|
|
//ds.Tables["dettaglioContributo"].Rows.Add("", string.Format("Patrimonio {0}", Helper.ReplaceVariables("$/Banca/$", EnvironmentFacade.ReportEnvironment)), totPatrimonio + totContributoAreaCorrente, "-", "", true, true, ordinamento--, ordineArea);
|
|
ds.Tables["dettaglioContributo"].Rows.Add("", string.Format("Patrimonio {0}", Helper.ReplaceVariables("$/Banca/$", EnvironmentFacade.ReportEnvironment)), totPatrimonio + totContributoAreaCorrente, "-", "", true, true, 0, ordineArea);
|
|
//--Adriano 20180111
|
|
|
|
var listaComponentiNucleo = datiSeiUnico.nucleiUnit().anagrafica.listaClientiNucleo.OrderByDescending(o => o.controvalore);
|
|
|
|
decimal totCtv = 0;
|
|
decimal totPerc = 0;
|
|
|
|
decimal nettoCtv = 0;
|
|
|
|
//int i;
|
|
//ordinamento = 0;
|
|
|
|
foreach (var item in listaComponentiNucleo)
|
|
{
|
|
//i = 0;
|
|
nettoCtv = 0;
|
|
|
|
foreach (var area in dettaglioContributoOrderBYArea)
|
|
{
|
|
foreach (var cliente in area.clienti)
|
|
{
|
|
if (cliente.codiceFiscale.Equals(item.codiceFiscale))
|
|
{
|
|
if (Convert.ToDecimal(cliente.controvalore) < 0)
|
|
{
|
|
//Modifica 20180110
|
|
//switch (area.area.ToString().ToUpper())
|
|
//{
|
|
// case "SELF":
|
|
// //ds.Tables["dettaglioNota"].Rows.Add(area.area.ToString(), item.nome + " " + item.cognome, item.controvalore, item.percentuale);
|
|
// i++;
|
|
// //Adriano: inserire nel campo [descrizione] il testo che identifichi il tipo ("GP Eligo Fondi" / "GP Eligo Titoli")
|
|
// ds.Tables["dettaglioNota"].Rows.Add(area.area.ToString(), item.nome + " " + item.cognome, i == 1 ? "GP Eligo Fondi" : "GP Eligo Titoli", cliente.controvalore, cliente.percentuale);
|
|
// //--Adriano
|
|
// break;
|
|
// case "CC":
|
|
// //ds.Tables["dettaglioNota"].Rows.Add(area.area.ToString(), item.nome + " " + item.cognome, item.controvalore, item.percentuale);
|
|
|
|
// //Adriano: inserire nel campo [descrizione] il testo
|
|
// ds.Tables["dettaglioNota"].Rows.Add(area.area.ToString(), item.nome + " " + item.cognome, "Conto Corrente", cliente.controvalore, cliente.percentuale);
|
|
// //--Adriano
|
|
// break;
|
|
//}
|
|
//Fine Modifica 20180110
|
|
nettoCtv += cliente.controvalore;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
//Adriano 20180108: se il CTV nella tabella componenti nucleo va decurtato delle voci negative:
|
|
//Adriano 20180111: imposto la colonna ordinamento con 0 per i componenti del nucleo e 1 per il patrimonio
|
|
//ds.Tables["componentiNucleo"].Rows.Add(item.nome + " " + item.cognome, item.controvalore + nettoCtv, Helper.FormatDecimal((item.percentuale * 100).ToString(), 2), false, false, ordinamento);
|
|
ds.Tables["componentiNucleo"].Rows.Add(item.nome + " " + item.cognome, item.controvalore + nettoCtv, Helper.FormatDecimal((item.percentuale * 100).ToString(), 2), false, false, 0);
|
|
//--Adriano 20180111
|
|
totCtv += item.controvalore + nettoCtv;
|
|
totPerc += item.percentuale;
|
|
//ordinamento++;
|
|
//--Adriano
|
|
}
|
|
|
|
//Adriano 20180111: ricalcolo percentuali
|
|
|
|
decimal perc = 0;
|
|
|
|
foreach (DataRow dr in ds.Tables["componentiNucleo"].Rows)
|
|
{
|
|
perc = (Convert.ToDecimal(dr["ControvaloreAttuale"]) * 100 / totCtv);
|
|
dr["PercentualeAttuale"] = Helper.FormatDecimal(perc.ToString(), 2);
|
|
}
|
|
|
|
//ds.Tables["componentiNucleo"].Rows.Add(item.nome + " " + item.cognome, item.controvalore + nettoCtv, Helper.FormatDecimal((item.percentuale * 100).ToString(), 2), false, false, ordinamento);
|
|
//ds.Tables["componentiNucleo"].Rows.Add(string.Format("Patrimonio {0}", Helper.ReplaceVariables("$/Banca/$", EnvironmentFacade.ReportEnvironment)), totCtv, Helper.FormatDecimal((totPerc * 100).ToString(), 2), true, true, ordinamento);
|
|
ds.Tables["componentiNucleo"].Rows.Add(string.Format("Patrimonio {0}", Helper.ReplaceVariables("$/Banca/$", EnvironmentFacade.ReportEnvironment)), totCtv, Helper.FormatDecimal((totPerc * 100).ToString(), 2), true, true, 1);
|
|
//--Adriano 20180111
|
|
|
|
return ds;
|
|
}
|
|
|
|
public virtual string GetNota(DataTable tNota, DataTable tComponenti)
|
|
{
|
|
List<string> notaCliente = new List<string>();
|
|
string ret = "";
|
|
string current = "";
|
|
|
|
if (tNota.Rows.Count > 0)
|
|
{
|
|
var data = tNota.AsEnumerable();
|
|
var CCData = data.Where(x => x.Field<string>("Area").ToString().ToUpper().Equals("CC")).ToList();
|
|
|
|
//Adriano: nelle due seguenti istruzioni, se nella tabella dettaglioNote (-> tNota) nel campo Descrizione ci sono i testi esatti "GP Eligo Fondi" e "GP Eligo Titoli",
|
|
// si può usare Equals, altrimenti, se c'è un testo che identifica l'uno o l'altro, vanno modificate opportunamente.
|
|
var EligoFondiData = data.Where(x => x.Field<string>("Area").ToString().ToUpper().Equals("SELF") && x.Field<string>("DescrizioneRiga").ToString().ToUpper().Equals("GP ELIGO FONDI")).ToList();
|
|
var EligoTitoliData = data.Where(x => x.Field<string>("Area").ToString().ToUpper().Equals("SELF") && x.Field<string>("DescrizioneRiga").ToString().ToUpper().Equals("GP ELIGO TITOLI")).ToList();
|
|
// 20181009 AC
|
|
var TuoFoglioData = data.Where(x => x.Field<string>("Area").ToString().ToUpper().Equals("SELF") && x.Field<string>("DescrizioneRiga").ToString().ToUpper().Equals("IL MIO FOGLIO")).ToList();
|
|
//--20181009
|
|
|
|
// 20181210
|
|
string virgola = "";
|
|
//--20181210
|
|
|
|
foreach (DataRow clientItem in tComponenti.Rows)
|
|
{
|
|
var dataCliente = data.Where(d => d.Field<string>("ComponenteNucleo").ToString().Equals(clientItem["ComponenteNucleo"]));
|
|
|
|
if (dataCliente.Count() > 0)
|
|
{
|
|
var CCDataCliente = dataCliente.Where(x => x.Field<string>("Area").ToString().ToUpper().Equals("CC")).FirstOrDefault();
|
|
|
|
//Adriano: nelle due seguenti istruzioni, se nella tabella dettaglioNote (-> tNota) nel campo Descrizione ci sono i testi esatti "GP Eligo Fondi" e "GP Eligo Titoli",
|
|
// si può usare Equals, altrimenti, se c'è un testo che identifica l'uno o l'altro, vanno modificate opportunamente.
|
|
var EligoFondiDataCliente = dataCliente.Where(x => x.Field<string>("Area").ToString().ToUpper().Equals("SELF") && x.Field<string>("DescrizioneRiga").ToString().ToUpper().Equals("GP ELIGO FONDI")).FirstOrDefault();
|
|
var EligoTitoliDataCliente = dataCliente.Where(x => x.Field<string>("Area").ToString().ToUpper().Equals("SELF") && x.Field<string>("DescrizioneRiga").ToString().ToUpper().Equals("GP ELIGO TITOLI")).FirstOrDefault();
|
|
// 20181009 AC
|
|
var TuoFoglioDataCliente = dataCliente.Where(x => x.Field<string>("Area").ToString().ToUpper().Equals("SELF") && x.Field<string>("DescrizioneRiga").ToString().ToUpper().Equals("IL MIO FOGLIO")).FirstOrDefault();
|
|
//--20181009 AC
|
|
|
|
current = string.Format("Per il cliente {0}, il controvalore esclude il saldo negativo ", clientItem["ComponenteNucleo"]);
|
|
if (CCDataCliente != null)
|
|
{
|
|
current += string.Format("dei conti correnti ({0}€)", CCDataCliente.Field<decimal>("ControvaloreAttuale").ToString("#,##0.00"));
|
|
virgola = ", ";
|
|
}
|
|
|
|
// 20181009 AC
|
|
if (TuoFoglioDataCliente != null)
|
|
{
|
|
//Adriano: la seguente istruzione prevede che nel campo DescrizioneRiga ci sia il testo esatto "IL MIO FOGLIO"
|
|
// se diversamente, si può usare l'istruzione commentata, in cui il testo è direttamente cablato nella stringa
|
|
|
|
// 20181210
|
|
//current += string.Format(", della liquidità sottostante la GP Eligo Fondi (-{1}€)", EligoFondiDataCliente.Field<string>("DescrizioneRiga").ToString(), EligoFondiDataCliente.Field<decimal>("ControvaloreAttuale").ToString("#,##0.00"));
|
|
|
|
current += virgola + string.Format("della liquidità sottostante {0} ({1}€)", TuoFoglioDataCliente.Field<string>("DescrizioneRiga").ToString(), TuoFoglioDataCliente.Field<decimal>("ControvaloreAttuale").ToString("#,##0.00"));
|
|
virgola = ", ";
|
|
//--20181210
|
|
}
|
|
//--20181009 AC
|
|
|
|
if (EligoFondiDataCliente != null)
|
|
{
|
|
//Adriano: la seguente istruzione prevede che nel campo DescrizioneRiga ci sia il testo esatto "GP Eligo Fondi"
|
|
// se diversamente, si può usare l'istruzione commentata, in cui il testo è direttamente cablato nella stringa
|
|
|
|
// 20181210
|
|
//current += string.Format(", della liquidità sottostante la {0} ({1}€)", EligoFondiDataCliente.Field<string>("DescrizioneRiga").ToString(), EligoFondiDataCliente.Field<decimal>("ControvaloreAttuale").ToString("#,##0.00"));
|
|
current += virgola + string.Format("della liquidità sottostante la {0} ({1}€)", EligoFondiDataCliente.Field<string>("DescrizioneRiga").ToString(), EligoFondiDataCliente.Field<decimal>("ControvaloreAttuale").ToString("#,##0.00"));
|
|
|
|
virgola = ", ";
|
|
//--20181210
|
|
//current += string.Format(", della liquidità sottostante la GP Eligo Fondi (-{1}€)", EligoFondiDataCliente.Field<string>("DescrizioneRiga").ToString(), EligoFondiDataCliente.Field<decimal>("ControvaloreAttuale").ToString("#,##0.00"));
|
|
}
|
|
|
|
if (EligoTitoliDataCliente != null)
|
|
{
|
|
//Adriano: la seguente istruzione prevede che nel campo DescrizioneRiga ci sia il testo esatto "GP Eligo Titoli"
|
|
// se diversamente, si può usare l'istruzione commentata, in cui il testo è direttamente cablato nella stringa
|
|
|
|
// 20181210
|
|
//current += string.Format(", della liquidità sottostante la {0} ({1}€)", EligoTitoliDataCliente.Field<string>("DescrizioneRiga").ToString(), EligoTitoliDataCliente.Field<decimal>("ControvaloreAttuale").ToString("#,##0.00"));
|
|
|
|
current += virgola + string.Format("della liquidità sottostante la {0} ({1}€)", EligoTitoliDataCliente.Field<string>("DescrizioneRiga").ToString(), EligoTitoliDataCliente.Field<decimal>("ControvaloreAttuale").ToString("#,##0.00"));
|
|
|
|
virgola = ", ";
|
|
//--20181210
|
|
|
|
//current += string.Format(", della liquidità sottostante la GP Eligo Titoli (-{1}€)", EligoTitoliDataCliente.Field<string>("DescrizioneRiga").ToString(), EligoTitoliDataCliente.Field<decimal>("ControvaloreAttuale").ToString("#,##0.00"));
|
|
}
|
|
|
|
if (!string.IsNullOrEmpty(current))
|
|
{
|
|
clientItem["ComponenteNucleo"] += "*";
|
|
notaCliente.Add(current);
|
|
}
|
|
}
|
|
|
|
// 20181210
|
|
virgola = "";
|
|
//--20181210
|
|
}
|
|
|
|
// 20181210
|
|
virgola = "";
|
|
//--20181210
|
|
|
|
current = string.Format("Per il patrimonio {0} del Nucleo, il controvalore esclude il saldo negativo ", Helper.ReplaceVariables("$/Banca/$", EnvironmentFacade.ReportEnvironment));
|
|
|
|
if (CCData.Count > 0)
|
|
{
|
|
current += string.Format("dei conti correnti ({0}€)", CCData.Sum(x => x.Field<decimal>("ControvaloreAttuale")).ToString("#,##0.00"));
|
|
// 20181210
|
|
virgola = ", ";
|
|
//20181210
|
|
}
|
|
|
|
// 20181009 AC
|
|
if (TuoFoglioData.Count > 0)
|
|
{
|
|
//Adriano: la seguente istruzione prevede che nel campo DescrizioneRiga ci sia il testo esatto "Il Mio Foglio"
|
|
// se diversamente, si può usare l'istruzione commentata, in cui il testo è direttamente cablato nella stringa
|
|
|
|
// 20181210
|
|
//current += string.Format(", della liquidità sottostante la GP Eligo Fondi (-{1}€)", EligoFondiData.Select(x => x.Field<string>("DescrizioneRiga")).FirstOrDefault().ToString(), EligoFondiData.Sum(x => x.Field<decimal>("ControvaloreAttuale")).ToString("#,##0.00"));
|
|
current += virgola + string.Format("della liquidità sottostante {0} ({1}€)", TuoFoglioData.Select(x => x.Field<string>("DescrizioneRiga")).FirstOrDefault().ToString(), TuoFoglioData.Sum(x => x.Field<decimal>("ControvaloreAttuale")).ToString("#,##0.00"));
|
|
virgola = ", ";
|
|
//--20181210
|
|
}
|
|
//--20181009
|
|
|
|
if (EligoFondiData.Count > 0)
|
|
{
|
|
//Adriano: la seguente istruzione prevede che nel campo DescrizioneRiga ci sia il testo esatto "GP Eligo Fondi"
|
|
// se diversamente, si può usare l'istruzione commentata, in cui il testo è direttamente cablato nella stringa
|
|
|
|
// 20181210
|
|
//current += string.Format(", della liquidità sottostante la {0} ({1}€)", EligoFondiData.Select(x => x.Field<string>("DescrizioneRiga")).FirstOrDefault().ToString(), EligoFondiData.Sum(x => x.Field<decimal>("ControvaloreAttuale")).ToString("#,##0.00"));
|
|
current += virgola + string.Format("della liquidità sottostante la {0} ({1}€)", EligoFondiData.Select(x => x.Field<string>("DescrizioneRiga")).FirstOrDefault().ToString(), EligoFondiData.Sum(x => x.Field<decimal>("ControvaloreAttuale")).ToString("#,##0.00"));
|
|
virgola = ", ";
|
|
//--20181210
|
|
//current += string.Format(", della liquidità sottostante la GP Eligo Fondi (-{1}€)", EligoFondiData.Select(x => x.Field<string>("DescrizioneRiga")).FirstOrDefault().ToString(), EligoFondiData.Sum(x => x.Field<decimal>("ControvaloreAttuale")).ToString("#,##0.00"));
|
|
}
|
|
|
|
if (EligoTitoliData.Count > 0)
|
|
{
|
|
//Adriano: la seguente istruzione prevede che nel campo DescrizioneRiga ci sia il testo esatto "GP Eligo Titoli"
|
|
// se diversamente, si può usare l'istruzione commentata, in cui il testo è direttamente cablato nella stringa
|
|
|
|
// 20181210
|
|
//current += string.Format(", della liquidità sottostante la {0} ({1}€)", EligoTitoliData.Select(x => x.Field<string>("DescrizioneRiga")).FirstOrDefault().ToString(), EligoTitoliData.Sum(x => x.Field<decimal>("ControvaloreAttuale")).ToString("#,##0.00"));
|
|
current += virgola + string.Format("della liquidità sottostante la {0} ({1}€)", EligoTitoliData.Select(x => x.Field<string>("DescrizioneRiga")).FirstOrDefault().ToString(), EligoTitoliData.Sum(x => x.Field<decimal>("ControvaloreAttuale")).ToString("#,##0.00"));
|
|
virgola = ",";
|
|
//--20181210
|
|
|
|
//current += string.Format(", della liquidità sottostante la GP Eligo Titoli (-{1}€)", EligoTitoliData.Select(x => x.Field<string>("DescrizioneRiga")).FirstOrDefault().ToString(), EligoTitoliData.Sum(x => x.Field<decimal>("ControvaloreAttuale")).ToString("#,##0.00"));
|
|
}
|
|
|
|
if (!string.IsNullOrEmpty(current))
|
|
notaCliente.Add(current);
|
|
}
|
|
|
|
foreach (var s in notaCliente)
|
|
{
|
|
ret += string.Format("{0}. ", s);
|
|
}
|
|
|
|
return ret;
|
|
}
|
|
|
|
public virtual string GetTestoIntro()
|
|
{
|
|
//return datiSeiUnico.FormatBanca("In questa scheda è riportata l'allocazione corrente sulle aree di bisogno delle risorse finanziarie, associate al nucleo, che i componenti detengono presso $/Banca/$.");
|
|
return datiSeiUnico.FormatBanca("Nella tabella sottostante è mostrato il patrimonio, associato al nucleo, che i componenti detengono presso $/Banca/$.");
|
|
}
|
|
|
|
public virtual string GetTestoPiramide()
|
|
{
|
|
return datiSeiUnico.FormatBanca("Di seguito è riportata l'allocazione corrente sulle aree di bisogno delle risorse finanziarie, associate al nucleo, che i componenti detengono presso $/Banca/$.");
|
|
}
|
|
|
|
public virtual string GetTestoTabella()
|
|
{
|
|
return datiSeiUnico.FormatBanca("Nella tabella sottostante è mostrato il dettaglio della composizione sulle aree di bisogno del patrimonio finanziario del nucleo, in funzione dell'allocazione sulle aree dei componenti.");
|
|
}
|
|
}
|
|
} |