214 lines
8.6 KiB
C#
214 lines
8.6 KiB
C#
using System;
|
|
using System.Data;
|
|
using ceTe.DynamicPDF;
|
|
using ceTe.DynamicPDF.PageElements;
|
|
using ceTe.DynamicPDF.Text;
|
|
using PDFGenerator.Presentation.Section;
|
|
using PDFGenerator.BusinessLayer;
|
|
using PDFGenerator;
|
|
using PDFGenerator.Presentation.Section.Tables;
|
|
using PDFGenerator.BusinessLayer.DataSection;
|
|
using PDFGenerator.Presentation.Section.Charts;
|
|
|
|
/// <summary>
|
|
/// Summary description for S82
|
|
/// </summary>
|
|
public class S82BIS : ISezione
|
|
{
|
|
string Titolo = " ";
|
|
private string _testointroduttivo = "";
|
|
|
|
public string TestoIntroduttivo
|
|
{
|
|
get
|
|
{
|
|
return _testointroduttivo;
|
|
}
|
|
set
|
|
{
|
|
_testointroduttivo = value;
|
|
}
|
|
}
|
|
|
|
#region ISezione Members
|
|
|
|
public void writeSezione (DataThread dataThread)
|
|
{
|
|
DocumentPDF document = dataThread.DocumentPDF;
|
|
DatiTabella datitab = new DatiTabella();
|
|
DataSetS82 set = (DataSetS82)dataThread.Data.DatiSezione;
|
|
|
|
//calcola se entra nella pagina altrimenti aggiunge una nuova pagina. In questa sezione il # di righe è fissato
|
|
if (document.checkMargin(datitab.GetRowDim() * 8))
|
|
document.addPage();
|
|
|
|
ceTe.DynamicPDF.Merger.ImportedPage page = document.getCurrentPage();
|
|
|
|
document.setSezTitolo(Titolo);
|
|
document.setChapterHeader(_testointroduttivo);
|
|
document.setHeaderSpace(25);
|
|
|
|
#region Tabella Header (testo: CONTROVALORE E RISCHIO)
|
|
//qui mi carico i dati della datatable Header
|
|
datitab.table = set.Tables["Header"];
|
|
|
|
Tabella tabellaHeader = new Tabella(document.getMargineLeft(), document.getLastPos());
|
|
tabellaHeader.Header = false;
|
|
tabellaHeader.Datasource = datitab.table;
|
|
tabellaHeader.DimensioneLinea = 1;
|
|
tabellaHeader.Colonne.Add(new Colonna("Descrizione", "", 285, TipoAllineamento.SINISTRA, true, 10, true));
|
|
tabellaHeader.Draw(datitab, document);
|
|
#endregion
|
|
|
|
#region Tabella contenente CONTROVALORE e VAR con grafico Slider
|
|
datitab = new DatiTabella();
|
|
//qui mi carico i dati della datatable DatiSintetici_Dettaglio
|
|
datitab.table = set.Tables["DatiSintetici_Dettaglio"];
|
|
Tabella tabellaDSD = new Tabella(document.getMargineLeft(), document.getLastPos() + tabellaHeader.AltezzaTabella);
|
|
|
|
tabellaDSD.Header = false;
|
|
tabellaDSD.Datasource = datitab.table;
|
|
tabellaDSD.DimensioneLinea = 1;
|
|
tabellaDSD.Colonne.Add(new Colonna("Descrizione", "", 175, TipoAllineamento.SINISTRA, true, 8, false));
|
|
tabellaDSD.Colonne.Add(new Colonna("Valore", "", 110, TipoAllineamento.DESTRA, true, 8, false));
|
|
|
|
tabellaDSD.Draw(datitab, document);
|
|
|
|
//Scrivo il grafico SliderBar
|
|
Slider objSlider = new Slider();
|
|
objSlider.DatiTabella = datitab;
|
|
objSlider.DocumentPDF = document;
|
|
objSlider.PositionX = (int)document.getMargineLeft() + 120;
|
|
objSlider.PositionY = (int)(document.getLastPos() + datitab.GetRowDim() * 0.38F);
|
|
String app = (String)datitab.table.Rows[1]["Valore"];
|
|
if (app.Contains("%"))
|
|
app = app.Remove(app.LastIndexOf('%'));
|
|
if (app.Trim().ToLower() == "n.c.")
|
|
objSlider.DrawNoMarcatore();
|
|
else
|
|
objSlider.Draw(Convert.ToDecimal(app));
|
|
|
|
#endregion
|
|
|
|
#region Tabella COPERTURA
|
|
datitab = new DatiTabella();
|
|
//qui mi carico i dati della datatable DatiSintetici_Dettaglio
|
|
datitab.table = set.Tables["DT_Copertura"];
|
|
|
|
Tabella tabellaCop = new Tabella(document.getMargineLeft(), document.getLastPos() + tabellaHeader.AltezzaTabella +
|
|
tabellaDSD.AltezzaTabella + 5);
|
|
tabellaCop.Header = false;
|
|
tabellaCop.Datasource = datitab.table;
|
|
tabellaCop.DimensioneLinea = 1;
|
|
|
|
tabellaCop.Colonne.Add(new Colonna("Descrizione", "", 175, TipoAllineamento.SINISTRA, false, 8, false));
|
|
tabellaCop.Colonne.Add(new Colonna("Valore", "", 110, TipoAllineamento.DESTRA, false, 8, false));
|
|
|
|
if (tabellaCop.Datasource.Rows.Count > 0)
|
|
{
|
|
#region Linea di separazione meno marcata
|
|
//V
|
|
//page.Elements.Add(new ceTe.DynamicPDF.PageElements.Line(tabellaCop.X - 5, tabellaCop.Y - 40, tabellaCop.X + 290, tabellaCop.Y - 40, 2F, new RgbColor(232, 236, 237)));
|
|
page.Elements.Add(new ceTe.DynamicPDF.PageElements.Line(tabellaCop.X - 5, tabellaCop.Y - 40, tabellaCop.X + 290, tabellaCop.Y - 40, 1F, new RgbColor(232, 236, 237)));
|
|
//
|
|
#endregion
|
|
}
|
|
|
|
tabellaCop.Draw(datitab, document);
|
|
|
|
#endregion
|
|
|
|
#region Linea di separazione piu marcata
|
|
|
|
if (tabellaCop.Datasource.Rows.Count > 0)
|
|
page.Elements.Add(new ceTe.DynamicPDF.PageElements.Line(tabellaCop.X - 5, tabellaCop.Y - 15, tabellaCop.X + 290, tabellaCop.Y - 15, 4F, new RgbColor(232, 236, 237)));
|
|
else
|
|
page.Elements.Add(new ceTe.DynamicPDF.PageElements.Line(tabellaCop.X - 5, tabellaCop.Y - 40, tabellaCop.X + 290, tabellaCop.Y - 40, 4F, new RgbColor(232, 236, 237)));
|
|
|
|
#endregion
|
|
|
|
#region Tabelle PESO PERCENTUALE e RISCHIO RELATIVO
|
|
|
|
datitab = new DatiTabella();
|
|
//qui mi carico i dati della datatable DT_TabellaBassa
|
|
datitab.table = set.Tables["DT_TabellaBassa"];
|
|
|
|
Tabella tabellaBassa;
|
|
if (tabellaCop.Datasource.Rows.Count > 0)
|
|
tabellaBassa = new Tabella(document.getMargineLeft(), tabellaCop.Y + 30);
|
|
else
|
|
tabellaBassa = new Tabella(document.getMargineLeft(), tabellaCop.Y);
|
|
|
|
tabellaBassa.Header = false;
|
|
tabellaBassa.SaltoPagina = false;
|
|
tabellaBassa.Datasource = datitab.table;
|
|
tabellaBassa.DimensioneLinea = 1;
|
|
|
|
tabellaBassa.Colonne.Add(new Colonna("Descrizione", "", 175, TipoAllineamento.SINISTRA, false, 8, false));
|
|
tabellaBassa.Colonne.Add(new Colonna("Valore", "", 110, TipoAllineamento.DESTRA, false, 8, false));
|
|
tabellaBassa.Draw(datitab, document);
|
|
|
|
#endregion
|
|
|
|
#region Tabella Header Orizzonte Temporale
|
|
|
|
// header temporale
|
|
datitab = new DatiTabella();
|
|
datitab.table = set.Tables["HeaderTemporale"];
|
|
|
|
Tabella tabellaHeaderT;
|
|
|
|
if (tabellaCop.Datasource.Rows.Count > 0)
|
|
tabellaHeaderT = new Tabella(document.getMargineLeft(), tabellaBassa.Y + 50); // da rivedere
|
|
else
|
|
tabellaHeaderT = new Tabella(document.getMargineLeft(), tabellaBassa.Y + 50);
|
|
|
|
tabellaHeaderT.Header = false;
|
|
tabellaHeaderT.Datasource = datitab.table;
|
|
tabellaHeaderT.DimensioneLinea = 1;
|
|
tabellaHeaderT.Colonne.Add(new Colonna("Descrizione", "", 285, TipoAllineamento.SINISTRA, true, 10, true));
|
|
tabellaHeaderT.Draw(datitab, document);
|
|
|
|
#endregion
|
|
|
|
#region Tabella Dati orizzonte temporale
|
|
|
|
datitab = new DatiTabella();
|
|
//qui mi carico i dati della datatable DT_TabellaBassa
|
|
datitab.table = set.Tables["DT_OrizTemporale"];
|
|
|
|
Tabella tabellaOriz = new Tabella(document.getMargineLeft(), tabellaHeaderT.Y + tabellaHeaderT.AltezzaTabella);
|
|
tabellaOriz.SaltoPagina = false;
|
|
tabellaOriz.Header = false;
|
|
tabellaOriz.Datasource = datitab.table;
|
|
tabellaOriz.DimensioneLinea = 1;
|
|
tabellaOriz.Colonne.Add(new Colonna("Descrizione", "", 175, TipoAllineamento.SINISTRA, false, 8, false));
|
|
tabellaOriz.Colonne.Add(new Colonna("Valore", "", 110, TipoAllineamento.DESTRA, false, 8, false));
|
|
tabellaOriz.Draw(datitab, document);
|
|
|
|
#endregion
|
|
|
|
#region Linea di separazione di chiusura sezione
|
|
|
|
page.Elements.Add(new ceTe.DynamicPDF.PageElements.Line(tabellaOriz.X - 5, tabellaOriz.Y + 5, tabellaOriz.X + 290, tabellaOriz.Y + 5, 2F, new RgbColor(232, 236, 237)));
|
|
|
|
#endregion
|
|
|
|
document.setLastPos(200);
|
|
|
|
//V
|
|
dataThread.UltimaSezioneStampata = "S82";
|
|
}
|
|
|
|
|
|
public void setTitolo (string label)
|
|
{
|
|
Titolo = label;
|
|
}
|
|
|
|
#endregion
|
|
|
|
|
|
}
|
|
|