private void OnCommandClick(object sender, EventArgs e) { if (!IsSelValid()) { return; } var cmd = (Button)sender; switch (cmd.Name) { case "cmdPreview": htmlBox1.Html = RT2020.Reports.Inventory.Journal.List.HTML(txtFrom.Text.Trim(), txtTo.Text.Trim(), FromDate.ToString("yyyy-MM-dd"), ToDate.ToString("yyyy-MM-dd")); break; case "cmdPDF": #region export PDF var pdf = RT2020.Reports.Inventory.Journal.List.PDF(txtFrom.Text.Trim(), txtTo.Text.Trim(), FromDate.ToString("yyyy-MM-dd"), ToDate.ToString("yyyy-MM-dd")); if (pdf != null) { var dl = new FileDownloadGateway(); dl.FileName = string.Format("{0}.{1}.pdf", WestwindHelper.GetWord("report.SA1330", "Setting"), DateTime.Now.ToString("yyyyMMddHHmmss")); dl.SetContentType(DownloadContentType.OctetStream); dl.StartBytesDownload(this, pdf); } break; #endregion case "cmdExcel": #region export Excel var xls = RT2020.Reports.Inventory.Journal.List.Excel(txtFrom.Text.Trim(), txtTo.Text.Trim(), FromDate.ToString("yyyy-MM-dd"), ToDate.ToString("yyyy-MM-dd")); if (xls != null) { var dl = new FileDownloadGateway(); dl.FileName = string.Format("{0}.{1}.xlsx", WestwindHelper.GetWord("report.SA1330", "Setting"), DateTime.Now.ToString("yyyyMMddHHmmss")); dl.SetContentType(DownloadContentType.MicrosoftExcel); dl.StartBytesDownload(this, xls); } break; #endregion case "cmdPivot": #region export PivotTable var pvt = RT2020.Reports.Inventory.Journal.List.Pivot(txtFrom.Text.Trim(), txtTo.Text.Trim(), FromDate.ToString("yyyy-MM-dd"), ToDate.ToString("yyyy-MM-dd")); if (pvt != null) { var dl = new FileDownloadGateway(); dl.FileName = string.Format("{0}.{1}.xlsx", WestwindHelper.GetWord("report.SA1330", "Setting"), DateTime.Now.ToString("yyyyMMddHHmmss")); dl.SetContentType(DownloadContentType.MicrosoftExcel); dl.StartBytesDownload(this, pvt); } break; #endregion } }
private void OnCommandClick(object sender, EventArgs e) { if (!IsSelValid()) { return; } var cmd = (Button)sender; switch (cmd.Name) { case "cmdPreview": #region gen HTML Preview var id = Guid.NewGuid(); var subject = "SA1340-Summary"; var json = GetSelectionsJson(); var result = PipelineEx.Save(id, subject, json, (int)EnumHelper.Status.Active, DateTime.Now, ConfigHelper.CurrentUserId); if (result) { htmlBox1.Html = RT2020.Reports.Inventory.Journal.Summary.HTML(id.ToString()); } break; #endregion /** suspended * case "cmdPDF": #region export PDF * var pdf = RT2020.Reports.Inventory.Journal.Monthly.PDF(txtFrom.Text.Trim(), txtTo.Text.Trim(), FromDate.ToString("yyyy-MM-dd"), ToDate.ToString("yyyy-MM-dd")); * * if (pdf != null) * { * var dl = new FileDownloadGateway(); * dl.FileName = string.Format("{0}.{1}.pdf", WestwindHelper.GetWord("report.SA1330", "Setting"), DateTime.Now.ToString("yyyyMMddHHmmss")); * dl.SetContentType(DownloadContentType.OctetStream); * dl.StartBytesDownload(this, pdf); * } * break; #endregion * case "cmdExcel": #region export Excel * var xls = RT2020.Reports.Inventory.Journal.Monthly.Excel(txtFrom.Text.Trim(), txtTo.Text.Trim(), FromDate.ToString("yyyy-MM-dd"), ToDate.ToString("yyyy-MM-dd")); * * if (xls != null) * { * var dl = new FileDownloadGateway(); * dl.FileName = string.Format("{0}.{1}.xlsx", WestwindHelper.GetWord("report.SA1330", "Setting"), DateTime.Now.ToString("yyyyMMddHHmmss")); * dl.SetContentType(DownloadContentType.MicrosoftExcel); * dl.StartBytesDownload(this, xls); * } * break; #endregion */ case "cmdPivot": #region export PivotTable var pvt = RT2020.Reports.Inventory.Journal.Summary.Pivot(GetSelections()); if (pvt != null) { var dl = new FileDownloadGateway(); dl.FileName = string.Format("{0}.{1}.xlsx", WestwindHelper.GetWord("report.SA1340", "Setting"), DateTime.Now.ToString("yyyyMMddHHmmss")); dl.SetContentType(DownloadContentType.MicrosoftExcel); dl.StartBytesDownload(this, pvt); } break; #endregion } }