357 lines
18 KiB
C#
357 lines
18 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 S102 : STorta //: ISezione
|
||
{
|
||
private string _titolo = string.Empty;
|
||
private string _testointroduttivo = string.Empty;
|
||
|
||
|
||
|
||
|
||
|
||
/// <summary>
|
||
/// Titolo della sezione
|
||
/// </summary>
|
||
public new string Titolo
|
||
{
|
||
get
|
||
{
|
||
return _titolo;
|
||
}
|
||
set
|
||
{
|
||
_titolo = value;
|
||
}
|
||
}
|
||
|
||
/// <summary>
|
||
/// Testo introduttivo della Sezione.
|
||
/// </summary>
|
||
public string TestoIntroduttivo
|
||
{
|
||
get
|
||
{
|
||
return _testointroduttivo;
|
||
}
|
||
set
|
||
{
|
||
_testointroduttivo = value;
|
||
}
|
||
}
|
||
public S102()
|
||
{
|
||
//
|
||
// TODO: Add constructor logic here
|
||
//
|
||
}
|
||
|
||
#region ISezione Members
|
||
|
||
|
||
|
||
public new void writeSezione(DataThread dataThread)
|
||
{
|
||
|
||
DocumentPDF document = dataThread.DocumentPDF;
|
||
DatiTabella datitab = new DatiTabella();
|
||
DataSet set = (DataSet)dataThread.Data.DatiSezione;
|
||
int ChartHeigth = 156;//120;
|
||
|
||
//calcola se entra nella pagina ci devono entrare la 102 e la 103
|
||
if (document.checkMargin(500))
|
||
document.addPage();
|
||
|
||
|
||
string temp;
|
||
|
||
|
||
if (dataThread.Intermediario == "BF" || dataThread.Intermediario == string.Empty)
|
||
{
|
||
//if (dataThread.Rete == "S")
|
||
// temp = "Sanpaolo Invest";
|
||
//else
|
||
// //FC 26062015 Aggionamento nuova Ragione Sociale
|
||
// temp = "Fideuram";
|
||
|
||
//*********************************** Cecco modifiche dicitura IWBANK**********************
|
||
if (dataThread.Rete == "S")
|
||
//Rosaspina Andrea
|
||
temp = "Fideuram S.p.A., commercializzato tramite la rete di private banker Sanpaolo Invest";
|
||
//temp = "Sanpaolo Invest";
|
||
else if (dataThread.Rete == "F")
|
||
{
|
||
//FC 26062015 Aggionamento nuova Ragione Sociale
|
||
temp = "Fideuram";
|
||
}
|
||
else
|
||
{
|
||
temp = "IW Private Investments";
|
||
}
|
||
}
|
||
//**********************************************************************************************
|
||
else
|
||
temp = dataThread.Intermediario;
|
||
|
||
if (dataThread.TipoReport.ToUpper() == "MONITORAGGIO")
|
||
document.setSezTitolo(_titolo);
|
||
else
|
||
document.setSezTitoloWithoutNumber(_titolo + " " + temp);
|
||
|
||
//V if I have non coverage heritage I have to add the text in the introductionary text
|
||
if (set.Tables["PatrimonioNonCoperto"].Rows.Count > 0)
|
||
_testointroduttivo += "\r\n"+Resource.S102_TestoPatrimonioNonCoperto;
|
||
|
||
_testointroduttivo = _testointroduttivo.Replace("/$BANCA$/", temp);
|
||
|
||
if (temp.ToUpper() == "COMPLESSIVO")
|
||
_testointroduttivo = _testointroduttivo.Replace(", detenuto presso Complessivo,", " complessivo");
|
||
|
||
document.setSezHeader(_testointroduttivo); // testo introduttivo
|
||
document.setHeaderSpace(10);
|
||
|
||
|
||
datitab.table = set.Tables["RischioCredito"];
|
||
datitab.setIsRet();
|
||
datitab.setIsLinee(1);
|
||
datitab.setHeader();
|
||
datitab.setCell(175, ceTe.DynamicPDF.TextAlign.Left, Globals.OpenTypeFontVerdana, false);
|
||
datitab.setCell(90, ceTe.DynamicPDF.TextAlign.Right, Globals.OpenTypeFontVerdana, false);
|
||
datitab.setCell(40, ceTe.DynamicPDF.TextAlign.Right, Globals.OpenTypeFontVerdana, false);
|
||
|
||
|
||
//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();
|
||
if (dataThread.TipoReport.ToUpper() == "DIAGNOSI") 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);
|
||
Cdatitab.setCell(90, ceTe.DynamicPDF.TextAlign.Right, Globals.OpenTypeFontVerdanaB, true);
|
||
Cdatitab.setCell(40, ceTe.DynamicPDF.TextAlign.Right, Globals.OpenTypeFontVerdanaB, true);
|
||
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);
|
||
NCdatitab.setCell(90, ceTe.DynamicPDF.TextAlign.Right, Globals.OpenTypeFontVerdana, false);
|
||
NCdatitab.setCell(40, ceTe.DynamicPDF.TextAlign.Right, Globals.OpenTypeFontVerdana, false);
|
||
|
||
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);
|
||
datitab.setCell(90, ceTe.DynamicPDF.TextAlign.Right, Globals.OpenTypeFontVerdanaB, true);
|
||
datitab.setCell(40, ceTe.DynamicPDF.TextAlign.Right, Globals.OpenTypeFontVerdanaB, true);
|
||
|
||
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<70> 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())
|
||
{
|
||
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
|
||
}
|
||
}
|