Exemple #1
0
        private void radButton1_Click(object sender, EventArgs e)
        {
            Telerik.Reporting.Processing.ReportProcessor reportProcessor = new Telerik.Reporting.Processing.ReportProcessor();

            //set any deviceInfo settings if necessary
            System.Collections.Hashtable deviceInfo = new System.Collections.Hashtable();

            //Print Slip Gaji
            rptBarangKeluarTabel rpt1 = new rptBarangKeluarTabel();

            rpt1.ReportParameters[0].Value = DateTime.Now;
            //gj.ReportParameters["User"].Value = NBConfig.ValidUserName;
            IReportDocument report1 = (IReportDocument)rpt1;

            Telerik.Reporting.Processing.RenderingResult result = reportProcessor.RenderReport("XLS", report1, deviceInfo);
            string fileName = "SURATJALAN_" + DateTime.Now.ToString("ddMMMyy") + "." + result.Extension;

            const string path     = @"\\sinarekserver\forms\";
            string       filePath = System.IO.Path.Combine(path, fileName);

            using (System.IO.FileStream fs = new System.IO.FileStream(filePath, System.IO.FileMode.Create))
            {
                fs.Write(result.DocumentBytes, 0, result.DocumentBytes.Length);
            }
        }
Exemple #2
0
        /// <summary>
        /// Save Report to a file to a specified location
        /// </summary>
        /// <param name="rptDoc"></param>
        /// <param name="Location"></param>
        internal static void SavedToPDF(IReportDocument rptDoc, string Location)
        {
            Telerik.Reporting.Processing.ReportProcessor reportProcessor = new Telerik.Reporting.Processing.ReportProcessor();

            //set any deviceInfo settings if necessary
            System.Collections.Hashtable deviceInfo = new System.Collections.Hashtable();

            InstanceReportSource reportSource = new InstanceReportSource();

            reportSource.ReportDocument = rptDoc;

            Telerik.Reporting.Processing.RenderingResult result = reportProcessor.RenderReport("PDF", reportSource, deviceInfo);
            string fileName = result.DocumentName + "." + result.Extension;
            string filePath = System.IO.Path.Combine(Location, fileName);

            using (System.IO.FileStream fs = new System.IO.FileStream(filePath, System.IO.FileMode.Create))
            {
                fs.Write(result.DocumentBytes, 0, result.DocumentBytes.Length);
            }
        }
        private static void CreateLetterToPutInFrontOfNote(FaxTelephoneNumber faxTelephoneNumber, SignedDocument document)
        {
            Correspondence letter = new Correspondence();
            letter.TodaysDate = DateTime.Now.ToLongDateString();
            letter.MessageFrom = "A patient communications update from the office of " + document.CareProviderName;

            if (string.IsNullOrEmpty(faxTelephoneNumber.AddressLine1))
            {
                faxTelephoneNumber.AddressLine1 = string.Empty;
            }

            if (string.IsNullOrEmpty(faxTelephoneNumber.AddressLine2))
            {
                faxTelephoneNumber.AddressLine2 = string.Empty;
            }

            if (string.IsNullOrEmpty(faxTelephoneNumber.City))
            {
                faxTelephoneNumber.City = string.Empty;
            }
            else
            {
                faxTelephoneNumber.City = faxTelephoneNumber.City + ", ";
            }

            if (string.IsNullOrEmpty(faxTelephoneNumber.State))
            {
                faxTelephoneNumber.State = string.Empty;
            }
            else
            {
                faxTelephoneNumber.State = faxTelephoneNumber.State + " ";
            }

            if (string.IsNullOrEmpty(faxTelephoneNumber.PostalCode))
            {
                faxTelephoneNumber.PostalCode = string.Empty;
            }

            if (faxTelephoneNumber.AddressLine2.Length > 0)
            {
                letter.HeaderText = faxTelephoneNumber.Name + Environment.NewLine
                    + faxTelephoneNumber.AddressLine1 + Environment.NewLine
                    + faxTelephoneNumber.AddressLine2 + Environment.NewLine
                    + faxTelephoneNumber.City
                    + faxTelephoneNumber.State + faxTelephoneNumber.PostalCode;
            }
            else
            {
                string[] credential = faxTelephoneNumber.FullName.Split(' ');
                faxTelephoneNumber.Name = credential[1] + " " + credential[0] + " " + credential[credential.Length - 1];

                letter.HeaderText = credential[1] + " " + credential[0] + " " + credential[credential.Length - 1] + Environment.NewLine
                     + faxTelephoneNumber.AddressLine1 + Environment.NewLine
                     + faxTelephoneNumber.City
                     + faxTelephoneNumber.State + faxTelephoneNumber.PostalCode;
            }

            letter.BodyText = "I saw your patient " + document.PatientName
                + " at your request in consultation regarding the patient’s  orthopedic problem.  "
                + " Thank you for your kind referral." + Environment.NewLine + Environment.NewLine
                + "I’ve enclosed a copy of our office notes which includes "
                + "the diagnosis and treatment plan.  I will continue to keep you updated in the future with "
                + "regard to our patient’s progress .  Please let me know if I can answer any further questions "
                + "regarding our patient’s care." + Environment.NewLine + Environment.NewLine + Environment.NewLine
                + "All the Best,"
                + Environment.NewLine + Environment.NewLine + Environment.NewLine + Environment.NewLine + Environment.NewLine + Environment.NewLine + Environment.NewLine
                + document.CareProviderName
                + Environment.NewLine + Environment.NewLine
                + "Enclosure"
            ;

            AutomatedFaxReports.Letter report1 = new AutomatedFaxReports.Letter(letter);
            Telerik.Reporting.Processing.ReportProcessor reportProcessor = new Telerik.Reporting.Processing.ReportProcessor();
            Telerik.Reporting.InstanceReportSource instanceReportSource = new Telerik.Reporting.InstanceReportSource();
            instanceReportSource.ReportDocument = report1;
            Telerik.Reporting.Processing.RenderingResult result = reportProcessor.RenderReport("PDF", instanceReportSource, null);
            using (var pdfStream = new MemoryStream(result.DocumentBytes))
            using (var reportFile = new FileStream(ConfigurationValues.CorrespondensePath, FileMode.Create))
            {
                pdfStream.CopyTo(reportFile);
            }

            PdfFileEditor pdfEditor = new PdfFileEditor();

            //    try
            //    {
            //        File.Delete(ConfigurationValues.FinalFaxPath);
            //    }
            //    catch { }

            ConfigurationValues.FinalFaxPath = System.Configuration.ConfigurationManager.AppSettings["finalFaxPath"] + Guid.NewGuid().ToString() + ".pdf";
            pdfEditor.Concatenate(ConfigurationValues.CorrespondensePath, ConfigurationValues.CreatePdfPath, ConfigurationValues.FinalFaxPath);

        }