public virtual CrystalDecisions.CrystalReports.Engine.ReportDocument CreateReport() { rpt_ChovayNangmuc01a rpt = new rpt_ChovayNangmuc01a(); rpt.Site = this.Site; return(rpt); }
private void Lblin01kt_OnMouseDown(object sender, MouseButtonEventArgs e) { try { cls.ClsConnect(); int thamso = 3; string[] bien = new string[thamso]; object[] giatri = new object[thamso]; bien[0] = "@Ngay"; if (dtpNgay.SelectedDate != null) { giatri[0] = dtpNgay.SelectedDate.Value.ToString("yyyy-MM-dd"); bien[1] = "@TuNgay"; if (dtpTuNgay.SelectedDate != null) { giatri[1] = dtpTuNgay.SelectedDate.Value.ToString("yyyy-MM-dd"); bien[2] = "@DenNgay"; if (dtpDenNgay.SelectedDate != null) { giatri[2] = dtpDenNgay.SelectedDate.Value.ToString("yyyy-MM-dd"); } } } var dtin = cls.LoadDataProcPara("usp_ChovayNangmuc04", bien, giatri, thamso); if (dtin.Rows.Count > 0) { rpt_ChovayNangmuc01a rpt = new rpt_ChovayNangmuc01a(); RPUtility.ShowRp(rpt, dtin, this, srv.DbSourceSerVer(), srv.DbNameSerVer(), srv.DbUserSerVer(), srv.DbPassSerVer()); FileName = Thumuc + "\\" + str.Left(CboPos.SelectedValue.ToString().Trim(), 6) + "_Mẫu 01_KT " + dtpTuNgay.SelectedDate.Value.ToString("ddMMyyyy") + "_Đến ngày_" + dtpDenNgay.SelectedDate.Value.ToString("ddMMyyyy") + ".csv"; //MessageBox.Show(FileName); str.ExportToExcel(dtin, FileName); //str.WriteDataTableToExcel(dtin,"M01",FileName,"true"); ////FileStream fs = new FileStream(FileName, FileMode.Create); ////StreamWriter sw = new StreamWriter(fs, Encoding.Unicode); ////str.ToCSV(dtin, sw, true); MessageBox.Show("Copy Excel to : " + FileName, "Thông báo", MessageBoxButton.OK, MessageBoxImage.Information); str.OpenExcel(FileName); } else { MessageBox.Show("Không có món vay nào !", "Thông báo", MessageBoxButton.OK, MessageBoxImage.Information); } } catch (Exception ex) { MessageBox.Show("Lỗi : " + ex.Message, "Thông báo", MessageBoxButton.OK, MessageBoxImage.Error); } cls.DongKetNoi(); }