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

291 lines
13 KiB
C#
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

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.Presentation.Section.Tables;
using PDFGenerator.BusinessLayer.DataSection;
using PDFGenerator.BusinessLayer;
using System.Resources;
using System.Reflection;
using PDFGenerator.BusinessLayer.Utils;
using ceTe.DynamicPDF.PageElements;
namespace PDFGenerator.Presentation.Section
{
class S128 : ISezione
{
private string _header = "";
public string Header
{
get { return _header; }
set { _header = value; }
}
private TipoReport _tipologiaReport;
public TipoReport TipologiaReport
{
get { return _tipologiaReport; }
set { _tipologiaReport = value; }
}
private string _testoIntroduttivo = string.Empty;
public string TestoIntroduttivo
{
get { return _testoIntroduttivo; }
set { _testoIntroduttivo = value; }
}
private string _testoChiusura = string.Empty;
public string TestoChiusura
{
get { return _testoChiusura; }
set { _testoChiusura = value; }
}
public S128()
{
//
// TODO: Add constructor logic here
//
}
#region ISezione Members
public void writeSezione(DataThread dataThread)
{
DocumentPDF document = dataThread.DocumentPDF;
DataSetS128 set = (DataSetS128)dataThread.Data.DatiSezione;
string bottomLabelText = SimpleTextGenerator.ProduceText(this, "S128BottomLabel", dataThread, null);
string notaComplessita = "";
string nota2b = "";
//20180917 AC
bottomLabelText = bottomLabelText.Replace("*", "(*)");
//--20180917
document.setSezTitolo(dataThread.SezioneReport.Titolo);
string tempTesto = dataThread.SezioneReport.TestoIntroduttivo;
if (dataThread.IsProffesionalClient)
tempTesto = "Di seguito è indicato il profilo finanziario che le è stato assegnato sulla base delle informazioni raccolte anche tramite il questionario di profilatura, nonchè lesposizione del patrimonio in termini di rischio mercato, rischio credito e complessità rispetto ai limiti massimi associati al suo profilo finanziario.";
//if (dataThread.Rete.ToUpper() == "S")
// tempTesto = tempTesto.Replace("Fideuram", "Sanpaolo Invest");
//**************************** Cecco modifiche dicitura IWBANK*******************
if (dataThread.Rete.ToUpper() == "S")
// Rosaspina Andrea //
tempTesto = tempTesto.Replace("Fideuram", "Fideuram S.p.A., commercializzato tramite la rete di private banker Sanpaolo Invest");
// tempTesto = tempTesto.Replace("Fideuram", "Sanpaolo Invest");
else if (dataThread.Rete.ToUpper() == "W")
tempTesto = tempTesto.Replace("Fideuram", "IW Private Investments");
//****************************************************************************
document.setChapterHeader(tempTesto, 0, 520, 8);
float YTable = document.getLastPos() - 13;
float XTable = document.getMargineLeft();
# region profilorischio
DatiTabella profilofinanziarioDatiTab = new DatiTabella();
profilofinanziarioDatiTab.table = set.Tables["ProfiloRischio"];
profilofinanziarioDatiTab.SetRowDim(15);
profilofinanziarioDatiTab.setIsLinee(1);
profilofinanziarioDatiTab.setCell(140, ceTe.DynamicPDF.TextAlign.Left, Globals.OpenTypeFontVerdanaB, true);
profilofinanziarioDatiTab.setCell(273, ceTe.DynamicPDF.TextAlign.Left, Globals.OpenTypeFontVerdana, false);
profilofinanziarioDatiTab.setX(XTable);
profilofinanziarioDatiTab.setY(YTable);
Tabella profilofinanziarioTab = new Tabella();
document.InsertTable(profilofinanziarioTab.getTabella(profilofinanziarioDatiTab));
#endregion
//MIFID2 20180430 Aumentare la distanza con la tabella successiva
//YTable += profilofinanziarioDatiTab.getNumRow() * profilofinanziarioDatiTab.GetRowDim();
YTable += profilofinanziarioDatiTab.getNumRow() * profilofinanziarioDatiTab.GetRowDim() + 15;
#region Colonne Red
string intestazioneColonna1 = "Limite massimo profilo finanziario";
//string intestazioneColonna2 = "Patrimonio " + (dataThread.Rete.ToUpper().Equals("F") ? "Fideuram" : "SanPaolo");
//********************************** Cecco midifica dicitura IWBANK******************************
string intestazioneColonna2 = "";
switch (dataThread.Rete.ToUpper())
{
case "F":
{
intestazioneColonna2 = ("Patrimonio Fideuram");
break;
}
case "S":
{
intestazioneColonna2 = ("Patrimonio Sanpaolo Invest"); //Modificato su richiesta di Napolitano, SanPaolo
break;
}
case "W":
{
intestazioneColonna2 = ("Patrimonio IW Private Inv.");
break;
}
}
//****************************************************************************************************************
DataTable dt = set.Tables["ColonneRed"];
dt.Rows[0]["Limite"] = string.Empty;
dt.Rows[0]["Patrimonio"] = string.Empty;
DatiTabella colonneRed = new DatiTabella();
colonneRed.SetRowDim(15);
colonneRed.table = dt;
Tabella tabRed = new Tabella(XTable + 150, YTable);
tabRed.Header = true;
tabRed.AltezzaCella = 15;
tabRed.Datasource = colonneRed.table;
tabRed.Colonne.Add(new Colonna("Limite", intestazioneColonna1, 196, TipoAllineamento.DESTRA, false, 9, false));
tabRed.Colonne.Add(new Colonna("Patrimonio", intestazioneColonna2, 166, TipoAllineamento.DESTRA, false, 9, false));
tabRed.Draw(colonneRed, document);
//--MIFID2
#endregion
YTable += colonneRed.getNumRow() * colonneRed.GetRowDim();
# region Adeguatezza
//MIFID2 20180531
bool notaRischioMercato = false;
//--MIFID2
DatiTabella datitab = new DatiTabella();
if (!string.IsNullOrEmpty(bottomLabelText))
{
string rischioMercato = set.Tables["ProfiliRischioAdeguatezza"].Rows[0]["ValoreBF"].ToString();
rischioMercato += "*";
set.Tables["ProfiliRischioAdeguatezza"].Rows[0]["ValoreBF"] = rischioMercato;
//MIFID2 20180531
notaRischioMercato = true;
//--MIFID2
}
//MIFID2 20180702 CR Napolitano
// per i clienti professionali la complessità è impostata a "n.a.", quindi non c'è bisogno di asterisco e nota:
string ast = "";
//20180918 AC su richiesta Napolitano, la nota sul livello di Complessità del Patrimonio va mostrata
//if (!dataThread.IsProffesionalClient)
//{
//MIFID2 20180531 se il valore del limite complessità del patrimonio è definito, va aggiunta la nota relativa, con uno o due asterischi in base alla nota sul rischio Mercato.
if (!set.Tables["ProfiliRischioAdeguatezza"].Rows[2]["ValoreBF"].ToString().Equals("-"))
{
ast = notaRischioMercato ? "**" : "*";
set.Tables["ProfiliRischioAdeguatezza"].Rows[2]["ValoreBF"] += ast;
notaComplessita = string.Format("({0}) Complessità massima dei prodotti in portafoglio", ast);
//MIFID2 CR Napolitano: inserita nuova nota relativa al Limite Massimo Complessità per le persone giuridiche con delegati profilati
if (!dataThread.IsProffesionalClient && dataThread.Flagpg.Equals(1) && dataThread.Flagnqp.Equals("S") && dataThread.Flagprlrde.Equals("S"))
{
ast += "*";
set.Tables["ProfiliRischioAdeguatezza"].Rows[2]["LimiteMax"] += ast;
nota2b = string.Format("({0}) Livello di Esperienza e Conoscenza più alto tra quelli associati ai singoli Legali Rappresentanti/Delegati profilati", ast);
}
}
//}
datitab.table = set.Tables["ProfiliRischioAdeguatezza"];
datitab.SetRowDim(15);
datitab.setIsLinee(1);
datitab.setCell(200, ceTe.DynamicPDF.TextAlign.Left, Globals.OpenTypeFontVerdanaB, false);
datitab.setCell(146, ceTe.DynamicPDF.TextAlign.Right, Globals.OpenTypeFontVerdana, false);
datitab.setCell(166, ceTe.DynamicPDF.TextAlign.Right, Globals.OpenTypeFontVerdana, false);
datitab.setX(XTable);
datitab.setY(YTable);
Tabella tab = new Tabella();
tab.LineaFineTabella = true;
document.InsertTable(tab.getTabella(datitab));
#endregion
YTable += datitab.getNumRow() * datitab.GetRowDim();
//MIFID2 20180430
//document.setLastPos(
// (profilofinanziarioDatiTab.getNumRow() * profilofinanziarioDatiTab.GetRowDim()) +
// (colonneRed.getNumRow() * colonneRed.GetRowDim()) +
// (datitab.getNumRow() * datitab.GetRowDim()) - 33); // -33
document.setLastPos(
(profilofinanziarioDatiTab.getNumRow() * profilofinanziarioDatiTab.GetRowDim()) +
(colonneRed.getNumRow() * colonneRed.GetRowDim()) +
//(datitab.getNumRow() * datitab.GetRowDim()) - 33 + 15); // -33 + 20
(datitab.getNumRow() * datitab.GetRowDim()) - 33 + 5); // -33 + 20
//--MIFID2
//MIFID2 20180531
//if (!String.IsNullOrEmpty(bottomLabelText))
//{
// document.setChapterHeader(bottomLabelText, 0, 520, 7);
//}
if (!String.IsNullOrEmpty(bottomLabelText))
{
document.writeText(document.getMargineLeft(), document.getLastPos(), bottomLabelText, 6, 510, ceTe.DynamicPDF.TextAlign.Justify);
document.setLastPos(0);
}
//20180918 AC La nota sulla Complessità del Patrimonio, va mostrata anche per i professionali
//MIFID2 20180702 CR Napolitano
// per i clienti professionali i valori sulla Complessità vanno impostati a "n.a." (quindi la nota non deve esserci)
//if (dataThread.IsProffesionalClient) {
// notaComplessita = string.Empty;
//}
//--MIFID2
//--20180918
float liftUp = 0;
if (!string.IsNullOrEmpty(notaComplessita))
{
document.writeText(document.getMargineLeft(), document.getLastPos(), notaComplessita, 6, 520, ceTe.DynamicPDF.TextAlign.Left);
document.setLastPos(0);
liftUp = 15;
}
if (!string.IsNullOrEmpty(nota2b))
{
document.writeText(document.getMargineLeft(), document.getLastPos()-20, nota2b, 6, 520, ceTe.DynamicPDF.TextAlign.Justify);
document.setLastPos(0);
liftUp += 23;
}
string notaCopertura = string.Format("La copertura del suo portafoglio per il calcolo degli indicatori di rischio risulta essere del <b>{0}%</b>", set.Tables["Copertura"].Rows[0]["Valore"].ToString());
//FormattedTextArea text = new FormattedTextArea(notaCopertura, document.getMargineLeft(), !string.IsNullOrEmpty(notaComplessita) ? document.getLastPos() - 15 : document.getLastPos(), 510, 50, new ceTe.DynamicPDF.FontFamily("pipp", Globals.OpenTypeFontVerdana, Globals.OpenTypeFontVerdanaB, Globals.OpenTypeFontVerdanaZ, Globals.OpenTypeFontVerdanaZ), 8, true);
FormattedTextArea text = new FormattedTextArea(notaCopertura, document.getMargineLeft(), document.getLastPos() - liftUp, 510, 50, new ceTe.DynamicPDF.FontFamily("pipp", Globals.OpenTypeFontVerdana, Globals.OpenTypeFontVerdanaB, Globals.OpenTypeFontVerdanaZ, Globals.OpenTypeFontVerdanaZ), 8, true);
text.Height = text.GetRequiredHeight();
text.Style.Paragraph.Align = ceTe.DynamicPDF.TextAlign.Justify;
document.getCurrentPage().Elements.Add(text);
if (!string.IsNullOrEmpty(notaComplessita))
//document.setLastPos(-38); //-10
document.setLastPos(-liftUp);
else
document.setLastPos(0);
}
#endregion
}
}