2025-06-03 15:11:16 +02:00

1406 lines
67 KiB
C#
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

using System;
using System.Collections.Generic;
using System.Text;
using System.Data;
using ceTe.DynamicPDF.Merger;
using PDFGenerator.BusinessLayer.DataSection;
using PDFGenerator.Presentation.Section.Tables;
using PDFGenerator.BusinessLayer;
using ceTe.DynamicPDF.Text;
using PDFGenerator.Presentation.Section;
using ceTe.DynamicPDF.PageElements;
using System.Linq;
using NLog;
namespace PDFGenerator.Presentation.Section
{
public class FD43BIS : ISezione
{
private static NLog.Logger logger = NLog.LogManager.GetCurrentClassLogger();
string Titolo = " ";
DataSetS43BIS set;
ImportedPage page;
private bool _versatonetto_utileperdita = false;
private bool _mostrarendimentodainizioanno = false;
private bool _mostrarendimentodadatasottoscrizione = false;
// private bool _mostratitolosezione = false;
//MIFID2 20180420
string notaSezione = string.Empty;
bool notaSezioneStampata = false;
bool moreTables = false;
int tableCount;
//--MIFID2
private TipologiaReport _tipologiaReport = TipologiaReport.MONITORAGGIO; // la S43BIS è usata solo per il monitoraggio fase 2 (monitoraggio senza albero.)
public FD43BIS()
{
}
string _Area;
string _Progetto;
private string _titolosezione = string.Empty;
private string _ordinamentoProgetto = string.Empty;
#region ISezione Members
public void writeSezione(DataThread dataThread)
{
bool _mostratitolosezione = true;
DocumentPDF document = dataThread.DocumentPDF;
DatiTabella datitab = new DatiTabella();
set = (DataSetS43BIS)dataThread.Data.DatiSezione;
//MIFID2 20180529 decremento il conteggio delle aree da stampare (per MONITORAGGIO)
document.AreasCount--;
//--MIFID2
//MIFID2 20180424
notaSezione = dataThread.SezioneReport.Nota;
//notaSezione = "NOTA PROVA 43Bis " + dataThread.Area;
/************* Modifica per la gestione della nota dinamica in base ai prodotti FAI 11/03/2021 - Pino *********************/
//string testoNotaFAI = " Il controvalore dei fondi Perennius Global Yield Private 2011, Idea Crescita Globale, FAI Private Debt Special Opportunities e FAI Private Markets Insight esposto nella rendicontazione è determinato tramite il NAV trimestrale al #dataFAI# (ultimo disponibile alla data di predisposizione del presente rendiconto) al netto delle distribuzioni avvenute nel trimestre e accreditate sul conto corrente indicato in fase di sottoscrizione.";
string testoNotaFAI = " Il controvalore dei fondi di Investimento alternativi è determinato tenuto conto del NAV ufficiale trimestrale al #dataFAI# (ultimo disponibile alla data di predisposizione del presente rendiconto) al netto di eventuali richiami e/o distribuzioni di capitale effettuati successivamente.";
string _flagNotaFAI = set.FlagNotaFAI.Rows[0][0].ToString();
if (_flagNotaFAI == "S")
{
testoNotaFAI = testoNotaFAI.Replace("#dataFAI#", set.FlagNotaFAI.Rows[0][1].ToString());
notaSezione += testoNotaFAI;
}
/***************************************************************************************************************************/
document.NotaPieDiPagina = notaSezione;
// Controlla se ci sono vari codici aree bisogno, in tal caso la nota statica va a fondo pagina, altrimenti, se c'è un solo codice area, va a fine tabella
DataView viewDistinctAreas = new DataView(set.Tables["ProdottiAreeBisogno"]);
DataTable distinctValues = viewDistinctAreas.ToTable(true, "CodiceAreaBisogno");
moreTables = distinctValues.Rows.Count > 1;
//--MIFID2
//if (document.checkMargin(datitab.GetRowDim() * 5)) {
// document.addPage();
//}
dataThread.UltimaSezioneStampata = "";
page = document.getCurrentPage();
DataView view;
#region stampo solo Robo
datitab.table = set.Tables["ProdottiAreeBisogno"];
DataRow[] drFilterAreaProgetto;
string titoloRibilanciato = "Portafoglio Direct Evo"; //"Portafoglio Ribilanciato";
drFilterAreaProgetto = set.Tables["ProdottiAreeBisogno"].Select(" CodiceAreaBisogno = 'Rob'");
if (drFilterAreaProgetto.Length > 0)
{
//MIFID2 20180514 se cambia pagina resetto il flag notastampata
//orig:
//if (document.checkMargin(datitab.GetRowDim() * 4))
// document.addPage();
if (document.checkMargin(datitab.GetRowDim() * 4))
{
document.addPage();
notaSezioneStampata = false;
}
//--MIFID2
//if (_mostratitolosezione)
//{
// if (string.IsNullOrEmpty(_titolosezione))
// {
// if (!titoloRibilanciato.Equals(""))
// {
// document.setTitolo(titoloRibilanciato);
// document.setSezTitoloWithoutNumber(drFilterAreaProgetto[0].Field<string>("Progetto").ToString());
// titoloRibilanciato = "";
// }
// }
// else
// document.setTitolo(_titolosezione);
//}
this.writeArea(datitab, document, "Rob", dataThread);
//MIFID2 20180514 una volta stampata la tabella, decremento il contatore
//tableCount--;
}
#endregion
//if (_Area == null || _Area == "Liq")
//{
// datitab.table = set.Tables["ProdottiAreeBisogno"];
// view = new DataView(datitab.table);
// view.RowFilter = ("CodiceAreaBisogno = 'Liq'");
// if (view.Count > 0)
// {
// //MIFID2 20180528 se cambia pagina resetto il flag notastampata
// //orig:
// //if (document.checkMargin(datitab.GetRowDim() * 4))
// // document.addPage();
// if (document.checkMargin(datitab.GetRowDim() * 4))
// {
// document.addPage();
// notaSezioneStampata = false;
// }
// //--MIFID2
// this.writeArea(datitab, document, "Liq", dataThread);
// }
//}
//if (Area == null || Area == "Ris")
//{
// datitab.table = set.Tables["ProdottiAreeBisogno"];
// view = new DataView(datitab.table);
// view.RowFilter = ("CodiceAreaBisogno = 'Ris'");
// if (view.Count > 0)
// {
// //MIFID2 20180528 se cambia pagina resetto il flag notastampata
// //orig:
// //if (document.checkMargin(datitab.GetRowDim() * 4))
// // document.addPage();
// if (document.checkMargin(datitab.GetRowDim() * 4))
// {
// document.addPage();
// notaSezioneStampata = false;
// }
// //--MIFID2
// this.writeArea(datitab, document, "Ris", dataThread);
// }
//}
//if (Area == null || Area == "Pre")
//{
// datitab.table = set.Tables["ProdottiAreeBisogno"];
// view = new DataView(datitab.table);
// view.RowFilter = ("CodiceAreaBisogno = 'Pre'");
// if (view.Count > 0)
// {
// //MIFID2 20180528 se cambia pagina resetto il flag notastampata
// //orig:
// //if (document.checkMargin(datitab.GetRowDim() * 4))
// // document.addPage();
// if (document.checkMargin(datitab.GetRowDim() * 4))
// {
// document.addPage();
// notaSezioneStampata = false;
// }
// //--MIFID2
// this.writeArea(datitab, document, "Pre", dataThread);
// }
//}
//if (Area == null || Area == "Inv")
//{
// datitab.table = set.Tables["ProdottiAreeBisogno"];
// view = new DataView(datitab.table);
// view.RowFilter = ("CodiceAreaBisogno = 'Inv'");
// if (view.Count > 0)
// {
// //MIFID2 20180528 se cambia pagina resetto il flag notastampata
// //orig:
// //if (document.checkMargin(datitab.GetRowDim() * 4))
// // document.addPage();
// if (document.checkMargin(datitab.GetRowDim() * 4))
// {
// document.addPage();
// notaSezioneStampata = false;
// }
// //--MIFID2
// this.writeAreaProgetto(datitab, document, "Inv", dataThread.Progetto, dataThread);
// }
//}
//if (Area == null || Area == "Ext")
//{
// datitab.table = set.Tables["ProdottiAreeBisogno"];
// view = new DataView(datitab.table);
// view.RowFilter = ("CodiceAreaBisogno = 'Ext'");
// if (view.Count > 0)
// {
// //MIFID2 20180528 se cambia pagina resetto il flag notastampata
// //orig:
// //if (document.checkMargin(datitab.GetRowDim() * 4))
// // document.addPage();
// if (document.checkMargin(datitab.GetRowDim() * 4))
// {
// document.addPage();
// notaSezioneStampata = false;
// }
// //--MIFID2
// this.writeArea(datitab, document, "Ext", dataThread);
// }
//}
//if (Area == null || Area == "Na")
//{
// // Risorse non associate
// datitab.table = set.Tables["ProdottiAreeBisogno"];
// view = new DataView(datitab.table);
// view.RowFilter = ("CodiceAreaBisogno = 'Na'");
// if (view.Count > 0)
// {
// if (Area == null)
// //MIFID2 20180528 se cambia pagina resetto il flag notastampata
// //orig:
// //if (document.checkMargin(datitab.GetRowDim() * 4))
// // document.addPage();
// if (document.checkMargin(datitab.GetRowDim() * 4))
// {
// document.addPage();
// notaSezioneStampata = false;
// }
// //--MIFID2
// this.writeArea(datitab, document, "Na", dataThread);
// }
//}
if (document.Areas.Rows.Count == 0)
{
var segnaposto = 0;
if (document.DocumentNotes.Rows.Count > 0)
document.WriteNote2(notaSezione, dataThread.IsSavingMap, dataThread.IsAPC103);
}
document.setLastPos(5);
}
#endregion
/// <summary>
/// Disegna la tabella per il dettaglio monitoraggio x Area.
/// </summary>
/// <param name="datitab"></param>
/// <param name="document"></param>
/// <param name="area"></param>
private void writeArea(DatiTabella datitab, DocumentPDF document, string area, DataThread dataThread)
{
dataThread.SETDATA();
//MIFID2 20180528
tableCount--;
//--MIFID2
//MIFID2 20180529 Elimino dalla proprietà datatable del document la riga relativa all'area che sto stampando
if (dataThread.TipoReport.ToUpper().Equals("MONITORAGGIO"))
{
foreach (DataRow row in document.Areas.Rows)
{
if (row.Field<string>("NEED_AREA").ToUpper().Equals(area.ToUpper()))
row.Delete();
}
document.Areas.AcceptChanges();
}
//--MIFID2
float dim = 0;
page = document.getCurrentPage();
FormatNum conv = new FormatNum();
string notaGradoCopertura = string.Empty;
//setta la datatable
datitab.table = set.Tables["ProdottiAreeBisogno"];
// filtro per l'area
DataView view = new DataView(datitab.table);
view.RowFilter = ("CodiceAreaBisogno = '" + area + "'");
datitab.table = view.ToTable();
#region Tabella Dati
// Disegno la tabella
Tabella tabellaDettaglio_Area = new Tabella(document.getMargineLeft(), document.getLastPos());
tabellaDettaglio_Area.HeaderFont = 8;
tabellaDettaglio_Area.Header = true;
tabellaDettaglio_Area.Datasource = datitab.table;
tabellaDettaglio_Area.Id = "tabella_S43BIS" + area;
tabellaDettaglio_Area.AltezzaCella = 23;
tabellaDettaglio_Area.LineaFineTabella = true;
#region Settaggio delle Note di piè di pagina e delle note a piedi della tabella
//MIFID2 20180619 Se il documento non ha nessuna nota nella lista di note, mi serve aggiungerne una "finta" per avere il numero di asterischi che parte da 2 (includendo la nota fissa sul Ctv)
if (document.Note.Count == 0)
document.Note.Add(new Nota(Nota.TipologiaNota.NonImpostato, tabellaDettaglio_Area.Id, ""));
//--MIFID2
//Nota a piedi della tabella
// Imposto la nota a piedi della Tabella
notaGradoCopertura = datitab.table.Rows[0]["Copertura"] == DBNull.Value ? string.Empty : datitab.table.Rows[0]["Copertura"].ToString();
if (notaGradoCopertura.Length > 0)
{
document.Note.Add(new Nota(Nota.TipologiaNota.GradoCopertura, tabellaDettaglio_Area.Id, notaGradoCopertura));
tabellaDettaglio_Area.NotaTabella.Add(document.Note.Find(Nota.TipologiaNota.GradoCopertura, tabellaDettaglio_Area.Id).Testo);
}
document.Note.RemoveAt(0);
#endregion
//tabellaDettaglio_Area.Colonne.Add(new Colonna("DataAssociazione", "Data ass.", 60, TipoAllineamento.SINISTRA, false, 7, false));
//tabellaDettaglio_Area.Colonne.Add(new Colonna("<IMAGE>", " ", 5, TipoAllineamento.DESTRA, false, 7, false, TipoColonna.IMMAGINE));
//tabellaDettaglio_Area.Colonne.Add(new Colonna("Descrizione", "Descrizione", 87, TipoAllineamento.SINISTRA, false, 7, false));
tabellaDettaglio_Area.Colonne.Add(new Colonna("DataAssociazione", "Data ass.", 45, TipoAllineamento.SINISTRA, false, 7, false));
tabellaDettaglio_Area.Colonne.Add(new Colonna("<IMAGE>", " ", 5, TipoAllineamento.DESTRA, false, 7, false, TipoColonna.IMMAGINE));
tabellaDettaglio_Area.Colonne.Add(new Colonna("Descrizione", "Descrizione", 110, TipoAllineamento.SINISTRA, false, 7, false));
//tabellaDettaglio_Area.Colonne.Add(new Colonna("DataAssociazione", "Data assoc.", 55, TipoAllineamento.SINISTRA, false, 7, false));
//tabellaDettaglio_Area.Colonne.Add(new Colonna("<IMAGE>", " ", 15, TipoAllineamento.DESTRA, false, 7, false, TipoColonna.IMMAGINE));
//tabellaDettaglio_Area.Colonne.Add(new Colonna("Descrizione", "Descrizione", 82, TipoAllineamento.SINISTRA, false, 7, false));
//MIFID2 20180424 Asterisco + nota a pie' pagina (o fine tabella)
//tabellaDettaglio_Area.Colonne.Add(new Colonna("Controvalore", "Controvalore (€)", 80, TipoAllineamento.DESTRA, false, 7, false));
tabellaDettaglio_Area.Colonne.Add(new Colonna("Controvalore", "Controvalore (€)*", 80, TipoAllineamento.DESTRA, false, 7, false));
//--MIFID2
tabellaDettaglio_Area.Colonne.Add(new Colonna("VersatoNetto", "Versato netto<BR>da assoc. (€)", 80, TipoAllineamento.DESTRA, false, 7, false));
tabellaDettaglio_Area.Colonne.Add(new Colonna("UtilePerdita", "Utile/perdita<BR>da assoc. (€)", 80, TipoAllineamento.DESTRA, false, 7, false));
tabellaDettaglio_Area.Colonne.Add(new Colonna("CreditRisk", "Rischio<BR>Credito", 65, TipoAllineamento.DESTRA, false, 7, false));
tabellaDettaglio_Area.Colonne.Add(new Colonna("Var", "Rischio<BR>(VaR %)", 55, TipoAllineamento.DESTRA, false, 7, false));
tabellaDettaglio_Area.ColoreDirectBankB = "green";
//MIFID2 20180530
string NomeArea = string.Format("{0}-{1}", area, datitab.table.Rows[0]["Progetto"]);
document.DocumentNotes.Rows.Add(NomeArea, 0, document.CurrentPage);
//--MIFID2
// Scrivo la tabella tabella Dati
//MIFID2 20180514
//orig:
//tabellaDettaglio_Area.Draw(datitab, document);
//tabellaDettaglio_Area.Draw(datitab, document, notaSezione, tableCount == 0, ref notaSezioneStampata);
tabellaDettaglio_Area.DrawMonitoraggio(datitab, document, notaSezione, tableCount == 0, ref notaSezioneStampata);
//--MIFID2
#endregion Tabella Dati
#region Tabella Totali
datitab = new DatiTabella();
datitab.table = set.Tables["ProdottiTotale"];
datitab.CellClear();
//Imposto gli asterischi di rimando nel caso in cui sia presente la nota del grado copertura
if (notaGradoCopertura.Length > 0)
datitab.table.Rows[0]["Var"] = datitab.table.Rows[0]["Var"].ToString() + document.Note.Find(Nota.TipologiaNota.GradoCopertura, tabellaDettaglio_Area.Id).ToString();
/*************************************** Fix Levi Trimestrale 10/2020 - Pino **********************************************************************/
//Tabella tabellaTotali_Area = new Tabella(document.getMargineLeft(), document.getLastPos() + tabellaDettaglio_Area.AltezzaTabella + 25);
Tabella tabellaTotali_Area = new Tabella(document.getMargineLeft(), document.getLastPos() + tabellaDettaglio_Area.AltezzaTabella + 29);
/**************************************************************************************************************************************************/
tabellaTotali_Area.HeaderFont = 8;
tabellaTotali_Area.Header = false;
tabellaTotali_Area.SaltoPagina = false;
/*************************************** Fix Levi Trimestrale 10/2020 - Pino **********************************************************************/
//tabellaTotali_Area.Colonne.Add(new Colonna("Totale", "", 122, TipoAllineamento.SINISTRA, true, 8, true));
//tabellaTotali_Area.Colonne.Add(new Colonna("Controvalore", "", 110, TipoAllineamento.DESTRA, true, 8, true));
//tabellaTotali_Area.Colonne.Add(new Colonna("Var", "", 280, TipoAllineamento.DESTRA, true, 8, true));
tabellaTotali_Area.Colonne.Add(new Colonna("Totale", "", 122, TipoAllineamento.SINISTRA, true, 8, true));
tabellaTotali_Area.Colonne.Add(new Colonna("Controvalore", "", 118, TipoAllineamento.DESTRA, true, 8, true));
tabellaTotali_Area.Colonne.Add(new Colonna("Var", "", 280, TipoAllineamento.DESTRA, true, 8, true));
/**************************************************************************************************************************************************/
// it should fix problem
if (document.checkMargin(datitab.GetRowDim() * 4 + 20)) // + 20 because of '(*) Grado di copertura: 80,29%'
//MIFID2 20180528
{
document.addPage();
notaSezioneStampata = false;
}
//--MIFID2
// Scrive la tabella Totali
tabellaTotali_Area.Draw(datitab, document);
dim = tabellaTotali_Area.AltezzaTabella + tabellaDettaglio_Area.AltezzaTabella;
//MIFID2 20180529 DocumentNotes
// Memorizzare la posizione della nota e il numero pagina
//document.DocumentNotes.Rows.Add(NomeArea, document.getLastPos() + dim, document.CurrentPage);
//20180619 Se c'è anche la nota sulla Copertura, bisogna dare un po' di spazio in più
//document.AddDocumentNote(NomeArea, document.getLastPos() + dim, document.CurrentPage);
if (!string.IsNullOrEmpty(notaGradoCopertura))
{
document.AddDocumentNote(NomeArea, document.getLastPos() + dim + 10, document.CurrentPage);
document.setLastPos(dim);
}
else
{
document.AddDocumentNote(NomeArea, document.getLastPos() + dim, document.CurrentPage);
/************* Modifica per la gestione della nota dinamica in base ai prodotti FAI 12/03/2021 - Pino *********************/
//document.setLastPos(dim + 10);
document.setLastPos(dim + 50);
/******************************************************************************************************************************/
}
//--MIFID2
//page.Elements.Add(new TextArea("PROVA "+ document.NumPage.ToString(), document.getMargineLeft(), 500, 510, 10));
//var p = document.getPageAt(document.CurrentPage-1);
//p.Elements.Add(new TextArea("PROVA 0", document.getMargineLeft(), 500, 510, 10));
#endregion
//MIFID2 20180424 da collocare dopo l'ultima tabella (o a fondo pagina)
//if (!moreTables)
//{
// if (!string.IsNullOrEmpty(notaSezione) && !notaSezioneStampata)
// {
// FormattedTextArea text = new FormattedTextArea(notaSezione, document.getMargineLeft(), document.getLastPos(), 510, 50, new ceTe.DynamicPDF.FontFamily("pipp", Globals.OpenTypeFontVerdana, Globals.OpenTypeFontVerdanaB, Globals.OpenTypeFontVerdanaZ, Globals.OpenTypeFontVerdanaZ), 7, false);
// text.Height = text.GetRequiredHeight();
// text.Style.Paragraph.Align = ceTe.DynamicPDF.TextAlign.Justify;
// page.Elements.Add(text);
// notaSezioneStampata = true;
// }
//}
//else
//{
// if (!string.IsNullOrEmpty(notaSezione) && !notaSezioneStampata)
// {
// FormattedTextArea text = new FormattedTextArea(notaSezione, document.getMargineLeft(), 720, 510, 50, new ceTe.DynamicPDF.FontFamily("pipp", Globals.OpenTypeFontVerdana, Globals.OpenTypeFontVerdanaB, Globals.OpenTypeFontVerdanaZ, Globals.OpenTypeFontVerdanaZ), 7, false);
// text.Height = text.GetRequiredHeight();
// text.Style.Paragraph.Align = ceTe.DynamicPDF.TextAlign.Justify;
// page.Elements.Add(text);
// notaSezioneStampata = true;
// }
//}
//if (!string.IsNullOrEmpty(notaSezione) && !notaSezioneStampata)
//{
// FormattedTextArea text = new FormattedTextArea(notaSezione, document.getMargineLeft(), 720, 510, 50, new ceTe.DynamicPDF.FontFamily("pipp", Globals.OpenTypeFontVerdana, Globals.OpenTypeFontVerdanaB, Globals.OpenTypeFontVerdanaZ, Globals.OpenTypeFontVerdanaZ), 7, false);
// text.Height = text.GetRequiredHeight();
// text.Style.Paragraph.Align = ceTe.DynamicPDF.TextAlign.Justify;
// page.Elements.Add(text);
// notaSezioneStampata = true;
//}
//--MIFID2
//MIFID2 20180528
notaSezioneStampata = true;
if (tableCount == 0)
document.setLastPos(10);
//--MIFID2
}
/// <summary>
/// Disegna la tabella per il dettaglio monitoraggio x Area/Progetto.
/// Usata per area Investimento.
/// </summary>
/// <param name="datitab"></param>
/// <param name="document"></param>
/// <param name="area"></param>
private void writeAreaProgetto(DatiTabella datitab, DocumentPDF document, string area, string nomeprogetto, DataThread dataThread)
{
//bool checkPartiteViaggiantiCrossProgetto = false;
FormatNum conv = new FormatNum();
float dim = 0;
page = document.getCurrentPage();
//decimal totProgetto = 0;
// string varProgetto = " ";
//bool stampatatabellaTitoloProgetto = false;
// float ytabella = 0; // unico incremento per la y di tutte le tabelle.
string notaGradoCopertura = string.Empty;
//Tabella tabellaDatiProgetto = null;
//Tabella tabTotali = null;
//setta la datatable
datitab.table = set.Tables["ProdottiAreeBisogno"];
// filtro per l'area
DataView view = new DataView(datitab.table);
view.RowFilter = ("CodiceAreaBisogno = '" + area + "' and Progetto='" + nomeprogetto.Replace("'", "''") + "'");
datitab.table = view.ToTable();
//MIFID2 20180529 Elimino dalla proprietà datatable del document la riga relativa all'area che sto stampando
if (dataThread.TipoReport.ToUpper().Equals("MONITORAGGIO"))
{
foreach (DataRow row in document.Areas.Rows)
{
if (row.Field<string>("NEED_AREA").ToUpper().Equals(area.ToUpper()) && row.Field<string>("NOME_PROGETTO").ToUpper().Equals(nomeprogetto.ToUpper()))
row.Delete();
}
document.Areas.AcceptChanges();
}
//--MIFID2
if (datitab.table.Rows.Count > 0)
{
#region Tabella Dati
// Disegno la tabella
//Tabella tabellaDettaglio_Area = new Tabella(document.getMargineLeft(), document.getLastPos() + ytabella);
Tabella tabellaDettaglio_Area = new Tabella(document.getMargineLeft(), document.getLastPos());
tabellaDettaglio_Area.HeaderFont = 8;
tabellaDettaglio_Area.Header = true;
tabellaDettaglio_Area.Datasource = datitab.table;
tabellaDettaglio_Area.Id = "tabella_S43BIS" + area + "_" + nomeprogetto;
tabellaDettaglio_Area.AltezzaCella = 23;
tabellaDettaglio_Area.LineaFineTabella = true;
#region Settaggio delle Note a piedi della tabella
//MIFID2 20180619 Se il documento non ha nessuna nota nella lista di note, mi serve aggiungerne una "finta" per avere il numero di asterischi che parte da 2 (includendo la nota fissa sul Ctv)
if (document.Note.Count == 0)
document.Note.Add(new Nota(Nota.TipologiaNota.NonImpostato, tabellaDettaglio_Area.Id, ""));
//--MIFID2
//Nota a piedi della tabella
// Imposto la nota a piedi della Tabella
notaGradoCopertura = datitab.table.Rows[0]["Copertura"] == DBNull.Value ? string.Empty : datitab.table.Rows[0]["Copertura"].ToString();
if (notaGradoCopertura.Length > 0)
{
document.Note.Add(new Nota(Nota.TipologiaNota.GradoCopertura, tabellaDettaglio_Area.Id, notaGradoCopertura));
tabellaDettaglio_Area.NotaTabella.Add(document.Note.Find(Nota.TipologiaNota.GradoCopertura, tabellaDettaglio_Area.Id).Testo);
}
document.Note.RemoveAt(0);
#endregion
//tabellaDettaglio_Area.Colonne.Add(new Colonna("DataAssociazione", "Data assoc.", 60, TipoAllineamento.SINISTRA, false, 7, false));
//tabellaDettaglio_Area.Colonne.Add(new Colonna("<IMAGE>", " ", 5, TipoAllineamento.DESTRA, false, 7, false, TipoColonna.IMMAGINE));
//tabellaDettaglio_Area.Colonne.Add(new Colonna("Descrizione", "Descrizione", 87, TipoAllineamento.SINISTRA, false, 7, false));
tabellaDettaglio_Area.Colonne.Add(new Colonna("DataAssociazione", "Data ass.", 45, TipoAllineamento.SINISTRA, false, 7, false));
tabellaDettaglio_Area.Colonne.Add(new Colonna("<IMAGE>", " ", 5, TipoAllineamento.DESTRA, false, 7, false, TipoColonna.IMMAGINE));
tabellaDettaglio_Area.Colonne.Add(new Colonna("Descrizione", "Descrizione", 110, TipoAllineamento.SINISTRA, false, 7, false));
//MIFID2 20180424 Asterisco + nota a pie' pagina (o fine tabella)
//tabellaDettaglio_Area.Colonne.Add(new Colonna("Controvalore", "Controvalore (€)", 80, TipoAllineamento.DESTRA, false, 7, false));
tabellaDettaglio_Area.Colonne.Add(new Colonna("Controvalore", "Controvalore (€)*", 80, TipoAllineamento.DESTRA, false, 7, false));
//--MIFID2
tabellaDettaglio_Area.Colonne.Add(new Colonna("VersatoNetto", "Versato netto<BR>da assoc. (€)", 80, TipoAllineamento.DESTRA, false, 7, false));
tabellaDettaglio_Area.Colonne.Add(new Colonna("UtilePerdita", "Utile/perdita<BR>da assoc. (€)", 80, TipoAllineamento.DESTRA, false, 7, false));
tabellaDettaglio_Area.Colonne.Add(new Colonna("CreditRisk", "Rischio<BR>Credito", 65, TipoAllineamento.DESTRA, false, 7, false));
tabellaDettaglio_Area.Colonne.Add(new Colonna("Var", "Rischio<BR>(VaR %)", 55, TipoAllineamento.DESTRA, false, 7, false));
tabellaDettaglio_Area.ColoreDirectBankB = "green";
// Scrivo la tabella tabella Dati
//MIFID2 20180528
//tabellaDettaglio_Area.Draw(datitab, document);
//MIFID2 20180530
string NomeArea = string.Format("{0}-{1}", area, datitab.table.Rows[0]["Progetto"]);
document.DocumentNotes.Rows.Add(NomeArea, 0, document.CurrentPage);
//--MIFID2
//tabellaDettaglio_Area.Draw(datitab, document, notaSezione, tableCount == 0, ref notaSezioneStampata);
tabellaDettaglio_Area.DrawMonitoraggio(datitab, document, notaSezione, tableCount == 0, ref notaSezioneStampata);
//--MIFID2
#endregion Tabella Dati
////MIFID2 20180424 Serve per stampare la nota a piè pagina nelle pagine in cui viene splittata la tabella relativa agli investimenti
//int numPag = 1;
//foreach (var pag in tabellaDettaglio_Area.PagineDisegnate)
//{
// //Nell'ultima pagina la nota va a fine tabella
// if (numPag < tabellaDettaglio_Area.PagineDisegnate.Count)
// {
// FormattedTextArea text = new FormattedTextArea(notaSezione, document.getMargineLeft(), 720, 510, 50, new ceTe.DynamicPDF.FontFamily("pipp", Globals.OpenTypeFontVerdana, Globals.OpenTypeFontVerdanaB, Globals.OpenTypeFontVerdanaZ, Globals.OpenTypeFontVerdanaZ), 7, false);
// text.Height = text.GetRequiredHeight();
// text.Style.Paragraph.Align = ceTe.DynamicPDF.TextAlign.Justify;
// pag.Pagina.Elements.Add(text);
// }
// numPag++;
//}
////--MIFID2
#region Tabella Totali
datitab = new DatiTabella();
datitab.table = set.Tables["ProdottiTotale"];
datitab.CellClear();
//Imposto gli asterischi di rimando nel caso in cui sia presente la nota del grado copertura
if (notaGradoCopertura.Length > 0)
datitab.table.Rows[0]["Var"] = datitab.table.Rows[0]["Var"].ToString() + document.Note.Find(Nota.TipologiaNota.GradoCopertura, tabellaDettaglio_Area.Id).ToString();
/*************************************** Fix Levi Trimestrale 10/2020 - Pino **********************************************************************/
//Tabella tabellaTotali_Area = new Tabella(document.getMargineLeft(), document.getLastPos() + tabellaDettaglio_Area.AltezzaTabella + 25);
Tabella tabellaTotali_Area = new Tabella(document.getMargineLeft(), document.getLastPos() + tabellaDettaglio_Area.AltezzaTabella + 29);
/**************************************************************************************************************************************************/
tabellaTotali_Area.HeaderFont = 8;
tabellaTotali_Area.Header = false;
tabellaTotali_Area.SaltoPagina = false;
/*************************************** Fix Levi Trimestrale 10/2020 - Pino **********************************************************************/
//tabellaTotali_Area.Colonne.Add(new Colonna("Totale", "", 130, TipoAllineamento.SINISTRA, true, 8, true));
//tabellaTotali_Area.Colonne.Add(new Colonna("Controvalore", "", 102, TipoAllineamento.DESTRA, true, 8, true));
//tabellaTotali_Area.Colonne.Add(new Colonna("Var", "", 280, TipoAllineamento.DESTRA, true, 8, true));
tabellaTotali_Area.Colonne.Add(new Colonna("Totale", "", 130, TipoAllineamento.SINISTRA, true, 8, true));
tabellaTotali_Area.Colonne.Add(new Colonna("Controvalore", "", 110, TipoAllineamento.DESTRA, true, 8, true));
tabellaTotali_Area.Colonne.Add(new Colonna("Var", "", 280, TipoAllineamento.DESTRA, true, 8, true));
/**************************************************************************************************************************************************/
// Scrive la tabella Totali
tabellaTotali_Area.Draw(datitab, document);
dim = tabellaTotali_Area.AltezzaTabella + tabellaDettaglio_Area.AltezzaTabella;
//MIFID2 20180529 DocumentNotes
// Memorizzare la posizione della nota e il numero pagina
//document.DocumentNotes.Rows.Add(NomeArea, document.getLastPos() + dim, document.CurrentPage);
if (!string.IsNullOrEmpty(notaGradoCopertura))
{
document.AddDocumentNote(NomeArea, document.getLastPos() + dim + 10, document.CurrentPage);
document.setLastPos(dim);
}
else
{
document.AddDocumentNote(NomeArea, document.getLastPos() + dim, document.CurrentPage);
document.setLastPos(dim + 10); // document.setLastPos(dim + 10);
}
//--MIFID2
//MIFID2 20180424 INSERISCE LA NOTA STATICA ALLA FINE DELLA SEZIONE
//document.setLastPos(lastPosition + 10);
//document.setLastPos(dim);
//if (!string.IsNullOrEmpty(notaSezione))
//{
// FormattedTextArea text = new FormattedTextArea(notaSezione, document.getMargineLeft(), document.getLastPos(), 510, 50, new ceTe.DynamicPDF.FontFamily("pipp", Globals.OpenTypeFontVerdana, Globals.OpenTypeFontVerdanaB, Globals.OpenTypeFontVerdanaZ, Globals.OpenTypeFontVerdanaZ), 7, false);
// text.Height = text.GetRequiredHeight();
// text.Style.Paragraph.Align = ceTe.DynamicPDF.TextAlign.Justify;
// page = document.getCurrentPage();
// page.Elements.Add(text);
//}
document.setLastPos(dim + 200);
//--MIFID2
//document.setLastPos(dim + 10);
notaSezioneStampata = true;
#endregion
}
}
#region Regione contenente la nuova gestione della pagina per FD
public void writeSezioneFD(DataThread dataThread)
{
bool _mostratitolosezione = true;
string printedArea = string.Empty;
DocumentPDF document = dataThread.DocumentPDF;
DatiTabella datitab = new DatiTabella();
set = (DataSetS43BIS)dataThread.Data.DatiSezione;
notaSezione = dataThread.SezioneReport.Nota;
/************* Modifica per la gestione della nota dinamica in base ai prodotti FAI 12/03/2021 - Pino *********************/
//string testoNotaFAI = " Il controvalore dei fondi Perennius Global Yield Private 2011, Idea Crescita Globale, FAI Private Debt Special Opportunities e FAI Private Markets Insight esposto nella rendicontazione è determinato tramite il NAV trimestrale al #dataFAI# (ultimo disponibile alla data di predisposizione del presente rendiconto) al netto delle distribuzioni avvenute nel trimestre e accreditate sul conto corrente indicato in fase di sottoscrizione.";
string testoNotaFAI = " Il controvalore dei fondi di Investimento alternativi è determinato tenuto conto del NAV ufficiale trimestrale al #dataFAI# (ultimo disponibile alla data di predisposizione del presente rendiconto) al netto di eventuali richiami e/o distribuzioni di capitale effettuati successivamente.";
string _flagNotaFAI = set.FlagNotaFAI.Rows[0][0].ToString();
if (_flagNotaFAI == "S")
{
testoNotaFAI = testoNotaFAI.Replace("#dataFAI#", set.FlagNotaFAI.Rows[0][1].ToString());
notaSezione += testoNotaFAI;
}
/******************************************************************************************************************************/
document.NotaPieDiPagina = notaSezione;
//MIFID2 20180514 se cambia pagina resetto il flag notastampata
//orig:
//if (document.checkMargin(datitab.GetRowDim() * 4))
// document.addPage();
if (document.checkMargin(datitab.GetRowDim() * 4))
{
document.addPage();
notaSezioneStampata = false;
}
//--MIFID2
page = document.getCurrentPage();
#region Recupero i dati da stampare
DataRow[] drFilterAreaProgetto;
DataTable dtTabellaDati = new DataTable();
DataTable tempdtTabellaDati = new DataTable();
DataView view;
datitab.table = set.Tables["ProdottiAreeBisogno"];
dtTabellaDati = datitab.table;
tempdtTabellaDati = datitab.table;
DataView viewDistinctAreas = new DataView(set.Tables["ProdottiAreeBisogno"]);
DataTable distinctValues = viewDistinctAreas.ToTable(true, "CodiceAreaBisogno");
moreTables = distinctValues.Rows.Count > 1;
tableCount = distinctValues.Rows.Count;
//--MIFID2
//view = new DataView(datitab.table);
//if (!string.IsNullOrEmpty(dataThread.Area) || !string.IsNullOrEmpty(dataThread.Progetto))
//{
// if (dataThread.Area.ToUpper() != "NA")
// {
// view.RowFilter = ("OrdinamentoProgetto ='" + _ordinamentoProgetto + "' and " + "CodiceAreaBisogno = '" + dataThread.Area + "' and progetto='" + dataThread.Progetto.Replace("'", "''") + "'");
// datitab.table = view.ToTable();
// dtTabellaDati = datitab.table;
// }
// else
// {
// view.RowFilter = ("CodiceAreaBisogno = '" + dataThread.Area + "' and progetto='" + dataThread.Progetto.Replace("'", "''") + "'");
// datitab.table = view.ToTable();
// dtTabellaDati = datitab.table;
// }
//}
#endregion
if (_Area.Equals("Inv"))
{
#region stampo solo Robo
string titoloRibilanciato = "Portafoglio Direct Evo"; //"Portafoglio Ribilanciato";
drFilterAreaProgetto = dtTabellaDati.Select(" CodiceAreaBisogno = 'Rob'");
List<Progetti> listaNomeProgetti = UtilityBusinessLayer.ConvertTo<Progetti>(dtTabellaDati);
var nomeProgetto = listaNomeProgetti.Where(f => f.CodiceAreaBisogno == "Rob").Select(s => s.Progetto).Distinct().ToList();
if (nomeProgetto.Count > 0)
document.setTitolo(titoloRibilanciato);
foreach (var item in nomeProgetto)
{
if (drFilterAreaProgetto.Length > 0)
{
//MIFID2 20180514 se cambia pagina resetto il flag notastampata
//orig:
//if (document.checkMargin(datitab.GetRowDim() * 4))
// document.addPage();
if (document.checkMargin(datitab.GetRowDim() * 4))
{
document.addPage();
notaSezioneStampata = false;
}
//--MIFID2
if (_mostratitolosezione)
{
if (string.IsNullOrEmpty(_titolosezione))
{
if (!titoloRibilanciato.Equals(""))
{
//document.setTitolo(titoloRibilanciato);
document.setSezTitoloWithoutNumber(item);
}
}
else
document.setTitolo(_titolosezione);
}
this.writeAreaFD(dataThread, datitab, document, "Rob",item);
//MIFID2 20180514 una volta stampata la tabella, decremento il contatore
//tableCount--;
}
}
#endregion
#region Stampo gli altri prodotti
string titoloAltriStrumenti = "Portafoglio base"; //"Altri strumenti finanziari";
drFilterAreaProgetto = dtTabellaDati.Select(" CodiceAreaBisogno <> 'Rob'");
/*Ciclo sull array e modifico il valore CodiceAreaBisogno*/
//foreach (var item in drFilterAreaProgetto)
//{
// item["CodiceAreaBisogno"] = "ASF";
//}
if (drFilterAreaProgetto.Length > 0)
{
//MIFID2 20180514 se cambia pagina resetto il flag notastampata
//orig:
//if (document.checkMargin(datitab.GetRowDim() * 4))
// document.addPage();
if (document.checkMargin(datitab.GetRowDim() * 4))
{
document.addPage();
notaSezioneStampata = false;
}
//--MIFID2
if (_mostratitolosezione)
{
if (string.IsNullOrEmpty(_titolosezione))
{
if (!titoloAltriStrumenti.Equals(""))
{
document.setTitolo(titoloAltriStrumenti);
titoloAltriStrumenti = "";
}
}
else
document.setTitolo(_titolosezione);
}
this.writeAreaFD(dataThread, datitab, document, "ASF","Default");
// Modifiche richieste Luglio 2024
// Forzatura note a piè di pagina PS
// il testo lo preleva dal db ma in base a delle condizioni non inseriva la nota
// secondo l'ultima richiesta deve uscire a prescindere
document.setNotaPieDiPagina("(*) Linformazione relativa al Controvalore fa riferimento alla data di consolidamento (per i Conti Correnti al saldo contabile). Per alcuni prodotti la valorizzazione del Controvalore può risultare non perfettamente allineata alle rendicontazioni effettuate da SGR / Compagnie Assicurative, in seguito a differenti modalità di consolidamento dati. In caso di disallineamento dei valori, occorre far riferimento all'ultima valorizzazione prodotta dalla SGR / Compagnia Assicurativa.");
//MIFID2 20180514 una volta stampata la tabella, decremento il contatore
//tableCount--;
}
#endregion
}
}
/// <summary>
/// Disegna la tabella per Area (non d'investimento).
/// </summary>
/// <param name="datitab"></param>
/// <param name="document"></param>
/// <param name="area"></param>
private void writeAreaFD(DataThread dataThread, DatiTabella datitab, DocumentPDF document, string area,string nomeProgetto)
{
//MIFID2 20180514
tableCount--;
//--MIFID2
//if (area.ToUpper().Equals("INV"))
//{
// if (!string.IsNullOrEmpty(dataThread.Area) || !string.IsNullOrEmpty(dataThread.Progetto))
// this.writeAreaProgetto_Monitoraggio(dataThread, datitab, document, "Inv");
// else
// this.writeAreaProgetto(dataThread, datitab, document, "Inv");
// return;
//}
float lastPosition = 0;
int fontdim = 8;
page = document.getCurrentPage();
FormatNum conv = new FormatNum();
string notaGradoCopertura = string.Empty;
//setta la datatable
datitab.table = set.Tables["ProdottiAreeBisogno"];
// Disegno la tabella
Tabella tabellaDettaglio_Area = new Tabella(document.getMargineLeft(), document.getLastPos());
tabellaDettaglio_Area.HeaderFont = 8;
tabellaDettaglio_Area.Header = true;
tabellaDettaglio_Area.Datasource = datitab.table;
tabellaDettaglio_Area.Id = "tabella_" + area;
tabellaDettaglio_Area.LineaFineTabella = true;
tabellaDettaglio_Area.ColoreDirectBankB = "green";
// filtro per l'area
DataView view = new DataView(datitab.table);
view.RowFilter = ("CodiceAreaBisogno = '" + area + "' and Progetto='" + nomeProgetto + "'");
datitab.table = view.ToTable();
//MIFID2 20180619 Se il documento non ha nessuna nota nella lista di note, mi serve aggiungerne una "finta" per avere il numero di asterischi che parte da 2 (includendo la nota fissa sul Ctv)
if (document.Note.Count == 0)
document.Note.Add(new Nota(Nota.TipologiaNota.NonImpostato, tabellaDettaglio_Area.Id, ""));
//--MIFID2
#region Tutti tranne CC e INV
if (area.ToUpper() != "CC" && area.ToUpper() != "INV" && datitab.table.Rows.Count > 0)
{
notaGradoCopertura = datitab.table.Rows[0]["Copertura"] == DBNull.Value ? string.Empty : datitab.table.Rows[0]["Copertura"].ToString();
if (notaGradoCopertura.Length > 0)
{
//20180817 va mantenuta la nota fittizia altrimenti viene stampata la nota copertura con un solo asterisco così come quella fissa sul ctv
//document.Note.Clear();
//20180817
document.Note.Add(new Nota(Nota.TipologiaNota.GradoCopertura, tabellaDettaglio_Area.Id, notaGradoCopertura));
tabellaDettaglio_Area.NotaTabella.Add(document.Note.Find(Nota.TipologiaNota.GradoCopertura, tabellaDettaglio_Area.Id).Testo);
}
//20180620 serve ad eliminare la nota finta, che altrimenti verrebbe stampata
document.Note.RemoveAt(0);
tabellaDettaglio_Area.Colonne.Add(new Colonna("DataAssociazione", "Data ass.", 45, TipoAllineamento.SINISTRA, false, 7, false));
tabellaDettaglio_Area.Colonne.Add(new Colonna("<IMAGE>", " ", 5, TipoAllineamento.DESTRA, false, 7, false, TipoColonna.IMMAGINE));
tabellaDettaglio_Area.Colonne.Add(new Colonna("Descrizione", "Descrizione", 130, TipoAllineamento.SINISTRA, false, 7, false)); //110
//MIFID2 20180424 Asterisco + nota a pie' pagina (o fine tabella)
//tabellaDettaglio_Area.Colonne.Add(new Colonna("Controvalore", "Controvalore (€)", 80, TipoAllineamento.DESTRA, false, 7, false));
tabellaDettaglio_Area.Colonne.Add(new Colonna("Controvalore", "Controvalore (€)*", 90, TipoAllineamento.DESTRA, false, 7, false));
//--MIFID2
tabellaDettaglio_Area.Colonne.Add(new Colonna("VersatoNetto", "Versato netto<BR>da assoc. (€)", 90, TipoAllineamento.DESTRA, false, 7, false));
tabellaDettaglio_Area.Colonne.Add(new Colonna("UtilePerdita", "Utile/perdita<BR>da assoc. (€)", 90, TipoAllineamento.DESTRA, false, 7, false));
//tabellaDettaglio_Area.Colonne.Add(new Colonna("CreditRisk", "Rischio<BR>Credito", 65, TipoAllineamento.DESTRA, false, 7, false));
tabellaDettaglio_Area.Colonne.Add(new Colonna("Var", "Rischio<BR>(VaR %)", 70, TipoAllineamento.DESTRA, false, 7, false)); //55
//tabellaDettaglio_Area.ColoreDirectBankB = "green";
//--MIFID2
//MIFID2 20180601 Gestione nota, salvare informazione su tabella corrente
document.DocumentNotes.Rows.Add(area, 0, document.CurrentPage);
//tabellaDettaglio_Area.Draw(datitab, document, notaSezione, tableCount == 0, ref notaSezioneStampata);
//tabellaDettaglio_Area.DrawDiagnosi(datitab, document, notaSezione);
tabellaDettaglio_Area.DrawMonitoraggio(datitab, document, notaSezione, tableCount == 0, ref notaSezioneStampata);
//--MIFID2
datitab = new DatiTabella();
datitab.table = set.Tables["ProdottiTotale"];
datitab.CellClear();
DataView view2 = new DataView(datitab.table);
if (area.Equals("ASF"))
{
view2.RowFilter = ("CodiceAreaBisogno = '" + area + "' and AreaBisogno = 'Portafoglio Base'");
}
else
view2.RowFilter = ("CodiceAreaBisogno = '" + area + "' and Progetto = '" + nomeProgetto + "'");
datitab.table = view2.ToTable();
//Imposto gli asterischi di rimando nel caso in cui sia presente la nota del grado copertura
if (notaGradoCopertura.Length > 0)
datitab.table.Rows[0]["Var"] = datitab.table.Rows[0]["Var"].ToString() + document.Note.Find(Nota.TipologiaNota.GradoCopertura, tabellaDettaglio_Area.Id).ToString();
Tabella tabellaTotali_Area = new Tabella(document.getMargineLeft(), document.getLastPos() + tabellaDettaglio_Area.AltezzaTabella + 25);
tabellaTotali_Area.HeaderFont = 8;
tabellaTotali_Area.Header = false;
tabellaTotali_Area.SaltoPagina = false;
tabellaTotali_Area.Colonne.Add(new Colonna("Totale", "", 150, TipoAllineamento.SINISTRA, true, fontdim, true));
tabellaTotali_Area.Colonne.Add(new Colonna("Controvalore", "", 120, TipoAllineamento.DESTRA, true, fontdim, true));
tabellaTotali_Area.Colonne.Add(new Colonna("Var", "", 250, TipoAllineamento.DESTRA, true, fontdim, true));
tabellaTotali_Area.Draw(datitab, document);
lastPosition = tabellaTotali_Area.AltezzaTabella + tabellaDettaglio_Area.AltezzaTabella;
//MIFID2 20180601 DocumentNotes
// Memorizzare la posizione della nota e il numero pagina
// 20180619 se c'è la nota grado copertura bisogna aggiungere spazio
//document.AddDocumentNote(NomeArea, document.getLastPos() + lastPosition, document.CurrentPage);
if (!string.IsNullOrEmpty(notaGradoCopertura))
{
document.AddDocumentNote(area, document.getLastPos() + lastPosition + 10, document.CurrentPage);
document.setLastPos(lastPosition + 10);
}
else
{
document.AddDocumentNote(area, document.getLastPos() + lastPosition, document.CurrentPage);
document.setLastPos(lastPosition);
}
//--20180619
//--MIFID2
//document.setLastPos(lastPosition);
}
#endregion
#region Conti correnti a saldo negativo
//if (area.ToUpper() == "CC" && set.ContoCorrente.Rows.Count > 0)
//{
// // 20181204 Per gestire lo spazio che bisogna lasciare per un'eventuale nota sul controvalore che va direttamente sotto la tabella area precedente
// if (document.DocumentNotes.Rows.Count > 0)
// {
// document.setLastPos(5);
// spazioNotaLasciato = true;
// }
// document.setTitolo("Conti correnti a saldo negativo");
// datitab = new DatiTabella();
// datitab.table = set.Tables["ContoCorrente"];
// datitab.CellClear();
// DataView view3 = new DataView(datitab.table);
// datitab.table = view3.ToTable();
// for (int i = 0; i < datitab.table.Rows.Count; i++)
// datitab.table.Rows[i]["Var"] = conv.ConvertNum(datitab.table.Rows[i]["Var"]);
// //Imposto gli asterischi di rimando nel caso in cui sia presente la nota del grado copertura
// if (notaGradoCopertura.Length > 0)
// datitab.table.Rows[0]["Var"] = datitab.table.Rows[0]["Var"].ToString()
// + document.Note.Find(Nota.TipologiaNota.GradoCopertura, tabellaDettaglio_Area.Id).ToString();
// Tabella NewtabellaTotali_Area = new Tabella(document.getMargineLeft(), document.getLastPos());
// NewtabellaTotali_Area.HeaderFont = 8;
// NewtabellaTotali_Area.Header = true;
// NewtabellaTotali_Area.SaltoPagina = false;
// NewtabellaTotali_Area.Colonne.Add(new Colonna("Data", "Data di apertura", 60, TipoAllineamento.SINISTRA, false, fontdim, false));
// NewtabellaTotali_Area.Colonne.Add(new Colonna("Numero", "Numero di c/c", 224, TipoAllineamento.SINISTRA, false, fontdim, false));
// NewtabellaTotali_Area.Colonne.Add(new Colonna("<IMAGE>", " ", 5, TipoAllineamento.DESTRA, false, fontdim, false, TipoColonna.IMMAGINE));
// NewtabellaTotali_Area.Colonne.Add(new Colonna("SaldoContabile", "&nbsp;&nbsp;&nbsp;Saldo<BR>Contabile", 80, TipoAllineamento.DESTRA, false, fontdim, false));
// NewtabellaTotali_Area.Colonne.Add(new Colonna("SaldoDisponibile", "&nbsp;&nbsp;&nbsp;&nbsp;Saldo<BR>Disponibile", 80, TipoAllineamento.DESTRA, false, fontdim, false));
// NewtabellaTotali_Area.Colonne.Add(new Colonna("Var", "Rischio<BR>(VaR%)", 60, TipoAllineamento.DESTRA, false, fontdim, false));
// // 20181204 Gestione nota, salvare informazione su tabella corrente
// //document.DocumentNotes.Rows.Add(area, 0, document.CurrentPage);
// // Scrive la tabella Totali
// NewtabellaTotali_Area.DrawDiagnosi(datitab, document, notaSezione);
// lastPosition = NewtabellaTotali_Area.AltezzaTabella;// +NewtabellaTotali_Area.AltezzaTabella;
// // 20181204 Gestione nota, salvare informazione su tabella corrente
// // document.AddDocumentNote(area, document.getLastPos() + lastPosition, document.CurrentPage);
// document.setLastPos(lastPosition);
//}
#endregion Conti correnti a saldo negativo
#region Linea Self a saldo negativo
// MIOFOGLIO 20181129
//AGGIUNGERE QUI LOGICA PER SEPARARE LE DUE TABELLE
//if (area.ToUpper() == "SELF" && set.LineaSelf.Rows.Count > 0)
//{
// // 20181204 Per gestire lo spazio che bisogna lasciare per un'eventuale nota sul controvalore che va direttamente sotto la tabella area precedente
// if (document.DocumentNotes.Rows.Count > 0 && !spazioNotaLasciato)
// document.setLastPos(5);
// set.LineaSelf.OrderBy(o => o.CodInterno);
// float altezzaTabella = 0;
// // 20181204 serve ad eliminare la nota finta, che altrimenti verrebbe stampata
// document.Note.RemoveAt(0);
// //--20181204
// // GP ELIGO
// var rows = set.Tables["LineaSelf"].AsEnumerable().Where<DataRow>(x => x.Field<string>("CodInterno").Equals("XY"));
// if (rows.Any())
// {
// document.setTitolo("Liquidità negativa \"Linee GP Eligo\"");
// datitab = new DatiTabella();
// datitab.table = rows.CopyToDataTable();
// datitab.CellClear();
// Tabella TabLineaSelfGP = new Tabella(document.getMargineLeft(), document.getLastPos());
// TabLineaSelfGP.HeaderFont = 8;
// TabLineaSelfGP.Header = true;
// TabLineaSelfGP.SaltoPagina = false;
// TabLineaSelfGP.LineaFineTabella = false;
// TabLineaSelfGP.Colonne.Add(new Colonna("DataSott", "Data Sott.", 80, TipoAllineamento.SINISTRA, false, fontdim, false));
// TabLineaSelfGP.Colonne.Add(new Colonna("NumContratto", "Num. Contratto", 170, TipoAllineamento.SINISTRA, false, fontdim, false));
// TabLineaSelfGP.Colonne.Add(new Colonna("NomeProdotto", "Nome", 162, TipoAllineamento.SINISTRA, false, fontdim, false));
// TabLineaSelfGP.Colonne.Add(new Colonna("controvalore", "Controvalore (€)*", 100, TipoAllineamento.DESTRA, false, fontdim, false));
// // 20181204 Gestione nota, salvare informazione su tabella corrente
// document.DocumentNotes.Rows.Add(string.Format("{0} - {1}", area, "GP"), 0, document.CurrentPage);
// TabLineaSelfGP.DrawDiagnosi(datitab, document, notaSezione);
// lastPosition = TabLineaSelfGP.AltezzaTabella;// +TabLineaSelf.AltezzaTabella;
// // 20181204 Gestione nota, salvare informazione su tabella corrente
// if (!string.IsNullOrEmpty(notaGradoCopertura))
// {
// document.AddDocumentNote(string.Format("{0} - {1}", area, "GP"), document.getLastPos() + lastPosition + 10, document.CurrentPage);
// lastPosition += 10;
// }
// else
// {
// document.AddDocumentNote(string.Format("{0} - {1}", area, "GP"), document.getLastPos() + lastPosition, document.CurrentPage);
// }
// document.setLastPos(lastPosition);
// altezzaTabella = lastPosition;
// }
// //--GP ELIGO
// // IL MIO FOGLIO
// rows = set.Tables["LineaSelf"].AsEnumerable().Where<DataRow>(x => x.Field<string>("CodInterno").Equals("FO"));
// if (rows.Any())
// {
// document.setTitolo("Liquidità negativa \"Il Mio Foglio\"");
// datitab = new DatiTabella();
// datitab.table = rows.CopyToDataTable();
// datitab.CellClear();
// Tabella TabLineaSelfFO = new Tabella(document.getMargineLeft(), document.getLastPos());
// TabLineaSelfFO.HeaderFont = 8;
// TabLineaSelfFO.Header = true;
// TabLineaSelfFO.SaltoPagina = false;
// TabLineaSelfFO.LineaFineTabella = false;
// TabLineaSelfFO.Colonne.Add(new Colonna("DataSott", "Data Sott.", 80, TipoAllineamento.SINISTRA, false, fontdim, false));
// TabLineaSelfFO.Colonne.Add(new Colonna("NumContratto", "Num. Contratto", 170, TipoAllineamento.SINISTRA, false, fontdim, false));
// TabLineaSelfFO.Colonne.Add(new Colonna("NomeProdotto", "Nome", 162, TipoAllineamento.SINISTRA, false, fontdim, false));
// TabLineaSelfFO.Colonne.Add(new Colonna("controvalore", "Controvalore (€)*", 100, TipoAllineamento.DESTRA, false, fontdim, false));
// // 20181204 Gestione nota, salvare informazione su tabella corrente
// document.DocumentNotes.Rows.Add(string.Format("{0} - {1}", area, "FO"), 0, document.CurrentPage);
// TabLineaSelfFO.DrawDiagnosi(datitab, document, notaSezione);
// lastPosition = altezzaTabella;// + TabLineaSelfFO.AltezzaTabella;// +TabLineaSelf.AltezzaTabella;
// // 20181204 Gestione nota, salvare informazione su tabella corrente
// if (!string.IsNullOrEmpty(notaGradoCopertura))
// {
// document.AddDocumentNote(string.Format("{0} - {1}", area, "FO"), document.getLastPos() + lastPosition + 10, document.CurrentPage);
// lastPosition += 10;
// }
// else
// {
// document.AddDocumentNote(string.Format("{0} - {1}", area, "FO"), document.getLastPos() + lastPosition, document.CurrentPage);
// }
// document.setLastPos(lastPosition);
// }
// //--IL MIO FOGLIO
//}
//-- MIOFOGLIO 20181129
//if (area.ToUpper() == "SELF" && set.LineaSelf.Rows.Count > 0)
//{
// document.setTitolo("Liquidità negativa \"Linee GP Eligo\"");
// datitab = new DatiTabella();
// datitab.table = set.Tables["LineaSelf"];
// datitab.CellClear();
// Tabella TabLineaSelf = new Tabella(document.getMargineLeft(), document.getLastPos());
// TabLineaSelf.HeaderFont = 8;
// TabLineaSelf.Header = true;
// TabLineaSelf.SaltoPagina = false;
// TabLineaSelf.Colonne.Add(new Colonna("DataSott", "Data Sott.", 80, TipoAllineamento.SINISTRA, false, fontdim, false));
// TabLineaSelf.Colonne.Add(new Colonna("NumContratto", "Num. Contratto", 170, TipoAllineamento.SINISTRA, false, fontdim, false));
// TabLineaSelf.Colonne.Add(new Colonna("NomeProdotto", "Nome", 162, TipoAllineamento.SINISTRA, false, fontdim, false));
// TabLineaSelf.Colonne.Add(new Colonna("controvalore", "Controvalore (€)", 100, TipoAllineamento.DESTRA, false, fontdim, false));
// TabLineaSelf.DrawDiagnosi(datitab, document,notaSezione);
// lastPosition = TabLineaSelf.AltezzaTabella;// +TabLineaSelf.AltezzaTabella;
// document.setLastPos(lastPosition);
//}
#endregion Linea Self a saldo negativo
//MIFID2 20180419 da collocare dopo l'ultima tabella (o a fondo pagina)
//if (!moreTables)
//{
// if (!string.IsNullOrEmpty(notaSezione) && !notaSezioneStampata)
// {
// FormattedTextArea text = new FormattedTextArea(notaSezione, document.getMargineLeft(), document.getLastPos(), 510, 50, new ceTe.DynamicPDF.FontFamily("pipp", Globals.OpenTypeFontVerdana, Globals.OpenTypeFontVerdanaB, Globals.OpenTypeFontVerdanaZ, Globals.OpenTypeFontVerdanaZ), 7, false);
// text.Height = text.GetRequiredHeight();
// text.Style.Paragraph.Align = ceTe.DynamicPDF.TextAlign.Justify;
// page.Elements.Add(text);
// notaSezioneStampata = true;
// lastPosition += 100;
// document.setLastPos(lastPosition);
// }
//}
//else
//{
// if (!string.IsNullOrEmpty(notaSezione) && !notaSezioneStampata)
// {
// FormattedTextArea text = new FormattedTextArea(notaSezione, document.getMargineLeft(), 700, 510, 50, new ceTe.DynamicPDF.FontFamily("pipp", Globals.OpenTypeFontVerdana, Globals.OpenTypeFontVerdanaB, Globals.OpenTypeFontVerdanaZ, Globals.OpenTypeFontVerdanaZ), 7, false);
// text.Height = text.GetRequiredHeight();
// text.Style.Paragraph.Align = ceTe.DynamicPDF.TextAlign.Justify;
// page.Elements.Add(text);
// notaSezioneStampata = true;
// }
//}
//20180514
//float notaSezionePos;
//if (tableCount == 0)
//{
// notaSezionePos = document.getLastPos() - 30;
// document.setLastPos(lastPosition - 30);
//}
//else
// notaSezionePos = 700;
//if (!string.IsNullOrEmpty(notaSezione) && !notaSezioneStampata)
//{
// FormattedTextArea text = new FormattedTextArea(notaSezione, document.getMargineLeft(), notaSezionePos, 510, 50, new ceTe.DynamicPDF.FontFamily("pipp", Globals.OpenTypeFontVerdana, Globals.OpenTypeFontVerdanaB, Globals.OpenTypeFontVerdanaZ, Globals.OpenTypeFontVerdanaZ), 7, false);
// text.Height = text.GetRequiredHeight();
// text.Style.Paragraph.Align = ceTe.DynamicPDF.TextAlign.Justify;
// page.Elements.Add(text);
// notaSezioneStampata = true;
//}
notaSezioneStampata = true;
if (tableCount == 0)
document.setLastPos(10);
//--MIFID2
}
#endregion
public void setTitolo(string label)
{
Titolo = label;
}
public string Area
{
get
{
return _Area;
}
set
{
_Area = value;
}
}
public string Progetto
{
get
{
return _Progetto;
}
set
{
_Progetto = value;
}
}
public bool VersatoNetto_UtilePerdita
{
get { return _versatonetto_utileperdita; }
set { _versatonetto_utileperdita = value; }
}
public bool MostraRendimentoDaInizioAnno
{
get { return _mostrarendimentodainizioanno; }
set { _mostrarendimentodainizioanno = value; }
}
public bool MostraRendimentoDaDataSottoscrizione
{
get { return _mostrarendimentodadatasottoscrizione; }
set { _mostrarendimentodadatasottoscrizione = value; }
}
public TipologiaReport TipologiaReport
{
get { return _tipologiaReport; }
set { _tipologiaReport = value; }
}
}
public class Progetti
{
public string Progetto { get; set; }
public string CodiceAreaBisogno { get; set; }
}
}