Exemplo n.º 1
0
        private void btnOk_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                cls.ClsConnect();
                const int thamso = 4;
                string[]  bien   = new string[thamso];
                object[]  giatri = new object[thamso];
                bien[0] = "@Ngay";
                if (dtpNgay.SelectedDate != null)
                {
                    giatri[0] = dtpNgay.SelectedDate.Value.ToString("yyyy-MM-dd");
                    bien[1]   = "@Maxa";
                    giatri[1] = bll.Left(CboXa.SelectedValue.ToString(), 6);
                    bien[2]   = "@TuNgay";
                    if (dtpTuNgay.SelectedDate != null)
                    {
                        giatri[2] = dtpTuNgay.SelectedDate.Value.ToString("yyyy-MM-dd");
                        bien[3]   = "@DenNgay";
                        if (dtpDenNgay.SelectedDate != null)
                        {
                            giatri[3] = dtpDenNgay.SelectedDate.Value.ToString("yyyy-MM-dd");
                        }
                    }
                }
                dt = cls.LoadDataProcPara("usp_SkeSvRaTruong", bien, giatri, thamso);
                if (dt.Rows.Count > 0)
                {
                    FileName = Thumuc + "\\" + giatri[0] + "_" + giatri[1] + "_Sao kê sinh viên ra trường_" + dtpNgay.SelectedDate.Value.ToString("ddMMyyyy") + ".csv";
                    bll.ExportToExcel(dt, FileName);
                    //bll.ExportDTToExcel(dt,FileName);
                    //bll.WriteDataTableToExcel(dt, "Details", FileName, "tutm : 0985165777");
                    //bll.ToCSV(dt, sw, true);
                    MessageBox.Show("Copy Excel to : " + FileName, "Thông báo", MessageBoxButton.OK, MessageBoxImage.Information);
                    //bll.OpenCSVWithExcel(FileName);
                    bll.OpenExcel(FileName);

                    //rpt_DinhSv rpt = new rpt_DinhSv();
                    //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");
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
            cls.DongKetNoi();
        }
Exemplo n.º 2
0
        private void LblGetData_OnMouseDown(object sender, MouseButtonEventArgs e)
        {
            try
            {
                cls.ClsConnect();
                int      thamso = 5;
                string[] bien   = new string[thamso];
                object[] giatri = new object[thamso];
                bien[0]   = "@MaPos";
                giatri[0] = str.Left(CboPos.SelectedValue.ToString().Trim(), 6);
                bien[1]   = "@Ngay";
                if (dtpNgay.SelectedDate != null)
                {
                    giatri[1] = dtpNgay.SelectedDate.Value.ToString("yyyy-MM-dd");
                    bien[2]   = "@Maxa";
                    giatri[2] = str.Left(CboXa.SelectedValue.ToString().Trim(), 6);
                    bien[3]   = "@TuNgay";
                    if (dtpTuNgay.SelectedDate != null)
                    {
                        giatri[3] = dtpTuNgay.SelectedDate.Value.ToString("yyyy-MM-dd");
                        bien[4]   = "@DenNgay";
                        if (dtpDenNgay.SelectedDate != null)
                        {
                            giatri[4] = dtpDenNgay.SelectedDate.Value.ToString("yyyy-MM-dd");
                        }
                    }
                }

                dt = cls.LoadDataProcPara("usp_ChovayNangmuc01", bien, giatri, thamso);
                //rpt_kt740_01 rpt = new rpt_kt740_01();
                if (dt.Rows.Count > 0)
                {
                    dgvSource.ItemsSource = dt.DefaultView;
                    // rpt_SkeTo rpt = new rpt_SkeTo();
                    // RPUtility.ShowRp(rpt, dt, this, srv.DbSourceSerVer(), srv.DbNameSerVer(), srv.DbUserSerVer(),srv.DbPassSerVer());
                    // string filename = "C:\\Tam\\" + str.Left(cboTo.SelectedValue.ToString().Trim(), 7) + ".xlsx";
                    // bll.WriteDataTableToExcel(dt, "Person Details", filename, "Details");
                    //dtNew = dt.GetChanges();
                }
                else
                {
                    MessageBox.Show("Chưa có số liệu", "Thông báo");
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
            cls.DongKetNoi();
        }
Exemplo n.º 3
0
 private void btnOk_Click(object sender, RoutedEventArgs e)
 {
     try
     {
         cls.ClsConnect();
         const int thamso = 2;
         string[]  bien   = new string[thamso];
         object[]  giatri = new object[thamso];
         bien[0] = "@Ngay";
         if (dtpNgay.SelectedDate != null)
         {
             giatri[0] = dtpNgay.SelectedDate.Value.ToString("dd/MM/yyyy");
         }
         bien[1]   = "@MaPos";
         giatri[1] = bll.Left(CboPos.SelectedValue.ToString().Trim(), 6);
         //MessageBox.Show(giatri[0].ToString() + "   " + giatri[1].ToString());
         dt = cls.LoadDataProcPara("usp_DonGia", bien, giatri, thamso);
         //MessageBox.Show(BienBll.NdMadv+"  "+BienBll.MainPos);
         if (BienBll.NdMadv == BienBll.MainPos)
         {
             rpt_DonGia rpt = new rpt_DonGia();
             RPUtility.ShowRp(rpt, dt, this, srv.DbSourceSerVer(), srv.DbNameSerVer(), srv.DbUserSerVer(), srv.DbPassSerVer());
         }
         else
         {
             rpt_DonGiaHuyen rpt = new rpt_DonGiaHuyen();
             RPUtility.ShowRp(rpt, dt, this, srv.DbSourceSerVer(), srv.DbNameSerVer(), srv.DbUserSerVer(), srv.DbPassSerVer());
         }
         cls.DongKetNoi();
     }
     catch (Exception ex)
     {
         MessageBox.Show("Lổi, liên hệ phòng tin học" + ex.Message, "Thông báo", MessageBoxButton.OK, MessageBoxImage.Error);
     }
 }
Exemplo n.º 4
0
 private void BtnOk_OnClick(object sender, RoutedEventArgs e)
 {
     _cls.ClsConnect();
     try
     {
         #region
         int      thamso = 2;
         string[] bien   = new string[thamso];
         object[] giatri = new object[thamso];
         bien[0]   = "@Ngay";
         bien[1]   = "@Mau";
         giatri[1] = "";
         if (dtpNgay.SelectedDate != null)
         {
             giatri[0] = dtpNgay.SelectedDate.Value.ToString("yyyy-MM-dd");
         }
         _dt = _cls.LoadDataProcPara("usp_QlyGqvlTinh", bien, giatri, thamso);
         rpt_NguonCqlvTinh rpt = new rpt_NguonCqlvTinh();
         RPUtility.ShowRp(rpt, _dt, this, srv.DbSourceSerVer(), srv.DbNameSerVer(), srv.DbUserSerVer(), srv.DbPassSerVer());
         rpt_NguonCqlvTinh1 rpt1 = new rpt_NguonCqlvTinh1();
         RPUtility.ShowRp(rpt1, _dt, this, srv.DbSourceSerVer(), srv.DbNameSerVer(), srv.DbUserSerVer(), srv.DbPassSerVer());
         #endregion
     }
     catch (Exception ex)
     {
         MessageBox.Show("Error" + ex.Message, "Error", MessageBoxButton.OK, MessageBoxImage.Error);
     }
     _cls.DongKetNoi();
 }
Exemplo n.º 5
0
 private void OK_OnClick(object sender, RoutedEventArgs e)
 {
     try
     {
         cls.ClsConnect();
         int      thamso = 1;
         string[] bien   = new string[thamso];
         object[] giatri = new object[thamso];
         bien[0]   = "@Ngay";
         giatri[0] = DtpNgay.SelectedDate.Value.ToString("yyyy-MM-dd");
         dt        = cls.LoadDataProcPara("usp_D21NHNN", bien, giatri, thamso);
         if (dt.Rows.Count > 0)
         {
             FileName = Thumuc + "\\" + DtpNgay.SelectedDate.Value.ToString("ddMMyyyy") + "_SoLieu_NHNN.xlsx";
             bll.WriteDataTableToExcel(dt, "Person Details", FileName, "Details");
             MessageBox.Show("OK đã xuất file Excel " + FileName, "Mess", MessageBoxButton.OK, MessageBoxImage.Information);
         }
         else
         {
             MessageBox.Show("Không có dữ liệu", "Mess", MessageBoxButton.OK, MessageBoxImage.Warning);
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show("Error \n" + ex.Message, "Mess", MessageBoxButton.OK, MessageBoxImage.Error);
     }
     finally
     {
         cls.DongKetNoi();
     }
 }
Exemplo n.º 6
0
 private void btnOk_Click(object sender, RoutedEventArgs e)
 {
     //var lastMonth = new DateTime(dtpNgay.SelectedDate.Value.Year, dtpNgay.SelectedDate.Value.Month, DateTime.DaysInMonth(dtpNgay.SelectedDate.Value.Year, dtpNgay.SelectedDate.Value.Month));
     cls.ClsConnect();
     try
     {
         int      thamso = 2;
         string[] bien   = new string[thamso];
         object[] giatri = new object[thamso];
         bien[0]   = "@Ma";
         giatri[0] = bll.Left(CboCanbo.SelectedValue.ToString().Trim(), 10);
         bien[1]   = "@Ngay";
         if (dtpNgay.SelectedDate != null)
         {
             giatri[1] = dtpNgay.SelectedDate.Value.ToString("yyyy-MM-dd");
         }
         dt = cls.LoadDataProcPara("usp_ChamCongPC", bien, giatri, thamso);
         if (dt.Rows.Count > 0)
         {
             rpt_ChamCong06 rpt = new rpt_ChamCong06();
             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.Warning);
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
     cls.DongKetNoi();
 }
Exemplo n.º 7
0
        private void btnOk_Click(object sender, RoutedEventArgs e)
        {
            // MessageBox.Show(BienBll.Ndma);
            ServerInfor srv = new ServerInfor();

            _cls.ClsConnect();
            int thamso = 2;

            string[] bien   = new string[thamso];
            object[] giatri = new object[thamso];
            bien[0] = "@Ngay";
            if (dtpNgay.SelectedDate != null)
            {
                giatri[0] = dtpNgay.SelectedDate.Value.ToString("yyyy-MM-dd");
            }
            bien[1]   = "@MaPos";
            giatri[1] = _str.Left(cboPos.SelectedValue.ToString().Trim(), 6);
            _dt       = _cls.LoadDataProcPara("usp_NVBQIN", bien, giatri, thamso);
            if (_dt.Rows.Count > 0)
            {
                rpt_NVBQ rpt = new rpt_NVBQ();
                RPUtility.ShowRp(rpt, _dt, this, srv.DbSourceSerVer(), srv.DbNameSerVer(), srv.DbUserSerVer(), srv.DbPassSerVer());
                FileName = Thumuc + "\\" + giatri[1] + "_SODU_NGUONVON_BQ_" + dtpNgay.SelectedDate.Value.ToString("ddMMyyyy") + ".csv";
                _str.ExportToExcel(_dt, FileName);
                MessageBox.Show("Copy Excel to : " + FileName, "Thông báo", MessageBoxButton.OK, MessageBoxImage.Information);
                _str.OpenExcel(FileName);
            }
            else
            {
                MessageBox.Show("Chưa có số liệu", "Thông báo");
            }
            _cls.DongKetNoi();
        }
Exemplo n.º 8
0
        private void btnExcel_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                DateTime newdate = new DateTime(dtpNgay.SelectedDate.Value.AddYears(-1).Year + 1, 1, 1);
                dtNew = dt.Clone();
                foreach (DataRow dr in dt.Rows)
                {
                    if ((bool)dr[0] == true)
                    {
                        dtNew.ImportRow(dr);
                    }
                }

                //dtNew = dt.GetChanges();
                if (dtNew == null || dtNew.Rows.Count == 0)
                {
                    MessageBox.Show("Chưa chọn thiết bị nào !", "Thông báo", MessageBoxButton.OK, MessageBoxImage.Warning);
                }
                else
                {
                    if (dtNew.Rows.Count >= 2)
                    {
                        MessageBox.Show("Chỉ chọn 1 thiết bị thôi !", "Thông báo", MessageBoxButton.OK,
                                        MessageBoxImage.Warning);
                    }
                    else
                    {
                        int      thamso = 4;
                        string[] bien   = new string[thamso];
                        object[] giatri = new object[thamso];
                        bien[0]   = "@Ngay";
                        giatri[0] = dtpNgay.SelectedDate.Value.ToString("yyyy-MM-dd");
                        bien[1]   = "@MaTs";
                        giatri[1] = dtNew.Rows[0]["MA_TS"].ToString();
                        bien[2]   = "@Lydo";
                        giatri[2] = txtLyDo.Text;
                        bien[3]   = "@DeNghi";
                        giatri[3] = txtDeNghi.Text;
                        var dtin = cls.LoadDataProcPara("usp_TSCC_HIS", bien, giatri, thamso);
                        if (dtin.Rows.Count > 0)
                        {
                            rpt_TSCC_Tr rpt = new rpt_TSCC_Tr();
                            RPUtility.ShowRp(rpt, dtin, 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);
            }
        }
Exemplo n.º 9
0
        private void BtnOk_OnClick(object sender, RoutedEventArgs e)
        {
            _cls.ClsConnect();
            try
            {
                int      thamso = 2;
                string[] bien   = new string[thamso];
                object[] giatri = new object[thamso];
                bien[0] = "@Ngay";
                if (dtpNgay.SelectedDate != null)
                {
                    giatri[0] = dtpNgay.SelectedDate.Value.ToString("yyyy-MM-dd");
                }
                bien[1]   = "@MaPos";
                giatri[1] = _str.Left(cboPos.SelectedValue.ToString().Trim(), 6);

                _dt = _cls.LoadDataProcPara("usp_KHTD", bien, giatri, thamso);
                if (_dt.Rows.Count != 0)
                {
                    rpt_KHTD rpt = new rpt_KHTD();
                    RPUtility.ShowRp(rpt, _dt, this, srv.DbSourceSerVer(), srv.DbNameSerVer(), srv.DbUserSerVer(), srv.DbPassSerVer());
                }
                else
                {
                    MessageBox.Show("Chưa có số liệu " + dtpNgay.SelectedDate.Value.ToString("dd/MM/yyyy"), "Thông báo", MessageBoxButton.OK, MessageBoxImage.Warning);
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("Error" + ex.Message, "Error", MessageBoxButton.OK, MessageBoxImage.Error);
            }
            _cls.DongKetNoi();
        }
Exemplo n.º 10
0
        private void BtnOk_OnClick(object sender, RoutedEventArgs e)
        {
            _cls.ClsConnect();
            try
            {
                #region
                int      thamso = 1;
                string[] bien   = new string[thamso];
                object[] giatri = new object[thamso];
                bien[0] = "@Ngay";
                if (dtpNgay.SelectedDate != null)
                {
                    giatri[0] = dtpNgay.SelectedDate.Value.ToString("yyyy-MM-dd");
                }
                _dt = _cls.LoadDataProcPara("usp_CtCanDoi", bien, giatri, thamso);
                if (_dt.Rows.Count > 0)
                {
                    rpt_CtCanDoi rpt = new rpt_CtCanDoi();
                    RPUtility.ShowRp(rpt, _dt, this, srv.DbSourceSerVer(), srv.DbNameSerVer(), srv.DbUserSerVer(),
                                     srv.DbPassSerVer());
                }
                else
                {
                    MessageBox.Show("Chưa có số liệu ngày ", "Thông báo", MessageBoxButton.OK, MessageBoxImage.Warning);
                }

                #endregion
            }
            catch (Exception ex)
            {
                MessageBox.Show("Error" + ex.Message, "Error", MessageBoxButton.OK, MessageBoxImage.Error);
            }
            _cls.DongKetNoi();
        }
Exemplo n.º 11
0
 private void btnOk_Click(object sender, RoutedEventArgs e)
 {
     try
     {
         ServerInfor srv = new ServerInfor();
         cls.ClsConnect();
         int      thamso = 2;
         string[] bien   = new string[thamso];
         object[] giatri = new object[thamso];
         bien[0] = "@Ngay";
         if (dtpNgay.SelectedDate != null)
         {
             giatri[0] = dtpNgay.SelectedDate.Value.ToString("yyyy-MM-dd");
         }
         bien[1]   = "@MaPos";
         giatri[1] = str.Left(cboPos.SelectedValue.ToString().Trim(), 6);
         dt        = cls.LoadDataProcPara("usp_Khtc03", bien, giatri, thamso);
         if (dt.Rows.Count > 0)
         {
             rpt_khtc03 rpt = new rpt_khtc03();
             RPUtility.ShowRp(rpt, dt, this, srv.DbSourceSerVer(), srv.DbNameSerVer(), srv.DbUserSerVer(), srv.DbPassSerVer());
         }
         else
         {
             MessageBox.Show("Chưa có số liệu", "Thông báo");
         }
         cls.DongKetNoi();
     }
     catch (Exception ex)
     {
         MessageBox.Show("Lổi " + ex.Message, "Mess");
     }
 }
Exemplo n.º 12
0
 private void BtnOk_OnClick(object sender, RoutedEventArgs e)
 {
     _cls.ClsConnect();
     try
     {
         sql = "select * from KQTHINV where NGAY='" + dtpNgay.SelectedDate.Value.ToString("yyyy-MM-dd") + "'";
         _dt = _cls.LoadDataText(sql);
         if (_dt.Rows.Count == 0)
         {
             MessageBox.Show("Không tìm thấy dữ liệu thi ngày :" + dtpNgay.SelectedDate.Value.ToString("dd/MM/yyyy"), "Thông báo", MessageBoxButton.OK, MessageBoxImage.Warning);
             Close();
         }
         else
         {
             int      thamso = 1;
             string[] bien   = new string[thamso];
             object[] giatri = new object[thamso];
             bien[0] = "@Ngay";
             if (dtpNgay.SelectedDate != null)
             {
                 giatri[0] = dtpNgay.SelectedDate.Value.ToString("yyyy-MM-dd");
             }
             _dt = _cls.LoadDataProcPara("usp_BaoCaoTN", bien, giatri, thamso);
             rpt_BaoCaoTN rpt = new rpt_BaoCaoTN();
             RPUtility.ShowRp(rpt, _dt, this, srv.DbSourceSerVer(), srv.DbNameSerVer(), srv.DbUserSerVer(), srv.DbPassSerVer());
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show("Error" + ex.Message, "Error", MessageBoxButton.OK, MessageBoxImage.Error);
     }
     _cls.DongKetNoi();
 }
Exemplo n.º 13
0
        private void OK_OnClick(object sender, RoutedEventArgs e)
        {
            try
            { cls.ClsConnect();
              int      thamso = 3;
              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]   = "@DenNgay";
                  if (DtpDenNgay.SelectedDate != null)
                  {
                      giatri[2] = DtpDenNgay.SelectedDate.Value.ToString("yyyy-MM-dd");
                      dt        = cls.LoadDataProcPara("usp_SkeDnKhoanh", bien, giatri, thamso);
                      if (dt.Rows.Count > 0)
                      {
                          if (RadioButton1.IsChecked == true)
                          {
                              rpt_SkeKhoanh rpt = new rpt_SkeKhoanh();
                              RPUtility.ShowRp(rpt, dt, this, srv.DbSourceSerVer(), srv.DbNameSerVer(), srv.DbUserSerVer(), srv.DbPassSerVer());
                          }
                          else
                          {
                              FileName = Thumuc + "\\" + bll.Left(CboPos.SelectedValue.ToString().Trim(), 6) + "_" +
                                         DtpDenNgay.SelectedDate.Value.ToString("ddMMyyyy") + "_Ske_Khoanh.csv";

                              /*bll.WriteDataTableToExcel(dt, "Person Details", FileName, "Details");
                               * bll.ExportToExcel(dt, FileName);
                               * MessageBox.Show("OK đã xuất file Excel " + FileName, "Mess", MessageBoxButton.OK, MessageBoxImage.Information);
                               * bll.OpenExcel(FileName);
                               */
                              //FileStream fs = new FileStream(FileName, FileMode.Create);
                              //StreamWriter sw = new StreamWriter(fs, Encoding.Unicode);
                              //bll.ToCSV(dt, sw, true);
                              bll.ExportToExcel(dt, FileName);
                              MessageBox.Show("Export to Excel : " + FileName, "Thông báo");
                              bll.OpenExcel(FileName);
                          }
                      }
                      else
                      {
                          MessageBox.Show("Không có dữ liệu", "Mess", MessageBoxButton.OK, MessageBoxImage.Warning);
                      }
                  }
              }
            }
            catch (Exception ex)
            {
                MessageBox.Show("Error \n" + ex.Message, "Mess", MessageBoxButton.OK, MessageBoxImage.Error);
            }
            finally
            {
                cls.DongKetNoi();
            }
        }
Exemplo n.º 14
0
        private void bntOk_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                bll.TaoThuMuc(Thumuc);
                cls.ClsConnect();
                int      thamso = 2;
                string[] bien   = new string[thamso];
                object[] giatri = new object[thamso];
                bien[0] = "@Ngay";
                if (dtpNgay.SelectedDate != null)
                {
                    giatri[0] = dtpNgay.SelectedDate.Value.ToString("yyyy-MM-dd");
                    bien[1]   = "@MaPos";
                    giatri[1] = bll.Left(cboPos.SelectedValue.ToString().Trim(), 6);
                    //MessageBox.Show(giatri[0] + "   " + giatri[1]);
                    //dt = cls.LoadDataProcPara("usp_KHB", bien, giatri, thamso);
                    dt1 = cls.LoadDataProcPara("usp_khb1", bien, giatri, thamso);
                    //dt2 = cls.LoadDataProcPara("usp_khb2", bien, giatri, thamso);
                    rpt_khb1 rpt1 = new rpt_khb1();
                    RPUtility.ShowRp(rpt1, dt1, this, srv.DbSourceSerVer(), srv.DbNameSerVer(), srv.DbUserSerVer(), srv.DbPassSerVer());
                    //rpt_khb2 rpt2 = new rpt_khb2();
                    //RPUtility.ShowRp(rpt2, dt2, this, srv.DbSourceSerVer(), srv.DbNameSerVer(), srv.DbUserSerVer(), srv.DbPassSerVer());
                    dt3 = cls.LoadDataProcPara("usp_khb3", bien, giatri, thamso);
                    rpt_khb3 rpt3 = new rpt_khb3();
                    RPUtility.ShowRp(rpt3, dt3, this, srv.DbSourceSerVer(), srv.DbNameSerVer(), srv.DbUserSerVer(), srv.DbPassSerVer());

                    dt4 = cls.LoadDataProcPara("usp_KHB4", bien, giatri, thamso);
                    rpt_khb4 rpt4 = new rpt_khb4();
                    RPUtility.ShowRp(rpt4, dt4, this, srv.DbSourceSerVer(), srv.DbNameSerVer(), srv.DbUserSerVer(), srv.DbPassSerVer());

                    // FileName = Thumuc + "\\KHB03_" + dtpNgay.SelectedDate.Value.ToString("ddMMyyyy") + ".xlsx";
                }
                // bll.WriteDataTableToExcel(dt2, "Person Details", FileName, "Details");
                // MessageBox.Show("Copy Excel to : " + FileName);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Error", MessageBoxButton.OK, MessageBoxImage.Error);
            }
            finally
            {
                cls.DongKetNoi();
            }
        }
Exemplo n.º 15
0
 private void btnOk_Click(object sender, RoutedEventArgs e)
 {
     cls.ClsConnect();
     try
     {
         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("yyyy-MM-dd");
         }
         else
         {
             MessageBox.Show("Chọn Ngày", "Mess");
             return;
         }
         if (Ration1.IsChecked == true)
         {
             dt = cls.LoadDataProcPara("usp_Ptsl", bien, giatri, thamso);
         }
         else
         {
             dt = cls.LoadDataProcPara("usp_Ptslct", bien, giatri, thamso);
         }
         if (dt.Rows.Count > 0)
         {
             rpt_Ptsl rpt = new rpt_Ptsl();
             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");
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
     cls.DongKetNoi();
 }
Exemplo n.º 16
0
        private void btnOk_Click(object sender, RoutedEventArgs e)
        {
            cls.ClsConnect();
            DataTable dt     = new DataTable();
            int       thamso = 4;

            string[] bien   = new string[thamso];
            object[] giatri = new object[thamso];
            bien[0]   = "@MaPos";
            giatri[0] = str.Left(CboPos.SelectedValue.ToString().Trim(), 6);
            bien[1]   = "@Ngay";
            if (dtpNgay.SelectedDate == null)
            {
                MessageBox.Show("Chưa chọn ngày", "Thông báo", MessageBoxButton.OK, MessageBoxImage.Error);
                return;
            }
            else
            {
                giatri[1] = dtpNgay.SelectedDate.Value.ToString("dd/MM/yyyy");
            }
            bien[2]   = "@MaXa";
            giatri[2] = str.Left(CboXa.SelectedValue.ToString().Trim(), 6);
            bien[3]   = "@Mau";
            if (radioButton1.IsChecked == true)
            {
                giatri[3] = '1';
            }
            else
            {
                giatri[3] = '2';
            }
            dt = cls.LoadDataProcPara("usp_Pnkt", bien, giatri, thamso);
            if (dt.Rows.Count > 0)
            {
                if (radioButton1.IsChecked == true)
                {
                    FileName = Thumuc + "\\" + str.Left(CboPos.SelectedValue.ToString().Trim(), 6) + "_PNKT_" +
                               dtpNgay.SelectedDate.Value.ToString("ddMMyyyy_") + str.Right(CboXa.SelectedValue.ToString().Trim(), 2) + ".csv";
                }
                else
                {
                    FileName = Thumuc + "\\" + str.Left(CboPos.SelectedValue.ToString().Trim(), 6) + "_CHTRINH_" +
                               dtpNgay.SelectedDate.Value.ToString("ddMMyyyy_") + str.Right(CboXa.SelectedValue.ToString().Trim(), 2) + ".csv";
                }
                FileStream   fs = new FileStream(FileName, FileMode.Create);
                StreamWriter sw = new StreamWriter(fs, Encoding.Unicode);
                //bll.WriteDataTableToExcel(dt, "Details", FileName, "tutm : 0985165777");
                str.ToCSV(dt, sw, true);
                MessageBox.Show("Copy Excel to : " + FileName, "Thông báo", MessageBoxButton.OK, MessageBoxImage.Information);
            }
            else
            {
                MessageBox.Show("Chưa có số liệu", "Thông báo");
            }
            cls.DongKetNoi();
        }
Exemplo n.º 17
0
        private void LblGetData_OnMouseDown(object sender, MouseButtonEventArgs e)
        {
            ChkAll.IsChecked = false;
            cls.ClsConnect();
            try
            {
                int      thamso = 4;
                string[] bien   = new string[thamso];
                object[] giatri = new object[thamso];
                bien[0] = "@Mato";
                if (CboTo != null)
                {
                    giatri[0] = str.Left(CboTo.SelectedValue.ToString().Trim(), 7);
                }
                else
                {
                    MessageBox.Show("Chọn Tổ", "Mess");
                    return;
                }
                bien[1] = "@Ngay";
                if (dtpNgay.SelectedDate.Value == null)
                {
                    MessageBox.Show("Chưa chọn ngày ", "Thông báo", MessageBoxButton.OK, MessageBoxImage.Error);
                    return;
                }
                else
                {
                    giatri[1] = dtpNgay.SelectedDate.Value.ToString("yyyy-MM-dd");
                }

                bien[2] = "@Mau";
                if (Opt1.IsChecked == true || Opt2.IsChecked == true)
                {
                    giatri[2] = "0";
                }
                else
                {
                    giatri[2] = "1";
                }
                bien[3]   = "@MaPos";
                giatri[3] = str.Left(CboPos.SelectedValue.ToString().Trim(), 6);
                dt        = cls.LoadDataProcPara("usp_DongCasa", bien, giatri, thamso);
                if (dt.Rows.Count > 0)
                {
                    dgvData.ItemsSource = dt.DefaultView;
                }
                else
                {
                    MessageBox.Show("Không có bản ghi nào ", "Mess");
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
Exemplo n.º 18
0
        private void LblGetData_OnMouseDown(object sender, MouseButtonEventArgs e)
        {
            try
            {
                cls.ClsConnect();
                int      thamso = 5;
                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";
                }
                bien[4]   = "@GhiChu";
                giatri[4] = txtGhiChu.Text.Trim();

                dt = cls.LoadDataProcPara("usp_ChamCong", bien, giatri, thamso);
                //rpt_kt740_01 rpt = new rpt_kt740_01();
                if (dt.Rows.Count > 0)
                {
                    dgvSource.ItemsSource = dt.DefaultView;
                    txtGhiChu.Text        = dt.Rows[0]["GHICHU"].ToString();
                    // rpt_SkeTo rpt = new rpt_SkeTo();
                    // RPUtility.ShowRp(rpt, dt, this, srv.DbSourceSerVer(), srv.DbNameSerVer(), srv.DbUserSerVer(),srv.DbPassSerVer());
                    // string filename = "C:\\Tam\\" + str.Left(cboTo.SelectedValue.ToString().Trim(), 7) + ".xlsx";
                    // bll.WriteDataTableToExcel(dt, "Person Details", filename, "Details");
                    //dtNew = dt.GetChanges();
                }
                else
                {
                    MessageBox.Show("Chưa có số liệu", "Thông báo");
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("Chưa chọn Phòng / Tổ " + ex.Message, "Thông báo", MessageBoxButton.OK, MessageBoxImage.Warning);
            }
            cls.DongKetNoi();
        }
Exemplo n.º 19
0
        private void btnSua_Click(object sender, RoutedEventArgs e)
        {
            string strup = "";

            try
            {
                cls.ClsConnect();
                dtNew = dt.GetChanges();
                if (dtNew == null || dtNew.Rows.Count == 0)
                {
                    MessageBox.Show("Chưa có thay đổi ngày nào !", "Thông báo", MessageBoxButton.OK, MessageBoxImage.Warning);
                }
                else
                {
                    foreach (DataRow dr in dtNew.Rows)
                    {
                        //strup = "insert into TSCC_HIS SELECT *,@Ngay NG_DG_SC,'' LYDO,'' DENGHI ,'0' MNV,@Ngay NG_BAOTRI FROM LUU_TSCC WHERE MA_TS = @MaTs";
                        if ((bool)dr["DG_BAOTRI"])
                        {
                            strup = "update LUU_TSCC set DG_BAOTRI=1,NG_DG_BAOTRI='" + DateTime.Now.ToString("yyyy-MM-dd") + "' where MA_TS='" + dr["MA_TS"] + "'";
                        }
                        else
                        {
                            strup = "update LUU_TSCC set DG_BAOTRI=0,NG_DG_BAOTRI='' where MA_TS='" + dr["MA_TS"] + "'";
                        }
                        cls.UpdateDataText(strup);
                    }
                    MessageBox.Show("Cập nhật thành công !", "Thông báo", MessageBoxButton.OK, MessageBoxImage.Information);
                }
                int      thamso = 2;
                string[] bien   = new string[thamso];
                object[] giatri = new object[thamso];
                bien[0]   = "@Ngay";
                giatri[0] = dtpNgay.SelectedDate.Value.ToString("yyyy-MM-dd");
                bien[1]   = "@Phong";
                giatri[1] = CboPhong.SelectedValue.ToString().Trim();
                var dtin = cls.LoadDataProcPara("usp_TSCC_BAOTRI", bien, giatri, thamso);
                if (dtin.Rows.Count > 0)
                {
                    rpt_TSCC_Hist rpt = new rpt_TSCC_Hist();
                    RPUtility.ShowRp(rpt, dtin, 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, "Lỗi", MessageBoxButton.OK, MessageBoxImage.Error);
            }
            cls.DongKetNoi();
        }
Exemplo n.º 20
0
 private void LoadGrid()
 {
     try
     {
         cls.ClsConnect();
         int      thamso = 2;
         string[] bien   = new string[thamso];
         object[] giatri = new object[thamso];
         bien[0]   = "@Mato";
         giatri[0] = bll.Left(CboTo.SelectedValue.ToString().Trim(), 7);
         bien[1]   = "@Ngay";
         if (dtpNgay.SelectedDate != null)
         {
             giatri[1] = dtpNgay.SelectedDate.Value.ToString("yyyy-MM-dd");
         }
         else
         {
             MessageBox.Show("Chưa chọn ngày ", "Mess");
             return;
         }
         dt = cls.LoadDataProcPara("usp_01TG", bien, giatri, thamso);
         //rpt_kt740_01 rpt = new rpt_kt740_01();
         if (dt.Rows.Count > 0)
         {
             dgvSource.ItemsSource = dt.DefaultView;
             // rpt_SkeTo rpt = new rpt_SkeTo();
             // RPUtility.ShowRp(rpt, dt, this, srv.DbSourceSerVer(), srv.DbNameSerVer(), srv.DbUserSerVer(),srv.DbPassSerVer());
             // string filename = "C:\\Tam\\" + str.Left(cboTo.SelectedValue.ToString().Trim(), 7) + ".xlsx";
             // bll.WriteDataTableToExcel(dt, "Person Details", filename, "Details");
             //dtNew = dt.GetChanges();
         }
         else
         {
             MessageBox.Show("Chưa có số liệu", "Thông báo");
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
     cls.DongKetNoi();
 }
Exemplo n.º 21
0
 private void BtnOk_OnClick(object sender, RoutedEventArgs e)
 {
     try
     {
         if (dtNew.Rows.Count > 0)
         {
             cls.ClsConnect();
             foreach (DataRow dr in dtNew.Rows)
             {
                 //MessageBox.Show(dr["NG_MATO"].ToString()+"      "+dr["A01"].ToString());
                 string strsql = "update NGUON_TT set A01=" + dr["A01"] + ",A02=" + dr["A02"] + ",A03=" +
                                 dr["A03"] + ",A03CS=" + dr["A03CS"] + ",A04=" + dr["A04"] + ",A06=" + dr["A06"] + ",A07=" + dr["A07"]
                                 + ",A08=" + dr["A08"] + ",A09=" + dr["A09"] + ",A10=" + dr["A10"] + ",A11=" +
                                 dr["A11"] + ",A15=" + dr["A15"] + ",A16=" + dr["A16"] + ",A17=" + dr["A17"] +
                                 ",A18=" + dr["A18"] + ",A19=" + dr["A19"] + ",B03T=" + dr["B03T"]
                                 + ",B03H=" + dr["B03H"] + ",B19T=" + dr["B19T"] + ",B19H=" + dr["B19H"] + ",TGXA=" + dr["TGXA"] + ",NG_TONG=" + dr["NG_TONG"]
                                 + " where NG_MAXA='" + dr["NG_MAXA"].ToString().Trim() + "'";
                 cls.UpdateDataText(strsql);
             }
             MessageBox.Show("Update Ok", "Mess", MessageBoxButton.OK, MessageBoxImage.Information);
             if (
                 MessageBox.Show("Có muốn in số liệu ra không ?", "Question", MessageBoxButton.YesNo,
                                 MessageBoxImage.Warning) == MessageBoxResult.Yes)
             {
                 cls.ClsConnect();
                 int      thamso = 1;
                 string[] bien   = new string[thamso];
                 object[] giatri = new object[thamso];
                 bien[0]   = "@MaPos";
                 giatri[0] = s.Left(CboPos.SelectedValue.ToString().Trim(), 6);
                 var          dtin = cls.LoadDataProcPara("usp_InNguon_TT", bien, giatri, thamso);
                 rpt_Nguon_UT rpt  = new rpt_Nguon_UT();
                 RPUtility.ShowRp(rpt, dtin, this, srv.DbSourceSerVer(), srv.DbNameSerVer(), srv.DbUserSerVer(), srv.DbPassSerVer());
             }
             dtNew.Clear();
             //dgvTarGet.ItemsSource = dtNew.DefaultView;
         }
         else
         {
             MessageBox.Show("Xem lại. Chưa có dữ liệu", "Mess", MessageBoxButton.OK, MessageBoxImage.Warning);
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show("Error \n" + ex.Message, "Mess", MessageBoxButton.OK, MessageBoxImage.Error);
     }
     finally
     {
         cls.DongKetNoi();
     }
 }
Exemplo n.º 22
0
        private void btnChapNhan_Click(object sender, RoutedEventArgs e)
        {
            DataTable dt = new DataTable();

            cls.ClsConnect();
            int thamso = 4;

            string[] bien   = new string[thamso];
            object[] giatri = new object[thamso];
            bien[0]   = "@ngay";
            giatri[0] = dtpNgay.SelectedDate.Value.ToString("dd/MM/yyyy");
            bien[1]   = "@MaXa";
            giatri[1] = bll.Left(cboXa.SelectedValue.ToString(), 6);
            bien[2]   = "@StartDate";
            giatri[2] = dtpStartDate.SelectedDate.Value.ToString("dd/MM/yyyy");
            bien[3]   = "@EndDate";
            giatri[3] = dtpEndDate.SelectedDate.Value.ToString("dd/MM/yyyy");
            MessageBox.Show(giatri[0].ToString() + giatri[1].ToString() + giatri[2].ToString() + giatri[3].ToString());
            if (opt01.IsChecked.Value == true)
            {
                dt = cls.LoadDataProcPara("usp_DanhSach01", bien, giatri, thamso);
            }
            else
            {
                dt = cls.LoadDataProcPara("usp_DanhSach19", bien, giatri, thamso);
            }
            int dem = dt.Rows.Count;

            if (dem <= 0)
            {
                MessageBox.Show("Không có khách hàng nào");
            }
            else
            {
                rpt_DanhSach rpt = new rpt_DanhSach();
                RPUtility.ShowRp(rpt, dt, this, srv.DbSourceSerVer(), srv.DbNameSerVer(), srv.DbUserSerVer(), srv.DbPassSerVer());
            }
        }
Exemplo n.º 23
0
 private void btnOK_Click(object sender, RoutedEventArgs e)
 {
     try
     {
         cls.ClsConnect();
         int      thamso = 2;
         string[] bien   = new string[thamso];
         object[] giatri = new object[thamso];
         bien[0] = "@Ngay";
         if (dtpNgay.SelectedDate != null)
         {
             giatri[0] = dtpNgay.SelectedDate.Value.ToString("yyyy-MM-dd");
         }
         bien[1]   = "@MaPos";
         giatri[1] = _str.Left(CboPos.SelectedValue.ToString().Trim(), 6);
         var dt = cls.LoadDataProcPara("usp_ChotNguon", bien, giatri, thamso);
         //dataGrid.ItemsSource = dt.DefaultView;
         if (dt.Rows.Count > 0)
         {
             foreach (DataRow dr in dt.Rows)
             {
                 //MessageBox.Show(dr["NG_MATO"].ToString()+"      "+dr["A01"].ToString());
                 string strsql = "update NGUON_UT set A01=" + dr["A01"] + ",A02=" + dr["A02"] + ",A03=" +
                                 dr["A03"] + ",A04=" + dr["A04"] + ",A06=" + dr["A06"] + ",A07=" + dr["A07"]
                                 + ",A09=" + dr["A09"] + ",A10=" + dr["A10"] + ",A11=" +
                                 dr["A11"] + ",A15=" + dr["A15"] + ",A16=" + dr["A16"] + ",A17=" + dr["A17"] +
                                 ",A18=" + dr["A18"] + ",A19=" + dr["A19"] + ",B03T=" + dr["B03T"]
                                 + ",B03H=" + dr["B03H"] + ",B19T=" + dr["B19T"] + ",B19H=" + dr["B19H"]
                                 + " where NG_MATO='" + dr["KU_MATO"].ToString().Trim() + "'";
                 cls.UpdateDataText(strsql);
                 //MessageBox.Show(strsql);
             }
             if (dtpNgay.SelectedDate != null)
             {
                 string str = "update NGUON_UT set NGAY=" + dtpNgay.SelectedDate.Value.ToString("yyyy-MM-dd") + " where NG_MAPGD='" + _str.Left(CboPos.SelectedValue.ToString().Trim(), 6) + "'";
                 cls.UpdateDataText(str);
             }
             MessageBox.Show("Update Ok", "Mess", MessageBoxButton.OK, MessageBoxImage.Information);
         }
         else
         {
             MessageBox.Show("Xem lại. Chưa có dữ liệu", "Mess", MessageBoxButton.OK, MessageBoxImage.Warning);
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show("Error " + ex.Message, "Mess", MessageBoxButton.OK, MessageBoxImage.Error);
     }
     cls.DongKetNoi();
 }
Exemplo n.º 24
0
 private void LblManual_OnMouseDown(object sender, MouseButtonEventArgs e)
 {
     try
     {
         _cls.ClsConnect();
         int      thamso = 3;
         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");
         }
         bien[2]   = "@MaXa";
         giatri[2] = bll.Left(CboXa.SelectedValue.ToString().Trim(), 6);
         _dt       = _cls.LoadDataProcPara("usp_ChamDiemGDX", bien, giatri, thamso);
         if (_dt.Rows.Count > 0)
         {
             dgvTarGet.ItemsSource = _dt.DefaultView;
         }
         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();
     }
 }
Exemplo n.º 25
0
        private void btnOk_Click(object sender, RoutedEventArgs e)
        {
            // MessageBox.Show(BienBll.Ndma);
            ServerInfor srv = new ServerInfor();

            _cls.ClsConnect();
            int thamso = 3;

            string[] bien   = new string[thamso];
            object[] giatri = new object[thamso];
            bien[0] = "@Ngay";
            if (dtpNgay.SelectedDate != null)
            {
                giatri[0] = dtpNgay.SelectedDate.Value.ToString("yyyy-MM-dd");
            }
            bien[1]   = "@MaPos";
            giatri[1] = _str.Left(cboPos.SelectedValue.ToString().Trim(), 6);
            string mau = "";

            if (ration1.IsChecked == true)
            {
                mau = "1";
            }
            else if (ration2.IsChecked == true)
            {
                mau = "2";
            }
            else if (ration3.IsChecked == true)
            {
                mau = "3";
            }
            else
            {
                mau = "4";
            }
            bien[2]   = "@Mau";
            giatri[2] = mau;
            _dt       = _cls.LoadDataProcPara("usp_Khtc01", bien, giatri, thamso);
            if (_dt.Rows.Count > 0)
            {
                rpt_Khtc01 rpt = new rpt_Khtc01();
                RPUtility.ShowRp(rpt, _dt, this, srv.DbSourceSerVer(), srv.DbNameSerVer(), srv.DbUserSerVer(), srv.DbPassSerVer());
            }
            else
            {
                MessageBox.Show("Chưa có số liệu", "Thông báo");
            }
            _cls.DongKetNoi();
        }
Exemplo n.º 26
0
        private void btnOk_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                cls.ClsConnect();

                int      thamso = 3;
                string[] bien   = new string[thamso];
                object[] giatri = new object[thamso];
                bien[0]   = "@MaPos";
                giatri[0] = str.Left(CboPos.SelectedValue.ToString().Trim(), 6);
                bien[1]   = "@Ngay";
                if (dtpNgay.SelectedDate == null)
                {
                    MessageBox.Show("Chưa chọn ngày", "Thông báo", MessageBoxButton.OK, MessageBoxImage.Error);
                    return;
                }
                else
                {
                    giatri[1] = dtpNgay.SelectedDate.Value.ToString("yyyy-MM-dd");
                }
                bien[2]   = "@MaXa";
                giatri[2] = str.Left(CboXa.SelectedValue.ToString().Trim(), 6);
                //----------------------------------
                dt = cls.LoadDataProcPara("usp_SkeNqh", bien, giatri, thamso);
                if (dt.Rows.Count > 0)
                {
                    FileName = Thumuc + "\\" + str.Left(CboPos.SelectedValue.ToString().Trim(), 6) + "_" + str.Left(CboXa.SelectedValue.ToString().Trim(), 6) + "_SKE_NQH_" + dtpNgay.SelectedDate.Value.ToString("ddMMyyyy") + ".csv";
                    FileStream   fs = new FileStream(FileName, FileMode.Create);
                    StreamWriter sw = new StreamWriter(fs, Encoding.Unicode);
                    str.ToCSV(dt, sw, true);
                    MessageBox.Show("OK đã xuất file Excel " + FileName, "Mess", MessageBoxButton.OK,
                                    MessageBoxImage.Information);

                    //str.ExportToExcel(dt, FileName);
                    //bll.ExportDTToExcel(dt,FileName);
                    //bll.WriteDataTableToExcel(dt, "Details", FileName, "tutm : 0985165777");
                }
                else
                {
                    MessageBox.Show(str.Left(CboXa.SelectedValue.ToString().Trim(), 6) + " Không có nợ quá hạn", "Thông báo", MessageBoxButton.OK, MessageBoxImage.Warning);
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Error", MessageBoxButton.OK, MessageBoxImage.Error);
            }
            cls.DongKetNoi();
        }
Exemplo n.º 27
0
        private void btnOk_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                cls.ClsConnect();
                int      thamso = 3;
                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");
                }
                if (giatri[1] == null)
                {
                    MessageBox.Show("Chưa chọn ngày : ", "Mess");
                    return;
                }
                bien[2]   = "@MaXa";
                giatri[2] = bll.Left(CboXa.SelectedValue.ToString().Trim(), 6);
                var dt = cls.LoadDataProcPara(ChkTh.IsChecked == true ? "usp_TLGDXA_TH" : "usp_TLGDXA", bien, giatri, thamso);

                if (dt.Rows.Count > 0)
                {
                    if (ChkTh.IsChecked == true)
                    {
                        rpt_TLGDXA_TH rpt = new rpt_TLGDXA_TH();
                        RPUtility.ShowRp(rpt, dt, this, srv.DbSourceSerVer(), srv.DbNameSerVer(), srv.DbUserSerVer(),
                                         srv.DbPassSerVer());
                    }
                    else
                    {
                        rpt_TLGDXA rpt = new rpt_TLGDXA();
                        RPUtility.ShowRp(rpt, dt, this, srv.DbSourceSerVer(), srv.DbNameSerVer(), srv.DbUserSerVer(), srv.DbPassSerVer());
                    }
                }
                else
                {
                    MessageBox.Show("Không có dữ liệu ", "Mess");
                }
                cls.DongKetNoi();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
Exemplo n.º 28
0
        //private BackgroundWorker _worker;

        private void OK_OnClick(object sender, RoutedEventArgs e)
        {
            try
            {
                //_dt = _cls.LoadDataText("select * from HSKH");

                for (int i = 1; i <= dtpNgay.SelectedDate.Value.Month; i++)
                {
                    for (int j = 1; j < 31; j++)
                    {
                        _cls.ClsConnect();
                        //string ngay = bll.Right(dtpNgay.SelectedDate.Value.ToString("dd/MM/yyyy"), 4) + "-" + i.ToString("00") + "-" + j.ToString("00") ;
                        //string sql = "delete from QT_HSTG where NGAYBC='"+ngay+"'";
                        //MessageBox.Show(sql);
                        //_cls.UpdateDataText(sql);
                        const int thamso = 1;
                        string[]  bien   = new string[thamso];
                        object[]  giatri = new object[thamso];
                        bien[0] = "@Ngay";
                        if (dtpNgay.SelectedDate != null)
                        {
                            giatri[0] = dtpNgay.SelectedDate.Value.ToString("yyyy-MM-dd");
                        }
                        //MessageBox.Show(giatri[0].ToString() + "   " + giatri[1].ToString());
                        _cls.LoadDataProcPara("usp_PSSL", bien, giatri, thamso);

                        _cls.DongKetNoi();
                    }
                }
                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();
            }

            /*
             * _worker = new BackgroundWorker { WorkerReportsProgress = true };
             * //_worker.DoWork += (obj, ea)=>ProgressOk();
             * _worker.DoWork += ProgressOk;//new DoWorkEventHandler(ProgressOk);
             * _worker.ProgressChanged += ProgressReport;
             * _worker.RunWorkerCompleted += WorkerComplete;
             * _worker.RunWorkerAsync();
             */
        }
Exemplo n.º 29
0
        private void btnOK_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                cls.ClsConnect();
                int      thamso = 3;
                string[] bien   = new string[thamso];
                object[] giatri = new object[thamso];
                bien[0]   = "@MaPos";
                giatri[0] = str.Left(CboPos.SelectedValue.ToString().Trim(), 6);
                bien[1]   = "@Ngay";
                if (dtpNgay.SelectedDate != null)
                {
                    giatri[1] = dtpNgay.SelectedDate.Value.ToString("yyyy-MM-dd");
                }
                bien[2] = "@Mau";
                if (Ration1.IsChecked != null && (bool)Ration1.IsChecked)
                {
                    giatri[2] = "1";
                }
                else if (Ration2.IsChecked != null && (bool)Ration2.IsChecked)
                {
                    giatri[2] = "2";
                }
                else
                {
                    giatri[2] = "3";
                }

                // MessageBox.Show(giatri[0]+","+giatri[1] + ","+giatri[2] + ","+giatri[3] + ","+giatri[4]);
                dt = cls.LoadDataProcPara("usp_TGTKTO", bien, giatri, thamso);
                if (dt.Rows.Count > 0)
                {
                    rpt_TGTKTO01 rpt = new rpt_TGTKTO01();
                    RPUtility.ShowRp(rpt, dt, this, srv.DbSourceSerVer(), srv.DbNameSerVer(),
                                     srv.DbUserSerVer(), srv.DbPassSerVer());
                }
                else
                {
                    MessageBox.Show("Chưa có số liệu", "Thông báo");
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
            cls.DongKetNoi();
        }
Exemplo n.º 30
0
 private void lblXem_OnMouseDown(object sender, MouseButtonEventArgs e)
 {
     try
     {
         cls.ClsConnect();
         DataTable dt     = new DataTable();
         int       thamso = 2;
         string[]  bien   = new string[thamso];
         object[]  giatri = new object[thamso];
         bien[0] = "@Ngay";
         bien[1] = "@Makh";
         if (dtpNgay.SelectedDate == null)
         {
             MessageBox.Show("Chưa chọn ngày", "Thông báo", MessageBoxButton.OK, MessageBoxImage.Error);
             return;
         }
         else
         {
             giatri[0] = dtpNgay.SelectedDate.Value.ToString("yyyy-MM-dd");
         }
         if (txtMakh.Text == null)
         {
             MessageBox.Show("Chưa nhập MAKH", "Thông báo", MessageBoxButton.OK, MessageBoxImage.Error);
             return;
         }
         else
         {
             giatri[1] = txtMakh.Text.Trim();
         }
         dt = cls.LoadDataProcPara("usp_TTKH", bien, giatri, thamso);
         if (dt.Rows.Count > 0)
         {
             rpt_TTKH rpt = new rpt_TTKH();
             RPUtility.ShowRp(rpt, dt, this, srv.DbSourceSerVer(), srv.DbNameSerVer(), srv.DbUserSerVer(), srv.DbPassSerVer());
         }
         else
         {
             MessageBox.Show("Không có thông tin khách hàng !", "Thông báo");
         }
         cls.DongKetNoi();
     }
     catch (Exception ex)
     {
         MessageBox.Show("Error " + ex.Message, "Mess", MessageBoxButton.OK, MessageBoxImage.Error);
     }
 }