public virtual CrystalDecisions.CrystalReports.Engine.ReportDocument CreateReport() { rpt_RoiTo rpt = new rpt_RoiTo(); rpt.Site = this.Site; return(rpt); }
private void lblOk_MouseDown(object sender, MouseButtonEventArgs e) { try { dtNew = dt.Clone(); foreach (DataRow dr in dt.Rows) { if ((bool)dr[0] == true) { dtNew.ImportRow(dr); } } //dtNew = dt.GetChanges(); if (dtNew == null || dtNew.Rows.Count == 0) { MessageBox.Show("Chưa có thay đổi ngày nào !", "Thông báo", MessageBoxButton.OK, MessageBoxImage.Warning); } else { if (Opt1.IsChecked == true || Opt3.IsChecked == true) { rpt_DongCasa rpt = new rpt_DongCasa(); RPUtility.ShowRp(rpt, dtNew, this, srv.DbSourceSerVer(), srv.DbNameSerVer(), srv.DbUserSerVer(), srv.DbPassSerVer()); if (lblGmt.IsChecked == true) { rpt_RoiTo rpt1 = new rpt_RoiTo(); RPUtility.ShowRp(rpt1, dtNew, this, srv.DbSourceSerVer(), srv.DbNameSerVer(), srv.DbUserSerVer(), srv.DbPassSerVer()); } //dt = null; //dtNew = null; //dgvData.ItemsSource = null; /* * string mau = ""; * if (Opt3.IsChecked == true) * { * mau = "1"; * } * else * { * mau = "0"; * } * //dgvNew.ItemsSource = dtNew.DefaultView; * * if (Opt1.IsChecked == true || Opt2.IsChecked == true) * { * rpt_DongCasa rpt = new rpt_DongCasa(); * //RPUtility.ShowRp(rpt, dtNew, this, srv.DbSourceLocal(), srv.DbNameLocal(), srv.DbUserLocal(), srv.DbPassLocal()); * RPUtility.ShowRpOnePara(rpt, dtNew, mau, this, srv.DbSourceLocal(), srv.DbNameLocal(), * srv.DbUserLocal(), srv.DbPassLocal()); * } * else * { * rpt_DongCasa rpt = new rpt_DongCasa(); * //RPUtility.ShowRp(rpt, dtNew, this, srv.DbSourceLocal(), srv.DbNameLocal(), srv.DbUserLocal(), srv.DbPassLocal()); * RPUtility.ShowRpOnePara(rpt, dtNew, mau, this, srv.DbSourceLocal(), srv.DbNameLocal(), * srv.DbUserLocal(), srv.DbPassLocal()); * } */ } else { FileName = Thumuc + "\\" + str.Left(CboPos.SelectedValue.ToString().Trim(), 6) + "_" + str.Left(CboTo.SelectedValue.ToString().Trim(), 7) + "_DONG105_" + dtpNgay.SelectedDate.Value.ToString("ddMMyyyy") + ".csv"; FileStream fs = new FileStream(FileName, FileMode.Create); StreamWriter sw = new StreamWriter(fs, Encoding.Unicode); //bll.WriteDataTableToExcel(dt, "Details", FileName, "tutm : 0985165777"); str.ToCSV(dtNew, sw, true); MessageBox.Show("Copy Excel to : " + FileName, "Thông báo", MessageBoxButton.OK, MessageBoxImage.Information); } //dtNew = dt.Clone(); //dtNew = null; //dt = null; // dgvData.ItemsSource = null; // ChkAll.IsChecked = false; } } catch (Exception ex) { MessageBox.Show("Bấm nút lấy dữ liệu !" + ex.Message, "Lỗi", MessageBoxButton.OK, MessageBoxImage.Error); } }