public int InsertInforTranWarehouse(InforTransWarehouseDTO infor) { string sql = string.Format("INSERT INTO [THONGTIN_CHUYENKHO] VALUES('{0}', '{1}', '{2}', '{3}', N'{4}', '{5}', '{6}', N'{7}', {8})", infor.MaPhieuChuyen, infor.MaKhoXuat, infor.MaKhoNhan, infor.NgayLap, infor.GhiChu, infor.MaNVXuat, infor.MaNVNhan, infor.SoPhieuChuyenTay, infor.TongTienChuyen); return(ConnectionDB.ExcuteNonQuery(sql)); }
public int UpdateInforTranWarehouse(InforTransWarehouseDTO infor) { string sql = string.Format("UPDATE [THONGTIN_CHUYENKHO] SET MaKhoXuat = '{0}', MaKhoNhan = '{1}',NgayLap = '{2}', GhiChu = N'{3}', MaNVXuat = '{4}', MaNVNhan = '{5}', SoPhieuChuyenTay = '{6}', TongTienChuyen = {7} WHERE MaPhieuChuyen = '{8}'", infor.MaKhoXuat, infor.MaKhoNhan, infor.NgayLap, infor.GhiChu, infor.MaNVXuat, infor.MaNVNhan, infor.SoPhieuChuyenTay, infor.TongTienChuyen, infor.MaPhieuChuyen); return(ConnectionDB.ExcuteNonQuery(sql)); }
private void btnSuaChua_Click(object sender, EventArgs e) { GridView gridView = grcTheoHangHoa.FocusedView as GridView; InforTransWarehouseDTO inforSellGui = new InforTransWarehouseDTO(); var maPhieu = gridView.GetRowCellValue(gridView.FocusedRowHandle, "MaPhieuChuyen"); // lấy được mã phiếu if (maPhieu == null) { XtraMessageBox.Show("Mời bạn chọn mã phiếu cần sửa"); } else { // lấy thông tin chuyển kho biết mã: inforSellGui = inforTrans.getDetailTransFromMa(maPhieu.ToString()); List <DetailTransWarehouseDTO> listDetailBuyGui = detailTransBUS.getListDetailTransFromMa(maPhieu.ToString()); if (UpdateChuyenKho != null) { UpdateChuyenKho(inforSellGui, listDetailBuyGui); // chhuyeenr sang bên nhận } } }
private void UpdateChuyenKho(InforTransWarehouseDTO inforTrans, List <DetailTransWarehouseDTO> list) { uc.Dock = DockStyle.Fill; userControl.Controls.Clear(); userControl.Controls.Add(uc); userControl.Dock = DockStyle.Fill; uc.getDuLieu(inforTrans, list); }
private void grvThongTinChuyenKho_MasterRowGetChildList(object sender, DevExpress.XtraGrid.Views.Grid.MasterRowGetChildListEventArgs e) { GridView grv = sender as GridView; InforTransWarehouseDTO infor = grv.GetRow(e.RowHandle) as InforTransWarehouseDTO; e.ChildList = listDetailTransWarehouse.Where(x => x.MaPhieuChuyen == infor.MaPhieuChuyen).ToList(); }
private void grvThongTinChuyenKho_MasterRowEmpty(object sender, DevExpress.XtraGrid.Views.Grid.MasterRowEmptyEventArgs e) { GridView grv = sender as GridView; InforTransWarehouseDTO infor = grv.GetRow(e.RowHandle) as InforTransWarehouseDTO; if (infor != null) { e.IsEmpty = !listDetailTransWarehouse.Any(x => x.MaPhieuChuyen == infor.MaPhieuChuyen); } }
public void getDuLieu(InforTransWarehouseDTO infor, List <DetailTransWarehouseDTO> listDetail) { txtPhieuCK.Text = infor.MaPhieuChuyen; cbKhoXuatHang.EditValue = infor.MaKhoXuat; cbKhoNhanHang.EditValue = infor.MaKhoNhan; cbNguoiChuyen.EditValue = infor.MaNVXuat; cbNguoiNhan.EditValue = infor.MaNVNhan; dtNgayChuyen.Text = infor.NgayLap.ToString(); foreach (DetailTransWarehouseDTO x in listDetail) { detailBuyBus.InsertChiTietHoaDonMuaHang_Ao(x.MaPhieuChuyen, x.MaHang, x.TenHang, x.DonVi, x.SoLuong, x.DonGia, x.ThanhTien); } grcChuyenKho.DataSource = detailBuyBus.getChiTietHoaDonMuaHang(); }
public List <InforTransWarehouseDTO> getListInforTrans(DateTime a, DateTime b, int check) { string sql; if (check == 0) { sql = "SELECT tt.MaPhieuChuyen as [Chứng Từ], tt.NgayLap as [Ngày Lập], kh.TenKho as [Kho Chuyển], " + "kh1.TenKho as [Kho Nhận], nv1.TenNV as [Nhân Viên Chuyển], nv2.TenNV as [Nhân Viên Nhận]" + " ,tt.TongTienChuyen as [Thành Tiền], tt.GhiChu as [Ghi Chú] " + "FROM THONGTIN_CHUYENKHO tt, KHOHANG kh, KHOHANG kh1, _NHANVIEN nv1, _NHANVIEN nv2 " + "where kh.MaKho = tt.MaKhoNhan and kh1.MaKho = tt.MaKhoXuat and tt.MaNVXuat = nv1.MaNV and tt.MaNVNhan = nv2.MaNV"; } else { sql = string.Format("SELECT tt.MaPhieuChuyen as [Chứng Từ], tt.NgayLap as [Ngày Lập], kh.TenKho as [Kho Chuyển], " + "kh1.TenKho as [Kho Nhận], nv1.TenNV as [Nhân Viên Chuyển], nv2.TenNV as [Nhân Viên Nhận]" + " ,tt.TongTienChuyen as [Thành Tiền], tt.GhiChu as [Ghi Chú] " + "FROM THONGTIN_CHUYENKHO tt, KHOHANG kh, KHOHANG kh1, _NHANVIEN nv1, _NHANVIEN nv2 " + "where kh.MaKho = tt.MaKhoNhan and kh1.MaKho = tt.MaKhoXuat and tt.MaNVXuat = nv1.MaNV and tt.MaNVNhan = nv2.MaNV and tt.NgayLap Between '{0}' and '{1}'", a, b); } DataTable data = ConnectionDB.getData(sql); List <InforTransWarehouseDTO> listInforTrans = new List <InforTransWarehouseDTO>(); if (data.Rows.Count > 0) { foreach (DataRow dataRow in data.Rows) { InforTransWarehouseDTO inforTrans = new InforTransWarehouseDTO(); inforTrans.MaPhieuChuyen = dataRow[0].ToString(); inforTrans.NgayLap = DateTime.Parse(dataRow[1].ToString()); inforTrans.MaKhoNhan = dataRow[2].ToString(); inforTrans.MaKhoXuat = dataRow[3].ToString(); inforTrans.MaNVXuat = dataRow[4].ToString(); inforTrans.MaNVNhan = dataRow[5].ToString(); inforTrans.TongTienChuyen = float.Parse(dataRow[6].ToString()); inforTrans.GhiChu = dataRow[7].ToString(); listInforTrans.Add(inforTrans); } } return(listInforTrans); }
public InforTransWarehouseDTO getDetailTransFromMa(string maPhieuChuyen) { string sql = string.Format("SELECT * FROM THONGTIN_CHUYENKHO where maPhieuChuyen = '{0}' ", maPhieuChuyen); DataTable data = ConnectionDB.getData(sql); InforTransWarehouseDTO inforX = new InforTransWarehouseDTO(); if (data.Rows.Count > 0) { inforX.MaPhieuChuyen = data.Rows[0]["MaPhieuChuyen"].ToString(); inforX.MaKhoXuat = data.Rows[0]["MaKhoXuat"].ToString(); inforX.MaKhoNhan = data.Rows[0]["MaKhoNhan"].ToString(); inforX.NgayLap = DateTime.Parse(data.Rows[0]["NgayLap"].ToString()); inforX.GhiChu = data.Rows[0]["GhiChu"].ToString(); inforX.MaNVXuat = data.Rows[0]["MaNVXuat"].ToString(); inforX.MaNVNhan = data.Rows[0]["MaNVNhan"].ToString(); inforX.SoPhieuChuyenTay = data.Rows[0]["SoPhieuChuyenTay"].ToString(); } return(inforX); }
public int UpdateInforTranWarehouse(InforTransWarehouseDTO infor) { return(inforDAO.UpdateInforTranWarehouse(infor)); }
public int InsertInforTranWarehouse(InforTransWarehouseDTO infor) { return(inforDAO.InsertInforTranWarehouse(infor)); }