Beispiel #1
0
 private void CboPos_SelectionChanged(object sender, SelectionChangedEventArgs e)
 {
     try
     {
         //MessageBox.Show(bll.Left(cboPos.SelectedValue.ToString().Trim(),6));
         CboPB.Items.Clear();
         cls.ClsConnect();
         if (bll.Left(CboPos.SelectedValue.ToString().Trim(), 6) == BienBll.MainPos.Trim())
         {
             dtxa = cls.LoadDataText("select * from DM_PHONGBAN where MA in ('18','19','20','21','22') order by MA");
         }
         else
         {
             dtxa = cls.LoadDataText("select * from DM_PHONGBAN where MA in ('29','30','31') order by MA");
         }
         for (int i = 0; i < dtxa.Rows.Count; i++)
         {
             CboPB.Items.Add(dtxa.Rows[i][0].ToString().Trim() + " | " + dtxa.Rows[i][1]);
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show("Tiếp tục" + ex.Message, "Mess");
     }
     cls.DongKetNoi();
 }
Beispiel #2
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();
 }
Beispiel #3
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_NVKHBIN", bien, giatri, thamso);
            if (_dt.Rows.Count > 0)
            {
                rpt_NVKHB rpt = new rpt_NVKHB();
                RPUtility.ShowRp(rpt, _dt, this, srv.DbSourceSerVer(), srv.DbNameSerVer(), srv.DbUserSerVer(), srv.DbPassSerVer());
                //FileName = Thumuc + "\\" + giatri[1] + "_PHI_KHB_" + 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();
        }
Beispiel #4
0
        private void BtnOk_OnClick(object sender, RoutedEventArgs e)
        {
            try
            {
                cls.ClsConnect();
                string pos   = s.Left(CboPos.SelectedValue.ToString(), 6);
                string thang = dtpNgay.SelectedDate.Value.ToString("MM");
                string nam   = dtpNgay.SelectedDate.Value.ToString("yyyy");
                dtNew = dt.GetChanges();
                if (dtNew != null && dtNew.Rows.Count > 0)
                {
                    foreach (DataRow dr in dtNew.Rows)
                    {
                        //MessageBox.Show(dr["NG_MATO"].ToString()+"      "+dr["A01"].ToString());
                        string strsql = "update LUUKTNB set COT03=" + dr["COT03"] + ",COT04=" + dr["COT04"] + ",COT05=" + dr["COT05"]
                                        + ",COT06=" + dr["COT06"] + ",COT07=" + dr["COT07"]
                                        + ",COT08=" + dr["COT08"] + ",COT09=" + dr["COT09"] + ",COT10=" + dr["COT10"] + ",COT11=" +
                                        dr["COT11"] + ",COT12=" + dr["COT12"] + ",COT13=" + dr["COT13"] + ",COT14=" + dr["COT14"] +
                                        ",COT15=" + dr["COT15"] + ",COT16=" + dr["COT16"] + ",COT17=" + dr["COT17"]
                                        + ",ND_MA='" + BienBll.Ndma + "',ND_TEN=N'" + BienBll.NdTen + "'"
                                        + " where MAPOS='" + pos + "' and TT='" + dr["TT"] + "' and THANG='" + thang + "' and NAM='" + nam + "' and MAU='2'";
                        cls.UpdateDataText(strsql);
                    }
                }
                else
                {
                    MessageBox.Show("Xem lại. Chưa có thay đổi nào!", "Mess", MessageBoxButton.OK, MessageBoxImage.Warning);
                }
                string strup = "update LUUKTNB set COT05= (case when COT03>0 then COT04*100/COT03 else 0 end)" +
                               ",COT08=(case when COT06>0 then COT07*100/COT06 else 0 end) " +
                               ",COT11=(case when COT09>0 then COT10*100/COT09 else 0 end) " +
                               ",COT14=(case when COT12>0 then COT13*100/COT12 else 0 end) " +
                               ",COT17=(case when COT15>0 then COT16*100/COT15 else 0 end) " +
                               "where MAPOS='" + pos + "' and THANG='" + thang + "' and NAM='" + nam + "' and MAU='2'";
                cls.UpdateDataText(strup);
                if (Option1.IsChecked == true)
                {
                    strin = "select * from LUUKTNB where MAPOS='" + pos + "' and THANG='" + thang +
                            "' and NAM='" + nam + "' and MA='H' and MAU='2' order by TT";
                }
                else
                {
                    strin = "select * from LUUKTNB where MAPOS='" + pos + "' and THANG='" + thang +
                            "' and NAM='" + nam + "' and MA='T' and MAU='2'  order by TT";
                }

                var dtin =
                    cls.LoadDataText(strin);
                rpt_KTNB01 rpt = new rpt_KTNB01();
                RPUtility.ShowRp(rpt, dtin, this, srv.DbSourceSerVer(), srv.DbNameSerVer(), srv.DbUserSerVer(), srv.DbPassSerVer());
            }
            catch (Exception ex)
            {
                MessageBox.Show("Error \n" + ex.Message, "Mess", MessageBoxButton.OK, MessageBoxImage.Error);
            }
            finally
            {
                cls.DongKetNoi();
            }
        }
Beispiel #5
0
 private void OK_OnClick(object sender, RoutedEventArgs e)
 {
     try
     {
         _cls.ClsConnect();
         foreach (DataRow dr in _dt.Rows)
         {
             string strup = "update MAU_THIDUA set DIEM='" + dr["DIEM"] + "',TT='" + dr["TT"] + "', CHITIEU= N'" + dr["CHITIEU"]
                            + "',INDAM='" + dr["INDAM"] + "',NGHIENG='" + dr["NGHIENG"] + "',CONG='" + dr["CONG"]
                            + "' where NAM='" + comboBoxYear.SelectedValue + "' and QUY='" + CboQuy.SelectionBoxItem.ToString().Trim()
                            + "' and DOT='" + bll.Left(RadCboDot.SelectedValue.ToString(), 1) + "' and STT=" + dr["STT"]
                            + " and CHUYENDE='" + RadCboChDe.SelectedValue.ToString().Trim() + "'";
             //MessageBox.Show(strup);
             _cls.UpdateDataText(strup);
         }
         MessageBox.Show("Lưu thành công !", "Mess", MessageBoxButton.OK, MessageBoxImage.Information);
     }
     catch (Exception ex)
     {
         MessageBox.Show("Error \n" + ex.Message, "Mess", MessageBoxButton.OK, MessageBoxImage.Error);
     }
     finally
     {
         _cls.DongKetNoi();
     }
 }
Beispiel #6
0
 private void CboPB_SelectionChanged(object sender, System.Windows.Controls.SelectionChangedEventArgs e)
 {
     try
     {
         dtpNgay.SelectedDate = DateTime.Now;
         cls.ClsConnect();
         string str = "select cast(0 as bit) CHON,a.* from DM_CANBO a where ND_MADV='" + s.Left(CboPos.SelectedValue.ToString().Trim(), 6) +
                      "' and a.ND_PHONGBAN='" + s.Left(CboPB.SelectedValue.ToString().Trim(), 2) + "' and a.ND_TTHAI<>'C' order by a.STT";
         //MessageBox.Show(str);
         dt = cls.LoadDataText(str);
         if (dt.Rows.Count > 0)
         {
             dgvData.ItemsSource = dt.DefaultView;
         }
         else
         {
             MessageBox.Show("Chưa có số liệu", "Thông báo");
         }
         cls.DongKetNoi();
     }
     catch (Exception ex)
     {
         MessageBox.Show("Tiếp tục" + ex.Message, "Mess");
     }
     cls.DongKetNoi();
 }
        private void btnOK_Click(object sender, RoutedEventArgs e)
        {
            ClsServer cls = new ClsServer();

            try
            {
                cls.ClsConnect();
                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]   = "@MaPos";
                giatri[1] = bll.Left(CboPos.SelectedValue.ToString().Trim(), 6);
                bien[2]   = "@MaXa";
                giatri[2] = bll.Left(CboXa.SelectedValue.ToString().Trim(), 6);
                bien[3]   = "@Nam";
                giatri[3] = comboBoxYear.SelectedValue.ToString().Trim();
                dt        = cls.LoadLdbf("usp_TTDSHN01", bien, giatri, thamso);
                rpt_ChkDoituong01 rpt = new rpt_ChkDoituong01();
                RPUtility.ShowRp(rpt, dt, this, srv.DbSourceSerVer(), srv.DbNameSerVer(), srv.DbUserSerVer(), srv.DbPassSerVer());

                //MessageBox.Show("Insert OK", "Thông báo", MessageBoxButton.OK, MessageBoxImage.Information);
            }
            catch (Exception ex)
            {
                MessageBox.Show("Error + " + ex.Message, "Error", MessageBoxButton.OK, MessageBoxImage.Error);
            }
        }
Beispiel #8
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] = str.Left(CboPos.SelectedValue.ToString().Trim(), 6);
       bien[1]   = "@MaXa";
       giatri[1] = str.Left(CboXa.SelectedValue.ToString().Trim(), 6);
       bien[2]   = "@Ngay";
       if (dtpNgay.SelectedDate != null)
       {
           giatri[2] = dtpNgay.SelectedDate.Value.ToString("yyyy-MM-dd");
       }
       dt = cls.LoadLdbf("usp_XLN_M1", bien, giatri, thamso);
       if (dt.Rows.Count > 0)
       {
           rpt_XLN_M1 rpt = new rpt_XLN_M1();
           RPUtility.ShowRp(rpt, dt, this, srv.DbSourceSerVer(), srv.DbNameSerVer(), srv.DbUserSerVer(), srv.DbPassSerVer());
       }
       else
       {
           MessageBox.Show("Không có khế ước nào đến hạn !", "Thông báo", MessageBoxButton.OK, MessageBoxImage.Warning);
       } }
     catch (Exception ex)
     {
         MessageBox.Show("Error \n" + ex.Message, "Mess", MessageBoxButton.OK, MessageBoxImage.Error);
     }
     finally
     {
         cls.DongKetNoi();
     }
 }
Beispiel #9
0
 private void CboPos_SelectionChanged(object sender, SelectionChangedEventArgs e)
 {
     try
     {
         if (bll.Left(CboPos.SelectedValue.ToString().Trim(), 6) != "003000")
         {
             CboXa.Items.Clear();
             cls.ClsConnect();
             //DataTable dtxa = new DataTable();
             string sql = "select MA,TEN from DMXA where PGD_QL= " +
                          bll.Left(CboPos.SelectedValue.ToString().Trim(), 6) + " order by MA";
             var dtxa = cls.LoadDataText(sql);
             for (int i = 0; i < dtxa.Rows.Count; i++)
             {
                 CboXa.Items.Add(dtxa.Rows[i][0] + " | " + dtxa.Rows[i][1]);
             }
         }
         else
         {
             CboXa.Items.Add("003000 | Tất cả");
         }
         CboXa.SelectedIndex = 0;
     }
     catch (Exception ex)
     {
         MessageBox.Show("Tiếp tục" + ex.Message, "Mess");
     }
 }
Beispiel #10
0
 private void btnOk_Click(object sender, RoutedEventArgs e)
 {
     str.TaoThuMuc(Thumuc);
     try
     {
         cls.ClsConnect();
         string strsql = "select a.PLN_MAPGD,(select PO_TEN from dmpos where po_ma=a.pln_mapgd) TENPOS"
                         + " , left(a.PLN_MADP, 6) MAXA,(select ten from dmxa where ma = left(a.PLN_MADP, 6)) TENXA "
                         + " ,a.PLN_MATO,a.PLN_TENTT,a.PLN_MAKH,a.PLN_TENKH,CHAR(39) + a.PLN_SOKU SOKU "
                         + " ,a.PLN_DNOTHAN,a.PLN_DNOQHAN,a.PLN_DNOKHOANH,a.PLN_K_KNTN_SODU from PLN_KNTN_CL a "
                         + " where a.PLN_NGAYBC = '2018-06-30' and a.PLN_TT_MONVAY <> 'CLOSE' and a.PLN_TRANGTHAI = 'S' and a.PLN_K_KNTN_SODU > 0 "
                         + " and a.PLN_K_KNTN_SD" + str.Left(CboNgNhan.SelectedValue.ToString(), 2) + ">0 order by a.PLN_MADP,a.PLN_MATO,a.PLN_MAKH";
         dt       = cls.LoadDataText(strsql);
         FileName = Thumuc + "\\" + str.Left(cboPos.SelectedValue.ToString(), 6) + "_" + CboNgNhan.SelectedValue.ToString().Substring(4, CboNgNhan.SelectedValue.ToString().Trim().Length - 4) + "_" + dtpNgay.SelectedDate.Value.ToString("ddMMyyyy") + ".csv";
         MessageBox.Show(FileName);
         str.ExportToExcel(dt, FileName);
         MessageBox.Show("Copy Excel to : " + FileName, "Thông báo", MessageBoxButton.OK, MessageBoxImage.Information);
         str.OpenExcel(FileName);
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
     cls.DongKetNoi();
 }
Beispiel #11
0
 private void CboPos_SelectionChanged(object sender, SelectionChangedEventArgs e)
 {
     try
     {
         //MessageBox.Show(str.Left(cboPos.SelectedValue.ToString().Trim(),6));
         if (bll.Left(CboPos.SelectedValue.ToString().Trim(), 6) != "003000")
         {
             CboXa.Items.Clear();
             cls.ClsConnect();
             string sql = "select MA,TEN from DMXA where PGD_QL= " + "'" +
                          bll.Left(CboPos.SelectedValue.ToString().Trim(), 6) + "' and right(MA,2)<>'00' order by MA";
             var dtxa = cls.LoadDataText(sql);
             for (int i = 0; i < dtxa.Rows.Count; i++)
             {
                 CboXa.Items.Add(dtxa.Rows[i][0] + " | " + dtxa.Rows[i][1]);
             }
         }
         else
         {
             // CboXa.Items.Add("003000 | Tất cả");
             MessageBox.Show("Không chọn POS 003000", "Mess", MessageBoxButton.OK, MessageBoxImage.Warning);
         }
         // CboXa.SelectedIndex = 0;
     }
     catch (Exception ex)
     {
         MessageBox.Show("Tiếp tục" + ex.Message, "Mess");
     }
     cls.DongKetNoi();
 }
Beispiel #12
0
 private void btnXoa_Click(object sender, RoutedEventArgs e)
 {
     try
     {
         cls.ClsConnect();
         string strchk = "select * from LUU_CAMERA where MAXA='" +
                         str.Left(CboXa.SelectedValue.ToString().Trim(), 6) + "' and THANG='" +
                         dtpNgay.SelectedDate.Value.ToString("MM") + "' and NAM='" + dtpNgay.SelectedDate.Value.ToString("yyyy") + "' and NGUOI_NHAP='" + BienBll.Ndma.ToUpper() + "'";
         var dtchk = cls.LoadDataText(strchk);
         if (dtchk.Rows.Count > 0)
         {
             string strdel = "delete from LUU_CAMERA where MAXA='" +
                             str.Left(CboXa.SelectedValue.ToString().Trim(), 6) + "' and THANG='" +
                             dtpNgay.SelectedDate.Value.ToString("MM") + "' and NAM='" +
                             dtpNgay.SelectedDate.Value.ToString("yyyy") + "' and NGUOI_NHAP='" +
                             BienBll.Ndma.ToUpper() + "'";
             cls.UpdateDataText(strdel);
             MessageBox.Show("Đã xóa thông tin xã : " + CboXa.SelectedValue, "Thông báo", MessageBoxButton.OK, MessageBoxImage.Warning);
         }
         else
         {
             MessageBox.Show("Không thể xóa vì chưa nhập thông tin !", "Thông báo", MessageBoxButton.OK, MessageBoxImage.Warning);
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show("Lỗi : " + ex.Message, "Error", MessageBoxButton.OK, MessageBoxImage.Error);
     }
     cls.DongKetNoi();
 }
Beispiel #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();
            }
        }
Beispiel #14
0
        private void btnOk_Click(object sender, RoutedEventArgs e)
        {
            #region

            try
            {
                cls.ClsConnect();
                int      thamso = 5;
                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);
                bien[2]   = "@MaXa";
                giatri[2] = str.Left(CboXa.SelectedValue.ToString().Trim(), 6);
                bien[3]   = "@Mau";
                if (Ration1.IsChecked == true)
                {
                    giatri[3] = "1";
                }
                else if (Ration2.IsChecked == true)
                {
                    giatri[3] = "2";
                }
                else
                {
                    giatri[3] = "3";
                }
                bien[4]   = "@Cqlv";
                giatri[4] = str.Left(CboCqlv.SelectedValue.ToString().Trim(), 2);

                dt = cls.LoadLdbf("usp_QlyGqvl", bien, giatri, thamso);
                if (dt.Rows.Count > 0)
                {
                    //rpt_QlyGqvl rpt = new rpt_QlyGqvl();
                    rpt_QlyGqvlNew rpt = new rpt_QlyGqvlNew();
                    RPUtility.ShowRp(rpt, dt, this, srv.DbSourceSerVer(), srv.DbNameSerVer(), srv.DbUserSerVer(), srv.DbPassSerVer());
                }

                else
                {
                    MessageBox.Show("Không có số liệu", "Thông báo", MessageBoxButton.OK, MessageBoxImage.Warning);
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
            cls.DongKetNoi();

            #endregion
        }
Beispiel #15
0
        private void btnIn_Click(object sender, RoutedEventArgs e)
        {
            cls.ClsConnect();
            string Nam = dtpNgay.SelectedDate.Value.ToString("yyyy");
            string Pos = bll.Left(CboPos.SelectedValue.ToString(), 6);
            string sql = "select mapos,manv,ten,qlc,stlv,l1,a1,l2,a2,l3,a3,l4,a4,l5,a5,l6,a6,l7,a7,l8,a8,l9,a9,l10,a10,l11,a11,l12,a12,phongto" +
                         " from LuuHeSoLuong where nam = " + "'" + Nam + "'" + " and mapos= " + "'" + Pos + "' order by mapos,manv";

            dt = cls.LoadDataText(sql);
            dgvData.ItemsSource = dt.DefaultView;
            // rpt_HeSo rpt = new rpt_HeSo();
            // RPUtility.ShowRp(rpt, dt, this, srv.DbSourceSerVer(), srv.DbNameSerVer(), srv.DbUserSerVer(), srv.DbPassSerVer());
        }
Beispiel #16
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);
            }
        }
Beispiel #17
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();
        }
Beispiel #18
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);
     }
 }
Beispiel #19
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");
     }
 }
Beispiel #20
0
        private void btnOk_Click(object sender, RoutedEventArgs e)
        {
            string    tungay  = dtpTuNgay.SelectedDate.Value.ToString("dd/MM/yyyy");
            string    denngay = dtpDenNgay.SelectedDate.Value.ToString("dd/MM/yyyy");
            ClsOracle clsora  = new ClsOracle();
            DataTable dt      = new DataTable();

            clsora.ClsConnect();
            string tk = str.Left(cboTk.SelectedValue.ToString().Trim(), 10);
            //MessageBox.Show(tk);

            string sql = "select to_char(a.ngaygd,'dd/MM/yyyy') as NGGD,c.AC_DESC as TENTK,a.*,b.* from hsbt a, DMPOS b,DMTKGL c where a.ngaybc >= " + "to_date(" + "'" + tungay + "'" + "," + "'dd/mm/yyyy" + "')" + " and a.ngaybc <= " + "to_date(" + "'" + denngay + "'" + "," + "'dd/mm/yyyy" + "') and a.MAPGD= " + "'" + str.Left(cboPos.SelectedValue.ToString().Trim(), 6) + "'" + " and a.TK= " + "'" + tk + "'" + " and a.MAPGD=b.PO_MA and a.TK=c.BANK_AC order by a.NGAYGD ";

            //MessageBox.Show(sql);
            dt = clsora.LoadDataText(sql);
            //dataGrid1.ItemsSource = dt.DefaultView;
            if (dt.Rows.Count > 0)
            {
                rpt_Pstk rpt = new rpt_Pstk();
                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");
            }
        }
Beispiel #21
0
        private void OK_OnClick(object sender, RoutedEventArgs e)
        {
            try
            {
                _cls.ClsConnect();
                int      thamso = 6;
                string[] bien   = new string[thamso];
                object[] giatri = new object[thamso];
                foreach (DataRow dr in _dt.Rows)
                {
                    bien[0]   = "@MaPos";
                    giatri[0] = dr[2];
                    bien[1]   = "@Nam";
                    giatri[1] = dr[0];
                    bien[2]   = "@MaXa";
                    giatri[2] = dr[5];
                    bien[3]   = "@STT";
                    giatri[3] = dr[7];
                    bien[4]   = "@Diem";
                    giatri[4] = dr[12];
                    bien[5]   = "@MOTA";
                    giatri[5] = dr[17];

                    // MessageBox.Show(dr[0].ToString());
                    // MessageBox.Show("Mapos : "+giatri[0]+"  Nam: "+giatri[1]+"   Maxa"+ giatri[2]+"  STT"+ giatri[3]+"  Diem"+giatri[4]);
                    _cls.UpdateDataProcPara("usp_UpdateCHAMDIEM_GDX", bien, giatri, thamso);
                }
                _cls.ClsConnect();
                int      thamso1 = 3;
                string[] bien1   = new string[thamso1];
                object[] giatri1 = new object[thamso1];
                bien1[0]   = "@MaPos";
                giatri1[0] = bll.Left(CboPos.SelectedValue.ToString().Trim(), 6);
                bien1[1]   = "@Nam";
                giatri1[1] = bll.Right(dtpNgay.SelectedDate.Value.ToString("dd/MM/yyyy"), 4);
                bien1[2]   = "@MaXa";
                giatri1[2] = bll.Left(CboXa.SelectedValue.ToString().Trim(), 6);
                _cls.UpdateDataProcPara("usp_UpdateCHAMDIEMGDX", bien1, giatri1, thamso1);

                MessageBox.Show("Save data OK", "Mess", MessageBoxButton.OK, MessageBoxImage.Information);
            }
            catch (Exception ex)
            {
                MessageBox.Show("Error \n" + ex.Message, "Mess", MessageBoxButton.OK, MessageBoxImage.Error);
            }
            finally
            {
                _cls.DongKetNoi();
            }
        }
Beispiel #22
0
        private void LblGetData_OnMouseDown(object sender, MouseButtonEventArgs e)
        {
            string strssql = "";

            cls.ClsConnect();
            try
            {
                var mato = str.Left(CboTo.SelectedValue.ToString().Trim(), 7);
                if (dtpNgay.SelectedDate != null)
                {
                    if (Opt1.IsChecked == true)
                    {
                        strssql = "select MAPOS,TENPOS,MAKH,TENKH,MAXA,TENXA,SOKU,CHTRINH,MATO,TENTT,DUNO,convert(varchar(10),NGAY_VAY,103) NGAY_VAY,TRANGTHAI1,TRANGTHAI2,PLMD,TEN_PLMD from MAU06 where MATO='" +
                                  mato + "'";
                    }
                    else if (Opt2.IsChecked == true)
                    {
                        strssql = "select MAPOS,TENPOS,MAKH,TENKH,MAXA,TENXA,SOKU,CHTRINH,MATO,TENTT,DUNO,convert(varchar(10),NGAY_VAY,103) NGAY_VAY,TRANGTHAI1,TRANGTHAI2,PLMD,TEN_PLMD from MAU06 where MATO='" +
                                  mato + "' and TRANGTHAI1='true'";
                    }
                    else
                    {
                        strssql = "select MAPOS,TENPOS,MAKH,TENKH,MAXA,TENXA,SOKU,CHTRINH,MATO,TENTT,DUNO,convert(varchar(10),NGAY_VAY,103) NGAY_VAY,TRANGTHAI1,TRANGTHAI2,PLMD,TEN_PLMD from MAU06 where MATO='" +
                                  mato + "' and TRANGTHAI1='false'";
                    }
                    dt = cls.LoadDataText(strssql);
                    if (dt.Rows.Count > 0)
                    {
                        dgvData.ItemsSource = dt.DefaultView;
                    }
                    else
                    {
                        MessageBox.Show("Không có bản ghi nào ", "Mess");
                    }
                }
                else
                {
                    MessageBox.Show("Chưa chọn ngày ", "Thông báo", MessageBoxButton.OK, MessageBoxImage.Error);
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
Beispiel #23
0
        private void btnOk_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                cls.ClsConnect();
                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";
                giatri[1] = dtpNgay.SelectedDate.Value.ToString("dd/MM/yyyy");
                if (giatri[1] == null)
                {
                    MessageBox.Show("Chưa chọn ngày : ", "Mess");
                    return;
                }
                bien[2] = "@Mau";
                if (Ration1.IsChecked == true)
                {
                    giatri[2] = "1";
                }
                else if (Ration2.IsChecked == true)
                {
                    giatri[2] = "2";
                }
                else
                {
                    giatri[2] = "3";
                }

                bien[3] = "@Nguon";
                if (Ration4.IsChecked == true)
                {
                    giatri[3] = "1";
                }
                else if (Ration5.IsChecked == true)
                {
                    giatri[3] = "2";
                }
                else
                {
                    giatri[3] = "3";
                }

                //dt = cls.LoadDataProcPara("usp_PhanTichSL", bien, giatri, thamso);
                dt = cls.LoadLdbf("usp_PhanTichSL", bien, giatri, thamso);
                //dataGrid1.ItemsSource = dt.DefaultView;
                rpt_PhanTichSL rpt = new rpt_PhanTichSL();
                RPUtility.ShowRp(rpt, dt, this, srv.DbSourceSerVer(), srv.DbNameSerVer(), srv.DbUserSerVer(), srv.DbPassSerVer());
                cls.DongKetNoi();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
Beispiel #24
0
 private void LblGetData_OnMouseDown(object sender, MouseButtonEventArgs e)
 {
     try
     {
         upda = false;
         cls.ClsConnect();
         if (dtpNgay.SelectedDate != null)
         {
             var dtchk =
                 cls.LoadDataText("select * from KHAOSAT where  MAU='" + _mau + "' and POS='" +
                                  str.Right(str.Left(CboPos.SelectedValue.ToString().Trim(), 6), 4) + "' and NAM=" + dtpNgay.SelectedDate.Value.ToString("yyyy"));
             if (dtchk.Rows.Count > 0)
             {
                 sql = "select * from KHAOSAT where MAU='" + _mau + "' and POS='" +
                       str.Right(str.Left(CboPos.SelectedValue.ToString().Trim(), 6), 4) + "' and NAM=" + dtpNgay.SelectedDate.Value.ToString("yyyy");
                 upda = true;
             }
             else if (dtpNgay.SelectedDate != null)
             {
                 sql = "select '" + _mau + "' MAU," + dtpNgay.SelectedDate.Value.ToString("yyyy") + " NAM," + dtpNgay.SelectedDate.Value.ToString("yyyy-MM-dd") + " NGAY" +
                       "," + str.Left(CboPos.SelectedValue.ToString().Trim(), 6) + " POS,'" + _ct + "' CHTR,b.MA MAXA" +
                       ",ROW_NUMBER() OVER (Order by b.MA) COT1,b.TEN COT2,cast(0 as NUMERIC(18,0)) COT3,cast(0 as NUMERIC(18,0)) COT4" +
                       ",cast(0 as NUMERIC(18,0)) COT5 ,cast(0 as NUMERIC(18, 0)) COT6,cast(0 as NUMERIC(18, 0)) COT7,cast(0 as NUMERIC(18, 0)) COT8" +
                       ",cast(0 as NUMERIC(18, 0)) COT9,cast(0 as NUMERIC(18, 0)) COT10,cast(0 as NUMERIC(18, 0)) COT11,cast(0 as NUMERIC(18, 0)) COT12" +
                       ",cast(0 as NUMERIC(18, 0)) COT13,cast(0 as NUMERIC(18, 0)) COT14 from DMXA b " +
                       " where b.PGD_QL='" + str.Left(CboPos.SelectedValue.ToString().Trim(), 6) + "' and right(b.MA,2)<>'00'";
             }
         }
         dt = cls.LoadDataText(sql);
         if (dt.Rows.Count > 0)
         {
             dgvSource.ItemsSource = dt.DefaultView;
         }
         else
         {
             MessageBox.Show("Chưa có số liệu", "Thông báo");
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
     cls.DongKetNoi();
 }
Beispiel #25
0
 private void btnWrite_Click(object sender, RoutedEventArgs e)
 {
     if (txtPath.Text == "")
     {
         MessageBox.Show("Chưa chọn file Excel", "Error", MessageBoxButton.OK, MessageBoxImage.Error);
     }
     else
     {
         try
         {
             //MessageBox.Show(bll.Left(bll.Right(txtPath.Text.Trim(), 16), 12)+'_'+bll.Right(bll.Left(CboSheet.SelectedValue.ToString().Trim(), 3),2));
             string FileName = "C:\\TEXT\\" + bll.XoaHetKyTuTrang(bll.Left(bll.Right(txtPath.Text.Trim(), 16), 12) + '_' + bll.Right(bll.Left(CboSheet.SelectedValue.ToString().Trim(), 3), 2)) + ".txt";
             //string[] arrStr = FileName.Split('\\');
             Encoding encode = Encoding.BigEndianUnicode;
             _fw = new FileStream(FileName, FileMode.Create, FileAccess.Write, FileShare.None);
             StreamWriter sw = new StreamWriter(_fw, encode);
             foreach (DataRow row in dt.Rows)
             {
                 for (int i = 0; i < dt.Columns.Count; i++)
                 {
                     if (i + 1 < dt.Columns.Count)
                     {
                         sw.Write(row[i].ToString() + "$");
                     }
                     else
                     {
                         sw.Write(row[i].ToString());
                     }
                 }
                 sw.WriteLine();
             }
             sw.Close();
             MessageBox.Show("Export OK", "Mess", MessageBoxButton.OK, MessageBoxImage.Information);
             btnWrite.IsEnabled = false;
         }
         catch (Exception ex)
         {
             MessageBox.Show(ex.Message);
         }
     }
 }
Beispiel #26
0
 private void BtnOk_OnClick(object sender, RoutedEventArgs e)
 {
     try
     {
         if (dtNew.Rows.Count > 0)
         {
             cls.ClsConnect();
             foreach (DataRow dr in dtNew.Rows)
             {
                 if (Ration1.IsChecked == true)
                 {
                     strsql = "update KTHDT set SOTOKT=" + dr["SOTOKT"] + ",SOTODC=" + dr["SOTODC"]
                              + " where NAM='" + dtpNgay.SelectedDate.Value.ToString("yyyy") + "' and PO_MA='" + dr["PO_MA"] + "' and MAU='" + dr["MAU"] + "' and TO_DVUT='" +
                              dr["TO_DVUT"] + "' and MAXA='" + dr["MAXA"] + "'";
                 }
                 else
                 {
                     strsql = "update KTHDT set SOTOKT=" + dr["SOTOKT"] + ",SOTODC=" + dr["SOTODC"]
                              + " where NAM='" + dtpNgay.SelectedDate.Value.ToString("yyyy") + "' and PO_MA='" + s.Left(CboPos.SelectedValue.ToString().Trim(), 6)
                              + "' and MAU='2' and TO_DVUT='" + dr["TO_DVUT"] + "'";
                 }
                 cls.UpdateDataText(strsql);
             }
             dtNew.Clear();
             MessageBox.Show("Lưu thành công !", "Thông báo", 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 \n" + ex.Message, "Mess", MessageBoxButton.OK, MessageBoxImage.Error);
     }
     finally
     {
         cls.DongKetNoi();
     }
 }
Beispiel #27
0
 private void LblGetData_OnMouseDown(object sender, MouseButtonEventArgs e)
 {
     cls.ClsConnect();
     try
     {
         string strsql = "select * from KH_XLN where MAXA='" + str.Left(CboXa.SelectedValue.ToString().Trim(), 7) +
                         "' and THANG_KH='" + CboThang.SelectedValue.ToString().Trim() + "' and TRANGTHAI<>'C' order by MATO";
         dt = cls.LoadDataText(strsql);
         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);
     }
 }
 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();
     }
 }
Beispiel #29
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());
            }
        }
Beispiel #30
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();
 }