Beispiel #1
0
        public virtual CrystalDecisions.CrystalReports.Engine.ReportDocument CreateReport()
        {
            rpt_ChamCong rpt = new rpt_ChamCong();

            rpt.Site = this.Site;
            return(rpt);
        }
Beispiel #2
0
        private void BtnIn_OnClick(object sender, RoutedEventArgs e)
        {
            cls.ClsConnect();
            {
                try
                {
                    MessageBox.Show("Để số ngày hưởng cá đúng do có nghỉ bù và làm thêm trong tháng, cần chấm làm thêm trước khi in!", "Thông báo", MessageBoxButton.OK, MessageBoxImage.Warning);
                    if (Ration1.IsChecked == true)
                    {
                        mau = "CC";
                    }
                    else if (Ration2.IsChecked == true)
                    {
                        mau = "LT";
                    }
                    else
                    {
                        mau = "NB";
                    }
                    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";
                    giatri[3] = mau;

                    //---------------------------
                    if (Ration1.IsChecked == true)
                    {
                        cls.UpdateDataProcPara("usp_ChamCong02", bien, giatri, thamso);
                    }
                    if (Ration2.IsChecked == true)
                    {
                        cls.UpdateDataProcPara("usp_ChamCong01", bien, giatri, thamso);
                    }
                    //----------------------------
                    if (mau == "CC")
                    {
                        str = "select * from LUUCHAMCONG where ND_MADV='" +
                              bll.Left(CboPos.SelectedValue.ToString().Trim(), 6) + "' and THANG='" +
                              dtpNgay.SelectedDate.Value.Month + "' and NAM='" +
                              dtpNgay.SelectedDate.Value.Year + "' and ND_PHONGBAN='" +
                              bll.Left(CboPB.SelectedValue.ToString().Trim(), 2) + "' and ND_MA<>'00' and MA='" + mau +
                              "' order by STT";
                        string str1 = "select * from LUUCHAMCONG where ND_MADV='" +
                                      bll.Left(CboPos.SelectedValue.ToString().Trim(), 6) + "' and THANG='" +
                                      dtpNgay.SelectedDate.Value.Month + "' and NAM='" +
                                      dtpNgay.SelectedDate.Value.Year + "' and ND_PHONGBAN='" +
                                      bll.Left(CboPB.SelectedValue.ToString().Trim(), 2) + "' and ND_MA<>'00' and MA='" + mau +
                                      "' and CS>0 order by STT";
                        dtcs = cls.LoadDataText(str1);
                    }
                    else
                    {
                        str = "select * from LUUCHAMCONG where ND_MADV='" +
                              bll.Left(CboPos.SelectedValue.ToString().Trim(), 6) + "' and THANG='" +
                              dtpNgay.SelectedDate.Value.Month + "' and NAM='" +
                              dtpNgay.SelectedDate.Value.Year + "' and ND_PHONGBAN='" +
                              bll.Left(CboPB.SelectedValue.ToString().Trim(), 2) + "' and MA='" + mau +
                              "' and [32]+[33]+[34]+[35]>0  order by STT";
                    }
                    dt = cls.LoadDataText(str);
                    //MessageBox.Show(str);
                    if (mau == "CC")
                    {
                        rpt_ChamCong rpt = new rpt_ChamCong();
                        RPUtility.ShowRp(rpt, dt, this, srv.DbSourceSerVer(), srv.DbNameSerVer(), srv.DbUserSerVer(), srv.DbPassSerVer());
                        if (dtcs.Rows.Count > 0)
                        {
                            rpt_ChamCong07 rpt1 = new rpt_ChamCong07();
                            RPUtility.ShowRp(rpt1, dtcs, this, srv.DbSourceSerVer(), srv.DbNameSerVer(),
                                             srv.DbUserSerVer(), srv.DbPassSerVer());

                            string str2 = "select '" + BienBll.NdTen.Trim() + "' TENCB,c.TEN TENCHUCVU,b.ND_CHUCVU,a.* from LUUCHAMCONG a"
                                          + " left join DM_CANBO b on a.ND_MA = b.MA_CIF "
                                          + " left join DM_CHUCVU c on b.ND_CHUCVU = c.MA"
                                          +
                                          " where a.ND_MADV = '" + bll.Left(CboPos.SelectedValue.ToString().Trim(), 6)
                                          + "' and a.THANG = '" + dtpNgay.SelectedDate.Value.Month
                                          + "' and a.NAM = '" + dtpNgay.SelectedDate.Value.Year
                                          + "' and a.ND_PHONGBAN = '" + bll.Left(CboPB.SelectedValue.ToString().Trim(), 2)
                                          + "' and a.ND_MA <> '00' and a.MA = '" + mau + "' and a.CS>0 order by a.STT";
                            var            dttr = cls.LoadDataText(str2);
                            rpt_ChamCong08 rpt2 = new rpt_ChamCong08();
                            RPUtility.ShowRp(rpt2, dttr, this, srv.DbSourceSerVer(), srv.DbNameSerVer(),
                                             srv.DbUserSerVer(), srv.DbPassSerVer());
                        }
                    }
                    else
                    {
                        rpt_ChamCong01 rpt = new rpt_ChamCong01();
                        RPUtility.ShowRp(rpt, dt, this, srv.DbSourceSerVer(), srv.DbNameSerVer(), srv.DbUserSerVer(), srv.DbPassSerVer());
                        //RPUtility.ShowRpOnePara(rpt, dt,txtGhiChu.Text.Trim(), 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();
            btnIn.IsEnabled = false;
        }