示例#1
0
        public virtual CrystalDecisions.CrystalReports.Engine.ReportDocument CreateReport()
        {
            rpt_ChamDiemGDX_TH rpt = new rpt_ChamDiemGDX_TH();

            rpt.Site = this.Site;
            return(rpt);
        }
示例#2
0
 private void Print_OnClick(object sender, RoutedEventArgs e)
 {
     if (Opt1.IsChecked == true)
     {
         string sql = "select * from LUU_CHAMDIEMGDX where MAPOS='" +
                      bll.Left(CboPos.SelectedValue.ToString().Trim(), 6) + "' and MAXA='" +
                      bll.Left(CboXa.SelectedValue.ToString().Trim(), 6) + "' and NAM='" +
                      bll.Right(dtpNgay.SelectedDate.Value.ToString("dd/MM/yyyy"), 4) + "' order by STT";
         try
         {
             _cls.ClsConnect();
             _dt = _cls.LoadDataText(sql);
             if (_dt.Rows.Count > 0)
             {
                 rpt_ChamDiemGDX rpt = new rpt_ChamDiemGDX();
                 RPUtility.ShowRp(rpt, _dt, this, srv.DbSourceSerVer(), srv.DbNameSerVer(), srv.DbUserSerVer(),
                                  srv.DbPassSerVer());
             }
             else
             {
                 MessageBox.Show("Không có dữ liệu", "Mess", MessageBoxButton.OK, MessageBoxImage.Warning);
             }
         }
         catch (Exception)
         {
             MessageBox.Show("Error", "Mess", MessageBoxButton.OK, MessageBoxImage.Error);
         }
     }
     else
     {
         string sql =
             "select MA from DMXA where PGD_QL='" + bll.Left(CboPos.SelectedValue.ToString().Trim(), 6) + "'" +
             " and right(MA,2)<>'00' and MA not in (select MAXA from LUU_CHAMDIEMGDX where MAPOS='" + bll.Left(CboPos.SelectedValue.ToString().Trim(), 6) + "' and NAM='" + bll.Right(dtpNgay.SelectedDate.Value.ToString("dd/MM/yyyy"), 4) + "')";
         _cls.ClsConnect();
         _dt = _cls.LoadDataText(sql);
         if (_dt.Rows.Count > 0)
         {
             string xa = "";
             foreach (DataRow dr in _dt.Rows)
             {
                 //MessageBox.Show(dr[0].ToString());
                 xa = xa + "/" + dr[0].ToString();
             }
             MessageBox.Show("Những xã sau chưa chấm : " + xa, "Mess", MessageBoxButton.OK, MessageBoxImage.Warning);
         }
         else
         {
             try
             {
                 _cls.ClsConnect();
                 int      thamso = 2;
                 string[] bien   = new string[thamso];
                 object[] giatri = new object[thamso];
                 bien[0]   = "@MaPos";
                 giatri[0] = bll.Left(CboPos.SelectedValue.ToString().Trim(), 6);
                 bien[1]   = "@Ngay";
                 if (dtpNgay.SelectedDate != null)
                 {
                     giatri[1] = dtpNgay.SelectedDate.Value.ToString("dd/MM/yyyy");
                 }
                 _dt = _cls.LoadDataProcPara("usp_ChamDiemGDX_TH", bien, giatri, thamso);
                 if (_dt.Rows.Count > 0)
                 {
                     rpt_ChamDiemGDX_TH rpt = new rpt_ChamDiemGDX_TH();
                     RPUtility.ShowRp(rpt, _dt, this, srv.DbSourceSerVer(), srv.DbNameSerVer(), srv.DbUserSerVer(),
                                      srv.DbPassSerVer());
                 }
                 else
                 {
                     MessageBox.Show("Không có bản ghi nào", "Mess", MessageBoxButton.OK, MessageBoxImage.Warning);
                 }
                 //MessageBox.Show("OK", "Mess", MessageBoxButton.OK, MessageBoxImage.Information);
             }
             catch (Exception ex)
             {
                 MessageBox.Show("Error \n" + ex.Message, "Mess", MessageBoxButton.OK, MessageBoxImage.Error);
             }
             finally
             {
                 _cls.DongKetNoi();
             }
         }
     }
 }