public virtual CrystalDecisions.CrystalReports.Engine.ReportDocument CreateReport() { rpt_XaTo rpt = new rpt_XaTo(); rpt.Site = this.Site; return(rpt); }
private void btnOk_Click(object sender, RoutedEventArgs e) { cls.ClsConnect(); DataTable dt = new DataTable(); int thamso = 5; string[] bien = new string[thamso]; object[] giatri = new object[thamso]; bien[0] = "@MaPos"; giatri[0] = str.Left(CboPos.SelectedValue.ToString().Trim(), 6); bien[1] = "@Ngay"; if (dtpNgay.SelectedDate == null) { MessageBox.Show("Chưa chọn ngày", "Thông báo", MessageBoxButton.OK, MessageBoxImage.Error); return; } else { giatri[1] = dtpNgay.SelectedDate.Value.ToString("yyyy-MM-dd"); } bien[2] = "@MaXa"; giatri[2] = str.Left(CboXa.SelectedValue.ToString().Trim(), 6); bien[3] = "@Mau"; if (radioButton4.IsChecked == true) { giatri[3] = "1"; } else { giatri[3] = "2"; } bien[4] = "@Ky"; if (radioButton1.IsChecked == true) { giatri[4] = "1"; } else if (radioButton2.IsChecked == true) { giatri[4] = "2"; } else if (radioButton3.IsChecked == true) { giatri[4] = "3"; } //MessageBox.Show(giatri[0] + " " + giatri[1] + " " + giatri[2] + " " + giatri[3] + " " + giatri[4]); dt = cls.LoadDataProcPara("usp_XaTo", bien, giatri, thamso); //rpt_kt740_01 rpt = new rpt_kt740_01(); if (dt.Rows.Count > 0) { rpt_XaTo rpt = new rpt_XaTo(); RPUtility.ShowRp(rpt, dt, this, srv.DbSourceSerVer(), srv.DbNameSerVer(), srv.DbUserSerVer(), srv.DbPassSerVer()); //dataGrid1.ItemsSource = dt.DefaultView; // FileName = Thumuc + "\\" + str.Left(CboPos.SelectedValue.ToString().Trim(), 6) + "_" + str.Left(CboDvut.SelectedValue.ToString().Trim(), 2) + "_" + str.Left(CboXa.SelectedValue.ToString().Trim(), 6) + "_" + dtpNgay.SelectedDate.Value.ToString("ddMMyyyy") + ".xlsx"; // str.WriteDataTableToExcel(dt, "Person Details", FileName, "Details"); // MessageBox.Show("Copy Excel to : " + FileName); } else { MessageBox.Show("Chưa có số liệu", "Thông báo"); } cls.DongKetNoi(); }