Exemplo n.º 1
0
        ///<summary>Adds the xml for one statement.</summary>
        public static void GenerateOneStatement(XmlWriter writer, Statement stmt, Patient pat, Family fam, DataSet dataSet)
        {
            writer.WriteStartElement("Statement");
            writer.WriteStartElement("RecipientAddress");
            Patient guar = fam.ListPats[0];

            writer.WriteElementString("Name", guar.GetNameFLFormal());
            writer.WriteElementString("Account", guar.ChartNumber);           //.PatNum.ToString());//Only one customer is using this, so no need to give option.
            writer.WriteElementString("Address1", guar.Address);
            writer.WriteElementString("Address2", guar.Address2);
            writer.WriteElementString("City", guar.City);
            writer.WriteElementString("State", guar.State);
            writer.WriteElementString("Zip", guar.Zip);
            string email      = "";
            Def    billingDef = DefC.GetDef(DefCat.BillingTypes, guar.BillingType);

            if (billingDef.ItemValue == "E")
            {
                email = guar.Email;
            }
            writer.WriteElementString("EMail", email);
            writer.WriteEndElement();            //RecipientAddress
            //Account summary-----------------------------------------------------------------------
            if (stmt.DateRangeFrom.Year < 1880)  //make up a statement date.
            {
                writer.WriteElementString("PriorStatementDate", DateTime.Today.AddMonths(-1).ToString("MM/dd/yyyy"));
            }
            else
            {
                writer.WriteElementString("PriorStatementDate", stmt.DateRangeFrom.AddDays(-1).ToString("MM/dd/yyyy"));
            }
            DateTime dueDate;

            if (PrefC.GetLong(PrefName.StatementsCalcDueDate) == -1)
            {
                dueDate = DateTime.Today.AddDays(10);
            }
            else
            {
                dueDate = DateTime.Today.AddDays(PrefC.GetLong(PrefName.StatementsCalcDueDate));
            }
            writer.WriteElementString("DueDate", dueDate.ToString("MM/dd/yyyy"));
            writer.WriteElementString("StatementDate", stmt.DateSent.ToString("MM/dd/yyyy"));
            double balanceForward = 0;

            for (int r = 0; r < dataSet.Tables["misc"].Rows.Count; r++)
            {
                if (dataSet.Tables["misc"].Rows[r]["descript"].ToString() == "balanceForward")
                {
                    balanceForward = PIn.Double(dataSet.Tables["misc"].Rows[r]["value"].ToString());
                }
            }
            writer.WriteElementString("PriorBalance", balanceForward.ToString("F2"));
            DataTable tableAccount = null;

            for (int i = 0; i < dataSet.Tables.Count; i++)
            {
                if (dataSet.Tables[i].TableName.StartsWith("account"))
                {
                    tableAccount = dataSet.Tables[i];
                }
            }
            double credits = 0;

            for (int i = 0; i < tableAccount.Rows.Count; i++)
            {
                credits += PIn.Double(tableAccount.Rows[i]["creditsDouble"].ToString());
            }
            writer.WriteElementString("Credits", credits.ToString("F2"));
            decimal payPlanDue = 0;
            double  amountDue  = guar.BalTotal;

            for (int m = 0; m < dataSet.Tables["misc"].Rows.Count; m++)
            {
                if (dataSet.Tables["misc"].Rows[m]["descript"].ToString() == "payPlanDue")
                {
                    payPlanDue += PIn.Decimal(dataSet.Tables["misc"].Rows[m]["value"].ToString());                  //This will be an option once more users are using it.
                }
            }
            writer.WriteElementString("PayPlanDue", payPlanDue.ToString("F2"));
            if (PrefC.GetBool(PrefName.BalancesDontSubtractIns))
            {
                writer.WriteElementString("EstInsPayments", "");                         //optional.
            }
            else                                                                         //this is typical
            {
                writer.WriteElementString("EstInsPayments", guar.InsEst.ToString("F2")); //optional.
                amountDue -= guar.InsEst;
            }
            InstallmentPlan installPlan = InstallmentPlans.GetOneForFam(guar.PatNum);

            if (installPlan != null)
            {
                //show lesser of normal total balance or the monthly payment amount.
                if (installPlan.MonthlyPayment < amountDue)
                {
                    amountDue = installPlan.MonthlyPayment;
                }
            }
            writer.WriteElementString("AmountDue", amountDue.ToString("F2"));
            writer.WriteElementString("PastDue30", guar.Bal_31_60.ToString("F2"));           //optional
            writer.WriteElementString("PastDue60", guar.Bal_61_90.ToString("F2"));           //optional
            writer.WriteElementString("PastDue90", guar.BalOver90.ToString("F2"));           //optional
            //Notes-----------------------------------------------------------------------------------
            writer.WriteStartElement("Notes");
            if (stmt.NoteBold != "")
            {
                writer.WriteStartElement("Note");
                writer.WriteAttributeString("FgColor", "Red");
                writer.WriteCData(stmt.NoteBold);
                writer.WriteEndElement();                //Note
            }
            if (stmt.Note != "")
            {
                writer.WriteStartElement("Note");
                writer.WriteCData(stmt.Note);
                writer.WriteEndElement();        //Note
            }
            writer.WriteEndElement();            //Notes
            //Detail items------------------------------------------------------------------------------
            writer.WriteStartElement("DetailItems");
            //string note;
            string descript;
            string fulldesc;
            string procCode;
            string tth;

            //string linedesc;
            string[]      lineArray;
            List <string> lines;
            DateTime      date;
            int           seq = 0;

            for (int i = 0; i < tableAccount.Rows.Count; i++)
            {
                procCode  = tableAccount.Rows[i]["ProcCode"].ToString();
                tth       = tableAccount.Rows[i]["tth"].ToString();
                descript  = tableAccount.Rows[i]["description"].ToString();
                fulldesc  = procCode + " " + tth + " " + descript;
                lineArray = fulldesc.Split(new string[] { "\r\n" }, StringSplitOptions.RemoveEmptyEntries);
                lines     = new List <string>(lineArray);
                //The specs say that the line limit is 30 char.  But in testing, it will take 50 char.
                //We will use 40 char to be safe.
                if (lines[0].Length > 40)
                {
                    string newline = lines[0].Substring(40);
                    lines[0] = lines[0].Substring(0, 40);       //first half
                    lines.Insert(1, newline);                   //second half
                }
                for (int li = 0; li < lines.Count; li++)
                {
                    writer.WriteStartElement("DetailItem");                    //has a child item. We won't add optional child note
                    writer.WriteAttributeString("sequence", seq.ToString());
                    writer.WriteStartElement("Item");
                    if (li == 0)
                    {
                        date = (DateTime)tableAccount.Rows[i]["DateTime"];
                        writer.WriteElementString("Date", date.ToString("MM/dd/yyyy"));
                        writer.WriteElementString("PatientName", tableAccount.Rows[i]["patient"].ToString());
                    }
                    else
                    {
                        writer.WriteElementString("Date", "");
                        writer.WriteElementString("PatientName", "");
                    }
                    writer.WriteElementString("Description", lines[li]);
                    if (li == 0)
                    {
                        writer.WriteElementString("Charges", tableAccount.Rows[i]["charges"].ToString());
                        writer.WriteElementString("Credits", tableAccount.Rows[i]["credits"].ToString());
                        writer.WriteElementString("Balance", tableAccount.Rows[i]["balance"].ToString());
                    }
                    else
                    {
                        writer.WriteElementString("Charges", "");
                        writer.WriteElementString("Credits", "");
                        writer.WriteElementString("Balance", "");
                    }
                    writer.WriteEndElement();                    //Item
                    writer.WriteEndElement();                    //DetailItem
                    seq++;
                }
            }
            writer.WriteEndElement();            //DetailItems
            writer.WriteEndElement();            //Statement
        }
Exemplo n.º 2
0
        ///<summary>Adds the xml for one statement.</summary>
        public static void GenerateOneStatement(XmlWriter writer, Statement stmt, Patient pat, Family fam, DataSet dataSet)
        {
            writer.WriteStartElement("EisStatement");
            writer.WriteAttributeString("OutputFormat", "StmOut_Blue6Col");
            writer.WriteAttributeString("CreditCardChoice", PrefC.GetString(PrefName.BillingElectCreditCardChoices));
            writer.WriteStartElement("Patient");
            Patient guar = fam.ListPats[0];

            writer.WriteElementString("Name", guar.GetNameFLFormal());
            writer.WriteElementString("Account", guar.PatNum.ToString());
            writer.WriteElementString("Address1", guar.Address);
            writer.WriteElementString("Address2", guar.Address2);
            writer.WriteElementString("City", guar.City);
            writer.WriteElementString("State", guar.State);
            writer.WriteElementString("Zip", guar.Zip);
            string email      = "";
            Def    billingDef = DefC.GetDef(DefCat.BillingTypes, guar.BillingType);

            if (billingDef.ItemValue == "E")
            {
                email = guar.Email;
            }
            writer.WriteElementString("EMail", email);
            //Account summary-----------------------------------------------------------------------
            writer.WriteStartElement("AccountSummary");
            if (stmt.DateRangeFrom.Year < 1880)           //make up a statement date.
            {
                writer.WriteElementString("PriorStatementDate", DateTime.Today.AddMonths(-1).ToString("MM/dd/yyyy"));
            }
            else
            {
                writer.WriteElementString("PriorStatementDate", stmt.DateRangeFrom.AddDays(-1).ToString("MM/dd/yyyy"));
            }
            DateTime dueDate;

            if (PrefC.GetLong(PrefName.StatementsCalcDueDate) == -1)
            {
                dueDate = DateTime.Today.AddDays(10);
            }
            else
            {
                dueDate = DateTime.Today.AddDays(PrefC.GetLong(PrefName.StatementsCalcDueDate));
            }
            writer.WriteElementString("DueDate", dueDate.ToString("MM/dd/yyyy"));
            writer.WriteElementString("StatementDate", stmt.DateSent.ToString("MM/dd/yyyy"));
            double balanceForward = 0;

            for (int r = 0; r < dataSet.Tables["misc"].Rows.Count; r++)
            {
                if (dataSet.Tables["misc"].Rows[r]["descript"].ToString() == "balanceForward")
                {
                    balanceForward = PIn.Double(dataSet.Tables["misc"].Rows[r]["value"].ToString());
                }
            }
            writer.WriteElementString("PriorBalance", balanceForward.ToString("F2"));
            writer.WriteElementString("RunningBalance", "");      //for future use
            writer.WriteElementString("PerPayAdj", "");           //optional
            writer.WriteElementString("InsPayAdj", "");           //optional
            writer.WriteElementString("Adjustments", "");         //for future use
            writer.WriteElementString("NewCharges", "");          //optional
            writer.WriteElementString("FinanceCharges", "");      //for future use
            DataTable tableAccount = null;

            for (int i = 0; i < dataSet.Tables.Count; i++)
            {
                if (dataSet.Tables[i].TableName.StartsWith("account"))
                {
                    tableAccount = dataSet.Tables[i];
                }
            }
            double credits = 0;

            for (int i = 0; i < tableAccount.Rows.Count; i++)
            {
                credits += PIn.Double(tableAccount.Rows[i]["creditsDouble"].ToString());
            }
            writer.WriteElementString("Credits", credits.ToString("F2"));
            //on a regular printed statement, the amount due at the top might be different from the balance at the middle right.
            //This is because of payment plan balances.
            //But in e-bills, there is only one amount due.
            //Insurance estimate is already subtracted, and payment plan balance is already added.
            double amountDue = guar.BalTotal;

            //add payplan due amt:
            for (int m = 0; m < dataSet.Tables["misc"].Rows.Count; m++)
            {
                if (dataSet.Tables["misc"].Rows[m]["descript"].ToString() == "payPlanDue")
                {
                    amountDue += PIn.Double(dataSet.Tables["misc"].Rows[m]["value"].ToString());
                }
            }
            if (PrefC.GetBool(PrefName.BalancesDontSubtractIns))
            {
                writer.WriteElementString("EstInsPayments", "");               //optional.
                writer.WriteElementString("PatientShare", amountDue.ToString("F2"));
                //this is ambiguous.  It seems to be AmountDue, but it could possibly be 0-30 days aging
                writer.WriteElementString("CurrentBalance", amountDue.ToString("F2"));
            }
            else                                                                         //this is typical
            {
                writer.WriteElementString("EstInsPayments", guar.InsEst.ToString("F2")); //optional.
                amountDue -= guar.InsEst;
                writer.WriteElementString("PatientShare", amountDue.ToString("F2"));
                writer.WriteElementString("CurrentBalance", amountDue.ToString("F2"));
            }
            writer.WriteElementString("PastDue30", guar.Bal_31_60.ToString("F2")); //optional
            writer.WriteElementString("PastDue60", guar.Bal_61_90.ToString("F2")); //optional
            writer.WriteElementString("PastDue90", guar.BalOver90.ToString("F2")); //optional
            writer.WriteElementString("PastDue120", "");                           //optional
            writer.WriteEndElement();                                              //AccountSummary
            //Notes-----------------------------------------------------------------------------------
            writer.WriteStartElement("Notes");
            if (stmt.NoteBold != "")
            {
                writer.WriteStartElement("Note");
                writer.WriteAttributeString("FgColor", "Red");               //ColorToHexString(Color.DarkRed));
                //writer.WriteAttributeString("BgColor",ColorToHexString(Color.White));
                writer.WriteCData(stmt.NoteBold);
                writer.WriteEndElement();                //Note
            }
            if (stmt.Note != "")
            {
                writer.WriteStartElement("Note");
                //writer.WriteAttributeString("FgColor",ColorToHexString(Color.Black));
                //writer.WriteAttributeString("BgColor",ColorToHexString(Color.White));
                writer.WriteCData(stmt.Note);
                writer.WriteEndElement();        //Note
            }
            writer.WriteEndElement();            //Notes
            //Detail items------------------------------------------------------------------------------
            writer.WriteStartElement("DetailItems");
            //string note;
            string descript;
            string fulldesc;
            string procCode;
            string tth;

            //string linedesc;
            string[]      lineArray;
            List <string> lines;
            DateTime      date;
            int           seq = 0;

            for (int i = 0; i < tableAccount.Rows.Count; i++)
            {
                procCode  = tableAccount.Rows[i]["ProcCode"].ToString();
                tth       = tableAccount.Rows[i]["tth"].ToString();
                descript  = tableAccount.Rows[i]["description"].ToString();
                fulldesc  = procCode + " " + tth + " " + descript;
                lineArray = fulldesc.Split(new string[] { "\r\n" }, StringSplitOptions.RemoveEmptyEntries);
                lines     = new List <string>(lineArray);
                //The specs say that the line limit is 30 char.  But in testing, it will take 50 char.
                //We will use 40 char to be safe.
                if (lines[0].Length > 40)
                {
                    string newline = lines[0].Substring(40);
                    lines[0] = lines[0].Substring(0, 40);       //first half
                    lines.Insert(1, newline);                   //second half
                }
                for (int li = 0; li < lines.Count; li++)
                {
                    writer.WriteStartElement("DetailItem");                    //has a child item. We won't add optional child note
                    writer.WriteAttributeString("sequence", seq.ToString());
                    writer.WriteStartElement("Item");
                    if (li == 0)
                    {
                        date = (DateTime)tableAccount.Rows[i]["DateTime"];
                        writer.WriteElementString("Date", date.ToString("MM/dd/yyyy"));
                        writer.WriteElementString("PatientName", tableAccount.Rows[i]["patient"].ToString());
                    }
                    else
                    {
                        writer.WriteElementString("Date", "");
                        writer.WriteElementString("PatientName", "");
                    }
                    writer.WriteElementString("Description", lines[li]);
                    if (li == 0)
                    {
                        writer.WriteElementString("Charges", tableAccount.Rows[i]["charges"].ToString());
                        writer.WriteElementString("Credits", tableAccount.Rows[i]["credits"].ToString());
                        writer.WriteElementString("Balance", tableAccount.Rows[i]["balance"].ToString());
                    }
                    else
                    {
                        writer.WriteElementString("Charges", "");
                        writer.WriteElementString("Credits", "");
                        writer.WriteElementString("Balance", "");
                    }
                    writer.WriteEndElement();                    //Item
                    writer.WriteEndElement();                    //DetailItem
                    seq++;
                }

                /*The code below just didn't work because notes don't get displayed on the statement.
                 * linedesc=lines[0];
                 * note="";
                 * if(linedesc.Length>30) {
                 *      note=linedesc.Substring(30);
                 *      linedesc=linedesc.Substring(0,30);
                 * }
                 * for(int l=1;l<lines.Length;l++) {
                 *      if(note!="") {
                 *              note+="\r\n";
                 *      }
                 *      note+=lines[l];
                 * }
                 *
                 * if(note!="") {
                 *      writer.WriteStartElement("Note");
                 *      //we're not going to specify colors here since they're optional
                 *      writer.WriteCData(note);
                 *      writer.WriteEndElement();//Note
                 * }*/
            }
            writer.WriteEndElement();            //DetailItems
            writer.WriteEndElement();            //Patient
            writer.WriteEndElement();            //EisStatement
        }
Exemplo n.º 3
0
        public static string GetChanges(Procedure procCur, Procedure procOld, OrionProc orionProcCur, OrionProc orionProcOld)
        {
            Changes = "";
            if (orionProcOld.DPC != orionProcCur.DPC)
            {
                if (Changes != "")
                {
                    Changes += "\r\n";
                }
                Changes += "DPC changed from " + POut.String(orionProcOld.DPC.ToString()) + " to " + POut.String(orionProcCur.DPC.ToString()) + ".";
            }
            if (orionProcOld.DPCpost != orionProcCur.DPCpost)
            {
                if (Changes != "")
                {
                    Changes += "\r\n";
                }
                Changes += "DPC Post Visit changed from " + POut.String(orionProcOld.DPCpost.ToString()) + " to " + POut.String(orionProcCur.DPCpost.ToString()) + ".";
            }
            //PatNum, AptNum, PlannedAptNum should never change---------------------------------------------------------------------------------------------
            if (procOld.PatNum != procCur.PatNum)
            {
                if (Changes != "")
                {
                    Changes += "\r\n";
                }
                Changes += "Patient Num changed from " + procOld.PatNum + " to " + procCur.PatNum + ".";
            }
            if (procOld.AptNum != procCur.AptNum)
            {
                if (Changes != "")
                {
                    Changes += "\r\n";
                }
                Changes += "Apt Num changed from " + procOld.AptNum + " to " + procCur.AptNum + ".";
            }
            if (procOld.PlannedAptNum != procCur.PlannedAptNum)
            {
                if (Changes != "")
                {
                    Changes += "\r\n";
                }
                Changes += "Planned Apt Num changed from " + procOld.PlannedAptNum + " to " + procCur.PlannedAptNum + ".";
            }
            //Date and time related fields------------------------------------------------------------------------------------------------------------------
            if (procOld.DateEntryC.Date != procCur.DateEntryC.Date)
            {
                if (Changes != "")
                {
                    Changes += "\r\n";
                }
                Changes += "Date Entry changed from " + procOld.DateEntryC.ToShortDateString() + " to " + procCur.DateEntryC.ToShortDateString() + ".";
            }
            if (procOld.ProcDate.Date != procCur.ProcDate.Date)
            {
                if (Changes != "")
                {
                    Changes += "\r\n";
                }
                Changes += "Proc Date changed from " + procOld.ProcDate.ToShortDateString() + " to " + procCur.ProcDate.ToShortDateString() + ".";
            }
            //if(procOld.StartTime != procCur.StartTime) {
            //  if(Changes!=""){ Changes+="\r\n";}
            //  Changes+="Start Time changed from "+procOld.StartTime+" to "+procCur.StartTime+".";
            //}
            //if(procOld.StopTime != procCur.StopTime) {
            //  if(Changes!=""){ Changes+="\r\n";}
            //  Changes+="Stop Time changed from "+procOld.StopTime+" to "+procCur.StopTime+".";
            //}
            if (procOld.ProcTime != procCur.ProcTime)
            {
                if (Changes != "")
                {
                    Changes += "\r\n";
                }
                Changes += "Procedure Time changed from "
                           + (PIn.DateT(procOld.ProcTime.ToString()).ToShortTimeString() == "12:00 AM"?"none":PIn.DateT(procOld.ProcTime.ToString()).ToShortTimeString())
                           + " to " + (PIn.DateT(procCur.ProcTime.ToString()).ToShortTimeString() == "12:00 AM"?"none":PIn.DateT(procCur.ProcTime.ToString()).ToShortTimeString()) + ".";
            }
            if (procOld.ProcTimeEnd != procCur.ProcTimeEnd)
            {
                if (Changes != "")
                {
                    Changes += "\r\n";
                }
                Changes += "Procedure End Time changed from "
                           + (PIn.DateT(procOld.ProcTimeEnd.ToString()).ToShortTimeString() == "12:00 AM"?"none":PIn.DateT(procOld.ProcTimeEnd.ToString()).ToShortTimeString())
                           + " to " + (PIn.DateT(procCur.ProcTimeEnd.ToString()).ToShortTimeString() == "12:00 AM"?"none":PIn.DateT(procCur.ProcTimeEnd.ToString()).ToShortTimeString()) + ".";
            }
            //Procedure, related areas, amount, hide graphics, etc.-----------------------------------------------------------------------------------------
            if (procOld.CodeNum != procCur.CodeNum)
            {
                if (Changes != "")
                {
                    Changes += "\r\n";
                }
                Changes += "Procedure changed from " + ProcedureCodes.GetLaymanTerm(procOld.CodeNum) + " to " + ProcedureCodes.GetLaymanTerm(procCur.CodeNum) + ".";
            }
            if (procOld.ProcFee != procCur.ProcFee)
            {
                if (Changes != "")
                {
                    Changes += "\r\n";
                }
                Changes += "Proc Fee changed from $" + procOld.ProcFee.ToString("F") + " to $" + procCur.ProcFee.ToString("F") + ".";
            }
            if (procOld.ToothNum != procCur.ToothNum)
            {
                if (Changes != "")
                {
                    Changes += "\r\n";
                }
                Changes += "Tooth Num changed from " + procOld.ToothNum + " to " + procCur.ToothNum + ".";
            }
            if (procOld.Surf != procCur.Surf)
            {
                if (Changes != "")
                {
                    Changes += "\r\n";
                }
                Changes += "Surface changed from " + procOld.Surf + " to " + procCur.Surf + ".";
            }
            if (procOld.ToothRange != procCur.ToothRange)
            {
                if (Changes != "")
                {
                    Changes += "\r\n";
                }
                Changes += "Tooth Range changed from " + procOld.ToothRange + " to " + procCur.ToothRange + ".";
            }
            if (procOld.HideGraphics != procCur.HideGraphics)
            {
                if (Changes != "")
                {
                    Changes += "\r\n";
                }
                Changes += "Hide Graphics changed from " + (procOld.HideGraphics?"Hide Graphics":"Do Not Hide Graphics")
                           + " to " + (procCur.HideGraphics?"Hide Graphics":"Do Not Hide Graphics") + ".";
            }
            //Provider, Diagnosis, Priority, Place of Service, Clinic, Site---------------------------------------------------------------------------------
            if (procOld.ProvNum != procCur.ProvNum)
            {
                if (Changes != "")
                {
                    Changes += "\r\n";
                }
                Changes += "Provider changed from " + Providers.GetAbbr(procOld.ProvNum) + " to " + Providers.GetAbbr(procCur.ProvNum) + ".";
            }
            if (procOld.Dx != procCur.Dx)
            {
                if (Changes != "")
                {
                    Changes += "\r\n";
                }
                Changes += "Diagnosis changed from " + DefC.GetDef(DefCat.Diagnosis, procOld.Dx).ItemName
                           + " to " + DefC.GetDef(DefCat.Diagnosis, procCur.Dx).ItemName + ".";
            }
            if (procOld.Priority != procCur.Priority)
            {
                if (Changes != "")
                {
                    Changes += "\r\n";
                }
                Changes += "Priority changed from " + ((procOld.Priority != 0)?DefC.GetDef(DefCat.TxPriorities, procOld.Priority).ItemName:"no priority")
                           + " to " + ((procCur.Priority != 0)?DefC.GetDef(DefCat.TxPriorities, procCur.Priority).ItemName:"no priority") + ".";
            }
            if (procOld.PlaceService != procCur.PlaceService)
            {
                if (Changes != "")
                {
                    Changes += "\r\n";
                }
                Changes += "Place of Service changed from " + procOld.PlaceService.ToString() + " to " + procCur.PlaceService.ToString() + ".";
            }
            if (procOld.ClinicNum != procCur.ClinicNum)
            {
                if (Changes != "")
                {
                    Changes += "\r\n";
                }
                Changes += "Clinic changed from " + Clinics.GetDesc(procOld.ClinicNum) + " to " + Clinics.GetDesc(procCur.ClinicNum) + ".";
            }
            if (procOld.SiteNum != procCur.SiteNum)
            {
                if (Changes != "")
                {
                    Changes += "\r\n";
                }
                Changes += "Site changed from " + (procOld.SiteNum == 0?"none":Sites.GetDescription(procOld.SiteNum))
                           + " to " + (procCur.SiteNum == 0?"none":Sites.GetDescription(procCur.SiteNum)) + ".";
            }
            //Prosthesis reverse lookup---------------------------------------------------------------------------------------------------------------------
            if (procOld.Prosthesis != procCur.Prosthesis)
            {
                if (Changes != "")
                {
                    Changes += "\r\n";
                }
                string prosthesisOld;
                switch (procOld.Prosthesis.ToString())
                {
                case "": prosthesisOld = "no"; break;

                case "I":       prosthesisOld = "Initial"; break;

                case "R": prosthesisOld = "Replacement"; break;

                default: prosthesisOld = "error"; break;
                }
                string prosthesisCur;
                switch (procCur.Prosthesis.ToString())
                {
                case "": prosthesisCur = "no"; break;

                case "I": prosthesisCur = "Initial"; break;

                case "R": prosthesisCur = "Replacement"; break;

                default: prosthesisCur = "error"; break;
                }
                Changes += "Prosthesis changed from " + prosthesisOld + " to " + prosthesisCur + ".";
            }
            if (procOld.DateOriginalProsth.Date != procCur.DateOriginalProsth.Date)
            {
                if (Changes != "")
                {
                    Changes += "\r\n";
                }
                Changes += "Date of Original Prosthesis changed from " + procOld.DateOriginalProsth.ToShortDateString()
                           + " to " + procCur.DateOriginalProsth.ToShortDateString() + ".";
            }
            //Claim Note & Orion Proc Fields----------------------------------------------------------------------------------------------------------------
            if (procOld.ClaimNote != procCur.ClaimNote)
            {
                if (Changes != "")
                {
                    Changes += "\r\n";
                }
                Changes += "Claim Note changed from " + (procOld.ClaimNote == ""?"none":"'" + procOld.ClaimNote + "'")
                           + " to " + (procCur.ClaimNote == ""?"none":"'" + procCur.ClaimNote + "'");
            }
            if (orionProcOld.OrionProcNum != orionProcCur.OrionProcNum)
            {
                if (Changes != "")
                {
                    Changes += "\r\n";
                }
                Changes += "Orion Proc Num changed from " + POut.Long(orionProcOld.OrionProcNum) + " to " + POut.Long(orionProcCur.OrionProcNum) + ".";
            }
            if (orionProcOld.ProcNum != orionProcCur.ProcNum)
            {
                if (Changes != "")
                {
                    Changes += "\r\n";
                }
                Changes += "Proc Num changed from " + POut.Long(orionProcOld.ProcNum) + " to " + POut.Long(orionProcCur.ProcNum) + ".";
            }
            //Orion Status Reverse Lookup for Description----------------------------------//None is equivalent to TP---------------------------------------
            if (orionProcOld.Status2 != orionProcCur.Status2 && !(orionProcOld.Status2 == OrionStatus.None && orionProcCur.Status2 == OrionStatus.TP))
            {
                if (Changes != "")
                {
                    Changes += "\r\n";
                }
                string[] status2     = new string[2];
                string[] status2Desc = new string[2];
                status2[0] = orionProcOld.Status2.ToString();
                status2[1] = orionProcCur.Status2.ToString();
                for (int i = 0; i < 2; i++)
                {
                    switch (status2[i])
                    {
                    case "None":            status2Desc[i] = "TP-treatment planned"; break;

                    case "TP":                      status2Desc[i] = "TP-treatment planned"; break;

                    case "C":                               status2Desc[i] = "C-completed";   break;

                    case "E":                               status2Desc[i] = "E-existing prior to incarceration"; break;

                    case "R":                               status2Desc[i] = "R-refused treatment"; break;

                    case "RO":                      status2Desc[i] = "RO-referred out to specialist"; break;

                    case "CS":                      status2Desc[i] = "CS-completed by specialist"; break;

                    case "CR":                      status2Desc[i] = "CR-completed by registry"; break;

                    case "CA_Tx":           status2Desc[i] = "CA_Tx-cancelled, tx plan changed"; break;

                    case "CA_EPRD": status2Desc[i] = "CA_EPRD-cancelled, eligible parole"; break;

                    case "CA_P/D":  status2Desc[i] = "CA_P/D--cancelled, parole/discharge"; break;

                    case "S":                               status2Desc[i] = "S-suspended, unacceptable plaque"; break;

                    case "ST":                      status2Desc[i] = "ST-stop clock, multi visit"; break;

                    case "W":                               status2Desc[i] = "W-watch"; break;

                    case "A":                               status2Desc[i] = "A-alternative"; break;

                    default:                                status2Desc[i] = "error"; break;
                    }
                }
                Changes += "Orion Procedure Status changed from " + status2Desc[0] + " to " + status2Desc[1] + ".";
            }
            //Other orion fields----------------------------------------------------------------------------------------------------------------------------
            if (orionProcOld.DateScheduleBy.Date != orionProcCur.DateScheduleBy.Date)
            {
                if (Changes != "")
                {
                    Changes += "\r\n";
                }
                Changes += "Date Schedule By changed from " + orionProcOld.DateScheduleBy.ToShortDateString()
                           + " to " + orionProcCur.DateScheduleBy.ToShortDateString() + ".";
            }
            if (orionProcOld.DateStopClock.Date != orionProcCur.DateStopClock.Date)
            {
                if (Changes != "")
                {
                    Changes += "\r\n";
                }
                Changes += "Date Stop Clock changed from " + orionProcOld.DateStopClock.ToShortDateString()
                           + " to " + orionProcCur.DateStopClock.ToShortDateString() + ".";
            }
            if (orionProcOld.IsOnCall != orionProcCur.IsOnCall)
            {
                if (Changes != "")
                {
                    Changes += "\r\n";
                }
                Changes += "Is On Call changed from " + (orionProcOld.IsOnCall?"Is On Call":"Is Not On Call")
                           + " to " + (orionProcCur.IsOnCall?"Is On Call":"Is Not On Call") + ".";
            }
            if (orionProcOld.IsEffectiveComm != orionProcCur.IsEffectiveComm)
            {
                if (Changes != "")
                {
                    Changes += "\r\n";
                }
                Changes += "Is Effective Comm changed from " + (orionProcOld.IsEffectiveComm?"Is an Effective Communicator":"Is Not an Effective Communicator")
                           + " to " + (orionProcCur.IsEffectiveComm?"Is an Effective Communicator":"Is Not an Effective Communicator") + ".";
            }
            if (orionProcOld.IsRepair != orionProcCur.IsRepair)
            {
                if (Changes != "")
                {
                    Changes += "\r\n";
                }
                Changes += "Is Repair changed from " + (orionProcOld.IsRepair?"Is a Repair":"Is Not a Repair")
                           + " to " + (orionProcCur.IsRepair?"Is a Repair":"Is Not a Repair") + ".";
            }
            //Medical fields--------------------------------------------------------------------------------------------------------------------------------
            if (procOld.MedicalCode != procCur.MedicalCode)
            {
                if (Changes != "")
                {
                    Changes += "\r\n";
                }
                Changes += "Medical Code changed from " + (procOld.MedicalCode == ""?"none":procOld.MedicalCode)
                           + " to " + (procCur.MedicalCode == ""?"none":procCur.MedicalCode) + ".";
            }
            if (procOld.DiagnosticCode != procCur.DiagnosticCode)
            {
                if (Changes != "")
                {
                    Changes += "\r\n";
                }
                Changes += "Diagnostic Code changed from " + (procOld.DiagnosticCode == ""?"none":procOld.DiagnosticCode)
                           + " to " + (procCur.DiagnosticCode == ""?"none":procCur.DiagnosticCode) + ".";
            }
            if (procOld.IsPrincDiag != procCur.IsPrincDiag)
            {
                if (Changes != "")
                {
                    Changes += "\r\n";
                }
                Changes += "Is Princ Diag changed from " + (procOld.IsPrincDiag?"Principal Diagnosis":"Not Principal Diagnosis")
                           + " to " + (procCur.IsPrincDiag?"Principal Diagnosis":"Not Principal Diagnosis") + ".";
            }
            //if(procOld.RevCode != procCur.RevCode) {
            //  if(Changes!=""){ Changes+="\r\n";}
            //  Changes+="Rev Code changed from "+POut.String(procOld.RevCode)+"' to '"+POut.String(procCur.RevCode)+".";
            //}
            //Proc status and billing fields----------------------------------------------------------------------------------------------------------------
            if (procOld.ProcStatus != procCur.ProcStatus)
            {
                if (Changes != "")
                {
                    Changes += "\r\n";
                }
                Changes += "Procedure Status changed from " + procOld.ProcStatus.ToString() + " to " + procCur.ProcStatus.ToString() + ".";
            }
            if (procOld.DateTP.Date != procCur.DateTP.Date && procOld.DateTP.Date != DateTime.MinValue.Date)
            {
                if (Changes != "")
                {
                    Changes += "\r\n";
                }
                Changes += "Date TP changed from " + procOld.DateTP.ToShortDateString() + " to " + procCur.DateTP.ToShortDateString() + ".";
            }
            //if(procOld.BillingTypeOne != procCur.BillingTypeOne) {
            //  if(Changes!=""){ Changes+="\r\n";}
            //  Changes+="Billing Type One changed from "+(procOld.BillingTypeOne!=0?DefC.GetDef(DefCat.BillingTypes,procOld.BillingTypeOne).ItemName:"none")
            //		+" to "+(procCur.BillingTypeOne!=0?DefC.GetDef(DefCat.BillingTypes,procCur.BillingTypeOne).ItemName:"none")+".";
            //}
            //if(procOld.BillingTypeTwo != procCur.BillingTypeTwo) {
            //  if(Changes!=""){ Changes+="\r\n";}
            //  Changes+="Billing Type Two changed from "+(procOld.BillingTypeTwo!=0?DefC.GetDef(DefCat.BillingTypes,procOld.BillingTypeTwo).ItemName:"none")
            //		+" to "+(procCur.BillingTypeTwo!=0?DefC.GetDef(DefCat.BillingTypes,procCur.BillingTypeTwo).ItemName:"none")+".";
            //}
            if (procOld.ProcNumLab != procCur.ProcNumLab)
            {
                if (Changes != "")
                {
                    Changes += "\r\n";
                }
                Changes += "Proc Num Lab changed from " + POut.Long(procOld.ProcNumLab) + " to " + POut.Long(procCur.ProcNumLab) + ".";
            }
            //if(procOld.UnitCode != procCur.UnitCode) {
            //  if(Changes!=""){ Changes+="\r\n";}
            //  Changes+="Unit Code changed from "+POut.String(procOld.UnitCode)+" to "+POut.String(procCur.UnitCode)+".";
            //}
            //UnitQty, Canadian Type Codes, and Note--------------------------------------------------------------------------------------------------------
            if (procOld.UnitQty != procCur.UnitQty)
            {
                if (Changes != "")
                {
                    Changes += "\r\n";
                }
                Changes += "Unit Quantity changed from " + POut.Int(procOld.UnitQty) + " to " + POut.Int(procCur.UnitQty) + ".";
            }
            //if(procOld.CanadianTypeCodes != procCur.CanadianTypeCodes) {
            //  if(Changes!=""){ Changes+="\r\n";}
            //  Changes+="Canadian Code Type changed from "+POut.String(procOld.CanadianTypeCodes)+" to "+POut.String(procCur.CanadianTypeCodes)+".";
            // }
            if (procOld.Note != procCur.Note && !(procOld.Note == null && procCur.Note == ""))         //Null note is equivalent to an empty note string.
            {
                if (Changes != "")
                {
                    Changes += "\r\n";
                }
                Changes += "Note changed from " + (procOld.Note == ""?"none":"'" + procOld.Note + "'")
                           + " to " + (procCur.Note == ""?"none":"'" + procCur.Note + "'");
            }
            return(Changes);
        }