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

180 lines
10 KiB
C#

using System;
using System.Collections.Generic;
using System.Text;
using ceTe.DynamicPDF.Text;
using System.Collections;
using ceTe.DynamicPDF;
using PDFGenerator.Presentation.Section.Tables;
using PDFGenerator.Presentation.Section.Charts;
using PDFGenerator.BusinessLayer.DataSection;
using System.Data;
using PDFGenerator.BusinessLayer;
using ceTe.DynamicPDF.PageElements;
namespace PDFGenerator.Presentation.Section
{
public class S140 : STorta //: ISezione
{
#region ISezione Members
public new void writeSezione(DataThread dataThread)
{
DocumentPDF document = dataThread.DocumentPDF;
DataSetS140 set = (DataSetS140)dataThread.Data.DatiSezione;
//if (dataThread.TipoContratto != TipoContratto.Private)
// document.addPage();
document.setSezTitolo(dataThread.SezioneReport.Titolo.Replace("/$Banca$/", dataThread.NomeRete));
document.setChapterHeader(dataThread.SezioneReport.TestoIntroduttivo.Replace("/$Banca$/", dataThread.NomeRete), 0, 520, 8);
float Xtable = document.getMargineLeft();
float Ytable = document.getLastPos();
int dFont = 8;
int hRow = 18;
int wCol1 = 135;
int wCol2 = 95;
int wCol3 = 65;
int hGrafico = 150;
float lastPosGrafico = Ytable + hGrafico;
#region GRAFICO
DatiGrafico dati = new DatiGrafico();
dati.dataTab = set.ChartData;
dati.setHeight(hGrafico);
dati.setWidth(hGrafico);
Torta isto = new Torta();
document.InsertGrafico(isto.getGrafico(dati), 360, Ytable-10);
#endregion
datitab.setIsRet();
datitab.setIsLinee(1);
datitab.setHeader();
datitab.setHeaderFont(dFont);
datitab.setHeaderDim(hRow);
datitab.SetRowDim(hRow);
datitab.setCell(wCol1, ceTe.DynamicPDF.TextAlign.Left, Globals.OpenTypeFontVerdana, false, dFont);
datitab.setCell(wCol2, ceTe.DynamicPDF.TextAlign.Right, Globals.OpenTypeFontVerdana, false, dFont);
datitab.setCell(wCol3, ceTe.DynamicPDF.TextAlign.Right, Globals.OpenTypeFontVerdana, false, dFont);
datitab.setY(Ytable);
datitab.setX(Xtable);
datitab.setCellSpace(0);
datitab.table = set.RischioCredito;
Tabella tab = new Tabella();
document.InsertTable(tab.getTabella(datitab));
Ytable += datitab.GetRowDim() * (datitab.getNumRow() + 1);
datitab = new DatiTabella();
datitab.table = set.PatrimonioCoperto;
datitab.setY(Ytable);
datitab.setX(Xtable);
datitab.setHeaderDim(hRow);
datitab.SetRowDim(hRow);
datitab.setCell(wCol1, ceTe.DynamicPDF.TextAlign.Left, Globals.OpenTypeFontVerdanaB, true, dFont);
datitab.setCell(wCol2, ceTe.DynamicPDF.TextAlign.Right, Globals.OpenTypeFontVerdanaB, true, dFont);
datitab.setCell(wCol3, ceTe.DynamicPDF.TextAlign.Right, Globals.OpenTypeFontVerdanaB, true, dFont);
datitab.setCellSpace(0);
Tabella Ctab = new Tabella();
document.InsertTable(Ctab.getTabella(datitab));
Ytable += datitab.GetRowDim() * datitab.getNumRow() ;
datitab = new DatiTabella();
datitab.table = set.PatrimonioNonCoperto;
datitab.setIsRet();
datitab.setIsLinee(1);
datitab.setY(Ytable);
datitab.setX(Xtable);
datitab.setHeaderDim(hRow);
datitab.SetRowDim(hRow);
datitab.setCell(wCol1, ceTe.DynamicPDF.TextAlign.Left, Globals.OpenTypeFontVerdana, false, dFont);
datitab.setCell(wCol2, ceTe.DynamicPDF.TextAlign.Right, Globals.OpenTypeFontVerdana, false, dFont);
datitab.setCell(wCol3, ceTe.DynamicPDF.TextAlign.Right, Globals.OpenTypeFontVerdana, false, dFont);
datitab.setCellSpace(0);
Tabella Ctab2 = new Tabella();
document.InsertTable(Ctab2.getTabella(datitab));
Ytable += datitab.GetRowDim() * datitab.getNumRow();
datitab = new DatiTabella();
datitab.table = set.RischioCreditoTotal;
datitab.setY(Ytable);
datitab.setX(Xtable);
datitab.setHeaderDim(hRow);
datitab.SetRowDim(hRow);
datitab.setCell(wCol1, ceTe.DynamicPDF.TextAlign.Left, Globals.OpenTypeFontVerdanaB, true, dFont);
datitab.setCell(wCol2, ceTe.DynamicPDF.TextAlign.Right, Globals.OpenTypeFontVerdanaB, true, dFont);
datitab.setCell(wCol3, ceTe.DynamicPDF.TextAlign.Right, Globals.OpenTypeFontVerdanaB, true, dFont);
datitab.setCellSpace(0);
Tabella tabTot = new Tabella();
document.InsertTable(tabTot.getTabella(datitab));
// Ytable += datitab.GetRowDim() * (datitab.getNumRow() < 5 ? 5 : datitab.getNumRow()) + 5;
Ytable = lastPosGrafico - 15;
//decimal totalePartiteViaggianti = dataThread.PartiteViaggiantiDisinvestimento + dataThread.PartiteViaggiantiInvestimento;
//if (dataThread.TotalNegativeCurrentAccountValue < 0 && totalePartiteViaggianti == 0)
// document.getCurrentPage().Elements.Add(new Label(string.Format("(*) Il controvalore esclude il saldo negativo del\r\nconto corrente ({0} €)", dataThread.TotalNegativeCurrentAccountValue.ToString("N")), Xtable, Ytable, 512, 30F, Globals.OpenTypeFontVerdana, 8));
//else if (dataThread.TotalNegativeCurrentAccountValue == 0 && totalePartiteViaggianti != 0)
// document.getCurrentPage().Elements.Add(new Label(string.Format("(*) Il controvalore esclude gli investimenti in corso", dataThread.TotalNegativeCurrentAccountValue.ToString("N")), Xtable, Ytable, 512, 30F, Globals.OpenTypeFontVerdana, 8));
//else if (dataThread.TotalNegativeCurrentAccountValue < 0 && totalePartiteViaggianti != 0)
// document.getCurrentPage().Elements.Add(new Label(string.Format("(*) Il controvalore esclude il saldo negativo di\r\nconto corrente ({0} €) e gli investimenti in corso", dataThread.TotalNegativeCurrentAccountValue.ToString("N")), Xtable, Ytable, 512, 30F, Globals.OpenTypeFontVerdana, 8));
decimal totalNegativeCurrentAccountValue = dataThread.TotalNegativeCurrentAccountValue;
decimal totalSelfNegCurrentAccountValue = dataThread.TotalSelfNegCurrentAccountValue;
decimal totalePartiteViaggianti = dataThread.PartiteViaggiantiDisinvestimento + dataThread.PartiteViaggiantiInvestimento;
string note = "";
if (totalNegativeCurrentAccountValue==0 && totalSelfNegCurrentAccountValue==0 && totalePartiteViaggianti!=0) {
note += "(*) Il controvalore esclude gli investimenti in corso";
}
if (totalNegativeCurrentAccountValue<0 && totalSelfNegCurrentAccountValue==0 && totalePartiteViaggianti==0) {
note += "(*) Il controvalore esclude il saldo negativo del conto corrente ({0} €)";
note = string.Format(note, totalNegativeCurrentAccountValue.ToString("N"));
}
if (totalNegativeCurrentAccountValue==0 && totalSelfNegCurrentAccountValue<0 && totalePartiteViaggianti==0) {
note += "(*) Il controvalore esclude il saldo negativo della liquidità sottostante le linee “GP Eligo” ({0} €)";
note = string.Format(note, totalSelfNegCurrentAccountValue.ToString("N"));
}
if (totalNegativeCurrentAccountValue<0 && totalSelfNegCurrentAccountValue==0 && totalePartiteViaggianti!=0) {
note += "(*) Il controvalore esclude il saldo negativo del conto corrente ({0} €) e gli investimenti in corso";
note = string.Format(note, totalNegativeCurrentAccountValue.ToString("N"));
}
if (totalNegativeCurrentAccountValue<0 && totalSelfNegCurrentAccountValue<0 && totalePartiteViaggianti==0) {
note += "(*) Il controvalore esclude il saldo negativo del conto corrente ({0} €) e il saldo negativo della liquidità sottostante le linee “GP Eligo” ({1} €)";
note = string.Format(note, totalNegativeCurrentAccountValue.ToString("N"), totalSelfNegCurrentAccountValue.ToString("N"));
}
if (totalNegativeCurrentAccountValue==0 && totalSelfNegCurrentAccountValue<0 && totalePartiteViaggianti!=0) {
note += "(*) Il controvalore esclude il saldo negativo della liquidità sottostante le linee “GP Eligo” ({0} €) e gli investimenti in corso";
note = string.Format(note,totalSelfNegCurrentAccountValue.ToString("N"));
}
if (totalNegativeCurrentAccountValue<0 && totalSelfNegCurrentAccountValue<0 && totalePartiteViaggianti!=0) {
note += "(*) Il controvalore esclude il saldo negativo del conto corrente ({0} €), il saldo negativo della liquidità sottostante le linee “GP Eligo” ({1} €) e gli investimenti in corso";
note = string.Format(note, totalNegativeCurrentAccountValue.ToString("N"), totalSelfNegCurrentAccountValue.ToString("N"));
}
if(!note.Equals(""))
document.getCurrentPage().Elements.Add(new Label(note, Xtable, Ytable, 512, 30F, Globals.OpenTypeFontVerdana, 8));
document.setLastPos(hGrafico);
}
#endregion
}
}