This commit is contained in:
146
source/WBI/ReportView.aspx.cs
Normal file
146
source/WBI/ReportView.aspx.cs
Normal file
@@ -0,0 +1,146 @@
|
||||
using System;
|
||||
using System.Data;
|
||||
using System.Configuration;
|
||||
using System.Collections;
|
||||
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 GZTW.AyaNova.BLL;
|
||||
using DevExpress.XtraReports;
|
||||
using DevExpress.XtraReports.UI;
|
||||
|
||||
public partial class ReportView : BaseThemePage
|
||||
{
|
||||
protected void Page_Load(object sender, EventArgs e)
|
||||
{
|
||||
//Get the report id
|
||||
Report r = Report.GetItem(new Guid(Request.QueryString["rpt"]));
|
||||
this.Title = r.Name;
|
||||
|
||||
//get the datasource
|
||||
object DataSource = Cache[Request.QueryString["src"]];
|
||||
|
||||
ReportDataSet source = null;
|
||||
if (DataSource is ReportDataSet)
|
||||
source = (ReportDataSet)DataSource;
|
||||
else
|
||||
{
|
||||
ReportDataSetAdapter rdsa = new ReportDataSetAdapter();
|
||||
source = new ReportDataSet();
|
||||
rdsa.Fill(source, DataSource);
|
||||
}
|
||||
|
||||
//Add localized text and display name to reportdataset
|
||||
source.LocaleTextTable = Util.LocaleTextTable;
|
||||
source.DisplayName = "WorkorderServiceDetailed";
|
||||
|
||||
//instantiate an xreport object
|
||||
//set it's datasource
|
||||
DevExpress.XtraReports.UI.XtraReport x = new XtraReport();
|
||||
|
||||
//Case 232
|
||||
//x.LoadState(r.GetReportContent());
|
||||
x.LoadLayout(r.GetReportContent());
|
||||
|
||||
|
||||
//LocalizeReport(x);
|
||||
|
||||
//case 1468
|
||||
x.ScriptReferences = AyaBizUtils.GetBizObjectLibraryDllPaths();;
|
||||
|
||||
|
||||
//Case 232 change block:
|
||||
//x.DataSource=source;
|
||||
if (source.Tables.Count == 1)
|
||||
{
|
||||
//It's a summary report so just bind to the report as normal
|
||||
x.DataSource = source;
|
||||
}
|
||||
else
|
||||
{
|
||||
//It's a detailed report made of subreports so remove the datasource
|
||||
//from the main report and set it on the detailereport band
|
||||
x.DataSource = null;
|
||||
DetailReportBand detailReport = x.Bands[BandKind.DetailReport] as DetailReportBand;
|
||||
if (detailReport != null)
|
||||
{
|
||||
detailReport.DataSource = source;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
if (AyaBizUtils.Trial)
|
||||
{
|
||||
WatermarkReport(x, true);
|
||||
}
|
||||
|
||||
//pass it to the viewer component
|
||||
this.ReportViewer1.Report = x;
|
||||
|
||||
|
||||
//case 1346
|
||||
//show and process signature if it's signable
|
||||
if (Request.QueryString["sigwo"] != null)
|
||||
{
|
||||
if (Page.IsPostBack)
|
||||
{
|
||||
//process possible signature
|
||||
object o = Page.Request["sigpad-data"];
|
||||
if (o != null && !string.IsNullOrWhiteSpace(o.ToString()))
|
||||
{
|
||||
AySignature sig = new AySignature(o.ToString());
|
||||
if (sig.HasSignature)
|
||||
{
|
||||
//store in workorder
|
||||
o.ToString();
|
||||
Workorder w=Workorder.GetItem(new Guid(Request.QueryString["sigwo"]));
|
||||
w.WorkorderService.SetSignature=o.ToString();
|
||||
w.Save();
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
//Show signature area
|
||||
sigdiv.Visible = true;
|
||||
lblSignTitleTop.Visible = true;
|
||||
lblSignTitle.Text = lblSignTitleTop.Text = Util.GlobalSettings.SignatureTitle;
|
||||
lblSignHeader.Text = Util.GlobalSettings.SignatureHeader;
|
||||
lblSignFooter.Text = Util.GlobalSettings.SignatureFooter;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
sigdiv.Visible = false;
|
||||
lblSignTitleTop.Visible = false;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
static internal void WatermarkReport(XtraReport rpt, bool Insert)
|
||||
{
|
||||
if (Insert)
|
||||
{
|
||||
rpt.Watermark.Text = "TRIAL SAMPLE";
|
||||
rpt.Watermark.Font = new System.Drawing.Font("Tahoma", 72, System.Drawing.FontStyle.Bold);
|
||||
//Case 232
|
||||
rpt.Watermark.TextTransparency = 128;
|
||||
rpt.Watermark.ShowBehind = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
rpt.Watermark.Text = "";
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user