2025-04-15 12:10:19 +02:00

151 lines
5.9 KiB
C#
Raw Permalink Blame History

This file contains ambiguous Unicode characters

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

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using PDFGenerator.BusinessLayer.DataSection;
using PDFGenerator.BusinessLayer;
using PDFGenerator.Presentation.Section.Tables;
using System.Data;
namespace PDFGenerator.Presentation.Section
{
class S333 : ISezione
{
private string _titolo = string.Empty;
private string _testointroduttivo = string.Empty;
/// <summary>
/// Titolo della sezione
/// </summary>
public string Titolo
{
get
{
return _titolo;
}
set
{
_titolo = value;
}
}
/// <summary>
/// Testo introduttivo della Sezione.
/// </summary>
public string TestoIntroduttivo
{
get
{
return _testointroduttivo;
}
set
{
_testointroduttivo = value;
}
}
public S333()
{
//
// TODO: Add constructor logic here
//
}
public void writeSezione(DataThread dataThread)
{
DocumentPDF document = dataThread.DocumentPDF;
document.setSezTitolo(dataThread.SezioneReport.Titolo);
DataSetS333 set = (DataSetS333)dataThread.Data.DatiSezione;
if (set.Protetti.Rows.Count > 0)
{
if (document.checkMargin(100))
document.addPage();
//set.ProfiloVersatoNetto.Rows.Count
string testo = dataThread.SezioneReport.TestoIntroduttivo.Replace("/$Banca$/", dataThread.NomeRete);
testo = testo.Replace("$/Prodotto/$", set.Protetti.Rows[0]["DES_PROD"].ToString());
testo = testo.Replace("$/QMaxPerc/$", set.Protetti.Rows[0]["QUOTA_MAX_PERC"].ToString());
document.setChapterHeader(testo, 0, 520, 8);
CapitaleProtetto(dataThread);
//addNota(document);
}
}
private void CapitaleProtetto(DataThread dataThread)
{
DocumentPDF document = dataThread.DocumentPDF;
DataSetS333 set = (DataSetS333)dataThread.Data.DatiSezione;
float htestosotto = 0;
for (int r = 0; r < set.Protetti.Rows.Count; r++)
{
Tabella tabellaDati = new Tabella();
tabellaDati.HeaderFont = 8;
DataRow riga = set.Protetti.Rows[r];
if (r == set.Protetti.Rows.Count - 1) htestosotto = 100;
if (document.checkMargin((tabellaDati.AltezzaCella * 4) + htestosotto))
document.addPage();
tabellaDati.Header = true;
tabellaDati.Y = document.getLastPos();
tabellaDati.X = document.getMargineLeft();
tabellaDati.Colonne.Add(new Colonna("DESCRIZIONE","Contratto " + riga["COD_CONF"], 232, TipoAllineamento.SINISTRA, false, 7, false));
tabellaDati.Colonne.Add(new Colonna("QUOTA", "Quota (€)", 60, TipoAllineamento.DESTRA, false, 7, false));
tabellaDati.Colonne.Add(new Colonna("NUMEROQUOTE", "Numero Quote", 60, TipoAllineamento.DESTRA, false, 7, false));
tabellaDati.Colonne.Add(new Colonna("CONTROVALORE", "Controvalore (€)", 90, TipoAllineamento.DESTRA, false, 7, false));
tabellaDati.Colonne.Add(new Colonna("DATARIF", "Data di riferimento", 70, TipoAllineamento.DESTRA, false, 7, false));
tabellaDati.Draw(new DatiTabella(TabellaCapitaleProtetto(riga)), document);
document.setLastPos(tabellaDati.AltezzaTabella - 15);
}
string nota = dataThread.SezioneReport.NotaAlternativa;
nota = "(*) La quota protetta è pari all80% della quota massima giornaliera raggiunta dal fondo dalla data di partenza: la quota massima potrebbe variare in funzione delle condizioni di mercato. Il controvalore protetto è calcolato ipotizzando che il numero delle quote si mantenga costante nel tempo e sia quindi uguale a quello disponibile alla data di produzione del report: il numero delle quote potrebbe variare nel tempo in seguito a movimentazione da parte del cliente o in seguito ad attività di ribilanciamento, prevista dal contratto";
//nota = nota.Replace("$/QMaxPerc/$", set.Protetti.Rows[0]["QUOTA_MAX_PERC"].ToString());
document.setChapterHeader(nota, 0, 520, 8);
}
private DataTable TabellaCapitaleProtetto(DataRow riga)
{
DataTable dt = new DataTable();
dt.Columns.Add("DESCRIZIONE");
dt.Columns.Add("QUOTA");
dt.Columns.Add("NUMEROQUOTE");
dt.Columns.Add("CONTROVALORE");
dt.Columns.Add("DATARIF");
DataRow dr = dt.NewRow();
//dr["DESCRIZIONE"] = riga["DES_PROD"] +" " + riga["COD_CONF"];
dr["DESCRIZIONE"] = riga["DES_PROD"];
dr["QUOTA"] = riga["QUOTA"];
dr["NUMEROQUOTE"] = riga["NUMEROQUOTE"];
dr["CONTROVALORE"] = riga["CONTROVALORE"];
dr["DATARIF"] = riga["DATARIF"];
dt.Rows.Add(dr);
dr = dt.NewRow();
dr["DESCRIZIONE"] = riga["DES_MAX"];
dr["QUOTA"] = riga["QUOTA_MAX"];
dr["NUMEROQUOTE"] = "-";
dr["CONTROVALORE"] = "-";
dr["DATARIF"] = riga["DATARIF_MAX"];
dt.Rows.Add(dr);
dr = dt.NewRow();
dr["DESCRIZIONE"] = riga["DES_PROT"];
dr["QUOTA"] = riga["QUOTA_PROT"];
dr["NUMEROQUOTE"] = riga["NUMEROQUOTE_PROT"];
dr["CONTROVALORE"] = riga["CONTROVALORE_PROT"];
dr["DATARIF"] = "-";
dt.Rows.Add(dr);
return dt;
}
}
}