148 lines
6.7 KiB
C#
148 lines
6.7 KiB
C#
using System;
|
|
using System.Data;
|
|
using Consulenza.ReportWriter.Business.OBJ_PDF;
|
|
using Consulenza.ReportCommon;
|
|
using System.Collections.Generic;
|
|
using Consulenza.ReportWriter.Business;
|
|
|
|
namespace Consulenza.ReportWriter.Manager.Section.Base.Proposta
|
|
{
|
|
public class P12_B : Entity.Section
|
|
{
|
|
public P12_B(EnvironmentFacade environmentFacade, int idSection)
|
|
: base(environmentFacade, idSection)
|
|
{
|
|
try
|
|
{
|
|
Draw();
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
SectionLogger.Write("P12_B", ex.Message, SectionLoggerMessageLevel.E, base.EnvironmentFacade.ReportEnvironment);
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// Disegna l'oggetto P12_B.
|
|
/// Questa sezione contiene i prodotti MASS
|
|
/// </summary>
|
|
protected override sealed void Draw()
|
|
{
|
|
var dsP12 = GetDataSet();
|
|
|
|
var dtTabellaRiepilogo = dsP12.Tables[0];
|
|
var dtTabellaDati = dsP12.Tables[1];
|
|
|
|
if (dtTabellaDati.Rows.Count <= 0) return;
|
|
|
|
#region Tabella Riepilogo
|
|
|
|
var tabellaSubtitle = new TablePDF(base.EnvironmentFacade.RendererFacade.XLeftLimit, 3, 2);
|
|
tabellaSubtitle.Columns.Add(new ColumnPDF("", 174, HorizontalAlignmentType.Sinistra, false, true, 8, ColumnType.Testo));
|
|
tabellaSubtitle.Columns.Add(new ColumnPDF("", 174, HorizontalAlignmentType.Sinistra, false, true, 8, ColumnType.Testo));
|
|
tabellaSubtitle.Columns.Add(new ColumnPDF("", 174, HorizontalAlignmentType.Sinistra, false, true, 8, ColumnType.Testo));
|
|
tabellaSubtitle.Header = false;
|
|
tabellaSubtitle.Footer = false;
|
|
tabellaSubtitle.AlternateRow = false;
|
|
tabellaSubtitle.ID = "tabellaSubtitle_P12";
|
|
|
|
tabellaSubtitle.Cells[0, 0].Value = "Tipo rateazione: " + dtTabellaRiepilogo.Rows[0]["Descrizione"].ToString();
|
|
tabellaSubtitle.Cells[1, 0].Value = "Rata programmata (€): " + Helper.FormatCurrency(dtTabellaRiepilogo.Rows[0]["ImportoRata"].ToString());
|
|
tabellaSubtitle.Cells[2, 0].Value = "Numero annualità: " + dtTabellaRiepilogo.Rows[0]["DurataPPV"].ToString();
|
|
|
|
string sPremioUnicoAggiuntivo = "0,00";
|
|
if (!string.IsNullOrEmpty(dtTabellaRiepilogo.Rows[0]["ImpAggiuntivo"].ToString()))
|
|
sPremioUnicoAggiuntivo = Helper.FormatCurrency(dtTabellaRiepilogo.Rows[0]["ImpAggiuntivo"].ToString());
|
|
|
|
tabellaSubtitle.Cells[0, 1].Value = "Premio unico aggiuntivo (€): " + sPremioUnicoAggiuntivo.ToString();
|
|
|
|
#endregion
|
|
|
|
#region Tabella Dati
|
|
|
|
decimal totaleControvaloreAttuale = Convert.ToDecimal(dtTabellaDati.Compute("Sum(CtvAttuale)", string.Empty));
|
|
decimal totaleControvaloreProspettico = Convert.ToDecimal(dtTabellaDati.Compute("Sum(CtvProspettico)", string.Empty));
|
|
|
|
var tabella = new TablePDF(base.EnvironmentFacade.RendererFacade.XLeftLimit, dtTabellaDati)
|
|
{
|
|
ID = "Tabella_P12_B",
|
|
SubTitleTable = tabellaSubtitle,
|
|
TitleRowSpace = 5,
|
|
TitleRow = true,
|
|
TitleRowText = "NUOVA SOTTOSCRIZIONE A PREMIO PERIODICO"
|
|
};
|
|
|
|
tabella.Columns.Add(new ColumnPDF("NomeProdotto", 223, HorizontalAlignmentType.Sinistra, false, false, 7, ColumnType.Testo, "NomeProdotto", "Nome prodotto"));
|
|
tabella.Columns.Add(new ColumnPDF("CtvAttuale", 150, HorizontalAlignmentType.Destra, false, false, 7, ColumnType.Decimale, "CtvAttuale", "Controvalore attuale (€)"));
|
|
tabella.Columns.Add(new ColumnPDF("CtvProspettico", 150, HorizontalAlignmentType.Destra, false, false, 7, ColumnType.Decimale, "CtvProspettico", "Controvalore prospettico (€)"));
|
|
|
|
|
|
// Footer
|
|
tabella.FooterColumns.Add(new ColumnPDF("Totale", 223, HorizontalAlignmentType.Sinistra, false, true, 8, ColumnType.Testo));
|
|
tabella.FooterColumns.Add(new ColumnPDF("TotaleControvaloreAttuale", 150, HorizontalAlignmentType.Destra, false, true, 8, ColumnType.Decimale));
|
|
tabella.FooterColumns.Add(new ColumnPDF("TotaleControvaloreProspettico", 150, HorizontalAlignmentType.Destra, false, true, 8, ColumnType.Decimale));
|
|
|
|
tabella.FooterCells[0, 0].Value = "Totale";
|
|
tabella.FooterCells[1, 0].Value = totaleControvaloreAttuale.ToString();
|
|
tabella.FooterCells[2, 0].Value = totaleControvaloreProspettico.ToString();
|
|
|
|
#region Nota PremiVersati (header della tabella)
|
|
|
|
var campiAsterisco = new string[1] { "CtvProspettico" }; // campi del datasource su cui aggiungere gli asterischi di rimando alla note.
|
|
|
|
var notaPremiVersati = new TableNotePDF(TableNotePDF.TableNotePositionType.PièDiTabella, "Totale dei premi versati in fase di sottoscrizione (prima rata + premio unico aggiuntivo)", campiAsterisco, string.Empty, TableNotePDF.TableNoteAsteriskPositionType.IntestazioneTabella);
|
|
tabella.Notes.Add(notaPremiVersati);
|
|
|
|
#endregion
|
|
|
|
#endregion
|
|
|
|
base.AddElement(tabella);
|
|
base.AddElement(new SpacePDF(20));
|
|
}
|
|
|
|
/// <summary>
|
|
/// Recupera i dati necessari alla Section restituendo un DataTable.
|
|
/// </summary>
|
|
/// <returns></returns>
|
|
protected sealed override DataTable GetDataTable()
|
|
{
|
|
return null;
|
|
}
|
|
|
|
/// <summary>
|
|
/// Recupera i dati necessari alla Section restituendo un DataSet.
|
|
/// </summary>
|
|
/// <returns></returns>
|
|
protected sealed override DataSet GetDataSet()
|
|
{
|
|
var parametri = new List<Parametro>();
|
|
|
|
#region Definizione dei parametri
|
|
|
|
var parametro = new Parametro
|
|
{
|
|
Direction = System.Data.ParameterDirection.Input,
|
|
DbType = System.Data.DbType.Int64,
|
|
ParameterName = "chiaveClientePB",
|
|
Value = base.EnvironmentFacade.ReportEnvironment.Cliente.Chiave
|
|
};
|
|
parametri.Add(parametro);
|
|
|
|
parametro = new Parametro
|
|
{
|
|
Direction = System.Data.ParameterDirection.Input,
|
|
DbType = System.Data.DbType.Int32,
|
|
ParameterName = "chiaveProposta",
|
|
Value = base.EnvironmentFacade.ReportEnvironment.Proposta.Chiave
|
|
};
|
|
parametri.Add(parametro);
|
|
|
|
#endregion
|
|
|
|
return EnvironmentFacade.ReportEnvironment.Proposta.PropostaCBUnica ? DataAccess.ExecuteDataSetStoredProcedure(DBProvider.SqlServerConsulenzaUnica, "REP_Prop_P12_B", parametri)
|
|
: DataAccess.ExecuteDataSetStoredProcedure(DBProvider.SqlServerConsulenzaBase, "REP_Prop_P12_B", parametri);
|
|
}
|
|
}
|
|
}
|