77 lines
2.7 KiB
C#
77 lines
2.7 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 PDFGenerator.BusinessLayer.DataSection;
|
|
using PDFGenerator.BusinessLayer;
|
|
using System.Collections.Generic;
|
|
|
|
namespace PDFGenerator.BusinessLayer.DataSection
|
|
{
|
|
class DSS144DistibuzionePerScadenze: IDataSection
|
|
{
|
|
public DSS144DistibuzionePerScadenze()
|
|
{
|
|
}
|
|
|
|
#region IDataSection Members
|
|
public DataSectionResult getDataSection(List<SessionStruct> tabelleSessione, string querySql, DataThread dataThread)
|
|
{
|
|
|
|
try
|
|
{
|
|
FormatNum num = new FormatNum();
|
|
|
|
DataSectionResult dsr = new DataSectionResult();
|
|
|
|
DataTable dt = SectionManager.GetDataSection(tabelleSessione, querySql, dataThread);
|
|
|
|
DataSetS144 ds144 = new DataSetS144();
|
|
decimal Totale = 0;
|
|
decimal TotPerc = 100;
|
|
for (int r = 0; r < dt.Rows.Count; r++)
|
|
{
|
|
DataRow dr = ds144.Scadenza.NewRow();
|
|
dr["Scadenza"] = dt.Rows[r]["Scadenza"].ToString();
|
|
dr["Controvalore"] = num.ConvertNum(dt.Rows[r]["Controvalore"]);
|
|
Totale += decimal.Parse(dr["Controvalore"].ToString());
|
|
dr["Percentage"] = Decimal.Round(Convert.ToDecimal(dt.Rows[r]["Percentage"]), 2, MidpointRounding.AwayFromZero);
|
|
TotPerc -= decimal.Parse(dr["Percentage"].ToString());
|
|
dr["Red"] = dt.Rows[r]["Red"];
|
|
dr["Green"] = dt.Rows[r]["Green"];
|
|
dr["Blue"] = dt.Rows[r]["Blue"];
|
|
ds144.Scadenza.Rows.Add(dr);
|
|
}
|
|
|
|
if (ds144.Scadenza.Rows.Count > 0)
|
|
ds144.Scadenza.Rows[dt.Rows.Count - 1]["Percentage"] = decimal.Parse(ds144.Scadenza.Rows[dt.Rows.Count - 1]["Percentage"].ToString()) + TotPerc;
|
|
|
|
|
|
DataRow drtot = ds144.Totale.NewRow();
|
|
//Fc 17/12/2013
|
|
// modifica secondo richiesta di F.Scirocco
|
|
drtot["Descrizione"] = "Totale";
|
|
drtot["Controvalore"] = num.ConvertNum(Totale);
|
|
drtot["Percentage"] = num.ConvertNum(100);
|
|
ds144.Totale.Rows.Add(drtot);
|
|
|
|
dsr.DatiSezione = ds144;
|
|
dsr.Esito = ds144.Scadenza.Rows.Count;
|
|
return dsr;
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
throw ex;
|
|
}
|
|
}
|
|
#endregion
|
|
}
|
|
}
|