public void expor_excel_delete(
            eFormMode ip_form_mode
            , string ip_str_bo_tinh
            , string ip_str_don_vi_chu_quan
            , decimal ip_dc_don_vi_su_dung
            , ref string op_str_excel_file_name)
        {
            //1. Đưa dữ liệu lên trên grid
            m_obj_trans = get_trans_object(m_fg);

            m_e_form_mode = ip_form_mode;
            US_DM_DON_VI v_us_don_vi = new US_DM_DON_VI();
            if (ip_dc_don_vi_su_dung != CONST_QLDB.ID_TAT_CA)
            {
                v_us_don_vi = new US_DM_DON_VI(ip_dc_don_vi_su_dung);
            }
            else
            {
                v_us_don_vi.strTEN_DON_VI = CONST_QLDB.TAT_CA;
                v_us_don_vi.strLOAI_HINH_DON_VI = CONST_QLDB.TAT_CA;
            }

            //2. Xuất dữ liệu ra file excel
            CExcelWebReport v_obj_exe_report = new CExcelWebReport("BC-002 Bao cao ke khai xe o to.xls", 13, 1); ;
            switch (m_e_form_mode)
            {
                case eFormMode.KE_KHAI_O_TO:
                    //load_data_2_grid(ip_dc_don_vi_su_dung, ID_TRANG_THAI_OTO.DANG_SU_DUNG);
                    v_obj_exe_report = new CExcelWebReport("BC-002 Bao cao ke khai xe o to.xls", 13, 1);
                    break;
                case eFormMode.O_TO_DE_NGHI_XU_LY:
                    //load_data_2_grid(ip_dc_don_vi_su_dung, ID_TRANG_THAI_OTO.DE_NGHI_XU_LY);
                    v_obj_exe_report = new CExcelWebReport("BC-005 Danh muc xe oto de nghi xu ly.xls", 13, 1);
                    break;
                case eFormMode.O_TO_GIAO_DON_VI_SU_NGHIEP:
                    // Chỗ này đang chưa chuẩn vì chưa hiểu sự nghiệp là gì
                    //load_data_2_grid(ip_dc_don_vi_su_dung, ID_TRANG_THAI_OTO.DANG_SU_DUNG);
                    v_obj_exe_report = new CExcelWebReport("BC-023 Bao cao danh muc xe o to giao cho don vi su nghiep cong lap tu chu tai chinh.xls", 13, 1);
                    break;
                default:
                    break;
            }

            v_obj_exe_report.AddFindAndReplaceItem("<BO_TINH>", ip_str_bo_tinh);
            v_obj_exe_report.AddFindAndReplaceItem("<DON_VI_CHU_QUAN>", ip_str_don_vi_chu_quan);
            v_obj_exe_report.AddFindAndReplaceItem("<DON_VI_SU_DUNG_TAI_SAN>", v_us_don_vi.strTEN_DON_VI);
            v_obj_exe_report.AddFindAndReplaceItem("<MA_DON_VI>", v_us_don_vi.strMA_DON_VI);
            v_obj_exe_report.AddFindAndReplaceItem("<LOAI_HINH_DON_VI>", v_us_don_vi.strLOAI_HINH_DON_VI);

            v_obj_exe_report.FindAndReplace(false);
            v_obj_exe_report.Export2ExcelWithoutFixedRows(m_fg, 1, m_fg.Cols.Count - 1, true);
            //3. Trả về địa chỉ file
            op_str_excel_file_name = v_obj_exe_report.GetStrOutputFileNameWithPath();
        }
        public void export_excel(
            eFormMode ip_form_mode
            , ref IP.Core.QltsFormControls.CObjExcelAssetParameters op_obj_excel_parameters
            )
        {
            //1. Đưa dữ liệu lên trên grid
            m_obj_trans = get_trans_object(m_fg);

            m_e_form_mode = ip_form_mode;
            US_DM_DON_VI v_us_don_vi = new US_DM_DON_VI();
            if (op_obj_excel_parameters.dcID_DON_VI_SU_DUNG != CONST_QLDB.ID_TAT_CA)
            {
                v_us_don_vi = new US_DM_DON_VI(op_obj_excel_parameters.dcID_DON_VI_SU_DUNG);
            }
            else
            {
                v_us_don_vi.strTEN_DON_VI = CONST_QLDB.TAT_CA;
                v_us_don_vi.strLOAI_HINH_DON_VI = CONST_QLDB.TAT_CA;
            }

            //2. Xuất dữ liệu ra file excel
            CExcelWebReport v_obj_exe_report = new CExcelWebReport();
            switch (m_e_form_mode)
            {
                case eFormMode.KE_KHAI_O_TO:
                    load_data_2_grid(
                         op_obj_excel_parameters.dcID_BO_TINH
                        , op_obj_excel_parameters.dcID_DON_VI_CHU_QUAN
                        , op_obj_excel_parameters.dcID_DON_VI_SU_DUNG
                        , op_obj_excel_parameters.dcID_LOAI_TAI_SAN
                        , ID_TRANG_THAI_OTO.DANG_SU_DUNG
                        , op_obj_excel_parameters.strKEY_SEARCH);
                    v_obj_exe_report = new CExcelWebReport(TEN_BAO_CAO.BCDM_OTO_KE_KHAI, 13, 1);
                    break;
                case eFormMode.O_TO_DE_NGHI_XU_LY:
                    load_data_2_grid(
                        op_obj_excel_parameters.dcID_BO_TINH
                        , op_obj_excel_parameters.dcID_DON_VI_CHU_QUAN
                        , op_obj_excel_parameters.dcID_DON_VI_SU_DUNG
                        , op_obj_excel_parameters.dcID_LOAI_TAI_SAN
                        , ID_TRANG_THAI_OTO.DE_NGHI_XU_LY
                        , op_obj_excel_parameters.strKEY_SEARCH);
                    v_obj_exe_report = new CExcelWebReport(TEN_BAO_CAO.BCDM_OTO_DE_NGHI_XU_LY, 13, 1);
                    break;
                case eFormMode.THONG_KE_O_TO:
                    // Chỗ này đang chưa chuẩn vì chưa hiểu sự nghiệp là gì
                    load_data_2_grid(
                        op_obj_excel_parameters.dcID_BO_TINH
                        , op_obj_excel_parameters.dcID_DON_VI_CHU_QUAN
                        , op_obj_excel_parameters.dcID_DON_VI_SU_DUNG
                        , op_obj_excel_parameters.dcID_LOAI_TAI_SAN
                        , op_obj_excel_parameters.dcID_TRANG_THAI_TAI_SAN
                        , op_obj_excel_parameters.strKEY_SEARCH);
                    v_obj_exe_report = new CExcelWebReport(TEN_BAO_CAO.BCDM_OTO_THONG_KE, 13, 1);
                    break;
                case eFormMode.O_TO_GIAO_DON_VI_SU_NGHIEP:
                    // Chỗ này đang chưa chuẩn vì chưa hiểu sự nghiệp là gì
                    load_data_2_grid(
                        op_obj_excel_parameters.dcID_BO_TINH
                        , op_obj_excel_parameters.dcID_DON_VI_CHU_QUAN
                        , op_obj_excel_parameters.dcID_DON_VI_SU_DUNG
                        , op_obj_excel_parameters.dcID_LOAI_TAI_SAN
                        , ID_TRANG_THAI_OTO.DANG_SU_DUNG
                        , op_obj_excel_parameters.strKEY_SEARCH);
                    v_obj_exe_report = new CExcelWebReport(TEN_BAO_CAO.BCDM_OTO_GIAO_CHO_DON_VI_CONG_LAP_TU_CHU_TAI_CHINH, 13, 1);
                    break;
                default:
                    break;
            }

            v_obj_exe_report.AddFindAndReplaceItem("<BO_TINH>", op_obj_excel_parameters.strTEN_BO_TINH);
            v_obj_exe_report.AddFindAndReplaceItem("<DON_VI_CHU_QUAN>", op_obj_excel_parameters.strTEN_DON_VI_CHU_QUAN);
            v_obj_exe_report.AddFindAndReplaceItem("<DON_VI_SU_DUNG_TAI_SAN>", op_obj_excel_parameters.strTEN_DON_VI_SU_DUNG);
            v_obj_exe_report.AddFindAndReplaceItem("<MA_DON_VI>", v_us_don_vi.strMA_DON_VI);
            v_obj_exe_report.AddFindAndReplaceItem("<LOAI_HINH_DON_VI>", v_us_don_vi.strLOAI_HINH_DON_VI);
            v_obj_exe_report.AddFindAndReplaceItem("<NGAY>", DateTime.Now.Day);
            v_obj_exe_report.AddFindAndReplaceItem("<THANG>", DateTime.Now.Month);
            v_obj_exe_report.AddFindAndReplaceItem("<NAM>", DateTime.Now.Year);

            v_obj_exe_report.FindAndReplace(false);
            v_obj_exe_report.Export2ExcelWithoutFixedRows(m_fg, 1, m_fg.Cols.Count - 1, true);
            //3. Trả về địa chỉ file
            op_obj_excel_parameters.strFILE_NAME_RESULT = v_obj_exe_report.GetStrOutputFileNameWithPath();
        }
        public void export_excel_TH_THSD(
            TINH_HINH_SU_DUNG ip_str_loai_bao_cao
            , ref IP.Core.QltsFormControls.CObjExcelAssetParameters op_obj_excel_parameters)
        {
            m_obj_trans = get_trans_object(m_fg);
            US_DM_DON_VI v_us_dm_don_vi_bo_tinh;
            CExcelWebReport v_obj_exe_report;
            if (op_obj_excel_parameters.dcID_BO_TINH != CONST_QLDB.ID_TAT_CA)
            {
                v_us_dm_don_vi_bo_tinh = new US_DM_DON_VI(op_obj_excel_parameters.dcID_BO_TINH);
            }
            else
            {
                v_us_dm_don_vi_bo_tinh = new US_DM_DON_VI();
            }
            switch (ip_str_loai_bao_cao)
            {
                case TINH_HINH_SU_DUNG.TONG_HOP_CHUNG:
                    v_obj_exe_report = new CExcelWebReport("BC-400 BCTH-THSDTSK-THC.xls", 17, 1); ;
                    load_data_to_grid_thsd_tong_hop_chung(op_obj_excel_parameters);
                    break;
                case TINH_HINH_SU_DUNG.DON_VI_SU_DUNG:
                    v_obj_exe_report = new CExcelWebReport("BC-400 BCTH-THSDTSK-CT.xls", 17, 1); ;
                    load_data_to_grid_thsd_theo_don_vi(op_obj_excel_parameters);
                    break;
                default:
                    v_obj_exe_report = new CExcelWebReport("BC-400 BCTH-THSDTSK-THC.xls", 17, 1); ;
                    load_data_to_grid_thsd_tong_hop_chung(op_obj_excel_parameters);
                    break;
            }

            v_obj_exe_report.AddFindAndReplaceItem("<BO_TINH>", op_obj_excel_parameters.strTEN_BO_TINH);
            v_obj_exe_report.AddFindAndReplaceItem("<DON_VI_CHU_QUAN>", op_obj_excel_parameters.strTEN_DON_VI_CHU_QUAN);
            v_obj_exe_report.AddFindAndReplaceItem("<DON_VI_BO_TINH>", v_us_dm_don_vi_bo_tinh.strTEN_DON_VI);
            v_obj_exe_report.AddFindAndReplaceItem("<MA_DON_VI>", v_us_dm_don_vi_bo_tinh.strMA_DON_VI);
            v_obj_exe_report.AddFindAndReplaceItem("<NGAY>", DateTime.Now.Day);
            v_obj_exe_report.AddFindAndReplaceItem("<THANG>", DateTime.Now.Month);
            v_obj_exe_report.AddFindAndReplaceItem("<NAM>", DateTime.Now.Year);
            v_obj_exe_report.FindAndReplace(false);
            v_obj_exe_report.Export2ExcelWithoutFixedRows(m_fg, 1, m_fg.Cols.Count - 1, true);
            op_obj_excel_parameters.strFILE_NAME_RESULT = v_obj_exe_report.GetStrOutputFileNameWithPath();
        }
        public void export_excel(
            eFormMode ip_form_mode
            , decimal ip_dc_id_dat
            , ref CObjExcelAssetParameters op_obj_excel_parameters)
        {
            //1. Đưa dữ liệu lên trên grid
            m_obj_trans = get_trans_object(m_fg_nha);
            m_e_form_mode = ip_form_mode;
            US_V_DM_DAT v_us_v_dm_dat;
            if (ip_dc_id_dat != CONST_QLDB.ID_TAT_CA)
            {
                v_us_v_dm_dat = new US_V_DM_DAT(ip_dc_id_dat);
            }
            else
            {
                v_us_v_dm_dat = new US_V_DM_DAT();
            }
            US_DM_DON_VI v_us_dm_don_vi;
            if (op_obj_excel_parameters.dcID_DON_VI_SU_DUNG != CONST_QLDB.ID_TAT_CA)
            {
                v_us_dm_don_vi = new US_DM_DON_VI(op_obj_excel_parameters.dcID_DON_VI_SU_DUNG);
            }
            else
            {
                v_us_dm_don_vi = new US_DM_DON_VI();
            }

            //2. Xuất dữ liệu ra file excel
            //CExcelWebReport v_obj_exe_report = new CExcelWebReport("BC-18 Bao cao danh muc tru so lam viec co so hoat dong su nghiep.xls", 21, 1);
            CExcelWebReport v_obj_exe_report = new CExcelWebReport();
            switch (m_e_form_mode)
            {
                case eFormMode.KE_KHAI:
                    load_data_2_grid(op_obj_excel_parameters, ip_dc_id_dat);
                    v_obj_exe_report = new CExcelWebReport(TEN_BAO_CAO.BCDM_TSLM_KE_KHAI, 21, 1);
                    break;
                case eFormMode.DE_NGHI_XU_LY:
                    load_data_2_grid(op_obj_excel_parameters, ip_dc_id_dat);
                    v_obj_exe_report = new CExcelWebReport(TEN_BAO_CAO.BCDM_TSLM_DE_NGHI_XU_LY, 21, 1);
                    break;
                case eFormMode.THONG_KE:
                    load_data_2_grid(op_obj_excel_parameters, ip_dc_id_dat);
                    v_obj_exe_report = new CExcelWebReport(TEN_BAO_CAO.BCDM_TSLM_THONG_KE, 21, 1);
                    break;
                default:
                    break;
            }

            // Thông tin phần đầu
            v_obj_exe_report.AddFindAndReplaceItem("<BO_TINH>", op_obj_excel_parameters.strTEN_BO_TINH);
            v_obj_exe_report.AddFindAndReplaceItem("<DON_VI_CHU_QUAN>", op_obj_excel_parameters.strTEN_DON_VI_CHU_QUAN);
            v_obj_exe_report.AddFindAndReplaceItem("<DON_VI_SU_DUNG_TAI_SAN>", op_obj_excel_parameters.strTEN_DON_VI_SU_DUNG);
            v_obj_exe_report.AddFindAndReplaceItem("<MA_DON_VI>", v_us_dm_don_vi.strMA_DON_VI);
            v_obj_exe_report.AddFindAndReplaceItem("<LOAI_HINH_DON_VI>", op_obj_excel_parameters.strLOAI_HINH_DON_VI);

            // Thông tin đất
            v_obj_exe_report.AddFindAndReplaceItem("<DIA_CHI>", v_us_v_dm_dat.strDIA_CHI);
            v_obj_exe_report.AddFindAndReplaceItem("<DT_KHUON_VIEN>", v_us_v_dm_dat.dcDT_KHUON_VIEN.ToString("#,##0.00"));
            v_obj_exe_report.AddFindAndReplaceItem("<TRU_SO_LAM_VIEC>", v_us_v_dm_dat.dcDT_TRU_SO_LAM_VIEC.ToString("#,##0.00"));
            v_obj_exe_report.AddFindAndReplaceItem("<CO_SO_HDSN>", v_us_v_dm_dat.dcDT_CO_SO_HOAT_DONG_SU_NGHIEP.ToString("#,##0.00"));
            v_obj_exe_report.AddFindAndReplaceItem("<LAM_NHA_O>", v_us_v_dm_dat.dcDT_LAM_NHA_O.ToString("#,##0.00"));
            v_obj_exe_report.AddFindAndReplaceItem("<CHO_THUE>", v_us_v_dm_dat.dcDT_CHO_THUE.ToString("#,##0.00"));
            v_obj_exe_report.AddFindAndReplaceItem("<BO_TRONG>", v_us_v_dm_dat.dcDT_BO_TRONG.ToString("#,##0.00"));
            v_obj_exe_report.AddFindAndReplaceItem("<BI_LAN_CHIEM>", v_us_v_dm_dat.dcDT_BI_LAN_CHIEM.ToString("#,##0.00"));
            v_obj_exe_report.AddFindAndReplaceItem("<KHAC>", v_us_v_dm_dat.dcDT_SU_DUNG_MUC_DICH_KHAC.ToString("#,##0.00"));
            v_obj_exe_report.AddFindAndReplaceItem("<GT_THEO_SO_KE_TOAN>", v_us_v_dm_dat.dcGT_THEO_SO_KE_TOAN.ToString("#,##0.00"));

            // Thông tin phần cuối
            //v_obj_exe_report.AddFindAndReplaceItem("<HO_SO_GIAY_TO_LIEN_QUAN>", v_us_dm_dat.strDIA_CHI);
            v_obj_exe_report.AddFindAndReplaceItem("<NGAY>", DateTime.Now.Day);
            v_obj_exe_report.AddFindAndReplaceItem("<THANG>", DateTime.Now.Month);
            v_obj_exe_report.AddFindAndReplaceItem("<NAM>", DateTime.Now.Year);

            // Thông tin bảng
            v_obj_exe_report.FindAndReplace(false);
            v_obj_exe_report.Export2ExcelWithoutFixedRows(m_fg_nha, 1, m_fg_nha.Cols.Count - 1, true);

            //3. Trả về địa chỉ file
            op_obj_excel_parameters.strFILE_NAME_RESULT = v_obj_exe_report.GetStrOutputFileNameWithPath();
        }
        public void export_excel_tai_san_co_nguyen_gia_tren_500_trieu(
            eFormMode ip_form_mode
            , ref IP.Core.QltsFormControls.CObjExcelAssetParameters op_obj_excel_parameters)
        {
            m_obj_trans = get_trans_object(m_fg);
            m_e_form_mode = ip_form_mode;
            US_DM_DON_VI v_us_dm_don_vi;
            if (op_obj_excel_parameters.dcID_DON_VI_SU_DUNG != CONST_QLDB.ID_TAT_CA)
            {
                v_us_dm_don_vi = new US_DM_DON_VI(op_obj_excel_parameters.dcID_DON_VI_SU_DUNG);
            }
            else
            {
                v_us_dm_don_vi = new US_DM_DON_VI();
            }

            CExcelWebReport v_obj_exe_report = new CExcelWebReport("BC-26 BCDM-TSK.xls", 12, 1); ;
            switch (m_e_form_mode)
            {
                case eFormMode.KE_KHAI_TAI_SAN_KHAC:
                    v_obj_exe_report = new CExcelWebReport("BC-26 BCDM-TSK.xls", 12, 1);
                    load_data_2_grid_tai_san_co_nguyen_gia_tren_500_trieu(op_obj_excel_parameters);
                    break;
                case eFormMode.TAI_SAN_KHAC_DE_NGHI_XU_LY:
                    v_obj_exe_report = new CExcelWebReport("BC-24 BCDM-TSK-DNXL.xls", 12, 1);
                    load_data_2_grid_tai_san_co_nguyen_gia_tren_500_trieu(op_obj_excel_parameters);
                    break;
                case eFormMode.TAI_SAN_KHAC_GIAO_DON_VI_SU_NGHIEP:
                    v_obj_exe_report = new CExcelWebReport("BC-28 BCDM-TSK-DVTCTC.xls", 14, 1);
                    load_data_2_grid_tai_san_co_nguyen_gia_tren_500_trieu(op_obj_excel_parameters);
                    break;
                default:
                    break;
            }
            v_obj_exe_report.AddFindAndReplaceItem("<BO_TINH>", op_obj_excel_parameters.strTEN_BO_TINH);
            v_obj_exe_report.AddFindAndReplaceItem("<DON_VI_CHU_QUAN>", op_obj_excel_parameters.strTEN_DON_VI_CHU_QUAN);
            v_obj_exe_report.AddFindAndReplaceItem("<DON_VI_SU_DUNG_TAI_SAN>", op_obj_excel_parameters.strTEN_DON_VI_SU_DUNG);
            v_obj_exe_report.AddFindAndReplaceItem("<MA_DON_VI>", v_us_dm_don_vi.strMA_DON_VI);
            v_obj_exe_report.AddFindAndReplaceItem("<LOAI_HINH_DON_VI>", op_obj_excel_parameters.strLOAI_HINH_DON_VI);
            v_obj_exe_report.AddFindAndReplaceItem("<TEN_DON_VI_CHU_QUAN>", op_obj_excel_parameters.strTEN_DON_VI_CHU_QUAN);
            v_obj_exe_report.AddFindAndReplaceItem("<DON_VI_SU_DUNG>", op_obj_excel_parameters.strTEN_DON_VI_SU_DUNG);
            v_obj_exe_report.AddFindAndReplaceItem("<NGAY>", DateTime.Now.Day);
            v_obj_exe_report.AddFindAndReplaceItem("<THANG>", DateTime.Now.Month);
            v_obj_exe_report.AddFindAndReplaceItem("<NAM>", DateTime.Now.Year);

            v_obj_exe_report.FindAndReplace(false);
            v_obj_exe_report.Export2ExcelWithoutFixedRows(m_fg, 1, m_fg.Cols.Count - 1, true);

            op_obj_excel_parameters.strFILE_NAME_RESULT = v_obj_exe_report.GetStrOutputFileNameWithPath();
        }
,SO_DAU_KY_NGUYEN_GIA = 4
        }

        #endregion Enumerations

        #region Methods

        public void display()
        {
            this.ShowDialog();
        }

        public void export_excel(TANG_GIAM_TAI_SAN ip_tang_giam_tai_san
            , ref IP.Core.QltsFormControls.CObjExcelAssetParameters op_obj_excel_parameters)
        {
            m_obj_trans = get_trans_object(m_fg);
            string v_str_ma_don_vi="";
            if (op_obj_excel_parameters.dcID_BO_TINH !=-1)
            {
                US_DM_DON_VI v_us_dm_don_vi = new US_DM_DON_VI(op_obj_excel_parameters.dcID_BO_TINH);
                v_str_ma_don_vi = v_us_dm_don_vi.strMA_DON_VI;
            }

            CExcelWebReport v_obj_exe_report = new CExcelWebReport("BC-330 BCTH-TGTS.xls", 16, 1);
            load_data_to_grid_tai_san(ip_tang_giam_tai_san
                , op_obj_excel_parameters.strUSER_NAME
                ,op_obj_excel_parameters.dcID_BO_TINH
                ,op_obj_excel_parameters.dcID_DON_VI_CHU_QUAN
                ,op_obj_excel_parameters.datTU_NGAY
                ,op_obj_excel_parameters.datDEN_NGAY);
            switch (ip_tang_giam_tai_san)
            {
                case TANG_GIAM_TAI_SAN.TONG_HOP_CHUNG:
                    v_obj_exe_report.AddFindAndReplaceItem("<LOAI_BAO_CAO>"
                        , "Phần 1: Tổng hợp chung"
                        );
                    break;
                case TANG_GIAM_TAI_SAN.CHI_TIET_THEO_LOAI_HINH:
                   v_obj_exe_report.AddFindAndReplaceItem("<LOAI_BAO_CAO>"
                         , "Phần 2: Chi tiết theo loại hình đơn vị"
                         );
                    break;
                case TANG_GIAM_TAI_SAN.CHI_TIET_THEO_DON_VI:
                    v_obj_exe_report.AddFindAndReplaceItem("<LOAI_BAO_CAO>"
                        , "Phần 3: Chi tiết theo từng đơn vị"
                        );
                    break;
            }