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

204 lines
7.0 KiB
C#

using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Collections;
using ceTe.DynamicPDF;
using ceTe.DynamicPDF.Text;
using PDFGenerator.BusinessLayer.DataSection;
using PDFGenerator.BusinessLayer;
using System.Collections.Generic;
using System.Linq;
namespace PDFGenerator.Presentation.Section
{
public class S163 : SIstogramma, ISezione
{
public S163()
{
//
// TODO: Add constructor logic here
//
}
#region ISezione Members
public new void writeSezione(DataThread datathread)
{
document = datathread.DocumentPDF;
DataSetS163 set = (DataSetS163)datathread.Data.DatiSezione;
tabTortaTabella = set.Tables["MacroAssetClass"];
tabTortaTotali = set.Tables["MacroAssetTotale"];
tabTortaPatrimonioNonRappresentabile = set.Tables["PatrimonioNonRappresentabile"];
tabTotale = set.Tables["Totale"];
// ************************* Modifica Andrea per correzione ***********************************//
// tabTortaTotali.Rows[0][1] = tabTotale.Rows[0][1];
//tabTortaTotali.Rows[0][1] = datathread.PatrimonioBancaFideuramCtvAlNettoContoCorrente;
tabTortaTotali.Rows[0][1] = datathread.Patrimonioterzictv;
// ******************************************************************************************//
/*************************** "Modifiche per Aladdin grafici a barre -- Pino" ************************************/
//base.writeSezione(datathread);
//if (set.Tables["PatrimonioNonRappresentabile"].Rows.Count > 0)
//{
// if (dim > ChartHeigth)
// {
// this.addNota(document, (int)dim);
// }
// else
// {
// this.addNota(document, ChartHeigth);
// }
//}
base.writeSezione163(datathread);
if (dim > ChartHeigth)
{
this.addNota1(document, (int)dim, datathread);
}
else
{
this.addNota1(document, ChartHeigth, datathread);
}
/**************************************************************************************************/
if (dim > ChartHeigth)
{
document.setLastPos(dim);
}
else
{
document.setLastPos(ChartHeigth);
}
}
#endregion
public void writeSezioneCombo(DataThread datathread)
{
document = datathread.DocumentPDF;
DataSetS163 set = (DataSetS163)datathread.Data.DatiSezione;
tabTortaTabella = set.Tables["MacroAssetClass"];
tabTortaTotali = set.Tables["MacroAssetTotale"];
tabTortaPatrimonioNonRappresentabile = set.Tables["PatrimonioNonRappresentabile"];
tabTotale = set.Tables["Totale"];
base.writeSezioneComboSX(datathread);
if (salto)
document.returnLastPage();
document.setPotenzialeLastPos(datitab.GetRowDim() * datitab.getNumRow() + dim, salto);
}
private void addNota(DocumentPDF doc, int dim)
{
doc.setSezFooter("(*) Il dettaglio del Patrimonio non rappresentabile per Asset class viene riportato in fondo al documento.", dim);
}
private void addNota1(DocumentPDF doc, int dim, DataThread dataThread)
{
decimal PatrimonioTerzi = dataThread.PatrimonioTerziContoCorrente;
decimal ProdottiNonRapp = dataThread.PatrimonioNonRappresentabileAI;
decimal GradoCopertura = 100;
if (dataThread.Patrimonioterzictv != 0)
GradoCopertura = (dataThread.Patrimonioterzictv - dataThread.PatrimonioNonRappresentabileAI)/(dataThread.Patrimonioterzictv)* 100;
decimal PatrimonioTerziNonRapp = dataThread.PatrimonioNonRappresentabileAI;
List<string> notes = new List<string>();
string nota = string.Empty;
string nota1 = "";
string token = "";
//totalNegativeCurrentAccountValue = -1000.00M;
//totaleSelfNegFO = -1000.00M;
//totalePartiteViaggianti = 1000.00M;
//GPEligoFondi = -500.00M;
//GPEligoTitoli = -500.00M;
//PatrimonioTerzi = -400.00M;
//GradoCopertura = 70.00M;
//PatrimonioTerziNonRapp = 100.00M;
//ProdottiNonRapp = 20.00M;
if (PatrimonioTerzi < 0 || ((GradoCopertura >= 0 && GradoCopertura < 100) && ProdottiNonRapp != 0))
nota = "(*) ";
if (PatrimonioTerzi < 0)
{
notes.Add("Il controvalore esclude il saldo negativo");
token = " ";
notes.Add(string.Format(token + "dei conti correnti ({0} €)", PatrimonioTerzi.ToString("N")));
token = ". ";
}
if (PatrimonioTerziNonRapp != 0)
{
if (GradoCopertura >= 0 && GradoCopertura < 100)
{
notes.Add(string.Format(token + "Grado di copertura (%) della rappresentazione grafica per macro asset class pari a {0}", GradoCopertura.ToString("N")));
token = ": ";
if (PatrimonioTerziNonRapp != 0)
{
notes.Add(string.Format(token + "non sono considerati"));
token = " ";
if (PatrimonioTerziNonRapp != 0)
{
notes.Add(string.Format(token + "i prodotti non rappresentabili ({0} €)", PatrimonioTerziNonRapp.ToString("N")));
token = ", ";
}
notes.Add(string.Format("."));
}
nota1 += ".";
token = " ";
//int i = 0;
nota += notes.FirstOrDefault<string>();
if (notes.Count > 1)
{
foreach (var s in notes.Skip(1))
{
nota += s;
//if (i == 0)
// nota += s;
//if (i > 0 && i < notes.Count - 1)
// nota += ", " + s;
//if (i == notes.Count - 1)
// nota += " e " + s;
//i++;
}
}
//else
// nota += notes.FirstOrDefault<string>();
if (!nota.Equals(""))
//document.getCurrentPage().Elements.Add(new Label(nota, Xtable, Ytable, 512, 30F, Globals.OpenTypeFontVerdana, 7));
doc.setSezFooter(nota, dim-20);
}
}
}
}
}