public override void ToXml(XElement document)
        {
            TCellNKProfileTestOrder panelSetOrder = (TCellNKProfileTestOrder)this.m_AccessionOrder.PanelSetOrderCollection.GetPanelSetOrder(this.m_ReportNo);

            this.AddHeader(document, panelSetOrder, "T-Cell/NK Profile");

            this.AddNextObxElement("", document, "F");
            this.AddNextObxElement("WBC: " + panelSetOrder.WBC.Value.ToString(), document, "F");
            this.AddNextObxElement("Lympocyte Percentage: " + panelSetOrder.LymphocytePercentage.ToString().StringAsPercent(), document, "F");
            this.AddNextObxElement("", document, "F");
            this.AddNextObxElement("T - cells % of Lymphocytes: " + panelSetOrder.CD3TPercent.ToString().StringAsPercent(), document, "F");
            this.AddNextObxElement("T - cells Absolute Count: " + panelSetOrder.CD3TCount, document, "F");
            this.AddNextObxElement("", document, "F");
            this.AddNextObxElement("CD4 + T - helper % of Lymphocytes: " + panelSetOrder.CD4TPercent.ToString().StringAsPercent(), document, "F");
            this.AddNextObxElement("CD4 + T - helper Absolute Count: " + panelSetOrder.CD4TCount, document, "F");
            this.AddNextObxElement("", document, "F");
            this.AddNextObxElement("CD8 + T - suppressor % of Lymphocytes: " + panelSetOrder.CD8TPercent.ToString().StringAsPercent(), document, "F");
            this.AddNextObxElement("CD8 + T - suppressor Absolute Count: " + panelSetOrder.CD8TCount, document, "F");
            this.AddNextObxElement("", document, "F");
            this.AddNextObxElement("NK cells % of Lymphocytes: " + panelSetOrder.CD16CD56NKPercent.ToString().StringAsPercent(), document, "F");
            this.AddNextObxElement("NK cells Absolute Count: " + panelSetOrder.CD16CD56NKCount, document, "F");

            this.AddNextObxElement("", document, "F");
            this.AddNextObxElement("Pathologist: " + panelSetOrder.Signature, document, "F");
            if (panelSetOrder.FinalTime.HasValue == true)
            {
                this.AddNextObxElement("E-signed " + panelSetOrder.FinalTime.Value.ToString("MM/dd/yyyy HH:mm"), document, "F");
            }
            this.AddNextObxElement("", document, "F");
            this.AddAmendments(document);

            this.AddNextObxElement("", document, "F");
            this.AddNextObxElement("Clinical History:", document, "F");
            this.HandleLongString(this.m_AccessionOrder.ClinicalHistory, document, "F");

            this.AddNextObxElement("", document, "F");
            this.AddNextObxElement("Method: " + panelSetOrder.Method, document, "F");

            YellowstonePathology.Business.Specimen.Model.SpecimenOrder specimenOrder = this.m_AccessionOrder.SpecimenOrderCollection.GetSpecimenOrder(panelSetOrder.OrderedOn, panelSetOrder.OrderedOnId);
            this.AddNextObxElement("", document, "F");
            this.AddNextObxElement("Specimen: " + specimenOrder.Description, document, "F");
            this.AddNextObxElement("", document, "F");

            string collectionDateTimeString = YellowstonePathology.Business.Helper.DateTimeExtensions.CombineDateAndTime(specimenOrder.CollectionDate, specimenOrder.CollectionTime);

            this.AddNextObxElement("Collection Date/Time: " + collectionDateTimeString, document, "F");
            this.AddNextObxElement(string.Empty, document, "F");

            this.AddNextObxElement("Specimen Adequacy: " + specimenOrder.SpecimenAdequacy, document, "F");
            this.AddNextObxElement("", document, "F");

            this.HandleLongString(panelSetOrder.ASRComment, document, "F");
            this.AddNextObxElement(string.Empty, document, "F");

            string locationPerformed = panelSetOrder.GetLocationPerformedComment();

            this.AddNextObxElement(locationPerformed, document, "F");
            this.AddNextObxElement(string.Empty, document, "F");
        }
        public override void Render()
        {
            TCellNKProfileTestOrder testOrder = (TCellNKProfileTestOrder)this.m_PanelSetOrder;

            this.m_TemplateName = @"\\CFileServer\Documents\ReportTemplates\XmlTemplates\TCellNKProfile.3.xml";

            base.OpenTemplate();

            this.SetDemographicsV2();
            this.SetReportDistribution();
            this.SetCaseHistory();

            YellowstonePathology.Business.Specimen.Model.SpecimenOrder specimenOrder = this.m_AccessionOrder.SpecimenOrderCollection.GetSpecimenOrderByOrderTarget(this.m_PanelSetOrder.OrderedOnId);
            this.ReplaceText("specimen_description", specimenOrder.Description);

            YellowstonePathology.Business.Amendment.Model.AmendmentCollection amendmentCollection = this.m_AccessionOrder.AmendmentCollection.GetAmendmentsForReport(m_PanelSetOrder.ReportNo);
            YellowstonePathology.Business.Document.AmendmentSection           amendmentSection    = new YellowstonePathology.Business.Document.AmendmentSection();
            amendmentSection.SetAmendment(amendmentCollection, this.m_ReportXml, this.m_NameSpaceManager, true);

            string signature = string.Empty;

            if (this.m_PanelSetOrder.Final == true && this.m_PanelSetOrder.PanelSetId != 66)
            {
                signature = this.m_PanelSetOrder.Signature;
            }
            else if (this.m_PanelSetOrder.Final == false)
            {
                signature = "This Case Is Not Final";
            }
            this.SetXmlNodeData("pathologist_signature", signature);

            string wbcCount = string.Empty;

            if (testOrder.WBC.HasValue == true)
            {
                wbcCount = testOrder.WBC.Value.ToString();
            }
            this.SetXmlNodeData("wbc_count", wbcCount + "/uL (from client)");
            this.SetXmlNodeData("lymphocyte_percentage", testOrder.LymphocytePercentage.ToString().StringAsPercent());
            this.SetXmlNodeData("tcell_percent", testOrder.CD3TPercent.ToString());
            this.SetXmlNodeData("tcell_count", testOrder.CD3TCount);
            this.SetXmlNodeData("cd4t_percent", testOrder.CD4TPercent.ToString());
            this.SetXmlNodeData("cd4t_count", testOrder.CD4TCount);
            this.SetXmlNodeData("cd8t_percent", testOrder.CD8TPercent.ToString());
            this.SetXmlNodeData("cd8t_count", testOrder.CD8TCount);
            this.SetXmlNodeData("nkcell_percent", testOrder.CD16CD56NKPercent.ToString());
            this.SetXmlNodeData("nkcell_count", testOrder.CD16CD56NKCount);
            this.SetXmlNodeData("cd4cd8_ratio", testOrder.CD4CD8Ratio);

            this.SetXmlNodeData("cd3_percent", testOrder.CD3Percent.ToString().StringAsPercent());
            this.SetXmlNodeData("cd4_percent", testOrder.CD4Percent.ToString().StringAsPercent());
            this.SetXmlNodeData("cd8_percent", testOrder.CD8Percent.ToString().StringAsPercent());
            this.SetXmlNodeData("cd16_percent", testOrder.CD16Percent.ToString().StringAsPercent());
            this.SetXmlNodeData("cd19_percent", testOrder.CD19Percent.ToString().StringAsPercent());
            this.SetXmlNodeData("cd45_percent", testOrder.CD45Percent.ToString().StringAsPercent());
            this.SetXmlNodeData("cd56_percent", testOrder.CD56Percent.ToString().StringAsPercent());

            this.SetXmlNodeData("clinical_history", this.m_AccessionOrder.ClinicalHistory);

            string dateTimeCollected = string.Empty;

            if (specimenOrder.CollectionTime.HasValue == true)
            {
                dateTimeCollected = specimenOrder.CollectionTime.Value.ToString("MM/dd/yyyy HH:mm");
            }
            else if (specimenOrder.CollectionDate.HasValue == true)
            {
                dateTimeCollected = specimenOrder.CollectionDate.Value.ToString("MM/dd/yyyy");
            }

            this.SetXmlNodeData("report_method", testOrder.Method);
            this.SetXmlNodeData("date_time_collected", dateTimeCollected);
            this.SetXmlNodeData("specimen_adequacy", specimenOrder.SpecimenAdequacy);
            this.SetXmlNodeData("report_references", testOrder.ReportReferences);
            this.SetXmlNodeData("asr_comment", testOrder.ASRComment);

            this.SaveReport();
        }