コード例 #1
0
ファイル: WpfDonGia.xaml.cs プロジェクト: tutmvbsp/vbspinfor
 private void btnOk_Click(object sender, RoutedEventArgs e)
 {
     try
     {
         cls.ClsConnect();
         const int thamso = 2;
         string[]  bien   = new string[thamso];
         object[]  giatri = new object[thamso];
         bien[0] = "@Ngay";
         if (dtpNgay.SelectedDate != null)
         {
             giatri[0] = dtpNgay.SelectedDate.Value.ToString("dd/MM/yyyy");
         }
         bien[1]   = "@MaPos";
         giatri[1] = bll.Left(CboPos.SelectedValue.ToString().Trim(), 6);
         //MessageBox.Show(giatri[0].ToString() + "   " + giatri[1].ToString());
         dt = cls.LoadDataProcPara("usp_DonGia", bien, giatri, thamso);
         //MessageBox.Show(BienBll.NdMadv+"  "+BienBll.MainPos);
         if (BienBll.NdMadv == BienBll.MainPos)
         {
             rpt_DonGia rpt = new rpt_DonGia();
             RPUtility.ShowRp(rpt, dt, this, srv.DbSourceSerVer(), srv.DbNameSerVer(), srv.DbUserSerVer(), srv.DbPassSerVer());
         }
         else
         {
             rpt_DonGiaHuyen rpt = new rpt_DonGiaHuyen();
             RPUtility.ShowRp(rpt, dt, this, srv.DbSourceSerVer(), srv.DbNameSerVer(), srv.DbUserSerVer(), srv.DbPassSerVer());
         }
         cls.DongKetNoi();
     }
     catch (Exception ex)
     {
         MessageBox.Show("Lổi, liên hệ phòng tin học" + ex.Message, "Thông báo", MessageBoxButton.OK, MessageBoxImage.Error);
     }
 }
コード例 #2
0
ファイル: WpfPstk.xaml.cs プロジェクト: tutmvbsp/vbspinfor
        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");
            }
        }
コード例 #3
0
 private void btnOk_Click(object sender, RoutedEventArgs e)
 {
     //var lastMonth = new DateTime(dtpNgay.SelectedDate.Value.Year, dtpNgay.SelectedDate.Value.Month, DateTime.DaysInMonth(dtpNgay.SelectedDate.Value.Year, dtpNgay.SelectedDate.Value.Month));
     cls.ClsConnect();
     try
     {
         int      thamso = 2;
         string[] bien   = new string[thamso];
         object[] giatri = new object[thamso];
         bien[0]   = "@Ma";
         giatri[0] = bll.Left(CboCanbo.SelectedValue.ToString().Trim(), 10);
         bien[1]   = "@Ngay";
         if (dtpNgay.SelectedDate != null)
         {
             giatri[1] = dtpNgay.SelectedDate.Value.ToString("yyyy-MM-dd");
         }
         dt = cls.LoadDataProcPara("usp_ChamCongPC", bien, giatri, thamso);
         if (dt.Rows.Count > 0)
         {
             rpt_ChamCong06 rpt = new rpt_ChamCong06();
             RPUtility.ShowRp(rpt, dt, this, srv.DbSourceSerVer(), srv.DbNameSerVer(), srv.DbUserSerVer(), srv.DbPassSerVer());
         }
         else
         {
             MessageBox.Show("Không có bản ghi nào!", "Thông báo", MessageBoxButton.OK, MessageBoxImage.Warning);
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
     cls.DongKetNoi();
 }
コード例 #4
0
 private void BtnPrint_OnClick(object sender, RoutedEventArgs e)
 {
     try
     {
         _cls.ClsConnect();
         var dt = _cls.LoadDataText("select a.NAM,a.POS,b.PO_TEN, c.TEN TENNGUON, d.TEN NGUON,count(a.TIEUDE) DEM "
                                    + " from TT_CAPNHAT a, DMPOS b, TT_THELOAI c, TT_NGUONTIN d where a.POS = b.PO_MA and a.MA_THELOAI = c.MA and a.MA_NGUON = d.MA "
                                    + " and a.NAM = '" + dtpNgay.SelectedDate.Value.ToString("yyyy") + "' and right(a.POS, 2) <> '00' group by a.NAM, a.POS, b.PO_TEN, c.TEN, d.TEN order by a.POS, c.TEN, d.TEN");
         if (dt.Rows.Count > 0)
         {
             rpt_TuyenTruyen rpt = new rpt_TuyenTruyen();
             RPUtility.ShowRp(rpt, dt, this, srv.DbSourceSerVer(), srv.DbNameSerVer(), srv.DbUserSerVer(),
                              srv.DbPassSerVer());
         }
         else
         {
             MessageBox.Show("Không có tin nào ! : ", "Thông báo", MessageBoxButton.OK, MessageBoxImage.Warning);
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show("Lỗi : " + ex.Message, "Thông báo", MessageBoxButton.OK, MessageBoxImage.Error);
     }
     _cls.DongKetNoi();
 }
コード例 #5
0
ファイル: WpfKTNB01.xaml.cs プロジェクト: tutmvbsp/vbspinfor
        private void BtnOk_OnClick(object sender, RoutedEventArgs e)
        {
            try
            {
                cls.ClsConnect();
                string pos   = s.Left(CboPos.SelectedValue.ToString(), 6);
                string thang = dtpNgay.SelectedDate.Value.ToString("MM");
                string nam   = dtpNgay.SelectedDate.Value.ToString("yyyy");
                dtNew = dt.GetChanges();
                if (dtNew != null && dtNew.Rows.Count > 0)
                {
                    foreach (DataRow dr in dtNew.Rows)
                    {
                        //MessageBox.Show(dr["NG_MATO"].ToString()+"      "+dr["A01"].ToString());
                        string strsql = "update LUUKTNB set COT03=" + dr["COT03"] + ",COT04=" + dr["COT04"] + ",COT05=" + dr["COT05"]
                                        + ",COT06=" + dr["COT06"] + ",COT07=" + dr["COT07"]
                                        + ",COT08=" + dr["COT08"] + ",COT09=" + dr["COT09"] + ",COT10=" + dr["COT10"] + ",COT11=" +
                                        dr["COT11"] + ",COT12=" + dr["COT12"] + ",COT13=" + dr["COT13"] + ",COT14=" + dr["COT14"] +
                                        ",COT15=" + dr["COT15"] + ",COT16=" + dr["COT16"] + ",COT17=" + dr["COT17"]
                                        + ",ND_MA='" + BienBll.Ndma + "',ND_TEN=N'" + BienBll.NdTen + "'"
                                        + " where MAPOS='" + pos + "' and TT='" + dr["TT"] + "' and THANG='" + thang + "' and NAM='" + nam + "' and MAU='2'";
                        cls.UpdateDataText(strsql);
                    }
                }
                else
                {
                    MessageBox.Show("Xem lại. Chưa có thay đổi nào!", "Mess", MessageBoxButton.OK, MessageBoxImage.Warning);
                }
                string strup = "update LUUKTNB set COT05= (case when COT03>0 then COT04*100/COT03 else 0 end)" +
                               ",COT08=(case when COT06>0 then COT07*100/COT06 else 0 end) " +
                               ",COT11=(case when COT09>0 then COT10*100/COT09 else 0 end) " +
                               ",COT14=(case when COT12>0 then COT13*100/COT12 else 0 end) " +
                               ",COT17=(case when COT15>0 then COT16*100/COT15 else 0 end) " +
                               "where MAPOS='" + pos + "' and THANG='" + thang + "' and NAM='" + nam + "' and MAU='2'";
                cls.UpdateDataText(strup);
                if (Option1.IsChecked == true)
                {
                    strin = "select * from LUUKTNB where MAPOS='" + pos + "' and THANG='" + thang +
                            "' and NAM='" + nam + "' and MA='H' and MAU='2' order by TT";
                }
                else
                {
                    strin = "select * from LUUKTNB where MAPOS='" + pos + "' and THANG='" + thang +
                            "' and NAM='" + nam + "' and MA='T' and MAU='2'  order by TT";
                }

                var dtin =
                    cls.LoadDataText(strin);
                rpt_KTNB01 rpt = new rpt_KTNB01();
                RPUtility.ShowRp(rpt, dtin, this, srv.DbSourceSerVer(), srv.DbNameSerVer(), srv.DbUserSerVer(), srv.DbPassSerVer());
            }
            catch (Exception ex)
            {
                MessageBox.Show("Error \n" + ex.Message, "Mess", MessageBoxButton.OK, MessageBoxImage.Error);
            }
            finally
            {
                cls.DongKetNoi();
            }
        }
コード例 #6
0
ファイル: WpfSkePnkt.xaml.cs プロジェクト: tutmvbsp/vbspinfor
 private void btnOk_Click(object sender, RoutedEventArgs e)
 {
     dtNew = dt.Clone();
     foreach (DataRow dr in dt.Rows)
     {
         if ((bool)dr[0] == true)
         {
             dtNew.ImportRow(dr);
         }
     }
     if (dtNew == null || dtNew.Rows.Count == 0)
     {
         MessageBox.Show("Chưa chọn khách hàng nào ", "Mess");
     }
     else
     {
         if (Opt1.IsChecked == true)
         {
             rpt_SkePnkt rpt = new rpt_SkePnkt();
             RPUtility.ShowRp(rpt, dtNew, this, srv.DbSourceSerVer(), srv.DbNameSerVer(), srv.DbUserSerVer(),
                              srv.DbPassSerVer());
         }
         else
         {
             FileName = Thumuc + "\\" + bll.Left(CboPos.SelectedValue.ToString().Trim(), 6) + "_" + bll.Left(CboXa.SelectedValue.ToString().Trim(), 7) + "_PNKT_" + 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");
             bll.ToCSV(dt, sw, true);
             MessageBox.Show("Copy Excel to : " + FileName, "Thông báo", MessageBoxButton.OK, MessageBoxImage.Information);
         }
     }
 }
コード例 #7
0
ファイル: WpfXLN_M1.xaml.cs プロジェクト: tutmvbsp/vbspinfor
 private void OK_OnClick(object sender, RoutedEventArgs e)
 {
     try
     { cls.ClsConnect();
       int      thamso = 3;
       string[] bien   = new string[thamso];
       object[] giatri = new object[thamso];
       bien[0]   = "@MaPos";
       giatri[0] = str.Left(CboPos.SelectedValue.ToString().Trim(), 6);
       bien[1]   = "@MaXa";
       giatri[1] = str.Left(CboXa.SelectedValue.ToString().Trim(), 6);
       bien[2]   = "@Ngay";
       if (dtpNgay.SelectedDate != null)
       {
           giatri[2] = dtpNgay.SelectedDate.Value.ToString("yyyy-MM-dd");
       }
       dt = cls.LoadLdbf("usp_XLN_M1", bien, giatri, thamso);
       if (dt.Rows.Count > 0)
       {
           rpt_XLN_M1 rpt = new rpt_XLN_M1();
           RPUtility.ShowRp(rpt, dt, this, srv.DbSourceSerVer(), srv.DbNameSerVer(), srv.DbUserSerVer(), srv.DbPassSerVer());
       }
       else
       {
           MessageBox.Show("Không có khế ước nào đến hạn !", "Thông báo", MessageBoxButton.OK, MessageBoxImage.Warning);
       } }
     catch (Exception ex)
     {
         MessageBox.Show("Error \n" + ex.Message, "Mess", MessageBoxButton.OK, MessageBoxImage.Error);
     }
     finally
     {
         cls.DongKetNoi();
     }
 }
コード例 #8
0
ファイル: WpfVpp.xaml.cs プロジェクト: tutmvbsp/vbspinfor
 private void btnIn_Click(object sender, RoutedEventArgs e)
 {
     try
     {
         cls.ClsConnect();
         string str = "select * from LUUVPP where MAPOS='" + bll.Left(CboPos.SelectedValue.ToString().Trim(), 6)
                      + "' and PHONGTO='" + bll.Left(CboPB.SelectedValue.ToString().Trim(), 2) + "' and THANG = '"
                      + bll.Left(comboBoxMonth.SelectedValue.ToString().Trim(), 2) + "' and NAM='" + comboBoxYear.SelectedValue.ToString().Trim() + "' and SOLUONG>0";
         //MessageBox.Show(str);
         var dtin = cls.LoadDataText(str);
         if (dtin.Rows.Count > 0)
         {
             rpt_Vpp01 rpt = new rpt_Vpp01();
             RPUtility.ShowRp(rpt, dtin, 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();
 }
コード例 #9
0
        private void btnOK_Click(object sender, RoutedEventArgs e)
        {
            ClsServer cls = new ClsServer();

            try
            {
                cls.ClsConnect();
                int      thamso = 4;
                string[] bien   = new string[thamso];
                object[] giatri = new object[thamso];
                bien[0] = "@Ngay";
                if (dtpNgay.SelectedDate != null)
                {
                    giatri[0] = dtpNgay.SelectedDate.Value.ToString("yyyy-MM-dd");
                }
                bien[1]   = "@MaPos";
                giatri[1] = bll.Left(CboPos.SelectedValue.ToString().Trim(), 6);
                bien[2]   = "@MaXa";
                giatri[2] = bll.Left(CboXa.SelectedValue.ToString().Trim(), 6);
                bien[3]   = "@Nam";
                giatri[3] = comboBoxYear.SelectedValue.ToString().Trim();
                dt        = cls.LoadLdbf("usp_TTDSHN01", bien, giatri, thamso);
                rpt_ChkDoituong01 rpt = new rpt_ChkDoituong01();
                RPUtility.ShowRp(rpt, dt, this, srv.DbSourceSerVer(), srv.DbNameSerVer(), srv.DbUserSerVer(), srv.DbPassSerVer());

                //MessageBox.Show("Insert OK", "Thông báo", MessageBoxButton.OK, MessageBoxImage.Information);
            }
            catch (Exception ex)
            {
                MessageBox.Show("Error + " + ex.Message, "Error", MessageBoxButton.OK, MessageBoxImage.Error);
            }
        }
コード例 #10
0
 private void btnOk_Click(object sender, RoutedEventArgs e)
 {
     try
     {
         ServerInfor srv = new ServerInfor();
         cls.ClsConnect();
         int      thamso = 2;
         string[] bien   = new string[thamso];
         object[] giatri = new object[thamso];
         bien[0] = "@Ngay";
         if (dtpNgay.SelectedDate != null)
         {
             giatri[0] = dtpNgay.SelectedDate.Value.ToString("yyyy-MM-dd");
         }
         bien[1]   = "@MaPos";
         giatri[1] = str.Left(cboPos.SelectedValue.ToString().Trim(), 6);
         dt        = cls.LoadDataProcPara("usp_Khtc03", bien, giatri, thamso);
         if (dt.Rows.Count > 0)
         {
             rpt_khtc03 rpt = new rpt_khtc03();
             RPUtility.ShowRp(rpt, dt, this, srv.DbSourceSerVer(), srv.DbNameSerVer(), srv.DbUserSerVer(), srv.DbPassSerVer());
         }
         else
         {
             MessageBox.Show("Chưa có số liệu", "Thông báo");
         }
         cls.DongKetNoi();
     }
     catch (Exception ex)
     {
         MessageBox.Show("Lổi " + ex.Message, "Mess");
     }
 }
コード例 #11
0
ファイル: WpfTSCC03.xaml.cs プロジェクト: tutmvbsp/vbspinfor
 private void Hist_OnMouseDown(object sender, MouseButtonEventArgs e)
 {
     try
     {
         string   ng          = dtpNgay.SelectedDate.Value.ToString("yyyy-MM-dd");
         DateTime newdate     = new DateTime(dtpNgay.SelectedDate.Value.AddYears(-1).Year + 1, 1, 1);
         DateTime LastDayYear = new DateTime(dtpNgay.SelectedDate.Value.Year, 12, 31);
         cls.ClsConnect();
         string sqlload =
             "select a.*,b.PO_TEN from TSCC_HIS a left join DMPOS b on a.POS_CD=b.PO_MA where a.MA_TS='" + label.Content + "' and a.MNV='0' order by a.NG_DG_SC";
         //MessageBox.Show(sqlload);
         var dthis = cls.LoadDataText(sqlload);
         if (dthis.Rows.Count > 0)
         {
             /*
              * FileName = Thumuc + "\\" + label.Content + "_" + dtpNgay.SelectedDate.Value.ToString("ddMMyyyy") + ".csv";
              * s.ExportToExcel(dthis, FileName);
              * s.OpenExcel(FileName);
              */
             rpt_TSCC_BaoTri rpt = new rpt_TSCC_BaoTri();
             RPUtility.ShowRp(rpt, dthis, this, srv.DbSourceSerVer(), srv.DbNameSerVer(),
                              srv.DbUserSerVer(),
                              srv.DbPassSerVer());
         }
         else
         {
             MessageBox.Show("Không có dữ liệu !", "Thông báo", MessageBoxButton.OK,
                             MessageBoxImage.Information);
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message, "Thông báo", MessageBoxButton.OK, MessageBoxImage.Error);
     }
 }
コード例 #12
0
ファイル: WpfTSCC03.xaml.cs プロジェクト: tutmvbsp/vbspinfor
        private void btnExcel_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                DateTime newdate = new DateTime(dtpNgay.SelectedDate.Value.AddYears(-1).Year + 1, 1, 1);
                dtNew = dt.Clone();
                foreach (DataRow dr in dt.Rows)
                {
                    if ((bool)dr[0] == true)
                    {
                        dtNew.ImportRow(dr);
                    }
                }

                //dtNew = dt.GetChanges();
                if (dtNew == null || dtNew.Rows.Count == 0)
                {
                    MessageBox.Show("Chưa chọn thiết bị nào !", "Thông báo", MessageBoxButton.OK, MessageBoxImage.Warning);
                }
                else
                {
                    if (dtNew.Rows.Count >= 2)
                    {
                        MessageBox.Show("Chỉ chọn 1 thiết bị thôi !", "Thông báo", MessageBoxButton.OK,
                                        MessageBoxImage.Warning);
                    }
                    else
                    {
                        int      thamso = 4;
                        string[] bien   = new string[thamso];
                        object[] giatri = new object[thamso];
                        bien[0]   = "@Ngay";
                        giatri[0] = dtpNgay.SelectedDate.Value.ToString("yyyy-MM-dd");
                        bien[1]   = "@MaTs";
                        giatri[1] = dtNew.Rows[0]["MA_TS"].ToString();
                        bien[2]   = "@Lydo";
                        giatri[2] = txtLyDo.Text;
                        bien[3]   = "@DeNghi";
                        giatri[3] = txtDeNghi.Text;
                        var dtin = cls.LoadDataProcPara("usp_TSCC_HIS", bien, giatri, thamso);
                        if (dtin.Rows.Count > 0)
                        {
                            rpt_TSCC_Tr rpt = new rpt_TSCC_Tr();
                            RPUtility.ShowRp(rpt, dtin, this, srv.DbSourceSerVer(), srv.DbNameSerVer(),
                                             srv.DbUserSerVer(),
                                             srv.DbPassSerVer());
                        }
                        else
                        {
                            MessageBox.Show("Không có dữ liệu !", "Thông báo", MessageBoxButton.OK,
                                            MessageBoxImage.Information);
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Thông báo", MessageBoxButton.OK, MessageBoxImage.Error);
            }
        }
コード例 #13
0
 private void BtnOk_OnClick(object sender, RoutedEventArgs e)
 {
     _cls.ClsConnect();
     try
     {
         sql = "select * from KQTHINV where NGAY='" + dtpNgay.SelectedDate.Value.ToString("yyyy-MM-dd") + "'";
         _dt = _cls.LoadDataText(sql);
         if (_dt.Rows.Count == 0)
         {
             MessageBox.Show("Không tìm thấy dữ liệu thi ngày :" + dtpNgay.SelectedDate.Value.ToString("dd/MM/yyyy"), "Thông báo", MessageBoxButton.OK, MessageBoxImage.Warning);
             Close();
         }
         else
         {
             int      thamso = 1;
             string[] bien   = new string[thamso];
             object[] giatri = new object[thamso];
             bien[0] = "@Ngay";
             if (dtpNgay.SelectedDate != null)
             {
                 giatri[0] = dtpNgay.SelectedDate.Value.ToString("yyyy-MM-dd");
             }
             _dt = _cls.LoadDataProcPara("usp_BaoCaoTN", bien, giatri, thamso);
             rpt_BaoCaoTN rpt = new rpt_BaoCaoTN();
             RPUtility.ShowRp(rpt, _dt, this, srv.DbSourceSerVer(), srv.DbNameSerVer(), srv.DbUserSerVer(), srv.DbPassSerVer());
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show("Error" + ex.Message, "Error", MessageBoxButton.OK, MessageBoxImage.Error);
     }
     _cls.DongKetNoi();
 }
コード例 #14
0
        private void btnOk_Click(object sender, RoutedEventArgs e)
        {
            string strup = "";

            try
            {
                cls.ClsConnect();
                string sqlload =
                    "select '" + dtpNgay.SelectedDate.Value.ToString("dd/MM/yyyy") + "' NGAY,a.POS_CD,b.PO_TEN,a.MA_NHANHIEU_TS,a.TEN_NHANHIEU_TS,a.MAPHONG,a.TENPHONG,convert(varchar(4),DATEPART(yyyy,NGAY_MUA)) NAM,A.MA_TS,a.MOTA,MA_CIF,CB_QUANLY,a.GDX from LUU_TSCC a left join DMPOS b on a.POS_CD = b.PO_MA where a.POS_CD = '" + CboPos.SelectedValue + "' and LOAI_TS_CHITIET = 'TI1' and a.TRANGTHAI = 'A' order by MAPHONG,MA_NHANHIEU_TS,MA_CIF";
                var dtin = cls.LoadDataText(sqlload);
                if (dtin.Rows.Count > 0)
                {
                    rpt_TSCC_BC rpt = new rpt_TSCC_BC();
                    RPUtility.ShowRp(rpt, dtin, this, srv.DbSourceSerVer(), srv.DbNameSerVer(), srv.DbUserSerVer(),
                                     srv.DbPassSerVer());
                }
                else
                {
                    MessageBox.Show("Không có dữ liệu !", "Thông báo", MessageBoxButton.OK, MessageBoxImage.Information);
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Lỗi", MessageBoxButton.OK, MessageBoxImage.Error);
            }
            cls.DongKetNoi();
        }
コード例 #15
0
        private void BtnOk_OnClick(object sender, RoutedEventArgs e)
        {
            _cls.ClsConnect();
            try
            {
                #region
                int      thamso = 1;
                string[] bien   = new string[thamso];
                object[] giatri = new object[thamso];
                bien[0] = "@Ngay";
                if (dtpNgay.SelectedDate != null)
                {
                    giatri[0] = dtpNgay.SelectedDate.Value.ToString("yyyy-MM-dd");
                }
                _dt = _cls.LoadDataProcPara("usp_CtCanDoi", bien, giatri, thamso);
                if (_dt.Rows.Count > 0)
                {
                    rpt_CtCanDoi rpt = new rpt_CtCanDoi();
                    RPUtility.ShowRp(rpt, _dt, this, srv.DbSourceSerVer(), srv.DbNameSerVer(), srv.DbUserSerVer(),
                                     srv.DbPassSerVer());
                }
                else
                {
                    MessageBox.Show("Chưa có số liệu ngày ", "Thông báo", MessageBoxButton.OK, MessageBoxImage.Warning);
                }

                #endregion
            }
            catch (Exception ex)
            {
                MessageBox.Show("Error" + ex.Message, "Error", MessageBoxButton.OK, MessageBoxImage.Error);
            }
            _cls.DongKetNoi();
        }
コード例 #16
0
 private void BtnOk_OnClick(object sender, RoutedEventArgs e)
 {
     _cls.ClsConnect();
     try
     {
         #region
         int      thamso = 2;
         string[] bien   = new string[thamso];
         object[] giatri = new object[thamso];
         bien[0]   = "@Ngay";
         bien[1]   = "@Mau";
         giatri[1] = "";
         if (dtpNgay.SelectedDate != null)
         {
             giatri[0] = dtpNgay.SelectedDate.Value.ToString("yyyy-MM-dd");
         }
         _dt = _cls.LoadDataProcPara("usp_QlyGqvlTinh", bien, giatri, thamso);
         rpt_NguonCqlvTinh rpt = new rpt_NguonCqlvTinh();
         RPUtility.ShowRp(rpt, _dt, this, srv.DbSourceSerVer(), srv.DbNameSerVer(), srv.DbUserSerVer(), srv.DbPassSerVer());
         rpt_NguonCqlvTinh1 rpt1 = new rpt_NguonCqlvTinh1();
         RPUtility.ShowRp(rpt1, _dt, this, srv.DbSourceSerVer(), srv.DbNameSerVer(), srv.DbUserSerVer(), srv.DbPassSerVer());
         #endregion
     }
     catch (Exception ex)
     {
         MessageBox.Show("Error" + ex.Message, "Error", MessageBoxButton.OK, MessageBoxImage.Error);
     }
     _cls.DongKetNoi();
 }
コード例 #17
0
        private void BtnIn_OnClick(object sender, RoutedEventArgs e)
        {
            cls.ClsConnect();
            try
            {
                if (Ration1.IsChecked == true)
                {
                    strsql = "select * from KTHDT where NAM='" + dtpNgay.SelectedDate.Value.ToString("yyyy") + "' and PO_MA='" + s.Left(CboPos.SelectedValue.ToString().Trim(), 6)
                             + "' and MAU='1' and TO_DVUT='" +
                             s.Left(CboDvut.SelectedValue.ToString().Trim(), 2) + "' order by MAXA";
                }
                else
                {
                    strsql = "select * from KTHDT where PO_MA='" + s.Left(CboPos.SelectedValue.ToString().Trim(), 6)
                             + "' and MAU='2' order by TO_DVUT";
                }

                var       dtin = cls.LoadDataText(strsql);
                rpt_KTHDT rpt  = new rpt_KTHDT();
                RPUtility.ShowRp(rpt, dtin, this, srv.DbSourceSerVer(), srv.DbNameSerVer(), srv.DbUserSerVer(),
                                 srv.DbPassSerVer());
            }
            catch (Exception ex)
            {
                MessageBox.Show("Tiếp tục" + ex.Message, "Mess");
            }
            cls.DongKetNoi();
        }
コード例 #18
0
ファイル: WpfNVBQ.xaml.cs プロジェクト: tutmvbsp/vbspinfor
        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();
        }
コード例 #19
0
        private void btnSua_Click(object sender, RoutedEventArgs e)
        {
            string strup = "";

            try
            {
                cls.ClsConnect();
                string phong = CboPhong.SelectedValue.ToString().Trim();
                var    dtin  = cls.LoadDataText("select * from luu_tscc where TRANGTHAI='A' and POS_CD='" + CboPos.SelectedValue + "' and right(MAPHONG,2)='" + s.Right(CboPhong.SelectedValue.ToString().Trim(), 2) + "' order by LOAI_TS_CHITIET,MA_NHANHIEU_TS,MA_TS");
                if (dtin.Rows.Count > 0)
                {
                    rpt_TSCC_KiemKe rpt = new rpt_TSCC_KiemKe();
                    RPUtility.ShowRp(rpt, dtin, this, srv.DbSourceSerVer(), srv.DbNameSerVer(), srv.DbUserSerVer(),
                                     srv.DbPassSerVer());
                }
                else
                {
                    MessageBox.Show("Không có dữ liệu !", "Thông báo", MessageBoxButton.OK,
                                    MessageBoxImage.Information);
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Lỗi", MessageBoxButton.OK, MessageBoxImage.Error);
            }
            cls.DongKetNoi();
        }
コード例 #20
0
ファイル: WpfKHTD.xaml.cs プロジェクト: tutmvbsp/vbspinfor
        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();
        }
コード例 #21
0
        private void OK_OnClick(object sender, RoutedEventArgs e)
        {
            try
            { cls.ClsConnect();
              int      thamso = 3;
              string[] bien   = new string[thamso];
              object[] giatri = new object[thamso];
              bien[0]   = "@MaPos";
              giatri[0] = bll.Left(CboPos.SelectedValue.ToString().Trim(), 6);
              bien[1]   = "@Ngay";
              if (DtpNgay.SelectedDate != null)
              {
                  giatri[1] = DtpNgay.SelectedDate.Value.ToString("yyyy-MM-dd");
                  bien[2]   = "@DenNgay";
                  if (DtpDenNgay.SelectedDate != null)
                  {
                      giatri[2] = DtpDenNgay.SelectedDate.Value.ToString("yyyy-MM-dd");
                      dt        = cls.LoadDataProcPara("usp_SkeDnKhoanh", bien, giatri, thamso);
                      if (dt.Rows.Count > 0)
                      {
                          if (RadioButton1.IsChecked == true)
                          {
                              rpt_SkeKhoanh rpt = new rpt_SkeKhoanh();
                              RPUtility.ShowRp(rpt, dt, this, srv.DbSourceSerVer(), srv.DbNameSerVer(), srv.DbUserSerVer(), srv.DbPassSerVer());
                          }
                          else
                          {
                              FileName = Thumuc + "\\" + bll.Left(CboPos.SelectedValue.ToString().Trim(), 6) + "_" +
                                         DtpDenNgay.SelectedDate.Value.ToString("ddMMyyyy") + "_Ske_Khoanh.csv";

                              /*bll.WriteDataTableToExcel(dt, "Person Details", FileName, "Details");
                               * bll.ExportToExcel(dt, FileName);
                               * MessageBox.Show("OK đã xuất file Excel " + FileName, "Mess", MessageBoxButton.OK, MessageBoxImage.Information);
                               * bll.OpenExcel(FileName);
                               */
                              //FileStream fs = new FileStream(FileName, FileMode.Create);
                              //StreamWriter sw = new StreamWriter(fs, Encoding.Unicode);
                              //bll.ToCSV(dt, sw, true);
                              bll.ExportToExcel(dt, FileName);
                              MessageBox.Show("Export to Excel : " + FileName, "Thông báo");
                              bll.OpenExcel(FileName);
                          }
                      }
                      else
                      {
                          MessageBox.Show("Không có dữ liệu", "Mess", MessageBoxButton.OK, MessageBoxImage.Warning);
                      }
                  }
              }
            }
            catch (Exception ex)
            {
                MessageBox.Show("Error \n" + ex.Message, "Mess", MessageBoxButton.OK, MessageBoxImage.Error);
            }
            finally
            {
                cls.DongKetNoi();
            }
        }
コード例 #22
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);
            }
        }
コード例 #23
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
        }
コード例 #24
0
        private void btnSua_Click(object sender, RoutedEventArgs e)
        {
            string strup = "";

            try
            {
                cls.ClsConnect();
                dtNew = dt.GetChanges();
                if (dtNew == null || dtNew.Rows.Count == 0)
                {
                    MessageBox.Show("Chưa có thay đổi ngày nào !", "Thông báo", MessageBoxButton.OK, MessageBoxImage.Warning);
                }
                else
                {
                    foreach (DataRow dr in dtNew.Rows)
                    {
                        //strup = "insert into TSCC_HIS SELECT *,@Ngay NG_DG_SC,'' LYDO,'' DENGHI ,'0' MNV,@Ngay NG_BAOTRI FROM LUU_TSCC WHERE MA_TS = @MaTs";
                        if ((bool)dr["DG_BAOTRI"])
                        {
                            strup = "update LUU_TSCC set DG_BAOTRI=1,NG_DG_BAOTRI='" + DateTime.Now.ToString("yyyy-MM-dd") + "' where MA_TS='" + dr["MA_TS"] + "'";
                        }
                        else
                        {
                            strup = "update LUU_TSCC set DG_BAOTRI=0,NG_DG_BAOTRI='' where MA_TS='" + dr["MA_TS"] + "'";
                        }
                        cls.UpdateDataText(strup);
                    }
                    MessageBox.Show("Cập nhật thành công !", "Thông báo", MessageBoxButton.OK, MessageBoxImage.Information);
                }
                int      thamso = 2;
                string[] bien   = new string[thamso];
                object[] giatri = new object[thamso];
                bien[0]   = "@Ngay";
                giatri[0] = dtpNgay.SelectedDate.Value.ToString("yyyy-MM-dd");
                bien[1]   = "@Phong";
                giatri[1] = CboPhong.SelectedValue.ToString().Trim();
                var dtin = cls.LoadDataProcPara("usp_TSCC_BAOTRI", bien, giatri, thamso);
                if (dtin.Rows.Count > 0)
                {
                    rpt_TSCC_Hist rpt = new rpt_TSCC_Hist();
                    RPUtility.ShowRp(rpt, dtin, this, srv.DbSourceSerVer(), srv.DbNameSerVer(), srv.DbUserSerVer(),
                                     srv.DbPassSerVer());
                }
                else
                {
                    MessageBox.Show("Không có dữ liệu !", "Thông báo", MessageBoxButton.OK,
                                    MessageBoxImage.Information);
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Lỗi", MessageBoxButton.OK, MessageBoxImage.Error);
            }
            cls.DongKetNoi();
        }
コード例 #25
0
        private void btnSua_Click(object sender, RoutedEventArgs e)
        {
            string strup = "";

            try
            {
                cls.ClsConnect();
                dtNew = dt.GetChanges();
                if (dtNew == null || dtNew.Rows.Count == 0)
                {
                    MessageBox.Show("Chưa có thay đổi ngày nào !", "Thông báo", MessageBoxButton.OK, MessageBoxImage.Warning);
                }
                else
                {
                    foreach (DataRow dr in dtNew.Rows)
                    {
                        if ((bool)dr["DG_THANHLY"])
                        {
                            strup = "update LUU_TSCC set DG_THANHLY=1,NG_DG_THANHLY='" + DateTime.Now.ToString("yyyy-MM-dd") + "' where MA_TS='" + dr["MA_TS"] + "'";
                        }
                        else
                        {
                            strup = "update LUU_TSCC set DG_THANHLY=0,NG_DG_THANHLY='' where MA_TS='" + dr["MA_TS"] + "'";
                        }
                        cls.UpdateDataText(strup);
                    }
                    MessageBox.Show("Cập nhật thành công !", "Thông báo", MessageBoxButton.OK, MessageBoxImage.Information);
                }
                string mau = "";
                mau = "5";
                string ng      = dtpNgay.SelectedDate.Value.ToString("yyyy-MM-dd");
                string sqlload =
                    "select '" + mau + "' MAU,'" + ng + "' NGAY,a.*,b.PO_TEN from LUU_TSCC a left join DMPOS b on a.POS_CD=b.PO_MA " +
                    "where a.DG_THANHLY=1 and a.TRANGTHAI='A' and a.POS_CD='" + CboPos.SelectedValue + "' and right(MAPHONG,2)='" + s.Right(CboPhong.SelectedValue.ToString().Trim(), 2) + "' order by a.LOAI_TS_CHITIET,a.MA_NHANHIEU_TS,a.MA_TS";
                var dtin = cls.LoadDataText(sqlload);
                if (dtin.Rows.Count > 0)
                {
                    rpt_TSCC_SaoKe rpt = new rpt_TSCC_SaoKe();
                    RPUtility.ShowRp(rpt, dtin, this, srv.DbSourceSerVer(), srv.DbNameSerVer(), srv.DbUserSerVer(),
                                     srv.DbPassSerVer());
                }
                else
                {
                    MessageBox.Show("Không có dữ liệu !", "Thông báo", MessageBoxButton.OK,
                                    MessageBoxImage.Information);
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Lỗi", MessageBoxButton.OK, MessageBoxImage.Error);
            }
            cls.DongKetNoi();
        }
コード例 #26
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());
     }
 }
コード例 #27
0
 private void BtnOk_OnClick(object sender, RoutedEventArgs e)
 {
     try
     {
         if (dtNew.Rows.Count > 0)
         {
             cls.ClsConnect();
             foreach (DataRow dr in dtNew.Rows)
             {
                 //MessageBox.Show(dr["NG_MATO"].ToString()+"      "+dr["A01"].ToString());
                 string strsql = "update NGUON_TT set A01=" + dr["A01"] + ",A02=" + dr["A02"] + ",A03=" +
                                 dr["A03"] + ",A03CS=" + dr["A03CS"] + ",A04=" + dr["A04"] + ",A06=" + dr["A06"] + ",A07=" + dr["A07"]
                                 + ",A08=" + dr["A08"] + ",A09=" + dr["A09"] + ",A10=" + dr["A10"] + ",A11=" +
                                 dr["A11"] + ",A15=" + dr["A15"] + ",A16=" + dr["A16"] + ",A17=" + dr["A17"] +
                                 ",A18=" + dr["A18"] + ",A19=" + dr["A19"] + ",B03T=" + dr["B03T"]
                                 + ",B03H=" + dr["B03H"] + ",B19T=" + dr["B19T"] + ",B19H=" + dr["B19H"] + ",TGXA=" + dr["TGXA"] + ",NG_TONG=" + dr["NG_TONG"]
                                 + " where NG_MAXA='" + dr["NG_MAXA"].ToString().Trim() + "'";
                 cls.UpdateDataText(strsql);
             }
             MessageBox.Show("Update Ok", "Mess", MessageBoxButton.OK, MessageBoxImage.Information);
             if (
                 MessageBox.Show("Có muốn in số liệu ra không ?", "Question", MessageBoxButton.YesNo,
                                 MessageBoxImage.Warning) == MessageBoxResult.Yes)
             {
                 cls.ClsConnect();
                 int      thamso = 1;
                 string[] bien   = new string[thamso];
                 object[] giatri = new object[thamso];
                 bien[0]   = "@MaPos";
                 giatri[0] = s.Left(CboPos.SelectedValue.ToString().Trim(), 6);
                 var          dtin = cls.LoadDataProcPara("usp_InNguon_TT", bien, giatri, thamso);
                 rpt_Nguon_UT rpt  = new rpt_Nguon_UT();
                 RPUtility.ShowRp(rpt, dtin, this, srv.DbSourceSerVer(), srv.DbNameSerVer(), srv.DbUserSerVer(), srv.DbPassSerVer());
             }
             dtNew.Clear();
             //dgvTarGet.ItemsSource = dtNew.DefaultView;
         }
         else
         {
             MessageBox.Show("Xem lại. Chưa có dữ liệu", "Mess", MessageBoxButton.OK, MessageBoxImage.Warning);
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show("Error \n" + ex.Message, "Mess", MessageBoxButton.OK, MessageBoxImage.Error);
     }
     finally
     {
         cls.DongKetNoi();
     }
 }
コード例 #28
0
ファイル: WpfKhtc01.xaml.cs プロジェクト: tutmvbsp/vbspinfor
        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();
        }
コード例 #29
0
 private void Lblin01kt_OnMouseDown(object sender, MouseButtonEventArgs e)
 {
     try
     {
         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]   = "@TuNgay";
             if (dtpTuNgay.SelectedDate != null)
             {
                 giatri[1] = dtpTuNgay.SelectedDate.Value.ToString("yyyy-MM-dd");
                 bien[2]   = "@DenNgay";
                 if (dtpDenNgay.SelectedDate != null)
                 {
                     giatri[2] = dtpDenNgay.SelectedDate.Value.ToString("yyyy-MM-dd");
                 }
             }
         }
         var dtin = cls.LoadDataProcPara("usp_ChovayNangmuc04", bien, giatri, thamso);
         if (dtin.Rows.Count > 0)
         {
             rpt_ChovayNangmuc01a rpt = new rpt_ChovayNangmuc01a();
             RPUtility.ShowRp(rpt, dtin, this, srv.DbSourceSerVer(), srv.DbNameSerVer(), srv.DbUserSerVer(), srv.DbPassSerVer());
             FileName = Thumuc + "\\" + str.Left(CboPos.SelectedValue.ToString().Trim(), 6) + "_Mẫu 01_KT " + dtpTuNgay.SelectedDate.Value.ToString("ddMMyyyy") + "_Đến ngày_" + dtpDenNgay.SelectedDate.Value.ToString("ddMMyyyy") + ".csv";
             //MessageBox.Show(FileName);
             str.ExportToExcel(dtin, FileName);
             //str.WriteDataTableToExcel(dtin,"M01",FileName,"true");
             ////FileStream fs = new FileStream(FileName, FileMode.Create);
             ////StreamWriter sw = new StreamWriter(fs, Encoding.Unicode);
             ////str.ToCSV(dtin, sw, true);
             MessageBox.Show("Copy Excel to : " + FileName, "Thông báo", MessageBoxButton.OK, MessageBoxImage.Information);
             str.OpenExcel(FileName);
         }
         else
         {
             MessageBox.Show("Không có món vay nào !", "Thông báo", MessageBoxButton.OK, MessageBoxImage.Information);
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show("Lỗi : " + ex.Message, "Thông báo", MessageBoxButton.OK, MessageBoxImage.Error);
     }
     cls.DongKetNoi();
 }
コード例 #30
0
        private void btnOk_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                cls.ClsConnect();
                int      thamso = 3;
                string[] bien   = new string[thamso];
                object[] giatri = new object[thamso];
                bien[0]   = "@MaPos";
                giatri[0] = bll.Left(CboPos.SelectedValue.ToString().Trim(), 6);
                bien[1]   = "@Ngay";
                if (dtpNgay.SelectedDate != null)
                {
                    giatri[1] = dtpNgay.SelectedDate.Value.ToString("yyyy-MM-dd");
                }
                if (giatri[1] == null)
                {
                    MessageBox.Show("Chưa chọn ngày : ", "Mess");
                    return;
                }
                bien[2]   = "@MaXa";
                giatri[2] = bll.Left(CboXa.SelectedValue.ToString().Trim(), 6);
                var dt = cls.LoadDataProcPara(ChkTh.IsChecked == true ? "usp_TLGDXA_TH" : "usp_TLGDXA", bien, giatri, thamso);

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