public frmInPhieuXuatHang() { InitializeComponent(); dsXuatHang baocao = new dsXuatHang(); DataTable dtable = baocao.THXuatHang; rptPhieuXuatKho report = new rptPhieuXuatKho(); dtable = new STOCK_OUTWARD_DETAILController().Report_XuatHang("BH_admin_000026"); report.Database.Tables["THXuatHang"].SetDataSource((DataTable)dtable); crystalReportViewer1.ReportSource = report; crystalReportViewer1.Refresh(); }
private void barButtonItem4_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { if (MessageBox.Show("Bạn Muốn Xóa Phiếu Bán Hàng Này?", "Cảnh Báo", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button1) == DialogResult.Yes) { if (gridView1.RowCount > 0) { string id = gridView1.GetRowCellValue(gridView1.FocusedRowHandle, gridView1.Columns[0]).ToString(); if ((new DEBTController().DEBT_GetbyRefID(id).Amount >= new DEBTController().DEBT_GetbyRefID(id).Payment) && (new DEBTController().DEBT_GetbyRefID(id).Payment > 0)) { MessageBox.Show("Không thể xóa phiếu mua hàng này.\n\n Phiếu này đã được thu tiền.", "Cảnh Báo", MessageBoxButtons.OK, MessageBoxIcon.Error); } else { int rs = -1; int rsdetail = -1; rs = new STOCK_OUTWARDController().STOCK_OUTWARD_Delete(id); DataTable TableStockdetail = new STOCK_OUTWARD_DETAILController().STOCK_OUTWARD_DETAIL_GetList_ByID(id); //rsdetail = new STOCK_OUTWARD_DETAILController().STOCK_OUTWARD_DETAIL_Delete(new Guid("391fd8bf-0f5f-452e-bdc5-a2303be1c3d2")); foreach (DataRow datarow in TableStockdetail.Rows) { rsdetail = new STOCK_OUTWARD_DETAILController().STOCK_OUTWARD_DETAIL_Delete(new Guid(datarow["ID"].ToString())); } if ((rs > -1)) { MessageBox.Show("Phiếu bán hàng đã được xóa", "Thông báo"); _sys_log.MChine = new MobilityNetwork().GetComputerName(); _sys_log.IP = new MobilityNetwork().GetIP(); _sys_log.UserID = "US000001"; _sys_log.Created = DateTime.Now; _sys_log.Action_Name = "Xóa"; _sys_log.Description = "Xóa Bảng Kê Phiếu Xuất" + "-" + gridView1.GetRowCellValue(gridView1.FocusedRowHandle, gridView1.Columns[0]).ToString(); _sys_log.Reference = gridView1.GetRowCellValue(gridView1.FocusedRowHandle, gridView1.Columns[0]).ToString(); _sys_log.Module = "Bảng Kê Phiếu Xuất"; _sys_log.Active = true; SYS_LOGController insertlog = new SYS_LOGController(); insertlog.SYS_LOG_Insert(_sys_log); } else { MessageBox.Show("Phiếu bán hàng không được xóa", "Thông báo"); } } } gridControl1.DataSource = new STOCK_OUTWARDController().STOCK_OUTWARD_GetList_ByDate_Action(dateTu.DateTime, dateDen.DateTime, 0, 2); } }