public virtual CrystalDecisions.CrystalReports.Engine.ReportDocument CreateReport() { SupplierCreditAvailabilityRPTTemp rpt = new SupplierCreditAvailabilityRPTTemp(); rpt.Site = this.Site; return(rpt); }
private void button5_Click(object sender, EventArgs e) { if (String.IsNullOrEmpty(txtSupCode.Text)) { MessageBox.Show("Type A Valid Supplier"); txtSupCode.Focus(); } else if (!chkAllRoutes.Checked && String.IsNullOrEmpty(mySupplier.getSupplierName(cmbRoute.SelectedValue.ToString(), txtSupCode.Text))) { MessageBox.Show("Type A Valid Supplier"); txtSupCode.Focus(); } else if (chkAllRoutes.Checked && String.IsNullOrEmpty(mySupplier.getSupplierName(txtSupCode.Text))) { MessageBox.Show("Type A Valid Supplier"); txtSupCode.Focus(); } else { DataSet dsRPT = new DataSet(); DataTable dataSetReport = new DataTable(); dataSetReport.TableName = "SupplierPaymentsSummary"; DataTable dataSetReport1 = new DataTable(); dataSetReport.TableName = "PaymentsHistory"; string supCode = string.Empty; supCode = txtSupCode.Text; string strRoute = "%"; if (chkAllRoutes.Checked) { strRoute = "%"; } else { strRoute = cmbRoute.SelectedValue.ToString(); } dataSetReport = myMonthlySummary.getSupplierPaymentsDetail(ToDate.Value.Year, ToDate.Value.Month, supCode, strRoute).Tables[0]; dataSetReport1 = myMonthlySummary.getCreditAvailabilityPaymentSummary(ToDate.Value.Year, ToDate.Value.Month, FromDate.Value.Month, supCode, strRoute).Tables[0]; dataSetReport1.TableName = "History"; if (dataSetReport.Rows.Count > 0) { dataSetReport.WriteXml("SupplierPaymentsSummary.xml"); dataSetReport1.WriteXml("supplierPaymentsHistory.xml"); //SupplierCreditAvailabilityRPT myReport = new SupplierCreditAvailabilityRPT(); SupplierCreditAvailabilityRPTTemp myReport = new SupplierCreditAvailabilityRPTTemp(); myReport.SetDataSource(dataSetReport); SupplierGLHistoryRPT glRpt = new SupplierGLHistoryRPT(); glRpt.SetDataSource(dataSetReport1); //myReport.SetDataSource(dataSetReport1); ReportViewer rptViewer = new ReportViewer(); myReport.SetParameterValue("Company", BoughtLeafBusinessLayer.BLUser.getCompanyName()); myReport.SetParameterValue("Year", ToDate.Value.Date.Year.ToString()); myReport.SetParameterValue("Month", ToDate.Value.Date.Month.ToString()); //myReport.SetParameterValue("payRate", mySettings.getKiloRate(ToDate.Value.Date.Year, ToDate.Value.Date.Month)); myReport.SetParameterValue("payRate", Convert.ToDecimal(txt_rate.Text)); rptViewer.crystalReportViewer1.ReportSource = myReport; rptViewer.Show(); } else { MessageBox.Show("No Data Available"); } } }