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 S167 : STorta //: ISezione
{
private string _titolo = string.Empty;
private string _testointroduttivo = string.Empty;
///
/// Titolo della sezione
///
public new string Titolo
{
get
{
return _titolo;
}
set
{
_titolo = value;
}
}
///
/// Testo introduttivo della Sezione.
///
public string TestoIntroduttivo
{
get
{
return _testointroduttivo;
}
set
{
_testointroduttivo = value;
}
}
public S167()
{
//
// TODO: Add constructor logic here
//
}
#region ISezione Members
public new void writeSezione(DataThread dataThread)
{
DocumentPDF document = dataThread.DocumentPDF;
DatiTabella datitab = new DatiTabella();
DataSetS167 set = (DataSetS167)dataThread.Data.DatiSezione;
int ChartHeigth = 156;
if (document.checkMargin(500))
document.addPage();
#region titolo e testointroduttivo
string titolo = "";
string testointroduttivo = "";
switch (dataThread.Intermediario.ToUpper().ToString())
{
case "COMPLESSIVO":
titolo = "Patrimonio Complessivo";
testointroduttivo = "Nella parte alta della scheda è riportata la classificazione per rischio credito del suo patrimonio finanziario complessivo. La classe di rischio credito è attribuita soltanto ad alcune tipologie di strumenti finanziari. Nella parte bassa della scheda sono riportati, se presenti, i primi tre emittenti dei titoli che lei detiene presso /$BANCA$/ e presso altri Istituti, in ordine di concentrazione, con evidenza del rischio credito relativo alle obbligazioni.";
break;
case "BF":
titolo = "Patrimonio /$BANCA$/";
testointroduttivo = "Nella parte alta della scheda è riportata la classificazione per rischio credito del suo patrimonio finanziario presso /$BANCA$/. La classe di rischio credito è attribuita soltanto ad alcune tipologie di strumenti finanziari. Nella parte bassa della scheda sono riportati, se presenti, i primi tre emittenti dei titoli che lei detiene presso /$BANCA$/, in ordine di concentrazione, con evidenza del rischio credito relativo alle obbligazioni.";
break;
default:
titolo = "Patrimonio altri Istituti";
testointroduttivo = "Nella parte alta della scheda è riportata la classificazione per rischio credito del suo patrimonio finanziario presso altri Istituti. La classe di rischio credito è attribuita soltanto ad alcune tipologie di strumenti finanziari. Nella parte bassa della scheda sono riportati, se presenti, i primi tre emittenti dei titoli che lei detiene presso altri Istituti, in ordine di concentrazione, con evidenza del rischio credito relativo alle obbligazioni.";
break;
}
titolo = titolo.Replace("/$BANCA$/", dataThread.NomeRete);
if (set.Tables["PatrimonioNonCoperto"].Rows.Count > 0)
testointroduttivo += "\r\n" + Resource.S102_TestoPatrimonioNonCoperto;
testointroduttivo = testointroduttivo.Replace("/$BANCA$/", dataThread.NomeRete);
document.setSezTitolo(titolo);
document.setChapterHeader(testointroduttivo, 0, 520, 8);
document.setHeaderSpace(10);
#endregion
if (set.RischioCreditoTotal.Rows.Count ==1)
set.RischioCreditoTotal[0]["totale"] = titolo;
datitab.table = set.Tables["RischioCredito"];
datitab.setIsRet();
datitab.setIsLinee(1);
datitab.setHeader();
datitab.setCell(175, ceTe.DynamicPDF.TextAlign.Left, Globals.OpenTypeFontVerdana, false, 9);
datitab.setCell(90, ceTe.DynamicPDF.TextAlign.Right, Globals.OpenTypeFontVerdana, false, 9);
datitab.setCell(40, ceTe.DynamicPDF.TextAlign.Right, Globals.OpenTypeFontVerdana, false, 9);
//document.page.Elements.Add(new ceTe.DynamicPDF.PageElements.Label(s, xMacroAsset + width, yLabel, (float)Convert.ToDouble(dati.campi[i]), heightLabel, (ceTe.DynamicPDF.Font)dati.font[i], fontSize, (ceTe.DynamicPDF.TextAlign)dati.align[i], ceTe.DynamicPDF.CmykColor.Black));
ceTe.DynamicPDF.Merger.ImportedPage page = document.getCurrentPage();
datitab.setY(document.getLastPos());
datitab.setX(document.getMargineLeft());
datitab.setCellSpace(0);
Tabella tab = new Tabella();
tab.HeaderFont = 8;
//setta posizione tabella
document.InsertTable(tab.getTabella(datitab));
float dim = datitab.GetRowDim() * (datitab.getNumRow() + 1);
//================GRAFICO==================================================================
DatiGrafico dati = new DatiGrafico();
dati.dataTab = set.Tables["ChartData"];
/////Parti aggiuntive tabella
//string label = "";
//if (dataThread.Rete == "F")
// label = "Banca Fideuram";
//else
// label = "Sanpaolo Invest";
dati.setHeight(ChartHeigth);
dati.setWidth(207);
//IstoBarre102 isto = new IstoBarre102();
//document.InsertGrafico(isto.getGrafico(dati), 349, document.getLastPos() - 12);
//this.writeSezione102();
dati.setHeight(ChartHeigth);
dati.setWidth(140);
Torta isto = new Torta();
//document.InsertGrafico(isto.getGrafico(dati), 390, document.getLastPos() - 11);
if (set.Tables["PatrimonioCoperto"].Rows.Count > 0)
{
if (set.Tables["PatrimonioCoperto"].Rows[0]["Percentage"] != DBNull.Value)
{
if (set.Tables["PatrimonioCoperto"].Rows[0]["Percentage"].ToString() != "0,00")
document.InsertGrafico(isto.getGrafico(dati), 360, document.getLastPos() - 11);
}
}
if (set.Tables["RischioCreditoTotal"].Rows.Count > 0)
{
if (set.Tables["RischioCreditoTotal"].Rows[0]["Percentage"] != DBNull.Value)
{
if (set.Tables["RischioCreditoTotal"].Rows[0]["Percentage"].ToString() != "0,00")
document.InsertGrafico(isto.getGrafico(dati), 360, document.getLastPos() - 11);
}
}
//this.writeSezione102();
float LastPosition = document.getLastPos();
//============================================================================================
#region Patrimonio non Coperto (Patrimonio Coperto)
bool patrimonioNonCoperto = false;
if (set.Tables["PatrimonioNonCoperto"].Rows.Count > 0)
{
patrimonioNonCoperto = true;
DatiTabella Cdatitab = new DatiTabella();
Cdatitab.table = set.Tables["PatrimonioCoperto"];
Cdatitab.setY(document.getLastPos() + dim);
Cdatitab.setX(document.getMargineLeft());
Cdatitab.setCell(175, ceTe.DynamicPDF.TextAlign.Left, Globals.OpenTypeFontVerdanaB, true, 9);
Cdatitab.setCell(90, ceTe.DynamicPDF.TextAlign.Right, Globals.OpenTypeFontVerdanaB, true, 9);
Cdatitab.setCell(40, ceTe.DynamicPDF.TextAlign.Right, Globals.OpenTypeFontVerdanaB, true, 9);
Cdatitab.setCellSpace(0);
Tabella Ctab = new Tabella();
if (dataThread.TipoReport.ToUpper() == "DIAGNOSI") tab.HeaderFont = 8;
document.InsertTable(Ctab.getTabella(Cdatitab));
document.setLastPos(3F);
DatiTabella NCdatitab = new DatiTabella();
NCdatitab.table = set.Tables["PatrimonioNonCoperto"];
NCdatitab.setY(document.getLastPos() + dim - 7);
NCdatitab.setX(document.getMargineLeft());
NCdatitab.setCell(175, ceTe.DynamicPDF.TextAlign.Left, Globals.OpenTypeFontVerdana, false, 9);
NCdatitab.setCell(90, ceTe.DynamicPDF.TextAlign.Right, Globals.OpenTypeFontVerdana, false, 9);
NCdatitab.setCell(40, ceTe.DynamicPDF.TextAlign.Right, Globals.OpenTypeFontVerdana, false, 9);
document.InsertTable(tab.getTabella(NCdatitab));
document.setLastPos(3F);
}
#endregion
datitab.setY(document.getLastPos());
datitab.setX(document.getMargineLeft());
datitab.setCellSpace(0);
Tabella tabTot = new Tabella();
if (dataThread.TipoReport.ToUpper() == "DIAGNOSI") tabTot.HeaderFont = 8;
//setta posizione tabella
//document.InsertTable(tabTot.getTabella(datitab));
float dimTot = datitab.GetRowDim() * (datitab.getNumRow() + 1);
datitab = new DatiTabella();
datitab.table = set.Tables["RischioCreditoTotal"];
bool hasPatrimonioNonCoperto = false;
if (set.Tables["PatrimonioNonCoperto"].Rows.Count > 0)
{
datitab.setY(document.getLastPos() + dimTot - 14);
hasPatrimonioNonCoperto = true;
}
else
datitab.setY(document.getLastPos() + dimTot);
datitab.setX(document.getMargineLeft());
datitab.setCell(175, ceTe.DynamicPDF.TextAlign.Left, Globals.OpenTypeFontVerdanaB, true, 9);
datitab.setCell(90, ceTe.DynamicPDF.TextAlign.Right, Globals.OpenTypeFontVerdanaB, true, 9);
datitab.setCell(40, ceTe.DynamicPDF.TextAlign.Right, Globals.OpenTypeFontVerdanaB, true, 9);
document.InsertTable(tabTot.getTabella(datitab));
//page.Elements.Add(new ceTe.DynamicPDF.PageElements.Rectangle(358, LastPosition + 128, 205, 23, 0, new RgbColor(232, 236, 255)));
//FormatNum format = new FormatNum();
////Added by Mebaid
//dati.valMax = 100;
////End mebaid
//ArrayList Labels = format.CreaCustomPerc102(dati.getValMax());
//page.Elements.Add(new ceTe.DynamicPDF.PageElements.Label("0%", 360, LastPosition + 134, 50, 10, Globals.OpenTypeFontVerdana, 6, ceTe.DynamicPDF.TextAlign.Left, ceTe.DynamicPDF.CmykColor.Black));
//page.Elements.Add(new ceTe.DynamicPDF.PageElements.Label("10%", 378, LastPosition + 134, 50, 10, Globals.OpenTypeFontVerdana, 6, ceTe.DynamicPDF.TextAlign.Left, ceTe.DynamicPDF.CmykColor.Black));
//page.Elements.Add(new ceTe.DynamicPDF.PageElements.Label("20%", 396, LastPosition + 134, 50, 10, Globals.OpenTypeFontVerdana, 6, ceTe.DynamicPDF.TextAlign.Left, ceTe.DynamicPDF.CmykColor.Black));
//page.Elements.Add(new ceTe.DynamicPDF.PageElements.Label("30%", 414, LastPosition + 134, 50, 10, Globals.OpenTypeFontVerdana, 6, ceTe.DynamicPDF.TextAlign.Left, ceTe.DynamicPDF.CmykColor.Black));
//page.Elements.Add(new ceTe.DynamicPDF.PageElements.Label("40%", 432, LastPosition + 134, 50, 10, Globals.OpenTypeFontVerdana, 6, ceTe.DynamicPDF.TextAlign.Left, ceTe.DynamicPDF.CmykColor.Black));
////mebaid
//page.Elements.Add(new ceTe.DynamicPDF.PageElements.Label("50%", 451, LastPosition + 134, 50, 10, Globals.OpenTypeFontVerdana, 6, ceTe.DynamicPDF.TextAlign.Left, ceTe.DynamicPDF.CmykColor.Black));
//page.Elements.Add(new ceTe.DynamicPDF.PageElements.Label("60%", 471, LastPosition + 134, 50, 10, Globals.OpenTypeFontVerdana, 6, ceTe.DynamicPDF.TextAlign.Left, ceTe.DynamicPDF.CmykColor.Black));
//page.Elements.Add(new ceTe.DynamicPDF.PageElements.Label("70%", 489, LastPosition + 134, 50, 10, Globals.OpenTypeFontVerdana, 6, ceTe.DynamicPDF.TextAlign.Left, ceTe.DynamicPDF.CmykColor.Black));
//page.Elements.Add(new ceTe.DynamicPDF.PageElements.Label("80%", 507, LastPosition + 134, 50, 10, Globals.OpenTypeFontVerdana, 6, ceTe.DynamicPDF.TextAlign.Left, ceTe.DynamicPDF.CmykColor.Black));
//page.Elements.Add(new ceTe.DynamicPDF.PageElements.Label("90%", 525, LastPosition + 134, 50, 10, Globals.OpenTypeFontVerdana, 6, ceTe.DynamicPDF.TextAlign.Left, ceTe.DynamicPDF.CmykColor.Black));
//page.Elements.Add(new ceTe.DynamicPDF.PageElements.Label("100%", 543, LastPosition + 134, 50, 10, Globals.OpenTypeFontVerdana, 6, ceTe.DynamicPDF.TextAlign.Left, ceTe.DynamicPDF.CmykColor.Black));
dimTot += datitab.GetRowDim() * datitab.getNumRow();
if (dimTot > ChartHeigth)
document.setLastPos(dimTot);
else
document.setLastPos(ChartHeigth);
//nota tabella
decimal totalePartiteViaggianti = dataThread.PartiteViaggiantiInvestimento + dataThread.PartiteViaggiantiDisinvestimento;
FormatNum formatter = new FormatNum();
//V Se sto stampando la sezione per il patrimonio complessivo o patrimonio casa (intermediario = BF anche per SPI)
//allora ci può essere la nota dinamica sulle partite viaggianti e cc negativo
// if ((dataThread.Intermediario.ToUpper() == "COMPLESSIVO" || dataThread.Intermediario.ToUpper() == "BF") && dataThread.ReportsType == )
if ((dataThread.Intermediario.ToUpper() == "COMPLESSIVO" || dataThread.Intermediario.ToUpper() == "BF") &&
dataThread.TipoReport.ToUpper() == TipoReport.DIAGNOSI.ToString())
{
string nota = "";
int deltaYNota = -36;
if (patrimonioNonCoperto)
deltaYNota -= 11;
if (dataThread.TotalNegativeCurrentAccountValue == 0 && dataThread.TotalSelfNegCurrentAccountValue == 0 && totalePartiteViaggianti != 0)
{
nota="(*) Il controvalore esclude gli investimenti in corso";
}
else if (dataThread.TotalNegativeCurrentAccountValue != 0 && dataThread.TotalSelfNegCurrentAccountValue == 0 && totalePartiteViaggianti == 0)
{
nota="(*) Il controvalore esclude il saldo negativo del conto corrente ({0} €)";
nota = string.Format(nota, dataThread.TotalNegativeCurrentAccountValue.ToString("N"));
}
else if (dataThread.TotalNegativeCurrentAccountValue == 0 && dataThread.TotalSelfNegCurrentAccountValue != 0 && totalePartiteViaggianti == 0)
{
nota = "(*) Il controvalore esclude il saldo negativo della liquidità sottostante le linee “GP Eligo” ({0} €)";
nota = string.Format(nota, dataThread.TotalSelfNegCurrentAccountValue.ToString("N"));
}
else if (dataThread.TotalNegativeCurrentAccountValue != 0 && dataThread.TotalSelfNegCurrentAccountValue == 0 && totalePartiteViaggianti != 0)
{
nota="(*) Il controvalore esclude il saldo negativo del conto corrente ({0} €) e gli investimenti in corso";
nota = string.Format(nota, dataThread.TotalNegativeCurrentAccountValue.ToString("N"));
}
else if (dataThread.TotalNegativeCurrentAccountValue != 0 && dataThread.TotalSelfNegCurrentAccountValue != 0 && totalePartiteViaggianti == 0)
{
nota = "(*) Il controvalore esclude il saldo negativo del conto corrente ({0} €) e il saldo negativo della liquidità sottostante le linee “GP Eligo” ({1} €)";
nota = string.Format(nota, dataThread.TotalNegativeCurrentAccountValue.ToString("N"), dataThread.TotalSelfNegCurrentAccountValue.ToString("N"));
}
else if (dataThread.TotalNegativeCurrentAccountValue == 0 && dataThread.TotalSelfNegCurrentAccountValue != 0 && totalePartiteViaggianti != 0)
{
nota = "(*) Il controvalore esclude il saldo negativo della liquidità sottostante le linee “GP Eligo” ({0} €) e gli investimenti in corso";
nota = string.Format(nota, dataThread.TotalSelfNegCurrentAccountValue.ToString("N"));
}
else if (dataThread.TotalNegativeCurrentAccountValue != 0 && dataThread.TotalSelfNegCurrentAccountValue != 0 && totalePartiteViaggianti != 0)
{
nota = "(*) 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";
nota = string.Format(nota, dataThread.TotalNegativeCurrentAccountValue.ToString("N"), dataThread.TotalSelfNegCurrentAccountValue.ToString("N"));
}
if(!nota.Equals(""))
{
document.getCurrentPage().Elements.Add(new Label(nota, datitab.getX(), document.getLastPos() + deltaYNota, 500F, 30F, Globals.OpenTypeFontVerdana, 8));
}
//int deltaYNota = -30;
//if (patrimonioNonCoperto)
// deltaYNota -= 11;
//if (dataThread.TotalNegativeCurrentAccountValue < 0 && totalePartiteViaggianti == 0)
//{
// //formatter.ConvertNum(Convert.ToDecimal(dataThread.TotalNegativeCurrentAccountValue));
// //document.getCurrentPage().Elements.Add(new Label(string.Format(Resource.S1_DiagnosesFootNote, dataThread.TotalNegativeCurrentAccountValue), datitab.getX(), document.getLastPos() - 46, 500F, 30F, Globals.OpenTypeFontVerdana, 8));
// document.getCurrentPage().Elements.Add(new Label(string.Format(Resource.S102_NotaCCNegativo, dataThread.TotalNegativeCurrentAccountValue.ToString("N")), datitab.getX(), document.getLastPos() + deltaYNota, 500F, 30F, Globals.OpenTypeFontVerdana, 8));
//}
//else if (dataThread.TotalNegativeCurrentAccountValue == 0 && totalePartiteViaggianti != 0)
//{
// document.getCurrentPage().Elements.Add(new Label(string.Format(Resource.S102_NotaOperazioniInCorso, dataThread.TotalNegativeCurrentAccountValue.ToString("N")), datitab.getX(), document.getLastPos() + deltaYNota, 500F, 30F, Globals.OpenTypeFontVerdana, 8));
//}
//else if (dataThread.TotalNegativeCurrentAccountValue < 0 && totalePartiteViaggianti != 0)
//{
// document.getCurrentPage().Elements.Add(new Label(string.Format(Resource.S102_NotaCCNegativo_OperazioniInCorso, dataThread.TotalNegativeCurrentAccountValue.ToString("N")), datitab.getX(), document.getLastPos() + deltaYNota, 500F, 30F, Globals.OpenTypeFontVerdana, 8));
//}
}
else if (dataThread.TipoReport.ToUpper() == TipoReport.MONITORAGGIO.ToString())
{
int deltaYNota = -30;
if (patrimonioNonCoperto)
deltaYNota -= 11;
if (dataThread.TotalNegativeCurrentAccountValue < 0 && totalePartiteViaggianti == 0)
{
document.getCurrentPage().Elements.Add(new Label(string.Format(Resource.S102_NotaCCNegativo, dataThread.TotalNegativeCurrentAccountValue.ToString("N")), datitab.getX(), document.getLastPos() + deltaYNota, 500F, 30F, Globals.OpenTypeFontVerdana, 8));
}
else if (dataThread.TotalNegativeCurrentAccountValue == 0 && totalePartiteViaggianti != 0)
{
document.getCurrentPage().Elements.Add(new Label(string.Format(Resource.S102_NotaOperazioniInCorso, dataThread.TotalNegativeCurrentAccountValue.ToString("N")), datitab.getX(), document.getLastPos() + deltaYNota, 500F, 30F, Globals.OpenTypeFontVerdana, 8));
}
else if (dataThread.TotalNegativeCurrentAccountValue < 0 && totalePartiteViaggianti != 0)
{
document.getCurrentPage().Elements.Add(new Label(string.Format(Resource.S102_NotaCCNegativo_OperazioniInCorso, dataThread.TotalNegativeCurrentAccountValue.ToString("N")), datitab.getX(), document.getLastPos() + deltaYNota, 500F, 30F, Globals.OpenTypeFontVerdana, 8));
}
}
if (hasPatrimonioNonCoperto)
{
//document.getCurrentPage().Elements.Add(new Label(Resource.S102_NotaCCNegativo, datitab.getX(), document.getLastPos() - 46, 500F, 30F, Globals.OpenTypeFontVerdana, 8));
//document.getCurrentPage().Elements.Add(new Label(Resource.S102_NotaFranchigia, datitab.getX(), document.getLastPos() - 24, 500F, 30F, Globals.OpenTypeFontVerdana, 8));
//document.getCurrentPage().Elements.Add(new Label(Resource.S102_NotaFranchigia, datitab.getX(), document.getLastPos() - 100, 500F, 30F, Globals.OpenTypeFontVerdana, 8));
//document.getCurrentPage().Elements.Add(new Label(Resource.S102_NotaFranchigia, datitab.getX(), document.getLastPos(), 500F, 30F, Globals.OpenTypeFontVerdana, 8));
document.setLastPos(10);
}
}
#endregion
}
}