116 lines
4.7 KiB
C#
116 lines
4.7 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Data;
|
|
using Consulenza.ReportWriter.Business.OBJ_PDF;
|
|
using Consulenza.ReportWriter.Business;
|
|
|
|
namespace Consulenza.ReportWriter.Manager.Section.Base.Proposta
|
|
{
|
|
public class P8 : Entity.Section
|
|
{
|
|
public P8(EnvironmentFacade environmentFacade, int idSection)
|
|
: base(environmentFacade, idSection)
|
|
{
|
|
try
|
|
{
|
|
Draw();
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
SectionLogger.Write("P8", ex.Message, SectionLoggerMessageLevel.E, base.EnvironmentFacade.ReportEnvironment);
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// Disegna l'oggetto P8
|
|
/// </summary>
|
|
protected override sealed void Draw()
|
|
{
|
|
var dtT4 = GetText();
|
|
var dtP8 = GetDataTable();
|
|
|
|
if (dtP8.Rows.Count <= 0) return;
|
|
|
|
#region Testo introduttivo T4
|
|
|
|
FormattedTextAreaPDF testoIntroduttivo = null;
|
|
if (dtT4.Rows.Count > 0)
|
|
{
|
|
string stringaTestoIntroduttivo = dtT4.Rows[0]["Testo1"].ToString();
|
|
testoIntroduttivo = new FormattedTextAreaPDF(stringaTestoIntroduttivo, base.EnvironmentFacade.RendererFacade.XLeftLimit + 5);
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region Tabella P8
|
|
|
|
decimal totaleControvaloreAttuale = Convert.ToDecimal(dtP8.Compute("Sum(Ctv_Attuale)", string.Empty));
|
|
decimal totaleControvaloreProspettico = Convert.ToDecimal(dtP8.Compute("Sum(Ctv_Prospettico)", string.Empty));
|
|
|
|
var tabella = new TablePDF(base.EnvironmentFacade.RendererFacade.XLeftLimit, dtP8);
|
|
tabella.Columns.Add(new ColumnPDF("NomeProdotto", 223, HorizontalAlignmentType.Sinistra, false, false, 7, ColumnType.Testo, "NomeProdotto", "Nome prodotto"));
|
|
tabella.Columns.Add(new ColumnPDF("Ctv_Attuale", 150, HorizontalAlignmentType.Destra, false, false, 7, ColumnType.Decimale, "Ctv_Attuale", "Controvalore attuale (€)"));
|
|
tabella.Columns.Add(new ColumnPDF("Ctv_Prospettico", 150, HorizontalAlignmentType.Destra, false, false, 7, ColumnType.Decimale, "Ctv_Prospettico", "Controvalore prospettico (€)"));
|
|
|
|
|
|
// Footer
|
|
tabella.FooterColumns.Add(new ColumnPDF("Totale", 223, HorizontalAlignmentType.Sinistra, false, true, 8, ColumnType.Testo));
|
|
tabella.FooterColumns.Add(new ColumnPDF("Totale Controvalore Attuale", 150, HorizontalAlignmentType.Destra, false, true, 8, ColumnType.Decimale));
|
|
tabella.FooterColumns.Add(new ColumnPDF("Totale Controvalore Prospettico", 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();
|
|
|
|
#endregion
|
|
|
|
base.AddElement(testoIntroduttivo);
|
|
base.AddElement(new SpacePDF(20));
|
|
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()
|
|
{
|
|
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.ExecuteDataTableStoredProcedure(DBProvider.SqlServerConsulenzaUnica, "REP_Prop_P8", parametri)
|
|
: DataAccess.ExecuteDataTableStoredProcedure(DBProvider.SqlServerConsulenzaBase, "REP_Prop_P8", parametri);
|
|
}
|
|
|
|
/// <summary>
|
|
/// Recupera i dati necessari alla Section restituendo un DataSet.
|
|
/// </summary>
|
|
/// <returns></returns>
|
|
protected sealed override DataSet GetDataSet()
|
|
{
|
|
return null;
|
|
}
|
|
}
|
|
} |