/// <summary> /// Prints the preview report by report. /// </summary> /// <param name="frmParent">The FRM parent.</param> /// <param name="param">The e parameter.</param> /// <param name="isPrint">if set to <c>true</c> [is print].</param> public void PrintPreviewReportByReport(XtraForm frmParent, DrilldownReportParam param, bool isPrint) { try { Cursor.Current = Cursors.WaitCursor; _reportListModel = ReportLists.Find(item => item.ReportID == param.ArgParameter[0].ToString()); if (_reportListModel == null) { return; } _frmParentForm = frmParent; var reportListSource = GetDrillDownDataSource(frmParent, _reportListModel, param.ArgParameter); if (reportListSource == null || reportListSource.Count <= 0) { return; } if (reportListSource.Count > 0) { if (!string.IsNullOrEmpty(_reportListModel.TableName)) { DataMember = _reportListModel.TableName.Trim(); } DisplayReport(ref reportListSource, _reportListModel, false, frmParent, false, isPrint, DateTime.MinValue); } else { XtraMessageBox.Show("Không có bản ghi nào", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information); } } catch (Exception ex) { XtraMessageBox.Show(ex.ToString(), "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
/// <summary> /// Reports the drill down ledger report. /// </summary> /// <param name="sender">The sender.</param> /// <param name="eParam">The e parameter.</param> private void ReportDrillDownLedgerReport(object sender, DrilldownReportParam eParam) { try { var pageIndex = ReportSharpTool.oPreviewForm.ReportViewer.PageIndex; ReportTool.DrillDownReport(sender, eParam); var zoom = ReportSharpTool.PreviewForm.ReportViewer.Zoom; var templateFile = ReportSharpTool.ReportSlot.FilePath; ReportSharpTool.ReportSlot.FilePath = ReportSharpTool.ReportFileName; ReportSharpTool.ReportSlot.Document = ReportSharpTool.ReportSlot.LoadReport(); ReportSharpTool.RefreshInfo(ReportSharpTool.ReportSlot.Document); ReportSharpTool.ReportSlot.FilePath = templateFile; ReportSharpTool.ReportSlot.SaveReport(ReportSharpTool.ReportSlot.Document); ReportSharpTool.ReportSlot.RenderDocument(); ReportSharpTool.PreviewForm.ReportViewer.Actions["RefreshReport"].ExecuteAction(); var reportFileName = ReportSharpTool.ReportFileName; ReportSharpTool.PreviewForm.Text = ReportSharpTool.ReportTitle + @" [" + reportFileName.Substring((reportFileName.LastIndexOf("\\", StringComparison.Ordinal) + 1), ((reportFileName.Length - reportFileName.LastIndexOf("\\", StringComparison.Ordinal)) - 1)) + @"] - Xem báo cáo"; ReportSharpTool.PreviewForm.ReportViewer.Zoom = zoom; ReportSharpTool.oPreviewForm.ReportViewer.PageIndex = pageIndex; } catch (Exception ex) { XtraMessageBox.Show(ex.ToString(), "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
/// <summary> /// Drills down report. /// </summary> /// <param name="form">The form.</param> /// <param name="eParam">The e parameter.</param> private static void DrillDownReport(XtraForm form, DrilldownReportParam eParam) { try { Cursor.Current = Cursors.WaitCursor; var viewer = new ReportHelper(); InitData(); viewer.ReportLists = ReportLists; viewer.CommonVariable = CommonVariable; viewer.PrintPreviewReportByReport(form, eParam, false); } catch (Exception ex) { XtraMessageBox.Show("Lỗi: " + ex.Message, "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information); } finally { Cursor.Current = Cursors.Default; } }
/// <summary> /// Drills down report. /// </summary> /// <param name="sender">The sender.</param> /// <param name="eParam">The e parameter.</param> internal static void DrillDownReport(object sender, DrilldownReportParam eParam) { DrillDownReport((XtraForm)sender, eParam); }