예제 #1
0
파일: PrintUtils.cs 프로젝트: mahitosh/HRA4
        public HraHtmlDocument printHtmlDoc(int apptID, string unitnum, int templateID)
        {
            if (string.IsNullOrEmpty(printer) || printer.ToUpper() == "BATCH")
            {
                return null;
            }

            HraHtmlDocument hdoc = null;
            try
            {
                SessionManager.Instance.SetActivePatient(unitnum, apptID);

                hdoc = new HraHtmlDocument(templateID, unitnum, apptID);
                if (hdoc == null)
                {
                    Logger.Instance.WriteToLog("RiskApps3Automation.HtmlDocument(" + templateID.ToString() + ", " + apptID.ToString() + ", \"" + unitnum + "\") returned null");
                    return null;
                }
                hdoc.targetPrinter = printer;

                hdoc.apptid = apptID;
                if (printer.ToLower() != "batch")
                {
                    hdoc.Print();
                }
            }
            catch (Exception e)
            {
                Logger.Instance.WriteToLog("printHtmlDoc(" + apptID.ToString() + ", \"" + unitnum + "\", " + templateID.ToString() + ") " + e.ToString());
                return null;
            }
            return hdoc;
        }
예제 #2
0
파일: PrintUtils.cs 프로젝트: mahitosh/HRA4
        public HraHtmlDocument printHtmlDoc(int apptID, string unitnum, int templateID)
        {
            if (string.IsNullOrEmpty(printer) || printer.ToUpper() == "BATCH")
            {
                return(null);
            }

            HraHtmlDocument hdoc = null;

            try
            {
                SessionManager.Instance.SetActivePatient(unitnum, apptID);

                hdoc = new HraHtmlDocument(templateID, unitnum, apptID);
                if (hdoc == null)
                {
                    Logger.Instance.WriteToLog("RiskApps3Automation.HtmlDocument(" + templateID.ToString() + ", " + apptID.ToString() + ", \"" + unitnum + "\") returned null");
                    return(null);
                }
                hdoc.targetPrinter = printer;

                hdoc.apptid = apptID;
                if (printer.ToLower() != "batch")
                {
                    hdoc.Print();
                }
            }
            catch (Exception e)
            {
                Logger.Instance.WriteToLog("printHtmlDoc(" + apptID.ToString() + ", \"" + unitnum + "\", " + templateID.ToString() + ") " + e.ToString());
                return(null);
            }
            return(hdoc);
        }
예제 #3
0
파일: PrintUtils.cs 프로젝트: mahitosh/HRA4
        public bool savePdfDoc(int apptID, string unitnum, int templateID, string directory)
        {
            try
            {
                SessionManager.Instance.SetActivePatient(unitnum, apptID);
                directory = Configurator.GetDocumentStorage();   // override save location with config.xml
                if (directory.Substring(directory.Length - 1) != "\\")
                {
                    directory = directory + "\\";
                }
                string templateDirectory = Configurator.GetDocumentTemplateStorage();   // override save location with config.xml
                if (templateDirectory.Substring(templateDirectory.Length - 1) != "\\")
                {
                    templateDirectory = templateDirectory + "\\";
                }

                HraHtmlDocument hdoc = new HraHtmlDocument(templateID, unitnum, apptID);
                if (hdoc == null)
                {
                    Logger.Instance.WriteToLog("RiskApps3Automation.HtmlDocument(" + templateID.ToString() + ", " + apptID.ToString() + ", \"" + unitnum + "\") returned null");
                    return(false);
                }
                hdoc.apptid = apptID;

                FileInfo fInfo = hdoc.template.CalculateFileName(SessionManager.Instance.GetActivePatient().name,
                                                                 SessionManager.Instance.GetActivePatient().apptdatetime.ToShortDateString().Replace("/", "-"),
                                                                 SessionManager.Instance.GetActivePatient().apptid,
                                                                 SessionManager.Instance.GetActivePatient().unitnum,
                                                                 "pdf", directory);

                string PdfFileName = fInfo.FullName;

                DocumentTemplate.ConvertToPdf(hdoc.template.htmlText, PdfFileName);
            }
            catch (Exception e)
            {
                Logger.Instance.WriteToLog("saveHtmlDoc(" + apptID.ToString() + ", \"" + unitnum + "\", " + templateID.ToString() + ", \"" + directory + "\") " + e.ToString());
                return(false);
            }
            return(true);
        }
예제 #4
0
파일: PrintUtils.cs 프로젝트: mahitosh/HRA4
        public bool saveHtmlDoc(int apptID, string unitnum, int templateID, string directory)
        {
            try
            {
                SessionManager.Instance.SetActivePatient(unitnum, apptID);

                HraHtmlDocument hdoc = new HraHtmlDocument(templateID, unitnum, apptID);
                if (hdoc == null)
                {
                    Logger.Instance.WriteToLog("RiskApps3Automation.HtmlDocument(" + templateID.ToString() + ", " + apptID.ToString() + ", \"" + unitnum + "\") returned null");
                    return(false);
                }
                hdoc.apptid = apptID;
                hdoc.Save(directory);
            }
            catch (Exception e)
            {
                Logger.Instance.WriteToLog("saveHtmlDoc(" + apptID.ToString() + ", \"" + unitnum + "\", " + templateID.ToString() + ", \"" + directory + "\") " + e.ToString());
                return(false);
            }
            return(true);
        }
예제 #5
0
파일: PrintUtils.cs 프로젝트: mahitosh/HRA4
        public bool savePdfDoc(int apptID, string unitnum, int templateID, string directory)
        {
            try
            {
                SessionManager.Instance.SetActivePatient(unitnum, apptID);
                directory = Configurator.GetDocumentStorage();   // override save location with config.xml
                if (directory.Substring(directory.Length - 1) != "\\") directory = directory + "\\";
                string templateDirectory = Configurator.GetDocumentTemplateStorage();   // override save location with config.xml
                if (templateDirectory.Substring(templateDirectory.Length - 1) != "\\") templateDirectory = templateDirectory + "\\";

                HraHtmlDocument hdoc = new HraHtmlDocument(templateID, unitnum, apptID);
                if (hdoc == null)
                {
                    Logger.Instance.WriteToLog("RiskApps3Automation.HtmlDocument(" + templateID.ToString() + ", " + apptID.ToString() + ", \"" + unitnum + "\") returned null");
                    return false;
                }
                hdoc.apptid = apptID;

                FileInfo fInfo = hdoc.template.CalculateFileName(SessionManager.Instance.GetActivePatient().name,
                                        SessionManager.Instance.GetActivePatient().apptdatetime.ToShortDateString().Replace("/", "-"),
                                        SessionManager.Instance.GetActivePatient().apptid,
                                        SessionManager.Instance.GetActivePatient().unitnum,
                                        "pdf", directory);

                string PdfFileName = fInfo.FullName;

                DocumentTemplate.ConvertToPdf(hdoc.template.htmlText,PdfFileName);

            }
            catch (Exception e)
            {
                Logger.Instance.WriteToLog("saveHtmlDoc(" + apptID.ToString() + ", \"" + unitnum + "\", " + templateID.ToString() + ", \"" + directory + "\") " + e.ToString());
                return false;
            }
            return true;
        }
예제 #6
0
파일: PrintUtils.cs 프로젝트: mahitosh/HRA4
        public bool saveHtmlDoc(int apptID, string unitnum, int templateID, string directory)
        {
            try
            {
                SessionManager.Instance.SetActivePatient(unitnum, apptID);

                HraHtmlDocument hdoc = new HraHtmlDocument(templateID, unitnum, apptID);
                if (hdoc == null)
                {
                    Logger.Instance.WriteToLog("RiskApps3Automation.HtmlDocument(" + templateID.ToString() + ", " + apptID.ToString() + ", \"" + unitnum + "\") returned null");
                    return false;
                }
                hdoc.apptid = apptID;
                hdoc.Save(directory);
            }
            catch (Exception e)
            {
                Logger.Instance.WriteToLog("saveHtmlDoc(" + apptID.ToString() + ", \"" + unitnum + "\", " + templateID.ToString() + ", \"" + directory + "\") " + e.ToString());
                return false;
            }
            return true;
        }