709 lines
34 KiB
C#
709 lines
34 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 Dundas.Charting.WebControl;
|
|
using PDFGenerator.Presentation.Section.Tables;
|
|
using PDFGenerator.BusinessLayer.DataSection;
|
|
using PDFGenerator.Presentation.Section.Charts;
|
|
using PDFGenerator.BusinessLayer;
|
|
using ContrattoSei.Utilities;
|
|
using ceTe.DynamicPDF.PageElements;
|
|
using PDFGenerator.BusinessLayer.Utils;
|
|
using System.Linq;
|
|
|
|
namespace PDFGenerator.Presentation.Section
|
|
{
|
|
public class FD170 : ISezione
|
|
{
|
|
string Titolo = string.Empty;
|
|
private string _testointroduttivo;
|
|
private string _testotitolo;
|
|
|
|
|
|
|
|
/// <summary>
|
|
/// Testo del titolo della sezione.
|
|
/// </summary>
|
|
public string TestoTitolo
|
|
{
|
|
get
|
|
{
|
|
return _testotitolo;
|
|
}
|
|
set
|
|
{
|
|
_testotitolo = value;
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// Testo introduttivo della sezione
|
|
/// </summary>
|
|
public string TestoIntroduttivo
|
|
{
|
|
get
|
|
{
|
|
return _testointroduttivo;
|
|
}
|
|
set
|
|
{
|
|
_testointroduttivo = value;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
public FD170()
|
|
{
|
|
//
|
|
// TODO: Add constructor logic here
|
|
//
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
/// Stampa la sezione S170
|
|
/// </summary>
|
|
/// <param name="paramSez"></param>
|
|
public void writeSezione(DataThread dataThread)
|
|
{
|
|
DocumentPDF document = dataThread.DocumentPDF;
|
|
|
|
string nomeRete = dataThread.NomeRete;
|
|
|
|
float xLine = 50;
|
|
float widthLine = 320;
|
|
float widthRectangleTable = widthLine - xLine + 3;
|
|
float fontSize = 5;
|
|
int altezzaGrafico = 165;
|
|
float altezzaGraficoMenoEtichette = altezzaGrafico - 40;
|
|
|
|
DatiTabella datitab = new DatiTabella();
|
|
DataSetS170 set = (DataSetS170)dataThread.Data.DatiSezione;
|
|
|
|
//20180926 AC La nota sull'eccessiva adeguatezza è richiesta solo in Monitoraggio
|
|
string notaEccessivaAdeguatezza = string.Empty;
|
|
if (dataThread.TipoReport.ToUpper().Equals("MONITORAGGIO"))
|
|
notaEccessivaAdeguatezza = SimpleTextGenerator.ProduceText(this, "S128BottomLabel", dataThread, null);
|
|
|
|
//20180917 AC
|
|
notaEccessivaAdeguatezza = notaEccessivaAdeguatezza.Replace("*", "(*)");
|
|
//--20180917
|
|
|
|
if (dataThread.TipoReport.ToUpper().Equals("DIAGNOSI"))
|
|
datitab.table = set.Tables["RischioDiversificazione"];
|
|
else
|
|
//Prendo la prima riga e l'ultima, che contiene il Limite Massimo
|
|
datitab.table = set.Tables["RischioDiversificazione"].AsEnumerable().Where(d => d.Field<Int32>("ordine") == 1).CopyToDataTable();
|
|
//--MIFID2
|
|
|
|
//MIFID2 20180524
|
|
float liftDown = 0;
|
|
|
|
if (datitab.table.Rows.Count > 2)
|
|
{
|
|
liftDown = 30;
|
|
document.setLastPos(liftDown);
|
|
}
|
|
//--MIFID2
|
|
|
|
//bool _mostracolonnacopertura = Convert.ToBoolean(set.ResultSet[0]["MostraColonnaCopertura"]);
|
|
|
|
ceTe.DynamicPDF.Merger.ImportedPage page = document.getCurrentPage();
|
|
|
|
#region Titolo e testo introduttivo
|
|
document.setSezTitoloDiagnosi(_testotitolo);
|
|
document.setChapterHeader(_testointroduttivo, 0, 520, 8);
|
|
//document.setLastPos(-50);
|
|
//document.setLastPos(liftDown-50);
|
|
#endregion
|
|
|
|
double var1 = 0;
|
|
if (set.RischioPatrimonioFinanziario.Rows.Count != 0)
|
|
var1 = Convert.ToDouble((decimal)set.RischioPatrimonioFinanziario.Rows[0]["Var"]);
|
|
if (dataThread.IsProffesionalClient && dataThread.RiskArea == 5) var1 = 50;
|
|
|
|
//MIFID2 20180524 per cambio pagina
|
|
//document.InsertTable(tab.getTabella(datitab));
|
|
|
|
//MIFID2 20180521
|
|
//datitab.table = set.Tables["RischioDiversificazione"];
|
|
|
|
|
|
|
|
float dim = datitab.GetRowDim() * datitab.getNumRow();
|
|
|
|
#region Grafico
|
|
|
|
DatiGrafico dati = new DatiGrafico();
|
|
dati.dataTab = datitab.table;
|
|
//MIFID2 20180521 commentata
|
|
//dati.dataTab.Columns.Remove(dati.dataTab.Columns["Copertura"]);
|
|
//--MIFID2
|
|
dati.setHeight(altezzaGrafico);
|
|
dati.setWidth(295);//T-1466629-Y0Y5
|
|
|
|
//MIFID2: 20180404 Richiama un nuovo grafico GraficoS170
|
|
//GraficoS132BIS pall = new GraficoS132BIS();
|
|
//Chart grafico = pall.getGrafico(dati, dataThread);
|
|
GraficoS170 pall = new GraficoS170();
|
|
Chart grafico = pall.getGrafico(dati, dataThread);
|
|
//--MIFID2: 20180404
|
|
|
|
double vaRMassimo = pall.AxisY_Maximum;
|
|
document.InsertGrafico(grafico, document.getMargineLeft() + 75, document.getLastPos());
|
|
|
|
#endregion
|
|
|
|
dim += (altezzaGrafico + 40);
|
|
|
|
#region Marcatore alla sinistra del grafico
|
|
|
|
ceTe.DynamicPDF.PageElements.Rectangle rect;
|
|
FormatNum conv = new FormatNum();
|
|
float yImg = document.getLastPos() - 5;
|
|
|
|
float yLabelY = document.getLastPos();
|
|
|
|
if (set.RischioPatrimonioFinanziario.Rows.Count != 0)
|
|
{
|
|
float xFreccia = document.getMargineLeft();
|
|
float yFreccia = document.getLastPos();
|
|
float wFreccia = 50;
|
|
float hFreccia = 20;
|
|
string profilo = " ";
|
|
|
|
switch (MarkPosition((float)var1))
|
|
{
|
|
//case 0:
|
|
// profilo = "Conservativo";
|
|
// yFreccia += 100;
|
|
// break;
|
|
//case 1:
|
|
// profilo = "Moderato";
|
|
// yFreccia += 94;
|
|
// break;
|
|
//case 2:
|
|
// profilo = "Dinamico";
|
|
// yFreccia += 74;
|
|
// break;
|
|
//case 3:
|
|
// profilo = "Attivo";
|
|
// yFreccia += 50;
|
|
// break;
|
|
////case 4:
|
|
//// profilo = "Aggressivo";
|
|
//// yFreccia += -4;
|
|
//// break;
|
|
//default:
|
|
// break;
|
|
|
|
case 1:
|
|
profilo = "Conservativo";
|
|
yFreccia += 100;
|
|
break;
|
|
case 2:
|
|
profilo = "Moderato";
|
|
yFreccia += 94;
|
|
break;
|
|
case 3:
|
|
profilo = "Dinamico";
|
|
yFreccia += 74;
|
|
break;
|
|
case 4:
|
|
profilo = "Attivo";
|
|
yFreccia += 50;
|
|
break;
|
|
//case 4:
|
|
// profilo = "Aggressivo";
|
|
// yFreccia += -4;
|
|
// break;
|
|
default:
|
|
break;
|
|
|
|
|
|
}
|
|
|
|
page.Elements.Add(
|
|
new ceTe.DynamicPDF.PageElements.Rectangle(
|
|
xFreccia,
|
|
yFreccia,
|
|
wFreccia,
|
|
hFreccia,
|
|
0,
|
|
new RgbColor(232, 236, 237)));
|
|
|
|
|
|
rect = new ceTe.DynamicPDF.PageElements.Rectangle(
|
|
xFreccia + wFreccia,
|
|
yFreccia,
|
|
hFreccia / 1.414F,
|
|
hFreccia / 1.414F,
|
|
0,
|
|
new RgbColor(232, 236, 237));
|
|
|
|
rect.Angle = 45;
|
|
page.Elements.Add(rect);
|
|
|
|
xFreccia += 1;
|
|
hFreccia = fontSize + 1;
|
|
float interline = hFreccia + 1;
|
|
|
|
page.Elements.Add(
|
|
new ceTe.DynamicPDF.PageElements.Label("Profilo finanziario:"
|
|
, xFreccia
|
|
, yFreccia
|
|
, wFreccia
|
|
, hFreccia
|
|
, Globals.OpenTypeFontVerdana
|
|
, fontSize));
|
|
|
|
page.Elements.Add(
|
|
new ceTe.DynamicPDF.PageElements.Label(profilo + " (" + (MarkPosition((float)var1)).ToString() + ")" //new ceTe.DynamicPDF.PageElements.Label(profilo + " (" + (MarkPosition((float)var1) + 1).ToString() + ")"
|
|
, xFreccia
|
|
, yFreccia + interline
|
|
, wFreccia
|
|
, hFreccia
|
|
, Globals.OpenTypeFontVerdana
|
|
, fontSize));
|
|
|
|
page.Elements.Add(new ceTe.DynamicPDF.PageElements.Label("(VaR " + conv.ConvertNum(var1) + "%)"
|
|
, xFreccia
|
|
, yFreccia + (interline * 2)
|
|
, wFreccia
|
|
, hFreccia
|
|
, Globals.OpenTypeFontVerdana
|
|
, fontSize));
|
|
|
|
if (profilo == "Aggressivo")
|
|
yLabelY += rect.Height + 10;
|
|
else
|
|
yLabelY -= rect.Height - 10;
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region titoli
|
|
page.Elements.Add(new ceTe.DynamicPDF.PageElements.Label("Rischio (VaR%)", document.getMargineLeft(), yLabelY, 120, 12, Globals.OpenTypeFontVerdana, fontSize, ceTe.DynamicPDF.TextAlign.Left, ceTe.DynamicPDF.CmykColor.Black));
|
|
#endregion
|
|
|
|
#region Legenda alla destra del Grafico
|
|
string relativePath = UtilityManager.getAppSetting("LegendaDiversificazioneLarge");
|
|
System.Reflection.Assembly thisExe;
|
|
thisExe = System.Reflection.Assembly.GetExecutingAssembly();
|
|
System.IO.Stream file = thisExe.GetManifestResourceStream(relativePath);
|
|
page.Elements.Add(new ceTe.DynamicPDF.PageElements.Image(file, document.getMargineLeft() + 400, document.getLastPos() + 103, 0.40F)); // T-1466629-Y0Y5 +80
|
|
#endregion
|
|
|
|
#region Tabella sotto al grafico
|
|
//MIFID2 20180518 per diagnosi si prendono tutte le righe possibili (Patrimonio Banca, Patrimonio Terzi, Patrimonio Complessivo. In monitoraggio, solo il primo)
|
|
//datitab.table = set.Tables["RischioDiversificazioneTable"];
|
|
if (dataThread.TipoReport.ToUpper().Equals("DIAGNOSI"))
|
|
datitab.table = set.Tables["RischioDiversificazioneTable"];
|
|
else
|
|
{
|
|
//Prendo la prima riga e l'ultima, che contiene il Limite Massimo
|
|
datitab.table = set.Tables["RischioDiversificazioneTable"].AsEnumerable().Where(d => d.Field<Int32>("ordine") == 1 || d.Field<Int32>("ordine") == 4).CopyToDataTable();
|
|
//Qui bisogna riprendere le Caption dal DataTable originale, la query precedente fa perdere le caption.
|
|
foreach (DataColumn col in datitab.table.Columns)
|
|
{
|
|
col.Caption = set.Tables["RischioDiversificazioneTable"].Columns[col.ColumnName].Caption;
|
|
}
|
|
}
|
|
|
|
//20180917 AC gestione nota e asterisco eccessiva adeguatezza
|
|
|
|
if (dataThread.TipoReport.ToUpper().Equals("MONITORAGGIO"))
|
|
{
|
|
if (!string.IsNullOrEmpty(notaEccessivaAdeguatezza))
|
|
{
|
|
datitab.table.Rows[0]["varstring"] += "*";
|
|
if (datitab.table.Rows[0]["complessita"].ToString().Contains("*"))
|
|
datitab.table.Rows[0]["complessita"] += "*";
|
|
// 20181011 AC in caso di nota Eccessiva Adeguatezza va aggiunto l'asterisco sulla voce varstring e poi incrementati quelli già presenti nelle voci di complessità (prima riga e seconda riga)
|
|
//--20181011 AC
|
|
|
|
// 20181011 AC non c'è bisogno di incrementare gli asterischi, perché già sono presenti e sono stati incrementati nelle istruzioni precedenti
|
|
|
|
//20180925 AC: per le persone giuridiche con delegati profilati bisogna prevedere che, in corrispondenza della Complessità limite profilo, ci sia il rimando alla relativa nota. Imposto un numero di asterischi in base a quanti ne ha la voce precedente
|
|
if (!dataThread.IsProffesionalClient && dataThread.Flagpg.Equals(1) && dataThread.Flagnqp.Equals("S") && dataThread.Flagprlrde.Equals("S"))
|
|
{
|
|
//datitab.table.Rows[1]["complessita"] += new string('*', datitab.table.Rows[0]["complessita"].ToString().Count(x => x == '*') + 1);
|
|
datitab.table.Rows[1]["complessita"] += "*";
|
|
|
|
}
|
|
//20180925
|
|
//--20181011 AC
|
|
}
|
|
}
|
|
//--20180917
|
|
|
|
//MIFID2 20180524 cambia pagina se la tabella ha più della riga Patrimonio Banca (MODIFICARE con > 2)
|
|
if (datitab.table.Rows.Count > 2)
|
|
{
|
|
//document.setLastPos(822);
|
|
altezzaGrafico = 0;
|
|
document.changePage();
|
|
document.nextPage(document.getMargineLeft());
|
|
page = document.getCurrentPage();
|
|
}
|
|
|
|
//--MIFID2
|
|
// if (!_mostracolonnacopertura)
|
|
datitab.table.Columns.Remove(datitab.table.Columns["copertura"]);
|
|
|
|
//MIFID2 20180521
|
|
datitab.table.Columns.Remove(datitab.table.Columns["ordine"]);
|
|
//--MIFID2
|
|
|
|
/* MUA - Fix Eliminazione colonna Rischio Credito 13/07/2023 - Pino */
|
|
datitab.table.Columns.Remove(datitab.table.Columns["rischioCredito"]);
|
|
datitab.table.Columns["varString"].Caption = "Rischio (VaR %)";
|
|
/********************************************************************/
|
|
|
|
|
|
datitab.setIsLinee(1);
|
|
datitab.setHeader();
|
|
datitab.setHeaderDim(30);
|
|
|
|
//MIFID2: 20180404 E' richiesta anche la colonna sulla complessità
|
|
|
|
//MIFID2 20180626 Allineamento al centro
|
|
|
|
datitab.setCell(110, ceTe.DynamicPDF.TextAlign.Left, Globals.OpenTypeFontVerdana, false);
|
|
datitab.setCell(120, ceTe.DynamicPDF.TextAlign.Center, Globals.OpenTypeFontVerdana, false); //90
|
|
/* MUA - Fix elimino colonna Rischio Credito 13/07/2023 - Pino */
|
|
//datitab.setCell(50, ceTe.DynamicPDF.TextAlign.Center, Globals.OpenTypeFontVerdana, false);
|
|
/****************************************************************/
|
|
datitab.setCell(100, ceTe.DynamicPDF.TextAlign.Center, Globals.OpenTypeFontVerdana, false);
|
|
datitab.setCell(95, ceTe.DynamicPDF.TextAlign.Center, Globals.OpenTypeFontVerdana, false);
|
|
datitab.setCell(75, ceTe.DynamicPDF.TextAlign.Center, Globals.OpenTypeFontVerdana, false);
|
|
|
|
//--MIFID2
|
|
//--MIFID2
|
|
|
|
datitab.setY(document.getLastPos() + altezzaGrafico + 20);
|
|
datitab.setX(document.getMargineLeft());
|
|
datitab.setIsRet();
|
|
datitab.setCellSpace(0);
|
|
Tabella tab = new Tabella();
|
|
|
|
tab.LineaFineTabella = true;
|
|
|
|
tab.ColoreDirectBankB = "green";
|
|
#endregion
|
|
|
|
document.InsertTable(tab.getTabella(datitab));
|
|
|
|
this.writeMarker(document, datitab);
|
|
|
|
// document.setLastPos(-document.getLastPos()+695); T-1466629-Y0Y5
|
|
|
|
//MIFID2 20180524 La tabella avrà 2 righe (Patrimonio Banca + Riga Limite Massimo) oppure 4 righe (Patrimonio Banca + Terzi + Complessivo + Riga Limite Massimo)
|
|
//if (datitab.table.Rows.Count > 1) //
|
|
//if (datitab.table.Rows.Count > 2) //
|
|
// document.setLastPos(datitab.getNumRow() * datitab.GetRowDim());
|
|
//else
|
|
// document.setLastPos(tab.AltezzaTabella);
|
|
|
|
document.setLastPos(altezzaGrafico + datitab.getNumRow() * datitab.GetRowDim() + 10);
|
|
|
|
bool notaComplessita = false;
|
|
|
|
// MIOFOGLIO 20181130
|
|
float overSpace = 0;
|
|
//--MIOFOGLIO 20181130
|
|
|
|
if (dataThread.TipoReport.ToUpper().Equals("DIAGNOSI"))
|
|
{
|
|
string nota = "";
|
|
|
|
// MIOFOGLIO 20181130
|
|
nota += "(*) In tabella non vengono considerati eventuali saldi negativi di conto corrente ed investimenti in corso";
|
|
|
|
if (dataThread.TotalSelfNegCurrentAccountValue != 0)
|
|
{
|
|
if (dataThread.GetSelfNegativeValue("FO") != 0)
|
|
nota += ", né il saldo negativo della liquidità sottostante le linee “Il MF - Liquidità”";
|
|
if (dataThread.GetSelfNegativeValue("XY") != 0)
|
|
nota += ", né il saldo negativo della liquidità sottostante le linee “GP Eligo”";
|
|
overSpace = 6;
|
|
}
|
|
|
|
nota += ".";
|
|
|
|
// commentato:
|
|
|
|
//if (dataThread.TotalSelfNegCurrentAccountValue != 0)
|
|
//{
|
|
// nota = "(*) In tabella non vengono considerati eventuali saldi negativi di conto corrente ed investimenti in corso, né il saldo negativo della liquidità sottostante le linee “GP Eligo”.";
|
|
//}
|
|
//else
|
|
//{
|
|
// nota = "(*) In tabella non vengono considerati eventuali saldi negativi di conto corrente ed investimenti in corso.";
|
|
//}
|
|
|
|
//--MIOFOGLIO 20181130
|
|
|
|
page.Elements.Add(new ceTe.DynamicPDF.PageElements.Label(nota, datitab.getX(), document.getLastPos(), 500F, 20F, Globals.OpenTypeFontVerdana, fontSize + 1f));
|
|
|
|
//20180914 su richiesta Napolitano, la complessità relativa al Patrimonio va mostrata (non va mostrata quella della riga del Limite massimo profilo
|
|
//quindi commento il blocco if seguente:
|
|
//if (!dataThread.IsProffesionalClient)
|
|
//{
|
|
|
|
string nota2 = "(**) Complessità massima dei prodotti in portafoglio";
|
|
|
|
//se almeno una delle righe presenta complessità valorizzata, nel qual caso va aggiunta la nota
|
|
//if (datitab.table.AsEnumerable().Where(x => !x.Field<string>("Complessita").Equals("-")).AsDataView().Count > 0)
|
|
if (datitab.table.AsEnumerable().Where(x => !x.Field<string>("patrimonio").Contains("Limite massimo profilo") && !x.Field<string>("Complessita").Equals("-")).AsDataView().Count > 0)
|
|
{
|
|
// MIOFOGLIO 20181130 (aggiunto spazio aggiuntivo in caso di presenza GP e/o MioFoglio negativo)
|
|
page.Elements.Add(new ceTe.DynamicPDF.PageElements.Label(nota2, datitab.getX(), document.getLastPos() + 8F + overSpace, 500F, 20F, Globals.OpenTypeFontVerdana, fontSize + 1f));
|
|
//page.Elements.Add(new ceTe.DynamicPDF.PageElements.Label(nota2, datitab.getX(), document.getLastPos() + 8F, 500F, 20F, Globals.OpenTypeFontVerdana, fontSize + 1f));
|
|
//--MIOFOGLIO 20181130
|
|
|
|
//MIFID2 CR Napolitano: aggiunto flag per gestire il numero di asterischi sulla nuova nota richiesta.
|
|
notaComplessita = true;
|
|
}
|
|
|
|
//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"))
|
|
{
|
|
string nota2b = "Livello di Esperienza e Conoscenza più alto tra quelli associati ai singoli Legali Rappresentanti/Delegati profilati";
|
|
if (notaComplessita)
|
|
nota2b = string.Concat("(***) ", nota2b);
|
|
else
|
|
nota2b = string.Concat("(**) ", nota2b);
|
|
// MIOFOGLIO 20181130 (aggiunto spazio aggiuntivo in caso di presenza GP e/o MioFoglio negativo)
|
|
page.Elements.Add(new ceTe.DynamicPDF.PageElements.Label(nota2b, datitab.getX(), notaComplessita ? document.getLastPos() + 16F + overSpace : document.getLastPos() + 8F + overSpace, 500F, 20F, Globals.OpenTypeFontVerdana, fontSize + 1f));
|
|
//page.Elements.Add(new ceTe.DynamicPDF.PageElements.Label(nota2b, datitab.getX(), notaComplessita ? document.getLastPos() + 16F : document.getLastPos() + 8F, 500F, 20F, Globals.OpenTypeFontVerdana, fontSize + 1f));
|
|
//--MIOFOGLIO 20181130
|
|
}
|
|
//--MIFID2
|
|
|
|
if (dataThread.profiloIsAct == false)
|
|
// MIOFOGLIO 20181130 (aggiunto spazio aggiuntivo in caso di presenza GP e/o MioFoglio negativo)
|
|
page.Elements.Add(new ceTe.DynamicPDF.PageElements.Label(Resource.Nota_S96_Scaduto, datitab.getX(), notaComplessita ? document.getLastPos() + 24 + overSpace : document.getLastPos() + 10 + overSpace, 500F, 20F, Globals.OpenTypeFontVerdana, fontSize + 1f, ceTe.DynamicPDF.CmykColor.Red));
|
|
//page.Elements.Add(new ceTe.DynamicPDF.PageElements.Label(Resource.Nota_S96_Scaduto, datitab.getX(), notaComplessita ? document.getLastPos() + 24 : document.getLastPos() + 10, 500F, 20F, Globals.OpenTypeFontVerdana, fontSize + 1f, ceTe.DynamicPDF.CmykColor.Red));
|
|
//--MIOFOGLIO 20181130
|
|
|
|
//}
|
|
//--20180914 Blocco controllo su professionale commentato
|
|
|
|
string nota3;
|
|
|
|
if (set.Tables["RischioDiversificazione"].Rows.Count == 3) //Contiene Patrimonio Banca + Terzi + Complessivo
|
|
{
|
|
var cop1 = set.Tables["RischioDiversificazione"].Rows[0].Field<string>("copertura").ToString();
|
|
var cop2 = set.Tables["RischioDiversificazione"].Rows[1].Field<string>("copertura").ToString();
|
|
var cop3 = set.Tables["RischioDiversificazione"].Rows[2].Field<string>("copertura").ToString();
|
|
nota3 = string.Format("La copertura del patrimonio per il calcolo degli indicatori di rischio è pari al <b>{0}%</b> per il <b>patrimonio $/Banca/$</b>, del <b>{1}%</b> per il <b>patrimonio altri Istituti</b> e del <b>{2}%</b> per il <b>patrimonio complessivo</b>.", cop1, cop2, cop3).Replace("$/Banca/$", nomeRete);
|
|
|
|
}
|
|
else
|
|
{
|
|
var cop1 = set.Tables["RischioDiversificazione"].Rows[0].Field<string>("copertura").ToString();
|
|
//var cop3 = set.Tables["RischioDiversificazione"].Rows[1].Field<string>("copertura").ToString();
|
|
nota3 = string.Format("La copertura del patrimonio per il calcolo degli indicatori di rischio è pari al <b>{0}%</b> per il <b>patrimonio $/Banca/$</b>.", cop1).Replace("$/Banca/$", nomeRete);
|
|
|
|
}
|
|
|
|
//page.Elements.Add(new ceTe.DynamicPDF.PageElements.TextArea(nota3, datitab.getX(), document.getLastPos() + 20F, 500F, 20F, Globals.OpenTypeFontVerdana, fontSize+2f));
|
|
FormattedTextArea textNota = new FormattedTextArea(nota3, document.getMargineLeft(), notaComplessita ? document.getLastPos() + 30F : document.getLastPos() + 16F, 500F, 20F, new ceTe.DynamicPDF.FontFamily("pipp", Globals.OpenTypeFontVerdana, Globals.OpenTypeFontVerdanaB, Globals.OpenTypeFontVerdanaZ, Globals.OpenTypeFontVerdanaZ), fontSize + 1f, false);
|
|
textNota.Height = textNota.GetRequiredHeight();
|
|
textNota.Style.Paragraph.Align = ceTe.DynamicPDF.TextAlign.Justify;
|
|
page.Elements.Add(textNota);
|
|
|
|
}
|
|
else
|
|
{
|
|
//20180914 su richiesta Napolitano, la complessità relativa al Patrimonio va mostrata (non va mostrata quella della riga del Limite massimo profilo
|
|
//quindi commento il blocco if seguente:
|
|
//if (!dataThread.IsProffesionalClient)
|
|
//{
|
|
|
|
//20180917 AC gestione nota eccessiva adeguatezza
|
|
//string nota2 = "(*) Complessità massima dei prodotti in portafoglio";
|
|
float spazioNota = 0;
|
|
|
|
if (!string.IsNullOrEmpty(notaEccessivaAdeguatezza))
|
|
{
|
|
FormattedTextArea t = new FormattedTextArea(notaEccessivaAdeguatezza, document.getMargineLeft(), document.getLastPos(), 510F, 20F, new ceTe.DynamicPDF.FontFamily("pipp", Globals.OpenTypeFontVerdana, Globals.OpenTypeFontVerdanaB, Globals.OpenTypeFontVerdanaZ, Globals.OpenTypeFontVerdanaZ), 6, false);
|
|
t.Height = t.GetRequiredHeight();
|
|
t.Style.Paragraph.Align = ceTe.DynamicPDF.TextAlign.Justify;
|
|
page.Elements.Add(t);
|
|
spazioNota = 24;
|
|
}
|
|
|
|
string nota2 = "";
|
|
if (!string.IsNullOrEmpty(notaEccessivaAdeguatezza))
|
|
nota2 = "(**) Complessità massima dei prodotti in portafoglio";
|
|
else
|
|
nota2 = "(*) Complessità massima dei prodotti in portafoglio";
|
|
//--2018917
|
|
|
|
//se almeno una delle righe presenta complessità valorizzata, nel qual caso va aggiunta la nota
|
|
//if (datitab.table.AsEnumerable().Where(x => !x.Field<string>("Complessita").Equals("-")).AsDataView().Count > 0)
|
|
if (datitab.table.AsEnumerable().Where(x => !x.Field<string>("patrimonio").Contains("Limite massimo profilo") && !x.Field<string>("Complessita").Equals("-")).AsDataView().Count > 0)
|
|
{
|
|
//20180917 AC aggiunto spazio per la nota precedente
|
|
//page.Elements.Add(new ceTe.DynamicPDF.PageElements.Label(nota2, datitab.getX(), document.getLastPos(), 500F, 20F, Globals.OpenTypeFontVerdana, fontSize + 1));
|
|
page.Elements.Add(new ceTe.DynamicPDF.PageElements.Label(nota2, datitab.getX(), document.getLastPos() + spazioNota, 500F, 20F, Globals.OpenTypeFontVerdana, fontSize + 1));
|
|
//--20180917
|
|
//MIFID2 CR Napolitano: aggiunto flag per gestire il numero di asterischi sulla nuova nota richiesta.
|
|
notaComplessita = true;
|
|
}
|
|
|
|
//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"))
|
|
{
|
|
string nota2b = "Livello di Esperienza e Conoscenza più alto tra quelli associati ai singoli Legali Rappresentanti/Delegati profilati";
|
|
if (notaComplessita)
|
|
//20180917 AC gestione nota eccessiva adeguatezza
|
|
//nota2b = string.Concat("(**) ", nota2b);
|
|
nota2b = !string.IsNullOrEmpty(notaEccessivaAdeguatezza) ? string.Concat("(***) ", nota2b) : string.Concat("(**) ", nota2b);
|
|
else
|
|
//20180917 AC gestione nota eccessiva adeguatezza
|
|
//nota2b = string.Concat("(*) ", nota2b);
|
|
nota2b = !string.IsNullOrEmpty(notaEccessivaAdeguatezza) ? string.Concat("(**) ", nota2b) : string.Concat("(*) ", nota2b);
|
|
|
|
//20180917 AC aggiunto spazio nota precedente
|
|
//page.Elements.Add(new ceTe.DynamicPDF.PageElements.Label(nota2b, datitab.getX(), notaComplessita ? document.getLastPos() + 8F : document.getLastPos(), 500F, 20F, Globals.OpenTypeFontVerdana, fontSize + 1f));
|
|
page.Elements.Add(new ceTe.DynamicPDF.PageElements.Label(nota2b, datitab.getX(), notaComplessita ? document.getLastPos() + 8F + spazioNota : document.getLastPos(), 500F, 20F, Globals.OpenTypeFontVerdana, fontSize + 1f));
|
|
//--20180917
|
|
}
|
|
//--MIFID2
|
|
//}
|
|
//--20180914 blocco controllo professionale commentato
|
|
|
|
var cop = set.Tables["RischioDiversificazione"].Rows[0].Field<string>("copertura").ToString();
|
|
|
|
string nota3 = String.Format("La copertura del suo portafoglio per il calcolo degli indicatori di rischio risulta essere del <b>{0}%</b>", cop);
|
|
|
|
//20180917 AC aggiunto spazio nota precedente
|
|
//FormattedTextArea textNota = new FormattedTextArea(nota3, document.getMargineLeft(), document.getLastPos() + 20f, 500F, 20F, new ceTe.DynamicPDF.FontFamily("pipp", Globals.OpenTypeFontVerdana, Globals.OpenTypeFontVerdanaB, Globals.OpenTypeFontVerdanaZ, Globals.OpenTypeFontVerdanaZ), fontSize + 2f, false);
|
|
FormattedTextArea textNota = new FormattedTextArea(nota3, document.getMargineLeft(), document.getLastPos() + 20f + spazioNota, 500F, 20F, new ceTe.DynamicPDF.FontFamily("pipp", Globals.OpenTypeFontVerdana, Globals.OpenTypeFontVerdanaB, Globals.OpenTypeFontVerdanaZ, Globals.OpenTypeFontVerdanaZ), fontSize + 2f, false);
|
|
//--20180917
|
|
textNota.Height = textNota.GetRequiredHeight();
|
|
textNota.Style.Paragraph.Align = ceTe.DynamicPDF.TextAlign.Justify;
|
|
page.Elements.Add(textNota);
|
|
}
|
|
|
|
|
|
//document.setLastPos(800); T-1466629-Y0Y5
|
|
|
|
document.setLastPos(document.getLastPos());
|
|
|
|
//if (datitab.table.Rows.Count > 1)
|
|
// document.setLastPos(-document.getLastPos() + 822);
|
|
//else
|
|
// document.setLastPos(-document.getLastPos() + 800);
|
|
}
|
|
|
|
public void setTitolo(string label)
|
|
{
|
|
Titolo = label;
|
|
}
|
|
|
|
private int MarkPosition(float var)
|
|
{
|
|
int index = 0;
|
|
|
|
/*** Fix Soglie Var 22/07/2023 - Pino ***/
|
|
//if (var <= Convert.ToDouble(BusinessLayer.SoglieVar.sVar1))
|
|
// index = 0;
|
|
//if ((Convert.ToDouble(BusinessLayer.SoglieVar.sVar1) < var) && (var <= Convert.ToDouble(BusinessLayer.SoglieVar.sVar2)))
|
|
// index = 1;
|
|
//if ((Convert.ToDouble(BusinessLayer.SoglieVar.sVar2) < var) && (var <= Convert.ToDouble(BusinessLayer.SoglieVar.sVar3)))
|
|
// index = 2;
|
|
//if ((Convert.ToDouble(BusinessLayer.SoglieVar.sVar3) < var) && (var <= Convert.ToDouble(BusinessLayer.SoglieVar.sVar4)))
|
|
// index = 3;
|
|
//if ((Convert.ToDouble(BusinessLayer.SoglieVar.sVar4) < var))
|
|
// index = 4;
|
|
|
|
var varDec = Convert.ToDecimal(var);
|
|
|
|
|
|
if (varDec <= Convert.ToDecimal(BusinessLayer.SoglieVar.sVar1))
|
|
index = 1;
|
|
if ((Convert.ToDecimal(BusinessLayer.SoglieVar.sVar1) < varDec) && (varDec <= Convert.ToDecimal(BusinessLayer.SoglieVar.sVar2)))
|
|
index = 2;
|
|
if ((Convert.ToDecimal(BusinessLayer.SoglieVar.sVar2) < varDec) && (varDec <= Convert.ToDecimal(BusinessLayer.SoglieVar.sVar3)))
|
|
index = 3;
|
|
if ((Convert.ToDecimal(BusinessLayer.SoglieVar.sVar3) < varDec) && (varDec <= Convert.ToDecimal(BusinessLayer.SoglieVar.sVar4)))
|
|
index = 4;
|
|
//if ((Convert.ToDouble(BusinessLayer.SoglieVar.sVar4) < var))
|
|
// index = 4;
|
|
|
|
|
|
/*****************************************/
|
|
|
|
return index;
|
|
}
|
|
|
|
/// <summary>
|
|
/// Disegna il simbolo accanto alla descrizione del patrimonio nella colonna Patrimonio.
|
|
/// </summary>
|
|
/// <param name="document"></param>
|
|
/// <param name="datasource"></param>
|
|
private void writeMarker(DocumentPDF document, DatiTabella datasource)
|
|
{
|
|
ceTe.DynamicPDF.Merger.ImportedPage page = document.getCurrentPage();
|
|
float y = datasource.GetRowDim();
|
|
float yTabella = datasource.getY();
|
|
ceTe.DynamicPDF.PageElements.Rectangle rect;
|
|
|
|
foreach (DataRow myRow in datasource.table.Rows)
|
|
{
|
|
switch (myRow["Patrimonio"].ToString().Trim().ToLower())
|
|
{
|
|
|
|
//FC 26062015 Aggionamento nuova Ragione Sociale
|
|
//FC 25012016 case "patrimonio banca fideuram":
|
|
case "patrimonio fideuram":
|
|
case "patrimonio sanpaolo invest":
|
|
case "patrimonio san paolo invest":
|
|
case "patrimonio iw private investments":
|
|
case "patrimonio attuale":
|
|
//Marker 1
|
|
rect = new ceTe.DynamicPDF.PageElements.Rectangle(document.getMargineLeft(), yTabella - 5 + y, 10 / 1.414F, 10 / 1.414F, 0, new RgbColor(0, 0, 0));
|
|
rect.Angle = 45;
|
|
page.Elements.Add(rect);
|
|
y += datasource.GetRowDim();
|
|
break;
|
|
|
|
case "patrimonio complessivo":
|
|
//Marker 2
|
|
rect = new ceTe.DynamicPDF.PageElements.Rectangle(document.getMargineLeft() - 4, yTabella - 4 + y, 8, 8, 0, new RgbColor(0, 0, 0));
|
|
//rect.CornerRadius = 5;
|
|
page.Elements.Add(rect);
|
|
y += datasource.GetRowDim();
|
|
break;
|
|
|
|
case "patrimonio altri istituti":
|
|
case "patrimonio prospettico":
|
|
//Marker 3
|
|
rect = new ceTe.DynamicPDF.PageElements.Rectangle(document.getMargineLeft() - 5, yTabella - 5 + y, 10, 10, 0, new RgbColor(0, 0, 0));
|
|
rect.CornerRadius = 5;
|
|
page.Elements.Add(rect);
|
|
y += datasource.GetRowDim();
|
|
break;
|
|
|
|
default:
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|