/// <summary> /// Xóa thông tin chi tiết phiếu chi /// </summary> /// <param name="ChiTietPhieuThu"> /// MaPhieuThu nvarchar(10) /// MaPhieuXuat nvarchar(10) /// </param> public int Xoa(clsChiTietPhieuThuDTO ChiTietPhieuThu) { int i = -1; string sql = "sp_DeleteChiTietPhieuThu"; string[] ParameterColection = new string[2]; Object[] valueofParameter = new Object[2]; ParameterColection[0] = "@MaPhieuThu"; valueofParameter[0] = ChiTietPhieuThu.MaPhieuThu; ParameterColection[1] = "@MaPhieuXuat"; valueofParameter[1] = ChiTietPhieuThu.PhieuXuat; i = sqlServer.writeData(sql, ParameterColection, valueofParameter); return(i); }
/// <summary> /// Thêm thông tin chi tiết phiếu thu /// </summary> /// <param name="ChiTietPhieuThu"> /// MaPhieuThu nvarchar(10) /// MaPhieuXuat nvarchar(10) /// SoTien int /// </param> public int Them(clsChiTietPhieuThuDTO ChiTietPhieuThu) { int i = -1; string sql = "sp_InsertChiTietPhieuThu"; string[] ParameterColection = new string[3]; Object[] valueofParameter = new Object[3]; ParameterColection[0] = "@MaPhieuThu"; valueofParameter[0] = ChiTietPhieuThu.MaPhieuThu; ParameterColection[1] = "@MaPhieuXuat"; valueofParameter[1] = ChiTietPhieuThu.PhieuXuat.MaPhieuXuat; ParameterColection[2] = "@SoTien"; valueofParameter[2] = ChiTietPhieuThu.SoTien; i = sqlServer.writeData(sql, ParameterColection, valueofParameter); return(i); }
/// <summary> /// chuyển từ một dòng sang đối tượng PhieuThuDTO /// </summary> private List <clsChiTietPhieuThuDTO> ChuyenDoi(DataTable table, string MaPhieuThu) { List <clsChiTietPhieuThuDTO> DanhSach = new List <clsChiTietPhieuThuDTO>(); for (int i = 0; i < table.Rows.Count; i++) { clsChiTietPhieuThuDTO CT_PhieuThu = new clsChiTietPhieuThuDTO(); CT_PhieuThu.MaPhieuThu = MaPhieuThu; CT_PhieuThu.SoTien = Double.Parse(table.Rows[i]["SoTien"].ToString()); CT_PhieuThu.PhieuXuat.MaPhieuXuat = table.Rows[i]["MaPhieuXuat"].ToString(); CT_PhieuThu.PhieuXuat.NgayXuat = DateTime.Parse(table.Rows[i]["NgayXuat"].ToString()); CT_PhieuThu.PhieuXuat.KhachHang.MaKhachHang = table.Rows[i]["MaKhachHang"].ToString(); CT_PhieuThu.PhieuXuat.TongTien = Double.Parse(table.Rows[i]["TongTien"].ToString()); CT_PhieuThu.PhieuXuat.DaTra = Double.Parse(table.Rows[i]["DaTra"].ToString()); CT_PhieuThu.PhieuXuat.TrangThai = int.Parse(table.Rows[i]["TrangThai"].ToString()); DanhSach.Add(CT_PhieuThu); } return(DanhSach); }
//Khởi tạo chi tiết phiếu thu tiền hàng đã bán private List <clsChiTietPhieuThuDTO> KhoiTaoChiTietPhieuThu(string MaPhieuThu) { List <clsChiTietPhieuThuDTO> DS_CTPT = new List <clsChiTietPhieuThuDTO>(); for (int i = 0; i < grdvDSDonHangDaBan.Rows.Count; i++) { Double TienThuKyNay = double.Parse(grdvDSDonHangDaBan.Rows[i].Cells["ThuKyNay"].Value.ToString()); Double TienConThu = double.Parse(grdvDSDonHangDaBan.Rows[i].Cells["ConThu"].Value.ToString()); if (TienThuKyNay > 0) { clsChiTietPhieuThuDTO CTPT = new clsChiTietPhieuThuDTO(); CTPT.MaPhieuThu = MaPhieuThu; CTPT.PhieuXuat.MaPhieuXuat = grdvDSDonHangDaBan.Rows[i].Cells["MaPhieuXuat"].Value.ToString().Trim(); //Cap nhat lai so tien da tra CTPT.PhieuXuat.DaTra += TienThuKyNay; CTPT.SoTien = TienThuKyNay; DS_CTPT.Add(CTPT); } } return(DS_CTPT); }
/// <summary> /// Xóa thông tin chi tiết phiếu chi /// </summary> /// <param name="ChiTietPhieuThu"> /// MaPhieuThu nvarchar(10) /// MaPhieuXuat nvarchar(10) /// </param> public int Xoa(clsChiTietPhieuThuDTO ChiTietPhieuThu) { return(ChiTietPhieuThuDAO.Xoa(ChiTietPhieuThu)); }
/// <summary> /// Thêm thông tin chi tiết phiếu thu /// </summary> /// <param name="ChiTietPhieuThu"> /// MaPhieuThu nvarchar(10) /// MaPhieuXuat nvarchar(10) /// SoTien int /// </param> public int Them(clsChiTietPhieuThuDTO ChiTietPhieuThu) { return(ChiTietPhieuThuDAO.Them(ChiTietPhieuThu)); }