public virtual CrystalDecisions.CrystalReports.Engine.ReportDocument CreateReport() { rpt_TSCC_TH rpt = new rpt_TSCC_TH(); rpt.Site = this.Site; return(rpt); }
private void TongHop_OnMouseDown(object sender, MouseButtonEventArgs e) { try { string ng = dtpNgay.SelectedDate.Value.ToString("yyyy-MM-dd"); string pos = CboPos.SelectedValue.ToString().Trim(); DateTime newdate = new DateTime(dtpNgay.SelectedDate.Value.AddYears(-1).Year + 1, 1, 1); DateTime LastDayYear = new DateTime(dtpNgay.SelectedDate.Value.Year, 12, 31); cls.ClsConnect(); str = "select *,(select po_ten from DMPOS where po_ma=pos) po_ten from( " + " select NGAYBC NGAY,'" + pos + "' POS, MA_TS, LOAI_TS, TEN_LOAI_TS, MA_NHANHIEU_TS, TEN_NHANHIEU_TS, right(MAPHONG, 2) maph from LUU_TSCC where TRANGTHAI = 'A' and POS_CD = '" + pos + "'" + " ) as nguon pivot (count(ma_ts) for maph in ([17],[18],[19], [20], [21], [22], [29], [30], [31], [34])) as dich" + " where [17] +[18] + [19] + [20] + [21] + [22] + [29] + [30] + [31] + [34] > 0 order by LOAI_TS,MA_NHANHIEU_TS"; str1 = "select *,N'Tổng Hợp' po_ten from ( " + " select NGAYBC NGAY,N'Tổng Hợp' POS, MA_TS, LOAI_TS, TEN_LOAI_TS, MA_NHANHIEU_TS, TEN_NHANHIEU_TS, right(MAPHONG, 2) maph from LUU_TSCC where TRANGTHAI = 'A'" + " and LOAI_TS_CHITIET in ('MM1','TI1') and MA_NHANHIEU_TS in ('MM11','MM12','TI11','TI12','TI13','TI19')) as nguon pivot(count(ma_ts) for maph in ([17],[18],[19], [20], [21], [22], [29], [30], [31], [34])) as dich" + " where[17] + [18] + [19] + [20] + [21] + [22] + [29] + [30] + [31] + [34] > 0 order by LOAI_TS,MA_NHANHIEU_TS"; //MessageBox.Show(str); dt = cls.LoadDataText(str); var dt1 = cls.LoadDataText(str1); if (dt.Rows.Count > 0) { rpt_TSCC_TH rpt = new rpt_TSCC_TH(); RPUtility.ShowRp(rpt, dt, this, srv.DbSourceSerVer(), srv.DbNameSerVer(), srv.DbUserSerVer(), srv.DbPassSerVer()); RPUtility.ShowRp(rpt, dt1, this, srv.DbSourceSerVer(), srv.DbNameSerVer(), srv.DbUserSerVer(), srv.DbPassSerVer()); } else { MessageBox.Show("Không có dữ liệu !", "Thông báo", MessageBoxButton.OK, MessageBoxImage.Information); } } catch (Exception ex) { MessageBox.Show(ex.Message, "Thông báo", MessageBoxButton.OK, MessageBoxImage.Error); } }