BeforePrint event in ReportTool: Difference between revisions
Content added Content deleted
mNo edit summary |
mNo edit summary |
||
(4 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
==Introduction== |
==Introduction== |
||
BCE.AutoCount.Report.'''ReportTool''' is commonly use for DesignReport, PreviewReport and PrintReport when developing a custom report type event in Plug-In. |
BCE.AutoCount.Report.'''ReportTool''' is commonly use for DesignReport, PreviewReport and PrintReport when developing a custom report type event in Plug-In. |
||
There are times, when programmer needs to control how the report is send to the printer. |
There are times, when programmer needs to control how the report is send to the printer.<br /> |
||
With ReportTool, you may access to the printing property |
With ReportTool, you may access to the printing property before printing to the printer. |
||
==Register Script== |
==Register Script== |
||
Line 9: | Line 9: | ||
</syntaxhighlight> |
</syntaxhighlight> |
||
==Script Events== |
==Application Script Events== |
||
<syntaxhighlight lang="csharp"> |
<syntaxhighlight lang="csharp"> |
||
/// <summary> |
/// <summary> |
||
Line 34: | Line 34: | ||
</syntaxhighlight> |
</syntaxhighlight> |
||
== |
==Examples== |
||
===Print 2 copies of a |
===Print 2 copies of a specific report type=== |
||
<syntaxhighlight lang="csharp"> |
<syntaxhighlight lang="csharp"> |
||
public void BeforePrint(BCE.AutoCount.Report.ReportTool.BeforePrintEventArgs e) |
public void BeforePrint(BCE.AutoCount.Report.ReportTool.BeforePrintEventArgs e) |
||
Line 62: | Line 62: | ||
BCE.AutoCount.Authentication.AccessRight rights = BCE.AutoCount.Authentication.AccessRight.Create(e.DBSetting, |
BCE.AutoCount.Authentication.AccessRight rights = BCE.AutoCount.Authentication.AccessRight.Create(e.DBSetting, |
||
BCE.AutoCount.Authentication.UserAuthentication.GetOrCreate(e.DBSetting).LoginUserID); |
BCE.AutoCount.Authentication.UserAuthentication.GetOrCreate(e.DBSetting).LoginUserID); |
||
⚫ | |||
if (e.ReportType == "Invoice Document") |
|||
{ |
|||
⚫ | |||
} |
|||
} |
} |
||
</syntaxhighlight> |
</syntaxhighlight> |
Latest revision as of 10:22, 2 February 2018
Introduction
BCE.AutoCount.Report.ReportTool is commonly use for DesignReport, PreviewReport and PrintReport when developing a custom report type event in Plug-In. There are times, when programmer needs to control how the report is send to the printer.
With ReportTool, you may access to the printing property before printing to the printer.
Register Script
BCE.AutoCount.Scripting.ScriptManager.GetOrCreate(dbSetting).RegisterByType("ReportTool", typeof(ReportToolScript));
Application Script Events
/// <summary>
/// Implements script for Application.
/// </summary>
public class ReportToolScript
{
/// <summary>
/// Occurs before a report is printed
/// </summary>
/// <param name="e">The event argument</param>
public void BeforePrint(BCE.AutoCount.Report.ReportTool.BeforePrintEventArgs e)
{
}
/// <summary>
/// Occurs after a report is printed
/// </summary>
/// <param name="e">The event argument</param>
public void AfterPrint(BCE.AutoCount.Report.ReportTool.AfterPrintEventArgs e)
{
}
}
Examples
Print 2 copies of a specific report type
public void BeforePrint(BCE.AutoCount.Report.ReportTool.BeforePrintEventArgs e)
{
if (e.ReportType == "Your Report Type")
{
e.PrinterSettings.Copies = 2;
}
}
Specify a Printer when printing the report that is named as "My Receipt Voucher (format 1)"
public void BeforePrint(BCE.AutoCount.Report.ReportTool.BeforePrintEventArgs e)
{
if (e.ReportName == "My Receipt Voucher (format 1)")
{
e.PrinterSettings.PrinterName = "Panasonic KX-1121";
}
}
Control if user can print Invoice Document with a custom added access rights control
public void BeforePrint(BCE.AutoCount.Report.ReportTool.BeforePrintEventArgs e)
{
BCE.AutoCount.Authentication.AccessRight rights = BCE.AutoCount.Authentication.AccessRight.Create(e.DBSetting,
BCE.AutoCount.Authentication.UserAuthentication.GetOrCreate(e.DBSetting).LoginUserID);
if (e.ReportType == "Invoice Document")
{
e.AllowPrint = rights.IsAccessible("MYPLUGIN_OWN_PRINTINVOICECONTROL");
}
}
Go to top
|
Resources For AutoCount Software Developers
|