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); } } }
private void btnOk_Click(object sender, RoutedEventArgs e) { str.TaoThuMuc(Thumuc); try { cls.ClsConnect(); int thamso = 6; string[] bien = new string[thamso]; object[] giatri = new object[thamso]; bien[0] = "@MaPos"; giatri[0] = str.Left(cboPos.SelectedValue.ToString().Trim(), 6); bien[1] = "@TuNgay"; giatri[1] = dtpTuNgay.SelectedDate.Value.ToString("yyyy-MM-dd"); bien[2] = "@DenNgay"; giatri[2] = dtpDenNgay.SelectedDate.Value.ToString("yyyy-MM-dd"); bien[3] = "@Chtr"; giatri[3] = str.Left(CboChon.SelectedValue.ToString().Trim(), 2); bien[4] = "@Mau"; if (OptSke.IsChecked == true) { giatri[4] = "0"; } else if (OptChtr.IsChecked == true) { giatri[4] = "1"; // chi tiet theo chuong trinh } else if (OptM03.IsChecked == true) { giatri[4] = "2"; // } bien[5] = "@Ngay"; giatri[5] = dtpNgay.SelectedDate.Value.ToString("yyyy-MM-dd"); /* * else if (OptM01.IsChecked==true) giatri[4] = "A"; * else if (OptM02.IsChecked == true) giatri[4] = "B";//Tông hợp tất cả các chương trình theo xã */ if (OptSke.IsChecked == true) { if (str.Right(giatri[0].ToString(), 2) == "00") { strsql = " with lst1 as ( " + "select a.KU_MAPGD, left(a.KU_MADP, 6) MAXA, a.KU_MATO, a.KU_MAKH, a.KU_SOKU, a.KU_CHTRINH, a.KU_NGAYGNCC NG_VAY, a.KU_NGAYDHAN_1, a.KU_DNOTHAN + a.KU_DNOQHAN + a.KU_DNOKHOANH DUNO " + ", dbo.SoThang(a.KU_NGAYGNCC, a.KU_NGAYDHAN_1) SOTHANG, a.KU_MAPNKT51 from HSCV_DAILY a where a.KU_NGAYBC = '" + giatri[5] + "' and a.KU_DNOTHAN + a.KU_DNOQHAN + a.KU_DNOKHOANH > 0 and a.KU_TTMONVAY <> 'CLOSE' and a.KU_CHTRINH IN('01', '09', '19', '21') " + " ), lst1a as ( select a.* from lst1 a where a.NG_VAY between '" + giatri[1] + "' and '" + giatri[2] + "' )" + ", lst1b as ( select a.* from lst1 a, lst1a b where a.KU_MAKH = b.KU_MAKH ), lst2 as ( select a.KU_MAKH,count(a.KU_MAKH) DEM,sum(a.DUNO) DUNO from lst1b a group by a.KU_MAKH having sum(a.DUNO) > 50000000 )" + " select a.KU_MAPGD,a.MAXA,d.TEN,a.KU_MATO,f.TO_TENTT,a.KU_MAKH,c.KH_TENKH,char(39) + a.KU_SOKU SOKU, a.KU_CHTRINH,e.TENVT, a.NG_VAY, a.KU_NGAYDHAN_1 NG_DHAN, a.DUNO, a.SOTHANG, a.KU_MAPNKT51 PNKT, g.TEN TEN_PNKT" + " , (case when(a.NG_VAY < '" + giatri[1] + "' and b.DEM > 1) or (a.NG_VAY > '" + giatri[1] + "' and b.DEM = 1) then 1 else 2 end) LAN ,(case when (a.NG_VAY<'" + giatri[1] + "' and b.DEM>1) or (a.NG_VAY>'" + giatri[1] + "' and b.DEM=1) then a.DUNO else 0 end) DN_LAN1" + " ,(case when a.NG_VAY >= '" + giatri[1] + "' and b.DEM>1 then a.DUNO else 0 end) DN_LAN2 from lst1 a, lst2 b,hskh c, DMXA d,DM_CHTRINH e, HSTO f,DM_PNKT g " + " where a.KU_MAKH = b.KU_MAKH and a.KU_MAKH = c.KH_MAKH and a.MAXA = d.MA and a.KU_CHTRINH = e.CHTRINH and a.KU_MATO = f.TO_MATO and a.KU_MAPNKT51 = g.PNKT and c.KH_TTRANG='A' order by a.MAXA,a.KU_MAKH,a.KU_CHTRINH,a.NG_VAY"; } else { strsql = " with lst1 as ( " + "select a.KU_MAPGD, left(a.KU_MADP, 6) MAXA, a.KU_MATO, a.KU_MAKH, a.KU_SOKU, a.KU_CHTRINH, a.KU_NGAYGNCC NG_VAY, a.KU_NGAYDHAN_1, a.KU_DNOTHAN + a.KU_DNOQHAN + a.KU_DNOKHOANH DUNO " + ", dbo.SoThang(a.KU_NGAYGNCC, a.KU_NGAYDHAN_1) SOTHANG, a.KU_MAPNKT51 from HSCV_DAILY a where a.KU_MAPGD = '" + giatri[0] + "' and a.KU_NGAYBC = '" + giatri[5] + "' and a.KU_DNOTHAN + a.KU_DNOQHAN + a.KU_DNOKHOANH > 0 and a.KU_TTMONVAY <> 'CLOSE' and a.KU_CHTRINH IN('01', '09', '19', '21') " + " ), lst1a as ( select a.* from lst1 a where a.NG_VAY between '" + giatri[1] + "' and '" + giatri[2] + "' )" + ", lst1b as ( select a.* from lst1 a, lst1a b where a.KU_MAKH = b.KU_MAKH ), lst2 as ( select a.KU_MAKH,count(a.KU_MAKH) DEM,sum(a.DUNO) DUNO from lst1b a group by a.KU_MAKH having sum(a.DUNO) > 50000000 )" + " select a.KU_MAPGD,a.MAXA,d.TEN,a.KU_MATO,f.TO_TENTT,a.KU_MAKH,c.KH_TENKH,char(39) + a.KU_SOKU SOKU, a.KU_CHTRINH,e.TENVT, a.NG_VAY, a.KU_NGAYDHAN_1 NG_DHAN, a.DUNO, a.SOTHANG, a.KU_MAPNKT51 PNKT, g.TEN TEN_PNKT" + " , (case when(a.NG_VAY < '" + giatri[1] + "' and b.DEM > 1) or (a.NG_VAY > '" + giatri[1] + "' and b.DEM = 1) then 1 else 2 end) LAN ,(case when (a.NG_VAY<'" + giatri[1] + "' and b.DEM>1) or (a.NG_VAY>'" + giatri[1] + "' and b.DEM=1) then a.DUNO else 0 end) DN_LAN1" + " ,(case when a.NG_VAY >= '" + giatri[1] + "' and b.DEM>1 then a.DUNO else 0 end) DN_LAN2 from lst1 a, lst2 b,hskh c, DMXA d,DM_CHTRINH e, HSTO f,DM_PNKT g " + " where a.KU_MAKH = b.KU_MAKH and a.KU_MAKH = c.KH_MAKH and a.MAXA = d.MA and a.KU_CHTRINH = e.CHTRINH and a.KU_MATO = f.TO_MATO and a.KU_MAPNKT51 = g.PNKT and c.KH_TTRANG='A' order by a.MAXA,a.KU_MAKH,a.KU_CHTRINH,a.NG_VAY"; } dt = cls.LoadDataText(strsql); FileName = Thumuc + "\\" + str.Left(cboPos.SelectedValue.ToString().Trim(), 6) + "_Cho vay nâng mức_từ ngày " + dtpTuNgay.SelectedDate.Value.ToString("ddMMyyyy") + "_Đến ngày_" + dtpDenNgay.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 (str.Right(giatri[0].ToString(), 2) == "00") { dt = cls.LoadDataProcPara("usp_ChovayNangmuc03", bien, giatri, thamso); } else { dt = cls.LoadDataProcPara("usp_ChovayNangmuc", bien, giatri, thamso); } if (dt.Rows.Count > 0) { if (OptChtr.IsChecked == true) { rpt_ChovayNangmuc01 rpt = new rpt_ChovayNangmuc01(); RPUtility.ShowRp(rpt, dt, this, srv.DbSourceSerVer(), srv.DbNameSerVer(), srv.DbUserSerVer(), srv.DbPassSerVer()); // MessageBox.Show(OptChtr.Content.ToString()); FileName = Thumuc + "\\" + giatri[0] + "_" + OptChtr.Content + "_" + str.Left(CboChon.SelectedValue.ToString().Trim(), 2) + "_" + giatri[1] + "_Đến ngày_" + giatri[2] + ".xlsx"; } else if (OptM03.IsChecked == true) { rpt_ChovayNangmuc03 rpt = new rpt_ChovayNangmuc03(); RPUtility.ShowRp(rpt, dt, this, srv.DbSourceSerVer(), srv.DbNameSerVer(), srv.DbUserSerVer(), srv.DbPassSerVer()); FileName = Thumuc + "\\" + giatri[0] + "_Mãu 03BC_" + str.Left(CboChon.SelectedValue.ToString().Trim(), 2) + "_" + giatri[1] + "_Đến ngày_" + giatri[2] + ".xlsx"; } // str.ExportToExcel(dt, FileName); // str.OpenExcel(FileName); } else { MessageBox.Show("Chưa có số liệu", "Thông báo"); } } catch (Exception ex) { MessageBox.Show(ex.Message); } cls.DongKetNoi(); }
private void btnPrint_Click(object sender, RoutedEventArgs e) { try { cls.ClsConnect(); if (opt1.IsChecked == true) { mau = "2"; string strin = "select * from LUU_KHAOSATVAY where DOT='" + CboDot.SelectionBoxItem + "' and NAM='" + dtpNgay.SelectedDate.Value.ToString("yyyy") + "' and MAXA='" + CboXa.SelectedValue + "'"; var dtin = cls.LoadDataText(strin); if (dtin.Rows.Count > 0) { rpt_ksVay01 rpt = new rpt_ksVay01(); 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.Warning); } } if (opt2.IsChecked == true) //Mau 03 { mau = "3"; string strin = "select '" + mau + "' MAU,N'nhcsxh tỉnh quảng bình' title1,b.PO_TEN title2,a.DOT,a.NAM,a.MAPOS,b.PO_TEN,a.MAXA,a.TENXA,COUNT(distinct MATHON) SOTHON,COUNT(distinct MATO) SOTO,SUM(a.SH01) SH01,SUM(a.ST01) ST01 " + " , SUM(a.SH19)SH19, SUM(a.ST19) ST19, SUM(a.SH09) SH09, SUM(a.ST09) ST09, SUM(a.SH06) SH06, SUM(a.ST06) ST06 " + " , SUM(a.SH10) SH10, SUM(a.ST10) ST10, SUM(a.SH_CHUA) SH_CHUA, SUM(a.SH_KHONG) SH_KHONG " + " from LUU_KHAOSATVAY a, DMPOS b where a.TRANGTHAI='A' and a.MAPOS = b.PO_MA and a.DOT = '" + CboDot.SelectionBoxItem + "' and a.MAPOS = '" + CboPos.SelectedValue + "' and a.NAM = '" + dtpNgay.SelectedDate.Value.ToString("yyyy") + "' " + " group by a.DOT, a.NAM, a.MAPOS, b.PO_TEN, a.MAXA, a.TENXA order by a.MAXA"; var dtin = cls.LoadDataText(strin); if (dtin.Rows.Count > 0) { rpt_ksVay02 rpt = new rpt_ksVay02(); 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.Warning); } } else // mau 4 { mau = "4"; string strin = "select '" + mau + "' MAU,N'ngân hàng chinh sách xã hội' title1,N'chi nhánh tỉnh quảng bình' title2,a.DOT,a.NAM,a.MAPOS,b.PO_TEN,a.MAPOS MAXA,b.PO_TEN TENXA,COUNT(distinct MATHON) SOTHON,COUNT(distinct MATO) SOTO,SUM(a.SH01) SH01,SUM(a.ST01) ST01 " + " , SUM(a.SH19)SH19, SUM(a.ST19) ST19, SUM(a.SH09) SH09, SUM(a.ST09) ST09, SUM(a.SH06) SH06, SUM(a.ST06) ST06 " + " , SUM(a.SH10) SH10, SUM(a.ST10) ST10, SUM(a.SH_CHUA) SH_CHUA, SUM(a.SH_KHONG) SH_KHONG " + " from LUU_KHAOSATVAY a, DMPOS b where a.TRANGTHAI='A' and a.MAPOS = b.PO_MA and a.DOT = '" + CboDot.SelectionBoxItem + "' and a.NAM = '" + dtpNgay.SelectedDate.Value.ToString("yyyy") + "' " + " group by a.DOT, a.NAM, a.MAPOS, b.PO_TEN order by a.MAPOS"; var dtin = cls.LoadDataText(strin); if (dtin.Rows.Count > 0) { rpt_ksVay02 rpt = new rpt_ksVay02(); 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.Warning); } } } catch (Exception ex) { MessageBox.Show(ex.Message, "Thông báo", MessageBoxButton.OK, MessageBoxImage.Error); } cls.DongKetNoi(); }
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"] + "',GHICHU='" + dr["GHICHU"] + "' where POS='" + pos + "' and thang='" + thang + "' and nam='" + nam + "' and cap='" + cap + "' and KT_KHOA='" + dr["KT_KHOA"] + "'"; //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_UpKTNB01", bien, giatri, thamso); rpt_KTNB_01 rpt = new rpt_KTNB_01(); 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(); }
private void Print_OnClick(object sender, RoutedEventArgs e) { if (Opt1.IsChecked == true) { string sql = "select * from LUU_CHAMDIEMGDX where MAPOS='" + bll.Left(CboPos.SelectedValue.ToString().Trim(), 6) + "' and MAXA='" + bll.Left(CboXa.SelectedValue.ToString().Trim(), 6) + "' and NAM='" + bll.Right(dtpNgay.SelectedDate.Value.ToString("dd/MM/yyyy"), 4) + "' order by STT"; try { _cls.ClsConnect(); _dt = _cls.LoadDataText(sql); if (_dt.Rows.Count > 0) { rpt_ChamDiemGDX rpt = new rpt_ChamDiemGDX(); RPUtility.ShowRp(rpt, _dt, this, srv.DbSourceSerVer(), srv.DbNameSerVer(), srv.DbUserSerVer(), srv.DbPassSerVer()); } else { MessageBox.Show("Không có dữ liệu", "Mess", MessageBoxButton.OK, MessageBoxImage.Warning); } } catch (Exception) { MessageBox.Show("Error", "Mess", MessageBoxButton.OK, MessageBoxImage.Error); } } else { string sql = "select MA from DMXA where PGD_QL='" + bll.Left(CboPos.SelectedValue.ToString().Trim(), 6) + "'" + " and right(MA,2)<>'00' and MA not in (select MAXA from LUU_CHAMDIEMGDX where MAPOS='" + bll.Left(CboPos.SelectedValue.ToString().Trim(), 6) + "' and NAM='" + bll.Right(dtpNgay.SelectedDate.Value.ToString("dd/MM/yyyy"), 4) + "')"; _cls.ClsConnect(); _dt = _cls.LoadDataText(sql); if (_dt.Rows.Count > 0) { string xa = ""; foreach (DataRow dr in _dt.Rows) { //MessageBox.Show(dr[0].ToString()); xa = xa + "/" + dr[0].ToString(); } MessageBox.Show("Những xã sau chưa chấm : " + xa, "Mess", MessageBoxButton.OK, MessageBoxImage.Warning); } else { try { _cls.ClsConnect(); 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("dd/MM/yyyy"); } _dt = _cls.LoadDataProcPara("usp_ChamDiemGDX_TH", bien, giatri, thamso); if (_dt.Rows.Count > 0) { rpt_ChamDiemGDX_TH rpt = new rpt_ChamDiemGDX_TH(); 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", MessageBoxButton.OK, MessageBoxImage.Warning); } //MessageBox.Show("OK", "Mess", MessageBoxButton.OK, MessageBoxImage.Information); } catch (Exception ex) { MessageBox.Show("Error \n" + ex.Message, "Mess", MessageBoxButton.OK, MessageBoxImage.Error); } finally { _cls.DongKetNoi(); } } } }
private void BtnOk_OnClick(object sender, RoutedEventArgs e) { try { cls.ClsConnect(); const int thamso = 3; string[] bien = new string[thamso]; object[] giatri = new object[thamso]; bien[0] = "@MaPos"; giatri[0] = s.Left(CboPos.SelectedValue.ToString().Trim(), 6); bien[1] = "@DenNgay"; if (DtpDenNgay.SelectedDate == null) { return; } giatri[1] = DtpDenNgay.SelectedDate.Value.ToString("yyyy-MM-dd"); bien[2] = "@Mau"; // MessageBox.Show(giatri[1].ToString()+" "+giatri[2].ToString()); if (RadioButton1.IsChecked == true) { giatri[2] = "1"; } else if (RadioButton2.IsChecked == true) { giatri[2] = "2"; } else { giatri[2] = "3"; } dt = cls.LoadDataProcPara(RadioButton4.IsChecked != true ? "usp_KH_CBTD_MOI" : "usp_Export_KH_CBTD_MOI", bien, giatri, thamso); if (dt.Rows.Count > 0) { if ((string)giatri[0] == "003000" || (RadioButton3.IsChecked == true)) { rpt_KH_XA_MOI rpt = new rpt_KH_XA_MOI(); RPUtility.ShowRp(rpt, dt, this, srv.DbSourceSerVer(), srv.DbNameSerVer(), srv.DbUserSerVer(), srv.DbPassSerVer()); } else { rpt_KH_CBTD_MOI rpt = new rpt_KH_CBTD_MOI(); RPUtility.ShowRp(rpt, dt, this, srv.DbSourceSerVer(), srv.DbNameSerVer(), srv.DbUserSerVer(), srv.DbPassSerVer()); } /* * else if (RadioButton1.IsChecked == true) * { * rpt_KH_CBTD rpt = new rpt_KH_CBTD(); * RPUtility.ShowRp(rpt, dt, this, srv.DbSourceSerVer(), srv.DbNameSerVer(), srv.DbUserSerVer(), * srv.DbPassSerVer()); * } * else if (RadioButton2.IsChecked == true) * { * rpt_KH_CBKT rpt = new rpt_KH_CBKT(); * RPUtility.ShowRp(rpt, dt, this, srv.DbSourceSerVer(), srv.DbNameSerVer(), srv.DbUserSerVer(), * srv.DbPassSerVer()); * } */ } else if (RadioButton4.IsChecked == true) { MessageBox.Show("insert OK"); } else { MessageBox.Show("Không có số liệu", "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(); } }
private void btnOk_Click(object sender, RoutedEventArgs e) { cls.ClsConnect(); try { 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"); } else { MessageBox.Show("Chọn Ngày", "Mess"); return; } bien[2] = "@MaXa"; giatri[2] = bll.Left(CboXa.SelectedValue.ToString().Trim(), 6); dt = cls.LoadDataProcPara("usp_TyLeNQH", bien, giatri, thamso); if (dt.Rows.Count > 0) { rpt_TyLeNQH rpt = new rpt_TyLeNQH(); 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(); }
private void btnOk_Click(object sender, RoutedEventArgs e) { try { cls.ClsConnect(); DataTable dt = new DataTable(); int thamso = 3; string[] bien = new string[thamso]; object[] giatri = new object[thamso]; bien[0] = "@MaPos"; giatri[0] = str.Left(CboPos.SelectedValue.ToString().Trim(), 6); bien[1] = "@Ngay"; if (dtpNgay.SelectedDate == null) { MessageBox.Show("Chưa chọn ngày", "Thông báo", MessageBoxButton.OK, MessageBoxImage.Error); return; } else { giatri[1] = dtpNgay.SelectedDate.Value.ToString("yyyy-MM-dd"); } bien[2] = "@MaXa"; giatri[2] = str.Left(CboXa.SelectedValue.ToString().Trim(), 6); //MessageBox.Show(giatri[0] + " " + giatri[1] + " " + giatri[2] + " " + giatri[3] + " " + giatri[4]); if (radioButton1.IsChecked == true) { dt = cls.LoadLdbf("usp_DvutM01", bien, giatri, thamso); } else if (radioButton2.IsChecked == true) { dt = cls.LoadLdbf("usp_DvutM02", bien, giatri, thamso); } else if (radioButton3.IsChecked == true) { dt = cls.LoadLdbf("usp_DvutM03", bien, giatri, thamso); } else if (radioButton4.IsChecked == true) { dt = cls.LoadLdbf("usp_DvutM04", bien, giatri, thamso); } else if (radioButton5.IsChecked == true) { dt = cls.LoadLdbf("usp_DvutM05", bien, giatri, thamso); } else { dt = cls.LoadLdbf("usp_DvutM06", bien, giatri, thamso); } //rpt_kt740_01 rpt = new rpt_kt740_01(); if (dt.Rows.Count > 0) { if (radioButton1.IsChecked == true) { rpt_DvutM01 rpt = new rpt_DvutM01(); RPUtility.ShowRp(rpt, dt, this, srv.DbSourceSerVer(), srv.DbNameSerVer(), srv.DbUserSerVer(), srv.DbPassSerVer()); } else if (radioButton2.IsChecked == true) { rpt_DvutM02 rpt = new rpt_DvutM02(); RPUtility.ShowRp(rpt, dt, this, srv.DbSourceSerVer(), srv.DbNameSerVer(), srv.DbUserSerVer(), srv.DbPassSerVer()); } else if (radioButton3.IsChecked == true) { rpt_DvutM03 rpt = new rpt_DvutM03(); RPUtility.ShowRp(rpt, dt, this, srv.DbSourceSerVer(), srv.DbNameSerVer(), srv.DbUserSerVer(), srv.DbPassSerVer()); } else if (radioButton4.IsChecked == true) { rpt_DvutM04_1 rpt = new rpt_DvutM04_1(); RPUtility.ShowRp(rpt, dt, this, srv.DbSourceSerVer(), srv.DbNameSerVer(), srv.DbUserSerVer(), srv.DbPassSerVer()); } else if (radioButton5.IsChecked == true) { rpt_DvutM05 rpt = new rpt_DvutM05(); RPUtility.ShowRp(rpt, dt, this, srv.DbSourceSerVer(), srv.DbNameSerVer(), srv.DbUserSerVer(), srv.DbPassSerVer()); } else if (radioButton6.IsChecked == true) { rpt_DvutM06 rpt = new rpt_DvutM06(); 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("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(); }
private void btnOk_Click(object sender, RoutedEventArgs e) { bll.TaoThuMuc(Thumuc); try { ServerInfor srv = new ServerInfor(); cls.ClsConnect(); DataTable dt = new DataTable(); 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); if (radioButton1.IsChecked == true) { FileName = Thumuc + "\\D15NHNN_" + bll.Left(cboPos.SelectedValue.ToString().Trim(), 6) + "_" + dtpNgay.SelectedDate.Value.ToString("ddMMyyyy") + ".xlsx"; dt = cls.LoadDataProcPara("usp_D15NHNN", bien, giatri, thamso); } else if (radioButton2.IsChecked == true) { FileName = Thumuc + "\\D20NHNN_" + bll.Left(cboPos.SelectedValue.ToString().Trim(), 6) + "_" + dtpNgay.SelectedDate.Value.ToString("ddMMyyyy") + ".xlsx"; dt = cls.LoadDataProcPara("usp_D20NHNN", bien, giatri, thamso); } else { dt = cls.LoadDataText( "select CS_MAPGD,COUNT(distinct CS_MAKH) DEM from casa where CS_NGAYBC='" + dtpNgay.SelectedDate.Value.ToString("yyyy-MM-dd") + "' and CS_SODU_TK>0 group by CS_MAPGD"); } if (dt.Rows.Count > 0) { if (radioButton1.IsChecked == true || radioButton2.IsChecked == true) { bll.WriteDataTableToExcel(dt, "Details", FileName, "TUTM"); MessageBox.Show("Copy Excel to : " + FileName, "Thông báo", MessageBoxButton.OK, MessageBoxImage.Information); } if (radioButton1.IsChecked == true) { rpt_D15NHNN rpt = new rpt_D15NHNN(); RPUtility.ShowRp(rpt, dt, this, srv.DbSourceSerVer(), srv.DbNameSerVer(), srv.DbUserSerVer(), srv.DbPassSerVer()); } else if (radioButton2.IsChecked == true) { rpt_D20NHNN rpt = new rpt_D20NHNN(); RPUtility.ShowRp(rpt, dt, this, srv.DbSourceSerVer(), srv.DbNameSerVer(), srv.DbUserSerVer(), srv.DbPassSerVer()); } else { MessageBox.Show("CN01 : " + dt.Rows[0]["DEM"].ToString() + " | " + "CN02 : " + dt.Rows[1]["DEM"].ToString() + " | " + "CN03 : " + dt.Rows[2]["DEM"].ToString() + " | " + "CN04 : " + dt.Rows[3]["DEM"].ToString() + " | " + "CN05 : " + dt.Rows[4]["DEM"].ToString() + " | " + "CN06 : " + dt.Rows[5]["DEM"].ToString() + " | " + "CN07 : " + dt.Rows[6]["DEM"].ToString() + " | " + "CN08 : " + dt.Rows[7]["DEM"].ToString(), "Số hộ huy động vốn", MessageBoxButton.OK, MessageBoxImage.Information); } } else { MessageBox.Show("Chưa có số liệu", "Thông báo"); } cls.DongKetNoi(); } catch (Exception ex) { MessageBox.Show("Lổi " + ex.Message, "Thông báo", MessageBoxButton.OK, MessageBoxImage.Error); } }
private void btnOk_Click(object sender, RoutedEventArgs e) { #region 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] = 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"; } dt = cls.LoadLdbf("AA_DULIEU_TOXADVUT", bien, giatri, thamso); if (dt.Rows.Count > 0) { //MessageBox.Show("OK", "Thông báo", MessageBoxButton.OK,MessageBoxImage.Information); rpt_CLT01 rpt = new rpt_CLT01(); 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_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_CQLV set C11=" + dr["C11"] + ",C12=" + dr["C12"] + ",C13=" + dr["C13"] + ",C14=" + dr["C14"] + ",C15=" + dr["C15"] + ",C16=" + dr["C16"] + ",C17=" + dr["C17"] + ",C18=" + dr["C18"] + ",C19=" + dr["C19"] + ",C20=" + dr["C20"] + ",C21=" + dr["C21"] + " 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_Cqlv", bien, giatri, thamso); rpt_Nguon_Cqlv rpt = new rpt_Nguon_Cqlv(); 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(); } }
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); if (ChkTh.IsChecked == true) { if (bll.Left(CboDot.SelectedValue.ToString(), 1) == "0") // đợt ngắn { 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 a.CHUYENDE='" + RadCboChDe.SelectedValue.ToString().Trim() + "' and a.CHONIN='1' order by a.CHUYENDE,a.STT"; } //MessageBox.Show(strin); _cls.ClsConnect(); _dt = _cls.LoadDataText(strin); if (_dt.Rows.Count > 0) { rpt_ThiDua02 rpt = new rpt_ThiDua02(); 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); } } else { string strin = "select a.* from MAU_THIDUA a where a.NAM='" + comboBoxYear.SelectedValue + "' and a.QUY='" + CboQuy.SelectionBoxItem.ToString().Trim() + "' and a.DOT='" + bll.Left(CboDot.SelectedValue.ToString(), 1) + "' and CHUYENDE='" + RadCboChDe.SelectedValue.ToString().Trim() + "' and CHONIN='1' order by STT"; _cls.ClsConnect(); _dt = _cls.LoadDataText(strin); if (_dt.Rows.Count > 0) { rpt_ThiDua03 rpt = new rpt_ThiDua03(); 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(); LblManual_OnMouseDown(null, null); }
private void btnOk_Click(object sender, RoutedEventArgs e) { if (Ration3.IsChecked == true) { WpfDinhSv_ThuCong f = new WpfDinhSv_ThuCong(); f.ShowDialog(); } else { 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 (Ration1.IsChecked == true) { rpt_DinhSv rpt = new rpt_DinhSv(); RPUtility.ShowRp(rpt, dtNew, this, srv.DbSourceSerVer(), srv.DbNameSerVer(), srv.DbUserSerVer(), srv.DbPassSerVer()); // dgvData.ItemsSource = dt.DefaultView; } else if (Ration2.IsChecked == true) { rpt_DinhSv1 rpt = new rpt_DinhSv1(); RPUtility.ShowRp(rpt, dtNew, this, srv.DbSourceSerVer(), srv.DbNameSerVer(), srv.DbUserSerVer(), srv.DbPassSerVer()); } else if (Ration4.IsChecked == true) { rpt_SoLuuToRoi rpt = new rpt_SoLuuToRoi(); RPUtility.ShowRp(rpt, dtNew, this, srv.DbSourceSerVer(), srv.DbNameSerVer(), srv.DbUserSerVer(), srv.DbPassSerVer()); } } } }
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"); } }
private void btnOk_Click(object sender, RoutedEventArgs e) { #region try { cls.ClsConnect(); int thamso = 6; 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[5] = "@DenNgay"; if (dtpDenNgay.SelectedDate != null) { giatri[5] = dtpDenNgay.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_NdhCT", bien, giatri, thamso); if (dt.Rows.Count > 0) { if (Ration7.IsChecked == true) { if (Ration6.IsChecked == true) { rpt_NdhCtNewKHB rpt = new rpt_NdhCtNewKHB(); RPUtility.ShowRp(rpt, dt, this, srv.DbSourceSerVer(), srv.DbNameSerVer(), srv.DbUserSerVer(), srv.DbPassSerVer()); } else { rpt_NdhCtNew rpt = new rpt_NdhCtNew(); RPUtility.ShowRp(rpt, 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 }
private void btnOk_Click(object sender, RoutedEventArgs e) { try { cls.ClsConnect(); DataTable dt = new DataTable(); int thamso = 4; string[] bien = new string[thamso]; object[] giatri = new object[thamso]; bien[0] = "@MaPos"; giatri[0] = str.Left(CboPos.SelectedValue.ToString().Trim(), 6); bien[1] = "@Ngay"; if (dtpNgay.SelectedDate == null) { MessageBox.Show("Chưa chọn ngày", "Thông báo", MessageBoxButton.OK, MessageBoxImage.Error); return; } else { giatri[1] = dtpNgay.SelectedDate.Value.ToString("dd/MM/yyyy"); } bien[2] = "@KyBC"; if (radioButton1.IsChecked == true) { giatri[2] = 'D'; } else if (radioButton2.IsChecked == true) { giatri[2] = 'M'; } else if (radioButton3.IsChecked == true) { giatri[2] = 'Q'; } else { giatri[2] = 'Y'; } bien[3] = "@LoaiBC"; if (radioButton5.IsChecked == true) { giatri[3] = '1'; } else { giatri[3] = '2'; } //MessageBox.Show(giatri[0].ToString() + " " + giatri[1].ToString() + " " + giatri[2].ToString()); dt = cls.LoadDataProcPara("usp_CanDoi", bien, giatri, thamso); //rpt_kt740_01 rpt = new rpt_kt740_01(); if (dt.Rows.Count > 0) { rpt_CanDoi rpt = new rpt_CanDoi(); 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("ok"); } else { MessageBox.Show("Chưa có số liệu", "Thông báo"); } cls.DongKetNoi(); } catch (Exception ex) { MessageBox.Show("Error " + ex.Message, "Mess", MessageBoxButton.OK, MessageBoxImage.Error); } }
private void btnOk_Click(object sender, RoutedEventArgs e) { try { cls.ClsConnect(); int thamso = 6; 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] = "@HTVAY"; 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"; } bien[4] = "@Mau"; if (Ration7.IsChecked == true) { giatri[4] = "1"; } else if (Ration8.IsChecked == true) { giatri[4] = "2"; } bien[5] = "@MaXa"; giatri[5] = bll.Left(CboXa.SelectedValue.ToString().Trim(), 6); dt = cls.LoadDataProcPara("usp_PhanTichSL_CT", bien, giatri, thamso); if (dt.Rows.Count > 0) { rpt_PhanTichSL_CT rpt = new rpt_PhanTichSL_CT(); 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); } }
private void btnOk_Click(object sender, RoutedEventArgs e) { #region cls.ClsConnect(); try { int thamso = 3; string[] bien = new string[thamso]; object[] giatri = new object[thamso]; bien[0] = "@Ngay"; if (dtpNgayKu.SelectedDate != null) { giatri[0] = dtpNgayKu.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); dt = cls.LoadLdbf("usp_Nqh", bien, giatri, thamso); if (dt.Rows.Count > 0) { rpt_Nqh rpt = new rpt_Nqh(); RPUtility.ShowRp(rpt, dt, 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); } cls.DongKetNoi(); #endregion }
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"); } }
private void btnOk_Click(object sender, RoutedEventArgs e) { if (Ration4.IsChecked == true) { #region cls.ClsConnect(); DataTable dt = new DataTable(); 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); if (Ration1.IsChecked == true) { dt = cls.LoadDataProcPara("usp_Khtc02", bien, giatri, thamso); if (dt.Rows.Count > 0) { rpt_khtc02 rpt = new rpt_khtc02(); 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"); } } else if (Ration1.IsChecked == true) { dt = cls.LoadDataProcPara("usp_Khtc02_CT", bien, giatri, thamso); if (dt.Rows.Count > 0) { rpt_khtc02_CT rpt = new rpt_khtc02_CT(); 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"); } } else { int thamso1 = 3; string[] bien1 = new string[thamso1]; object[] giatri1 = new object[thamso1]; bien1[0] = "@Ngay"; if (dtpNgay.SelectedDate != null) { giatri1[0] = dtpNgay.SelectedDate.Value.ToString("yyyy-MM-dd"); } bien1[1] = "@MaPos"; giatri1[1] = str.Left(cboPos.SelectedValue.ToString().Trim(), 6); bien1[2] = "@Mau"; if (Ration4.IsChecked == true) { giatri1[2] = "1"; } else { giatri1[2] = "2"; } dt = cls.LoadDataProcPara("usp_Khtc02_CTTW", bien1, giatri1, thamso1); if (dt.Rows.Count > 0) { rpt_khtc02_CTTW rpt = new rpt_khtc02_CTTW(); 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(); #endregion } else { #region cls.ClsConnect(); dt = cls.LoadDataText("select * from QT_MS04TL where NG_CAPNHAT='" + dtpNgay.SelectedDate.Value.ToString("yyyy-MM-dd") + "'"); if (dt.Rows.Count == 0) { MessageBox.Show( "Chưa có số liệu ngày : " + dtpNgay.SelectedDate.Value.ToString("dd/MM/yyyy") + " từ TW", "Thông báo", MessageBoxButton.OK, MessageBoxImage.Warning); } else { #region 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); bien[2] = "@Mau"; if (Ration4.IsChecked == true) { giatri[2] = "1"; } else { giatri[2] = "2"; } dt = cls.LoadDataProcPara("usp_Khtc02_CTTW", bien, giatri, thamso); if (dt.Rows.Count > 0) { rpt_khtc02_CTTW rpt = new rpt_khtc02_CTTW(); 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"); } #endregion } #endregion } }
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(); }
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(); }
private void btnOk_Click(object sender, RoutedEventArgs e) { try { str.TaoThuMuc(Thumuc); 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 { rpt_GiaoNhanTVM01 rpt = new rpt_GiaoNhanTVM01(); RPUtility.ShowRp(rpt, dtNew, this, srv.DbSourceSerVer(), srv.DbNameSerVer(), srv.DbUserSerVer(), srv.DbPassSerVer()); rpt_GiaoNhanTVM02 rpt1 = new rpt_GiaoNhanTVM02(); RPUtility.ShowRp(rpt1, dtNew, this, srv.DbSourceSerVer(), srv.DbNameSerVer(), srv.DbUserSerVer(), srv.DbPassSerVer()); dgvSource.ItemsSource = null; FileName = Thumuc + "\\" + str.Left(CboXa.SelectedValue.ToString().Trim(), 6) + "_" + str.Left(CboToGiao.SelectedValue.ToString().Trim(), 7) + "_" + str.Left(CboToNhan.SelectedValue.ToString().Trim(), 7) + "_" + "_GIAONHAN_TV_" + dtpNgay.SelectedDate.Value.ToString("ddMMyyyy") + ".csv"; str.ExportToExcel(dtNew, 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, "Error", MessageBoxButton.OK, MessageBoxImage.Error); } cls.DongKetNoi(); }
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_QT_KHTC", bien, giatri, thamso); cls.LoadDataProcPara("usp_QT_KHTC", bien, giatri, thamso); if (BienBll.NdMadv == BienBll.MainPos) { if (bll.Left(CboPos.SelectedValue.ToString().Trim(), 6) == "003000") { string str1 = "select * from TAM_KHTC where MAU='1' order by TT"; dt = cls.LoadDataText(str1); rpt_QT_KHTC rpt = new rpt_QT_KHTC(); RPUtility.ShowRp(rpt, dt, this, srv.DbSourceSerVer(), srv.DbNameSerVer(), srv.DbUserSerVer(), srv.DbPassSerVer()); string str2 = "select * from TAM_KHTC where MAU='2' order by TT"; dt = cls.LoadDataText(str2); rpt_QT_KHTC rpt1 = new rpt_QT_KHTC(); RPUtility.ShowRp(rpt1, dt, this, srv.DbSourceSerVer(), srv.DbNameSerVer(), srv.DbUserSerVer(), srv.DbPassSerVer()); } else { string str1 = "select * from TAM_KHTC where MAU='1' order by TT"; dt = cls.LoadDataText(str1); rpt_QT_KHTCHuyen rpt = new rpt_QT_KHTCHuyen(); RPUtility.ShowRp(rpt, dt, this, srv.DbSourceSerVer(), srv.DbNameSerVer(), srv.DbUserSerVer(), srv.DbPassSerVer()); string str2 = "select * from TAM_KHTC where MAU='2' order by TT"; dt = cls.LoadDataText(str2); rpt_QT_KHTCHuyen rpt1 = new rpt_QT_KHTCHuyen(); RPUtility.ShowRp(rpt1, dt, this, srv.DbSourceSerVer(), srv.DbNameSerVer(), srv.DbUserSerVer(), srv.DbPassSerVer()); } } else { string str1 = "select * from TAM_KHTC where MAU='1' order by TT"; dt = cls.LoadDataText(str1); rpt_QT_KHTCHuyen rpt = new rpt_QT_KHTCHuyen(); RPUtility.ShowRp(rpt, dt, this, srv.DbSourceSerVer(), srv.DbNameSerVer(), srv.DbUserSerVer(), srv.DbPassSerVer()); string str2 = "select * from TAM_KHTC where MAU='2' order by TT"; dt = cls.LoadDataText(str2); rpt_QT_KHTCHuyen rpt1 = new rpt_QT_KHTCHuyen(); RPUtility.ShowRp(rpt1, 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); } }
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(); }
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(); }
private void BtnIn_OnClick(object sender, RoutedEventArgs e) { try { strsql = "select * from TBNDH where KU_MATO='" + s.Left(CboTo.SelectedValue.ToString().Trim(), 7) + "' and NGAY='" + dtpNgay.SelectedDate.Value.ToString("yyyy-MM-dd") + "' and DENNGAY='" + dtpDenNgay.SelectedDate.Value.ToString("yyyy-MM-dd") + "' and CHAPNHAN=1 or TUCHOI=1"; cls.ClsConnect(); var dtin = cls.LoadDataText(strsql); if (dtin.Rows.Count > 0) { strsql = "select * from TBNDH where KU_MATO='" + s.Left(CboTo.SelectedValue.ToString().Trim(), 7) + "' and NGAY='" + dtpNgay.SelectedDate.Value.ToString("yyyy-MM-dd") + "' and DENNGAY='" + dtpDenNgay.SelectedDate.Value.ToString("yyyy-MM-dd") + "' and CHAPNHAN=1"; var dtin1 = cls.LoadDataText(strsql); rpt_TBNDH rpt = new rpt_TBNDH(); RPUtility.ShowRp(rpt, dtin1, this, srv.DbSourceSerVer(), srv.DbNameSerVer(), srv.DbUserSerVer(), srv.DbPassSerVer()); rpt_TBNDH2 rpt1 = new rpt_TBNDH2(); RPUtility.ShowRp(rpt1, dtin1, this, srv.DbSourceSerVer(), srv.DbNameSerVer(), srv.DbUserSerVer(), srv.DbPassSerVer()); strsql = "select * from TBNDH where KU_MATO='" + s.Left(CboTo.SelectedValue.ToString().Trim(), 7) + "' and NGAY='" + dtpNgay.SelectedDate.Value.ToString("yyyy-MM-dd") + "' and DENNGAY='" + dtpDenNgay.SelectedDate.Value.ToString("yyyy-MM-dd") + "' and TUCHOI=1"; var dtin2 = cls.LoadDataText(strsql); rpt_TBNDH1 rpt2 = new rpt_TBNDH1(); RPUtility.ShowRp(rpt2, dtin2, 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("Tiếp tục" + ex.Message, "Mess"); } cls.DongKetNoi(); }
private void btnOK_Click(object sender, RoutedEventArgs e) { ClsServer cls = new ClsServer(); try { cls.ClsConnect(); int thamso = 4; string[] bien = new string[thamso]; object[] giatri = new object[thamso]; bien[0] = "@Ngay"; if (dtpNgay.SelectedDate != null) { giatri[0] = dtpNgay.SelectedDate.Value.ToString("yyyy-MM-dd"); } bien[1] = "@MaPos"; giatri[1] = bll.Left(CboPos.SelectedValue.ToString().Trim(), 6); bien[2] = "@MaXa"; giatri[2] = bll.Left(CboXa.SelectedValue.ToString().Trim(), 6); bien[3] = "@Nam"; giatri[3] = comboBoxYear.SelectedValue.ToString().Trim(); dt = cls.LoadLdbf("usp_TTDSHN01", bien, giatri, thamso); rpt_ChkDoituong01 rpt = new rpt_ChkDoituong01(); RPUtility.ShowRp(rpt, dt, this, srv.DbSourceSerVer(), srv.DbNameSerVer(), srv.DbUserSerVer(), srv.DbPassSerVer()); //MessageBox.Show("Insert OK", "Thông báo", MessageBoxButton.OK, MessageBoxImage.Information); } catch (Exception ex) { MessageBox.Show("Error + " + ex.Message, "Error", MessageBoxButton.OK, MessageBoxImage.Error); } }
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(); } }
private void Print_OnClick(object sender, RoutedEventArgs e) { try { _cls.ClsConnect(); if (chkth.IsChecked == true) { str = "select * from MAU_THIDUA where NAM='" + comboBoxYear.SelectedValue + "' and QUY='" + CboQuy.SelectionBoxItem.ToString().Trim() + "' and DOT='" + bll.Left(RadCboDot.SelectedValue.ToString(), 1) + "' and CHONIN='1' order by CHUYENDE,STT"; } else { str = "select * from MAU_THIDUA where NAM='" + comboBoxYear.SelectedValue + "' and QUY='" + CboQuy.SelectionBoxItem.ToString().Trim() + "' and DOT='" + bll.Left(RadCboDot.SelectedValue.ToString(), 1) + "'and CHUYENDE='" + RadCboChDe.SelectedValue.ToString().Trim() + "' and CHONIN='1' order by STT"; } var dtin = _cls.LoadDataText(str); if (chkth.IsChecked == true) { rpt_ThiDua04 rpt = new rpt_ThiDua04(); RPUtility.ShowRp(rpt, dtin, this, srv.DbSourceSerVer(), srv.DbNameSerVer(), srv.DbUserSerVer(), srv.DbPassSerVer()); } else { rpt_ThiDua rpt = new rpt_ThiDua(); 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(); } }