Exemple #1
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();
        }
Exemple #2
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();
        }
Exemple #3
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");
            }
        }
Exemple #4
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("dd/MM/yyyy");
         }
         bien[1]   = "@MaPos";
         giatri[1] = str.Left(cboPos.SelectedValue.ToString().Trim(), 6);
         dt        = cls.LoadDataProcPara("usp_Khtc06", bien, giatri, thamso);
         if (dt.Rows.Count > 0)
         {
             rpt_khtc06 rpt = new rpt_khtc06();
             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");
     }
 }
Exemple #5
0
        private void btnOK_Click(object sender, RoutedEventArgs e)
        {
            string thang = dtpNgay.SelectedDate.Value.Month.ToString();
            string nam   = dtpNgay.SelectedDate.Value.Year.ToString();

            //string phong = bll.Left(CboPB.SelectedValue.ToString().Trim(), 2);
            try
            {
                cls.ClsConnect();
                {
                    try
                    {
                        int      thamso = 4;
                        string[] bien   = new string[thamso];
                        object[] giatri = new object[thamso];
                        bien[0]   = "@MaPos";
                        giatri[0] = bll.Left(CboPos.SelectedValue.ToString().Trim(), 6);
                        bien[1]   = "@Ngay";
                        if (dtpNgay.SelectedDate != null)
                        {
                            giatri[1] = dtpNgay.SelectedDate.Value.ToString("yyyy-MM-dd");
                        }
                        bien[2]   = "@Phong";
                        giatri[2] = bll.Left(CboPB.SelectedValue.ToString().Trim(), 2);
                        bien[3]   = "@Mau";
                        if (Ration1.IsChecked == true)
                        {
                            giatri[3] = "CC";
                        }
                        else if (Ration2.IsChecked == true)
                        {
                            giatri[3] = "LT";
                        }
                        else
                        {
                            giatri[3] = "NB";
                        }
                        mau = giatri[3].ToString();
                        if (Ration1.IsChecked == true || Ration2.IsChecked == true || Ration3.IsChecked == true)
                        {
                            dt = cls.LoadDataProcPara("usp_ChamCongTK", bien, giatri, thamso);
                            if (dt.Rows.Count > 0)
                            {
                                if (mau == "CC")
                                {
                                    rpt_ChamCong02 rpt = new rpt_ChamCong02();
                                    RPUtility.ShowRp(rpt, dt, this, srv.DbSourceSerVer(), srv.DbNameSerVer(),
                                                     srv.DbUserSerVer(), srv.DbPassSerVer());
                                }
                                else if (mau == "LT")
                                {
                                    rpt_ChamCong03 rpt = new rpt_ChamCong03();
                                    RPUtility.ShowRp(rpt, dt, this, srv.DbSourceSerVer(), srv.DbNameSerVer(),
                                                     srv.DbUserSerVer(), srv.DbPassSerVer());
                                }
                                else
                                {
                                    rpt_ChamCong04 rpt = new rpt_ChamCong04();
                                    RPUtility.ShowRp(rpt, dt, this, srv.DbSourceSerVer(), srv.DbNameSerVer(),
                                                     srv.DbUserSerVer(), srv.DbPassSerVer());
                                }
                            }
                            else
                            {
                                MessageBox.Show("Không có bản ghi nào !", "Thông báo", MessageBoxButton.OK,
                                                MessageBoxImage.Information);
                            }
                        } // ration 4 hoac 5
                        else if (Ration4.IsChecked == true || Ration5.IsChecked == true)
                        {
                            int      thamso1 = 2;
                            string[] bien1   = new string[thamso1];
                            object[] giatri1 = new object[thamso1];
                            bien1[0]   = "@MaPos";
                            giatri1[0] = bll.Left(CboPos.SelectedValue.ToString().Trim(), 6);
                            bien1[1]   = "@Ngay";
                            if (dtpNgay.SelectedDate != null)
                            {
                                giatri1[1] = dtpNgay.SelectedDate.Value.ToString("yyyy-MM-dd");
                            }
                            dt = cls.LoadDataProcPara("usp_ChamCongPhep", bien1, giatri1, thamso1);
                            if (Ration4.IsChecked == true)
                            {
                                rpt_ChamCong05 rpt = new rpt_ChamCong05();
                                RPUtility.ShowRp(rpt, dt, this, srv.DbSourceSerVer(), srv.DbNameSerVer(),
                                                 srv.DbUserSerVer(), srv.DbPassSerVer());
                            }
                            if (Ration5.IsChecked == true)
                            {
                                rpt_ChamCong09 rpt1 = new rpt_ChamCong09();
                                RPUtility.ShowRp(rpt1, dt, this, srv.DbSourceSerVer(), srv.DbNameSerVer(),
                                                 srv.DbUserSerVer(), srv.DbPassSerVer());
                            }
                        }
                    }
                    catch (Exception ex)
                    {
                        MessageBox.Show("Lổi, kiểm tra lại thông tin " + ex.Message, "Thông báo", MessageBoxButton.OK,
                                        MessageBoxImage.Error);
                    }
                }
                cls.DongKetNoi();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Error", MessageBoxButton.OK, MessageBoxImage.Error);
            }
            cls.DongKetNoi();
        }
Exemple #6
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_UT set A01=" + dr["A01"] + ",A02=" + dr["A02"] + ",A03=" +
                                 dr["A03"] + ",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"] + ",TGTK=" + dr["TGTK"]
                                 + ",A03CS=" + dr["A03CS"] + ",A07_33=" + dr["A07_33"] + ",A20=" + dr["A20"]
                                 + " where NG_MATO='" + dr["NG_MATO"].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]   = "@MaXa";
                 giatri[0] = s.Left(CboXa.SelectedValue.ToString().Trim(), 6);
                 var          dtin = cls.LoadDataProcPara("usp_InNguon_UT", bien, giatri, thamso);
                 rpt_Nguon_UT rpt  = new rpt_Nguon_UT();
                 RPUtility.ShowRp(rpt, dtin, this, srv.DbSourceSerVer(), srv.DbNameSerVer(), srv.DbUserSerVer(), srv.DbPassSerVer());
                 rpt_Nguon_UT_KHB rptkhb = new rpt_Nguon_UT_KHB();
                 RPUtility.ShowRp(rptkhb, dtin, this, srv.DbSourceSerVer(), srv.DbNameSerVer(), srv.DbUserSerVer(), srv.DbPassSerVer());
                 //int thamso1 = 1;
                 //string[] bien1 = new string[thamso1];
                 //object[] giatri1 = new object[thamso1];
                 //bien1[0] = "@MaPos";
                 //giatri1[0] = s.Left(CboPos.SelectedValue.ToString().Trim(), 6);
                 //var dtth = cls.LoadDataProcPara("usp_InNguon_TH", bien1, giatri1, thamso1);
                 //rpt_Nguon_UT rpt = new rpt_Nguon_UT();
                 //RPUtility.ShowRp(rpt, dtth, 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();
     }
 }
Exemple #7
0
        private void btnOk_Click(object sender, RoutedEventArgs e)
        {
            bll.TaoThuMuc(Thumuc);
            var lastMonth = new DateTime(dtpNgay.SelectedDate.Value.Year, dtpNgay.SelectedDate.Value.Month, DateTime.DaysInMonth(dtpNgay.SelectedDate.Value.Year, dtpNgay.SelectedDate.Value.Month));

            try
            {
                ServerInfor srv = new ServerInfor();
                cls.ClsConnect();
                const 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] = "@Mato";
                if (Ration3.IsChecked == true)
                {
                    giatri[1] = bll.Left(cboXa.SelectedValue.ToString().Trim(), 6);
                }
                else
                {
                    giatri[1] = bll.Left(cboTo.SelectedValue.ToString().Trim(), 7);
                }
                bien[2] = "@Mau";
                if (Ration1.IsChecked == true || Ration5.IsChecked == true) // Mau KT
                {
                    giatri[2] = "1";
                }
                else //Mau Tat toan
                {
                    giatri[2] = "0";
                }

                if (Ration4.IsChecked == true)
                {
                    if (dtpNgay.SelectedDate.Value.ToString("yyyy-MM-dd") == lastMonth.ToString("yyyy-MM-dd"))
                    {
                        str = "select a.KU_MAPGD,left(a.KU_MADP,6) MAXA,c.TEN TENXA,a.KU_MATO,(select TO_TENTT from HSTO where TO_MATO=a.KU_MATO) TENTT,b.KH_MAKH,b.KH_TENKH,b.KH_TENVC "
                              + " ,char(39) + a.KU_SOKU SOKU, a.KU_CHTRINH,a.KU_MAQD,(select GIATRI from DMKHAC where KHOA_1='07' and KHOA_2=a.KU_MAQD) TENCHTR, a.KU_NGAYVAY, a.KU_NGAYDHAN_1, a.KU_NGAYDHAN_3 "
                              +
                              " , a.KU_DNOTHAN + a.KU_DNOQHAN + a.KU_DNOKHOANH DUNO, a.KU_LAITHAN + a.KU_LAIQHAN LAIDATHU, a.KU_LAITONTHAN + a.KU_LAITONQHAN LAITON "
                              +
                              " , (select SV_TENSV from HSSV where SV_SOKU = a.KU_SOKU) TENSV,a.KU_MAPNKT51,(select GIATRI from DMKHAC where KHOA_1 = '25' and KHOA_2 = a.KU_MAPNKT51) PNKT1 "
                              +
                              " ,a.KU_MAPNKT52,(select GIATRI from DMKHAC where KHOA_1 = '25' and KHOA_2 = a.KU_MAPNKT52) PNKT2,b.KH_DIACHI "
                              + " from HSKU a, HSKH b,DMXA c "
                              +
                              " where a.KU_DNOTHAN + a.KU_DNOQHAN + a.KU_DNOKHOANH>0 and a.KU_TTMONVAY<>'CLOSE' and a.KU_NGAYBC = '" +
                              giatri[0] + "' and a.KU_MATO = '" + giatri[1] +
                              "' and a.KU_MAKH = b.KH_MAKH and left(a.KU_MADP, 6)= c.MA order by b.KH_MAKH,a.KU_CHTRINH";
                    }
                    else
                    {
                        str = "select a.KU_MAPGD,left(a.KU_MADP,6) MAXA,c.TEN TENXA,a.KU_MATO,(select TO_TENTT from HSTO where TO_MATO=a.KU_MATO) TENTT,b.KH_MAKH,b.KH_TENKH, b.KH_TENVC "
                              + " ,char(39) + a.KU_SOKU SOKU, a.KU_CHTRINH,a.KU_MAQD,(select GIATRI from DMKHAC where KHOA_1='07' and KHOA_2=a.KU_MAQD) TENCHTR, a.KU_NGAYVAY, a.KU_NGAYDHAN_1, a.KU_NGAYDHAN_3 "
                              +
                              " , a.KU_DNOTHAN + a.KU_DNOQHAN + a.KU_DNOKHOANH DUNO, a.KU_LAITHAN + a.KU_LAIQHAN LAIDATHU, a.KU_LAITONTHAN + a.KU_LAITONQHAN LAITON "
                              +
                              " , (select SV_TENSV from HSSV where SV_SOKU = a.KU_SOKU) TENSV,a.KU_MAPNKT51,(select GIATRI from DMKHAC where KHOA_1 = '25' and KHOA_2 = a.KU_MAPNKT51) PNKT1 "
                              +
                              " ,a.KU_MAPNKT52,(select GIATRI from DMKHAC where KHOA_1 = '25' and KHOA_2 = a.KU_MAPNKT52) PNKT2,b.KH_DIACHI "
                              + " from HSCV_DAILY a, HSKH b,DMXA c "
                              +
                              " where a.KU_DNOTHAN + a.KU_DNOQHAN + a.KU_DNOKHOANH>0 and a.KU_TTMONVAY<>'CLOSE' and a.KU_NGAYBC = '" +
                              giatri[0] + "' and a.KU_MATO = '" + giatri[1] +
                              "' and a.KU_MAKH = b.KH_MAKH and left(a.KU_MADP, 6)= c.MA order by b.KH_MAKH,a.KU_CHTRINH";
                    }
                    dt       = cls.LoadDataText(str);
                    FileName = Thumuc + "\\" + bll.Left(cboPos.SelectedValue.ToString().Trim(), 6) + "_SKETO_" + bll.Left(cboTo.SelectedValue.ToString().Trim(), 7) + "_" + dtpNgay.SelectedDate.Value.ToString("ddMMyyyy") + ".csv";
                    bll.ExportToExcel(dt, FileName);
                    MessageBox.Show("Copy Excel to : " + FileName, "Thông báo", MessageBoxButton.OK, MessageBoxImage.Information);
                    bll.OpenExcel(FileName);
                }
                else
                {
                    dt = cls.LoadDataProcPara(Ration3.IsChecked != true ? "usp_sketo" : "usp_SkeBsungTT", bien, giatri, thamso);
                    //rpt_kt740_01 rpt = new rpt_kt740_01();
                    if (dt.Rows.Count > 0)
                    {
                        if (Ration1.IsChecked == true)
                        {
                            rpt_SkeTo rpt = new rpt_SkeTo();
                            RPUtility.ShowRp(rpt, dt, this, srv.DbSourceSerVer(), srv.DbNameSerVer(), srv.DbUserSerVer(),
                                             srv.DbPassSerVer());
                        }
                        else if (Ration2.IsChecked == true)
                        {
                            rpt_SkeTo1 rpt = new rpt_SkeTo1();
                            RPUtility.ShowRp(rpt, dt, this, srv.DbSourceSerVer(), srv.DbNameSerVer(), srv.DbUserSerVer(),
                                             srv.DbPassSerVer());
                        }
                        else if (Ration3.IsChecked == true)
                        {
                            rpt_SkeBsungTT rpt = new rpt_SkeBsungTT();
                            RPUtility.ShowRp(rpt, dt, this, srv.DbSourceSerVer(), srv.DbNameSerVer(), srv.DbUserSerVer(),
                                             srv.DbPassSerVer());
                        }
                        else if (Ration5.IsChecked == true)
                        {
                            rpt_Mau06_01 rpt = new rpt_Mau06_01();
                            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();
        }
        private void btnOk_Click(object sender, RoutedEventArgs e)
        {
            cls.ClsConnect();
            try
            {
                int      thamso = 4;
                string[] bien   = new string[thamso];
                object[] giatri = new object[thamso];

                /*
                 * bien[0] = "@Mato";
                 * if (CboTo != null)
                 *  giatri[0] = bll.Left(CboTo.SelectedValue.ToString().Trim(), 7);
                 * else
                 * {
                 *  MessageBox.Show("Chọn Tổ", "Mess");
                 *  return;
                 * }
                 */
                bien[0] = "@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[0] = dtpNgay.SelectedDate.Value.ToString("yyyy-MM-dd");
                }

                bien[1] = "@TuNgay";
                if (dtpTuNgay.SelectedDate.Value == null)
                {
                    MessageBox.Show("Chưa chọn ngày ", "Thông báo", MessageBoxButton.OK, MessageBoxImage.Error);
                    return;
                }
                else
                {
                    giatri[1] = dtpTuNgay.SelectedDate.Value.ToString("yyyy-MM-dd");
                }
                bien[2] = "@DenNgay";
                if (dtpDenNgay.SelectedDate.Value == null)
                {
                    MessageBox.Show("Chưa chọn ngày ", "Thông báo", MessageBoxButton.OK, MessageBoxImage.Error);
                    return;
                }
                else
                {
                    giatri[2] = dtpDenNgay.SelectedDate.Value.ToString("yyyy-MM-dd");
                }
                bien[3]   = "@MaXa";
                giatri[3] = bll.Left(CboXa.SelectedValue.ToString().Trim(), 6);
                // MessageBox.Show(giatri[0] + " "+giatri[1] + " " + giatri[2] + " " + giatri[3] + " " + giatri[4] + " " + giatri[5] + " " );
                dt = cls.LoadDataProcPara("usp_DKTRALAI", bien, giatri, thamso);
                if (dt.Rows.Count > 0)
                {
                    rpt_DKNOPLAI rpt = new rpt_DKNOPLAI();
                    RPUtility.ShowRp(rpt, dt, this, srv.DbSourceSerVer(), srv.DbNameSerVer(), srv.DbUserSerVer(), srv.DbPassSerVer());
                    //MessageBox.Show("OK ", "Thông báo",MessageBoxButton.OK,MessageBoxImage.Information);
                }
                else
                {
                    MessageBox.Show("Không có bản ghi nào ", "Mess");
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
Exemple #9
0
        private void btnOk_Click(object sender, RoutedEventArgs e)
        {
            cls.ClsConnect();
            DataTable dt     = new DataTable();
            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)
            {
                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);
            bien[3]   = "@Mau";
            if (radioButton4.IsChecked == true)
            {
                giatri[3] = "1";
            }
            else
            {
                giatri[3] = "2";
            }

            bien[4] = "@Ky";
            if (radioButton1.IsChecked == true)
            {
                giatri[4] = "1";
            }
            else if (radioButton2.IsChecked == true)
            {
                giatri[4] = "2";
            }
            else if (radioButton3.IsChecked == true)
            {
                giatri[4] = "3";
            }
            //MessageBox.Show(giatri[0] + "  " + giatri[1] + "  " + giatri[2] + "  " + giatri[3] + "  " + giatri[4]);
            dt = cls.LoadDataProcPara("usp_Dvut", bien, giatri, thamso);
            //rpt_kt740_01 rpt = new rpt_kt740_01();
            if (dt.Rows.Count > 0)
            {
                rpt_Dvut rpt = new rpt_Dvut();
                RPUtility.ShowRp(rpt, dt, this, srv.DbSourceSerVer(), srv.DbNameSerVer(), srv.DbUserSerVer(), srv.DbPassSerVer());
                //dataGrid1.ItemsSource = dt.DefaultView;
                // FileName = Thumuc + "\\" + str.Left(CboPos.SelectedValue.ToString().Trim(), 6) + "_" + str.Left(CboDvut.SelectedValue.ToString().Trim(), 2) + "_" + str.Left(CboXa.SelectedValue.ToString().Trim(), 6) + "_" + dtpNgay.SelectedDate.Value.ToString("ddMMyyyy") + ".xlsx";
                // str.WriteDataTableToExcel(dt, "Person Details", FileName, "Details");
                //MessageBox.Show("Copy Excel to : " + FileName);
            }
            else
            {
                MessageBox.Show("Chưa có số liệu", "Thông báo");
            }
            cls.DongKetNoi();
        }
        private void lblOk_MouseDown(object sender, MouseButtonEventArgs e)
        {
            try
            {
                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 có thay đổi ngày nào !", "Thông báo", MessageBoxButton.OK, MessageBoxImage.Warning);
                }
                else
                {
                    if (Opt1.IsChecked == true || Opt3.IsChecked == true)
                    {
                        rpt_DongCasa rpt = new rpt_DongCasa();
                        RPUtility.ShowRp(rpt, dtNew, this, srv.DbSourceSerVer(), srv.DbNameSerVer(), srv.DbUserSerVer(), srv.DbPassSerVer());
                        if (lblGmt.IsChecked == true)
                        {
                            rpt_RoiTo rpt1 = new rpt_RoiTo();
                            RPUtility.ShowRp(rpt1, dtNew, this, srv.DbSourceSerVer(), srv.DbNameSerVer(), srv.DbUserSerVer(), srv.DbPassSerVer());
                        }
                        //dt = null;
                        //dtNew = null;
                        //dgvData.ItemsSource = null;

                        /*
                         * string mau = "";
                         * if (Opt3.IsChecked == true)
                         * {
                         *  mau = "1";
                         * }
                         * else
                         * {
                         *  mau = "0";
                         * }
                         * //dgvNew.ItemsSource = dtNew.DefaultView;
                         *
                         * if (Opt1.IsChecked == true || Opt2.IsChecked == true)
                         * {
                         *  rpt_DongCasa rpt = new rpt_DongCasa();
                         *  //RPUtility.ShowRp(rpt, dtNew, this, srv.DbSourceLocal(), srv.DbNameLocal(), srv.DbUserLocal(), srv.DbPassLocal());
                         *  RPUtility.ShowRpOnePara(rpt, dtNew, mau, this, srv.DbSourceLocal(), srv.DbNameLocal(),
                         *      srv.DbUserLocal(), srv.DbPassLocal());
                         * }
                         * else
                         * {
                         *  rpt_DongCasa rpt = new rpt_DongCasa();
                         *  //RPUtility.ShowRp(rpt, dtNew, this, srv.DbSourceLocal(), srv.DbNameLocal(), srv.DbUserLocal(), srv.DbPassLocal());
                         *  RPUtility.ShowRpOnePara(rpt, dtNew, mau, this, srv.DbSourceLocal(), srv.DbNameLocal(),
                         *      srv.DbUserLocal(), srv.DbPassLocal());
                         * }
                         */
                    }
                    else
                    {
                        FileName = Thumuc + "\\" + str.Left(CboPos.SelectedValue.ToString().Trim(), 6) + "_" + str.Left(CboTo.SelectedValue.ToString().Trim(), 7) + "_DONG105_" + dtpNgay.SelectedDate.Value.ToString("ddMMyyyy") + ".csv";
                        FileStream   fs = new FileStream(FileName, FileMode.Create);
                        StreamWriter sw = new StreamWriter(fs, Encoding.Unicode);
                        //bll.WriteDataTableToExcel(dt, "Details", FileName, "tutm : 0985165777");
                        str.ToCSV(dtNew, sw, true);
                        MessageBox.Show("Copy Excel to : " + FileName, "Thông báo", MessageBoxButton.OK, MessageBoxImage.Information);
                    }
                    //dtNew = dt.Clone();
                    //dtNew = null;
                    //dt = null;
                    // dgvData.ItemsSource = null;
                    // ChkAll.IsChecked = false;
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("Bấm nút lấy dữ liệu !" + ex.Message, "Lỗi", MessageBoxButton.OK, MessageBoxImage.Error);
            }
        }
Exemple #11
0
        private void btnOk_Click(object sender, RoutedEventArgs e)
        {
            #region

            try
            {
                if (str.Right(str.Left(CboPos.SelectedValue.ToString().Trim(), 6), 2) == "00")
                {
                    MessageBox.Show("Không chọn POS tổng hợp", "Thông báo", MessageBoxButton.OK, MessageBoxImage.Warning);
                }
                else
                {
                    cls.ClsConnect();
                    int      thamso = 6;
                    string[] bien   = new string[thamso];
                    object[] giatri = new object[thamso];
                    bien[0] = "@NgayKu";
                    if (dtpNgayKu.SelectedDate != null)
                    {
                        giatri[0] = dtpNgayKu.SelectedDate.Value.ToString("yyyy-MM-dd");
                    }
                    bien[1] = "@NgayBt";
                    if (dtpNgayBt.SelectedDate != null)
                    {
                        giatri[1] = dtpNgayBt.SelectedDate.Value.ToString("yyyy-MM-dd");
                    }
                    bien[2]   = "@MaPos";
                    giatri[2] = str.Left(CboPos.SelectedValue.ToString().Trim(), 6);
                    bien[3]   = "@MaXa";
                    giatri[3] = str.Left(cboXa.SelectedValue.ToString().Trim(), 6);
                    //MessageBox.Show(giatri[3].ToString());
                    bien[4] = "@Nguon";
                    if (Ration1.IsChecked == true)
                    {
                        giatri[4] = "1";
                    }
                    else if (Ration2.IsChecked == true)
                    {
                        giatri[4] = "2";
                    }
                    else
                    {
                        giatri[4] = "3";
                    }
                    bien[5] = "@Mau";
                    if (Ration4.IsChecked == true)
                    {
                        giatri[5] = "1";
                    }
                    else if (Ration5.IsChecked == true)
                    {
                        giatri[5] = "2";
                    }
                    else
                    {
                        giatri[5] = "3";
                    }

                    if (Ration4.IsChecked == true)
                    {
                        dt = cls.LoadLdbf("usp_SlDaily", bien, giatri, thamso);
                        if (Ration6.IsChecked == true)
                        {
                            rpt_SlDaily rpt = new rpt_SlDaily();
                            RPUtility.ShowRp(rpt, dt, this, srv.DbSourceSerVer(), srv.DbNameSerVer(), srv.DbUserSerVer(), srv.DbPassSerVer());
                        }
                        else
                        {
                            FileName = Thumuc + "\\" + giatri[2] + "_" + giatri[3] + "_SLTD_XA_" +
                                       dtpNgayBt.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
                    {
                        if (Ration5.IsChecked == true)
                        {
                            dt = cls.LoadLdbf("usp_SlDailyCT", bien, giatri, thamso);
                            if (Ration6.IsChecked == true)
                            {
                                rpt_SlDailyCt rpt = new rpt_SlDailyCt();
                                RPUtility.ShowRp(rpt, dt, this, srv.DbSourceSerVer(), srv.DbNameSerVer(), srv.DbUserSerVer(), srv.DbPassSerVer());
                            }
                            else
                            {
                                FileName = Thumuc + "\\" + giatri[2] + "_" + giatri[3] + "_SLTD_CHTR_" +
                                           dtpNgayBt.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
                        {
                            dt = cls.LoadLdbf("usp_SlDailyDvut", bien, giatri, thamso);

                            if (Ration6.IsChecked == true)
                            {
                                rpt_SlDaily rpt = new rpt_SlDaily();
                                RPUtility.ShowRp(rpt, dt, this, srv.DbSourceSerVer(), srv.DbNameSerVer(), srv.DbUserSerVer(), srv.DbPassSerVer());
                            }
                            else
                            {
                                FileName = Thumuc + "\\" + giatri[2] + "_" + giatri[3] + "_SLTD_DVUT_" +
                                           dtpNgayBt.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);
                            }
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
            cls.DongKetNoi();

            #endregion
        }
Exemple #12
0
 private void btnOk_Click(object sender, RoutedEventArgs e)
 {
     try
     {
         cls.ClsConnect();
         int      thamso = 7;
         string[] bien   = new string[thamso];
         object[] giatri = new object[thamso];
         bien[0]   = "@MaPos";
         giatri[0] = BienBll.NdMadv.Trim();
         bien[1]   = "@Thang";
         giatri[1] = bll.Left(comboBoxMonth.SelectedValue.ToString().Trim(), 2);
         bien[2]   = "@Nam";
         giatri[2] = comboBoxYear.SelectedValue.ToString().Trim();
         bien[3]   = "@DGiao";
         giatri[3] = CboDgiao.SelectedValue.ToString().Trim();
         bien[4]   = "@Giao";
         giatri[4] = CboGiao.SelectedValue.ToString().Trim();
         bien[5]   = "@Nhan";
         giatri[5] = CboNhan.SelectedValue.ToString().Trim();
         bien[6]   = "@Phong";
         giatri[6] = bll.Left(CboPhong.SelectedValue.ToString().Trim(), 2);
         if (Option1.IsChecked == true)
         {
             dt = cls.LoadDataProcPara("usp_Vpp02", bien, giatri, thamso);
         }
         else if (Option2.IsChecked == true)
         {
             dt = cls.LoadDataProcPara("usp_Vpp03", bien, giatri, thamso);
         }
         else
         {
             dt = cls.LoadDataProcPara("usp_Vpp04", bien, giatri, thamso);
         }
         if (dt.Rows.Count > 0)
         {
             if (Option1.IsChecked == true)
             {
                 if (BienBll.NdMadv.Trim() == BienBll.MainPos.Trim())
                 {
                     rpt_Vpp02 rpt = new rpt_Vpp02();
                     RPUtility.ShowRp(rpt, dt, this, srv.DbSourceSerVer(), srv.DbNameSerVer(), srv.DbUserSerVer(),
                                      srv.DbPassSerVer());
                 }
                 else
                 {
                     rpt_Vpp03 rpt = new rpt_Vpp03();
                     RPUtility.ShowRp(rpt, dt, this, srv.DbSourceSerVer(), srv.DbNameSerVer(), srv.DbUserSerVer(),
                                      srv.DbPassSerVer());
                 }
             }
             else if (Option2.IsChecked == true)
             {
                 rpt_Vpp04 rpt = new rpt_Vpp04();
                 RPUtility.ShowRp(rpt, dt, this, srv.DbSourceSerVer(), srv.DbNameSerVer(), srv.DbUserSerVer(),
                                  srv.DbPassSerVer());
             }
             else
             {
                 rpt_Vpp05 rpt = new rpt_Vpp05();
                 RPUtility.ShowRp(rpt, dt, this, srv.DbSourceSerVer(), srv.DbNameSerVer(), srv.DbUserSerVer(),
                                  srv.DbPassSerVer());
             }
         }
         else
         {
             MessageBox.Show("Không có bản ghi nào !", "Thông báo", MessageBoxButton.OK, MessageBoxImage.Information);
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message, "Error", MessageBoxButton.OK, MessageBoxImage.Error);
     }
     cls.DongKetNoi();
 }
Exemple #13
0
 private void btnOk_Click(object sender, RoutedEventArgs 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]   = "@MaXa";
         giatri[1] = bll.Left(CboXa.SelectedValue.ToString().Trim(), 6);
         bien[2]   = "@Mato";
         giatri[2] = bll.Left(CboTo.SelectedValue.ToString().Trim(), 7);
         bien[3]   = "@Ngay";
         if (dtpNgay.SelectedDate == null)
         {
             MessageBox.Show("Chưa chọn ngày ", "Mess");
             return;
         }
         else
         {
             giatri[3] = dtpNgay.SelectedDate.Value.ToString("yyyy-MM-dd");
         }
         bien[4] = "@Mau";
         if (Ration1.IsChecked == true)
         {
             giatri[4] = "1";
         }
         else
         {
             giatri[4] = "2";
         }
         dt = cls.LoadDataProcPara("usp_DCPTNO", bien, giatri, thamso);
         if (dt.Rows.Count > 0)
         {
             if (Ration1.IsChecked == true)
             {
                 rpt_DCPTNO_DC rpt = new rpt_DCPTNO_DC();
                 RPUtility.ShowRp(rpt, dt, this, srv.DbSourceSerVer(), srv.DbNameSerVer(), srv.DbUserSerVer(), srv.DbPassSerVer());
             }
             else if (Ration2.IsChecked == true)
             {
                 rpt_DCPTNO_PT rpt = new rpt_DCPTNO_PT();
                 RPUtility.ShowRp(rpt, dt, this, srv.DbSourceSerVer(), srv.DbNameSerVer(), srv.DbUserSerVer(), srv.DbPassSerVer());
             }
             else
             {
                 rpt_DCPTNO rpt = new rpt_DCPTNO();
                 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);
     }
 }
Exemple #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]   = "@Htvay";
                if (Ration1.IsChecked == true)
                {
                    giatri[3] = "1";
                }
                else if (Ration2.IsChecked == true)
                {
                    giatri[3] = "2";
                }
                else
                {
                    giatri[3] = "3";
                }

                bien[4] = "@Nguon";
                if (Ration4.IsChecked == true)
                {
                    giatri[4] = "1";
                }
                else if (Ration5.IsChecked == true)
                {
                    giatri[4] = "2";
                }
                else
                {
                    giatri[4] = "3";
                }
                dt = cls.LoadLdbf("usp_QlyNnguon", bien, giatri, thamso);
                if (dt.Rows.Count > 0)
                {
                    if (Ration7.IsChecked == true)
                    {
                        if (Ration6.IsChecked == true)
                        {
                            rpt_QlyNguonKHB rpt = new rpt_QlyNguonKHB();
                            RPUtility.ShowRp(rpt, dt, this, srv.DbSourceSerVer(), srv.DbNameSerVer(),
                                             srv.DbUserSerVer(), srv.DbPassSerVer());
                        }
                        else
                        {
                            rpt_QlyNguon rpt = new rpt_QlyNguon();
                            RPUtility.ShowRp(rpt, dt, this, srv.DbSourceSerVer(), srv.DbNameSerVer(),
                                             srv.DbUserSerVer(), srv.DbPassSerVer());
                            rpt_QlyNguonB rptb = new rpt_QlyNguonB();
                            RPUtility.ShowRp(rptb, dt, this, srv.DbSourceSerVer(), srv.DbNameSerVer(),
                                             srv.DbUserSerVer(), srv.DbPassSerVer());
                            rpt_QlyNguonC rptc = new rpt_QlyNguonC();
                            RPUtility.ShowRp(rptc, dt, this, srv.DbSourceSerVer(), srv.DbNameSerVer(),
                                             srv.DbUserSerVer(), srv.DbPassSerVer());
                        }
                    }
                    else
                    {
                        FileName = Thumuc + "\\" + giatri[1] + "_" + giatri[2] + "_" + 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);
                        //str.exportDataTableToExcel(dt, FileName);
                        // //str.ExportToExcel(dt, FileName);
                        //MessageBox.Show("Export to Excel : " + FileName, "Thông báo");
                        // str.OpenExcel(FileName);

                        //str.ExportToExcel(dt, FileName);
                        MessageBox.Show("Copy Excel to : " + FileName, "Thông báo", MessageBoxButton.OK,
                                        MessageBoxImage.Information);
                        str.OpenExcel(FileName);
                    }
                }
                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
        }
Exemple #15
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();
            }
        }
Exemple #16
0
        private void BtnOk_OnClick(object sender, RoutedEventArgs e)
        {
            _cls.ClsConnect();
            //ora.ClsConnect();
            try
            {
                string nam   = dtpNgay.SelectedDate.Value.ToString("yyyy");
                string thang = dtpNgay.SelectedDate.Value.ToString("MM");
                string ng    = dtpNgay.SelectedDate.Value.ToString("yyyy-MM-dd");
                #region

                /*
                 * string strdel= "delete from DULIEU_NT where YEAR(NGAYBC)='"+dtpNgay.SelectedDate.Value.ToString("yyyy")+"' and MONTH(NGAYBC)='"+ dtpNgay.SelectedDate.Value.ToString("MM")+"'";
                 * //MessageBox.Show(strdel);
                 * _cls.UpdateDataText(strdel);
                 * string strsql = "select KHOA, THUTU, TT_HIENTHI, MA, TEN,to_char(NGAYBC,'YYYY-MM-DD') NGAYBC, NAMBC, MAPGD, CO_TONGHOP, MACN, NGUOI_NHAP,to_char(NGAY_NHAP,'YYYY-MM-DD') NGAY_NHAP, NGUOI_DUYET, NGAY_DUYET, D1"
                 + ", D2, D3, D4, D5, D6, D7, D8, D9, D10, D11, D12, D13, D14, D15, D16, D17, D18, D19, D20, D21, D22, D23, D24, D25, D26, D27, D28, D29"
                 +", D30, NHAPTAY, FONTFORMAT, KIEUIN from dulieu_nt where khoa = 'GSCMR_001' and to_char(NGAYBC, 'MM/YYYY') = '"+ dtpNgay.SelectedDate.Value.ToString("MM/yyyy") + "' ";
                 + //MessageBox.Show(strsql);
                 + _dt = ora.LoadDataText(strsql);
                 + foreach (DataRow dr in _dt.Rows)
                 + {
                 +  string sqladd =
                 +      "insert into DULIEU_NT(KHOA,THUTU,TT_HIENTHI,MA,TEN,NGAYBC,NAMBC,MAPGD,CO_TONGHOP,MACN,NGUOI_NHAP,NGAY_NHAP,NGUOI_DUYET,NGAY_DUYET "
                 +
                 +      ", D1, D2, D3, D4, D5, D6, D7, D8, D9, D10, D11, D12, D13, D14, D15, D16, D17, D18, D19, D20, D21, D22, D23, D24, D25 "
                 + ", D26, D27, D28, D29, D30, NHAPTAY, FONTFORMAT, KIEUIN)" + " Values('" + dr["KHOA"]
                 + "','" + _str.Right(dr["MA"].ToString(),2) + "','" + dr["TT_HIENTHI"] + "','" + dr["MA"] +
                 +      "',N'" + dr["TEN"] + "','" + dr["NGAYBC"] + "','" + dr["NAMBC"] + "','" + dr["MAPGD"] + "','" +
                 +      dr["CO_TONGHOP"] +
                 +      "','" + dr["MACN"] + "','" + dr["NGUOI_NHAP"] + "','" + dr["NGAY_NHAP"] + "','" +
                 +      dr["NGUOI_DUYET"] + "','" + dr["NGAY_DUYET"] + "',N'" + dr["D1"] + "','" + dr["D2"] + "',N'" +
                 +      dr["D3"] + "',N'"
                 + dr["D4"] + "','" + dr["D5"] + "','" + dr["D6"] + "','" + dr["D7"] + "','" + dr["D8"] + "','" +
                 +      dr["D9"] + "','" + dr["D10"] + "','" + dr["D11"] + "','" + dr["D12"] + "','" + dr["D13"] + "','" +
                 +      dr["D14"]
                 + "','" + dr["D15"] + "','" + dr["D16"] + "','" + dr["D17"] + "','" + dr["D18"] + "','" +
                 +      dr["D19"] + "','" + dr["D20"] + "','" + dr["D21"] + "','" + dr["D22"] + "','" + dr["D23"] +
                 +      "','" + dr["D24"] + "','" + dr["D25"]
                 + "','" + dr["D26"] + "','" + dr["D27"] + "','" + dr["D28"] + "','" + dr["D29"] + "','" +
                 +      dr["D30"] + "','" + dr["NHAPTAY"] + "','" + dr["FONTFORMAT"] + "',0)";
                 +   _cls.UpdateDataText(sqladd);
                 + }
                 + string strin = "with CT2 as "
                 +" (select * from(select a.NGAYBC, a.D5 MAXA, b.CVI_DESC TENXA, a.THUTU, a.D3 from DULIEU_NT a, TXN_POINT_INFO b"
                 + " where YEAR(a.NGAYBC) = '" + dtpNgay.SelectedDate.Value.ToString("yyyy") + "' and MONTH(a.NGAYBC) = '" + dtpNgay.SelectedDate.Value.ToString("MM") + "'"
                 + " and a.D5 = b.CVI_TXN_POINT_ID"
                 +" ) p pivot(max(D3) for thutu in ([01], [02], [03], [04], [05], [61],[62], [07], [08], [09], [10]) ) d )"
                 +" , lst1 as"
                 +" ("
                 +" select SUBSTRING(a.MAXA, 5, 4) MAPOS,b.PO_TEN,a.NGAYBC,a.MAXA,a.TENXA,isnull(a.[01], '')[01]"
                 +" ,isnull(a.[02], '')[02],isnull(a.[03], '')[03],isnull(a.[04], '')[04]"
                 +" ,isnull(a.[05], '')[05],isnull(a.[61], '')[61],isnull(a.[62], '')[62]"
                 +" ,isnull(a.[07], '')[07],isnull(a.[08], '')[08],isnull(a.[09], '')[09]"
                 +" ,isnull(a.[10], '')[10],(select D4 from DULIEU_NT"
                 + " where YEAR(NGAYBC) = '" + dtpNgay.SelectedDate.Value.ToString("yyyy") + "' and MONTH(NGAYBC) = '" + dtpNgay.SelectedDate.Value.ToString("MM") + "' and D5 = a.MAXA and MA = 'CMR01') LYDO"
                 + " from CT2 a, DMPOS b where SUBSTRING(a.MAXA, 5, 4) = SUBSTRING(b.PO_MA, 3, 4)"
                 +" )"
                 +" select a.MAPOS,a.PO_TEN,a.NGAYBC,a.MAXA,a.TENXA,a.[01],a.[02],a.[03],a.[04],a.[05],a.[61],a.[62]"
                 + " ,a.[07],a.[08],a.[09],a.[10],(case when a.LYDO = '' then N'Đạt : '+ cast((CAST([01] AS int)+CAST([02] AS int)+CAST([03] AS int)"
                 + " +CAST([04] AS int)+CAST([05] AS int)+CAST([61] AS int)+CAST([62] AS int)+CAST([07] AS int)"
                 + " +CAST([08] AS int)+CAST([09] AS int)++CAST([10] AS int))*100 / 11 as nvarchar(10))+'%'  else a.LYDO end) LYDO from lst1 a order by a.MAXA";
                 */
                #endregion

                //         string strin = " with CT2 as (select * from(select * from LUU_CAMERA where NAM = '"+nam+"' and thang = '"+thang+"') p pivot(max(D3) for thutu in ([1], [2], [3], [4], [5], [6],[7], [8], [9], [10],[11]) ) d ) , lst1 as"
                //               +" (select SUBSTRING(a.MAXA, 5, 4) MAPOS,b.PO_TEN,a.MAXA,a.TPI_DESC TENXA, sum(isnull(CAST([1] AS int), 0)) [01]"
                //               +" ,sum(isnull(CAST([2] AS int), 0)) [02],sum(isnull(CAST([3] AS int), 0)) [03],sum(isnull(CAST([4] AS int), 0)) [04] "
                //               +" ,sum(isnull(CAST([5] AS int), 0)) [05],sum(isnull(CAST([6] AS int), 0)) [06],sum(isnull(CAST([7] AS int), 0)) [07] "
                //+" ,sum(isnull(CAST([8] AS int), 0)) [08],sum(isnull(CAST([9] AS int), 0)) [09],sum(isnull(CAST([10] AS int), 0)) [10] "
                //+" ,sum(isnull(CAST([11] AS int), 0))[11],a.D4 LYDO from CT2 a, DMPOS b where left(a.MAXA, 4) = right(b.PO_MA, 4) "
                //               +" group by SUBSTRING(a.MAXA, 5, 4),b.PO_TEN,a.MAXA,a.TPI_DESC,a.D4 ) select '"+ng+"' NGAYBC,* from lst1 order by MAXA";
                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");
                var          dtin = _cls.LoadDataProcPara("usp_Camera01", bien, giatri, thamso);
                rpt_Camera01 rpt  = new rpt_Camera01();
                RPUtility.ShowRp(rpt, dtin, this, srv.DbSourceSerVer(), srv.DbNameSerVer(), srv.DbUserSerVer(), srv.DbPassSerVer());
            }
            catch (Exception ex)
            {
                MessageBox.Show("Error" + ex.Message, "Error", MessageBoxButton.OK, MessageBoxImage.Error);
            }
            _cls.DongKetNoi();
            ora.DongKetNoi();
        }
        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();
            }
        }
Exemple #18
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
        }
        private void btnOk_Click(object sender, RoutedEventArgs e)
        {
            //MessageBox.Show(BienBll.NdMadv.Trim());
            cls.ClsConnect();
            if (ChkTongHop.IsChecked == false)
            {
                int      thamso = 3;
                string[] bien   = new string[thamso];
                object[] giatri = new object[thamso];
                bien[0] = "@TuNgay";
                if (dtpTuNgay.SelectedDate != null)
                {
                    giatri[0] = dtpTuNgay.SelectedDate.Value.ToString("yyyy-MM-dd");
                }
                else
                {
                    MessageBox.Show("Chọn ngày : ");
                    return;
                }
                bien[1] = "@DenNgay";
                if (dtpTuNgay.SelectedDate != null)
                {
                    giatri[1] = dtpDenNgay.SelectedDate.Value.ToString("yyyy-MM-dd");
                }
                else
                {
                    MessageBox.Show("Chọn ngày : ");
                    return;
                }

                bien[2]   = "@MaPos";
                giatri[2] = BienBll.NdMadv.Trim();
                // MessageBox.Show(giatri[0] + "  " + giatri[1]);
                dt = cls.LoadDataProcPara("usp_KhGnTn", bien, giatri, thamso);
                if (dt.Rows.Count > 0)
                {
                    // dataGrid1.ItemsSource = dt.DefaultView;
                    rpt_KhGnTn rpt = new rpt_KhGnTn();
                    RPUtility.ShowRp(rpt, dt, this, srv.DbSourceSerVer(), srv.DbNameSerVer(), srv.DbUserSerVer(),
                                     srv.DbPassSerVer());
                }
                else
                {
                    MessageBox.Show("Không có dữ liệu !", "Mess");
                }
            }
            else if (Ration1.IsChecked == true)
            {
                int      thamso = 2;
                string[] bien   = new string[thamso];
                object[] giatri = new object[thamso];
                bien[0] = "@TuNgay";
                if (dtpTuNgay.SelectedDate != null)
                {
                    giatri[0] = dtpTuNgay.SelectedDate.Value.ToString("yyyy-MM-dd");
                }
                else
                {
                    MessageBox.Show("Chọn ngày : ");
                    return;
                }
                bien[1] = "@DenNgay";
                if (dtpTuNgay.SelectedDate != null)
                {
                    giatri[1] = dtpDenNgay.SelectedDate.Value.ToString("yyyy-MM-dd");
                }
                else
                {
                    MessageBox.Show("Chọn ngày : ");
                    return;
                }

                dt = cls.LoadDataProcPara("usp_KhGnTn01", bien, giatri, thamso);
                if (dt.Rows.Count > 0)
                {
                    //dataGrid1.ItemsSource = dt.DefaultView;
                    rpt_KhGnTn01 rpt = new rpt_KhGnTn01();
                    RPUtility.ShowRp(rpt, dt, this, srv.DbSourceSerVer(), srv.DbNameSerVer(), srv.DbUserSerVer(),
                                     srv.DbPassSerVer());
                }
                else
                {
                    MessageBox.Show("Không có dữ liệu !", "Mess");
                }
            }
            else
            {
                int      thamso = 2;
                string[] bien   = new string[thamso];
                object[] giatri = new object[thamso];
                bien[0] = "@TuNgay";
                if (dtpTuNgay.SelectedDate != null)
                {
                    giatri[0] = dtpTuNgay.SelectedDate.Value.ToString("yyyy-MM-dd");
                }
                else
                {
                    MessageBox.Show("Chọn ngày : ");
                    return;
                }
                bien[1] = "@DenNgay";
                if (dtpTuNgay.SelectedDate != null)
                {
                    giatri[1] = dtpDenNgay.SelectedDate.Value.ToString("yyyy-MM-dd");
                }
                else
                {
                    MessageBox.Show("Chọn ngày : ");
                    return;
                }

                dt = cls.LoadDataProcPara("usp_KhGnTn02", bien, giatri, thamso);
                if (dt.Rows.Count > 0)
                {
                    //dataGrid1.ItemsSource = dt.DefaultView;
                    rpt_KhGnTn02 rpt = new rpt_KhGnTn02();
                    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();
        }
Exemple #20
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);
            }
        }
        private void Print_OnClick(object sender, RoutedEventArgs e)
        {
            try
            {
                _cls.ClsConnect();
                int      thamso = 3;
                string[] bien   = new string[thamso];
                object[] giatri = new object[thamso];
                bien[0]   = "@Nam";
                giatri[0] = comboBoxYear.SelectedValue;
                bien[1]   = "@Quy";
                giatri[1] = CboQuy.SelectionBoxItem.ToString().Trim();
                bien[2]   = "@Dot";
                giatri[2] = bll.Left(CboDot.SelectedValue.ToString(), 1);

                //MessageBox.Show(giatri[0] + "   " + giatri[1]);
                //dt = cls.LoadDataProcPara("usp_KHB", bien, giatri, thamso);
                _cls.UpdateDataProcPara("usp_CongThiDua", bien, giatri, thamso);

                //string strcong = "with lst1 as "
                //                  +" (select CHUYENDE, sum(DIEM) DIEM, sum(P0101) P0101, sum(P0102) P0102, sum(P0201) P0201, sum(P0202) P0202 "
                //                  +", sum(P0301) P0301, sum(P0302) P0302, sum(P0401) P0401, sum(P0402) P0402, sum(P0501) P0501, sum(P0502) P0502 "
                //                  +", sum(P0601) P0601, sum(P0602) P0602, sum(P0701) P0701, sum(P0702) P0702, sum(P0801) P0801, sum(P0802) P0802 "
                //                  + " from MAU_THIDUA where CONG='0' and NAM='" + comboBoxYear.SelectedValue + "' and QUY='" + CboQuy.SelectionBoxItem.ToString().Trim()
                //                  + "' and DOT='" + bll.Left(CboDot.SelectedValue.ToString(), 1) + "' and CHUYENDE='" + RadCboChDe.SelectedValue.ToString().Trim() + "' group by CHUYENDE ) "
                //                  + "update a set a.P0101 = b.P0101,a.P0102 = b.P0102,a.P0201 = b.P0201,a.P0202 = b.P0202,a.P0301 = b.P0301,a.P0302 = b.P0302, "
                //                  +" a.P0401 = b.P0401,a.P0402 = b.P0402,a.P0501 = b.P0501,a.P0502 = b.P0502,a.P0601 = b.P0601,a.P0602 = b.P0602, "
                //                  + " a.P0701 = b.P0701,a.P0702 = b.P0702,a.P0801 = b.P0801,a.P0802 = b.P0802 from MAU_THIDUA a, lst1 b "
                //                  + " where a.NAM='" + comboBoxYear.SelectedValue + "' and a.QUY='" + CboQuy.SelectionBoxItem.ToString().Trim()
                //                  + "' and a.DOT='" + bll.Left(CboDot.SelectedValue.ToString(), 1) + "' and a.CHUYENDE='" + RadCboChDe.SelectedValue.ToString().Trim() + "' and a.CHUYENDE = b.CHUYENDE and a.CONG='1' and a.CHONIN='1'";
                //MessageBox.Show(strcong);
                // _cls.UpdateDataText(strcong);
                string strin = "";
                if (ChkTh.IsChecked == true)
                {
                    strin = "select b.PO_TEN,a.*,P" + CboPos.SelectedValue.ToString().Substring(4, 2) + "01 CHAMDIEM ," +
                            "( case when a.DOT=0 then c.MOTA+' Quý '+ a.QUY + ' Năm '+ a.NAM else c.MOTA end ) TITLE,NGNH"
                            + CboPos.SelectedValue.ToString().Substring(4, 2) + " NG_NHAN from MAU_THIDUA a,DMPOS b,DOT_THIDUA c where a.NAM='"
                            + comboBoxYear.SelectedValue + "' and a.QUY='" + CboQuy.SelectionBoxItem.ToString().Trim() + "' and a.DOT='"
                            + bll.Left(CboDot.SelectedValue.ToString(), 1) + "' and b.PO_MA='" + bll.Left(CboPos.SelectedValue.ToString().Trim(), 6) + "' and a.DOT=c.DOT and a.CHONIN='1' order by a.CHUYENDE,a.STT";
                }
                else
                {
                    strin = "select b.PO_TEN,a.*,P" + CboPos.SelectedValue.ToString().Substring(4, 2) + "01 CHAMDIEM ,case when a.DOT=0 then c.MOTA+' Quý '+ a.QUY + ' Năm '+ a.NAM else c.MOTA end TITLE,NGNH"
                            + CboPos.SelectedValue.ToString().Substring(4, 2) + " NG_NHAN from MAU_THIDUA a,DMPOS b,DOT_THIDUA c where a.NAM='"
                            + comboBoxYear.SelectedValue + "' and a.QUY='" + CboQuy.SelectionBoxItem.ToString().Trim() + "' and a.DOT='"
                            + bll.Left(CboDot.SelectedValue.ToString(), 1) + "' and b.PO_MA='" + bll.Left(CboPos.SelectedValue.ToString().Trim(), 6) + "' and a.DOT=c.DOT and CHUYENDE='" + RadCboChDe.SelectedValue + "' and a.CHONIN='1' order by a.STT";
                }

                //MessageBox.Show(strin);
                _dt = _cls.LoadDataText(strin);
                if (_dt.Rows.Count > 0)
                {
                    rpt_ThiDua01 rpt = new rpt_ThiDua01();
                    RPUtility.ShowRp(rpt, _dt, this, srv.DbSourceSerVer(), srv.DbNameSerVer(), srv.DbUserSerVer(), srv.DbPassSerVer());
                }
                else
                {
                    MessageBox.Show("Không có dữ liệu để in !", "Thông báo", MessageBoxButton.OK, MessageBoxImage.Warning);
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("Error \n" + ex.Message, "Thông báo", MessageBoxButton.OK, MessageBoxImage.Error);
            }
            _cls.DongKetNoi();
        }
        private void btnOK_Click(object sender, RoutedEventArgs e)
        {
            ClsServer cls = new ClsServer();

            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] = 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();
                bien[4]   = "@Chtr";
                giatri[4] = bll.Left(CboChTr.SelectedValue.ToString(), 2);
                dt        = cls.LoadLdbf("usp_TTDSHN", bien, giatri, thamso);
                rpt_ChkDoituong rpt = new rpt_ChkDoituong();
                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);
            }
        }
Exemple #23
0
 private void lblIn_MouseDown(object sender, MouseButtonEventArgs e)
 {
     dtNew = dt.GetChanges();
     if (dtNew == null || dtNew.Rows.Count == 0)
     {
         MessageBox.Show("Chưa có thay đổi nào !", "Thông báo", MessageBoxButton.OK, MessageBoxImage.Warning);
     }
     else
     {
         rpt_Mau06 rpt = new rpt_Mau06();
         RPUtility.ShowRp(rpt, dtNew, this, srv.DbSourceSerVer(), srv.DbNameSerVer(), srv.DbUserSerVer(), srv.DbPassSerVer());
     }
 }
        private void btnOk_Click(object sender, RoutedEventArgs e)
        {
            cls.ClsConnect();
            if (Ration1.IsChecked == true)
            {
                try
                {
                    int      thamso = 3;
                    string[] bien   = new string[thamso];
                    object[] giatri = new object[thamso];
                    bien[0] = "@Mato";
                    if (CboTo != null)
                    {
                        giatri[0] = bll.Left(CboTo.SelectedValue.ToString().Trim(), 7);
                    }
                    else
                    {
                        MessageBox.Show("Chọn Tổ", "Mess");
                        return;
                    }
                    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;
                    }
                    bien[2]   = "@MucTon";
                    giatri[2] = txtTon.Text;
                    dt        = cls.LoadDataProcPara("usp_LaiTonCT", bien, giatri, thamso);
                    if (dt.Rows.Count > 0)
                    {
                        rpt_LaiTonCt rpt = new rpt_LaiTonCt();
                        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);
                }
            }
            else if (Ration2.IsChecked == true)
            {
                try
                {
                    int      thamso = 3;
                    string[] bien   = new string[thamso];
                    object[] giatri = new object[thamso];
                    bien[0] = "@MaXa";
                    if (CboXa != null)
                    {
                        giatri[0] = bll.Left(CboXa.SelectedValue.ToString().Trim(), 6);
                    }
                    else
                    {
                        MessageBox.Show("Chọn Xã", "Mess");
                        return;
                    }
                    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;
                    }
                    bien[2]   = "@MucTon";
                    giatri[2] = txtTon.Text;
                    dt        = cls.LoadDataProcPara("usp_LaiTonTo", bien, giatri, thamso);
                    if (dt.Rows.Count > 0)
                    {
                        rpt_LaiTonTo rpt = new rpt_LaiTonTo();
                        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);
                }
            }
            else if (Ration3.IsChecked == true)
            {
                try
                {
                    int      thamso = 3;
                    string[] bien   = new string[thamso];
                    object[] giatri = new object[thamso];
                    bien[0] = "@MaPos";
                    if (CboPos.SelectedValue != null)
                    {
                        giatri[0] = bll.Left(CboPos.SelectedValue.ToString().Trim(), 6);
                    }
                    else
                    {
                        MessageBox.Show("Chọn POS", "Mess");
                        return;
                    }
                    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;
                    }
                    bien[2]   = "@MucTon";
                    giatri[2] = txtTon.Text;
                    dt        = cls.LoadDataProcPara("usp_LaiTonXa", bien, giatri, thamso);
                    if (dt.Rows.Count > 0)
                    {
                        //dataGrid1.ItemsSource = dt.DefaultView;
                        rpt_LaiTonXa rpt = new rpt_LaiTonXa();
                        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);
                }
            }
            else if (Ration4.IsChecked == true)
            {
                try
                {
                    int      thamso = 2;
                    string[] bien   = new string[thamso];
                    object[] giatri = new object[thamso];
                    bien[0]   = "@MucTon";
                    giatri[0] = txtTon.Text;
                    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;
                    }

                    dt = cls.LoadDataProcPara("usp_LaiTonPos", bien, giatri, thamso);
                    if (dt.Rows.Count > 0)
                    {
                        //dataGrid1.ItemsSource = dt.DefaultView;
                        rpt_LaiTonPos rpt = new rpt_LaiTonPos();
                        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);
                }
            }
            else if (Ration5.IsChecked == true)
            {
                try
                {
                    int      thamso = 3;
                    string[] bien   = new string[thamso];
                    object[] giatri = new object[thamso];
                    bien[0] = "@MaPos";
                    if (CboPos.SelectedValue != null)
                    {
                        giatri[0] = bll.Left(CboPos.SelectedValue.ToString().Trim(), 6);
                    }
                    else
                    {
                        MessageBox.Show("Chọn POS", "Mess");
                        return;
                    }
                    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;
                    }
                    bien[2]   = "@MucTon";
                    giatri[2] = txtTon.Text;
                    if (ChkAll.IsChecked == true)
                    {
                        dt = cls.LoadDataProcPara("usp_LaiTonAll", bien, giatri, thamso);
                    }
                    else
                    {
                        dt = cls.LoadDataProcPara("usp_LaiTonChTr", bien, giatri, thamso);
                    }
                    rpt_LaiTonCTXa rpt = new rpt_LaiTonCTXa();
                    RPUtility.ShowRp(rpt, dt, this, srv.DbSourceSerVer(), srv.DbNameSerVer(), srv.DbUserSerVer(), srv.DbPassSerVer());
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message);
                }
            }
            else if (Ration6.IsChecked == true)
            #region
            {
                try
                {
                    int      thamso = 3;
                    string[] bien   = new string[thamso];
                    object[] giatri = new object[thamso];
                    bien[0] = "@Mato";
                    if (CboTo != null)
                    {
                        giatri[0] = bll.Left(CboTo.SelectedValue.ToString().Trim(), 7);
                    }
                    else
                    {
                        MessageBox.Show("Chọn Tổ", "Mess");
                        return;
                    }
                    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;
                    }
                    bien[2]   = "@MucTon";
                    giatri[2] = txtTon.Text.Trim();
                    dt        = cls.LoadDataProcPara("usp_LaiTonGB", bien, giatri, thamso);
                    if (dt.Rows.Count > 0)
                    {
                        rpt_LaiTonGB rpt = new rpt_LaiTonGB();
                        //rpt.PrintOptions.PaperSize=PaperSize.PaperA4;
                        //rpt.PrintOptions.PaperOrientation=PaperOrientation.Portrait;

                        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);
                }
            }
            #endregion
            else if (Ration7.IsChecked == true)
            #region
            {
                try
                {
                    int      thamso = 2;
                    string[] bien   = new string[thamso];
                    object[] giatri = new object[thamso];
                    bien[0] = "@MaPos";
                    if (CboTo != null)
                    {
                        giatri[0] = bll.Left(CboPos.SelectedValue.ToString().Trim(), 6);
                    }
                    else
                    {
                        MessageBox.Show("Chọn POS", "Mess");
                        return;
                    }
                    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;
                    }
                    dt = cls.LoadDataProcPara("usp_ThuLaiTon", bien, giatri, thamso);
                    if (dt.Rows.Count > 0)
                    {
                        rpt_ThuLaiTon rpt = new rpt_ThuLaiTon();
                        //rpt.PrintOptions.PaperSize=PaperSize.PaperA4;
                        //rpt.PrintOptions.PaperOrientation=PaperOrientation.Portrait;

                        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);
                }
            }
            #endregion
            else if (Ration8.IsChecked == true)
            #region
            {
                try
                {
                    int      thamso = 3;
                    string[] bien   = new string[thamso];
                    object[] giatri = new object[thamso];
                    bien[0] = "@MaXa";
                    if (CboXa != null)
                    {
                        giatri[0] = bll.Left(CboXa.SelectedValue.ToString().Trim(), 6);
                    }
                    else
                    {
                        MessageBox.Show("Chọn Xã", "Mess");
                        return;
                    }
                    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;
                    }
                    bien[2]   = "@MucTon";
                    giatri[2] = txtTon.Text.Trim();
                    dt        = cls.LoadDataProcPara("usp_KiemtraDoichieu", bien, giatri, thamso);
                    if (dt.Rows.Count > 0)
                    {
                        rpt_KiemtraDoichieu rpt = new rpt_KiemtraDoichieu();
                        //rpt.PrintOptions.PaperSize=PaperSize.PaperA4;
                        //rpt.PrintOptions.PaperOrientation=PaperOrientation.Portrait;

                        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);
                }
            }
            #endregion
        }
Exemple #25
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();
 }
Exemple #26
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();
        }
Exemple #27
0
 private void btnOk_Click(object sender, RoutedEventArgs e)
 {
     try
     {
         cls.ClsConnect();
         DataTable dt     = new DataTable();
         int       thamso = 2;
         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");
         }
         //MessageBox.Show(giatri[0] + "  " + giatri[1] + "  " + giatri[2] + "  " + giatri[3] + "  " + giatri[4]);
         dt = cls.LoadLdbf("usp_TkXa", bien, giatri, thamso);
         //rpt_kt740_01 rpt = new rpt_kt740_01();
         if (dt.Rows.Count > 0)
         {
             rpt_TkXa rpt = new rpt_TkXa();
             RPUtility.ShowRp(rpt, dt, this, srv.DbSourceSerVer(), srv.DbNameSerVer(), srv.DbUserSerVer(), srv.DbPassSerVer());
             //dataGrid1.ItemsSource = dt.DefaultView;
             // FileName = Thumuc + "\\" + str.Left(CboPos.SelectedValue.ToString().Trim(), 6) + "_" + str.Left(CboDvut.SelectedValue.ToString().Trim(), 2) + "_" + str.Left(CboXa.SelectedValue.ToString().Trim(), 6) + "_" + dtpNgay.SelectedDate.Value.ToString("ddMMyyyy") + ".xlsx";
             // str.WriteDataTableToExcel(dt, "Person Details", FileName, "Details");
             //MessageBox.Show("Copy Excel to : " );
         }
         else
         {
             MessageBox.Show("Không có số liệu", "Thông báo", MessageBoxButton.OK, MessageBoxImage.Warning);
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message, "Error", MessageBoxButton.OK, MessageBoxImage.Error);
     }
     cls.DongKetNoi();
 }
Exemple #28
0
        private void btnOk_Click(object sender, RoutedEventArgs e)
        {
            cls.ClsConnect();
            try
            {
                int      thamso = 5;
                string[] bien   = new string[thamso];
                object[] giatri = new object[thamso];
                bien[0] = "@Mato";
                if (CboTo != null)
                {
                    giatri[0] = bll.Left(CboTo.SelectedValue.ToString().Trim(), 7);
                }
                else
                {
                    MessageBox.Show("Chọn Tổ", "Mess");
                    return;
                }
                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;
                }
                bien[2]   = "@MaPos";
                giatri[2] = bll.Left(CboPos.SelectedValue.ToString().Trim(), 6);
                bien[3]   = "@Mau";
                if (Ration1.IsChecked == true)
                {
                    giatri[3] = '1';
                    FileName  = Thumuc + "\\" + bll.Left(CboPos.SelectedValue.ToString().Trim(), 6) + "_LAITHANG_XA_" + bll.Left(CboTo.SelectedValue.ToString().Trim(), 7) + "_" + dtpNgay.SelectedDate.Value.ToString("ddMMyyyy") + ".csv";
                }
                else
                {
                    giatri[3] = '2';
                    FileName  = Thumuc + "\\" + bll.Left(CboPos.SelectedValue.ToString().Trim(), 6) + "_LAITHANG_CHTR_" + bll.Left(CboTo.SelectedValue.ToString().Trim(), 7) + "_" + dtpNgay.SelectedDate.Value.ToString("ddMMyyyy") + ".csv";
                }
                bien[4]   = "@MaXa";
                giatri[4] = bll.Left(CboXa.SelectedValue.ToString().Trim(), 6);

                dt = cls.LoadDataProcPara("usp_LAIDT", bien, giatri, thamso);
                if (dt.Rows.Count > 0)
                {
                    if (Ration1.IsChecked == true)
                    {
                        rpt_LAIDT rpt = new rpt_LAIDT();
                        RPUtility.ShowRp(rpt, dt, this, srv.DbSourceSerVer(), srv.DbNameSerVer(), srv.DbUserSerVer(), srv.DbPassSerVer());
                    }
                    else
                    {
                        bll.ExportToExcel(dt, FileName);
                        MessageBox.Show("Copy Excel to : " + FileName, "Thông báo", MessageBoxButton.OK, MessageBoxImage.Information);
                        bll.OpenExcel(FileName);
                    }
                }
                else
                {
                    MessageBox.Show("Không có bản ghi nào ", "Mess");
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
Exemple #29
0
        private void btnOk_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                cls.ClsConnect();
                string pos   = CboPos.SelectedValue.ToString().Trim();
                string thang = dtpNgay.SelectedDate.Value.Month.ToString();
                string nam   = dtpNgay.SelectedDate.Value.ToString("yyyy");
                string cap   = var2;
                //if (Opt1.IsChecked == true) cap = "1";else cap = "2";
                if (KyBC == "1")
                {
                    foreach (DataRow dr in dt.Rows)
                    {
                        string strup = "update LUUKTNB01 set COT3='" + dr["COT3"] + "',COT4='" + dr["COT4"] + "',COT5='" +
                                       dr["COT5"] + "',COT6='" + dr["COT6"] + "',COT7='" + dr["COT7"] + "',COT8='" +
                                       dr["COT8"] + "',COT9='" + dr["COT9"] + "',COT10='" + dr["COT10"] + "',COT11='" +
                                       dr["COT11"] + "',COT12='" + dr["COT12"] + "',COT13='" + dr["COT13"] + "',COT14='" +
                                       dr["COT14"] + "',COT15='" + dr["COT15"] + "',COT16='" + dr["COT16"] + "',COT17='" +
                                       dr["COT17"] + "',COT18='" + dr["COT18"] + "',GHICHU='" + dr["GHICHU"] +
                                       "' where POS='" + pos + "' and thang='" + thang + "' and nam='" + nam +
                                       "' and cap='" + cap + "' and KT_KHOA='" + dr["KT_KHOA"] + "' and MAU='" + Mau + "'";
                        //MessageBox.Show(strup);
                        cls.UpdateDataText(strup);
                    }
                    MessageBox.Show("Lưu thành công !", "Mess", MessageBoxButton.OK, MessageBoxImage.Information);
                }

                int      thamso = 5;
                string[] bien   = new string[thamso];
                object[] giatri = new object[thamso];
                bien[0]   = "@MaPos";
                giatri[0] = s.Left(CboPos.SelectedValue.ToString().Trim(), 6);
                bien[1]   = "@Ngay";
                if (dtpNgay.SelectedDate != null)
                {
                    giatri[1] = dtpNgay.SelectedDate.Value.ToString("yyyy-MM-dd");
                }
                bien[2]   = "@Cap";
                giatri[2] = var2;
                //if (Opt1.IsChecked == true) giatri[2] = "1";
                //else giatri[2] = "2";
                bien[3]   = "@Mau";
                giatri[3] = Mau;
                bien[4]   = "@KyBC";
                giatri[4] = KyBC;
                var         _dt = cls.LoadDataProcPara("usp_UpKTNB03", bien, giatri, thamso);
                rpt_KTNB_03 rpt = new rpt_KTNB_03();
                RPUtility.ShowRp(rpt, _dt, this, srv.DbSourceSerVer(), srv.DbNameSerVer(), srv.DbUserSerVer(), srv.DbPassSerVer());
                LblGetData_OnMouseDown(null, null);

                /*
                 * MessageBox.Show(strin);
                 * var dtin =cls.LoadDataText(strin);
                 * Xtra_KTNB_06 rpt = new Xtra_KTNB_06();//xtra_KTNB_06 rpt = new xtra_KTNB_06();
                 * rpt.DataSource = dtin;
                 * rpt.DataMember = rpt.DataMember;
                 * rpt.ShowPreviewDialog();
                 */
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Error", MessageBoxButton.OK, MessageBoxImage.Error);
            }
            cls.DongKetNoi();
        }
Exemple #30
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());
            }
        }