311 lines
13 KiB
C#
311 lines
13 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using ceTe.DynamicPDF;
|
|
using ceTe.DynamicPDF.Text;
|
|
using PDFGenerator.Presentation.Section.Tables;
|
|
using PDFGenerator.BusinessLayer.DataSection;
|
|
using PDFGenerator.BusinessLayer;
|
|
using ceTe.DynamicPDF.PageElements;
|
|
using System.Collections.Generic;
|
|
using System.Data;
|
|
using NLog;
|
|
|
|
namespace PDFGenerator.Presentation.Section
|
|
{
|
|
public class S182 : ISezione
|
|
{
|
|
private static readonly NLog.Logger logger = NLog.LogManager.GetCurrentClassLogger();
|
|
|
|
// N.B. : questa classe è completamente diversa dalla FD182
|
|
string Titolo = string.Empty;
|
|
string _testotitolo;
|
|
string _testointroduttivo;
|
|
string _testoAlternativo;
|
|
public int widthImporti = 60;
|
|
public int widthData = 50;
|
|
public int fontsize = 6;
|
|
public int headerFontSize = 5;
|
|
|
|
|
|
/// <summary>
|
|
/// Testo introduttivo della sezione.
|
|
/// </summary>
|
|
public string TestoIntroduttivo
|
|
{
|
|
get
|
|
{
|
|
return _testointroduttivo;
|
|
}
|
|
set
|
|
{
|
|
_testointroduttivo = value;
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// Testo del titolo della sezione.
|
|
/// </summary>
|
|
public string TestoTitolo
|
|
{
|
|
get
|
|
{
|
|
return _testotitolo;
|
|
}
|
|
set
|
|
{
|
|
_testotitolo = value;
|
|
}
|
|
}
|
|
|
|
public string TestoAlternativo
|
|
{
|
|
get { return _testoAlternativo; }
|
|
set { _testoAlternativo = value; }
|
|
}
|
|
|
|
public void setTitolo(string label)
|
|
{
|
|
Titolo = label;
|
|
}
|
|
|
|
public S182()
|
|
{
|
|
//
|
|
// TODO: Add constructor logic here
|
|
//
|
|
}
|
|
|
|
#region ISezione Members
|
|
public void writeSezione(DataThread dataThread)
|
|
{
|
|
|
|
dataThread.SETDATA();
|
|
DocumentPDF document = dataThread.DocumentPDF;
|
|
DataSetS182DettaglioProdottiESG set = (DataSetS182DettaglioProdottiESG)dataThread.Data.DatiSezione;
|
|
DatiTabella datitab = new DatiTabella();
|
|
|
|
//datitab.table = set.Tables["dtDettaglioProdottiESG"];
|
|
|
|
set.Tables["Prodotti"].Columns.Add("Immagine");
|
|
datitab.table = set.Tables["Prodotti"];
|
|
|
|
#region Titolo Seconda tabella
|
|
// Titolo della sezione
|
|
|
|
switch (dataThread.Rete)
|
|
{
|
|
case "F":
|
|
{
|
|
_testointroduttivo = _testointroduttivo.Replace("$/Banca/$", "Fideuram");
|
|
break;
|
|
}
|
|
case "S":
|
|
{
|
|
_testointroduttivo = _testointroduttivo.Replace("$/Banca/$", "Fideuram S.p.A., commercializzati tramite la rete di private banker Sanpaolo Invest,");
|
|
break;
|
|
}
|
|
case "W":
|
|
{
|
|
_testointroduttivo = _testointroduttivo.Replace("$/Banca/$", "IW Private Investments");
|
|
break;
|
|
}
|
|
}
|
|
|
|
logger.Info("Titolo della sezione " + _testointroduttivo);
|
|
document.setLastPos(-40);
|
|
document.setChapterHeader(string.Concat(_testointroduttivo, "<br>"), 0, 520, 8);
|
|
#endregion
|
|
|
|
|
|
#region Tabella
|
|
|
|
/***** Disegno la tabella con oggetti della solution trimestrale *************/
|
|
int widthTotaleAltre = calculateWidth();
|
|
int widthNomeProdotto = 520 - widthTotaleAltre + 25;
|
|
|
|
/** Creo una tabella solo per header **/
|
|
Tabella tabellaDati = new Tabella(document.getMargineLeft(), document.getLastPos(), 2, 0, 0.02F);
|
|
tabellaDati.Header = true;
|
|
tabellaDati.HeaderFont = 8;
|
|
tabellaDati.Datasource = datitab.table;
|
|
tabellaDati.AltezzaCella = 23; //15;
|
|
tabellaDati.LineaFineTabella = false;
|
|
tabellaDati.WithImage = true;
|
|
|
|
string col_prodotto = Utility.setColoreTesto("Prodotto", dataThread);
|
|
string col_CatSFDR = Utility.setColoreTesto("Categoria SFDR", dataThread);
|
|
string col_ESGRating = Utility.setColoreTesto("ESG Rating", dataThread);
|
|
string col_Controvalore = Utility.setColoreTesto("Controvalore(€)", dataThread);
|
|
|
|
tabellaDati.Colonne.Add(new Colonna("NomeProdotto", col_prodotto, widthNomeProdotto, TipoAllineamento.SINISTRA, false, tabellaDati.HeaderFont, false));
|
|
tabellaDati.Colonne.Add(new Colonna("Nome_Progetto", string.Empty, 0, TipoAllineamento.SINISTRA, false, tabellaDati.HeaderFont, false));
|
|
tabellaDati.Colonne.Add(new Colonna("preferenzaE", string.Empty, widthData - 5, TipoAllineamento.SINISTRA, false, tabellaDati.HeaderFont, false, TipoColonna.TESTO));
|
|
tabellaDati.Colonne.Add(new Colonna("preferenzaS", string.Empty, widthData - 5, TipoAllineamento.SINISTRA, false, tabellaDati.HeaderFont, false, TipoColonna.TESTO));
|
|
tabellaDati.Colonne.Add(new Colonna("preferenzaG", string.Empty, widthData - 5, TipoAllineamento.SINISTRA, false, tabellaDati.HeaderFont, false, TipoColonna.TESTO));
|
|
tabellaDati.Colonne.Add(new Colonna("CatSFDR", col_CatSFDR, widthData + 35, TipoAllineamento.SINISTRA, false, tabellaDati.HeaderFont, false, TipoColonna.TESTO));
|
|
tabellaDati.Colonne.Add(new Colonna("ESGRating", col_ESGRating, widthData + 10, TipoAllineamento.SINISTRA, false, tabellaDati.HeaderFont, false, TipoColonna.IMMAGINE));
|
|
tabellaDati.Colonne.Add(new Colonna("Controvalore", col_Controvalore, widthImporti + 50, TipoAllineamento.DESTRA, false, tabellaDati.HeaderFont, false, TipoColonna.TESTO));
|
|
tabellaDati.DrawESG(datitab, document);
|
|
|
|
#region Nuova versione Tabella Totale Risorse Finanziarie
|
|
// Recupero le altezze delle tabelle
|
|
float dim = tabellaDati.AltezzaTabella + 27;
|
|
|
|
Tabella tabellaTotali_OUT = null;
|
|
|
|
if (dataThread.Periodico)
|
|
{
|
|
if (set.Tables["ProdottiTRF"].Rows[0][1].Equals("TOTALE RISORSE FINANZIARIE"))
|
|
{
|
|
DataSet _ds = new DataSet();
|
|
DataTable _dt = new DataTable();
|
|
_dt.Columns.Add("PatrimonioFideuram", typeof(System.String));
|
|
_dt.Columns.Add("Totale", typeof(System.String));
|
|
|
|
_ds.Tables.Add(_dt);
|
|
DataRow dr = _dt.NewRow();
|
|
dr[0] = "Totale Risorse Finanziarie";
|
|
dr[1] = set.Tables["ProdottiTRF"].Rows[0]["Controvalore"];
|
|
|
|
_dt.Rows.Add(dr);
|
|
|
|
datitab = new DatiTabella();
|
|
datitab.table = _dt;
|
|
|
|
tabellaTotali_OUT = new Tabella(document.getMargineLeft(), document.getLastPos() + dim);
|
|
tabellaTotali_OUT.HeaderFont = 8;
|
|
tabellaTotali_OUT.Header = false;
|
|
tabellaTotali_OUT.SaltoPagina = false;
|
|
|
|
tabellaTotali_OUT.Colonne.Add(new Colonna("PatrimonioFideuram", "", 150, TipoAllineamento.SINISTRA, true, 8, true));
|
|
tabellaTotali_OUT.Colonne.Add(new Colonna("Totale", "", 365, TipoAllineamento.DESTRA, true, 8, true));
|
|
|
|
// Scrive la tabella Totale Risorse Finanziari
|
|
tabellaTotali_OUT.Draw(datitab, document);
|
|
}
|
|
}
|
|
#endregion
|
|
|
|
#region Tabella Dettaglio Risorse Finanziarie
|
|
Tabella tabellaDettTRF = null;
|
|
if (dataThread.Periodico)
|
|
{
|
|
if (set.Tables["ProdottiTRF"].Rows[0][1].Equals("TOTALE RISORSE FINANZIARIE"))
|
|
{
|
|
dim = dim + tabellaTotali_OUT.AltezzaTabella;
|
|
#region Dettaglio
|
|
// Tabella Dettaglio risorse Finanziarie
|
|
DataTable _dtDettTRF = new DataTable();
|
|
_dtDettTRF.Columns.Add("PatrimonioFideuramDett", typeof(System.String));
|
|
_dtDettTRF.Columns.Add("TotaleDett", typeof(System.String));
|
|
|
|
var ListaDettTrf = set.Tables["ProdottiTRF"].AsEnumerable().Where(f => f.Field<string>("Descrizione") == string.Empty).Select(s => s).ToList();
|
|
|
|
foreach (var itemDetTRF in ListaDettTrf)
|
|
{
|
|
DataRow drDettTRF = _dtDettTRF.NewRow();
|
|
|
|
drDettTRF[0] = itemDetTRF[5].ToString();
|
|
drDettTRF[1] = itemDetTRF["Controvalore"].ToString();
|
|
|
|
_dtDettTRF.Rows.Add(drDettTRF);
|
|
}
|
|
|
|
datitab = new DatiTabella();
|
|
datitab.table = _dtDettTRF;
|
|
|
|
tabellaDettTRF = new Tabella(document.getMargineLeft(), document.getLastPos() + dim);
|
|
tabellaDettTRF.HeaderFont = 8;
|
|
tabellaDettTRF.Header = false;
|
|
tabellaDettTRF.SaltoPagina = false;
|
|
|
|
tabellaDettTRF.Colonne.Add(new Colonna("PatrimonioFideuramDett", "", 150, TipoAllineamento.SINISTRA, false, 8, false));
|
|
tabellaDettTRF.Colonne.Add(new Colonna("TotaleDett", "", 365, TipoAllineamento.DESTRA, false, 8, false));
|
|
|
|
// Scrive la tabella Totale Risorse Finanziari
|
|
tabellaDettTRF.Draw(datitab, document);
|
|
#endregion
|
|
}
|
|
}
|
|
#endregion
|
|
|
|
#region Tabella Totale Patrimonio
|
|
if (set.Tables["ProdottiTRF"].Rows[0][1].Equals("TOTALE RISORSE FINANZIARIE"))
|
|
dim = dim + tabellaDettTRF.AltezzaTabella;
|
|
|
|
DataTable _dtTotalePatrimonio = new DataTable();
|
|
_dtTotalePatrimonio.Columns.Add("DescrizioneTP", typeof(System.String));
|
|
_dtTotalePatrimonio.Columns.Add("TotalePatrimonio", typeof(System.String));
|
|
|
|
var listaTotalePatrimonio = set.Tables["ProdottiTRF"].AsEnumerable().Where(f => f.Field<string>("Descrizione").Equals("TOTALE PATRIMONIO")).Select(s => s).ToList();
|
|
|
|
foreach (var itemTP in listaTotalePatrimonio)
|
|
{
|
|
DataRow drTotP = _dtTotalePatrimonio.NewRow();
|
|
drTotP[0] = itemTP["Descrizione"].ToString();
|
|
drTotP[1] = itemTP["Controvalore"].ToString();
|
|
|
|
_dtTotalePatrimonio.Rows.Add(drTotP);
|
|
}
|
|
|
|
datitab = new DatiTabella();
|
|
datitab.table = _dtTotalePatrimonio;
|
|
|
|
Tabella tabellaTotP = new Tabella(document.getMargineLeft(), document.getLastPos() + dim);
|
|
tabellaTotP.HeaderFont = 8;
|
|
tabellaTotP.Header = false;
|
|
tabellaTotP.SaltoPagina = false;
|
|
|
|
tabellaTotP.Colonne.Add(new Colonna("DescrizioneTP", "", 150, TipoAllineamento.SINISTRA, true, 8, true));
|
|
tabellaTotP.Colonne.Add(new Colonna("TotalePatrimonio", "", 365, TipoAllineamento.DESTRA, true, 8, true));
|
|
|
|
// Scrive la tabella Totale Risorse Finanziari
|
|
tabellaTotP.Draw(datitab, document);
|
|
#endregion
|
|
|
|
#region Nota tabella
|
|
//string nota = "*Il controvalore non considera i saldi negativi di conto corrente e/o le operazioni in corso.";
|
|
|
|
//document.setSezFooter(nota, tabellaDati.AltezzaTabella + tabellaTotali_OUT.AltezzaTabella + tabellaTotali_OUT.AltezzaCella, 0, 7);
|
|
//tabellaTotali_OUT.NotaTabella.Add(nota);
|
|
|
|
|
|
#endregion
|
|
|
|
#endregion
|
|
/*** ATTENZIONE Forzatura - Pino ************************/
|
|
//dataThread.Periodico = true;
|
|
//dataThread.CodiceFiscale = "DGSMHL70H08Z404F";
|
|
//dataThread.Rete = "S";
|
|
/********************************************************/
|
|
|
|
|
|
/*** TEST - Verifica Tempistica 09/11/2023 - Pino ****/
|
|
/*** Inserimento log per verifica tempistica della sezione ***/
|
|
//DateTimeOffset dateOffsetValueFin = DateTimeOffset.Parse(DateTime.Now.ToString("hh:mm:ss.ffff"));
|
|
//var tDiff = dateOffsetValueFin - dateOffsetValueIni;
|
|
//logger.Trace("S182 " + tDiff);
|
|
/*************************************************************/
|
|
}
|
|
|
|
protected int calculateWidth()
|
|
{
|
|
int tot = 0;
|
|
tot += widthImporti;
|
|
tot += widthImporti;
|
|
tot += widthImporti;
|
|
tot += widthImporti;
|
|
tot += widthImporti;
|
|
tot += widthImporti;
|
|
tot += widthImporti;
|
|
return tot;
|
|
|
|
}
|
|
|
|
#endregion
|
|
|
|
}
|
|
}
|