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(); }
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) { // 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_KHTC", bien, giatri, thamso); if (_dt.Rows.Count > 0) { if (BienBll.NdMadv.Trim() == BienBll.MainPos.Trim()) { rpt_QT_KHTC_NEW rpt = new rpt_QT_KHTC_NEW(); RPUtility.ShowRp(rpt, _dt, this, srv.DbSourceSerVer(), srv.DbNameSerVer(), srv.DbUserSerVer(), srv.DbPassSerVer()); //FileName = Thumuc + "\\" + giatri[1] + "_KHTC_" + 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 { rpt_QT_KHTCHuyen_NEW rpt = new rpt_QT_KHTCHuyen_NEW(); 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(); }
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(); } }
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 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 lblIn_MouseDown(object sender, MouseButtonEventArgs e) { dtNew = dt.GetChanges(); if (dtNew == null || dtNew.Rows.Count == 0) { MessageBox.Show("Chưa có thay đổi nào !", "Thông báo", MessageBoxButton.OK, MessageBoxImage.Warning); } else { rpt_Mau06 rpt = new rpt_Mau06(); RPUtility.ShowRp(rpt, dtNew, this, srv.DbSourceSerVer(), srv.DbNameSerVer(), srv.DbUserSerVer(), srv.DbPassSerVer()); } }
private void BtnOk_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(); } }
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 TongHop_OnMouseDown(object sender, MouseButtonEventArgs e) { try { string ng = dtpNgay.SelectedDate.Value.ToString("yyyy-MM-dd"); string pos = CboPos.SelectedValue.ToString().Trim(); 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(); str = "select *,(select po_ten from DMPOS where po_ma=pos) po_ten from( " + " select NGAYBC NGAY,'" + pos + "' POS, MA_TS, LOAI_TS, TEN_LOAI_TS, MA_NHANHIEU_TS, TEN_NHANHIEU_TS, right(MAPHONG, 2) maph from LUU_TSCC where TRANGTHAI = 'A' and POS_CD = '" + pos + "'" + " ) as nguon pivot (count(ma_ts) for maph in ([17],[18],[19], [20], [21], [22], [29], [30], [31], [34])) as dich" + " where [17] +[18] + [19] + [20] + [21] + [22] + [29] + [30] + [31] + [34] > 0 order by LOAI_TS,MA_NHANHIEU_TS"; str1 = "select *,N'Tổng Hợp' po_ten from ( " + " select NGAYBC NGAY,N'Tổng Hợp' POS, MA_TS, LOAI_TS, TEN_LOAI_TS, MA_NHANHIEU_TS, TEN_NHANHIEU_TS, right(MAPHONG, 2) maph from LUU_TSCC where TRANGTHAI = 'A'" + " and LOAI_TS_CHITIET in ('MM1','TI1') and MA_NHANHIEU_TS in ('MM11','MM12','TI11','TI12','TI13','TI19')) as nguon pivot(count(ma_ts) for maph in ([17],[18],[19], [20], [21], [22], [29], [30], [31], [34])) as dich" + " where[17] + [18] + [19] + [20] + [21] + [22] + [29] + [30] + [31] + [34] > 0 order by LOAI_TS,MA_NHANHIEU_TS"; //MessageBox.Show(str); dt = cls.LoadDataText(str); var dt1 = cls.LoadDataText(str1); if (dt.Rows.Count > 0) { rpt_TSCC_TH rpt = new rpt_TSCC_TH(); RPUtility.ShowRp(rpt, dt, this, srv.DbSourceSerVer(), srv.DbNameSerVer(), srv.DbUserSerVer(), srv.DbPassSerVer()); RPUtility.ShowRp(rpt, dt1, 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); } }
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(); }
private void BtnOk_OnClick(object sender, RoutedEventArgs e) { string ng = dtpNgay.SelectedDate.Value.ToString("dd/MM/yyyy"); string nam = dtpNgay.SelectedDate.Value.ToString("yyyy"); _cls.ClsConnect(); try { sql = "select a.NAMBC,'" + ng + "' NGAY,convert(datetime,left(NGAY_NHAP,7)+'-'+D1,102) NGAYBC,a.MAPGD,b.PO_TEN,a.MA MAXA,a.TEN TENXA,(case when a.D16=2 then 'X' else '' end) CAPTINH" + " ,(case when a.D16<>2 then 'X' else '' end) CAPHUYEN ,cast(a.D15 as numeric(10, 1)) SODIEM,a.NGAY_NHAP,a.NGUOI_NHAP from DULIEU_NT a" + " left join DMPOS b on a.MAPGD = b.PO_MA where nambc = '" + nam + "' and khoa = 'TDNN_001' and cast(a.D15 as numeric) > 0 order by a.MA,a.NGAYBC,a.NGAY_NHAP"; string sql1 = "with lst1 as " + " ( select distinct a.MA from dulieu_nt a where a.khoa = 'TDNN_001' and a.nambc = '" + nam + "' and a.MA not in " + " (select distinct b.MA from dulieu_nt b where b.khoa = 'TDNN_001' and b.nambc = '" + nam + "' and cast(b.D15 as numeric) > 0 " + " and a.MA = b.MA) )" + " select '" + nam + "' NAMBC,'" + ng + "' NGAY,'' NGAYBC,a.PGD_QL MAPGD, c.PO_TEN,a.MA MAXA, a.TEN TENXA,'' CAPTINH,'' CAPHUYEN,0 SODIEM,'' " + "NGAY_NHAP,'' NGUOI_NHAP " + " from dmxa a left join DMPOS c on a.PGD_QL = c.PO_MA, lst1 b where a.MA = b.MA order by a.ma"; _dt = _cls.LoadDataText(sql); var dt1 = _cls.LoadDataText(sql1); if (_dt.Rows.Count == 0) { MessageBox.Show("Không có dữ liệu !", "Thông báo", MessageBoxButton.OK, MessageBoxImage.Warning); Close(); } else { rpt_KT3502 rpt = new rpt_KT3502(); RPUtility.ShowRp(rpt, _dt, this, srv.DbSourceSerVer(), srv.DbNameSerVer(), srv.DbUserSerVer(), srv.DbPassSerVer()); RPUtility.ShowRp(rpt, dt1, this, srv.DbSourceSerVer(), srv.DbNameSerVer(), srv.DbUserSerVer(), srv.DbPassSerVer()); } } catch (Exception ex) { MessageBox.Show("Error" + ex.Message, "Error", MessageBoxButton.OK, MessageBoxImage.Error); } _cls.DongKetNoi(); }
private void OK_OnClick(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] = 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"); } 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("usp_XLN_M4", bien, giatri, thamso); if (dt.Rows.Count > 0) { rpt_XLN_M4 rpt = new rpt_XLN_M4(); 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 btnOK_Click(object sender, RoutedEventArgs e) { try { cls.ClsConnect(); int thamso = 3; string[] bien = new string[thamso]; object[] giatri = new object[thamso]; bien[0] = "@MaPos"; giatri[0] = str.Left(CboPos.SelectedValue.ToString().Trim(), 6); bien[1] = "@Ngay"; if (dtpNgay.SelectedDate != null) { giatri[1] = dtpNgay.SelectedDate.Value.ToString("yyyy-MM-dd"); } bien[2] = "@Mau"; if (Ration1.IsChecked != null && (bool)Ration1.IsChecked) { giatri[2] = "1"; } else if (Ration2.IsChecked != null && (bool)Ration2.IsChecked) { giatri[2] = "2"; } else { giatri[2] = "3"; } // MessageBox.Show(giatri[0]+","+giatri[1] + ","+giatri[2] + ","+giatri[3] + ","+giatri[4]); dt = cls.LoadDataProcPara("usp_TGTKTO", bien, giatri, thamso); if (dt.Rows.Count > 0) { rpt_TGTKTO01 rpt = new rpt_TGTKTO01(); RPUtility.ShowRp(rpt, dt, this, srv.DbSourceSerVer(), srv.DbNameSerVer(), srv.DbUserSerVer(), srv.DbPassSerVer()); } else { MessageBox.Show("Chưa có số liệu", "Thông báo"); } } catch (Exception ex) { MessageBox.Show(ex.Message); } cls.DongKetNoi(); }
private void lblXem_OnMouseDown(object sender, MouseButtonEventArgs e) { try { cls.ClsConnect(); DataTable dt = new DataTable(); int thamso = 2; string[] bien = new string[thamso]; object[] giatri = new object[thamso]; bien[0] = "@Ngay"; bien[1] = "@Makh"; if (dtpNgay.SelectedDate == null) { MessageBox.Show("Chưa chọn ngày", "Thông báo", MessageBoxButton.OK, MessageBoxImage.Error); return; } else { giatri[0] = dtpNgay.SelectedDate.Value.ToString("yyyy-MM-dd"); } if (txtMakh.Text == null) { MessageBox.Show("Chưa nhập MAKH", "Thông báo", MessageBoxButton.OK, MessageBoxImage.Error); return; } else { giatri[1] = txtMakh.Text.Trim(); } dt = cls.LoadDataProcPara("usp_TTKH", bien, giatri, thamso); if (dt.Rows.Count > 0) { rpt_TTKH rpt = new rpt_TTKH(); RPUtility.ShowRp(rpt, dt, this, srv.DbSourceSerVer(), srv.DbNameSerVer(), srv.DbUserSerVer(), srv.DbPassSerVer()); } else { MessageBox.Show("Không có thông tin khách hàng !", "Thông báo"); } cls.DongKetNoi(); } catch (Exception ex) { MessageBox.Show("Error " + ex.Message, "Mess", MessageBoxButton.OK, MessageBoxImage.Error); } }
private void BtnUpdate_OnClick(object sender, RoutedEventArgs e) { try { cls.ClsConnect(); var dtchk = cls.LoadDataText("select * from LUU_DANHGIAGV where NGAY='" + dtpNgay.SelectedDate.Value.ToString("yyyy-MM-dd") + "' and ND_MA='" + BienBll.Ndma.Trim() + "'"); if (dtchk.Rows.Count == 0) { dtNew = dt.Clone(); foreach (DataRow dr in dt.Rows) { if ((bool)dr["TOT"] == true || (bool)dr["KHA"] == true || (bool)dr["TB"] == true) { dtNew.ImportRow(dr); } } if (dtNew == null || dtNew.Rows.Count == 0) { MessageBox.Show("Chưa chọn khách hàng nào !", "Thông báo", MessageBoxButton.OK, MessageBoxImage.Warning); } foreach (DataRow dr in dtNew.Rows) { strsql = "insert into LUU_DANHGIAGV(NGAY,PO_MA,PO_TEN,ND_MA,ND_TEN,TT,CHITIEU,TOT,KHA,TB,DEXUAT)" + " Values('" + dr["NGAY"] + "','" + dr["PO_MA"] + "',N'" + dr["PO_TEN"] + "','" + dr["ND_MA"] + "',N'" + dr["ND_TEN"] + "','" + dr["TT"] + "',N'" + dr["CHITIEU"] + "','" + dr["TOT"] + "','" + dr["KHA"] + "','" + dr["TB"] + "',N'" + dr["DEXUAT"] + "')"; cls.UpdateDataText(strsql); // MessageBox.Show(strsql); } } //MessageBox.Show("Cập nhật thành công !", "Thông báo", MessageBoxButton.OK, MessageBoxImage.Information); var dtin = cls.LoadDataText("select * from LUU_DANHGIAGV where NGAY='" + dtpNgay.SelectedDate.Value.ToString("yyyy-MM-dd") + "' and ND_MA='" + BienBll.Ndma.Trim() + "' order by TT"); rpt_DanhGiaGV rpt = new rpt_DanhGiaGV(); RPUtility.ShowRp(rpt, dtin, this, srv.DbSourceSerVer(), srv.DbNameSerVer(), srv.DbUserSerVer(), srv.DbPassSerVer()); 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) { try { cls.ClsConnect(); DataTable dt = new DataTable(); int thamso = 2; string[] bien = new string[thamso]; object[] giatri = new object[thamso]; bien[0] = "@MaPos"; giatri[0] = str.Left(CboPos.SelectedValue.ToString().Trim(), 6); bien[1] = "@Ngay"; if (dtpNgay.SelectedDate == null) { MessageBox.Show("Chưa chọn ngày", "Thông báo", MessageBoxButton.OK, MessageBoxImage.Error); return; } else { giatri[1] = dtpNgay.SelectedDate.Value.ToString("yyyy-MM-dd"); } //MessageBox.Show(giatri[0] + " " + giatri[1] + " " + giatri[2] + " " + giatri[3] + " " + giatri[4]); dt = cls.LoadLdbf("usp_THUNODH", bien, giatri, thamso); //rpt_kt740_01 rpt = new rpt_kt740_01(); if (dt.Rows.Count > 0) { rpt_KH_THUNO rpt = new rpt_KH_THUNO(); RPUtility.ShowRp(rpt, dt, this, srv.DbSourceSerVer(), srv.DbNameSerVer(), srv.DbUserSerVer(), srv.DbPassSerVer()); //dataGrid1.ItemsSource = dt.DefaultView; // FileName = Thumuc + "\\" + str.Left(CboPos.SelectedValue.ToString().Trim(), 6) + "_" + str.Left(CboDvut.SelectedValue.ToString().Trim(), 2) + "_" + str.Left(CboXa.SelectedValue.ToString().Trim(), 6) + "_" + dtpNgay.SelectedDate.Value.ToString("ddMMyyyy") + ".xlsx"; // str.WriteDataTableToExcel(dt, "Person Details", FileName, "Details"); //MessageBox.Show("Copy Excel to : " ); } else { MessageBox.Show("Không có số liệu", "Thông báo", MessageBoxButton.OK, MessageBoxImage.Warning); } } catch (Exception ex) { MessageBox.Show(ex.Message, "Error", MessageBoxButton.OK, MessageBoxImage.Error); } cls.DongKetNoi(); }
private void btnOk_Click(object sender, RoutedEventArgs e) { cls.ClsConnect(); try { int thamso = 2; string[] bien = new string[thamso]; object[] giatri = new object[thamso]; bien[0] = "@MaPos"; giatri[0] = bll.Left(CboPos.SelectedValue.ToString().Trim(), 6); bien[1] = "@Ngay"; if (dtpNgay.SelectedDate != null) { giatri[1] = dtpNgay.SelectedDate.Value.ToString("yyyy-MM-dd"); } else { MessageBox.Show("Chọn Ngày", "Mess"); return; } if (Ration1.IsChecked == true) { dt = cls.LoadDataProcPara("usp_Ptsl", bien, giatri, thamso); } else { dt = cls.LoadDataProcPara("usp_Ptslct", bien, giatri, thamso); } if (dt.Rows.Count > 0) { rpt_Ptsl rpt = new rpt_Ptsl(); RPUtility.ShowRp(rpt, dt, this, srv.DbSourceSerVer(), srv.DbNameSerVer(), srv.DbUserSerVer(), srv.DbPassSerVer()); } else { MessageBox.Show("Không có bản ghi nào ", "Mess"); } } catch (Exception ex) { MessageBox.Show(ex.Message); } cls.DongKetNoi(); }
private void BtnOk_OnClick(object sender, RoutedEventArgs e) { try { cls.ClsConnect(); string pos = BienBll.NdMadv; 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"] + ",COT06=" + dr["COT06"] + ",COT07=" + dr["COT07"] + ",ND_MA='" + BienBll.Ndma + "',ND_TEN=N'" + BienBll.NdTen + "'" + " where MAPOS='" + pos + "' and TT='" + dr["TT"] + "' and THANG='" + thang + "' and NAM='" + nam + "' and MAU='1'"; cls.UpdateDataText(strsql); } MessageBox.Show("Update Ok", "Mess", MessageBoxButton.OK, MessageBoxImage.Information); } 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) where MAPOS='" + pos + "' and THANG='" + thang + "' and NAM='" + nam + "' and MAU='1'"; cls.UpdateDataText(strup); var dtin = cls.LoadDataText("select * from LUUKTNB where MAPOS='" + pos + "' and THANG='" + thang + "' and NAM='" + nam + "' and MAU='1' order by TT"); rpt_KTNB02 rpt = new rpt_KTNB02(); 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(); } }
private void btnOk_Click(object sender, RoutedEventArgs e) { try { //@MaPos = N'003005', //@Ngay = N'31/07/2015', //@Maxa = N'300504', //@Mato = N'0174146' cls.ClsConnect(); int thamso = 2; string[] bien = new string[thamso]; object[] giatri = new object[thamso]; bien[0] = "@Ngay"; if (dtpNgay.SelectedDate == null) { MessageBox.Show("Chưa chọn ngày ", "Mess"); return; } else { giatri[0] = dtpNgay.SelectedDate.Value.ToString("yyyy-MM-dd"); } bien[1] = "@Mato"; giatri[1] = bll.Left(CboTo.SelectedValue.ToString().Trim(), 7); dt = cls.LoadDataProcPara("usp_DoiChieu", bien, giatri, thamso); if (dt.Rows.Count > 0) { rpt_DoiChieu rpt = new rpt_DoiChieu(); 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); } }
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_RsGqvl rpt = new rpt_RsGqvl(); RPUtility.ShowRp(rpt, dtNew, this, srv.DbSourceSerVer(), srv.DbNameSerVer(), srv.DbUserSerVer(), srv.DbPassSerVer()); cls.ClsConnect(); foreach (DataRow dr in dtNew.Rows) { string upd = "update LUU_GQVL set TT_CHECK='Y' where KU_SOKU='" + dr["KU_SOKU"] + "' and TT_CHECK='N'"; cls.UpdateDataText(upd); } MessageBox.Show("Lưu thành công ! " + FileName, "Thông báo", MessageBoxButton.OK, MessageBoxImage.Information); } } catch (Exception ex) { MessageBox.Show(ex.Message, "Error", MessageBoxButton.OK, MessageBoxImage.Error); } cls.DongKetNoi(); }
private void btnChapNhan_Click(object sender, RoutedEventArgs e) { DataTable dt = new DataTable(); cls.ClsConnect(); int thamso = 4; string[] bien = new string[thamso]; object[] giatri = new object[thamso]; bien[0] = "@ngay"; giatri[0] = dtpNgay.SelectedDate.Value.ToString("dd/MM/yyyy"); bien[1] = "@MaXa"; giatri[1] = bll.Left(cboXa.SelectedValue.ToString(), 6); bien[2] = "@StartDate"; giatri[2] = dtpStartDate.SelectedDate.Value.ToString("dd/MM/yyyy"); bien[3] = "@EndDate"; giatri[3] = dtpEndDate.SelectedDate.Value.ToString("dd/MM/yyyy"); MessageBox.Show(giatri[0].ToString() + giatri[1].ToString() + giatri[2].ToString() + giatri[3].ToString()); if (opt01.IsChecked.Value == true) { dt = cls.LoadDataProcPara("usp_DanhSach01", bien, giatri, thamso); } else { dt = cls.LoadDataProcPara("usp_DanhSach19", bien, giatri, thamso); } int dem = dt.Rows.Count; if (dem <= 0) { MessageBox.Show("Không có khách hàng nào"); } else { rpt_DanhSach rpt = new rpt_DanhSach(); RPUtility.ShowRp(rpt, dt, this, srv.DbSourceSerVer(), srv.DbNameSerVer(), srv.DbUserSerVer(), srv.DbPassSerVer()); } }
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 { // dgvTarGet.ItemsSource = dtNew.DefaultView; rpt_01TG rpt = new rpt_01TG(); RPUtility.ShowRp(rpt, dtNew, this, srv.DbSourceSerVer(), srv.DbNameSerVer(), srv.DbUserSerVer(), srv.DbPassSerVer()); } // dtNew.RejectChanges(); // dtNew = null; }
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 btnIn_Click(object sender, RoutedEventArgs e) { try { cls.ClsConnect(); string upd1 = "update LUU_CAMERA set D3= (case when CHON=1 then 1 else 0 end) where MAXA='" + str.Left(CboXa.SelectedValue.ToString().Trim(), 6) + "' and THANG='" + dtpNgay.SelectedDate.Value.ToString("MM") + "' and NAM='" + dtpNgay.SelectedDate.Value.ToString("yyyy") + "'"; cls.UpdateDataText(upd1); int thamso = 2; string[] bien = new string[thamso]; object[] giatri = new object[thamso]; bien[0] = "@Maxa"; giatri[0] = str.Left(CboXa.SelectedValue.ToString().Trim(), 6); bien[1] = "@Ngay"; giatri[1] = dtpNgay.SelectedDate.Value.ToString("yyyy-MM-dd"); var dtin = cls.LoadDataProcPara("usp_Camera", bien, giatri, thamso); if (dtin.Rows.Count > 0) { rpt_Camera rpt = new rpt_Camera(); RPUtility.ShowRp(rpt, dtin, this, srv.DbSourceSerVer(), srv.DbNameSerVer(), srv.DbUserSerVer(), srv.DbPassSerVer()); } else { MessageBox.Show("Chưa có số liệu", "Thông báo"); } //MessageBox.Show("Lưu thành công ! " + FileName, "Thông báo", MessageBoxButton.OK, MessageBoxImage.Information); } catch (Exception ex) { MessageBox.Show(ex.Message, "Error", MessageBoxButton.OK, MessageBoxImage.Error); } 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 { // @MaPos = N'003005', //@Ngay = N'31/07/2015', //@Maxa = N'300512', //@Mato = N'0137149', //@TuNgay = N'01/01/2014', //@DenNgay = N'30/06/2015' cls.ClsConnect(); DataTable dt = new DataTable(); int thamso = 5; string[] bien = new string[thamso]; object[] giatri = new object[thamso]; bien[0] = "@Mato"; if (Ration3.IsChecked == true || Ration1.IsChecked == true) { giatri[0] = bll.Left(CboXa.SelectedValue.ToString().Trim(), 6); } else { giatri[0] = bll.Left(CboTo.SelectedValue.ToString().Trim(), 7); } bien[1] = "@Ngay"; if (dtpNgay.SelectedDate == null) { MessageBox.Show("Chưa chọn ngày ", "Mess"); return; } else { giatri[1] = dtpNgay.SelectedDate.Value.ToString("yyyy-MM-dd"); } bien[2] = "@TuNgay"; if (dtpTuNgay.SelectedDate == null) { MessageBox.Show("Chưa chọn ngày ", "Mess"); return; } else { giatri[2] = dtpTuNgay.SelectedDate.Value.ToString("yyyy-MM-dd"); } bien[3] = "@DenNgay"; if (dtpDenNgay.SelectedDate == null) { MessageBox.Show("Chưa chọn ngày ", "Mess"); return; } else { giatri[3] = dtpDenNgay.SelectedDate.Value.ToString("yyyy-MM-dd"); } bien[4] = "@Mau"; if (Ration1.IsChecked == true) { giatri[4] = "1"; } else if (Ration2.IsChecked == true) { giatri[4] = "2"; } else { giatri[4] = "3"; } // MessageBox.Show(giatri[0] + " " + giatri[1]); dt = cls.LoadDataProcPara("usp_KTSDVV", bien, giatri, thamso); if (dt.Rows.Count > 0) { rpt_KTSDVV rpt = new rpt_KTSDVV(); 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); } }
private void btnOk_Click(object sender, RoutedEventArgs e) { cls.ClsConnect(); if (Ration1.IsChecked == true) { try { int thamso = 4; string[] bien = new string[thamso]; object[] giatri = new object[thamso]; bien[0] = "@Mato"; if (CboTo != null) { giatri[0] = bll.Left(CboTo.SelectedValue.ToString().Trim(), 7); } else { MessageBox.Show("Chọn Tổ", "Mess"); return; } bien[1] = "@Ngay"; if (dtpNgay.SelectedDate.Value == null) { MessageBox.Show("Chưa chọn ngày ", "Thông báo", MessageBoxButton.OK, MessageBoxImage.Error); return; } else { giatri[1] = dtpNgay.SelectedDate.Value.ToString("dd/MM/yyyy"); } bien[2] = "@TuNgay"; if (dtpTuNgay.SelectedDate.Value == null) { MessageBox.Show("Chưa chọn ngày ", "Thông báo", MessageBoxButton.OK, MessageBoxImage.Error); return; } else { giatri[2] = dtpTuNgay.SelectedDate.Value.ToString("dd/MM/yyyy"); } bien[3] = "@DenNgay"; if (dtpDenNgay.SelectedDate.Value == null) { MessageBox.Show("Chưa chọn ngày ", "Thông báo", MessageBoxButton.OK, MessageBoxImage.Error); return; } else { giatri[3] = dtpDenNgay.SelectedDate.Value.ToString("dd/MM/yyyy"); } dt = cls.LoadDataProcPara("usp_SvCT", bien, giatri, thamso); if (dt.Rows.Count > 0) { rpt_SvCt rpt = new rpt_SvCt(); RPUtility.ShowRp(rpt, dt, this, srv.DbSourceSerVer(), srv.DbNameSerVer(), srv.DbUserSerVer(), srv.DbPassSerVer()); } else { MessageBox.Show("Không có bản ghi nào ", "Mess"); } } catch (Exception ex) { MessageBox.Show(ex.Message); } } else if (Ration2.IsChecked == true) { try { int thamso = 2; string[] bien = new string[thamso]; object[] giatri = new object[thamso]; bien[0] = "@MaXa"; if (CboXa != null) { giatri[0] = bll.Left(CboXa.SelectedValue.ToString().Trim(), 6); } else { MessageBox.Show("Chọn Xã", "Mess"); return; } bien[1] = "@Ngay"; if (dtpNgay.SelectedDate != null) { giatri[1] = dtpNgay.SelectedDate.Value.ToString("dd/MM/yyyy"); } else { MessageBox.Show("Chọn Ngày", "Mess"); return; } // MessageBox.Show(giatri[0] + " " + giatri[1]); dt = cls.LoadDataProcPara("usp_SvTo", bien, giatri, thamso); if (dt.Rows.Count > 0) { rpt_SvTo rpt = new rpt_SvTo(); RPUtility.ShowRp(rpt, dt, this, srv.DbSourceSerVer(), srv.DbNameSerVer(), srv.DbUserSerVer(), srv.DbPassSerVer()); } else { MessageBox.Show("Không có bản ghi nào ", "Mess"); } } catch (Exception ex) { MessageBox.Show(ex.Message); } } else if (Ration3.IsChecked == true) { try { int thamso = 2; string[] bien = new string[thamso]; object[] giatri = new object[thamso]; bien[0] = "@MaPos"; if (CboPos.SelectedValue != null) { giatri[0] = bll.Left(CboPos.SelectedValue.ToString().Trim(), 6); } else { MessageBox.Show("Chọn POS", "Mess"); return; } bien[1] = "@Ngay"; if (dtpNgay.SelectedDate != null) { giatri[1] = dtpNgay.SelectedDate.Value.ToString("dd/MM/yyyy"); } else { MessageBox.Show("Chọn Ngày", "Mess"); return; } // MessageBox.Show(giatri[0] + " " + giatri[1]); dt = cls.LoadDataProcPara("usp_SvXa", bien, giatri, thamso); if (dt.Rows.Count > 0) { //dataGrid1.ItemsSource = dt.DefaultView; rpt_SvXa rpt = new rpt_SvXa(); RPUtility.ShowRp(rpt, dt, this, srv.DbSourceSerVer(), srv.DbNameSerVer(), srv.DbUserSerVer(), srv.DbPassSerVer()); } else { MessageBox.Show("Không có bản ghi nào ", "Mess"); } } catch (Exception ex) { MessageBox.Show(ex.Message); } } else { try { int thamso = 2; string[] bien = new string[thamso]; object[] giatri = new object[thamso]; bien[0] = "@MaPos"; if (CboPos.SelectedValue != null) { giatri[0] = bll.Left(CboPos.SelectedValue.ToString().Trim(), 6); } else { MessageBox.Show("Chọn POS", "Mess"); return; } bien[1] = "@Ngay"; if (dtpNgay.SelectedDate != null) { giatri[1] = dtpNgay.SelectedDate.Value.ToString("dd/MM/yyyy"); } else { MessageBox.Show("Chọn Ngày", "Mess"); return; } dt = cls.LoadDataProcPara("usp_SvPos", bien, giatri, thamso); if (dt.Rows.Count > 0) { //dataGrid1.ItemsSource = dt.DefaultView; rpt_SvPos rpt = new rpt_SvPos(); 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); } } }
private void btnOk_Click(object sender, RoutedEventArgs e) { cls.ClsConnect(); DataTable dt = new DataTable(); int thamso = 5; string[] bien = new string[thamso]; object[] giatri = new object[thamso]; bien[0] = "@MaPos"; giatri[0] = str.Left(CboPos.SelectedValue.ToString().Trim(), 6); bien[1] = "@Ngay"; if (dtpNgay.SelectedDate == null) { MessageBox.Show("Chưa chọn ngày", "Thông báo", MessageBoxButton.OK, MessageBoxImage.Error); return; } else { giatri[1] = dtpNgay.SelectedDate.Value.ToString("yyyy-MM-dd"); } bien[2] = "@MaXa"; giatri[2] = str.Left(CboXa.SelectedValue.ToString().Trim(), 6); bien[3] = "@Mau"; if (radioButton4.IsChecked == true) { giatri[3] = "1"; } else { giatri[3] = "2"; } bien[4] = "@Ky"; if (radioButton1.IsChecked == true) { giatri[4] = "1"; } else if (radioButton2.IsChecked == true) { giatri[4] = "2"; } else if (radioButton3.IsChecked == true) { giatri[4] = "3"; } //MessageBox.Show(giatri[0] + " " + giatri[1] + " " + giatri[2] + " " + giatri[3] + " " + giatri[4]); dt = cls.LoadDataProcPara("usp_XaTo", bien, giatri, thamso); //rpt_kt740_01 rpt = new rpt_kt740_01(); if (dt.Rows.Count > 0) { rpt_XaTo rpt = new rpt_XaTo(); RPUtility.ShowRp(rpt, dt, this, srv.DbSourceSerVer(), srv.DbNameSerVer(), srv.DbUserSerVer(), srv.DbPassSerVer()); //dataGrid1.ItemsSource = dt.DefaultView; // FileName = Thumuc + "\\" + str.Left(CboPos.SelectedValue.ToString().Trim(), 6) + "_" + str.Left(CboDvut.SelectedValue.ToString().Trim(), 2) + "_" + str.Left(CboXa.SelectedValue.ToString().Trim(), 6) + "_" + dtpNgay.SelectedDate.Value.ToString("ddMMyyyy") + ".xlsx"; // str.WriteDataTableToExcel(dt, "Person Details", FileName, "Details"); // MessageBox.Show("Copy Excel to : " + FileName); } else { MessageBox.Show("Chưa có số liệu", "Thông báo"); } cls.DongKetNoi(); }
private void btnOk_Click(object sender, RoutedEventArgs e) { #region try { if (str.Right(str.Left(CboPos.SelectedValue.ToString().Trim(), 6), 2) == "00") { MessageBox.Show("Không chọn POS tổng hợp", "Thông báo", MessageBoxButton.OK, MessageBoxImage.Warning); } else { cls.ClsConnect(); if (Ration1.IsChecked == true) { int thamso = 2; string[] bien = new string[thamso]; object[] giatri = new object[thamso]; bien[0] = "@NgayKu"; if (dtpNgayKu.SelectedDate != null) { giatri[0] = dtpNgayKu.SelectedDate.Value.ToString("yyyy-MM-dd"); } bien[1] = "@MaPos"; giatri[1] = str.Left(CboPos.SelectedValue.ToString().Trim(), 6); dt = cls.LoadLdbf("usp_SlVungBien", bien, giatri, thamso); if (dt.Rows.Count > 0) { rpt_SlVungBien rpt = new rpt_SlVungBien(); 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); } } else if (Ration2.IsChecked == true) { int thamso1 = 3; string[] bien = new string[thamso1]; object[] giatri = new object[thamso1]; bien[0] = "@NgayKu"; 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_SlVungBienCT", bien, giatri, thamso1); if (dt.Rows.Count > 0) { rpt_SlVungBienCt rpt = new rpt_SlVungBienCt(); 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); } } else { int thamso2 = 1; string[] bien = new string[thamso2]; object[] giatri = new object[thamso2]; bien[0] = "@NgayKu"; if (dtpNgayKu.SelectedDate != null) { giatri[0] = dtpNgayKu.SelectedDate.Value.ToString("yyyy-MM-dd"); } dt = cls.LoadLdbf("usp_SlVungBienTH", bien, giatri, thamso2); if (dt.Rows.Count > 0) { FileName = Thumuc + "\\" + str.Left(CboPos.SelectedValue.ToString().Trim(), 6) + "_SoLieuXaVungBien_" + dtpNgayKu.SelectedDate.Value.ToString("ddMMyyyy") + ".csv"; str.ExportToExcel(dt, FileName); //bll.ExportDTToExcel(dt,FileName); //bll.WriteDataTableToExcel(dt, "Details", FileName, "tutm : 0985165777"); //bll.ToCSV(dt, sw, true); MessageBox.Show("Copy Excel to : " + FileName, "Thông báo", MessageBoxButton.OK, MessageBoxImage.Information); //bll.OpenCSVWithExcel(FileName); str.OpenExcel(FileName); } 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 }