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

82 lines
3.0 KiB
C#

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;
using PDFGenerator.Presentation.Section.Tables;
using PDFGenerator.BusinessLayer.DataSection;
using PDFGenerator.BusinessLayer;
namespace PDFGenerator.Presentation.Section
{
public class FD150 : ISezione
{
public FD150()
{
}
#region ISezione Members
public void writeSezione(DataThread dataThread)
{
DocumentPDF document = dataThread.DocumentPDF;
DatiTabella datitab = new DatiTabella();
DataSetS150 set = (DataSetS150)dataThread.Data.DatiSezione;
datitab.table = set.Tables["DatiAnagrafici"];
//eventuali operazioni sul dataset
DataView view = new DataView(datitab.table);
view.RowFilter = "Descrizione = 'Cliente'";
DataTable newTable = view.ToTable();
// Non aggiunge la riga vuota nel caso di cliente di tipo fiduciarie
if (!newTable.Rows[0]["Valore"].ToString().Contains("-"))
newTable.Rows.Add(newTable.NewRow());
datitab.table = newTable;
//calcola se entra nella pagina altrimenti aggiunge una nuova pagina. In questa sezione il # di righe è fissato
if (document.checkMargin(datitab.GetRowDim() * datitab.getNumRow()))
document.addPage();
datitab.SetRowDim(25);
datitab.setIsLinee(2);
datitab.setCell(170, ceTe.DynamicPDF.TextAlign.Left, Globals.OpenTypeFontVerdanaB, true);
datitab.setCell(343, ceTe.DynamicPDF.TextAlign.Left, Globals.OpenTypeFontVerdanaB, false);
//if (dataThread.TipoReport.ToUpper() == "DIAGNOSI")
// document.setSezTitoloDiagnosi(dataThread.SezioneReport.Titolo);
//else
document.setSezTitolo(dataThread.SezioneReport.Titolo);
datitab.setY(document.getLastPos());
datitab.setX(document.getMargineLeft());
Tabella tab = new Tabella();
if (dataThread.TipoReport.ToUpper() == "DIAGNOSI") tab.HeaderFont = 8;
//setta posizione tabella
document.InsertTable(tab.getTabella(datitab));
datitab = new DatiTabella();
datitab.table = set.Tables["DatiAnagrafici"];
view = new DataView(datitab.table);
view.RowFilter = "Descrizione <> 'Cliente'";
datitab.table = view.ToTable();
datitab.SetRowDim(25);
datitab.setIsLinee(2);
datitab.setCell(170, ceTe.DynamicPDF.TextAlign.Left, Globals.OpenTypeFontVerdanaB, true);
datitab.setCell(343, ceTe.DynamicPDF.TextAlign.Left, Globals.OpenTypeFontVerdana, false);
datitab.setY(document.getLastPos() + datitab.GetRowDim());
datitab.setX(document.getMargineLeft());
document.InsertTable(tab.getTabella(datitab));
document.setLastPos(datitab.GetRowDim() * (datitab.getNumRow()) + 10);
}
#endregion
}
}