275 lines
11 KiB
C#
275 lines
11 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.Presentation.Section.Tables;
|
|
using PDFGenerator.BusinessLayer.DataSection;
|
|
using PDFGenerator.BusinessLayer;
|
|
using System.Threading;
|
|
using System.Globalization;
|
|
using System.Collections.Generic;
|
|
using Dundas.Charting.WebControl;
|
|
using NLog;
|
|
using System.Linq;
|
|
// Rappresentazione per valute: sintesi
|
|
|
|
namespace PDFGenerator.Presentation.Section
|
|
{
|
|
public class FD147 : SIstogramma, ISezione // valute
|
|
{
|
|
private static NLog.Logger logger = NLog.LogManager.GetCurrentClassLogger();
|
|
public FD147()
|
|
{
|
|
}
|
|
private string _testointroduttivo;
|
|
private string _testointroduttivoAlternativo;
|
|
|
|
/// <summary>
|
|
/// Testo introduttivo della sezione
|
|
/// </summary>
|
|
public string TestoIntroduttivo
|
|
{
|
|
get { return _testointroduttivo; }
|
|
set { _testointroduttivo = value; }
|
|
}
|
|
|
|
/// <summary>
|
|
/// Testo introduttivo della sezione
|
|
/// </summary>
|
|
public string TestoIntroduttivoAlternativo
|
|
{
|
|
get { return _testointroduttivoAlternativo; }
|
|
set { _testointroduttivoAlternativo = value; }
|
|
}
|
|
|
|
public void writeSezione(DataThread dataThread)
|
|
{
|
|
dataThread.SETDATA();
|
|
DocumentPDF document = dataThread.DocumentPDF;
|
|
Dictionary<string, System.Drawing.Color> colori = this.getColorCurrencies();
|
|
System.Drawing.Color colore;
|
|
|
|
document.addPage();
|
|
document.NumLastPage = document.NumPage;
|
|
dataThread.SezioneReport.TestoIntroduttivo = dataThread.SezioneReport.TestoIntroduttivoAlternativo;
|
|
|
|
//DataSectionParameter dataSectionParameter = paramSez.getParam();
|
|
FormatNum conv = new FormatNum();
|
|
DatiTabella datitab = new DatiTabella();
|
|
DataSetS147 set = (DataSetS147)dataThread.Data.DatiSezione;
|
|
|
|
//*********************** Modifiche Andrea nuove valute******************************************
|
|
foreach (var item in set.PesiValuteTotali.AsEnumerable())
|
|
{
|
|
if (item.Field<string>("VALUTA").ToString() == "XX1")
|
|
item.SetField<string>("VALUTA", "Non Disp");
|
|
if (item.Field<string>("VALUTA").ToString() == "AP1")
|
|
item.SetField<string>("VALUTA", "Altre PE");
|
|
if (item.Field<string>("VALUTA").ToString() == "AP2")
|
|
item.SetField<string>("VALUTA", "Altre PS");
|
|
}
|
|
foreach (var item1 in set.PesiValuteNegative.AsEnumerable())
|
|
{
|
|
if (item1.Field<string>("VALUTA").ToString() == "XX1")
|
|
item1.SetField<string>("VALUTA", "Non Disp");
|
|
if (item1.Field<string>("VALUTA").ToString() == "AP1")
|
|
item1.SetField<string>("VALUTA", "Altre PE");
|
|
if (item1.Field<string>("VALUTA").ToString() == "AP2")
|
|
item1.SetField<string>("VALUTA", "Altre PS");
|
|
}
|
|
foreach (var item2 in set.PesiValutePositive.AsEnumerable())
|
|
{
|
|
if (item2.Field<string>("VALUTA").ToString() == "XX1")
|
|
item2.SetField<string>("VALUTA", "Non Disp");
|
|
if (item2.Field<string>("VALUTA").ToString() == "AP1")
|
|
item2.SetField<string>("VALUTA", "Altre PE");
|
|
if (item2.Field<string>("VALUTA").ToString() == "AP2")
|
|
item2.SetField<string>("VALUTA", "Altre PS");
|
|
}
|
|
//*****************************************************************************
|
|
|
|
|
|
/* Aggiungo colonne per i colori */
|
|
tabTortaTabella = set.Tables["PesiValuteTotali"];
|
|
|
|
tabTortaTabella.Columns.Add("Red",typeof(int));
|
|
tabTortaTabella.Columns.Add("Green", typeof(int));
|
|
tabTortaTabella.Columns.Add("Blue", typeof(int));
|
|
|
|
foreach (DataRow row in tabTortaTabella.Rows)
|
|
{
|
|
try
|
|
{
|
|
if (row["VALUTA"].ToString().ToUpper() == "EUR")
|
|
{
|
|
colore = colori[row["VALUTA"].ToString().ToUpper()];
|
|
}
|
|
else
|
|
{
|
|
colore = colori["ALTRE"];
|
|
}
|
|
}
|
|
catch (Exception e)
|
|
{
|
|
logger.Error(String.Concat("colori", e.Message, dataThread.CodiceFiscale, dataThread.Rete));
|
|
colore = colori["ALTRE"];
|
|
}
|
|
//RgbColor theColor = new RgbColor(colore.R, colore.G, colore.B);
|
|
|
|
row["Red"] = (int)colore.R;
|
|
row["Green"] = (int)colore.G;
|
|
row["Blue"] = (int)colore.B;
|
|
|
|
}
|
|
|
|
base.DirectBanker = "S";
|
|
|
|
|
|
base.writeSezioneFD147(dataThread);
|
|
}
|
|
|
|
|
|
private Dictionary<string, System.Drawing.Color> getColorCurrencies()
|
|
{
|
|
Dictionary<string, System.Drawing.Color> colori = new Dictionary<string, System.Drawing.Color>();
|
|
colori.Add("EUR", System.Drawing.Color.FromArgb(217, 81, 33));
|
|
//colori.Add("USD", System.Drawing.Color.FromArgb(82, 135, 197));
|
|
//colori.Add("CHF", System.Drawing.Color.FromArgb(255, 200, 0));
|
|
//colori.Add("GBP", System.Drawing.Color.FromArgb(255, 0, 255));
|
|
//colori.Add("CNY", System.Drawing.Color.FromArgb(255, 0, 0));
|
|
//colori.Add("JPY", System.Drawing.Color.FromArgb(0, 0, 0));
|
|
colori.Add("ALTRE", System.Drawing.Color.FromArgb(131, 188, 180));
|
|
|
|
|
|
|
|
return colori;
|
|
|
|
}
|
|
private void addNota1(DocumentPDF doc, int dim, DataThread dataThread, double copertura)
|
|
{
|
|
|
|
decimal totalNegativeCurrentAccountValue = dataThread.Periodico ? dataThread.ContoCorrente : 0;
|
|
decimal GPEligoFondi = dataThread.GPEligoFondi;
|
|
decimal GPEligoTitoli = dataThread.GPEligoTitoli;
|
|
decimal ProdottiNonRapp = dataThread.PatrimonioNonRappresentabileFI;
|
|
decimal PartiteViaggianti = dataThread.PartiteViaggiantiInvestimento;
|
|
//double GradoCopertura = copertura;
|
|
decimal valore = dataThread.PatrimonioBancaFideuramCtvAlNettoContoCorrente + dataThread.PartiteViaggiantiInvestimento + dataThread.PartiteViaggiantiDisinvestimento + dataThread.PatrimonioNonRappresentabileFI;
|
|
decimal GradoCopertura = (dataThread.PatrimonioBancaFideuramCtvAlNettoContoCorrente - dataThread.PatrimonioNonRappresentabileFI) / valore * 100;
|
|
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 (totalNegativeCurrentAccountValue != 0 || GPEligoFondi < 0 || GPEligoTitoli < 0 || ((GradoCopertura >= 0 && GradoCopertura < 100) && (ProdottiNonRapp != 0 || PartiteViaggianti != 0)))
|
|
{
|
|
nota = "(*) ";
|
|
}
|
|
|
|
if (totalNegativeCurrentAccountValue != 0 || GPEligoFondi < 0 || GPEligoTitoli < 0)
|
|
{
|
|
notes.Add("Il controvalore esclude il saldo negativo");
|
|
token = " ";
|
|
|
|
if (totalNegativeCurrentAccountValue < 0)
|
|
{
|
|
notes.Add(string.Format(token + "dei conti correnti ({0} €)", totalNegativeCurrentAccountValue.ToString("N")));
|
|
token = ", ";
|
|
}
|
|
|
|
if (GPEligoFondi < 0)
|
|
{
|
|
notes.Add(string.Format(token + "della liquidità sottostante GP Eligo Fondi ({0} €)", GPEligoFondi.ToString("N")));
|
|
token = ", ";
|
|
}
|
|
|
|
if (GPEligoTitoli < 0)
|
|
{
|
|
notes.Add(string.Format(token + "della liquidità sottostante GP Eligo Titoli ({0} €)", GPEligoTitoli.ToString("N")));
|
|
token = ", ";
|
|
}
|
|
token = ". ";
|
|
|
|
}
|
|
if (ProdottiNonRapp != 0 || PartiteViaggianti != 0)
|
|
{
|
|
if (GradoCopertura >= 0 && GradoCopertura < 100)
|
|
{
|
|
notes.Add(string.Format(token + "Grado di copertura (%) della rappresentazione grafica per esposizione valutaria pari a {0}", GradoCopertura.ToString("N")));
|
|
token = ": ";
|
|
|
|
if (ProdottiNonRapp != 0 || PartiteViaggianti != 0)
|
|
{
|
|
notes.Add(string.Format(token + "non sono considerati"));
|
|
token = " ";
|
|
if (ProdottiNonRapp != 0 || PartiteViaggianti != 0)
|
|
{
|
|
if (ProdottiNonRapp != 0)
|
|
{
|
|
notes.Add(string.Format(token + "i prodotti non rappresentabili ({0} €)", ProdottiNonRapp.ToString("N")));
|
|
token = ", ";
|
|
}
|
|
if (PartiteViaggianti != 0)
|
|
{
|
|
notes.Add(string.Format(token + "gli importi relativi alle operazioni in corso ({0} €)", PartiteViaggianti.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 - 15);
|
|
}
|
|
}
|
|
}
|