private void btnShow_Click(object sender, EventArgs e) { int num; DateTime @value = this.dtFrom.Value; DateTime date = @value.Date; @value = this.dtTo.Value; DateTime dateTime = @value.Date; ReportFrom reportFrom = new ReportFrom(); switch (this.reportType) { case ReportType.TrialBalance: { reportFrom.reportType = 0; } case ReportType.BalanceSheet: { reportFrom.reportType = 1; } case ReportType.Transactions: { reportFrom.reportType = 2; num = Convert.ToInt32(this.ddlAccounts.SelectedValue); reportFrom.account = num; } case ReportType.ProfitAndLoss: { reportFrom.reportType = 3; reportFrom.reportType = 8; goto; } case ReportType.Suppliers: { reportFrom.From = date; reportFrom.To = dateTime; this.closeSubs(this._form1); reportFrom.set_MdiParent(this._form1); this.Close(); this.Dispose(); reportFrom.set_Anchor(9); reportFrom.set_Dock(5); reportFrom.Show(); return; } } }
private void btnOK_Click(object sender, EventArgs e) { BalanceReportDataTable balanceReportDataTable; ReportDocument reportDocument = new ReportDocument(); reportDocument.Load(string.Concat(Path.GetDirectoryName(Application.ExecutablePath), "\\BalanceReportCR.rpt")); ReportBll reportBll = new ReportBll(); DateTime @value = this.dtDate.Value; DateTime date = @value.Date; int selectedValue = (int)this.ddlAccounts.SelectedValue; string str = string.Concat(this.ddlAccounts.SelectedValue.ToString(), " | ", this.ddlAccounts.GetItemText(this.ddlAccounts.SelectedItem)); if (this.category != 0) { balanceReportDataTable = reportBll.BalanceReportByCategory(selectedValue, date); } else { balanceReportDataTable = reportBll.BalanceReportByAccount(selectedValue, date); } reportDocument.SetDataSource(balanceReportDataTable); ParameterValues parameterValue1 = new ParameterValues(); ParameterDiscreteValue parameterDiscreteValue1 = new ParameterDiscreteValue(); parameterDiscreteValue1.set_Value(str); parameterValue1.Add(parameterDiscreteValue1); reportDocument.DataDefinition.ParameterFields["account"].ApplyCurrentValues(parameterValue1); ParameterValues parameterValue2 = new ParameterValues(); ParameterDiscreteValue parameterDiscreteValue2 = new ParameterDiscreteValue(); parameterDiscreteValue2.set_Value(date); parameterValue2.Add(parameterDiscreteValue2); reportDocument.DataDefinition.ParameterFields["dtTo"].ApplyCurrentValues(parameterValue2); ReportFrom reportFrom = new ReportFrom(); reportFrom.crViewer.set_ReportSource(reportDocument); reportFrom.MdiParent = this.form1; reportFrom.Anchor = AnchorStyles.Top | AnchorStyles.Right; reportFrom.Dock = DockStyle.Fill; reportFrom.reportType = ReportType.None; reportFrom.Show(); base.Close(); base.Dispose(); }