inserita stampa PDF!!!!

git-svn-id: https://keyhammer.ath.cx/svn/GMW/trunk@420 365432ac-a1b5-4ffd-bb28-6d3099d32164
This commit is contained in:
samuele
2012-02-15 18:21:04 +00:00
parent d3ad40a2df
commit ff23252983
16 changed files with 91 additions and 36 deletions
+1
View File
@@ -1094,6 +1094,7 @@
</ItemGroup>
<ItemGroup>
<Folder Include="logs\" />
<Folder Include="PDF\" />
<Folder Include="temp\" />
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
+2 -1
View File
@@ -60,7 +60,7 @@
<add key="appName" value="GMW" />
<add key="SiteName" value="San Possidonio" />
<add key="mainRev" value="1.1" />
<add key="minRev" value="410" />
<add key="minRev" value="411" />
<add key="copyRight" value="SteamWare © 2010-2011" />
<add key="_allowForceUser" value="true" />
<add key="_safePages" value="jumper.aspx#unauthorized.aspx#allegati.aspx#forceUser.aspx#login.aspx#test.aspx#istruzioni.aspx#Test.aspx" />
@@ -111,6 +111,7 @@
<add key="reportOpzPdf" value="&amp;rs:Format=PDF" />
<!--Setup x stampa dei PDF come copia-->
<add key="doPdfCopy" value="true" />
<add key="PdfFolder" value="PDF" />
<!--Configurazioni ad hoc Ambivere-->
Binary file not shown.
Binary file not shown.
+2 -1
View File
@@ -7,7 +7,7 @@
<add key="appName" value="GMW" />
<add key="SiteName" value="San Possidonio" />
<add key="mainRev" value="1.1" />
<add key="minRev" value="410" />
<add key="minRev" value="411" />
<add key="copyRight" value="SteamWare © 2010-2011" />
<add key="_allowForceUser" value="true" />
<add key="_safePages" value="jumper.aspx#unauthorized.aspx#allegati.aspx#forceUser.aspx#login.aspx#test.aspx#istruzioni.aspx#Test.aspx" />
@@ -58,6 +58,7 @@
<add key="reportOpzPdf" value="&amp;rs:Format=PDF" />
<!--Setup x stampa dei PDF come copia-->
<add key="doPdfCopy" value="true" />
<add key="PdfFolder" value="PDF" />
<!--Configurazioni ad hoc Ambivere-->
+2 -1
View File
@@ -7,7 +7,7 @@
<add key="appName" value="GMW" />
<add key="SiteName" value="San Possidonio" />
<add key="mainRev" value="1.1" />
<add key="minRev" value="410" />
<add key="minRev" value="411" />
<add key="copyRight" value="SteamWare © 2010-2011" />
<add key="_allowForceUser" value="true" />
<add key="_safePages" value="jumper.aspx#unauthorized.aspx#allegati.aspx#forceUser.aspx#login.aspx#test.aspx#istruzioni.aspx#Test.aspx" />
@@ -58,6 +58,7 @@
<add key="reportOpzPdf" value="&amp;rs:Format=PDF" />
<!--Setup x stampa dei PDF come copia-->
<add key="doPdfCopy" value="true" />
<add key="PdfFolder" value="PDF" />
<!--Configurazioni ad hoc Ambivere-->
+2 -1
View File
@@ -7,7 +7,7 @@
<add key="appName" value="GMW" />
<add key="SiteName" value="San Possidonio" />
<add key="mainRev" value="1.1" />
<add key="minRev" value="410" />
<add key="minRev" value="411" />
<add key="copyRight" value="SteamWare © 2010-2011" />
<add key="_allowForceUser" value="true" />
<add key="_safePages" value="jumper.aspx#unauthorized.aspx#allegati.aspx#forceUser.aspx#login.aspx#test.aspx#istruzioni.aspx#Test.aspx" />
@@ -58,6 +58,7 @@
<add key="reportOpzPdf" value="&amp;rs:Format=PDF" />
<!--Setup x stampa dei PDF come copia-->
<add key="doPdfCopy" value="true" />
<add key="PdfFolder" value="PDF" />
<!--Configurazioni ad hoc Ambivere-->
+1 -1
View File
@@ -7,7 +7,7 @@
<add key="appName" value="GMW" />
<add key="SiteName" value="Tekal" />
<add key="mainRev" value="1.1" />
<add key="minRev" value="410" />
<add key="minRev" value="411" />
<add key="copyRight" value="SteamWare © 2010-2011" />
<add key="_allowForceUser" value="true" />
<add key="_safePages" value="jumper.aspx#unauthorized.aspx#allegati.aspx#forceUser.aspx#login.aspx#test.aspx#istruzioni.aspx#Test.aspx" />
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
+66 -21
View File
@@ -21,6 +21,7 @@ public class reportPrinter
private int m_currentPageIndex;
protected int logLevel = 0;
protected bool doPdfCopy = false;
private IList<Stream> m_streams;
/// <summary>
/// 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;
}
/// <summary>
/// ciclo da fornire al renderizzatore dei report, per salvare 1 pdf da ogni pagina del report
/// </summary>
/// <param name="name"></param>
/// <param name="fileNameExtension"></param>
/// <param name="encoding"></param>
/// <param name="mimeType"></param>
/// <param name="willSeek"></param>
/// <returns></returns>
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;
}
/// <summary>
/// Handler per PrintPageEvents
/// </summary>
/// <param name="sender"></param>
@@ -80,6 +101,17 @@ public class reportPrinter
foreach (Stream stream in m_streams) stream.Position = 0;
}
/// <summary>
/// Export del report come PDF file.
/// </summary>
/// <param name="report"></param>
private void ExportPDF(LocalReport report, string deviceInfo)
{
Warning[] warnings;
m_streams = new List<Stream>();
report.Render("PDF", deviceInfo, CreateStreamPdf, out warnings);
foreach (Stream stream in m_streams) stream.Position = 0;
}
/// <summary>
/// dispone l'applicazione e rilascia le risorse
/// </summary>
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);
}
}
/// <summary>
/// esegue print vero e proprio
@@ -217,19 +247,19 @@ public class reportPrinter
/// <param name="deviceInfo"></param>
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();
}
/// <summary>
/// <summary>
/// effettua la stampa del cartellino indicato
/// </summary>
/// <param name="cartellino"></param>
/// <param name="UDC"></param>
/// <param name="printerName">indirizzo di rete completo stampante del tipo \\nomePc\nomeStampante, oppure "" x default</param>
/// <returns></returns>
/// </summary>
/// <param name="cartellino"></param>
/// <param name="UDC"></param>
/// <param name="printerName">indirizzo di rete completo stampante del tipo \\nomePc\nomeStampante, oppure "" x default</param>
/// <returns></returns>
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;
}
/// <summary>
/// effettua la vera e propria fase di stampa
/// </summary>
/// <param name="UDC"></param>
/// <param name="printerName"></param>
/// <param name="answ"></param>
/// <param name="report"></param>
/// <param name="deviceInfo"></param>
/// <returns></returns>
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");
}
/// <summary>
/// singleton pubblico
+5
View File
@@ -60,6 +60,11 @@
<ExcludeFromBuild Include="$(SourceWebPhysicalPath)\logs\*.txt" />
<ExcludeFromBuild Include="$(SourceWebPhysicalPath)\logs\*.zip" />
<ExcludeFromBuild Include="$(SourceWebPhysicalPath)\**\*.pdb" />
<ExcludeFromBuild Include="$(SourceWebPhysicalPath)\PDF" />
<ExcludeFromBuild Include="$(SourceWebPhysicalPath)\PDF\*" />
<ExcludeFromBuild Include="$(SourceWebPhysicalPath)\PDF\**\**" />
<ExcludeFromBuild Include="$(SourceWebPhysicalPath)\PDF\**\**\*" />
<ExcludeFromBuild Include="$(SourceWebPhysicalPath)\PDF\**\**\**\*.pdf" />
</ItemGroup>
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.WebDeployment.targets.
+5 -5
View File
@@ -306,14 +306,14 @@
{
"Name" = "8:Microsoft Visual Studio"
"ProductName" = "8:GMW"
"ProductCode" = "8:{B537E24F-56D5-4A21-8999-4B5B57BCB0C4}"
"PackageCode" = "8:{D3A0C677-066F-46C1-8318-7594372E8AA8}"
"ProductCode" = "8:{6D1D2F47-2E03-4F1B-8675-CAADCAB62A62}"
"PackageCode" = "8:{D3ACC55F-8037-4FD3-B878-4B22E5E3B688}"
"UpgradeCode" = "8:{C9BC0732-DC92-4336-BAC9-A05A5D2A97C0}"
"RestartWWWService" = "11:TRUE"
"RemovePreviousVersions" = "11:TRUE"
"DetectNewerInstalledVersion" = "11:TRUE"
"InstallAllUsers" = "11:FALSE"
"ProductVersion" = "8:1.1.410"
"ProductVersion" = "8:1.1.411"
"Manufacturer" = "8:SteamWare s.r.l."
"ARPHELPTELEPHONE" = "8:+39-035460560"
"ARPHELPLINK" = "8:http://www.steamware.net"
@@ -786,7 +786,7 @@
}
"{5259A561-127C-4D43-A0A1-72F10C7B3BF8}:_4FD0E5B75A7F47B79080EC0983BE6583"
{
"SourcePath" = "8:..\\..\\SetDirectoryPermission\\obj\\Debug\\SetDirectoryPermission.exe"
"SourcePath" = "8:..\\..\\SetDirectoryPermission\\obj\\Release\\SetDirectoryPermission.exe"
"TargetName" = "8:"
"Tag" = "8:"
"Folder" = "8:_5606017201AE45B480A8ABD8B8D68264"
@@ -814,7 +814,7 @@
}
"{5259A561-127C-4D43-A0A1-72F10C7B3BF8}:_8BDD7AA9D46A46EC80880F83F13C902E"
{
"SourcePath" = "8:..\\..\\IISCustomActionVB\\IISConsoleVB\\obj\\Debug\\IISConsoleVB.exe"
"SourcePath" = "8:..\\..\\IISCustomActionVB\\IISConsoleVB\\obj\\Release\\IISConsoleVB.exe"
"TargetName" = "8:"
"Tag" = "8:"
"Folder" = "8:_5606017201AE45B480A8ABD8B8D68264"
@@ -301,14 +301,14 @@
{
"Name" = "8:Microsoft Visual Studio"
"ProductName" = "8:GMW_test"
"ProductCode" = "8:{3476D0A5-F5D3-463D-96C8-BCADDDCF92CC}"
"PackageCode" = "8:{64514EDD-B79A-4506-B043-B52064A10E34}"
"ProductCode" = "8:{65F8B6A9-7FA8-4601-8C9B-5A24A2581F2F}"
"PackageCode" = "8:{0FB46C29-9415-4AF0-9626-5A0F3338E0AF}"
"UpgradeCode" = "8:{6FD64E39-D93B-4ADA-ADF3-303A1BCA49C2}"
"RestartWWWService" = "11:TRUE"
"RemovePreviousVersions" = "11:TRUE"
"DetectNewerInstalledVersion" = "11:TRUE"
"InstallAllUsers" = "11:FALSE"
"ProductVersion" = "8:1.1.410"
"ProductVersion" = "8:1.1.411"
"Manufacturer" = "8:SteamWare s.r.l."
"ARPHELPTELEPHONE" = "8:+39-035460560"
"ARPHELPLINK" = "8:http://www.steamware.net"
@@ -753,7 +753,7 @@
{
"{5259A561-127C-4D43-A0A1-72F10C7B3BF8}:_110D6612090D4EDA92F772F593B23D78"
{
"SourcePath" = "8:..\\..\\IISCustomActionVB\\IISConsoleVB\\obj\\Debug\\IISConsoleVB.exe"
"SourcePath" = "8:..\\..\\IISCustomActionVB\\IISConsoleVB\\obj\\Release\\IISConsoleVB.exe"
"TargetName" = "8:"
"Tag" = "8:"
"Folder" = "8:_D4983B53F0234BFF98835BF3AFECBB8D"
@@ -781,7 +781,7 @@
}
"{5259A561-127C-4D43-A0A1-72F10C7B3BF8}:_179F2C709A0749C4A5EBA956FADE7EE3"
{
"SourcePath" = "8:..\\..\\SetDirectoryPermission\\obj\\Debug\\SetDirectoryPermission.exe"
"SourcePath" = "8:..\\..\\SetDirectoryPermission\\obj\\Release\\SetDirectoryPermission.exe"
"TargetName" = "8:"
"Tag" = "8:"
"Folder" = "8:_D4983B53F0234BFF98835BF3AFECBB8D"