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

91 lines
3.0 KiB
C#

using System;
using System.Collections.Generic;
using System.Text;
using PDFGenerator.BusinessLayer;
using PDFGenerator.BusinessLayer.DataSection;
using PDFGenerator.Presentation.Section.Tables;
using ceTe.DynamicPDF;
namespace PDFGenerator.Presentation.Section
{
class S93: ISezione
{
string Titolo = string.Empty;
private string _testoIntroduttivo;
public S93()
{
//
// TODO: Add constructor logic here
//
}
public string TestoIntroduttivo
{
get { return _testoIntroduttivo; }
set { _testoIntroduttivo = value; }
}
public void writeSezione(DataThread dataThread)
{
DocumentPDF document = dataThread.DocumentPDF;
DatiTabella datitab = new DatiTabella();
DataSetS93 set = (DataSetS93)dataThread.Data.DatiSezione;
datitab.table = set.Tables["Dati"];
//calcola se entra nella pagina altrimenti aggiunge una nuova pagina.
if (document.checkMargin(datitab.GetRowDim() * (datitab.getNumRow() + 3)))
document.addPage();
document.setSezTitolo(Titolo);
document.setSezHeader(_testoIntroduttivo);
document.setHeaderSpace(30);
/// linea sopra risorse finanziare.
ceTe.DynamicPDF.Merger.ImportedPage page = document.getCurrentPage();
page.Elements.Add(new ceTe.DynamicPDF.PageElements.Line(document.getMargineLeft() - 5,document.getLastPos() - 37 ,document.getMargineLeft() + 285,document.getLastPos() -37 ,2F,new RgbColor(232, 236, 237)));
Tabella tabellaDati = new Tabella(document.getMargineLeft(), document.getLastPos());
tabellaDati.Header = false;
tabellaDati.Datasource = datitab.table;
tabellaDati.DimensioneLinea = 2;
tabellaDati.Colonne.Add(new Colonna("Descrizione", "", 130, TipoAllineamento.SINISTRA, false, 8, false));
tabellaDati.Colonne.Add(new Colonna("Controvalore", "", 150, TipoAllineamento.DESTRA, false, 8, false));
datitab.setCellSpace(0);
tabellaDati.Draw(datitab, document);
// Totale
datitab = new DatiTabella();
datitab.table = set.Tables["Totali"];
Tabella tabellaTotale = new Tabella(document.getMargineLeft(), document.getLastPos() + tabellaDati.AltezzaTabella);
tabellaTotale.SaltoPagina = false;
tabellaTotale.Header = false;
tabellaTotale.Colonne.Add(new Colonna("Descrizione", "", 130, TipoAllineamento.SINISTRA, true, 9, true));
tabellaTotale.Colonne.Add(new Colonna("Controvalore", "", 150, TipoAllineamento.DESTRA, true, 9, true));
tabellaTotale.Draw(datitab, document);
// setto la posizione aggiornata
document.setLastPos(tabellaDati.AltezzaTabella);
}
public void setTitolo(string label)
{
Titolo = label;
}
}
}