private void btnPrintPreview_Click(object sender, EventArgs e) { try { if (!ValidateRequire()) { return; } DataTable dtbResult = m_bizReport.GetMOHSummaryReport(Util.ConvertObjectToInteger(cboMonth.SelectedValue), txtYear.IntValue); if (!Util.IsNullOrEmptyOrZero(dtbResult.Rows.Count)) { AppEnvironment.ShowWaitForm("Please Wait", "Initializing Report."); ReportDocument rpt = ReportUtil.LoadReport("RPT010_MOHSummaryReport.rpt"); rpt.SetDataSource(dtbResult); string monthYear = cboMonth.Text + " " + txtYear.Text; rpt.SetParameterValue("MonthYear", monthYear); FrmPreviewReport frmPrint = new FrmPreviewReport(); AppEnvironment.CloseWaitForm(); ReportUtil.PrintPreviewReport(frmPrint, rpt); } else { MessageBox.Show("Data not Found.", "RPT010", MessageBoxButtons.OK, MessageBoxIcon.Information); } } catch (Exception ex) { AppEnvironment.CloseWaitForm(); ExceptionManager.ManageException(this, ex); } }
private void btnPrintPreview_Click(object sender, EventArgs e) { ReportDocument rpt = ReportUtil.LoadReport("RPT999_ReportTest.rpt"); FrmPreviewReport frmPrint = new FrmPreviewReport(); ReportUtil.PrintPreviewReport(frmPrint, rpt); }
private void btnPrintPreview_Click(object sender, EventArgs e) { try { if (!ValidateRequire()) { return; } if (radioBtnType1.Checked) { strItemType = radioBtnType1.Text; } else { strItemType = radioBtnType2.Text; } DataTable dtbResult = m_bizReport.GetCostReports(txtYear.IntValue, Util.ConvertObjectToInteger(cboMonth.SelectedValue) , strProdDateFrom, strProdDateTo, strProdOrderNoFrom, strProdOrderNoTo, strItemType); if (!Util.IsNullOrEmptyOrZero(dtbResult.Rows.Count)) { AppEnvironment.ShowWaitForm("Please Wait", "Initializing Report."); ReportDocument rpt = ReportUtil.LoadReport("RPT020_CostReport.rpt"); rpt.SetDataSource(dtbResult); string monthYear = cboMonth.Text + " " + txtYear.Text; DateTime minDate = dtbResult.AsEnumerable() .Select(cols => cols.Field <DateTime>("DocDate")) .FirstOrDefault(); DateTime maxDate = dtbResult.AsEnumerable() .Select(cols => cols.Field <DateTime>("DocDate")) .OrderByDescending(p => p.Ticks) .FirstOrDefault(); //string dateMinMax = minDate.ToString("dd/MM/yyyy") + " - " + maxDate.ToString("dd/MM/yyyy"); string dateMinMax = ProdDateFrom.Text + " - " + ProdDateTo.Text; rpt.SetParameterValue("dateMinMax", dateMinMax); rpt.SetParameterValue("MonthYear", monthYear); FrmPreviewReport frmPrint = new FrmPreviewReport(); AppEnvironment.CloseWaitForm(); ReportUtil.PrintPreviewReport(frmPrint, rpt); } else { MessageBox.Show("Data not Found.", "RPT020", MessageBoxButtons.OK, MessageBoxIcon.Information); } } catch (Exception ex) { AppEnvironment.CloseWaitForm(); ExceptionManager.ManageException(this, ex); } }