956 lines
41 KiB
C#
956 lines
41 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;
|
|
|
|
namespace PDFGenerator.Presentation.Section
|
|
{
|
|
public class S160 : ISezione
|
|
{
|
|
|
|
DataSetS160 set;
|
|
ImportedPage page;
|
|
|
|
string _Area;
|
|
string _Progetto;
|
|
private string _titolosezione = string.Empty;
|
|
private string _ordinamentoProgetto = string.Empty;
|
|
|
|
public string OrdinamentoProgetto
|
|
{
|
|
get { return _ordinamentoProgetto; }
|
|
set { _ordinamentoProgetto = value; }
|
|
}
|
|
|
|
|
|
public S160()
|
|
{
|
|
//
|
|
// 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)
|
|
{
|
|
|
|
bool _mostratitolosezione = true;
|
|
string printedArea = string.Empty;
|
|
DocumentPDF document = dataThread.DocumentPDF;
|
|
DatiTabella datitab = new DatiTabella();
|
|
set = (DataSetS160)dataThread.Data.DatiSezione;
|
|
|
|
if (document.checkMargin(datitab.GetRowDim() * 5))
|
|
document.addPage();
|
|
|
|
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;
|
|
|
|
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à
|
|
string titoloLiq = "Liquidità";
|
|
drFilterAreaProgetto = dtTabellaDati.Select(" CodiceAreaBisogno = 'Liq'");
|
|
|
|
if (drFilterAreaProgetto.Length > 0)
|
|
{
|
|
if (string.IsNullOrEmpty(printedArea))
|
|
printedArea += "'Liq'";
|
|
else
|
|
printedArea += " , 'Liq'";
|
|
|
|
if (document.checkMargin(datitab.GetRowDim() * 4))
|
|
document.addPage();
|
|
|
|
if (_mostratitolosezione) {
|
|
if (string.IsNullOrEmpty(_titolosezione))
|
|
{
|
|
if (!titoloLiq.Equals(""))
|
|
{
|
|
document.setTitolo("Liquidità");
|
|
titoloLiq = "";
|
|
}
|
|
}
|
|
else
|
|
document.setTitolo(_titolosezione);
|
|
}
|
|
|
|
this.writeArea(dataThread, datitab, document, "Liq");
|
|
}
|
|
#endregion
|
|
|
|
#region Conto Corrente a saldo negativo
|
|
|
|
drFilterAreaProgetto = dtTabellaDati.Select(" CodiceAreaBisogno = 'Cc'");
|
|
|
|
|
|
if (drFilterAreaProgetto.Length > 0 && set.ContoCorrente.Rows.Count > 0)
|
|
{
|
|
|
|
if (string.IsNullOrEmpty(printedArea))
|
|
printedArea += "'CC'";
|
|
else
|
|
printedArea += " , 'CC'";
|
|
|
|
if (document.checkMargin(datitab.GetRowDim() * 4))
|
|
document.addPage();
|
|
|
|
if (_mostratitolosezione)
|
|
{
|
|
if (string.IsNullOrEmpty(_titolosezione))
|
|
{
|
|
if (!titoloLiq.Equals(""))
|
|
{
|
|
document.setTitolo("Liquidità");
|
|
titoloLiq = "";
|
|
}
|
|
}
|
|
else
|
|
document.setTitolo(_titolosezione);
|
|
}
|
|
|
|
this.writeArea(dataThread, datitab, document, "CC");
|
|
}
|
|
|
|
#endregion
|
|
|
|
|
|
#region Linea Self a saldo negativo
|
|
|
|
drFilterAreaProgetto = dtTabellaDati.Select(" CodiceAreaBisogno = 'Self'");
|
|
|
|
|
|
if (set.LineaSelf.Rows.Count > 0)
|
|
{
|
|
|
|
if (string.IsNullOrEmpty(printedArea))
|
|
printedArea += "'CC'";
|
|
else
|
|
printedArea += " , 'CC'";
|
|
|
|
if (document.checkMargin(datitab.GetRowDim() * 4))
|
|
document.addPage();
|
|
|
|
if (_mostratitolosezione)
|
|
{
|
|
if (string.IsNullOrEmpty(_titolosezione) )
|
|
{
|
|
if(!titoloLiq.Equals("")){
|
|
document.setTitolo("Liquidità");
|
|
titoloLiq = "";
|
|
}
|
|
}
|
|
else
|
|
document.setTitolo(_titolosezione);
|
|
}
|
|
|
|
this.writeArea(dataThread, datitab, document, "Self");
|
|
}
|
|
|
|
#endregion
|
|
|
|
|
|
#region Stampo la tabella Riserva
|
|
|
|
drFilterAreaProgetto = dtTabellaDati.Select(" CodiceAreaBisogno = 'Ris'");
|
|
|
|
if (drFilterAreaProgetto.Length > 0)
|
|
{
|
|
if (string.IsNullOrEmpty(printedArea))
|
|
printedArea += "'Ris'";
|
|
else
|
|
printedArea += " , 'Ris'";
|
|
if (document.checkMargin(datitab.GetRowDim() * 4))
|
|
document.addPage();
|
|
|
|
if (dataThread.TipoReport.ToUpper().Equals("DIAGNOSI"))
|
|
{
|
|
if (_mostratitolosezione)
|
|
{
|
|
if (string.IsNullOrEmpty(_titolosezione))
|
|
document.setTitolo("Riserva");
|
|
else
|
|
document.setTitolo(_titolosezione);
|
|
|
|
}
|
|
}
|
|
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'";
|
|
|
|
if (document.checkMargin(datitab.GetRowDim() * 4))
|
|
document.addPage();
|
|
|
|
if (dataThread.TipoReport.ToUpper().Equals("DIAGNOSI"))
|
|
{
|
|
if (_mostratitolosezione)
|
|
{
|
|
if (string.IsNullOrEmpty(_titolosezione))
|
|
document.setTitolo("Previdenza");
|
|
else
|
|
document.setTitolo(_titolosezione);
|
|
|
|
}
|
|
}
|
|
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'";
|
|
if (document.checkMargin(datitab.GetRowDim() * 4))
|
|
document.addPage();
|
|
|
|
if (dataThread.TipoReport.ToUpper().Equals("DIAGNOSI"))
|
|
{
|
|
if (_mostratitolosezione)
|
|
{
|
|
if (string.IsNullOrEmpty(_titolosezione))
|
|
document.setTitolo("Investimento");
|
|
else
|
|
document.setTitolo(_titolosezione);
|
|
}
|
|
}
|
|
|
|
this.writeArea(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'";
|
|
if (document.checkMargin(datitab.GetRowDim() * 4))
|
|
document.addPage();
|
|
|
|
if (dataThread.TipoReport.ToUpper().Equals("DIAGNOSI"))
|
|
{
|
|
if (_mostratitolosezione)
|
|
{
|
|
if (string.IsNullOrEmpty(_titolosezione))
|
|
document.setTitolo("Extra Rendimento");
|
|
else
|
|
document.setTitolo(_titolosezione);
|
|
}
|
|
}
|
|
this.writeArea(dataThread, datitab, document, "Ext");
|
|
}
|
|
|
|
#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'";
|
|
|
|
if (document.checkMargin(datitab.GetRowDim() * 4))
|
|
document.addPage();
|
|
|
|
if (dataThread.TipoReport.ToUpper().Equals("DIAGNOSI"))
|
|
{
|
|
if (_mostratitolosezione)
|
|
{
|
|
if (string.IsNullOrEmpty(_titolosezione))
|
|
document.setTitolo("Risorse non allocate");
|
|
else
|
|
document.setTitolo(_titolosezione);
|
|
}
|
|
}
|
|
|
|
|
|
this.writeArea(dataThread, datitab, document, "Na");
|
|
}
|
|
#endregion
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
#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)
|
|
{
|
|
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;
|
|
|
|
// filtro per l'area
|
|
DataView view = new DataView(datitab.table);
|
|
view.RowFilter = ("CodiceAreaBisogno = '" + area + "'");
|
|
datitab.table = view.ToTable();
|
|
|
|
#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) {
|
|
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);
|
|
}
|
|
tabellaDettaglio_Area.Colonne.Add(new Colonna("DataSottoscrizione", "Data sott.", 60, TipoAllineamento.SINISTRA, false, fontdim, false));
|
|
tabellaDettaglio_Area.Colonne.Add(new Colonna("Descrizione", "Descrizione", 292, TipoAllineamento.SINISTRA, false, fontdim, false));
|
|
tabellaDettaglio_Area.Colonne.Add(new Colonna("<IMAGE>", " ", 5, TipoAllineamento.SINISTRA, false, fontdim, false));
|
|
tabellaDettaglio_Area.Colonne.Add(new Colonna("Controvalore", "Controvalore (€)", 90, TipoAllineamento.DESTRA, false, fontdim, false));
|
|
tabellaDettaglio_Area.Colonne.Add(new Colonna("Var", "Rischio<BR>(VaR %)", 65, TipoAllineamento.DESTRA, false, fontdim, false));
|
|
tabellaDettaglio_Area.Draw(datitab, document);
|
|
|
|
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", "", 337, TipoAllineamento.SINISTRA, true, fontdim, true));
|
|
tabellaTotali_Area.Colonne.Add(new Colonna("Controvalore", "", 110, TipoAllineamento.DESTRA, true, fontdim, true));
|
|
tabellaTotali_Area.Colonne.Add(new Colonna("Var", "", 65, TipoAllineamento.DESTRA, true, fontdim, true));
|
|
|
|
tabellaTotali_Area.Draw(datitab, document);
|
|
|
|
lastPosition = tabellaTotali_Area.AltezzaTabella + tabellaDettaglio_Area.AltezzaTabella;
|
|
|
|
document.setLastPos(lastPosition);
|
|
}
|
|
#endregion
|
|
|
|
#region Conti correnti a saldo negativo
|
|
|
|
if (area.ToUpper() == "CC" && set.ContoCorrente.Rows.Count > 0)
|
|
{
|
|
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.SINISTRA, false, fontdim, false));
|
|
NewtabellaTotali_Area.Colonne.Add(new Colonna("SaldoContabile", " Saldo<BR>Contabile", 80, TipoAllineamento.DESTRA, false, fontdim, false));
|
|
NewtabellaTotali_Area.Colonne.Add(new Colonna("SaldoDisponibile", " 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));
|
|
|
|
// Scrive la tabella Totali
|
|
NewtabellaTotali_Area.Draw(datitab, document);
|
|
lastPosition = NewtabellaTotali_Area.AltezzaTabella;// +NewtabellaTotali_Area.AltezzaTabella;
|
|
|
|
document.setLastPos(lastPosition);
|
|
|
|
}
|
|
|
|
#endregion Conti correnti a saldo negativo
|
|
|
|
|
|
#region Linea Self a saldo negativo
|
|
|
|
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.Draw(datitab, document);
|
|
lastPosition = TabLineaSelf.AltezzaTabella;// +TabLineaSelf.AltezzaTabella;
|
|
document.setLastPos(lastPosition);
|
|
}
|
|
|
|
#endregion Linea Self a saldo negativo
|
|
|
|
}
|
|
|
|
|
|
/// <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.
|
|
|
|
int fontdim = 8;
|
|
tabellaHeader.Colonne.Add(new Colonna("DataSottoscrizione", "Data sott.", 60, TipoAllineamento.SINISTRA, false, fontdim, false));
|
|
//tabellaHeader.Colonne.Add(new Colonna("Descrizione", "Descrizione", 227, TipoAllineamento.SINISTRA, false, fontdim, false));
|
|
tabellaHeader.Colonne.Add(new Colonna("Descrizione", "Descrizione", 292, TipoAllineamento.SINISTRA, false, fontdim, false));
|
|
tabellaHeader.Colonne.Add(new Colonna("<IMAGE>", " ", 5, TipoAllineamento.SINISTRA, false, fontdim, false));
|
|
tabellaHeader.Colonne.Add(new Colonna("Controvalore", "Controvalore (€)", 90, TipoAllineamento.DESTRA, false, fontdim, false));
|
|
//tabellaHeader.Colonne.Add(new Colonna("CreditRisk", "Rischio<BR>Credito", 65, TipoAllineamento.DESTRA, false, fontdim, false));
|
|
tabellaHeader.Colonne.Add(new Colonna("Var", "Rischio<BR>(VaR %)", 65, TipoAllineamento.DESTRA, false, fontdim, 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
|
|
|
|
//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));
|
|
|
|
|
|
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;
|
|
|
|
if (dataThread.TipoReport.ToUpper() == "DIAGNOSI")
|
|
{
|
|
|
|
if (_mostraSoloNomeProgetto)
|
|
tabellaTitoloProgetto.Colonne.Add(new Colonna("nomeProgetto", "", 512, TipoAllineamento.SINISTRA, true, 8, false));
|
|
else
|
|
{
|
|
//tabellaTitoloProgetto.Colonne.Add(new Colonna("nomeProgetto", "", 300, TipoAllineamento.SINISTRA, true, 9, false));
|
|
//tabellaTitoloProgetto.Colonne.Add(new Colonna("Controvalore", "", 82, TipoAllineamento.DESTRA, true, 9, false));
|
|
//tabellaTitoloProgetto.Colonne.Add(new Colonna("Var", "", 128, TipoAllineamento.DESTRA, true, 9, false));
|
|
tabellaTitoloProgetto.Colonne.Add(new Colonna("nomeProgetto", "", 300, TipoAllineamento.SINISTRA, true, 9, false));
|
|
tabellaTitoloProgetto.Colonne.Add(new Colonna("Controvalore", "", 145, TipoAllineamento.DESTRA, true, 9, false));
|
|
tabellaTitoloProgetto.Colonne.Add(new Colonna("Var", "", 65, TipoAllineamento.DESTRA, true, 9, false));
|
|
}
|
|
|
|
|
|
}
|
|
|
|
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;
|
|
|
|
//EN 25012016 -nota alla fine del ultimo progetto
|
|
//if (notaGradoCopertura.Length > 0)
|
|
if ((notaGradoCopertura.Length > 0) && j == 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, fontdim, false));
|
|
//tabellaDatiProgetto.Colonne.Add(new Colonna("Descrizione", "Descrizione", 227, TipoAllineamento.SINISTRA, false, fontdim, false));
|
|
tabellaDatiProgetto.Colonne.Add(new Colonna("Descrizione", "Descrizione", 292, TipoAllineamento.SINISTRA, false, fontdim, false));
|
|
tabellaDatiProgetto.Colonne.Add(new Colonna("<IMAGE>", " ", 5, TipoAllineamento.SINISTRA, false, fontdim, false));
|
|
tabellaDatiProgetto.Colonne.Add(new Colonna("Controvalore", "Controvalore (€)", 90, TipoAllineamento.DESTRA, false, fontdim, false));
|
|
// tabellaDatiProgetto.Colonne.Add(new Colonna("CreditRisk", "Rischio<BR>Credito", 65, TipoAllineamento.DESTRA, false, fontdim, false));
|
|
tabellaDatiProgetto.Colonne.Add(new Colonna("Var", "Rischio<BR>(VaR %)", 65, TipoAllineamento.DESTRA, false, fontdim, false));
|
|
|
|
|
|
// scrivo la tabellaDatiProgetto
|
|
tabellaDatiProgetto.Draw(datitab, document);
|
|
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));
|
|
|
|
tabTotali.Colonne.Add(new Colonna("Totale", string.Empty, 300, TipoAllineamento.SINISTRA, true, 8, true));
|
|
tabTotali.Colonne.Add(new Colonna("Controvalore", string.Empty, 145, TipoAllineamento.DESTRA, true, 8, true));
|
|
tabTotali.Colonne.Add(new Colonna("Var", string.Empty, 65, TipoAllineamento.DESTRA, true, 8, true));
|
|
|
|
|
|
/// disegna la tabella dei totali.
|
|
tabTotali.Draw(datitab, document);
|
|
lastPosition = yTabellaTotali;
|
|
|
|
// imposta l'ultima posizione da cui si puo scrivere.
|
|
document.setLastPos(lastPosition + 10);
|
|
|
|
#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();
|
|
|
|
|
|
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;
|
|
|
|
#region Settaggio delle Note a piedi della tabella
|
|
|
|
|
|
//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);
|
|
}
|
|
|
|
|
|
#endregion
|
|
|
|
int fontdim = 8;
|
|
tabellaDettaglio_Area.Colonne.Add(new Colonna("DataSottoscrizione", "Data sott.", 60, TipoAllineamento.SINISTRA, false, fontdim, false));
|
|
//tabellaDettaglio_Area.Colonne.Add(new Colonna("Descrizione", "Descrizione", 227, TipoAllineamento.SINISTRA, false, fontdim, false));
|
|
tabellaDettaglio_Area.Colonne.Add(new Colonna("Descrizione", "Descrizione", 292, TipoAllineamento.SINISTRA, false, fontdim, false));
|
|
tabellaDettaglio_Area.Colonne.Add(new Colonna("<IMAGE>", " ", 5, TipoAllineamento.SINISTRA, false, fontdim, false));
|
|
tabellaDettaglio_Area.Colonne.Add(new Colonna("Controvalore", "Controvalore (€)", 90, TipoAllineamento.DESTRA, false, fontdim, false));
|
|
//tabellaDettaglio_Area.Colonne.Add(new Colonna("CreditRisk", "Rischio<BR>Credito", 65, TipoAllineamento.DESTRA, false, fontdim, false));
|
|
tabellaDettaglio_Area.Colonne.Add(new Colonna("Var", "Rischio<BR>(VaR %)", 65, TipoAllineamento.DESTRA, false, fontdim, false));
|
|
|
|
|
|
|
|
// Scrivo la tabella tabella Dati
|
|
tabellaDettaglio_Area.Draw(datitab, document);
|
|
#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;
|
|
|
|
|
|
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, fontdim, true));
|
|
tabTotali.Colonne.Add(new Colonna("Controvalore", string.Empty, 82, TipoAllineamento.DESTRA, true, fontdim, true));
|
|
tabTotali.Colonne.Add(new Colonna("Var", string.Empty, 128, TipoAllineamento.DESTRA, true, fontdim, true));
|
|
|
|
|
|
/// disegna la tabella dei totali.
|
|
tabTotali.Draw(datitab, document);
|
|
|
|
dim = tabTotali.AltezzaTabella + tabellaDettaglio_Area.AltezzaTabella;
|
|
|
|
//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>
|
|
/// 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; }
|
|
}
|
|
|
|
}
|
|
}
|