159 lines
7.4 KiB
C#
159 lines
7.4 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 PDFGenerator.Presentation.Section.Tables;
|
|
using PDFGenerator.BusinessLayer.DataSection;
|
|
using PDFGenerator.BusinessLayer;
|
|
|
|
namespace PDFGenerator.Presentation.Section
|
|
{
|
|
public class S165 : ISezione
|
|
{
|
|
|
|
DataThread dsParam = null;
|
|
string notaGradoCopertura = string.Empty;
|
|
|
|
public S165()
|
|
{
|
|
//
|
|
// TODO: Add constructor logic here
|
|
//
|
|
}
|
|
|
|
|
|
|
|
public void writeSezione(DataThread dataThread)
|
|
{
|
|
|
|
DocumentPDF document = dataThread.DocumentPDF;
|
|
|
|
DatiTabella datitab = new DatiTabella();
|
|
DataSetS165 set = (DataSetS165)dataThread.Data.DatiSezione;
|
|
datitab.table = set.Tables["Fondi"];
|
|
dsParam = dataThread;
|
|
|
|
if (document.checkMargin(datitab.GetRowDim() * (datitab.getNumRow() + 3)))
|
|
document.addPage();
|
|
document.setTitolo(dataThread.SezioneReport.Titolo);
|
|
|
|
Tabella tabellaDati = new Tabella(document.getMargineLeft(), document.getLastPos());
|
|
if (dataThread.TipoReport.ToUpper() == "DIAGNOSI") tabellaDati.HeaderFont = 8;
|
|
tabellaDati.Header = true;
|
|
tabellaDati.Datasource = datitab.table;
|
|
tabellaDati.Id = "tabellaS50";
|
|
tabellaDati.AltezzaCella = 30;
|
|
|
|
#region Settaggio delle Note di piè di pagina, delle note a piedi della tabella e degli * per i varProxati
|
|
|
|
//Imposto le nota a pie di pagina.
|
|
ImpostaNote(datitab.table, tabellaDati.Id, ref document);
|
|
|
|
|
|
//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, tabellaDati.Id, notaGradoCopertura));
|
|
tabellaDati.NotaTabella.Add(document.Note.Find(Nota.TipologiaNota.GradoCopertura, tabellaDati.Id).Testo);
|
|
}
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
if (dataThread.NumeroIntermediari > 1)
|
|
{
|
|
tabellaDati.Colonne.Add(new Colonna("Intermediario", "Intermediario", 105, TipoAllineamento.SINISTRA, false, 7, false));
|
|
tabellaDati.Colonne.Add(new Colonna("DataSottoscrizione", "Data sott.", 55, TipoAllineamento.SINISTRA, false, 7, false));
|
|
tabellaDati.Colonne.Add(new Colonna("Descrizione", "Descrizione", 157, TipoAllineamento.SINISTRA, false, 7, false));
|
|
//tabellaDati.Colonne.Add(new Colonna("Aggiornamento", "Aggiornamento", 80, TipoAllineamento.SINISTRA, false, 7, false));
|
|
tabellaDati.Colonne.Add(new Colonna("Controvalore", "Controvalore (€)", 80, TipoAllineamento.DESTRA, false, 7, false));
|
|
tabellaDati.Colonne.Add(new Colonna("CreditRisk", "Rischio<BR>Credito", 65, TipoAllineamento.DESTRA, false, 7, false));
|
|
tabellaDati.Colonne.Add(new Colonna("Var", "Rischio<BR>(VaR %)", 50, TipoAllineamento.DESTRA, false, 7, false));
|
|
}
|
|
else
|
|
{
|
|
tabellaDati.Colonne.Add(new Colonna("DataSottoscrizione", "Data sott.", 55, TipoAllineamento.SINISTRA, false, 7, false));
|
|
tabellaDati.Colonne.Add(new Colonna("Descrizione", "Descrizione", 97, TipoAllineamento.SINISTRA, false, 7, false));
|
|
//tabellaDati.Colonne.Add(new Colonna("Aggiornamento", "Aggiornamento", 80, TipoAllineamento.SINISTRA, false, 7, false));
|
|
tabellaDati.Colonne.Add(new Colonna("Controvalore", "Controvalore (€)", 80, TipoAllineamento.DESTRA, false, 7, false));
|
|
tabellaDati.Colonne.Add(new Colonna("TipoVersamento", "Tipo di versamento", 85, TipoAllineamento.SINISTRA, false, 7, false));
|
|
tabellaDati.Colonne.Add(new Colonna("Ammontare", "Ammontare versamento", 80, TipoAllineamento.DESTRA, false, 7, false));
|
|
tabellaDati.Colonne.Add(new Colonna("CreditRisk", "Rischio<BR>Credito", 65, TipoAllineamento.DESTRA, false, 7, false));
|
|
tabellaDati.Colonne.Add(new Colonna("Var", "Rischio<BR>(VaR %)", 50, TipoAllineamento.DESTRA, false, 7, false));
|
|
}
|
|
datitab.setCellSpace(0);
|
|
|
|
|
|
tabellaDati.Draw(datitab, document);
|
|
|
|
|
|
datitab = new DatiTabella();
|
|
datitab.table = set.Tables["FondiTotale"];
|
|
|
|
|
|
|
|
Tabella tabellaTotale = new Tabella(document.getMargineLeft(), document.getLastPos() + tabellaDati.AltezzaTabella + 25);
|
|
if (dataThread.TipoReport.ToUpper() == "DIAGNOSI") tabellaTotale.HeaderFont = 8;
|
|
tabellaTotale.SaltoPagina = false;
|
|
tabellaTotale.Header = false;
|
|
if (dataThread.NumeroIntermediari > 1)
|
|
{
|
|
tabellaTotale.Colonne.Add(new Colonna("Totale", "", 317, TipoAllineamento.SINISTRA, true, 8, true));
|
|
tabellaTotale.Colonne.Add(new Colonna("Controvalore", "", 80, TipoAllineamento.DESTRA, true, 8, true));
|
|
tabellaTotale.Colonne.Add(new Colonna("Var", "", 115, TipoAllineamento.DESTRA, true, 8, true));
|
|
}
|
|
else
|
|
{
|
|
tabellaTotale.Colonne.Add(new Colonna("Totale", "", 152, TipoAllineamento.SINISTRA, true, 8, true));
|
|
tabellaTotale.Colonne.Add(new Colonna("Controvalore", "", 80, TipoAllineamento.DESTRA, true, 8, true));
|
|
tabellaTotale.Colonne.Add(new Colonna("Var", "", 280, TipoAllineamento.DESTRA, true, 8, true));
|
|
}
|
|
|
|
|
|
|
|
tabellaTotale.Draw(datitab, document);
|
|
|
|
// setto la posizione aggiornata
|
|
document.setLastPos(tabellaTotale.AltezzaTabella + tabellaDati.AltezzaTabella);
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
/// Verifica se nel datatable passato in input è presente almeno un campo della colonna VarProxato con valore 1.
|
|
/// Se si aggiungo al documento un oggetto Nota di tipo VarProxato e aggiungo al valore del campo VaR gli *.
|
|
/// La S50 può avere le note a fondo pagina solo per i var proxati.
|
|
/// </summary>
|
|
/// <param name="dataTable">fonte dati</param>
|
|
/// <param name="idtabellaassociata">id della tabella a cui andrà associata la nota</param>
|
|
/// <param name="document">documento</param>
|
|
private void ImpostaNote(DataTable dataTable, string idtabellaassociata, ref DocumentPDF document)
|
|
{
|
|
DataRow[] drVarProxato = dataTable.Select("VarProxato=1");
|
|
|
|
if (drVarProxato.Length > 0)
|
|
if (!document.Note.Exists(delegate(Nota t) { return t.TipoNota == Nota.TipologiaNota.VarProxato; }))
|
|
document.Note.Add(new Nota(Nota.TipologiaNota.VarProxato, idtabellaassociata, Resource.Nota_VarProxato));
|
|
|
|
//aggiungo al valore del campo VaR gli *
|
|
foreach (DataRow row in drVarProxato)
|
|
{
|
|
if (row["VaR"].ToString().ToLower() != "n.c.")
|
|
row["VaR"] += document.Note.Find(delegate(Nota nota) { return nota.TipoNota == Nota.TipologiaNota.VarProxato; }).ToString();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
} |