Esempio n. 1
0
        public virtual CrystalDecisions.CrystalReports.Engine.ReportDocument CreateReport()
        {
            rpt_ChamCong09 rpt = new rpt_ChamCong09();

            rpt.Site = this.Site;
            return(rpt);
        }
Esempio n. 2
0
        private void btnOK_Click(object sender, RoutedEventArgs e)
        {
            string thang = dtpNgay.SelectedDate.Value.Month.ToString();
            string nam   = dtpNgay.SelectedDate.Value.Year.ToString();

            //string phong = bll.Left(CboPB.SelectedValue.ToString().Trim(), 2);
            try
            {
                cls.ClsConnect();
                {
                    try
                    {
                        int      thamso = 4;
                        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("yyyy-MM-dd");
                        }
                        bien[2]   = "@Phong";
                        giatri[2] = bll.Left(CboPB.SelectedValue.ToString().Trim(), 2);
                        bien[3]   = "@Mau";
                        if (Ration1.IsChecked == true)
                        {
                            giatri[3] = "CC";
                        }
                        else if (Ration2.IsChecked == true)
                        {
                            giatri[3] = "LT";
                        }
                        else
                        {
                            giatri[3] = "NB";
                        }
                        mau = giatri[3].ToString();
                        if (Ration1.IsChecked == true || Ration2.IsChecked == true || Ration3.IsChecked == true)
                        {
                            dt = cls.LoadDataProcPara("usp_ChamCongTK", bien, giatri, thamso);
                            if (dt.Rows.Count > 0)
                            {
                                if (mau == "CC")
                                {
                                    rpt_ChamCong02 rpt = new rpt_ChamCong02();
                                    RPUtility.ShowRp(rpt, dt, this, srv.DbSourceSerVer(), srv.DbNameSerVer(),
                                                     srv.DbUserSerVer(), srv.DbPassSerVer());
                                }
                                else if (mau == "LT")
                                {
                                    rpt_ChamCong03 rpt = new rpt_ChamCong03();
                                    RPUtility.ShowRp(rpt, dt, this, srv.DbSourceSerVer(), srv.DbNameSerVer(),
                                                     srv.DbUserSerVer(), srv.DbPassSerVer());
                                }
                                else
                                {
                                    rpt_ChamCong04 rpt = new rpt_ChamCong04();
                                    RPUtility.ShowRp(rpt, dt, this, srv.DbSourceSerVer(), srv.DbNameSerVer(),
                                                     srv.DbUserSerVer(), srv.DbPassSerVer());
                                }
                            }
                            else
                            {
                                MessageBox.Show("Không có bản ghi nào !", "Thông báo", MessageBoxButton.OK,
                                                MessageBoxImage.Information);
                            }
                        } // ration 4 hoac 5
                        else if (Ration4.IsChecked == true || Ration5.IsChecked == true)
                        {
                            int      thamso1 = 2;
                            string[] bien1   = new string[thamso1];
                            object[] giatri1 = new object[thamso1];
                            bien1[0]   = "@MaPos";
                            giatri1[0] = bll.Left(CboPos.SelectedValue.ToString().Trim(), 6);
                            bien1[1]   = "@Ngay";
                            if (dtpNgay.SelectedDate != null)
                            {
                                giatri1[1] = dtpNgay.SelectedDate.Value.ToString("yyyy-MM-dd");
                            }
                            dt = cls.LoadDataProcPara("usp_ChamCongPhep", bien1, giatri1, thamso1);
                            if (Ration4.IsChecked == true)
                            {
                                rpt_ChamCong05 rpt = new rpt_ChamCong05();
                                RPUtility.ShowRp(rpt, dt, this, srv.DbSourceSerVer(), srv.DbNameSerVer(),
                                                 srv.DbUserSerVer(), srv.DbPassSerVer());
                            }
                            if (Ration5.IsChecked == true)
                            {
                                rpt_ChamCong09 rpt1 = new rpt_ChamCong09();
                                RPUtility.ShowRp(rpt1, dt, this, srv.DbSourceSerVer(), srv.DbNameSerVer(),
                                                 srv.DbUserSerVer(), srv.DbPassSerVer());
                            }
                        }
                    }
                    catch (Exception ex)
                    {
                        MessageBox.Show("Lổi, kiểm tra lại thông tin " + ex.Message, "Thông báo", MessageBoxButton.OK,
                                        MessageBoxImage.Error);
                    }
                }
                cls.DongKetNoi();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Error", MessageBoxButton.OK, MessageBoxImage.Error);
            }
            cls.DongKetNoi();
        }