public fPhieuTraTien(bool thu = true, CCongNo cn = null) { InitializeComponent(); PThu = thu; addCN = cn; Init(); }
private void btnLapPhieu_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { int rowIndex = gvMain.FocusedRowHandle; string _MaBH = ((DataTable)gcMain.DataSource).Rows[rowIndex]["MaBH"].ToString(); DateTime _NgayLap = DateTime.Parse(((DataTable)gcMain.DataSource).Rows[rowIndex]["NgayLap"].ToString()); string _MaKH = CNThu == true ?((DataTable)gcMain.DataSource).Rows[rowIndex]["MaKH"].ToString(): ((DataTable)gcMain.DataSource).Rows[rowIndex]["MaNCC"].ToString(); string _TenKH = CNThu == true ? ((DataTable)gcMain.DataSource).Rows[rowIndex]["TenKH"].ToString() : ((DataTable)gcMain.DataSource).Rows[rowIndex]["TenNCC"].ToString(); decimal _SoTien = decimal.Parse(((DataTable)gcMain.DataSource).Rows[rowIndex]["SoTienNo"].ToString()); decimal _SoTienTra = decimal.Parse(((DataTable)gcMain.DataSource).Rows[rowIndex]["SoTienTra"].ToString()); decimal _SoTienConNo = decimal.Parse(((DataTable)gcMain.DataSource).Rows[rowIndex]["SoTienConNo"].ToString()); string _GhiChu = ((DataTable)gcMain.DataSource).Rows[rowIndex]["GhiChu"].ToString(); CCongNo phieu = new CCongNo { MaBH = _MaBH, NgayLap = _NgayLap, MaKH = _MaKH, TenKH = _TenKH, SoTien = _SoTien, SoTienTra = _SoTienTra, SoTienConNo = _SoTienConNo, GhiChu = _GhiChu }; if (CNThu == true) { fPhieuTraTien pt = new fPhieuTraTien(true, phieu); pt.ShowDialog(); } else { fPhieuTraTien pt = new fPhieuTraTien(false, phieu); pt.ShowDialog(); } }
public static void ThemPT(CCongNo pt) { try { CongNo dao = new CongNo(); dao.ThemPhieuThu(pt); } catch (SqlException ex) { throw ex; } }
public static void ThemPC(CCongNo pc) { try { CongNo dao = new CongNo(); dao.ThemPhieuChi(pc); } catch (SqlException ex) { throw ex; } }
public void ThemPhieuThu(CCongNo pt) { Provider dao = new Provider(); try { dao.Connect(); string sql = "KSP_PT_Insert"; CommandType type = CommandType.StoredProcedure; dao.ExeCuteNonQuery(type, sql, new SqlParameter { ParameterName = "@MaPT", Value = pt.MaPT }, new SqlParameter { ParameterName = "@NgayLap", Value = pt.NgayLap }, new SqlParameter { ParameterName = "@MaBH", Value = pt.MaBH }, new SqlParameter { ParameterName = "@MaKH", Value = pt.MaKH }, new SqlParameter { ParameterName = "@TenKH", Value = pt.TenKH }, new SqlParameter { ParameterName = "@SoTienTra", Value = pt.SoTienTra }, new SqlParameter { ParameterName = "@TaoBoi", Value = pt.TaoBoi }, new SqlParameter { ParameterName = "@MaNV", Value = pt.MaNV }, new SqlParameter { ParameterName = "@GhiChu", Value = pt.GhiChu }); } catch (SqlException ex) { throw ex; } finally { dao.DisConnect(); } }
private void XLThem() { string _MaPT = txtPhieu.Text; DateTime _NgayLap = DateTime.Parse(deNgay.EditValue.ToString()); string _MaBH = txtCT.Text; string _MaKH = addCN.MaKH; string _TenKH = txtKH.Text; decimal _SoTienTra = decimal.Parse(calcTraTien.EditValue.ToString()); string _TaoBoi = "admin"; string _MaNV = gleNhanVien.EditValue.ToString(); string _GhiChu = txtGhiChu.Text; CCongNo cn = new CCongNo ( _MaPT, _NgayLap, _MaBH, _MaKH, _TenKH, _SoTienTra, _TaoBoi, _MaNV, _GhiChu ); if (PThu == true) { BUS_CongNo.ThemPT(cn); Action.Module = "Phiếu Thu Tiền"; Action.ActionName = "Thêm"; Action.Reference = _MaPT; Action.LuuThongTin(); } else { BUS_CongNo.ThemPC(cn); Action.Module = "Phiếu Chi Tiền"; Action.ActionName = "Thêm"; Action.Reference = _MaPT; Action.LuuThongTin(); } Close(); }
private void btnLapPhieu_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { int rowIndex = gvMain.FocusedRowHandle; string _MaBH = gvMain.GetRowCellValue(rowIndex, "MaBH").ToString(); DateTime _NgayLap = DateTime.Parse(gvMain.GetRowCellValue(rowIndex, "NgayLap").ToString()); string _MaKH = CNThu == true?gvMain.GetRowCellValue(rowIndex, "MaKH").ToString() : gvMain.GetRowCellValue(rowIndex, "MaNCC").ToString(); string _TenKH = CNThu == true?gvMain.GetRowCellValue(rowIndex, "TenKH").ToString() : gvMain.GetRowCellValue(rowIndex, "TenNCC").ToString(); decimal _SoTien = decimal.Parse(gvMain.GetRowCellValue(rowIndex, "SoTienNo").ToString()); decimal _SoTienTra = decimal.Parse(gvMain.GetRowCellValue(rowIndex, "SoTienTra").ToString()); decimal _SoTienConNo = decimal.Parse(gvMain.GetRowCellValue(rowIndex, "SoTienConNo").ToString()); string _GhiChu = gvMain.GetRowCellValue(rowIndex, "GhiChu").ToString(); CCongNo phieu = new CCongNo { MaBH = _MaBH, NgayLap = _NgayLap, MaKH = _MaKH, TenKH = _TenKH, SoTien = _SoTien, SoTienTra = _SoTienTra, SoTienConNo = _SoTienConNo, GhiChu = _GhiChu }; if (CNThu == true) { fPhieuTraTien pt = new fPhieuTraTien(true, phieu); pt.ShowDialog(); } else { fPhieuTraTien pt = new fPhieuTraTien(false, phieu); pt.ShowDialog(); } }