Completata release print in pdf
git-svn-id: https://keyhammer.ath.cx/svn/WebGIM/trunk@71 3e04ef4b-3b25-4b6c-be27-bb5389ca777b
This commit is contained in:
@@ -40,13 +40,17 @@ public class reportExporter
|
||||
/// <summary>
|
||||
/// carica i dati richiesti dal report dalla StoredProcedure (filtrando quindi...)
|
||||
/// </summary>
|
||||
/// <param name="idxObj"></param>
|
||||
/// <returns></returns>
|
||||
/// <param name="tipoReport">report ammessi: RichiestaIntervento</param>
|
||||
/// <param name="idxObj">num int mtz</param>
|
||||
/// <returns>tabella dati</returns>
|
||||
private DataTable caricaDati(reportRichiesto tipoReport, string idxObj)
|
||||
{
|
||||
DataTable tab = new DataTable();
|
||||
switch (tipoReport)
|
||||
{
|
||||
case reportRichiesto.ElencoMacchine:
|
||||
tab = (DataTable)TA_app.obj.taElencoImpMacch.GetData();
|
||||
break;
|
||||
case reportRichiesto.RichiestaIntervento:
|
||||
tab = (DataTable)TA_app.obj.taInterventiMtz.getByIdx(Convert.ToInt32(idxObj));
|
||||
break;
|
||||
@@ -56,10 +60,79 @@ public class reportExporter
|
||||
return tab;
|
||||
}
|
||||
/// <summary>
|
||||
/// carica i dati richiesti dal report dalla StoredProcedure (filtrando quindi...)
|
||||
/// </summary>
|
||||
/// <param name="tipoReport">report ammessi: ElencoMacchine</param>
|
||||
/// <returns>tabella dati</returns>
|
||||
private DataTable caricaDati(reportRichiesto tipoReport)
|
||||
{
|
||||
DataTable tab = new DataTable();
|
||||
switch (tipoReport)
|
||||
{
|
||||
case reportRichiesto.ElencoMacchine:
|
||||
tab = (DataTable)TA_app.obj.taElencoImpMacch.GetData();
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return tab;
|
||||
}
|
||||
/// <summary>
|
||||
/// carica i dati richiesti dal report dalla StoredProcedure (filtrando quindi...)
|
||||
/// </summary>
|
||||
/// <param name="tipoReport">report ammessi: ElencoInterventi / MTBF_MTTR</param>
|
||||
/// <param name="periodoAnalizzato">oggetto che contiene data inizio e data fine dell'analisi richiesta per il report</param>
|
||||
/// <returns>tabella dati</returns>
|
||||
private DataTable caricaDati(reportRichiesto tipoReport, intervalloDate periodoAnalizzato)
|
||||
{
|
||||
DataTable tab = new DataTable();
|
||||
switch (tipoReport)
|
||||
{
|
||||
case reportRichiesto.ElencoInterventi:
|
||||
tab = (DataTable)TA_app.obj.taElencoIntFilt.getByIntervDate(periodoAnalizzato.inizio, periodoAnalizzato.fine);
|
||||
break;
|
||||
case reportRichiesto.MTBF_MTTR:
|
||||
tab = (DataTable)TA_app.obj.taElenco_MTBF_MTTR.GetData(periodoAnalizzato.inizio, periodoAnalizzato.fine);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return tab;
|
||||
}
|
||||
/// <summary>
|
||||
/// renderizza il report in pdf
|
||||
/// </summary>
|
||||
/// <param name="tipoReport"></param>
|
||||
/// <param name="parametro"></param>
|
||||
/// <param name="tipoReport">report ammessi: ElencoMacchine</param>
|
||||
/// <returns></returns>
|
||||
public void popolaPdfStream(reportRichiesto tipoReport)
|
||||
{
|
||||
LocalReport report = new LocalReport();
|
||||
string deviceInfo = "";
|
||||
switch (tipoReport)
|
||||
{
|
||||
case reportRichiesto.ElencoMacchine:
|
||||
report.ReportPath = @".\MacchineReparti.rdlc";
|
||||
report.DataSources.Add(new ReportDataSource("WebGim", caricaDati(tipoReport)));
|
||||
deviceInfo = "<DeviceInfo>" +
|
||||
" <OutputFormat>PDF</OutputFormat>" +
|
||||
" <PageWidth>29.7cm</PageWidth>" +
|
||||
" <PageHeight>21cm</PageHeight>" +
|
||||
" <MarginTop>0.2cm</MarginTop>" +
|
||||
" <MarginLeft>0.2cm</MarginLeft>" +
|
||||
" <MarginRight>0.2cm</MarginRight>" +
|
||||
" <MarginBottom>0.2cm</MarginBottom>" +
|
||||
"</DeviceInfo>";
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
createPdfStream(report, deviceInfo);
|
||||
}
|
||||
/// <summary>
|
||||
/// renderizza il report in pdf
|
||||
/// </summary>
|
||||
/// <param name="tipoReport">report ammessi: RichiestaIntervento</param>
|
||||
/// <param name="parametro">idx della richiesta (numIntMtz)</param>
|
||||
/// <returns></returns>
|
||||
public void popolaPdfStream(reportRichiesto tipoReport, string parametro)
|
||||
{
|
||||
@@ -67,7 +140,7 @@ public class reportExporter
|
||||
string deviceInfo = "";
|
||||
switch (tipoReport)
|
||||
{
|
||||
case reportRichiesto.RichiestaIntervento:
|
||||
case reportRichiesto.RichiestaIntervento:
|
||||
report.ReportPath = @".\RichiestaIntervento.rdlc";
|
||||
report.DataSources.Add(new ReportDataSource("WebGim", caricaDati(tipoReport, parametro))); // OCCHIO!!! va messa sorgente dati CORRETTA
|
||||
deviceInfo = "<DeviceInfo>" +
|
||||
@@ -83,6 +156,60 @@ public class reportExporter
|
||||
default:
|
||||
break;
|
||||
}
|
||||
createPdfStream(report, deviceInfo);
|
||||
}
|
||||
/// <summary>
|
||||
/// renderizza il report in pdf
|
||||
/// </summary>
|
||||
/// <param name="tipoReport">report ammessi: ElencoInterventi / MTBF_MTTR</param>
|
||||
/// <param name="periodoAnalizzato">oggetto che contiene data inizio e data fine dell'analisi richiesta per il report</param>
|
||||
public void popolaPdfStream(reportRichiesto tipoReport, intervalloDate periodoAnalizzato)
|
||||
{
|
||||
LocalReport report = new LocalReport();
|
||||
string deviceInfo = "";
|
||||
switch (tipoReport)
|
||||
{
|
||||
case reportRichiesto.ElencoInterventi:
|
||||
report.ReportPath = @".\ReportInterventi.rdlc";
|
||||
report.DataSources.Add(new ReportDataSource("WebGim", caricaDati(tipoReport, periodoAnalizzato)));
|
||||
deviceInfo = "<DeviceInfo>" +
|
||||
" <OutputFormat>PDF</OutputFormat>" +
|
||||
" <PageWidth>21cm</PageWidth>" +
|
||||
" <PageHeight>29.7cm</PageHeight>" +
|
||||
" <MarginTop>0.2cm</MarginTop>" +
|
||||
" <MarginLeft>0.2cm</MarginLeft>" +
|
||||
" <MarginRight>0.2cm</MarginRight>" +
|
||||
" <MarginBottom>0.2cm</MarginBottom>" +
|
||||
"</DeviceInfo>";
|
||||
break;
|
||||
case reportRichiesto.MTBF_MTTR:
|
||||
report.ReportPath = @".\Report_MTBF_MTTR.rdlc";
|
||||
report.DataSources.Add(new ReportDataSource("WebGim", caricaDati(tipoReport, periodoAnalizzato)));
|
||||
deviceInfo = "<DeviceInfo>" +
|
||||
" <OutputFormat>PDF</OutputFormat>" +
|
||||
" <PageWidth>21cm</PageWidth>" +
|
||||
" <PageHeight>29.7cm</PageHeight>" +
|
||||
" <MarginTop>0.2cm</MarginTop>" +
|
||||
" <MarginLeft>0.2cm</MarginLeft>" +
|
||||
" <MarginRight>0.2cm</MarginRight>" +
|
||||
" <MarginBottom>0.2cm</MarginBottom>" +
|
||||
"</DeviceInfo>";
|
||||
// calcolo le ore totali equivalenti...
|
||||
ReportParameter[] OreTotali = { new ReportParameter("OreTotali", WebGimUtils.obj.oreEquivalenti(periodoAnalizzato).ToString()) };
|
||||
report.SetParameters(OreTotali);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
createPdfStream(report, deviceInfo);
|
||||
}
|
||||
/// <summary>
|
||||
/// crea il vero e proprio stream pdf
|
||||
/// </summary>
|
||||
/// <param name="report"></param>
|
||||
/// <param name="deviceInfo"></param>
|
||||
private void createPdfStream(LocalReport report, string deviceInfo)
|
||||
{
|
||||
// export in PDF
|
||||
string reportType = "PDF";
|
||||
Warning[] warnings;
|
||||
@@ -96,4 +223,5 @@ public class reportExporter
|
||||
out streams,
|
||||
out warnings);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -99,7 +99,7 @@ public class reportPrinter
|
||||
/// </summary>
|
||||
/// <param name="tipoReport">report ammessi: ElencoMacchine / RichiestaIntervento</param>
|
||||
/// <param name="periodoAnalizzato">oggetto che contiene data inizio e data fine dell'analisi richiesta per il report</param>
|
||||
/// <returns></returns>
|
||||
/// <returns>tabella dati</returns>
|
||||
private DataTable caricaDati(reportRichiesto tipoReport, string idxObj)
|
||||
{
|
||||
DataTable tab = new DataTable();
|
||||
@@ -121,7 +121,7 @@ public class reportPrinter
|
||||
/// </summary>
|
||||
/// <param name="tipoReport">report ammessi: ElencoInterventi / MTBF_MTTR</param>
|
||||
/// <param name="periodoAnalizzato">oggetto che contiene data inizio e data fine dell'analisi richiesta per il report</param>
|
||||
/// <returns></returns>
|
||||
/// <returns>tabella dati</returns>
|
||||
private DataTable caricaDati(reportRichiesto tipoReport, intervalloDate periodoAnalizzato)
|
||||
{
|
||||
DataTable tab = new DataTable();
|
||||
@@ -142,8 +142,8 @@ public class reportPrinter
|
||||
/// Crea un report locale da file rdlc, carica i dati, esporta report come EMF file e quindi lo invia alla stampante
|
||||
/// </summary>
|
||||
/// <param name="tipoReport">report ammessi: ElencoMacchine / RichiestaIntervento</param>
|
||||
/// <param name="printerName"></param>
|
||||
/// <param name="parametro"></param>
|
||||
/// <param name="printerName">nome completo stampante (rispetto al server)</param>
|
||||
/// <param name="parametro">numIntMtz (codice numero richiesta)</param>
|
||||
public void printReport(reportRichiesto tipoReport, string printerName, string parametro)
|
||||
{
|
||||
LocalReport report = new LocalReport();
|
||||
@@ -179,19 +179,13 @@ public class reportPrinter
|
||||
default:
|
||||
break;
|
||||
}
|
||||
// export in EMF
|
||||
Export(report, deviceInfo);
|
||||
m_currentPageIndex = 0;
|
||||
// stampo
|
||||
Print(printerName);
|
||||
// do dispose?
|
||||
Dispose();
|
||||
doEmfPrint(printerName, report, deviceInfo);
|
||||
}
|
||||
/// <summary>
|
||||
/// Crea un report locale da file rdlc, carica i dati, esporta report come EMF file e quindi lo invia alla stampante
|
||||
/// </summary>
|
||||
/// <param name="tipoReport">report ammessi: ElencoInterventi / MTBF_MTTR</param>
|
||||
/// <param name="printerName"></param>
|
||||
/// <param name="printerName">nome completo stampante (rispetto al server)</param>
|
||||
/// <param name="periodoAnalizzato">oggetto che contiene data inizio e data fine dell'analisi richiesta per il report</param>
|
||||
public void printReport(reportRichiesto tipoReport, string printerName, intervalloDate periodoAnalizzato)
|
||||
{
|
||||
@@ -231,6 +225,16 @@ public class reportPrinter
|
||||
default:
|
||||
break;
|
||||
}
|
||||
doEmfPrint(printerName, report, deviceInfo);
|
||||
}
|
||||
/// <summary>
|
||||
/// esegue print vero e proprio
|
||||
/// </summary>
|
||||
/// <param name="printerName"></param>
|
||||
/// <param name="report"></param>
|
||||
/// <param name="deviceInfo"></param>
|
||||
private void doEmfPrint(string printerName, LocalReport report, string deviceInfo)
|
||||
{
|
||||
// export in EMF
|
||||
Export(report, deviceInfo);
|
||||
m_currentPageIndex = 0;
|
||||
|
||||
@@ -3,20 +3,46 @@ using System.Collections.Generic;
|
||||
using System.Web;
|
||||
using System.Web.UI;
|
||||
using System.Web.UI.WebControls;
|
||||
using SteamWare;
|
||||
|
||||
public partial class ExportPdf : System.Web.UI.Page
|
||||
{
|
||||
protected void Page_Load(object sender, EventArgs e)
|
||||
{
|
||||
string reportName = "";
|
||||
// carico i parametri per chiamare export...
|
||||
string idx = Request.QueryString["idx"];
|
||||
intervalloDate periodo = new intervalloDate();
|
||||
periodo.inizio = Convert.ToDateTime(Request.QueryString["inizio"]);
|
||||
periodo.fine = Convert.ToDateTime(Request.QueryString["fine"]);
|
||||
reportRichiesto tipo = (reportRichiesto)Convert.ToInt32(Request.QueryString["tipo"]);
|
||||
// eseguo export
|
||||
reportExporter re = new reportExporter();
|
||||
re.popolaPdfStream(tipo, idx);
|
||||
// in base al tipo passo un metodo con idx o con parametro Intervallo analisi...
|
||||
switch (tipo)
|
||||
{
|
||||
case reportRichiesto.ElencoInterventi:
|
||||
reportName="elenco_interventi";
|
||||
re.popolaPdfStream(tipo, periodo);
|
||||
break;
|
||||
case reportRichiesto.ElencoMacchine:
|
||||
reportName="elenco_macchine";
|
||||
re.popolaPdfStream(tipo);
|
||||
break;
|
||||
case reportRichiesto.MTBF_MTTR:
|
||||
reportName = "MTBF_MTTR";
|
||||
re.popolaPdfStream(tipo, periodo);
|
||||
break;
|
||||
case reportRichiesto.RichiestaIntervento:
|
||||
reportName="richiesta";
|
||||
re.popolaPdfStream(tipo, idx);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
Response.Clear();
|
||||
Response.ContentType = re.mimeType;
|
||||
Response.AddHeader("content-disposition", "attachment; filename=WebGIM." + re.fileNameExtension);
|
||||
Response.AddHeader("content-disposition", string.Format("attachment; filename=WebGIM_{0}.{1}",reportName, re.fileNameExtension));
|
||||
Response.BinaryWrite(re.renderedBytes);
|
||||
Response.End();
|
||||
}
|
||||
|
||||
@@ -12,30 +12,27 @@
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
report interventi
|
||||
report interventi: spiegare cosa è (elenco degli interveti raggruppato x reparto e macchine + ore di fermo officina (dal guasto a fine intervento mtz), fermo manutenzione (da inizio a fine intervento) e ore erogate (ovvero somma del tempo di tutti i manutentori coinvolti)
|
||||
</td>
|
||||
<td>
|
||||
report MTBF MTTR
|
||||
report MTBF MTTR:<br />
|
||||
calcola il livello di affidabilità come MTBF= mean time before failure, ovvero divide le ore totali di apertura (al netto di ferie, feste, fermo macchina programmato) per il numero degli interventi effettuati <br />
|
||||
calcola inoltre i tempi medi di riparazione (MTTR, mean time to repair) visti dall'officina (guasto --> fine intervento) e dalla manutenzione ( inizio-> fine intervento)
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<asp:Button ID="btnInterventi_print" runat="server" Text="btnInterventi_print"
|
||||
Width="200px" onclick="btnInterventi_print_Click" />
|
||||
<asp:Button ID="btnInterventi_print" runat="server" Text="btnInterventi_print" Width="200px"
|
||||
OnClick="btnInterventi_print_Click" Visible="false" />
|
||||
<asp:HyperLink runat="server" ID="hlElencoInterventi_Pdf" ToolTip="exportPDF interventi (tradurre)"
|
||||
ImageUrl="~/images/page_pdf.png" />
|
||||
</td>
|
||||
<td>
|
||||
<asp:Button ID="btnMtbfMttr_print" runat="server" Text="btnMtbfMttr_print"
|
||||
Width="200px" onclick="btnMtbfMttr_print_Click" />
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<asp:Button ID="btnInterventi_pdf" runat="server" Text="btnInterventi_pdf"
|
||||
Width="200px" onclick="btnInterventi_pdf_Click" />
|
||||
</td>
|
||||
<td>
|
||||
<asp:Button ID="btnMtbfMttr_pdf" runat="server" Text="btnMtbfMttr_pdf"
|
||||
Width="200px" onclick="btnMtbfMttr_pdf_Click" />
|
||||
<asp:Button ID="btnMtbfMttr_print" runat="server" Text="btnMtbfMttr_print" Width="200px"
|
||||
OnClick="btnMtbfMttr_print_Click" Visible="false" />
|
||||
<asp:HyperLink runat="server" ID="hlMTBF_MTTR_Pdf" ToolTip="exportPDF MTBF MTTR (tradurre)"
|
||||
ImageUrl="~/images/page_pdf.png" />
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
@@ -9,26 +9,30 @@ public partial class report_analisi : System.Web.UI.Page
|
||||
{
|
||||
protected void Page_Load(object sender, EventArgs e)
|
||||
{
|
||||
// traduzioni
|
||||
traduciObj();
|
||||
// popolo valori default
|
||||
setDefaultValues();
|
||||
}
|
||||
private void traduciObj()
|
||||
{
|
||||
//
|
||||
}
|
||||
private void setDefaultValues()
|
||||
{
|
||||
hlElencoInterventi_Pdf.NavigateUrl = formattaUrl( reportRichiesto.ElencoInterventi, mod_periodoAnalisi1.intervalloAnalisi);
|
||||
hlMTBF_MTTR_Pdf.NavigateUrl = formattaUrl(reportRichiesto.MTBF_MTTR, mod_periodoAnalisi1.intervalloAnalisi);
|
||||
}
|
||||
private string formattaUrl(reportRichiesto tipo, intervalloDate periodo)
|
||||
{
|
||||
return String.Format("~/ExportPdf.aspx?tipo={0}&inizio={1}&fine={2}", Convert.ToInt32(tipo), periodo.inizio, periodo.fine);
|
||||
}
|
||||
protected void btnInterventi_print_Click(object sender, EventArgs e)
|
||||
{
|
||||
reportPrinter.obj.printReport(reportRichiesto.ElencoInterventi, memLayer.ML.confReadstring("stampanteRichiesteMtz"), mod_periodoAnalisi1.intervalloAnalisi);
|
||||
}
|
||||
protected void btnInterventi_pdf_Click(object sender, EventArgs e)
|
||||
{
|
||||
#if false
|
||||
reportPrinter.obj.printReport(reportRichiesto.ElencoInterventi, memLayer.ML.confReadstring("stampanteRichiesteMtz"), mod_periodoAnalisi1.intervalloAnalisi);
|
||||
#endif
|
||||
|
||||
}
|
||||
protected void btnMtbfMttr_print_Click(object sender, EventArgs e)
|
||||
{
|
||||
reportPrinter.obj.printReport(reportRichiesto.MTBF_MTTR, memLayer.ML.confReadstring("stampanteRichiesteMtz"), mod_periodoAnalisi1.intervalloAnalisi);
|
||||
}
|
||||
protected void btnMtbfMttr_pdf_Click(object sender, EventArgs e)
|
||||
{
|
||||
#if false
|
||||
reportPrinter.obj.printReport(reportRichiesto.MTBF_MTTR, memLayer.ML.confReadstring("stampanteRichiesteMtz"), mod_periodoAnalisi1.intervalloAnalisi);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,10 +6,15 @@
|
||||
<table cellpadding="4px">
|
||||
<tr>
|
||||
<td>
|
||||
<asp:Button ID="btnPdf" runat="server" Text="PDF (tradurre)" Width="200px" OnClick="btnPdf_Click" />
|
||||
tradurre con label: elenco dei reparti e delle macchine che li compongono, click
|
||||
x export in pdf
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<asp:Button ID="btnPrint" runat="server" Text="Stampa (tradurre)" Width="200px" OnClick="btnPrint_Click" />
|
||||
<asp:HyperLink runat="server" ID="hlExportPdf" ToolTip="exportPDF (tradurre)" ImageUrl="~/images/page_pdf.png" />
|
||||
<asp:Button ID="btnPrint" runat="server" Text="Stampa (tradurre)" Width="200px" OnClick="btnPrint_Click"
|
||||
Visible="false" />
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
@@ -9,15 +9,25 @@ public partial class report_impianti : System.Web.UI.Page
|
||||
{
|
||||
protected void Page_Load(object sender, EventArgs e)
|
||||
{
|
||||
|
||||
// traduzioni
|
||||
traduciObj();
|
||||
// popolo valori default
|
||||
setDefaultValues();
|
||||
}
|
||||
protected void btnPdf_Click(object sender, EventArgs e)
|
||||
private void traduciObj()
|
||||
{
|
||||
#if false
|
||||
// !!!FARE!!!
|
||||
reportPrinter.obj.printReport(reportRichiesto.ElencoMacchine, memLayer.ML.confReadstring("stampanteRichiesteMtz"), "");
|
||||
#endif
|
||||
//
|
||||
}
|
||||
private void setDefaultValues()
|
||||
{
|
||||
hlExportPdf.NavigateUrl = formattaUrl();
|
||||
}
|
||||
|
||||
private string formattaUrl()
|
||||
{
|
||||
return String.Format("~/ExportPdf.aspx?tipo={0}", Convert.ToInt32(reportRichiesto.ElencoMacchine));
|
||||
}
|
||||
|
||||
protected void btnPrint_Click(object sender, EventArgs e)
|
||||
{
|
||||
reportPrinter.obj.printReport(reportRichiesto.ElencoMacchine, memLayer.ML.confReadstring("stampanteRichiesteMtz"), "");
|
||||
|
||||
Reference in New Issue
Block a user