/// <summary>
 /// khoi tao gia tri
 /// </summary>
 public HienThi_ChiTiet_DonDatHang()
 {
     dh      = null;
     Sql     = null;
     conn    = null;
     cmd     = null;
     arr     = null;
     dr      = null;
     hienthi = null;
     cn      = null;
     ar      = new ArrayList();
 }
 /// <summary>
 /// thong tin hoa don nhap
 /// </summary>
 /// <param name="giatri"></param>
 /// <returns></returns>
 public Entities.HienThi_ChiTiet_DonDatHang[] sp_LayBang_ThongTinHoaDonNhap(Entities.HienThi_ChiTiet_DonDatHang giatri)
 {
     Entities.HienThi_ChiTiet_DonDatHang[] arrC = null;
     try
     {
         Constants.HienThi_ChiTiet_DonDatHang dh = new Constants.HienThi_ChiTiet_DonDatHang();
         Sql = new Constants.Sql();
         string sql = "exec sp_ThongTinHienThiHoaDonNhap @MaHoaDonNhap,@MaKho";
         conn = new Connection();
         cn   = conn.openConnection();
         cmd  = new SqlCommand(sql, cn);
         cmd.Parameters.Add("MaHoaDonNhap", SqlDbType.VarChar, 20).Value = giatri.MaHangHoa;
         cmd.Parameters.Add("MaKho", SqlDbType.VarChar, 20).Value        = giatri.TenHangHoa;
         dr  = cmd.ExecuteReader(CommandBehavior.CloseConnection);
         arr = new ArrayList();
         Entities.HienThi_ChiTiet_DonDatHang hienthi = null;
         while (dr.Read())
         {
             hienthi                   = new Entities.HienThi_ChiTiet_DonDatHang();
             hienthi.MaHangHoa         = dr[0].ToString().ToUpper();
             hienthi.TenHangHoa        = "" + dr[1].ToString();
             hienthi.SoLuongDat        = int.Parse(0 + dr[2].ToString());
             hienthi.GiaGoc            = Double.Parse(0 + dr[3].ToString()).ToString();
             hienthi.Giabanbuon        = Double.Parse(0 + dr[4].ToString()).ToString();
             hienthi.Giabanle          = Double.Parse(0 + dr[5].ToString()).ToString();
             hienthi.PhanTramChietKhau = Double.Parse(0 + dr[6].ToString()).ToString();
             hienthi.Thuegiatrigiatang = Double.Parse(0 + dr[7].ToString()).ToString();
             hienthi.Ngayhethan        = new Common.Utilities().XuLy(2, dr[8].ToString());
             arr.Add(hienthi);
         }
         int n = arr.Count;
         if (n == 0)
         {
             return(null);
         }
         arrC = new Entities.HienThi_ChiTiet_DonDatHang[n];
         for (int i = 0; i < n; i++)
         {
             arrC[i] = (Entities.HienThi_ChiTiet_DonDatHang)arr[i];
         }
     }
     catch (Exception ex)
     { string s = ex.Message.ToString(); }
     finally
     {
         cmd.Connection.Dispose();
         cn.Close();
         conn.closeConnection();
     }
     return(arrC);
 }