private void export_excel()
        {
            CExcelReport v_obj_exe_report = new CExcelReport();
            switch (m_e_form_mode)
            {
                case eFormMode.KE_KHAI:
                    v_obj_exe_report = new CExcelReport(TEN_BAO_CAO.BCDM_TSLM_KE_KHAI, 21, 1);
                    break;
                case eFormMode.DE_NGHI_XU_LY:
                    v_obj_exe_report = new CExcelReport(TEN_BAO_CAO.BCDM_TSLM_DE_NGHI_XU_LY, 21, 1);
                    break;

            }
            v_obj_exe_report.AddFindAndReplaceItem("<DON_VI_SU_DUNG_TAI_SAN>", m_cbo_don_vi_su_dung.Text);
            if (m_fg_excel_nha[1, (int)e_col_Excel_number.MA_DON_VI_SU_DUNG] != null)
                v_obj_exe_report.AddFindAndReplaceItem("<MA_DON_VI>", m_fg_excel_nha[1, (int)e_col_Excel_number.MA_DON_VI_SU_DUNG]);
            else v_obj_exe_report.AddFindAndReplaceItem("<MA_DON_VI>", "");
            v_obj_exe_report.AddFindAndReplaceItem("<LOAI_HINH_DON_VI>", m_cbo_loai_hinh_don_vi.Text);
            v_obj_exe_report.AddFindAndReplaceItem("<TRU_SO_LAM_VIEC>", m_lbl_lam_tru_so_lam_viec.Text);
            v_obj_exe_report.AddFindAndReplaceItem("<DIA_CHI>", m_lbl_dia_chi.Text);
            v_obj_exe_report.AddFindAndReplaceItem("<DT_KHUON_VIEN>", m_lbl_dien_tich_khuon_vien_dat.Text);
            v_obj_exe_report.AddFindAndReplaceItem("<CO_SO_HDSN>", m_lbl_lam_co_so_hd_su_nghiep.Text);
            v_obj_exe_report.AddFindAndReplaceItem("<LAM_NHA_O>", m_lbl_lam_nha_o.Text);
            v_obj_exe_report.AddFindAndReplaceItem("<CHO_THUE>", m_lbl_cho_thue.Text);
            v_obj_exe_report.AddFindAndReplaceItem("<BO_TRONG>", m_lbl_bo_trong.Text);
            v_obj_exe_report.AddFindAndReplaceItem("<BI_LAN_CHIEM>", m_lbl_bi_lan_chiem.Text);
            v_obj_exe_report.AddFindAndReplaceItem("<KHAC>", m_lbl_su_dung_vao_muc_dich_khac.Text);
            v_obj_exe_report.AddFindAndReplaceItem("<GT_THEO_SO_KE_TOAN>", m_lbl_gia_tri_theo_so_ke_toan.Text);
            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_nha, 2, m_fg_nha.Cols.Count - 1, true);
        }
 private void export_2_excel()
 {
     CExcelReport v_obj_excel_report = new CExcelReport("F461_Bao_cao_so_sanh_chi_phi_cuoi_thang.xls", 8, 1);
     v_obj_excel_report.AddFindAndReplaceItem("<ngay>", DateTime.Now.ToShortDateString());
     v_obj_excel_report.FindAndReplace(false);
     v_obj_excel_report.Export2ExcelWithoutFixedRows(m_fg, 0, m_fg.Cols.Count - 1, true);
 }
        private void export_excel()
        {
            CExcelReport v_obj_exe_report = new CExcelReport();
            switch (m_e_form_mode)
            {
                case eFormMode.TONG_HOP_CHUNG:
                    v_obj_exe_report = new CExcelReport(TEN_BAO_CAO.BCTH_THSD_TSK_THC, 17, 1);
                    break;
                case eFormMode.CHI_TIET_THEO_LOAI_HINH:
                    v_obj_exe_report = new CExcelReport(TEN_BAO_CAO.BCTH_THSD_TSK_LH, 17, 1);
                    break;
                case eFormMode.CHI_TIET_THEO_TUNG_DON_VI:
                    v_obj_exe_report = new CExcelReport(TEN_BAO_CAO.BCTH_THSD_TSK_DV, 17, 1);
                    break;

            }
            v_obj_exe_report.AddFindAndReplaceItem("<BO_TINH>", m_lbl_don_vi_bo_tinh.Text);
            v_obj_exe_report.AddFindAndReplaceItem("<DON_VI_BO_TINH>", m_lbl_don_vi_bo_tinh.Text);
            v_obj_exe_report.AddFindAndReplaceItem("<DON_VI_CHU_QUAN>", m_lbl_don_vi_chu_quan.Text);
            v_obj_exe_report.AddFindAndReplaceItem("<MA_DON_VI>", m_lbl_ma_don_vi.Text);
            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_tai_san_khac, 2, m_fg_tai_san_khac.Cols.Count - 1, true);
        }
 private void export_2_excel()
 {
     m_fg.Cols[(int)e_col_Number.UU_TIEN].Visible = false;
     m_dat_chon_thang = CIPConvert.ToDatetime("01/" + m_dt_chon_thang.Text);
     DateTime v_dt_tu_ngay = m_dat_chon_thang;
     DateTime v_dt_den_ngay = m_dat_chon_thang.AddMonths(1).AddDays(-m_dat_chon_thang.Day);
     CExcelReport v_obj_excel_report = new CExcelReport("f406_bc_Tong_hop_bill_theo_phong_ban.xlsx", 5, 1);
     US_HT_NGUOI_SU_DUNG v_ht_nguoi_su_dung = new US_HT_NGUOI_SU_DUNG(CAppContext_201.getCurrentUserID());
     //v_obj_excel_report.AddFindAndReplaceItem("<tu_ngay>", v_dt_tu_ngay.ToShortDateString());
     //v_obj_excel_report.AddFindAndReplaceItem("<den_ngay>", v_dt_den_ngay.ToShortDateString());
     v_obj_excel_report.AddFindAndReplaceItem("<THANG_TONG_HOP>", v_dt_tu_ngay.Month);
     v_obj_excel_report.AddFindAndReplaceItem("<NGUOI_LAP>", v_ht_nguoi_su_dung.strTEN);
     v_obj_excel_report.AddFindAndReplaceItem("<ngay>", DateTime.Now.Day);
     v_obj_excel_report.AddFindAndReplaceItem("<thang>", DateTime.Now.Month);
     v_obj_excel_report.AddFindAndReplaceItem("<nam>", DateTime.Now.Year);
     //v_obj_excel_report.AddFindAndReplaceItem("<trang_thai>", m_cbo_trang_thai.Text);
     v_obj_excel_report.FindAndReplace(false);
     v_obj_excel_report.Export2ExcelWithoutFixedRows(m_fg, 0, m_fg.Cols.Count - 1, true);
     m_fg.Cols[(int)e_col_Number.UU_TIEN].Visible = true;
 }
        //}
        private void export_2_excel()
        {
            CExcelReport v_obj_excel_report = new CExcelReport("f535_gui_don_hang_cho_NCC.xls", 6,1);
            v_obj_excel_report.AddFindAndReplaceItem("<thang>",m_dtp_thang.Text);
            v_obj_excel_report.FindAndReplace(false);
            v_obj_excel_report.Export2ExcelWithoutFixedRows(m_grv_don_hang, 0, m_grv_don_hang.Cols.Count - 1, true);
        }

        private void export_dataset_2_excel()
        private void export_excel()
        {
            CExcelReport v_obj_exe_report = new CExcelReport("BC-002 Bao cao ke khai xe o to.xls", 13, 1); ;
            switch (m_e_form_mode)
            {
                case eFormMode.KE_KHAI_O_TO:
                    v_obj_exe_report = new CExcelReport("BC-002 Bao cao ke khai xe o to.xls", 13, 1);
                    break;
                case eFormMode.O_TO_DE_NGHI_XU_LY:
                    v_obj_exe_report = new CExcelReport("BC-005 Danh muc xe oto de nghi xu ly.xls", 13, 1);
                    break;
                case eFormMode.O_TO_GIAO_DON_VI_SU_NGHIEP:
                    v_obj_exe_report = new CExcelReport("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>", m_cbo_bo_tinh.Text);
            v_obj_exe_report.AddFindAndReplaceItem("<DON_VI_CHU_QUAN>", m_cbo_don_vi_chu_quan.Text);
            v_obj_exe_report.AddFindAndReplaceItem("<DON_VI_SU_DUNG_TAI_SAN>", m_cbo_don_vi_su_dung.Text);
            v_obj_exe_report.AddFindAndReplaceItem("<MA_DON_VI>", m_txt_ma_don_vi.Text);
            v_obj_exe_report.AddFindAndReplaceItem("<LOAI_HINH_DON_VI>", m_txt_loai_hinh_don_vi.Text);

            v_obj_exe_report.FindAndReplace(false);
            v_obj_exe_report.Export2ExcelWithoutFixedRows(m_fg, 1, m_fg.Cols.Count - 1, true);
        }
 private void export_2_excel()
 {
     CExcelReport v_obj_excel_report = new CExcelReport("f405_Tra_cuc_so_Bill_new.xls", 6, 1);
     v_obj_excel_report.AddFindAndReplaceItem("<tu_ngay>", m_dt_tu_ngay.Text);
     v_obj_excel_report.AddFindAndReplaceItem("<den_ngay>", m_dt_den_ngay.Text);
     v_obj_excel_report.AddFindAndReplaceItem("<phap_nhan>", m_cbo_ten_pb.Text);
     //v_obj_excel_report.AddFindAndReplaceItem("<trang_thai>", m_cbo_trang_thai.Text);
     v_obj_excel_report.FindAndReplace(false);
     DataSet v_ds = new DataSet();
     v_ds=grid_to_dataset_export_excel(m_fg);
     m_fg_excel.DataSource = v_ds.Tables[0].DefaultView;
     v_obj_excel_report.Export2ExcelWithoutFixedRows(m_fg_excel, 0, m_fg_excel.Cols.Count -1, true);
 }
 private void xuat_excel()
 {
     var v_start_row = 8;
     var v_start_col = 2;
     var v_obj_excel_rpt = new CExcelReport("f420_bao_cao_tai_chinh_hs_theo_lop.xlsx", v_start_row, v_start_col);
     v_obj_excel_rpt.AddFindAndReplaceItem("<tu_ngay>", string.Format("{0}/{1}/{2}", m_dat_tu_ngay.Value.Date.Day, m_dat_tu_ngay.Value.Month, m_dat_tu_ngay.Value.Year));
     v_obj_excel_rpt.AddFindAndReplaceItem("<den_ngay>", string.Format("{0}/{1}/{2}", m_dat_den_ngay.Value.Day, m_dat_den_ngay.Value.Month, m_dat_den_ngay.Value.Year));
     v_obj_excel_rpt.AddFindAndReplaceItem("<ten_lop>", m_cbo_lop.Text.Trim());
     v_obj_excel_rpt.FindAndReplace(false);
     v_obj_excel_rpt.Export2ExcelWithoutFixedRows(m_fg, 0, m_fg.Cols.Count - 1, false);
 }
     v_us.CommitTransaction();
     m_grv_trang_thai.Rows.Remove(m_grv_trang_thai.Row);
 }
 catch (Exception v_e) {
     v_us.Rollback();
     CDBExceptionHandler v_objErrHandler = new CDBExceptionHandler(v_e,
         new CDBClientDBExceptionInterpret());
     v_objErrHandler.showErrorMessage();
        private void export_excel()
        {
            CExcelReport v_obj_exe_report = new CExcelReport();
            switch (m_e_form_mode)
            {
                case eFormMode.KE_KHAI:
                    v_obj_exe_report = new CExcelReport(TEN_BAO_CAO.BCDM_OTO_KE_KHAI, 13, 1);
                    break;
                case eFormMode.DE_NGHI_XU_LY:
                    v_obj_exe_report = new CExcelReport(TEN_BAO_CAO.BCDM_OTO_DE_NGHI_XU_LY, 13, 1);
                    break;

            }
            v_obj_exe_report.AddFindAndReplaceItem("<DON_VI_SU_DUNG_TAI_SAN>", m_cbo_don_vi_su_dung.Text);
            if (m_fg_oto_excel[1, (int)e_col_Excel_number.MA_DON_VI_SU_DUNG] != null)
                v_obj_exe_report.AddFindAndReplaceItem("<MA_DON_VI>", m_fg_oto_excel[1, (int)e_col_Excel_number.MA_DON_VI_SU_DUNG]);
            else v_obj_exe_report.AddFindAndReplaceItem("<MA_DON_VI>", "");
            v_obj_exe_report.AddFindAndReplaceItem("<LOAI_HINH_DON_VI>", m_cbo_loai_hinh_don_vi.Text);
            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_oto, 2, m_fg_oto.Cols.Count - 1, true);
        }
        private void export_2_excel()
        {
            m_grv_bill.Cols[(int)e_col_Number.CHON_GUI_MAIL].Visible = false;
            CExcelReport v_obj_excel_report = new CExcelReport("f512_bill_bi_tra_lai.xls", 6, 1);
            v_obj_excel_report.AddFindAndReplaceItem("<tu_ngay>", m_dtp_tu_ngay.Text);
            v_obj_excel_report.AddFindAndReplaceItem("<den_ngay>", m_dtp_den_ngay.Text);
            v_obj_excel_report.FindAndReplace(false);

            v_obj_excel_report.Export2ExcelWithoutFixedRows(m_grv_bill, 0, m_grv_bill.Cols.Count - 1, true);
            m_grv_bill.Cols[(int)e_col_Number.CHON_GUI_MAIL].Visible = true;
        }
        void m_xuat_excel_Click(object sender, EventArgs e)
        {
            try {
                CExcelReport v_excel = new CExcelReport("f130_chuc_nang.xls", 6, 1);
                v_excel.FindAndReplace(false);
                v_excel.Export2ExcelWithoutFixedRows(m_fg_load_file, (int)e_col_Number.SOCT, (int)e_col_Number.GHICHU, true);
                //v_excel.OpenExcelFile();
            }
            catch(Exception v_e) {

                CSystemLog_301.ExceptionHandle(v_e);
            }
        }
 private void export_excel()
 {
     CExcelReport v_obj_exe_report;
     switch (m_e_form_mode)
     {
         case eFormMode.KE_KHAI:
             v_obj_exe_report = new CExcelReport(TEN_BAO_CAO.BCDM_TST_TREN500TRIEU_KK, 12, 1);
             v_obj_exe_report.AddFindAndReplaceItem("<TEN_DON_VI_CHU_QUAN>", m_lbl_don_vi_chu_quan.Text);
             v_obj_exe_report.AddFindAndReplaceItem("<DON_VI_SU_DUNG>", m_lbl_don_vi_su_dung.Text);
             break;
         case eFormMode.DE_NGHI_XU_LY:
             v_obj_exe_report = new CExcelReport(TEN_BAO_CAO.BCDM_TSK_DE_NGHI_XU_LY, 12, 1);
             break;
         default:
             v_obj_exe_report = new CExcelReport();
             break;
     }
     v_obj_exe_report.AddFindAndReplaceItem("<DON_VI_SU_DUNG_TAI_SAN>", m_lbl_ma_don_vi.Text);
     v_obj_exe_report.AddFindAndReplaceItem("<MA_DON_VI>", m_lbl_ma_don_vi.Text);
     v_obj_exe_report.AddFindAndReplaceItem("<LOAI_HINH_DON_VI>", m_lbl_loai_hinh_don_vi.Text);
     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_tai_san_khac, 2, m_fg_tai_san_khac.Cols.Count - 1, true);
 }
 private void xuat_excel()
 {
     var v_start_row = 8;
     var v_start_col = 2;
     var v_obj_excel_rpt = new CExcelReport("f460_tinh_hinh_thoi_hoc.xlsx", v_start_row, v_start_col);
     v_obj_excel_rpt.AddFindAndReplaceItem("<tu_ngay>", string.Format("{0}/{1}/{2}", m_dat_tu_ngay.Value.Date.Day, m_dat_tu_ngay.Value.Month, m_dat_tu_ngay.Value.Year));
     v_obj_excel_rpt.AddFindAndReplaceItem("<den_ngay>", string.Format("{0}/{1}/{2}", m_dat_den_ngay.Value.Day, m_dat_den_ngay.Value.Month, m_dat_den_ngay.Value.Year));
     v_obj_excel_rpt.AddFindAndReplaceItem("<tong_so>", m_txt_sl_dang_hoc.Text);
     v_obj_excel_rpt.FindAndReplace(false);
     v_obj_excel_rpt.Export2ExcelWithoutFixedRows(m_fg, 0, m_fg.Cols.Count - 1, false);
 }
 private void export_2_excel()
 {
     CExcelReport v_obj_excel_report = new CExcelReport("f710_bc_tinh_hinh_VPP_theo_phong_ban.xlsx", 7, 1);
     v_obj_excel_report.AddFindAndReplaceItem("<tu_ngay>", v_dt_tu_ngay.ToShortDateString());
     v_obj_excel_report.AddFindAndReplaceItem("<den_ngay>", v_dt_den_ngay.ToShortDateString());
     v_obj_excel_report.FindAndReplace(false);
     //v_obj_excel_report.Export2ExcelWithoutFixedRows(m_fg, 0, m_fg.Cols.Count - 1, true);
     v_obj_excel_report.Export2ExcelWithoutFixedRows_saveDialog("abc",m_fg, 0, m_fg.Cols.Count - 1, true);
 }
                v_objErrHandler.showErrorMessage();
            }
        }

        private void export_2_excel()
        {
            CExcelReport v_obj_excel_report = new CExcelReport("f555_tong_hop_chi_phi_vpp.xls", 6, 1);
        }

        private void m_cmd_update_Click(object sender, EventArgs e)
        {
            try{
                update_v_gd_don_dat_hang_detail();
            }
            catch (Exception v_e){
                CSystemLog_301.ExceptionHandle(v_e);
            }
        }

        private void m_cmd_xuat_excel_Click(object sender, EventArgs e)
        {
 private void export_2_excel()
 {
     CExcelReport v_obj_excel_report = new CExcelReport("f410_bc_chi_phi_theo_phap_nhan.xlsx", 5, 1);
     v_obj_excel_report.AddFindAndReplaceItem("<tu_ngay>", m_dt_tu_ngay.Text);
     v_obj_excel_report.AddFindAndReplaceItem("<den_ngay>", m_dt_den_ngay.Text);
     //v_obj_excel_report.AddFindAndReplaceItem("<trang_thai>", m_cbo_trang_thai.Text);
     v_obj_excel_report.FindAndReplace(false);
     v_obj_excel_report.Export2ExcelWithoutFixedRows(m_fg, 0, m_fg.Cols.Count - 1, true);
 }
        private void xuat_excel()
        {
            var v_start_row = 8;
            var v_start_col = 2;
            var v_obj_excel_rpt = new CExcelReport("f230_ds_hoc_vien_theo_lop.xlsx", v_start_row, v_start_col);
            v_obj_excel_rpt.AddFindAndReplaceItem("<ten_lop>", m_cbo_lop_mon.Text);

            v_obj_excel_rpt.FindAndReplace(false);
            v_obj_excel_rpt.Export2ExcelWithoutFixedRows(m_fg, 0, m_fg.Cols.Count - 1, false);
        }
            }
            catch (Exception v_e) {
                v_us.Rollback();
                CDBExceptionHandler v_objErrHandler = new CDBExceptionHandler(v_e,
                    new CDBClientDBExceptionInterpret());
                v_objErrHandler.showErrorMessage();
            }
        }

        //private void set_search_tu_khoa_format_before()
        //{
        //    if (m_txt_tu_khoa.Text == "")
        //    {
        //        m_txt_tu_khoa.Text = m_str_goi_y;
        //        m_txt_tu_khoa.ForeColor = Color.Gray;
        //    }
        //}
        //private void set_search_tu_khoa_format_after()
        //{
        //    if (m_txt_tu_khoa.Text == m_str_goi_y)
        //    {
        //        m_txt_tu_khoa.Text = "";
        //    }
 private void export_2_excel_pn_pb()
 {
     CExcelReport v_obj_excel_report = new CExcelReport("f405_Tra_cuu_so_Bill_PN_PB.xls", 6, 1);
     v_obj_excel_report.AddFindAndReplaceItem("<tu_ngay>", m_dt_tu_ngay.Text);
     v_obj_excel_report.AddFindAndReplaceItem("<den_ngay>", m_dt_den_ngay.Text);
     v_obj_excel_report.AddFindAndReplaceItem("<phap_nhan>", m_cbo_ten_pb.Text);
     //v_obj_excel_report.AddFindAndReplaceItem("<trang_thai>", m_cbo_trang_thai.Text);
     v_obj_excel_report.FindAndReplace(false);
     v_obj_excel_report.Export2ExcelWithoutFixedRows(m_fg, 0, m_fg.Cols.Count - 5, true);
 }
 private void export_2_excel()
 {
     CExcelReport v_obj_excel_report = new CExcelReport("f407_bc_chi_tiet_bill_cua_phong_ban.xlsx", 6, 1);
     v_obj_excel_report.AddFindAndReplaceItem("<tu_ngay>", m_lbl_tu_ngay.Text);
     v_obj_excel_report.AddFindAndReplaceItem("<den_ngay>", m_lbl_den_ngay.Text);
     v_obj_excel_report.AddFindAndReplaceItem("<phong_ban>", m_lbl_ten_phong_ban.Text);
     v_obj_excel_report.AddFindAndReplaceItem("<tong_bill>", m_lbl_tong_bill.Text);
     v_obj_excel_report.AddFindAndReplaceItem("<tong_tien>", m_lbl_tong_tien.Text);
     v_obj_excel_report.FindAndReplace(false);
     v_obj_excel_report.Export2ExcelWithoutFixedRows(m_fg, 0, m_fg.Cols.Count - 1, true);
 }