/// <summary>
 /// Xuất báo cáo ra file excel
 /// </summary>
 /// <param name="TuThang"></param>
 /// <param name="DenThang"></param>
 /// <param name="NamLuong"></param>
 /// <param name="TrangThai"></param>
 /// <returns></returns>
 public clsExcelResult ExportToExcel(String TuThang, String DenThang, String NamLuong, String TrangThai)
 {
     clsExcelResult clsResult = new clsExcelResult();
     ExcelFile xls = CreateReport(Server.MapPath(sFilePath), TuThang,DenThang,NamLuong,TrangThai);
     using (MemoryStream ms = new MemoryStream())
     {
         xls.Save(ms);
         ms.Position = 0;
         clsResult.ms = ms;
         clsResult.FileName = "TongHop_ThuThueDauVao.xls";
         clsResult.type = "xls";
         return clsResult;
     }
 }
 public clsExcelResult ExportToExcel(String MaBL)
 {
     clsExcelResult clsResult = new clsExcelResult();
     ExcelFile xls = CreateReport(Server.MapPath(sFilePath),MaBL);
     using (MemoryStream ms = new MemoryStream())
     {
         xls.Save(ms);
         ms.Position = 0;
         clsResult.ms = ms;
         clsResult.FileName = "Luong_NguoiPhuThuoc.xls";
         clsResult.type = "xls";
         return clsResult;
     }
 }
 public clsExcelResult ExportToExcel(String MaND, string iID_MaPhongBan, string iThang1, string iThang2, string iThang3, string iThang4, String bQuy)
 {
     clsExcelResult clsResult = new clsExcelResult();
     ExcelFile xls = CreateReport(Server.MapPath(sFilePath), MaND, iID_MaPhongBan, iThang1, iThang2, iThang3, iThang4,bQuy);
     using (MemoryStream ms = new MemoryStream())
     {
         xls.Save(ms);
         ms.Position = 0;
         clsResult.ms = ms;
         clsResult.FileName = "rptQTQS_ThuongXuyen.xls";
         clsResult.type = "xls";
         return clsResult;
     }
 }
 public clsExcelResult ExportToExcel(String iID_MaDonVi, String iNamLamViec, String iID_MaTaiKhoan, String iThang1, String iThang2)
 {
     HamChung.Language();
     clsExcelResult clsResult = new clsExcelResult();
     ExcelFile xls = CreateReport(Server.MapPath(sFilePath), iID_MaDonVi, iNamLamViec, iID_MaTaiKhoan, iThang1, iThang2);
     using (MemoryStream ms = new MemoryStream())
     {
         xls.Save(ms);
         ms.Position = 0;
         clsResult.ms = ms;
         clsResult.FileName = "ChoDoanhnghiep.xls";
         clsResult.type = "xls";
         return clsResult;
     }
 }
        public clsExcelResult ExportToExcel(String NamLamViec)
        {
            clsExcelResult clsResult = new clsExcelResult();
            ExcelFile xls = CreateReport(Server.MapPath(sFilePath), NamLamViec);

            using (MemoryStream ms = new MemoryStream())
            {
                xls.Save(ms);
                ms.Position = 0;
                clsResult.ms = ms;
                clsResult.FileName = "rptQLDA_QTHT_02QTHT.xls";
                clsResult.type = "xls";
                return clsResult;
            }
        }
 public clsExcelResult ExportToExcel(String iNamLamViec, String iThang,String iTrangThai)
 {
     HamChung.Language();
     clsExcelResult clsResult = new clsExcelResult();
     ExcelFile xls = CreateReport(Server.MapPath(sFilePath), iNamLamViec, iThang, iTrangThai);
     using (MemoryStream ms = new MemoryStream())
     {
         xls.Save(ms);
         ms.Position = 0;
         clsResult.ms = ms;
         clsResult.FileName = "rptChiTietTaiKhoanTheoDonVi1.xls";
         clsResult.type = "xls";
         return clsResult;
     }
 }
        /// <summary>
        /// Hàm xuất dữ liệu ra file excel
        /// </summary>
        /// <param name="NamLamViec"></param>
        /// <returns></returns>
        public clsExcelResult ExportToExcel(String MaND, String iID_MaTrangThaiDuyet)
        {
            HamChung.Language();
            clsExcelResult clsResult = new clsExcelResult();
            ExcelFile xls = CreateReport(Server.MapPath(sFilePath), MaND, iID_MaTrangThaiDuyet);

            using (MemoryStream ms = new MemoryStream())
            {
                xls.Save(ms);
                ms.Position = 0;
                clsResult.ms = ms;
                clsResult.FileName = "DT_CNSQP_TuyVien"+Convert.ToString(DateTime.Now)+".xls";
                clsResult.type = "xls";
                return clsResult;
            }
        }
        /// <summary>
        /// hàm xuất dữ liệu ra file Excel
        /// </summary>
        /// <param name="NamLamViec"></param>
        /// <param name="sLNS"></param>
        /// <returns></returns>
        public clsExcelResult ExportToExcel(String NamLamViec, String iID_MaTrangThaiDuyet)
        {
            HamChung.Language();
            clsExcelResult clsResult = new clsExcelResult();
            ExcelFile xls = CreateReport(Server.MapPath(sFilePath), NamLamViec, iID_MaTrangThaiDuyet);

            using (MemoryStream ms = new MemoryStream())
            {
                xls.Save(ms);
                ms.Position = 0;
                clsResult.ms = ms;
                clsResult.FileName = "DuToanChiNganSach4d2-C.xls";
                clsResult.type = "xls";
                return clsResult;
            }
        }
 public clsExcelResult ExportToExcel(String iID_MaTaiKhoan)
 {
     HamChung.Language();
     String DuongDanFile = sFilePath_A3;
     clsExcelResult clsResult = new clsExcelResult();
     ExcelFile xls = CreateReport(Server.MapPath(DuongDanFile), iID_MaTaiKhoan);
     using (MemoryStream ms = new MemoryStream())
     {
         xls.Save(ms);
         ms.Position = 0;
         clsResult.ms = ms;
         clsResult.FileName = "DanhMuc_TaiKhoanChiTiet.xls";
         clsResult.type = "xls";
         return clsResult;
     }
 }
 public clsExcelResult ExportToExcel(String NamLamViec, String ThangLamViec, String TrangThai)
 {
     HamChung.Language();
     String DuongDanFile = sFilePath_A3;
     clsExcelResult clsResult = new clsExcelResult();
     ExcelFile xls = CreateReport(Server.MapPath(DuongDanFile), NamLamViec, ThangLamViec, TrangThai);
     using (MemoryStream ms = new MemoryStream())
     {
         xls.Save(ms);
         ms.Position = 0;
         clsResult.ms = ms;
         clsResult.FileName = "KeToan_QuyetToanNam.xls";
         clsResult.type = "xls";
         return clsResult;
     }
 }
 public clsExcelResult ExportToExcel(String iNam, String iThang, String optThu, String optTamUng, String optTra,String KhoGiay)
 {
     HamChung.Language();
     String DuongDan = "";
     if (KhoGiay == "1") DuongDan = sFilePath_a3;
     else DuongDan = sFilePath_a4;
     clsExcelResult clsResult = new clsExcelResult();
     ExcelFile xls = CreateReport(Server.MapPath(DuongDan), iNam, iThang, optThu, optTamUng, optTra,KhoGiay);
     using (MemoryStream ms = new MemoryStream())
     {
         xls.Save(ms);
         ms.Position = 0;
         clsResult.ms = ms;
         clsResult.FileName = "GiaiThichSoDu.xls";
         clsResult.type = "xls";
         return clsResult;
     }
 }
        public clsExcelResult ExportToExcel(String MaND, String ThangQuy, String LoaiThang_Quy, String iID_MaDonVi, String iID_MaNhomDonVi, String LuyKe, String iID_MaTrangThaiDuyet, String KhoGiay, String BaoHiem,String iLoai)
        {
            clsExcelResult clsResult = new clsExcelResult();
            HamChung.Language();
            String sFilePath = "";
            if (KhoGiay == "0")
            {
                if (BaoHiem == "0" || BaoHiem == "1" || BaoHiem == "2")
                {
                    sFilePath = "/Report_ExcelFrom/BaoHiem/rptBH_TongQuyetToan1.xls";
                }
                else if (BaoHiem == "3")
                {
                    sFilePath = "/Report_ExcelFrom/BaoHiem/rptBH_TongQuyetToanCN.xls";
                }
                else if (BaoHiem == "4")
                {
                    sFilePath = "/Report_ExcelFrom/BaoHiem/rptBH_TongQuyetToanDV.xls";
                }
                else
                {
                    sFilePath = "/Report_ExcelFrom/BaoHiem/rptBH_TongQuyetToanTH.xls";
                }
            }

            else
            {

                if (BaoHiem == "0" || BaoHiem == "1" || BaoHiem == "2")
                {
                    sFilePath = "/Report_ExcelFrom/BaoHiem/rptBH_TongQuyetToan1A3.xls";
                }
                else if (BaoHiem == "3")
                {
                    sFilePath = "/Report_ExcelFrom/BaoHiem/rptBH_TongQuyetToanCNA3.xls";
                }
                else if (BaoHiem == "4")
                {
                    sFilePath = "/Report_ExcelFrom/BaoHiem/rptBH_TongQuyetToanDVA3.xls";
                }
                else
                {
                    sFilePath = "/Report_ExcelFrom/BaoHiem/rptBH_TongQuyetToanTH.xls";
                }
            }
            ExcelFile xls = CreateReport(Server.MapPath(sFilePath), MaND, ThangQuy, LoaiThang_Quy, iID_MaDonVi, iID_MaNhomDonVi, LuyKe, iID_MaTrangThaiDuyet, KhoGiay, BaoHiem,iLoai);

            using (MemoryStream ms = new MemoryStream())
            {
                xls.Save(ms);
                ms.Position = 0;
                clsResult.ms = ms;
                //if (KhoGiay == "1")
                //{
                //    clsResult.FileName = "baocaoquyettoanChiCacCheDoBHXH.xls";
                //}
                //else
                //{
                //    clsResult.FileName = "baocaoquyettoanChiCacCheDoBHXH_A4.xls";
                //}
                clsResult.type = "xls";
                return clsResult;
            }
        }
 /// <summary>
 /// Xuất báo cáo ra file PDF
 /// </summary>
 /// <param name="Nam">Năm làm việc</param>
 /// <param name="MaDV">Mã doanh nghiệp</param>
 /// <returns></returns>
 public clsExcelResult ExportToPDF(String Quy, String Nam, String MaDN)
 {
     HamChung.Language();
     clsExcelResult clsResult = new clsExcelResult();
     ExcelFile xls = CreateReport(Server.MapPath(sFilePath),Quy,Nam,MaDN);
     using (FlexCelPdfExport pdf = new FlexCelPdfExport())
     {
         pdf.Workbook = xls;
         using (MemoryStream ms = new MemoryStream())
         {
             pdf.BeginExport(ms);
             pdf.ExportAllVisibleSheets(false, "AA");
             pdf.EndExport();
             ms.Position = 0;
             clsResult.FileName = "Test.pdf";
             clsResult.type = "pdf";
             clsResult.ms = ms;
             return clsResult;
         }
     }
 }
 /// <summary>
 /// Xuất báo cáo ra file Excel
 /// </summary>
 /// <param name="Nam">Năm làm việc</param>
 /// <param name="MaDV">Mã doanh nghiệp</param>
 /// <returns></returns>
 public clsExcelResult ExportToExcel(String Quy, String Nam, String MaDN)
 {
     HamChung.Language();
     clsExcelResult clsResult = new clsExcelResult();
     ExcelFile xls = CreateReport(Server.MapPath(sFilePath), Quy,Nam,MaDN);
     using (MemoryStream ms = new MemoryStream())
     {
         xls.Save(ms);
         ms.Position = 0;
         clsResult.ms = ms;
         clsResult.FileName = "HoatDong_KD_"+Nam+".xls";
         clsResult.type = "xls";
         return clsResult;
     }
 }
        public clsExcelResult ExportToExcel(String NgoaiTe, string vidDenNgay)
        {
            String DuongDanFile = sFilePath;
            // DateTime dNgay = Convert.ToDateTime(CommonFunction.LayNgayTuXau(vidDenNgay));
            clsExcelResult clsResult = new clsExcelResult();
            ExcelFile xls = CreateReport(Server.MapPath(DuongDanFile), NgoaiTe, vidDenNgay);

            using (MemoryStream ms = new MemoryStream())
            {
                xls.Save(ms);
                ms.Position = 0;
                clsResult.ms = ms;
                clsResult.FileName = "rptKHV_Bieu02VDT" + String.Format("{0:ddMMyyyyhhmmss}", DateTime.Now) + ".xls";
                clsResult.type = "xls";
                return clsResult;
            }
        }
        public clsExcelResult ExportToPDF(String iID_MaTrangThaiDuyet, String iID_MaDonVi, String dNgayCapPhat, String iDM_MaLoaiCapPhat, String LuyKe, String LoaiBaoCao)
        {
            HamChung.Language();
            String DuongDan = "";
            if (LoaiBaoCao == "Muc")
            {
                DuongDan = sFilePathMuc;
            }
            else if (LoaiBaoCao == "TieuMuc")
            {
                DuongDan = sFilePathTieuMuc;
            }
            else
            {
                DuongDan = sFilePathNganh;
            }
            clsExcelResult clsResult = new clsExcelResult();
            ExcelFile xls = CreateReport(Server.MapPath(DuongDan), iID_MaTrangThaiDuyet, iID_MaDonVi, dNgayCapPhat, iDM_MaLoaiCapPhat, LuyKe, LoaiBaoCao);
            using (FlexCelPdfExport pdf = new FlexCelPdfExport())
            {
                pdf.Workbook = xls;
                using (MemoryStream ms = new MemoryStream())
                {
                    pdf.BeginExport(ms);
                    pdf.ExportAllVisibleSheets(false, "AA");
                    pdf.EndExport();
                    ms.Position = 0;
                    clsResult.FileName = "Test.pdf";
                    clsResult.type = "pdf";
                    clsResult.ms = ms;
                    return clsResult;
                }

            }
        }
        /// <summary>
        /// Xuất ra excel
        /// </summary>
        /// <param name="NamLamViec"></param>
        /// <param name="iID_MaDonVi"></param>
        /// <param name="dNgayCapPhat"></param>
        /// <param name="iDM_MaLoaiCapPhat"></param>
        /// <param name="LuyKe"></param>
        /// <param name="LoaiBaoCao"></param>
        /// <returns></returns>
        public clsExcelResult ExportToExcel(String iID_MaTrangThaiDuyet, String iID_MaDonVi, String dNgayCapPhat, String iDM_MaLoaiCapPhat, String LuyKe, String LoaiBaoCao)
        {
            HamChung.Language();
            String DuongDan = "";
            if (LoaiBaoCao == "Muc")
            {
                DuongDan = sFilePathMuc;
            }
            else if (LoaiBaoCao == "TieuMuc")
            {
                DuongDan = sFilePathTieuMuc;
            }
            else
            {
                DuongDan = sFilePathNganh;
            }

            clsExcelResult clsResult = new clsExcelResult();
            ExcelFile xls = CreateReport(Server.MapPath(DuongDan), iID_MaTrangThaiDuyet, iID_MaDonVi, dNgayCapPhat, iDM_MaLoaiCapPhat, LuyKe, LoaiBaoCao);

            using (MemoryStream ms = new MemoryStream())
            {
                xls.Save(ms);
                ms.Position = 0;
                clsResult.ms = ms;
                clsResult.FileName = "CapPhat_79_3.xls";
                clsResult.type = "xls";
                return clsResult;
            }
        }
 public clsExcelResult ExportToPDF(String NamLamViec, String Thang_Quy, String LoaiThang_Quy, String inmuc, String iID_MaNguonNganSach, String iID_MaNamNganSach, String iID_MaTrangThaiDuyet)
 {
     HamChung.Language();
     String DuongDan = "";
     DuongDan = PathFile(inmuc, DuongDan);
     clsExcelResult clsResult = new clsExcelResult();
     ExcelFile xls = CreateReport(Server.MapPath(DuongDan), NamLamViec, Thang_Quy, LoaiThang_Quy, inmuc, iID_MaNguonNganSach, iID_MaNamNganSach, iID_MaTrangThaiDuyet);
     using (FlexCelPdfExport pdf = new FlexCelPdfExport())
     {
         pdf.Workbook = xls;
         using (MemoryStream ms = new MemoryStream())
         {
             pdf.BeginExport(ms);
             pdf.ExportAllVisibleSheets(false, "AA");
             pdf.EndExport();
             ms.Position = 0;
             clsResult.FileName = "Test.pdf";
             clsResult.type = "pdf";
             clsResult.ms = ms;
             return clsResult;
         }
     }
 }
        public clsExcelResult ExportToExcel(String NamLamViec, String Thang_Quy, String LoaiThang_Quy, String inmuc, String iID_MaNguonNganSach, String iID_MaNamNganSach, String iID_MaTrangThaiDuyet)
        {
            String DuongDan = "";
            DuongDan = PathFile(inmuc, DuongDan);
            HamChung.Language();
            clsExcelResult clsResult = new clsExcelResult();
            ExcelFile xls = CreateReport(Server.MapPath(DuongDan), NamLamViec, Thang_Quy, LoaiThang_Quy, inmuc, iID_MaNguonNganSach, iID_MaNamNganSach, iID_MaTrangThaiDuyet);
            using (MemoryStream ms = new MemoryStream())
            {
                xls.Save(ms);
                ms.Position = 0;
                clsResult.ms = ms;
                clsResult.FileName = "ChoDoanhnghiep.xls";
                clsResult.type = "xls";

                return clsResult;
            }
        }
        //<summary>
        //Hàm thực hiện việc xuất dữ liệu ra file excel
        //</summary>
        //<param name="NamLamViec"></param>
        //<param name="sLNS"></param>
        //<param name="iID_MaDotPhanBo"></param>
        //<param name="TruongTien"></param>
        //<returns></returns>
        public clsExcelResult ExportToExcel(String MaND, String sLNS, String iID_MaDotPhanBo, String iID_MaTrangThaiDuyet, String TruongTien, String KhoGiay, String LuyKe, String ToSo)
        {
            HamChung.Language();
            String DuongDan = "";
            if (LuyKe != "on")
            {
                if (KhoGiay == "1")
                {
                    if (ToSo == "1") DuongDan = sFilePath_A3_1_RG;
                    else DuongDan = sFilePath_A3_2_RG;
                }
                else
                {
                    if (ToSo == "1") DuongDan = sFilePath_A4_1_RG;
                    else DuongDan = sFilePath_A4_2_RG;
                }
            }
            else
            {
                if (KhoGiay == "1")
                {
                    if (ToSo == "1") DuongDan = sFilePath_A3_1;
                    else DuongDan = sFilePath_A3_2;
                }
                else
                {
                    if (ToSo == "1") DuongDan = sFilePath_A4_1;
                    else DuongDan = sFilePath_A4_2;
                }
            }
            clsExcelResult clsResult = new clsExcelResult();
            ExcelFile xls = CreateReport(Server.MapPath(DuongDan), MaND, sLNS, iID_MaDotPhanBo, iID_MaTrangThaiDuyet, TruongTien, KhoGiay, LuyKe, ToSo);

            using (MemoryStream ms = new MemoryStream())
            {
                xls.Save(ms);
                ms.Position = 0;
                clsResult.ms = ms;
                clsResult.FileName = "TongHopChiTieuDonVi.xls";
                clsResult.type = "xls";
                return clsResult;
            }
        }
        /// <summary>
        /// Xuát ra Excel
        /// </summary>
        /// <param name="NamLamViec"></param>
        /// <param name="iID_MaDonVi"></param>
        /// <returns></returns>
        public clsExcelResult ExportToExcel(String MaND, String iID_MaDonVi, String iID_MaDanhMuc, String sLNS, String iID_MaTrangThaiDuyet, String Check)
        {
            HamChung.Language();
            clsExcelResult clsResult = new clsExcelResult();
            String sFilePath = "";
            if (Check == "off")
            {
                sFilePath = "/Report_ExcelFrom/DuToan/rptDT_ChiNganSachSD_II_02.xls";
            }
            else
            {
                sFilePath = "/Report_ExcelFrom/DuToan/rptDT_Chi_SuDungNganSachNam.xls";
            }
            ExcelFile xls = CreateReport(Server.MapPath(sFilePath), MaND, iID_MaDonVi, iID_MaDanhMuc, sLNS, iID_MaTrangThaiDuyet, Check);

            using (MemoryStream ms = new MemoryStream())
            {
                xls.Save(ms);
                ms.Position = 0;
                clsResult.ms = ms;
                clsResult.FileName = "rptDT_ChiNganSachSD_II_02.xls";
                clsResult.type = "xls";
                return clsResult;
            }
        }
        public clsExcelResult ExportToPDF(String MaND, String ThangQuy, String LoaiThang_Quy, String iID_MaDonVi, String iID_MaNhomDonVi, String LuyKe, String iID_MaTrangThaiDuyet, String KhoGiay, String BaoHiem,String iLoai)
        {
            clsExcelResult clsResult = new clsExcelResult();
            HamChung.Language();
            String sFilePath = "";
            if (KhoGiay == "0")
            {
                if (BaoHiem == "0" || BaoHiem == "1" || BaoHiem == "2")
                {
                    sFilePath = "/Report_ExcelFrom/BaoHiem/rptBH_TongQuyetToan1.xls";
                }
                else if (BaoHiem == "3")
                {
                    sFilePath = "/Report_ExcelFrom/BaoHiem/rptBH_TongQuyetToanCN.xls";
                }
                else if (BaoHiem == "4")
                {
                    sFilePath = "/Report_ExcelFrom/BaoHiem/rptBH_TongQuyetToanDV.xls";
                }
                else
                {
                    sFilePath = "/Report_ExcelFrom/BaoHiem/rptBH_TongQuyetToanTH.xls";
                }
            }

            else
            {

                if (BaoHiem == "0" || BaoHiem == "1" || BaoHiem == "2")
                {
                    sFilePath = "/Report_ExcelFrom/BaoHiem/rptBH_TongQuyetToan1A3.xls";
                }
                else if (BaoHiem == "3")
                {
                    sFilePath = "/Report_ExcelFrom/BaoHiem/rptBH_TongQuyetToanCNA3.xls";
                }
                else if (BaoHiem == "4")
                {
                    sFilePath = "/Report_ExcelFrom/BaoHiem/rptBH_TongQuyetToanDVA3.xls";
                }
                else
                {
                    sFilePath = "/Report_ExcelFrom/BaoHiem/rptBH_TongQuyetToanTH.xls";
                }
            }
            ExcelFile xls = CreateReport(Server.MapPath(sFilePath), MaND, ThangQuy, LoaiThang_Quy, iID_MaDonVi, iID_MaNhomDonVi, LuyKe, iID_MaTrangThaiDuyet, KhoGiay, BaoHiem,iLoai);
            using (FlexCelPdfExport pdf = new FlexCelPdfExport())
            {
                pdf.Workbook = xls;
                using (MemoryStream ms = new MemoryStream())
                {
                    pdf.BeginExport(ms);
                    pdf.ExportAllVisibleSheets(false, "AA");
                    pdf.EndExport();
                    ms.Position = 0;
                    clsResult.FileName = "Test.pdf";
                    clsResult.type = "pdf";
                    clsResult.ms = ms;
                    return clsResult;
                }

            }
        }
        /// <summary>
        /// Xuất ra file Excel
        /// </summary>
        /// <param name="NamLamViec"></param>
        /// <returns></returns>
        public clsExcelResult ExportToExcel(String MaND, String iID_MaDonVi, String iID_MaTrangThaiDuyet)
        {
            clsExcelResult clsResult = new clsExcelResult();
            ExcelFile xls = CreateReport(Server.MapPath(sFilePath), MaND, iID_MaDonVi, iID_MaTrangThaiDuyet);

            using (MemoryStream ms = new MemoryStream())
            {
                xls.Save(ms);
                ms.Position = 0;
                clsResult.ms = ms;
                clsResult.FileName = "DTCNS_QP_Nam_TuyVien_DonVi.xls";
                clsResult.type = "xls";
                return clsResult;
            }
        }
        /// <summary>
        /// Hàm xuất dữ liệu ra file excel
        /// </summary>
        /// <param name="NamLamViec"></param>
        /// <returns></returns>
        public clsExcelResult ExportToExcel(String MaND, String iID_MaPhongBan)
        {
            clsExcelResult clsResult = new clsExcelResult();
            ExcelFile xls = CreateReport(Server.MapPath(sFilePath), MaND, iID_MaPhongBan);

            using (MemoryStream ms = new MemoryStream())
            {
                xls.Save(ms);
                ms.Position = 0;
                clsResult.ms = ms;
                clsResult.FileName = "DuToan_1020200_TongHop.xls";
                clsResult.type = "xls";
                return clsResult;
            }
        }
 /// <summary>
 /// Xuất báo cáo ra file Excel
 /// </summary>
 /// <param name="NamLamViec">Năm</param>
 /// <param name="Thang_Quy">Tháng | Quý</param>
 /// <param name="LoaiThang_Quy">1: Quý | 0: Tháng</param>
 /// <param name="LoaiBaoCao">Loại báo cáo in ra</param>
 /// <param name="inmuc">In đến mục loại khoản - mục - tiểu mục</param>
 /// <param name="iID_MaNguonNganSach">Nguồn ngân sách</param>
 /// <param name="iGom">On: Ghép 2 báo cáo trên file | off: Ngược lại</param>
 /// <param name="UserID">Người dùng</param>
 /// <returns></returns>
 public clsExcelResult ExportToExcel(String NamLamViec, String Thang_Quy, String LoaiThang_Quy, String LoaiBaoCao, String inmuc, String iID_MaNguonNganSach, String iGom, String UserID)
 {
     String DuongDan = "";
     DuongDan = GetPath(LoaiBaoCao, iGom, DuongDan);
     clsExcelResult clsResult = new clsExcelResult();
     ExcelFile xls = CreateReport(Server.MapPath(DuongDan), NamLamViec, Thang_Quy, LoaiThang_Quy, LoaiBaoCao, inmuc, iID_MaNguonNganSach, iGom,UserID);
     using (MemoryStream ms = new MemoryStream())
     {
         xls.Save(ms);
         ms.Position = 0;
         clsResult.ms = ms;
         clsResult.FileName = "DoiChieuDuToan.xls";
         clsResult.type = "xls";
         return clsResult;
     }
 }
 /// <summary>
 /// Xuất báo cáo ra file Excel
 /// </summary>
 /// <param name="iThang">Tháng quân số</param>
 /// <param name="iNam">Năm quân số</param>
 /// <param name="iAll">Tổng hợp tất cả đơn vị</param>
 /// <param name="iMaDV">Mã đơn vị</param>
 /// <returns></returns>
 public clsExcelResult ExportToExcel(String iThang, String iID_MaTrangThaiDuyet, String iAll, String iMaDV)
 {
     HamChung.Language();
     clsExcelResult clsResult = new clsExcelResult();
     ExcelFile xls = CreateReport(Server.MapPath(sFilePath), iThang, iID_MaTrangThaiDuyet, iAll, iMaDV);
     using (MemoryStream ms = new MemoryStream())
     {
         xls.Save(ms);
         ms.Position = 0;
         clsResult.ms = ms;
         clsResult.FileName = "THQS_BinhQuan.xls";
         clsResult.type = "xls";
         return clsResult;
     }
 }
        /// <summary>
        /// xuất ra PDF
        /// </summary>
        /// <param name="NamLamViec"></param>
        /// <param name="iID_MaDonVi"></param>
        /// <returns></returns>
        public clsExcelResult ExportToPDF(String MaND, String iID_MaDonVi, String iID_MaDanhMuc, String sLNS, String iID_MaTrangThaiDuyet, String Check)
        {
            HamChung.Language();
            clsExcelResult clsResult = new clsExcelResult();
            String sFilePath = "";
            if (Check == "off")
            {
                sFilePath = "/Report_ExcelFrom/DuToan/rptDT_ChiNganSachSD_II_02.xls";
            }
            else
            {
                sFilePath = "/Report_ExcelFrom/DuToan/rptDT_Chi_SuDungNganSachNam.xls";
            }
            ExcelFile xls = CreateReport(Server.MapPath(sFilePath), MaND, iID_MaDonVi, iID_MaDanhMuc, sLNS, iID_MaTrangThaiDuyet, Check);
            using (FlexCelPdfExport pdf = new FlexCelPdfExport())
            {
                pdf.Workbook = xls;
                using (MemoryStream ms = new MemoryStream())
                {
                    pdf.BeginExport(ms);
                    pdf.ExportAllVisibleSheets(false, "AA");
                    pdf.EndExport();
                    ms.Position = 0;
                    clsResult.FileName = "Test.pdf";
                    clsResult.type = "pdf";
                    clsResult.ms = ms;
                    return clsResult;
                }

            }
        }
        /// <summary>
        /// hàm xuất dữ liệu ra file Excel
        /// </summary>
        /// <param name="iID_MaDonVi"></param>
        /// <param name="iID_MaTrangThaiDuyet"></param>
        /// <returns></returns>
        public clsExcelResult ExportToExcel( String iID_MaTrangThaiDuyet, String iID_MaSanPham, String iID_MaChiTietGia)
        {
            clsExcelResult clsResult = new clsExcelResult();
            ExcelFile xls = CreateReport(Server.MapPath(sFilePath),  iID_MaTrangThaiDuyet, iID_MaSanPham, iID_MaChiTietGia);

            using (MemoryStream ms = new MemoryStream())
            {
                xls.Save(ms);
                ms.Position = 0;
                clsResult.ms = ms;
                clsResult.FileName = "BangGiaiTrinhChiTietTinhGiaSanPham.xls";
                clsResult.type = "xls";
                return clsResult;
            }
        }
 //<summary>
 //Hàm View PDF
 //</summary>
 //<param name="NamLamViec"></param>
 //<param name="sLNS"></param>
 //<param name="iID_MaDotPhanBo"></param>
 //<param name="TruongTien"></param>
 //<returns></returns>
 public ActionResult ViewPDF(String MaND, String sLNS, String iID_MaDotPhanBo, String iID_MaTrangThaiDuyet, String TruongTien, String KhoGiay, String LuyKe, String ToSo)
 {
     HamChung.Language();
     String DuongDan = "";
     if (LuyKe != "on")
     {
         if (KhoGiay == "1")
         {
             if (ToSo == "1") DuongDan = sFilePath_A3_1_RG;
             else DuongDan = sFilePath_A3_2_RG;
         }
         else
         {
             if (ToSo == "1") DuongDan = sFilePath_A4_1_RG;
             else DuongDan = sFilePath_A4_2_RG;
         }
     }
     else
     {
         if (KhoGiay == "1")
         {
             if (ToSo == "1") DuongDan = sFilePath_A3_1;
             else DuongDan = sFilePath_A3_2;
         }
         else
         {
             if (ToSo == "1") DuongDan = sFilePath_A4_1;
             else DuongDan = sFilePath_A4_2;
         }
     }
     clsExcelResult clsResult = new clsExcelResult();
     ExcelFile xls = CreateReport(Server.MapPath(DuongDan), MaND, sLNS, iID_MaDotPhanBo, iID_MaTrangThaiDuyet, TruongTien, KhoGiay, LuyKe, ToSo);
     using (FlexCelPdfExport pdf = new FlexCelPdfExport())
     {
         pdf.Workbook = xls;
         using (MemoryStream ms = new MemoryStream())
         {
             pdf.BeginExport(ms);
             pdf.ExportAllVisibleSheets(false, "BaoCao");
             pdf.EndExport();
             ms.Position = 0;
             return File(ms.ToArray(), "application/pdf");
         }
     }
     return null;
 }
        /// <summary>
        /// hàm xuất dữ liệu ra file PDF
        /// </summary>
        /// <param name="iID_MaDonVi"></param>
        /// <param name="iID_MaTrangThaiDuyet"></param>
        /// <returns></returns>
        public clsExcelResult ExportToPDF( String iID_MaTrangThaiDuyet, String iID_MaSanPham, String iID_MaChiTietGia)
        {
            clsExcelResult clsResult = new clsExcelResult();
            ExcelFile xls = CreateReport(Server.MapPath(sFilePath),  iID_MaTrangThaiDuyet, iID_MaSanPham, iID_MaChiTietGia);
            using (FlexCelPdfExport pdf = new FlexCelPdfExport())
            {
                pdf.Workbook = xls;
                using (MemoryStream ms = new MemoryStream())
                {
                    pdf.BeginExport(ms);
                    pdf.ExportAllVisibleSheets(false, "AA");
                    pdf.EndExport();
                    ms.Position = 0;
                    clsResult.FileName = "Test.pdf";
                    clsResult.type = "pdf";
                    clsResult.ms = ms;
                    return clsResult;
                }

            }
        }