public virtual CrystalDecisions.CrystalReports.Engine.ReportDocument CreateReport() { ReportBeli rpt = new ReportBeli(); rpt.Site = this.Site; return(rpt); }
private void BtnCreate_Click(object sender, RoutedEventArgs e) { bulan = cbBulan.SelectedIndex + 1; if (bulan < 10) { strParam = "0" + bulan.ToString(); } else { strParam = bulan.ToString(); } try { tahun = Convert.ToInt64(tbTahun.Text); strParam += "-" + tahun; if (cbJenis.SelectedIndex == 0) { ReportJual rjual = new ReportJual(); rjual.SetDatabaseLogon(MainWindow.user, MainWindow.pass, MainWindow.data, ""); rjual.SetParameterValue("bulan", cbBulan.SelectedValue.ToString().ToUpper()); rjual.SetParameterValue("tahun", tahun); rjual.SetParameterValue("BlnTh", strParam); CRViewer.ViewerCore.ReportSource = rjual; } else if (cbJenis.SelectedIndex == 1) { ReportBeli rbeli = new ReportBeli(); rbeli.SetDatabaseLogon(MainWindow.user, MainWindow.pass, MainWindow.data, ""); rbeli.SetParameterValue("bulan", cbBulan.SelectedValue.ToString().ToUpper()); rbeli.SetParameterValue("tahun", tahun); rbeli.SetParameterValue("BlnTh", strParam); CRViewer.ViewerCore.ReportSource = rbeli; } else if (cbJenis.SelectedIndex == 2) { ReportTukar rtukar = new ReportTukar(); rtukar.SetDatabaseLogon(MainWindow.user, MainWindow.pass, MainWindow.data, ""); rtukar.SetParameterValue("bulan", cbBulan.SelectedValue.ToString().ToUpper()); rtukar.SetParameterValue("tahun", tahun); rtukar.SetParameterValue("BlnTh", strParam); CRViewer.ViewerCore.ReportSource = rtukar; } } catch (Exception ex) { MessageBox.Show("Input Tahun Tidak Valid!"); } cbBulan.SelectedIndex = -1; tbTahun.Text = ""; }