1345 lines
60 KiB
C#
1345 lines
60 KiB
C#
using System;
|
|
using System.Data;
|
|
using System.Configuration;
|
|
using System.Web;
|
|
using System.Web.Security;
|
|
using System.Web.UI;
|
|
using System.Web.UI.WebControls;
|
|
using System.Web.UI.WebControls.WebParts;
|
|
using System.Web.UI.HtmlControls;
|
|
using System.Collections;
|
|
using ceTe.DynamicPDF;
|
|
using ceTe.DynamicPDF.Text;
|
|
|
|
using ceTe.DynamicPDF.Merger;
|
|
using PDFGenerator.BusinessLayer.DataSection;
|
|
using PDFGenerator.Presentation.Section.Tables;
|
|
using PDFGenerator.BusinessLayer;
|
|
using ceTe.DynamicPDF.PageElements;
|
|
|
|
namespace PDFGenerator.Presentation.Section
|
|
{
|
|
public class FD43 : ISezione
|
|
{
|
|
DataSetS43 set;
|
|
ImportedPage page;
|
|
|
|
string _Area;
|
|
string _Progetto;
|
|
private bool _mostratitolosezione = true;
|
|
private string _titolosezione = string.Empty;
|
|
private string _ordinamentoProgetto = string.Empty;
|
|
|
|
//MIFID2 20180528
|
|
string notaSezione = string.Empty;
|
|
bool notaSezioneStampata = false;
|
|
bool moreTables = false;
|
|
int tableCount;
|
|
//--MIFID2
|
|
|
|
public string OrdinamentoProgetto
|
|
{
|
|
get { return _ordinamentoProgetto; }
|
|
set { _ordinamentoProgetto = value; }
|
|
}
|
|
|
|
|
|
public FD43()
|
|
{
|
|
//
|
|
// TODO: Add constructor logic here
|
|
//
|
|
}
|
|
|
|
#region ISezione Members
|
|
|
|
|
|
|
|
/// <summary>
|
|
/// Stampa la sezione per area di bisogno.
|
|
/// Se l'area investimento ha più di 1 progetto, verrà aggiunta una riga, in grassetto, per ciascun progetto
|
|
/// come titolo del progetto d'investimento.
|
|
/// </summary>
|
|
/// <param name="dataThread"></param>
|
|
public void writeSezione(DataThread dataThread)
|
|
{
|
|
//int z;
|
|
|
|
string printedArea = string.Empty;
|
|
DocumentPDF document = dataThread.DocumentPDF;
|
|
DatiTabella datitab = new DatiTabella();
|
|
set = (DataSetS43)dataThread.Data.DatiSezione;
|
|
|
|
//MIFID2 20180424
|
|
//notaSezione = dataThread.SezioneReport.Nota;
|
|
//notaSezione = "NOTA PROVA 43 " + dataThread.Area;
|
|
|
|
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 _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
|
|
|
|
dataThread.UltimaSezioneStampata = "";
|
|
page = document.getCurrentPage();
|
|
|
|
|
|
#region Recupero i dati da stampare
|
|
|
|
DataRow[] drFilterAreaProgetto;
|
|
DataRow[] drFilterAreaProgetto_Liquidita;
|
|
DataTable dtTabellaDati = new DataTable();
|
|
DataTable tempdtTabellaDati = new DataTable();
|
|
|
|
|
|
DataView view;
|
|
|
|
datitab.table = set.Tables["ProdottiAreeBisogno"];
|
|
dtTabellaDati = datitab.table;
|
|
tempdtTabellaDati = datitab.table;
|
|
//
|
|
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
|
|
|
|
#region Stampo la tabella Liquidità
|
|
|
|
drFilterAreaProgetto = dtTabellaDati.Select(" CodiceAreaBisogno = 'Liq'");
|
|
drFilterAreaProgetto_Liquidita = drFilterAreaProgetto;
|
|
if (drFilterAreaProgetto.Length > 0)
|
|
{
|
|
if (string.IsNullOrEmpty(printedArea))
|
|
printedArea += "'Liq'";
|
|
else
|
|
printedArea += " , 'Liq'";
|
|
|
|
//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(dataThread, datitab, document, "Liq");
|
|
}
|
|
#endregion
|
|
|
|
#region Stampo la tabella Riserva
|
|
|
|
|
|
drFilterAreaProgetto = dtTabellaDati.Select(" CodiceAreaBisogno = 'Ris'");
|
|
|
|
if (drFilterAreaProgetto.Length > 0)
|
|
{
|
|
if (string.IsNullOrEmpty(printedArea))
|
|
printedArea += "'Ris'";
|
|
else
|
|
printedArea += " , 'Ris'";
|
|
|
|
|
|
//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(dataThread, datitab, document, "Ris");
|
|
|
|
}
|
|
#endregion
|
|
|
|
#region Stampo la tabella Previdenza
|
|
|
|
drFilterAreaProgetto = dtTabellaDati.Select(" CodiceAreaBisogno = 'Pre'");
|
|
|
|
if (drFilterAreaProgetto.Length > 0)
|
|
{
|
|
if (string.IsNullOrEmpty(printedArea))
|
|
printedArea += "'Pre'";
|
|
else
|
|
printedArea += " , 'Pre'";
|
|
|
|
//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(dataThread, datitab, document, "Pre");
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region Stampo la tabella Investimento
|
|
|
|
drFilterAreaProgetto = dtTabellaDati.Select(" CodiceAreaBisogno = 'Inv'");
|
|
|
|
if (drFilterAreaProgetto.Length > 0)
|
|
{
|
|
if (string.IsNullOrEmpty(printedArea))
|
|
printedArea += "'Inv'";
|
|
else
|
|
printedArea += " , 'Inv'";
|
|
|
|
//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
|
|
|
|
if (!string.IsNullOrEmpty(dataThread.Area) || !string.IsNullOrEmpty(dataThread.Progetto))
|
|
this.writeAreaProgetto_Monitoraggio(dataThread, datitab, document, "Inv");
|
|
else
|
|
this.writeAreaProgetto(dataThread, datitab, document, "Inv");
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region Stampo la tabella Extra rendimento
|
|
|
|
|
|
drFilterAreaProgetto = dtTabellaDati.Select(" CodiceAreaBisogno = 'Ext'");
|
|
|
|
if (drFilterAreaProgetto.Length > 0)
|
|
{
|
|
if (string.IsNullOrEmpty(printedArea))
|
|
printedArea += "'Ext'";
|
|
else
|
|
printedArea += " , 'Ext'";
|
|
|
|
//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(dataThread, datitab, document, "Ext");
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region Conti correnti a saldo negativo
|
|
|
|
drFilterAreaProgetto = dtTabellaDati.Select(" CodiceAreaBisogno = 'Cc'");
|
|
|
|
if (drFilterAreaProgetto.Length > 0)
|
|
{
|
|
if (string.IsNullOrEmpty(printedArea))
|
|
printedArea += "'Cc'";
|
|
else
|
|
printedArea += " , 'Cc'";
|
|
|
|
this.writeArea(dataThread, datitab, document, "CC");
|
|
}
|
|
|
|
|
|
#endregion
|
|
|
|
#region Liquidità GP Eligo Fondi
|
|
|
|
drFilterAreaProgetto = dtTabellaDati.Select(" CodiceAreaBisogno = 'Self'");
|
|
|
|
if (drFilterAreaProgetto.Length > 0)
|
|
{
|
|
if (string.IsNullOrEmpty(printedArea))
|
|
printedArea += "'Self'";
|
|
else
|
|
printedArea += " , 'Self'";
|
|
|
|
this.writeArea(dataThread, datitab, document, "Self");
|
|
}
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
#region Stampo la tabella Risorse non allocate
|
|
|
|
|
|
drFilterAreaProgetto = dtTabellaDati.Select(" CodiceAreaBisogno = 'Na'");
|
|
|
|
if (drFilterAreaProgetto.Length > 0)
|
|
{
|
|
if (string.IsNullOrEmpty(printedArea))
|
|
printedArea += "'Na'";
|
|
else
|
|
printedArea += " , 'Na'";
|
|
|
|
//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(dataThread, datitab, document, "Na");
|
|
}
|
|
#endregion
|
|
|
|
if (document.Areas.Rows.Count == 0)
|
|
{
|
|
var segnaposto = 0;
|
|
|
|
if (document.DocumentNotes.Rows.Count > 0)
|
|
document.WriteNote2(notaSezione, dataThread.IsSavingMap, dataThread.IsAPC103);
|
|
|
|
}
|
|
|
|
//MIFID2 20180528
|
|
/************* Modifica per la gestione della nota dinamica in base ai prodotti FAI 12/03/2021 - Pino *********************/
|
|
//document.setLastPos(10); // Originale
|
|
//document.setLastPos(150);
|
|
/******************************************************************************************************************************/
|
|
/**/
|
|
//--MIFID2
|
|
|
|
}
|
|
|
|
#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 writeArea(DataThread dataThread, DatiTabella datitab, DocumentPDF document, string area)
|
|
{
|
|
|
|
//MIFID2 20180514
|
|
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)
|
|
{
|
|
// MIOFOGLIO 20181207
|
|
// Se ci sono due righe "Self" per entrambi i prodotti (GP e FO) non devo cancellare entrambe le aree, ma la prima e poi esco dal ciclo.
|
|
|
|
if (row.Field<string>("NEED_AREA").ToUpper().Equals(area.ToUpper()))
|
|
{
|
|
row.Delete();
|
|
break;
|
|
}
|
|
|
|
//if (row.Field<string>("NEED_AREA").ToUpper().Equals(area.ToUpper()))
|
|
// row.Delete();
|
|
//--MIOFOGIO 20181207
|
|
}
|
|
document.Areas.AcceptChanges();
|
|
}
|
|
//--MIFID2
|
|
|
|
float lastPosition = 0;
|
|
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;
|
|
|
|
// filtro per l'area
|
|
DataView view = new DataView(datitab.table);
|
|
view.RowFilter = ("CodiceAreaBisogno = '" + area + "'");
|
|
datitab.table = view.ToTable();
|
|
|
|
#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
|
|
|
|
if (area.ToUpper() != "CC" && area.ToUpper() != "SELF" && datitab.table.Rows.Count > 0)
|
|
{
|
|
//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.Clear();
|
|
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);
|
|
|
|
#endregion
|
|
|
|
|
|
tabellaDettaglio_Area.Colonne.Add(new Colonna("DataSottoscrizione", "Data sott.", 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", 227, TipoAllineamento.SINISTRA, false, 7, false));
|
|
|
|
//MIFID2 20180424
|
|
//tabellaDettaglio_Area.Colonne.Add(new Colonna("Controvalore", "Controvalore (€)", 90, 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("CreditRisk", "Rischio<BR>Credito", 65, TipoAllineamento.DESTRA, false, 7, false));
|
|
tabellaDettaglio_Area.Colonne.Add(new Colonna("Var", "Rischio<BR>(VaR %)", 65, TipoAllineamento.DESTRA, false, 7, false));
|
|
|
|
// Scrivo la tabella tabella Dati
|
|
//MIFID2 20180514
|
|
//orig:
|
|
//tabellaDettaglio_Area.Draw(datitab, document);
|
|
//tabellaDettaglio_Area.Draw(datitab, document, notaSezione, tableCount == 0, ref notaSezioneStampata);
|
|
|
|
string NomeArea = string.Format("{0}-{1}", area, datitab.table.Rows[0]["Progetto"]);
|
|
|
|
/***** Scrive la nota alla fine della tabella indipendentemente se sia finita **********/
|
|
document.DocumentNotes.Rows.Add(NomeArea, 0, document.CurrentPage);
|
|
/**************************************************************************************/
|
|
tabellaDettaglio_Area.ColoreDirectBankB = "green";
|
|
tabellaDettaglio_Area.DrawMonitoraggio(datitab, document, notaSezione, tableCount == 0, ref notaSezioneStampata);
|
|
//--MIFID2
|
|
|
|
#region tabella Totali
|
|
|
|
datitab = new DatiTabella();
|
|
datitab.table = set.Tables["ProdottiTotale"];
|
|
datitab.CellClear();
|
|
|
|
DataView view2 = new DataView(datitab.table);
|
|
view2.RowFilter = ("CodiceAreaBisogno = '" + area + "'");
|
|
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", "", 272, 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", "", 130, TipoAllineamento.DESTRA, true, 8, true));
|
|
|
|
// Scrive la tabella Totali
|
|
tabellaTotali_Area.Draw(datitab, document);
|
|
|
|
lastPosition = 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()+lastPosition, document.CurrentPage);
|
|
|
|
// 20180619 se c'è la nota grado copertura bisogna aggiungere spazio
|
|
//document.AddDocumentNote(NomeArea, document.getLastPos() + lastPosition, document.CurrentPage);
|
|
|
|
if (!string.IsNullOrEmpty(notaGradoCopertura))
|
|
{
|
|
document.AddDocumentNote(NomeArea, document.getLastPos() + lastPosition + 10, document.CurrentPage);
|
|
document.setLastPos(lastPosition);
|
|
}
|
|
else
|
|
{
|
|
/* queste righe stampano le note dopo la tabella del totale */
|
|
document.AddDocumentNote(NomeArea, document.getLastPos() + lastPosition, document.CurrentPage); //originale
|
|
document.setLastPos(lastPosition + 50); //originale +10 Pino
|
|
}
|
|
//--20180619
|
|
|
|
//--MIFID2
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region New Section Added in Jan. 2011 release
|
|
|
|
if (area.ToUpper() == "CC")
|
|
{
|
|
|
|
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();
|
|
|
|
//20180620 serve ad eliminare la nota finta, che altrimenti verrebbe stampata
|
|
document.Note.RemoveAt(0);
|
|
|
|
Tabella NewtabellaTotali_Area = new Tabella(document.getMargineLeft(), document.getLastPos());
|
|
NewtabellaTotali_Area.HeaderFont = 8;
|
|
NewtabellaTotali_Area.Header = true;
|
|
NewtabellaTotali_Area.SaltoPagina = false;
|
|
NewtabellaTotali_Area.LineaFineTabella = true;
|
|
|
|
NewtabellaTotali_Area.Colonne.Add(new Colonna("Data", "Data di apertura", 50, TipoAllineamento.SINISTRA, false, 7, false));
|
|
NewtabellaTotali_Area.Colonne.Add(new Colonna("<IMAGE>", " ", 15, TipoAllineamento.SINISTRA, false, 7, false, TipoColonna.IMMAGINE));
|
|
NewtabellaTotali_Area.Colonne.Add(new Colonna("Numero", "Numero di c/c", 150, TipoAllineamento.SINISTRA, false, 7, false));
|
|
NewtabellaTotali_Area.Colonne.Add(new Colonna("SaldoContabile", " Saldo<BR>Contabile", 80, TipoAllineamento.DESTRA, false, 7, false));
|
|
NewtabellaTotali_Area.Colonne.Add(new Colonna("SaldoDisponibile", " Saldo<BR>Disponibile", 80, TipoAllineamento.DESTRA, false, 7, false));
|
|
NewtabellaTotali_Area.Colonne.Add(new Colonna("CreditRisk", "Rischio<BR>Credito", 60, TipoAllineamento.DESTRA, false, 7, false));
|
|
NewtabellaTotali_Area.Colonne.Add(new Colonna("Var", "Rischio<BR>(VaR%)", 60, TipoAllineamento.DESTRA, false, 7, false));
|
|
|
|
// Scrive la tabella Totali
|
|
NewtabellaTotali_Area.Draw(datitab, document);
|
|
lastPosition = NewtabellaTotali_Area.AltezzaTabella;
|
|
document.setLastPos(lastPosition);
|
|
|
|
}
|
|
|
|
|
|
if (area.ToUpper() == "SELF")
|
|
{
|
|
|
|
// MIOFOGLIO 20181129
|
|
|
|
//20181205
|
|
//20180620 serve ad eliminare la nota finta, che altrimenti verrebbe stampata
|
|
if (document.Note.Count > 0)
|
|
document.Note.RemoveAt(0);
|
|
|
|
// GP ELIGO
|
|
datitab = new DatiTabella();
|
|
|
|
if (dataThread.SezioneReport.CodiceAreaSelf.Equals("XY"))
|
|
datitab.table = set.Tables["lineaself"].AsEnumerable().Where(x => x.Field<string>("CodInterno").Equals("XY")).CopyToDataTable();
|
|
else
|
|
datitab.table = set.Tables["lineaself"].AsEnumerable().Where(x => x.Field<string>("CodInterno").Equals("FO")).CopyToDataTable();
|
|
|
|
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();
|
|
|
|
|
|
|
|
//FormattedTextArea text = new FormattedTextArea("Liquidità negativa GP Eligo", document.getMargineLeft(), document.getLastPos(), 510, 50, new ceTe.DynamicPDF.FontFamily("pipp", Globals.OpenTypeFontVerdana, Globals.OpenTypeFontVerdanaB, Globals.OpenTypeFontVerdanaZ, Globals.OpenTypeFontVerdanaZ), 8, true);
|
|
//text.Height = text.GetRequiredHeight();
|
|
//text.Style.Paragraph.Align = ceTe.DynamicPDF.TextAlign.Justify;
|
|
//text.Style.Bold = true;
|
|
////page.Elements.Add(text);
|
|
//document.setSezHeader(text.Text);
|
|
|
|
|
|
|
|
Tabella NewtabellaTotali_Area_GP = new Tabella(document.getMargineLeft(), document.getLastPos());
|
|
NewtabellaTotali_Area_GP.HeaderFont = 8;
|
|
NewtabellaTotali_Area_GP.Header = true;
|
|
NewtabellaTotali_Area_GP.SaltoPagina = false;
|
|
NewtabellaTotali_Area_GP.LineaFineTabella = true;
|
|
|
|
NewtabellaTotali_Area_GP.Colonne.Add(new Colonna("Data", "Data Sott.", 80, TipoAllineamento.SINISTRA, false, 7, false));
|
|
NewtabellaTotali_Area_GP.Colonne.Add(new Colonna("Numero", "Num. Contratto", 170, TipoAllineamento.SINISTRA, false, 7, false));
|
|
NewtabellaTotali_Area_GP.Colonne.Add(new Colonna("NomeProdotto", "Nome", 162, TipoAllineamento.SINISTRA, false, 7, false));
|
|
NewtabellaTotali_Area_GP.Colonne.Add(new Colonna("SaldoContabile", "Controvalore (€)*", 100, TipoAllineamento.DESTRA, false, 7, false));
|
|
|
|
// Scrive la tabella Totali
|
|
|
|
string NomeArea = string.Format("{0}-{1}", area, datitab.table.Rows[0]["CodInterno"]);
|
|
|
|
document.DocumentNotes.Rows.Add(NomeArea, 0, document.CurrentPage);
|
|
|
|
//NewtabellaTotali_Area_GP.Draw(datitab, document);
|
|
NewtabellaTotali_Area_GP.DrawMonitoraggio(datitab, document, notaSezione, tableCount == 0, ref notaSezioneStampata);
|
|
lastPosition = NewtabellaTotali_Area_GP.AltezzaTabella;
|
|
|
|
if (!string.IsNullOrEmpty(notaGradoCopertura))
|
|
{
|
|
document.AddDocumentNote(NomeArea, document.getLastPos() + lastPosition + 10, document.CurrentPage);
|
|
document.setLastPos(lastPosition);
|
|
}
|
|
else
|
|
{
|
|
document.AddDocumentNote(NomeArea, document.getLastPos() + lastPosition, document.CurrentPage);
|
|
document.setLastPos(lastPosition + 200); //+10
|
|
}
|
|
|
|
//--20181205
|
|
|
|
////20180620 serve ad eliminare la nota finta, che altrimenti verrebbe stampata
|
|
//document.Note.RemoveAt(0);
|
|
|
|
//// GP ELIGO
|
|
//datitab = new DatiTabella();
|
|
|
|
//datitab.table = set.Tables["lineaself"].AsEnumerable().Where(x=>x.Field<string>("CodInterno").Equals("XY")).CopyToDataTable();
|
|
//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();
|
|
|
|
|
|
////FormattedTextArea text = new FormattedTextArea("Liquidità negativa GP Eligo", document.getMargineLeft(), document.getLastPos(), 510, 50, new ceTe.DynamicPDF.FontFamily("pipp", Globals.OpenTypeFontVerdana, Globals.OpenTypeFontVerdanaB, Globals.OpenTypeFontVerdanaZ, Globals.OpenTypeFontVerdanaZ), 8, true);
|
|
////text.Height = text.GetRequiredHeight();
|
|
////text.Style.Paragraph.Align = ceTe.DynamicPDF.TextAlign.Justify;
|
|
////text.Style.Bold = true;
|
|
//////page.Elements.Add(text);
|
|
////document.setSezHeader(text.Text);
|
|
|
|
//Tabella NewtabellaTotali_Area_GP = new Tabella(document.getMargineLeft(), document.getLastPos());
|
|
//NewtabellaTotali_Area_GP.HeaderFont = 8;
|
|
//NewtabellaTotali_Area_GP.Header = true;
|
|
//NewtabellaTotali_Area_GP.SaltoPagina = false;
|
|
//NewtabellaTotali_Area_GP.LineaFineTabella = true;
|
|
|
|
//NewtabellaTotali_Area_GP.Colonne.Add(new Colonna("Data", "Data Sott.", 80, TipoAllineamento.SINISTRA, false, 7, false));
|
|
//NewtabellaTotali_Area_GP.Colonne.Add(new Colonna("Numero", "Num. Contratto", 170, TipoAllineamento.SINISTRA, false, 7, false));
|
|
//NewtabellaTotali_Area_GP.Colonne.Add(new Colonna("NomeProdotto", "Nome", 162, TipoAllineamento.SINISTRA, false, 7, false));
|
|
//NewtabellaTotali_Area_GP.Colonne.Add(new Colonna("SaldoContabile", "Controvalore (€)*", 100, TipoAllineamento.DESTRA, false, 7, false));
|
|
|
|
//// Scrive la tabella Totali
|
|
|
|
|
|
//NewtabellaTotali_Area_GP.Draw(datitab, document);
|
|
//lastPosition = NewtabellaTotali_Area_GP.AltezzaTabella;
|
|
//document.setLastPos(lastPosition);
|
|
|
|
// GP ELIGO
|
|
|
|
|
|
// FO
|
|
//datitab = new DatiTabella();
|
|
|
|
//datitab.table = set.Tables["lineaself"].AsEnumerable().Where(x => x.Field<string>("CodInterno").Equals("FO")).CopyToDataTable();
|
|
//datitab.CellClear();
|
|
|
|
//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();
|
|
|
|
////20180620 serve ad eliminare la nota finta, che altrimenti verrebbe stampata
|
|
////document.Note.RemoveAt(0);
|
|
|
|
|
|
//Tabella NewtabellaTotali_Area_FO = new Tabella(document.getMargineLeft(), document.getLastPos());
|
|
//NewtabellaTotali_Area_FO.HeaderFont = 8;
|
|
//NewtabellaTotali_Area_FO.Header = true;
|
|
//NewtabellaTotali_Area_FO.SaltoPagina = false;
|
|
//NewtabellaTotali_Area_FO.LineaFineTabella = true;
|
|
|
|
//NewtabellaTotali_Area_FO.Colonne.Add(new Colonna("Data", "Data Sott.", 80, TipoAllineamento.SINISTRA, false, 7, false));
|
|
//NewtabellaTotali_Area_FO.Colonne.Add(new Colonna("Numero", "Num. Contratto", 170, TipoAllineamento.SINISTRA, false, 7, false));
|
|
//NewtabellaTotali_Area_FO.Colonne.Add(new Colonna("NomeProdotto", "Nome", 162, TipoAllineamento.SINISTRA, false, 7, false));
|
|
//NewtabellaTotali_Area_FO.Colonne.Add(new Colonna("SaldoContabile", "Controvalore (€)*", 100, TipoAllineamento.DESTRA, false, 7, false));
|
|
|
|
//// Scrive la tabella Totali
|
|
//NewtabellaTotali_Area_FO.Draw(datitab, document);
|
|
//lastPosition = NewtabellaTotali_Area_GP.AltezzaTabella + NewtabellaTotali_Area_FO.AltezzaTabella;
|
|
|
|
//document.setLastPos(lastPosition);
|
|
|
|
//--FO
|
|
|
|
|
|
|
|
//--MIOFOGLIO 20181129
|
|
|
|
//datitab = new DatiTabella();
|
|
|
|
//datitab.table = set.Tables["lineaself"];
|
|
//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();
|
|
|
|
////20180620 serve ad eliminare la nota finta, che altrimenti verrebbe stampata
|
|
//document.Note.RemoveAt(0);
|
|
|
|
//Tabella NewtabellaTotali_Area = new Tabella(document.getMargineLeft(), document.getLastPos());
|
|
//NewtabellaTotali_Area.HeaderFont = 8;
|
|
//NewtabellaTotali_Area.Header = true;
|
|
//NewtabellaTotali_Area.SaltoPagina = false;
|
|
//NewtabellaTotali_Area.LineaFineTabella = true;
|
|
|
|
//NewtabellaTotali_Area.Colonne.Add(new Colonna("Data", "Data Sott.", 80, TipoAllineamento.SINISTRA, false, 7, false));
|
|
//NewtabellaTotali_Area.Colonne.Add(new Colonna("Numero", "Num. Contratto", 170, TipoAllineamento.SINISTRA, false, 7, false));
|
|
//NewtabellaTotali_Area.Colonne.Add(new Colonna("NomeProdotto", "Nome", 162, TipoAllineamento.SINISTRA, false, 7, false));
|
|
//NewtabellaTotali_Area.Colonne.Add(new Colonna("SaldoContabile", "Controvalore (€)*", 100, TipoAllineamento.DESTRA, false, 7, false));
|
|
|
|
//// Scrive la tabella Totali
|
|
//NewtabellaTotali_Area.Draw(datitab, document);
|
|
//lastPosition = NewtabellaTotali_Area.AltezzaTabella;
|
|
//document.setLastPos(lastPosition);
|
|
}
|
|
|
|
|
|
////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(), 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;
|
|
// }
|
|
//}
|
|
////--MIFID2
|
|
|
|
//MIFID2 20180528
|
|
notaSezioneStampata = true;
|
|
if (tableCount == 0)
|
|
document.setLastPos(0);
|
|
//--MIFID2
|
|
|
|
#endregion New Negative Values section
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
/// Disegna la tabella per Area Investimento
|
|
/// Se si ha più di 1 progetto, verrà aggiunta una riga, in grassetto, per ciascun progetto
|
|
/// come titolo del progetto d'investimento.
|
|
/// </summary>
|
|
/// <param name="datitab"></param>
|
|
/// <param name="document"></param>
|
|
/// <param name="area"></param>
|
|
private void writeAreaProgetto(DataThread dataThread, DatiTabella datitab, DocumentPDF document, string area)
|
|
{
|
|
|
|
bool checkPartiteViaggiantiCrossProgetto = false;
|
|
page = document.getCurrentPage();
|
|
float lastPosition = 0;
|
|
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 tabellaHeader = null;
|
|
Tabella tabellaTitoloProgetto = null;
|
|
Tabella tabellaDatiProgetto = null;
|
|
Tabella tabTotali = null;
|
|
|
|
|
|
|
|
//setta la datatable
|
|
datitab.table = set.Tables["ProdottiAreeBisogno"];
|
|
DataTable progetti = set.Tables["DettaglioProgetti"];
|
|
DataView view = new DataView(datitab.table);
|
|
DataView viewProgetti = new DataView(progetti);
|
|
|
|
view.RowFilter = ("CodiceAreaBisogno = '" + area + "'");
|
|
|
|
#region Tabella Header
|
|
tabellaHeader = new Tabella(document.getMargineLeft(), document.getLastPos());
|
|
tabellaHeader.HeaderFont = 8;
|
|
tabellaHeader.AltezzaCella = 30;
|
|
tabellaHeader.Header = true; // la gestione dell'header viene fatta manualmente.
|
|
tabellaHeader.SaltoPagina = false;
|
|
|
|
DataView viewHeader = new DataView(datitab.table);
|
|
viewHeader.RowFilter = ("CodiceAreaBisogno = 'xxx'");
|
|
datitab.table = viewHeader.ToTable();
|
|
datitab.table.Rows.Add(datitab.table.NewRow()); // serve per far scrivere l'intestazione.
|
|
|
|
//MIFID2 20180530
|
|
string NomeArea = string.Format("{0}-{1}", area, datitab.table.Rows[0]["Progetto"]);
|
|
document.DocumentNotes.Rows.Add(NomeArea, 0, document.CurrentPage);
|
|
//--MIFID2
|
|
|
|
tabellaHeader.Colonne.Add(new Colonna("DataSottoscrizione", "Data sott.", 60, TipoAllineamento.SINISTRA, false, 7, false));
|
|
tabellaHeader.Colonne.Add(new Colonna("<IMAGE>", " ", 5, TipoAllineamento.DESTRA, false, 7, false, TipoColonna.IMMAGINE));
|
|
tabellaHeader.Colonne.Add(new Colonna("Descrizione", "Descrizione", 227, TipoAllineamento.SINISTRA, false, 7, false));
|
|
|
|
tabellaHeader.Colonne.Add(new Colonna("Controvalore", "Controvalore (€)", 90, TipoAllineamento.DESTRA, false, 7, false));
|
|
tabellaHeader.Colonne.Add(new Colonna("CreditRisk", "Rischio<BR>Credito", 65, TipoAllineamento.DESTRA, false, 7, false));
|
|
tabellaHeader.Colonne.Add(new Colonna("Var", "Rischio<BR>(VaR %)", 65, TipoAllineamento.DESTRA, false, 7, false));
|
|
|
|
|
|
|
|
datitab.setCellSpace(0);
|
|
//Scrive la tabellaHeader
|
|
tabellaHeader.Draw(datitab, document);
|
|
ytabella += tabellaHeader.AltezzaTabella;
|
|
#endregion
|
|
|
|
// cicla sui progetti
|
|
int j = progetti.Rows.Count;
|
|
int iProgetti = 0; // contatore dei progetti
|
|
|
|
//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, "tabella_" + area, ""));
|
|
//--MIFID2
|
|
|
|
//Nota a piedi della tabella
|
|
// Imposto la nota a piedi della Tabella
|
|
DataView viewAreaInvestimento = new DataView(set.Tables["ProdottiAreeBisogno"]);
|
|
viewAreaInvestimento.RowFilter = "CodiceAreaBisogno= 'Inv'";
|
|
|
|
if (viewAreaInvestimento.Count > 0)
|
|
notaGradoCopertura = viewAreaInvestimento.ToTable().Rows[0]["Copertura"] == DBNull.Value ? string.Empty : viewAreaInvestimento.ToTable().Rows[0]["Copertura"].ToString();
|
|
|
|
if (notaGradoCopertura.Length > 0)
|
|
document.Note.Add(new Nota(Nota.TipologiaNota.GradoCopertura, "tabella_" + area, notaGradoCopertura));
|
|
|
|
document.Note.RemoveAt(0);
|
|
|
|
|
|
foreach (DataRow Row in progetti.Rows)
|
|
{
|
|
if (string.IsNullOrEmpty(_Progetto) || _Progetto == Row["NomeProgetto"].ToString())
|
|
{
|
|
totProgetto = Convert.ToDecimal(Row["Controvalore"]);
|
|
varProgetto = Row["Var"].ToString();
|
|
|
|
if (j > 0)
|
|
j--;
|
|
|
|
datitab.CellClear();
|
|
datitab.table = set.Tables["ProdottiAreeBisogno"];
|
|
view = new DataView(datitab.table);
|
|
view.RowFilter = ("CodiceAreaBisogno = '" + area + "'");
|
|
viewProgetti.RowFilter = ("NomeProgetto = '" + Row["NomeProgetto"].ToString().Replace("'", "''") + "'");
|
|
view.RowFilter = ("Progetto = '" + Row["NomeProgetto"].ToString().Replace("'", "''") + "'");
|
|
datitab.table = viewProgetti.ToTable();
|
|
|
|
// se il ctv del progetto investimento = 0 e VaR = n.c la tabella tabellaTitoloProgetto avrà solo la colonna "nomeProgetto"
|
|
decimal ctvProgettoInvestimento = Convert.ToDecimal(datitab.table.Compute("Sum(Controvalore)", "nomeProgetto = '" + Row["nomeprogetto"].ToString().Replace("'", "''") + "'"));
|
|
|
|
//bool _mostraSoloNomeProgetto = false;
|
|
// if (ctvProgettoInvestimento <= 0)
|
|
// _mostraSoloNomeProgetto = true; // mostrerò solo la colonna "NomeProgetto" per i progetti che hanno ctv pari a 0
|
|
|
|
if (string.IsNullOrEmpty(_Progetto))
|
|
{
|
|
// TABELLA TITOLO DEL PROGETTO
|
|
tabellaTitoloProgetto = new Tabella(document.getMargineLeft(), document.getLastPos() + ytabella);
|
|
tabellaTitoloProgetto.HeaderFont = 8;
|
|
tabellaTitoloProgetto.Header = false;
|
|
tabellaTitoloProgetto.SaltoPagina = false;
|
|
tabellaTitoloProgetto.Datasource = datitab.table;
|
|
|
|
|
|
datitab.setCellSpace(0);
|
|
datitab.setAlternRet();
|
|
|
|
tabellaTitoloProgetto.Draw(datitab, document);
|
|
ytabella += tabellaTitoloProgetto.AltezzaTabella;
|
|
stampatatabellaTitoloProgetto = true;
|
|
}
|
|
|
|
datitab.CellClear();
|
|
datitab.table = view.ToTable();
|
|
|
|
// TABELLA DATI PROGETTO.
|
|
//Tabella tabellaDatiProgetto;
|
|
tabellaDatiProgetto = new Tabella(document.getMargineLeft(), document.getLastPos() + ytabella);
|
|
tabellaDatiProgetto.HeaderFont = 8;
|
|
tabellaDatiProgetto.Datasource = datitab.table;
|
|
tabellaDatiProgetto.Header = false;
|
|
tabellaDatiProgetto.SaltoPaginaForzato = stampatatabellaTitoloProgetto;
|
|
tabellaDatiProgetto.Id = "tabella_" + area;
|
|
|
|
tabellaDatiProgetto.LineaFineTabella = true;
|
|
|
|
if (notaGradoCopertura.Length > 0)
|
|
tabellaDatiProgetto.NotaTabella.Add(document.Note.Find(Nota.TipologiaNota.GradoCopertura, tabellaDatiProgetto.Id).Testo);
|
|
|
|
|
|
tabellaDatiProgetto.Colonne.Add(new Colonna("DataSottoscrizione", "Data sott.", 60, TipoAllineamento.SINISTRA, false, 7, false));
|
|
tabellaDatiProgetto.Colonne.Add(new Colonna("<IMAGE>", " ", 5, TipoAllineamento.DESTRA, false, 7, false, TipoColonna.IMMAGINE));
|
|
tabellaDatiProgetto.Colonne.Add(new Colonna("Descrizione", "Descrizione", 227, TipoAllineamento.SINISTRA, false, 7, false));
|
|
|
|
tabellaDatiProgetto.Colonne.Add(new Colonna("Controvalore", "Controvalore (€)", 90, TipoAllineamento.DESTRA, false, 7, false));
|
|
tabellaDatiProgetto.Colonne.Add(new Colonna("CreditRisk", "Rischio<BR>Credito", 65, TipoAllineamento.DESTRA, false, 7, false));
|
|
tabellaDatiProgetto.Colonne.Add(new Colonna("Var", "Rischio<BR>(VaR %)", 65, TipoAllineamento.DESTRA, false, 7, false));
|
|
|
|
|
|
// scrivo la tabellaDatiProgetto
|
|
//MIFID2 20180528
|
|
//tabellaDatiProgetto.Draw(datitab, document);
|
|
//tabellaDatiProgetto.Draw(datitab, document, notaSezione, tableCount == 0, ref notaSezioneStampata);
|
|
tabellaDatiProgetto.DrawMonitoraggio(datitab, document, notaSezione, tableCount == 0, ref notaSezioneStampata);
|
|
//--MIFID2
|
|
|
|
|
|
checkPartiteViaggiantiCrossProgetto |= tabellaDatiProgetto.WithImage;
|
|
if (tabellaDatiProgetto.SaltoPaginaEffettuato)
|
|
ytabella = tabellaDatiProgetto.AltezzaCella;
|
|
|
|
ytabella += tabellaDatiProgetto.AltezzaTabella;
|
|
}
|
|
|
|
iProgetti++;
|
|
}
|
|
|
|
|
|
#region Scrivi Totale
|
|
|
|
|
|
datitab = new DatiTabella();
|
|
datitab.table = set.Tables["ProdottiTotale"];
|
|
datitab.CellClear();
|
|
|
|
DataView view2 = new DataView(datitab.table);
|
|
view2.RowFilter = ("CodiceAreaBisogno = '" + area + "'");
|
|
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, tabellaDatiProgetto.Id).ToString();
|
|
|
|
|
|
if (_Progetto != null)
|
|
{
|
|
//ASSEGNA I VALORI DEL SINGOLO PROGETTO ALLA TABELLA DEI TOTALI
|
|
datitab.table.Rows[0]["Totale"] = "TOTALE " + _Progetto.ToUpper();
|
|
datitab.table.Rows[0]["Controvalore"] = totProgetto;
|
|
datitab.table.Rows[0]["Var"] = varProgetto;
|
|
}
|
|
|
|
// TABELLA DEI TOTALI.
|
|
float yTabellaTotali;
|
|
if (tabellaDatiProgetto.SaltoPaginaEffettuato)
|
|
yTabellaTotali = tabellaDatiProgetto.AltezzaTabella;
|
|
else
|
|
yTabellaTotali = ytabella;
|
|
|
|
if (tabellaDatiProgetto.SaltoPaginaEffettuato)
|
|
yTabellaTotali += 25;
|
|
|
|
tabTotali = new Tabella(document.getMargineLeft(), document.getLastPos() + yTabellaTotali);
|
|
tabTotali.HeaderFont = 8;
|
|
tabTotali.Header = false;
|
|
tabTotali.SaltoPagina = false;
|
|
|
|
tabTotali.Colonne.Add(new Colonna("Totale", string.Empty, 300, TipoAllineamento.SINISTRA, true, 8, true));
|
|
tabTotali.Colonne.Add(new Colonna("Controvalore", string.Empty, 82, TipoAllineamento.DESTRA, true, 8, true));
|
|
tabTotali.Colonne.Add(new Colonna("Var", string.Empty, 128, TipoAllineamento.DESTRA, true, 8, true));
|
|
|
|
|
|
/// disegna la tabella dei totali.
|
|
tabTotali.Draw(datitab, document);
|
|
lastPosition = yTabellaTotali;
|
|
|
|
|
|
//MIFID2 20180529 DocumentNotes
|
|
// Memorizzare la posizione della nota e il numero pagina
|
|
|
|
//document.DocumentNotes.Rows.Add(NomeArea, document.getLastPos() + lastPosition, document.CurrentPage);
|
|
|
|
// 20180619 se c'è la nota grado copertura bisogna aggiungere spazio
|
|
//document.AddDocumentNote(NomeArea, document.getLastPos() + lastPosition, document.CurrentPage);
|
|
|
|
if (!string.IsNullOrEmpty(notaGradoCopertura))
|
|
{
|
|
document.AddDocumentNote(NomeArea, document.getLastPos() + lastPosition + 10, document.CurrentPage);
|
|
document.setLastPos(lastPosition);
|
|
}
|
|
else
|
|
{
|
|
document.AddDocumentNote(NomeArea, document.getLastPos() + lastPosition, document.CurrentPage);
|
|
document.setLastPos(lastPosition + 50); //+10
|
|
}
|
|
//--20180619
|
|
|
|
//--MIFID2
|
|
|
|
// imposta l'ultima posizione da cui si puo scrivere.
|
|
//MIFID2 20180528
|
|
//document.setLastPos(lastPosition + 10);
|
|
|
|
notaSezioneStampata = true;
|
|
//--MIFID2
|
|
|
|
#endregion
|
|
}
|
|
|
|
|
|
|
|
/// <summary>
|
|
/// Disegna la tabella per Area d'investimento
|
|
/// Usata per area Investimento nel report di monitoraggio
|
|
/// (ovvero quando il progetto d'investimento non è monitorato e si vuol stampare la S43 al posto della S43BIS)
|
|
/// </summary>
|
|
/// <param name="dataThread"></param>
|
|
/// <param name="datitab"></param>
|
|
/// <param name="document"></param>
|
|
/// <param name="area"></param>
|
|
private void writeAreaProgetto_Monitoraggio(DataThread dataThread, DatiTabella datitab, DocumentPDF document, string area)
|
|
{
|
|
|
|
FormatNum conv = new FormatNum();
|
|
float dim = 0;
|
|
string notaGradoCopertura = string.Empty;
|
|
|
|
page = document.getCurrentPage();
|
|
|
|
|
|
|
|
// decimal totProgetto = 0;
|
|
//string varProgetto = " ";
|
|
//bool stampatatabellaTitoloProgetto = false;
|
|
//float ytabella = 0; // unico incremento per la y di tutte le tabelle.
|
|
|
|
//Tabella tabellaDatiProgetto = null;
|
|
Tabella tabTotali = null;
|
|
|
|
|
|
//setta la datatable
|
|
datitab.table = set.Tables["ProdottiAreeBisogno"];
|
|
|
|
// filtro per l'area
|
|
DataView view = new DataView(datitab.table);
|
|
if (dataThread.Periodico)
|
|
view.RowFilter = ("OrdinamentoProgetto='" + _ordinamentoProgetto + "' and CodiceAreaBisogno = '" + dataThread.Area + "' and Progetto='" + dataThread.Progetto.Replace("'", "''") + "'");
|
|
else
|
|
view.RowFilter = ("'CodiceAreaBisogno = '" + dataThread.Area + "' and Progetto='" + dataThread.Progetto.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(dataThread.Progetto.ToUpper()))
|
|
row.Delete();
|
|
}
|
|
document.Areas.AcceptChanges();
|
|
}
|
|
//--MIFID2
|
|
|
|
|
|
//MIFID2 20180530
|
|
string NomeArea = string.Format("{0}-{1}", area, datitab.table.Rows[0]["Progetto"]);
|
|
document.DocumentNotes.Rows.Add(NomeArea, 0, document.CurrentPage);
|
|
//--MIFID2
|
|
|
|
if (datitab.table.Rows.Count > 0)
|
|
{
|
|
#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 = "tabellaS43perMonitoraggio_" + area;
|
|
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("DataSottoscrizione", "Data sott.", 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", 227, TipoAllineamento.SINISTRA, false, 7, false));
|
|
|
|
tabellaDettaglio_Area.Colonne.Add(new Colonna("Controvalore", "Controvalore (€)*", 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 %)", 65, TipoAllineamento.DESTRA, false, 7, false));
|
|
|
|
|
|
|
|
// Scrivo la tabella tabella Dati
|
|
//tabellaDettaglio_Area.Draw(datitab, document);
|
|
tabellaDettaglio_Area.DrawMonitoraggio(datitab, document, notaSezione, tableCount == 0, ref notaSezioneStampata);
|
|
|
|
#endregion Tabella Dati
|
|
|
|
#region Tabella Totale
|
|
|
|
datitab = new DatiTabella();
|
|
datitab.table = set.Tables["ProdottiTotale"];
|
|
datitab.CellClear();
|
|
|
|
DataView viewTotali = new DataView(datitab.table);
|
|
viewTotali.RowFilter = ("CodiceAreaBisogno = '" + area + "'");
|
|
datitab.table = viewTotali.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();
|
|
|
|
|
|
// d.lisena.
|
|
// mi apsetto i dati in un datatable, li ritrovo in un altro. La Ds43 va rifatta da capo.
|
|
DataView viewDettaglioProgetti = new DataView(set.Tables["DettaglioProgetti"]);
|
|
if (dataThread.Periodico)
|
|
viewDettaglioProgetti.RowFilter = "OrdinamentoProgetto = '" + _ordinamentoProgetto + "'";
|
|
else
|
|
viewDettaglioProgetti.RowFilter = "NomeProgetto = '" + dataThread.Progetto.Replace("'", "''") + "'";
|
|
DataTable dtDettaglioProgetti = viewDettaglioProgetti.ToTable();
|
|
decimal controvaloreTotaleProgetto = Convert.ToDecimal(dtDettaglioProgetti.Rows[0]["Controvalore"]);
|
|
string varTotaleProgetto = dtDettaglioProgetti.Rows[0]["Var"].ToString();
|
|
|
|
|
|
// d.lisena.
|
|
// mi apsetto i dati in un datatable, li ritrovo in un altro. La Ds43 va rifatta da capo.
|
|
datitab.table.Rows[0]["Totale"] = "TOTALE " + dataThread.Progetto.ToUpper();
|
|
datitab.table.Rows[0]["Controvalore"] = controvaloreTotaleProgetto;
|
|
datitab.table.Rows[0]["Var"] = varTotaleProgetto;
|
|
|
|
//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();
|
|
|
|
tabTotali = new Tabella(document.getMargineLeft(), document.getLastPos() + tabellaDettaglio_Area.AltezzaTabella + 25);
|
|
tabTotali.HeaderFont = 8;
|
|
tabTotali.Header = false;
|
|
tabTotali.SaltoPagina = false;
|
|
|
|
tabTotali.Colonne.Add(new Colonna("Totale", string.Empty, 300, TipoAllineamento.SINISTRA, true, 8, true));
|
|
tabTotali.Colonne.Add(new Colonna("Controvalore", string.Empty, 82, TipoAllineamento.DESTRA, true, 8, true));
|
|
tabTotali.Colonne.Add(new Colonna("Var", string.Empty, 128, TipoAllineamento.DESTRA, true, 8, true));
|
|
|
|
|
|
/// disegna la tabella dei totali.
|
|
tabTotali.Draw(datitab, document);
|
|
|
|
dim = tabTotali.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'è la nota grado copertura bisogna aggiungere spazio
|
|
//document.AddDocumentNote(NomeArea, document.getLastPos() + lastPosition, 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);
|
|
}
|
|
//--20180619
|
|
|
|
//--MIFID2
|
|
|
|
//tabellaDettaglio_Area.AddNotaPartiteViaggianti(dim, document);
|
|
//document.setLastPos(dim);
|
|
|
|
#endregion
|
|
}
|
|
}
|
|
|
|
|
|
|
|
/// <summary>
|
|
/// Imposta o recupera l'area di bisogno per cui stampare la sezione.
|
|
/// Se non impostata stampa la sezione per tutte le aree/progetti
|
|
/// </summary>
|
|
public string Area
|
|
{
|
|
get
|
|
{
|
|
return _Area;
|
|
}
|
|
set
|
|
{
|
|
_Area = value;
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// Imposta o recupera il nome del progetto per cui stampare la sezione.
|
|
/// Se non impostata stampa la sezione per tutte le aree/progetti
|
|
/// </summary>
|
|
public string Progetto
|
|
{
|
|
get
|
|
{
|
|
return _Progetto;
|
|
}
|
|
set
|
|
{
|
|
_Progetto = value;
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// Mostra il titolo della sezione (es Riserva, Liquidità,Extra rendimento ... )
|
|
/// Di default true.
|
|
/// </summary>
|
|
public bool MostraTitoloSezione
|
|
{
|
|
get { return _mostratitolosezione; }
|
|
set { _mostratitolosezione = value; }
|
|
}
|
|
|
|
/// <summary>
|
|
/// Imposta o recupera il titolo della sezione (es Riserva, Liquidità,Extra rendimento ... ).
|
|
/// Di default il titolo è preso dal database a meno che questa proprietà sia impostata e non sia impostata a true anche la MostraTitoloSezione.
|
|
/// </summary>
|
|
public string TitoloSezione
|
|
{
|
|
get { return _titolosezione; }
|
|
set { _titolosezione = value; }
|
|
}
|
|
}
|
|
}
|