private void load_data_to_lst_pl01(BKI_QLDTEntities ip_db
     , decimal ip_dc_id_don_vi
     , int ip_dc_nam)
 {
     lst_pl01 = ip_db.GD_PL01_TONG_HOP_TINH_HINH_KINH_PHI_VA_QUYET_TOAN_CHI
             .Where(x => x.NAM == ip_dc_nam && x.ID_DON_VI == ip_dc_id_don_vi).ToList();
 }
 public void UpdateGiaoDich(
     decimal ip_dc_id_giao_dich
     , string ip_str_SKNKTNN
     , string ip_str_SKNCQTC
     , string ip_str_SDNKTNN
     , string ip_str_SDNCQTC
     )
 {
     try
     {
         using (BKI_QLDTEntities db = new BKI_QLDTEntities())
         {
             GD_PL03_THUC_HIEN_XU_LY_KIEN_NGHI_CUA_KIEM_TOAN_THANH_TRA_TAI_CHINH gd
                 = db.GD_PL03_THUC_HIEN_XU_LY_KIEN_NGHI_CUA_KIEM_TOAN_THANH_TRA_TAI_CHINH.FirstOrDefault(x => x.ID == ip_dc_id_giao_dich);
             gd.SO_KIEN_NGHI_KIEM_TOAN_NHA_NUOC = CIPConvert.ToDecimal(ip_str_SKNKTNN.Replace(",", "").Replace(".", "").Trim());
             gd.SO_KIEN_NGHI_CO_QUAN_TAI_CHINH = CIPConvert.ToDecimal(ip_str_SKNCQTC.Replace(",", "").Replace(".", "").Trim());
             gd.SO_DA_NOP_TRA_KIEM_TOAN_NHA_NUOC = CIPConvert.ToDecimal(ip_str_SDNKTNN.Replace(",", "").Replace(".", "").Trim());
             gd.SO_DA_NOP_TRA_CO_QUAN_TAI_CHINH = CIPConvert.ToDecimal(ip_str_SDNCQTC.Replace(",", "").Replace(".", "").Trim());
             db.SaveChanges();
         }
     }
     catch (Exception v_e)
     {
         Context.Response.Output.Write("Loi: "+v_e.Message);
     }
 }
 private void load_data_to_lst_loai(BKI_QLDTEntities ip_db)
 {
     lst_loai = ip_db.DM_CHUONG_LOAI_KHOAN_MUC
             .Where(x => x.ID_LOAI == ID_CHUONG_LOAI_KHOAN_MUC.LOAI)
             .Select(x => new ItemCLKM { MaSo = x.MA_SO, Ten = x.TEN })
             .ToList();
 }
 public void genGrid(
     string ip_str_nguon_ns
     , decimal ip_dc_id_don_vi
     , int ip_dc_thang
     , int ip_dc_ky_bao_cao
     , int ip_dc_nam)
 {
     BKI_QLDTEntities db = new BKI_QLDTEntities();
     //2 kỳ báo cáo: kỳ 1 <=> ngày 1, kỳ 2 <=> ngày 15
     int v_i_ngay_bao_cao = 1;
     if (ip_dc_ky_bao_cao == 2)
     {
         v_i_ngay_bao_cao = 15;
     }
     DateTime v_dat_ngay_nhap = new DateTime(ip_dc_nam, ip_dc_thang, v_i_ngay_bao_cao);
     List<GD_KHOI_LUONG> v_lst_khoi_luong = new List<GD_KHOI_LUONG>();
     List<GD_KHOI_LUONG> v_lst_khoi_luong_luy_ke = new List<GD_KHOI_LUONG>();
     v_lst_khoi_luong = load_data_to_grid_by_nguon(
                         ip_str_nguon_ns
                         , ip_dc_id_don_vi, v_dat_ngay_nhap, db);
     v_lst_khoi_luong_luy_ke = load_data_to_grid_luy_ke_by_nguon(
                         ip_str_nguon_ns
                         , ip_dc_id_don_vi
                         , v_dat_ngay_nhap, db);
     string result = "";
     if (v_lst_khoi_luong != null)
     {
         result = F404Grid.RenderToString(v_lst_khoi_luong, v_lst_khoi_luong_luy_ke);
     }
     Context.Response.Write(result);
 }
 private void set_initial_form_load()
 {
     decimal v_dc_id_don_vi = m_dc_id_don_vi;
     decimal v_dc_nam = 2015;
     BKI_QLDTEntities db = new BKI_QLDTEntities();
     load_data_to_lst_du_toan_thu_chi_phi_pha(db, v_dc_id_don_vi, v_dc_nam);
     load_data_to_lst_quyet_dinh(db, v_dc_id_don_vi, (int)v_dc_nam);
 }
 protected void Page_Load(object sender, EventArgs e)
 {
     m_dc_id_don_vi = Person.get_id_don_vi();
     load_data_to_lst_noi_dung_chi();
     BKI_QLDTEntities db = new BKI_QLDTEntities();
     load_data_to_lst_don_vi(db, Person.get_id_don_vi());
     load_data_to_lst_clkm(db);
 }
 public void deleteItem(decimal ip_dc_id_giao_dich)
 {
     BKI_QLDTEntities db = new BKI_QLDTEntities();
     var gd = db.GD_DU_TOAN_THU_CHI_PHI_PHA.First(x => x.ID == ip_dc_id_giao_dich);
     if (gd == null) return;
     db.GD_DU_TOAN_THU_CHI_PHI_PHA.Remove(gd);
     db.SaveChanges();
 }
 private void load_data_to_lst_don_vi(BKI_QLDTEntities ip_db, decimal ip_dc_id_don_vi)
 {
     DS_DM_DON_VI v_ds = new DS_DM_DON_VI();
     US_DM_DON_VI v_us = new US_DM_DON_VI();
     v_us.load_danh_sach_don_vi_X_duoc_xem_du_lieu(ip_dc_id_don_vi, v_ds);
     m_lst_don_vi = v_ds.Tables[0].ToList<DBClassModel.DM_DON_VI>()
         .ToList();
 }
 public void DeleteGiaoDich(decimal ip_dc_id_giao_dich)
 {
     using (BKI_QLDTEntities db = new BKI_QLDTEntities())
     {
         //GD_PL05_DANH_MUC_CONG_TRINH_HOAN_THANH_GIAM_TRU_THANH_TOAN gd = new GD_PL05_DANH_MUC_CONG_TRINH_HOAN_THANH_GIAM_TRU_THANH_TOAN();
         //db.GD_PL05_DANH_MUC_CONG_TRINH_HOAN_THANH_GIAM_TRU_THANH_TOAN.Remove(gd);
         //db.SaveChanges();
     }
 }
 public void genGrid(decimal ip_dc_id_don_vi, int ip_i_nam)
 {
     BKI_QLDTEntities db = new BKI_QLDTEntities();
     InsertFromTemplate(ip_dc_id_don_vi, ip_i_nam);
     var lst_pl03 = db.GD_PL03_THUC_HIEN_XU_LY_KIEN_NGHI_CUA_KIEM_TOAN_THANH_TRA_TAI_CHINH
         .Where(x => x.ID_DON_VI == ip_dc_id_don_vi && x.NAM == ip_i_nam)
         .ToList();
     string v_str_grid = UserControls.QT_QBT_GRID_PL03.RenderToString(lst_pl03);
     Context.Response.Write(v_str_grid);
 }
 protected void Page_Load(object sender, EventArgs e)
 {
     BKI_QLDTEntities db = new BKI_QLDTEntities();
         DateTime v_dat = CCommonFunction.getDate_dau_nam_from_date(DateTime.Now.AddYears(-1));
         lst_history = db.HT_LICH_SU_QLDT
                         .Where(x => x.THOI_GIAN >= v_dat)
                         .OrderByDescending(x => x.THOI_GIAN)
                         .ToList();
         lst_nguoi_su_dung=db.HT_NGUOI_SU_DUNG
                         .ToList();
 }
 private void load_data_to_lst_du_toan_thu_chi_phi_pha(
     BKI_QLDTEntities ip_db
     , decimal ip_dc_id_don_vi
     , decimal ip_dc_nam
     )
 {
     m_lst_du_toan_thu_chi_phi_pha = ip_db.GD_DU_TOAN_THU_CHI_PHI_PHA
                                     .Where(x => x.ID_DON_VI == ip_dc_id_don_vi && x.NAM == ip_dc_nam)
                                     .OrderBy(x => x.MA_SO)
                                     .ThenBy(x => x.TT)
                                     .ToList();
 }
 private void load_data()
 {
     decimal v_dc_nam = CIPConvert.ToDecimal(m_ddl_chon_nam.SelectedValue);
     //decimal v_dc_id_don_vi = 241;
     m_dc_id_don_vi = CIPConvert.ToDecimal(m_ddl_don_vi.SelectedValue);
     using (BKI_QLDTEntities db = new BKI_QLDTEntities())
     {
         lst_PL04 = db.GD_PL04_DANH_MUC_CONG_TRINH_QUYET_TOAN
                                 .Where(x => x.NAM == v_dc_nam && x.ID_DON_VI == m_dc_id_don_vi)
                                 .ToList();
     }
 }
 private void load_data_to_lst_quyet_dinh(
     BKI_QLDTEntities ip_db
     , decimal ip_dc_id_don_vi
     , int ip_dc_nam
     )
 {
     DateTime v_dat_dau_nam = new DateTime(ip_dc_nam, 1, 1);
     DateTime v_dat_cuoi_nam = CCommonFunction.getDate_cuoi_nam_form_date(v_dat_dau_nam);
     m_lst_quyet_dinh = ip_db.DM_QUYET_DINH
                             .Where(x => x.NGAY_THANG>=v_dat_dau_nam&&x.NGAY_THANG<=v_dat_cuoi_nam)
                             .OrderBy(x => x.NGAY_THANG)
                             .ToList();
 }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                BKI_QLDTEntities db = new BKI_QLDTEntities();
                m_dc_id_don_vi = Person.get_id_don_vi();
                load_data_to_lst_don_vi(db,245);
                load_data_to_lst_loai(db);
                load_data_to_lst_pl01(db, 245, 2014);
                load_data_to_lst_don_vi(db, Person.get_id_don_vi());

            }
        }
 public void genGrid(decimal ip_dc_id_quyet_dinh, decimal ip_dc_id_don_vi)
 {
     BKI_QLDTEntities db = new BKI_QLDTEntities();
     var v_lst_du_toan_thu_chi_phi_pha = db.GD_DU_TOAN_THU_CHI_PHI_PHA
                                     .Where(x => x.ID_DON_VI == ip_dc_id_don_vi && x.ID_QUYET_DINH == ip_dc_id_quyet_dinh)
                                     .OrderBy(x => x.MA_SO.Substring(0, 4))
                                     .ThenBy(x => x.MA_SO_PARENT)
                                     .ThenBy(x => x.TT)
                                     .ToList();
     var result = "";
     result = UserControls.F505Grid.RenderToString(v_lst_du_toan_thu_chi_phi_pha);
     Context.Response.Output.Write(result);
 }
        private void InsertFromTemplate(decimal ip_dc_id_don_vi, decimal ip_dc_nam)
        {
            using (BKI_QLDTEntities db = new BKI_QLDTEntities())
            {
                var lst_Pl03_template = db.TP_PL03.ToList();
                var lst_gdPL03 = db.GD_PL03_THUC_HIEN_XU_LY_KIEN_NGHI_CUA_KIEM_TOAN_THANH_TRA_TAI_CHINH
                    .Where(x => x.ID_DON_VI == ip_dc_id_don_vi
                                && x.NAM == ip_dc_nam)
                    .ToList();
                //Insert to GD_PL03 from Templete PL03 if do not have
                foreach (var temp in lst_Pl03_template)
                {
                    if (lst_gdPL03
                        .Where(x => x.MA_SO.Trim() == temp.MA_SO.Trim()
                                    && x.NOI_DUNG.Trim() == temp.NOI_DUNG.Trim()
                                    && x.MA_SO_PARENT == temp.MA_SO_PARENT)
                        .ToList().Count < 1)
                    {
                        GD_PL03_THUC_HIEN_XU_LY_KIEN_NGHI_CUA_KIEM_TOAN_THANH_TRA_TAI_CHINH gd = new GD_PL03_THUC_HIEN_XU_LY_KIEN_NGHI_CUA_KIEM_TOAN_THANH_TRA_TAI_CHINH();
                        gd.MA_SO = temp.MA_SO;
                        gd.ID_DON_VI = ip_dc_id_don_vi;
                        gd.MA_SO_PARENT = temp.MA_SO_PARENT;
                        gd.NAM = ip_dc_nam;
                        gd.NOI_DUNG = temp.NOI_DUNG;
                        gd.SO_DA_NOP_TRA_CO_QUAN_TAI_CHINH = temp.SO_DA_NOP_TRA_CO_QUAN_TAI_CHINH;
                        gd.SO_DA_NOP_TRA_KIEM_TOAN_NHA_NUOC = temp.SO_DA_NOP_TRA_KIEM_TOAN_NHA_NUOC;
                        gd.SO_KIEN_NGHI_CO_QUAN_TAI_CHINH = temp.SO_KIEN_NGHI_CO_QUAN_TAI_CHINH;
                        gd.SO_KIEN_NGHI_KIEM_TOAN_NHA_NUOC = temp.SO_KIEN_NGHI_KIEM_TOAN_NHA_NUOC;
                        gd.TT = temp.TT;
                        db.GD_PL03_THUC_HIEN_XU_LY_KIEN_NGHI_CUA_KIEM_TOAN_THANH_TRA_TAI_CHINH.Add(gd);
                        db.SaveChanges();
                    }

                    //Delete from GD_PL03 if not exist in Templete PL03
                    foreach (var gd in lst_gdPL03)
                    {
                        if (lst_Pl03_template
                            .Where(x => x.MA_SO.Trim() == gd.MA_SO.Trim()
                                    && x.NOI_DUNG.Trim() == gd.NOI_DUNG.Trim()
                                    && x.MA_SO_PARENT == gd.MA_SO_PARENT)
                        .ToList().Count < 1)
                        {
                            lst_gdPL03.Remove(gd);
                            db.SaveChanges();
                        }
                    }
                }

            }
        }
 private void load_data()
 {
     load_ddl_chon_nam();
     m_nam = CIPConvert.ToDecimal(m_ddl_chon_nam.SelectedValue);
     BKI_QLDTEntities db = new BKI_QLDTEntities();
     lst_PL04 = db.GD_PL04_DANH_MUC_CONG_TRINH_QUYET_TOAN
                    .Where(x=>x.NAM == m_nam)
                    .ToList();
     lst_don_vi = db.GD_PL04_DANH_MUC_CONG_TRINH_QUYET_TOAN
                               .Select(x => new ItemBaoCaoDonVi { ID_DON_VI = x.DM_DON_VI.ID  , TEN_DON_VI = x.DM_DON_VI.TEN_DON_VI })
                               .Distinct()
                               .ToList();
     lst_giao_kh = db.GD_CHI_TIET_GIAO_KH.Where(x =>x.DM_QUYET_DINH.NGAY_THANG.Year == m_nam).ToList();
 }
        private void load_data()
        {
            decimal v_dc_nam = CIPConvert.ToDecimal(m_ddl_chon_nam.SelectedValue);
            using (BKI_QLDTEntities db = new BKI_QLDTEntities())
            {
                lst_PL04 = db.GD_PL04_DANH_MUC_CONG_TRINH_QUYET_TOAN
                                        .Where(x => x.NAM == v_dc_nam)
                                        .ToList();

                lst_don_vi = db.GD_PL04_DANH_MUC_CONG_TRINH_QUYET_TOAN
                                        .Select(x => new ItemBaoCaoDonVi { ID_DON_VI = x.DM_DON_VI.ID, TEN_DON_VI = x.DM_DON_VI.TEN_DON_VI })
                                        .Distinct()
                                        .ToList();
            }
        }
 protected void Page_Load(object sender, EventArgs e)
 {
     BKI_QLDTEntities db = new BKI_QLDTEntities();
     DateTime v_dat_ngay_nhap = new DateTime(2015, 04, 18);
     //m_lst_gd = db.GD_KHOI_LUONG.Where(x => x.ID_DON_VI == 263
     //	&& x.NGAY_THANG == v_dat_ngay_nhap).ToList();
     load_data_to_lst_don_vi(db);
     m_str_nguon = WebformFunctions.getValue_from_query_string<string>(
                         this
                         , FormInfo.QueryString.NGUON_NGAN_SACH
                         , STR_NGUON.QUY_BAO_TRI
                         );
     m_dc_id_don_vi = Person.get_id_don_vi();
     //load_data_to_grid_by_nguon(m_str_nguon, 263, v_dat_ngay_nhap, db);
 }
 private void load_danh_sach_cong_trinh(
     BKI_QLDTEntities ip_db
     , decimal ip_dc_id_don_vi
     , decimal ip_dc_nam
     )
 {
     lst_pl04 = ip_db.GD_PL04_DANH_MUC_CONG_TRINH_QUYET_TOAN
             .Where(x => x.ID_DON_VI == ip_dc_id_don_vi
                     && x.NAM == ip_dc_nam)
             .ToList();
     //lst_pl05=ip_db.GD_PL05_DANH_MUC_CONG_TRINH_HOAN_THANH_GIAM_TRU_THANH_TOAN
     //		.Where(x => x.ID_DON_VI == ip_dc_id_don_vi
     //				&& x.NAM == ip_dc_nam)
     //		.ToList();
 }
 public void UpdateAll(string ip_str_arr)
 {
     JavaScriptSerializer js = new JavaScriptSerializer();
     KhoiLuongItem[] ip_arr = js.Deserialize<KhoiLuongItem[]>(ip_str_arr);
     BKI_QLDTEntities db = new BKI_QLDTEntities();
     for (int i = 0; i < ip_arr.Length; i++)
     {
         decimal v_dc_id = ip_arr[i].ID;
         var gd = db.GD_KHOI_LUONG.FirstOrDefault(x => x.ID == v_dc_id);
         if (gd == null) continue;
         gd.SO_TIEN_DA_NGHIEM_THU = Convert.ToDecimal(ip_arr[i].GIA_TRI_THUC_HIEN_QBT.Replace(",", "").Replace(".", ""));
         gd.SO_TIEN_DA_NGHIEM_THU_NS = Convert.ToDecimal(ip_arr[i].GIA_TRI_THUC_HIEN_NS.Replace(",", "").Replace(".", ""));
         gd.NHU_CAU_VON_KY_TIEP_THEO =Convert.ToDecimal(ip_arr[i].NHU_CAU_VON_KY_TIEP_THEO.Replace(",", "").Replace(".", ""));
         db.SaveChanges();
     }
 }
 private void load_data_to_lst_clkm(BKI_QLDTEntities ip)
 {
     lst_clkm = ip
                .DM_CHUONG_LOAI_KHOAN_MUC
                .Select(x => new
                ItemCLKM
                {
                    MaSo = x.MA_SO
                    ,
                    Ten = x.TEN
                    ,
                    IdLoai = x.ID_LOAI
                    ,
                    MaSoParent = x.DM_CHUONG_LOAI_KHOAN_MUC_PARENT.MA_SO
                })
                .ToList();
 }
 public void genGrid(decimal ip_dc_id_don_vi, int ip_i_nam)
 {
     BKI_QLDTEntities db = new BKI_QLDTEntities();
     var lst_pl01 = db.GD_PL01_TONG_HOP_TINH_HINH_KINH_PHI_VA_QUYET_TOAN_CHI
                     .Where(x => x.NAM == ip_i_nam && x.ID_DON_VI == ip_dc_id_don_vi)
                     .ToList();
     if (lst_pl01.Count==0)
     {
         insertFormTemplateToGdPL01(db, ip_dc_id_don_vi, ip_i_nam);
         //reload list
         lst_pl01 = db.GD_PL01_TONG_HOP_TINH_HINH_KINH_PHI_VA_QUYET_TOAN_CHI
                     .Where(x => x.NAM == ip_i_nam && x.ID_DON_VI == ip_dc_id_don_vi)
                     .ToList();
     }
     string op_str_grid = "";
     op_str_grid = QT_QBT_GRID_PL01.RenderToString(lst_pl01);
     Context.Response.Write(op_str_grid);
 }
 protected void Page_Load(object sender, EventArgs e)
 {
     m_str_form_mode = WebformFunctions.getValue_from_query_string<string>(this, "form_mode", "don_vi");
     m_dc_id_don_vi = Person.get_id_don_vi();
     using (BKI_QLDTEntities db = new BKI_QLDTEntities())
     {
         InsertDataDuToanToQuyetToan(241, 2014);
         lst_pl04 = db.GD_PL04_DANH_MUC_CONG_TRINH_QUYET_TOAN
                    .Where(x => x.ID_DON_VI == 241 && x.NAM == 2014)
                    .ToList();
         lst_loai_nhiem_vu = db.CM_DM_TU_DIEN
                     .Where(x => x.ID_LOAI_TU_DIEN == ID_LOAI_TU_DIEN.LOAI_NHIEM_VU)
                     .OrderBy(x => x.GHI_CHU)
                     .Select(x => new ItemLNV { Ten = x.GHI_CHU + " - " + x.TEN, Value = x.TEN })
                     .ToList();
         load_data_to_lst_don_vi(db, Person.get_id_don_vi());
     }
 }
 private void load_ddl_chon_nam()
 {
     using (BKI_QLDTEntities db = new BKI_QLDTEntities())
     {
         lst_nam = db.GD_DU_TOAN_THU_CHI_PHI_PHA
                                     .Where(x=>x.NAM != null)
                                     .Select(x => x.NAM )
                                     .Distinct()
                                     .OrderByDescending(x => x)
                                     .ToList();
     }
     //kiểm tra có dữ liệu trong database không
     if (lst_nam.Count < 1)
     {
         lst_nam.Add(CIPConvert.ToDecimal(DateTime.Now.Year));
     }
     m_ddl_chon_nam.DataSource = lst_nam;
     m_ddl_chon_nam.DataBind();
 }
 private void load_ddl_chon_nam()
 {
     using (BKI_QLDTEntities db = new BKI_QLDTEntities())
     {
         lst_nam = db.GD_PL04_DANH_MUC_CONG_TRINH_QUYET_TOAN
                                     .Where(x=>x.ID_DON_VI== m_dc_id_don_vi)
                                     .Select(x => x.NAM)
                                     .Distinct()
                                     .OrderByDescending(x => x)
                                     .ToList();
     }
     //kiểm tra có dữ liệu trong database không
     if (lst_nam.Count < 1)
     {
         lst_nam.Add(CIPConvert.ToDecimal(DateTime.Now.Year));
     }
     m_ddl_chon_nam.DataSource = lst_nam;
     m_ddl_chon_nam.DataBind();
 }
        private void load_data()
        {
            decimal v_dc_nam = CIPConvert.ToDecimal(m_ddl_chon_nam.SelectedValue);
            using (BKI_QLDTEntities db = new BKI_QLDTEntities())
            {
                lst_gd_phi_pha = db.GD_DU_TOAN_THU_CHI_PHI_PHA
                                        .Where(x => x.NAM == v_dc_nam)
                                        .ToList();

                lst_don_vi = db.GD_DU_TOAN_THU_CHI_PHI_PHA
                                        .Select(x => new ItemBaoCaoDonVi { ID_DON_VI = x.DM_DON_VI.ID, TEN_DON_VI = x.DM_DON_VI.TEN_DON_VI })
                                        .Distinct()
                                        .ToList();
                lst_pha = db.GD_DU_TOAN_THU_CHI_PHI_PHA
                                        .Select(x => new Pha { ID_PHA = x.ID_PHA, TEN_PHA = x.DM_PHA.PHA })
                                        .Distinct()
                                        .ToList();
            }
        }
 public void insertFormTemplateToGdPL01(BKI_QLDTEntities ip_db, decimal ip_dc_id_don_vi, int ip_i_nam)
 {
     var lst_temp_pl01 = ip_db.TP_PL01.OrderBy(x=>x.ID).ToList();
     foreach (var tp in lst_temp_pl01)
     {
         GD_PL01_TONG_HOP_TINH_HINH_KINH_PHI_VA_QUYET_TOAN_CHI gd = new GD_PL01_TONG_HOP_TINH_HINH_KINH_PHI_VA_QUYET_TOAN_CHI();
         gd.CAP = tp.CAP;
         gd.CHI_TIEU = tp.CHI_TIEU;
         gd.CONG_THUC = tp.CONG_THUC;
         gd.ID_DON_VI =ip_dc_id_don_vi;
         gd.MA_SO = tp.MA_SO;
         gd.MA_SO_PARENT = tp.MA_SO_PARENT;
         gd.NAM = ip_i_nam;
         gd.SO_BAO_CAO = 0;
         gd.SO_XET_DUYET = 0;
         ip_db.GD_PL01_TONG_HOP_TINH_HINH_KINH_PHI_VA_QUYET_TOAN_CHI.Add(gd);
         ip_db.SaveChanges();
     }
 }
        private void load_data_to_grid()
        {
            //m_dat_tu_ngay = CIPConvert.ToDatetime(m_txt_tu_ngay.Text, "dd/MM/yyyy");
            //m_dat_den_ngay = CIPConvert.ToDatetime(m_txt_den_ngay.Text, "dd/MM/yyyy");
            m_dat_dau_nam = WebUS.CCommonFunction.getDate_dau_nam_from_date(m_dat_tu_ngay);

            BKI_QLDTEntities db = new BKI_QLDTEntities();
            m_lst_don_vi = db.DM_DON_VI
                            .ToList()
                            .OrderBy(x => x.TEN_DON_VI)
                            .ToList();

            m_lst_group_by = new List<QuanLyDuToan.BaoCao.F530_Bao_cao_tong_hop_hinh_hinh_giai_ngan.GroupDonVi>{
                            new QuanLyDuToan.BaoCao.F530_Bao_cao_tong_hop_hinh_hinh_giai_ngan.GroupDonVi("cục quản lý đường bộ I.","Cục QLĐB I")
                            ,new QuanLyDuToan.BaoCao.F530_Bao_cao_tong_hop_hinh_hinh_giai_ngan.GroupDonVi("cục quản lý đường bộ II.","Cục QLĐB II")
                            ,new QuanLyDuToan.BaoCao.F530_Bao_cao_tong_hop_hinh_hinh_giai_ngan.GroupDonVi("cục quản lý đường bộ III.","Cục QLĐB III")
                            ,new QuanLyDuToan.BaoCao.F530_Bao_cao_tong_hop_hinh_hinh_giai_ngan.GroupDonVi("cục quản lý đường bộ IV.","Cục QLĐB IV")
            };

            m_lst_don_vi_group_by = new List<SQLDataAccess.DM_DON_VI>();

            m_lst_giao_kh = db.GD_CHI_TIET_GIAO_KH
                                .Where(x => x.DM_QUYET_DINH.NGAY_THANG >= m_dat_dau_nam
                                            && x.DM_QUYET_DINH.NGAY_THANG <= m_dat_den_ngay)
                                .ToList();
            m_lst_giao_von = db.GD_CHI_TIET_GIAO_VON
                                .Where(x => x.DM_QUYET_DINH.NGAY_THANG >= m_dat_dau_nam
                                            && x.DM_QUYET_DINH.NGAY_THANG <= m_dat_den_ngay)
                                .ToList();
            m_lst_giai_ngan = db.GD_CHI_TIET_GIAI_NGAN
                                .Where(x => x.DM_GIAI_NGAN.NGAY_THANG >= m_dat_dau_nam
                                            && x.DM_GIAI_NGAN.NGAY_THANG <= m_dat_den_ngay)
                                .ToList();
            m_lst_khoi_luong = db.GD_KHOI_LUONG
                                .Where(x => x.NGAY_THANG >= m_dat_dau_nam
                                            && x.NGAY_THANG <= m_dat_den_ngay)
                                .ToList();
        }