public List <Model.BOMCustomsDeclar> GetBOMCustomsDeclars(Model.SummaryDelivery summaryDelivery)
        {
            List <Model.BOMCustomsDeclar> bOMCustomsDeclars = new List <Model.BOMCustomsDeclar>();


            StringBuilder stringBuilder = new StringBuilder();

            stringBuilder.Append(@" select a.MA_SP,a.MA_NPL, a.Ten_NPL, b.MA_HS, a.MA_DVT, a.DM_SD from CX_DDINHMUC a
 left join CX_SNPL b on a.MA_NPL = b.MA_NPL
 where 1 = 1");
            stringBuilder.Append("  and MA_SP LIKE '%" + summaryDelivery.Product.Substring(0, summaryDelivery.Product.Length - 3) + "%' ");
            SQLCustoms sQLCustoms = new SQLCustoms();
            DataTable  dt         = new DataTable();

            sQLCustoms.sqlDataAdapterFillDatatable(stringBuilder.ToString(), ref dt);
            for (int i = 0; i < dt.Rows.Count; i++)
            {
                Model.BOMCustomsDeclar bOM = new Model.BOMCustomsDeclar();
                bOM.Product  = summaryDelivery.Product;
                bOM.GiaTriSp = summaryDelivery.price;
                //  bOM.DonviSp =
                bOM.SLSanpham = summaryDelivery.TotalQuantity;

                bOM.MaNVL   = dt.Rows[i]["MA_NPL"].ToString().Trim();
                bOM.NVL     = dt.Rows[i]["Ten_NPL"].ToString().Trim();
                bOM.MaHS    = dt.Rows[i]["MA_HS"].ToString().Trim();
                bOM.DVTinh  = dt.Rows[i]["MA_DVT"].ToString().Trim();
                bOM.DinhMuc = double.Parse(dt.Rows[i]["DM_SD"].ToString().Trim());
                //   bOM.DonGia =double.Parse( summaryDelivery.UnitPrice.ToString());
                bOMCustomsDeclars.Add(bOM);
            }

            return(bOMCustomsDeclars);
        }
        public DataTable LayMaSpHQNam20()
        {
            DataTable     dt            = new DataTable();
            StringBuilder stringBuilder = new StringBuilder();

            stringBuilder.Append(" select * from dbo.CX_SSP where MA_SP like '20-%' ");
            SQLCustoms sQLCustoms = new SQLCustoms();

            sQLCustoms.sqlDataAdapterFillDatatable(stringBuilder.ToString(), ref dt);
            return(dt);
        }
        public DataTable BOMHAIQUANTheoMaSp(string MA_SP_HQ)
        {
            DataTable     dt            = new DataTable();
            StringBuilder stringBuilder = new StringBuilder();

            stringBuilder.Append(@"  select distinct a.MA_NPL,  b.MA_HS, cast( a.DM_SD as decimal(10,3)) as DM_SD  , a.MA_DVT from CX_DDINHMUC a
 left join CX_SNPL b on a.MA_NPL = b.MA_NPL
 where 1 = 1 ");
            stringBuilder.Append("and MA_SP = '" + MA_SP_HQ + "' ");
            SQLCustoms sQLCustoms = new SQLCustoms();

            sQLCustoms.sqlDataAdapterFillDatatable(stringBuilder.ToString(), ref dt);
            return(dt);
        }
        public DataTable GetTableToKHaiNhap(string Ma_NPL, string HsCode)
        {
            DataTable     dt            = new DataTable();
            StringBuilder stringBuilder = new StringBuilder();

            stringBuilder.Append(@"   select distinct b.NGAY_DK, a.SOTK, a.MA_LH, a.MA_HQ, NUOC_XX, TEN_NUOC_XX, MA_DVT, a.LUONG, a.DGIA_KB from [dbo].[DHANGMDDK] a
   inner join dbo.CX_ECX_NPLNHAP_TL b on a.SOTK = b.SOTK
  where CAST(b.NGAY_DK as date) >= '2019-06-01' ");
            stringBuilder.Append(" and MA_NPL_SP = '" + Ma_NPL + "' ");
            stringBuilder.Append(" and  MA_HANGKB = '" + HsCode + "' ");
            SQLCustoms sQLCustoms = new SQLCustoms();

            sQLCustoms.sqlDataAdapterFillDatatable(stringBuilder.ToString(), ref dt);


            return(dt);
        }