public virtual CrystalDecisions.CrystalReports.Engine.ReportDocument CreateReport() { rpt_ThiDua03 rpt = new rpt_ThiDua03(); rpt.Site = this.Site; return(rpt); }
private void Print_OnClick(object sender, RoutedEventArgs e) { try { _cls.ClsConnect(); int thamso = 3; string[] bien = new string[thamso]; object[] giatri = new object[thamso]; bien[0] = "@Nam"; giatri[0] = comboBoxYear.SelectedValue; bien[1] = "@Quy"; giatri[1] = CboQuy.SelectionBoxItem.ToString().Trim(); bien[2] = "@Dot"; giatri[2] = bll.Left(CboDot.SelectedValue.ToString(), 1); //MessageBox.Show(giatri[0] + " " + giatri[1]); //dt = cls.LoadDataProcPara("usp_KHB", bien, giatri, thamso); _cls.UpdateDataProcPara("usp_CongThiDua", bien, giatri, thamso); if (ChkTh.IsChecked == true) { if (bll.Left(CboDot.SelectedValue.ToString(), 1) == "0") // đợt ngắn { strin = "select b.PO_TEN,a.*,P" + CboPos.SelectedValue.ToString().Substring(4, 2) + "01 CHAMDIEM ,(case when a.DOT='0' then c.MOTA+' Quý '+ a.QUY + ' Năm '+ a.NAM else c.MOTA end) TITLE,NGNH" + CboPos.SelectedValue.ToString().Substring(4, 2) + " NG_NHAN from MAU_THIDUA a,DMPOS b,DOT_THIDUA c where a.NAM='" + comboBoxYear.SelectedValue + "' and a.QUY='" + CboQuy.SelectionBoxItem.ToString().Trim() + "' and a.DOT='" + bll.Left(CboDot.SelectedValue.ToString(), 1) + "' and b.PO_MA='" + bll.Left(CboPos.SelectedValue.ToString().Trim(), 6) + "' and a.DOT=c.DOT and a.CHONIN='1' order by a.CHUYENDE,a.STT"; } else { strin = "select b.PO_TEN,a.*,P" + CboPos.SelectedValue.ToString().Substring(4, 2) + "01 CHAMDIEM ,(case when a.DOT='0' then c.MOTA+' Quý '+ a.QUY + ' Năm '+ a.NAM else c.MOTA end) TITLE,NGNH" + CboPos.SelectedValue.ToString().Substring(4, 2) + " NG_NHAN from MAU_THIDUA a,DMPOS b,DOT_THIDUA c where a.NAM='" + comboBoxYear.SelectedValue + "' and a.QUY='" + CboQuy.SelectionBoxItem.ToString().Trim() + "' and a.DOT='" + bll.Left(CboDot.SelectedValue.ToString(), 1) + "' and b.PO_MA='" + bll.Left(CboPos.SelectedValue.ToString().Trim(), 6) + "' and a.DOT=c.DOT and a.CHUYENDE='" + RadCboChDe.SelectedValue.ToString().Trim() + "' and a.CHONIN='1' order by a.CHUYENDE,a.STT"; } //MessageBox.Show(strin); _cls.ClsConnect(); _dt = _cls.LoadDataText(strin); if (_dt.Rows.Count > 0) { rpt_ThiDua02 rpt = new rpt_ThiDua02(); RPUtility.ShowRp(rpt, _dt, this, srv.DbSourceSerVer(), srv.DbNameSerVer(), srv.DbUserSerVer(), srv.DbPassSerVer()); } else { MessageBox.Show("Không có dữ liệu để in !", "Thông báo", MessageBoxButton.OK, MessageBoxImage.Warning); } } else { string strin = "select a.* from MAU_THIDUA a where a.NAM='" + comboBoxYear.SelectedValue + "' and a.QUY='" + CboQuy.SelectionBoxItem.ToString().Trim() + "' and a.DOT='" + bll.Left(CboDot.SelectedValue.ToString(), 1) + "' and CHUYENDE='" + RadCboChDe.SelectedValue.ToString().Trim() + "' and CHONIN='1' order by STT"; _cls.ClsConnect(); _dt = _cls.LoadDataText(strin); if (_dt.Rows.Count > 0) { rpt_ThiDua03 rpt = new rpt_ThiDua03(); RPUtility.ShowRp(rpt, _dt, this, srv.DbSourceSerVer(), srv.DbNameSerVer(), srv.DbUserSerVer(), srv.DbPassSerVer()); } else { MessageBox.Show("Không có dữ liệu để in !", "Thông báo", MessageBoxButton.OK, MessageBoxImage.Warning); } } } catch (Exception ex) { MessageBox.Show("Error \n" + ex.Message, "Thông báo", MessageBoxButton.OK, MessageBoxImage.Error); } _cls.DongKetNoi(); LblManual_OnMouseDown(null, null); }