diff --git a/GMW/GMW/GMW.csproj b/GMW/GMW/GMW.csproj index 04439bbd..2d84c17e 100644 --- a/GMW/GMW/GMW.csproj +++ b/GMW/GMW/GMW.csproj @@ -1094,6 +1094,7 @@ + diff --git a/GMW/GMW/Web.config b/GMW/GMW/Web.config index 10e56bc7..a1f759bc 100644 --- a/GMW/GMW/Web.config +++ b/GMW/GMW/Web.config @@ -60,7 +60,7 @@ - + @@ -111,6 +111,7 @@ + diff --git a/GMW/GMW/bin/GMW.dll b/GMW/GMW/bin/GMW.dll index 05e3babb..924e12b6 100644 Binary files a/GMW/GMW/bin/GMW.dll and b/GMW/GMW/bin/GMW.dll differ diff --git a/GMW/GMW/bin/GMW_data.dll b/GMW/GMW/bin/GMW_data.dll index 3d7a0188..bc578146 100644 Binary files a/GMW/GMW/bin/GMW_data.dll and b/GMW/GMW/bin/GMW_data.dll differ diff --git a/GMW/GMW/mazzAppSettings.config b/GMW/GMW/mazzAppSettings.config index 26798593..6584d0ac 100644 --- a/GMW/GMW/mazzAppSettings.config +++ b/GMW/GMW/mazzAppSettings.config @@ -7,7 +7,7 @@ - + @@ -58,6 +58,7 @@ + diff --git a/GMW/GMW/mazzAppSettingsSP.config b/GMW/GMW/mazzAppSettingsSP.config index 303a0a00..2a9c3a82 100644 --- a/GMW/GMW/mazzAppSettingsSP.config +++ b/GMW/GMW/mazzAppSettingsSP.config @@ -7,7 +7,7 @@ - + @@ -58,6 +58,7 @@ + diff --git a/GMW/GMW/mazzAppSettingsSP_test.config b/GMW/GMW/mazzAppSettingsSP_test.config index 96844383..529d26d5 100644 --- a/GMW/GMW/mazzAppSettingsSP_test.config +++ b/GMW/GMW/mazzAppSettingsSP_test.config @@ -7,7 +7,7 @@ - + @@ -58,6 +58,7 @@ + diff --git a/GMW/GMW/mazzAppSettingsTK.config b/GMW/GMW/mazzAppSettingsTK.config index 2aa45f9e..a08273e3 100644 --- a/GMW/GMW/mazzAppSettingsTK.config +++ b/GMW/GMW/mazzAppSettingsTK.config @@ -7,7 +7,7 @@ - + diff --git a/GMW/GMW/obj/Debug/GMW.dll b/GMW/GMW/obj/Debug/GMW.dll index b0d8c016..924e12b6 100644 Binary files a/GMW/GMW/obj/Debug/GMW.dll and b/GMW/GMW/obj/Debug/GMW.dll differ diff --git a/GMW/GMW/obj/Debug/ResolveAssemblyReference.cache b/GMW/GMW/obj/Debug/ResolveAssemblyReference.cache index a989dfff..5dce71e8 100644 Binary files a/GMW/GMW/obj/Debug/ResolveAssemblyReference.cache and b/GMW/GMW/obj/Debug/ResolveAssemblyReference.cache differ diff --git a/GMW/GMW_data/bin/Debug/GMW_data.dll b/GMW/GMW_data/bin/Debug/GMW_data.dll index a820701f..bc578146 100644 Binary files a/GMW/GMW_data/bin/Debug/GMW_data.dll and b/GMW/GMW_data/bin/Debug/GMW_data.dll differ diff --git a/GMW/GMW_data/obj/Debug/GMW_data.dll b/GMW/GMW_data/obj/Debug/GMW_data.dll index a820701f..bc578146 100644 Binary files a/GMW/GMW_data/obj/Debug/GMW_data.dll and b/GMW/GMW_data/obj/Debug/GMW_data.dll differ diff --git a/GMW/GMW_data/reportPrinter.cs b/GMW/GMW_data/reportPrinter.cs index 9aeb7ea2..062872a2 100644 --- a/GMW/GMW_data/reportPrinter.cs +++ b/GMW/GMW_data/reportPrinter.cs @@ -21,6 +21,7 @@ public class reportPrinter private int m_currentPageIndex; protected int logLevel = 0; + protected bool doPdfCopy = false; private IList m_streams; /// /// ciclo da fornire al renderizzatore dei report, per salvare 1 immagine da ogni pagina del report @@ -38,6 +39,26 @@ public class reportPrinter return stream; } /// + /// ciclo da fornire al renderizzatore dei report, per salvare 1 pdf da ogni pagina del report + /// + /// + /// + /// + /// + /// + /// + private Stream CreateStreamPdf(string name, string fileNameExtension, Encoding encoding, string mimeType, bool willSeek) + { + // creo Directory se non c'è + SteamWare.fileMover fm = new fileMover(string.Format(@"{0}\{1:yyyy}\{1:MM}\{1:dd}\", memLayer.ML.confReadString("PdfFolder"), DateTime.Now),""); + fm.checkDir(); + string pdfPathName = string.Format(@"{0}\{1:yyyy}\{1:MM}\{1:dd}\{2}_{1:HHmmss}_{1:ffff}.{3}", memLayer.ML.confReadString("PdfFolder"), DateTime.Now, name, fileNameExtension); + //Stream stream = new FileStream(SteamWare.SteamwareStrings.getFilePath(@"~\temp\" + name + "." + fileNameExtension), FileMode.Create); + Stream stream = new FileStream(SteamWare.SteamwareStrings.getFilePath(pdfPathName), FileMode.Create); + m_streams.Add(stream); + return stream; + } + /// /// Handler per PrintPageEvents /// /// @@ -80,6 +101,17 @@ public class reportPrinter foreach (Stream stream in m_streams) stream.Position = 0; } /// + /// Export del report come PDF file. + /// + /// + private void ExportPDF(LocalReport report, string deviceInfo) + { + Warning[] warnings; + m_streams = new List(); + report.Render("PDF", deviceInfo, CreateStreamPdf, out warnings); + foreach (Stream stream in m_streams) stream.Position = 0; + } + /// /// dispone l'applicazione e rilascia le risorse /// public void Dispose() @@ -152,47 +184,45 @@ public class reportPrinter case reportRichiesto.CartellinoFin: report.ReportPath = @".\Reports\CartellinoFinito.rdlc"; report.DataSources.Add(new ReportDataSource(memLayer.ML.confReadString("ReportDatasource"), caricaDati(tipoReport, UDC))); - deviceInfo = deviceInfoParam.xmlParam; break; case reportRichiesto.CartellinoFusi: report.ReportPath = @".\Reports\CartellinoFus.rdlc"; report.DataSources.Add(new ReportDataSource(memLayer.ML.confReadString("ReportDatasource"), caricaDati(tipoReport, UDC))); - deviceInfo = deviceInfoParam.xmlParam; break; case reportRichiesto.CartellinoMP: report.ReportPath = @".\Reports\CartellinoMP.rdlc"; report.DataSources.Add(new ReportDataSource(memLayer.ML.confReadString("ReportDatasource"), caricaDati(tipoReport, UDC))); - deviceInfo = deviceInfoParam.xmlParam; break; case reportRichiesto.CartellinoLiquidiF10: report.ReportPath = @".\Reports\CartellinoLiquidiF10.rdlc"; report.DataSources.Add(new ReportDataSource(memLayer.ML.confReadString("ReportDatasourceLiquidiF10"), caricaDati(tipoReport, UDC))); - deviceInfo = deviceInfoParam.xmlParam; break; case reportRichiesto.CartellinoLiquidiF18: report.ReportPath = @".\Reports\CartellinoLiquidiF18.rdlc"; report.DataSources.Add(new ReportDataSource(memLayer.ML.confReadString("ReportDatasourceLiquidiF18"), caricaDati(tipoReport, UDC))); - deviceInfo = deviceInfoParam.xmlParam; break; case reportRichiesto.CartellinoOdette: report.ReportPath = @".\Reports\CartellinoOdette.rdlc"; report.DataSources.Add(new ReportDataSource(memLayer.ML.confReadString("ReportDatasourceOdette"), caricaDati(tipoReport, UDC))); - deviceInfo = deviceInfoParam.xmlParam; break; case reportRichiesto.CartellinoTara: report.ReportPath = @".\Reports\CartellinoTara.rdlc"; report.DataSources.Add(new ReportDataSource(memLayer.ML.confReadString("ReportDatasource"), caricaDati(tipoReport, UDC))); - deviceInfo = deviceInfoParam.xmlParam; break; case reportRichiesto.CartellinoWIP: report.ReportPath = @".\Reports\CartellinoWip.rdlc"; report.DataSources.Add(new ReportDataSource(memLayer.ML.confReadString("ReportDatasource"), caricaDati(tipoReport, UDC))); - deviceInfo = deviceInfoParam.xmlParam; break; } + deviceInfo = deviceInfoParam.xmlParam; doEmfPrint(printerName, report, deviceInfo); - // stampiamo ANCHE su pdf su una folder locale - doLocalPdfPrint(report, deviceInfo); + // controllo se devo fare copia PDF... stampiamo ANCHE su pdf su una folder locale + if (doPdfCopy) + { + deviceInfoParam.OutputFormat = "PDF"; + deviceInfo = deviceInfoParam.xmlParam; + doLocalPdfPrint(report, deviceInfo); + } } /// /// esegue print vero e proprio @@ -217,19 +247,19 @@ public class reportPrinter /// private void doLocalPdfPrint(LocalReport report, string deviceInfo) { - // calcolo la folder REALE con base + anno/mese/giorno - string pdfPath = ""; - - + // export in PDF + ExportPDF(report, deviceInfo); + m_currentPageIndex = 0; + // do dispose? + Dispose(); } - - /// + /// /// effettua la stampa del cartellino indicato - /// - /// - /// - /// indirizzo di rete completo stampante del tipo \\nomePc\nomeStampante, oppure "" x default - /// + /// + /// + /// + /// indirizzo di rete completo stampante del tipo \\nomePc\nomeStampante, oppure "" x default + /// public bool stampaCartellino(tipoCartellino cartellino, string UDC, string printerName) { bool answ = false; @@ -287,6 +317,20 @@ public class reportPrinter margin = memLayer.ML.confReadString(string.Format("Margin{0}", tipo)); // compongo parametri stampa devInfoParam deviceInfo = new devInfoParam(outForm, pagHeigth, pagWidth, margin, margin, margin, margin); + answ = printAndLog(UDC, printerName, answ, report, deviceInfo); + return answ; + } + /// + /// effettua la vera e propria fase di stampa + /// + /// + /// + /// + /// + /// + /// + private bool printAndLog(string UDC, string printerName, bool answ, reportRichiesto report, devInfoParam deviceInfo) + { try { if (logLevel > 5) logger.lg.scriviLog(String.Format("Sto per inviare un report alla stampante {0}", printerName), tipoLog.INFO); @@ -308,6 +352,7 @@ public class reportPrinter protected reportPrinter() { logLevel = memLayer.ML.confReadInt("_logLevel"); + doPdfCopy = memLayer.ML.confReadBool("doPdfCopy"); } /// /// singleton pubblico diff --git a/GMW/GMW_deploy/GMW_deploy.wdproj b/GMW/GMW_deploy/GMW_deploy.wdproj index b37e5aaa..ebb0742d 100644 --- a/GMW/GMW_deploy/GMW_deploy.wdproj +++ b/GMW/GMW_deploy/GMW_deploy.wdproj @@ -60,6 +60,11 @@ + + + + +