public virtual CrystalDecisions.CrystalReports.Engine.ReportDocument CreateReport()
        {
            Certified_Leasing_Outline rpt = new Certified_Leasing_Outline();

            rpt.Site = this.Site;
            return(rpt);
        }
Example #2
0
        public void printReportOutline()
        {
            if (Session["Company_Values"] != null)
            {
                try
                {
                    string Company_Values = (string)Session["Company_Values"];

                    string[] Array_Company = Company_Values.Split('|');

                    Certified_Leasing_Outline rpt = new Certified_Leasing_Outline();
                    rpt.SetParameterValue("Company_Name", Array_Company[0]);
                    rpt.SetParameterValue("Company_Address", Array_Company[1]);
                    rpt.SetParameterValue("SubCompany_Address_1", Array_Company[2]);
                    rpt.SetParameterValue("SubCompany_Address_2", Array_Company[3]);
                    rpt.SetParameterValue("SubCompany_Address_3", Array_Company[4]);

                    CRV_Display_Report.ReportSource = rpt;

                    /// Export Report to PDF File with Save As Mode
                    /// rpt.ExportToHttpResponse(ExportFormatType.PortableDocFormat, Response, true, "Payment_Schedule_" + cls.Deps_no);
                    /// Response.End();

                    ExportReportOutline(rpt, Array_Company[0]);
                }
                catch (Exception ex)
                {
                    error = "Exception ==> Certified_Leasing : Page --> printReportOutline() ";
                    Log_Error._writeErrorFile(error, ex);
                }
            }

            GC.Collect();
        }
Example #3
0
        public void ExportReportOutline(Certified_Leasing_Outline rpt, string file_name)
        {
            try
            {
                /// Create Main Folder for Detected Images of Contact Leasing
                string mainDirectory = "OutlineReport";

                string mainDirectoryPath = "C:/ReportExport/" + mainDirectory;

                if (!Directory.Exists(mainDirectoryPath))
                {
                    Directory.CreateDirectory(mainDirectoryPath);
                }

                string FilePath = "C:/ReportExport/" + mainDirectory + "/หนังสือรับรองการเช่า-ซื้อ_template_" + file_name + ".pdf";

                if (File.Exists(FilePath))
                {
                    File.Delete(FilePath);
                }

                /// Export Report to PDF File with Save As Mode
                rpt.ExportToDisk(ExportFormatType.PortableDocFormat, @"C:/ReportExport/" + mainDirectory + "/หนังสือรับรองการเช่า-ซื้อ_template_" + file_name + ".pdf");

                /// Display PDF File to PDF Program
                /// Process process = new Process();
                /// process.StartInfo.UseShellExecute = true;
                /// process.StartInfo.FileName = FilePath;
                /// process.Start();

                WebClient User       = new WebClient();
                Byte[]    FileBuffer = User.DownloadData(FilePath);
                if (FileBuffer != null)
                {
                    Response.ContentType = "application/pdf";
                    Response.AddHeader("content-length", FileBuffer.Length.ToString());
                    Response.BinaryWrite(FileBuffer);
                }

                User.Dispose();
            }
            catch (Exception ex)
            {
                error = "Exception ==> Certified_Leasing : Page --> ExportReportOutline() ";
                Log_Error._writeErrorFile(error, ex);
            }

            rpt.Dispose();

            GC.Collect();
        }