예제 #1
0
        private void FillGridCustomers()
        {
            gridCustomers.BeginUpdate();
            gridCustomers.Columns.Clear();
            gridCustomers.Columns.Add(new ODGridColumn("PatNum", -1));
            gridCustomers.Columns.Add(new ODGridColumn("Name", -1));
            gridCustomers.Columns.Add(new ODGridColumn("BillType", -1));
            gridCustomers.Columns.Add(new ODGridColumn("Unlink", 40, HorizontalAlignment.Center));
            gridCustomers.Rows.Clear();
            List <Patient> listPatients = Patients.GetMultPats(_listJobLinks.FindAll(x => x.LinkType == JobLinkType.Customer)
                                                               .Select(x => x.FKey).ToList()).ToList();

            foreach (Patient pat in listPatients)
            {
                ODGridRow row = new ODGridRow()
                {
                    Tag = pat
                };
                row.Cells.Add(pat.PatNum.ToString());
                row.Cells.Add(pat.GetNameFL());
                row.Cells.Add(Defs.GetDef(DefCat.BillingTypes, pat.BillingType).ItemName);
                row.Cells.Add("X");
                gridCustomers.Rows.Add(row);
            }
            gridCustomers.EndUpdate();
        }
예제 #2
0
        private void FillGrid()
        {
            InsFilingCodes.RefreshCache();
            _listInsFilingCodes = InsFilingCodes.GetDeepCopy();
            gridMain.BeginUpdate();
            gridMain.ListGridColumns.Clear();
            GridColumn col = new GridColumn(Lan.g("TableInsFilingCodes", "Description"), 250);

            gridMain.ListGridColumns.Add(col);
            col = new GridColumn(Lan.g("TableInsFilingCodes", "Group"), 100);
            gridMain.ListGridColumns.Add(col);
            col = new GridColumn(Lan.g("TableInsFilingCodes", "EclaimCode"), 100);
            gridMain.ListGridColumns.Add(col);
            gridMain.ListGridRows.Clear();
            GridRow row;

            for (int i = 0; i < _listInsFilingCodes.Count; i++)
            {
                row = new GridRow();
                row.Cells.Add(_listInsFilingCodes[i].Descript);
                string group = "";
                if (_listInsFilingCodes[i].GroupType > 0)
                {
                    group = Defs.GetDef(DefCat.InsuranceFilingCodeGroup, _listInsFilingCodes[i].GroupType)?.ItemName ?? "";
                }
                row.Cells.Add(group);
                row.Cells.Add(_listInsFilingCodes[i].EclaimCode);
                gridMain.ListGridRows.Add(row);
            }
            gridMain.EndUpdate();
        }
예제 #3
0
        ///<summary></summary>
        private void FillGrid()
        {
            if (!checkWebSchedNewPat.Checked && !checkWebSchedRecall.Checked && !checkASAP.Checked)
            {
                gridMain.BeginUpdate();
                gridMain.ListGridRows.Clear();
                gridMain.EndUpdate();
                return;
            }
            DataTable table = GetAppointments();

            gridMain.BeginUpdate();
            //Columns
            gridMain.ListGridColumns.Clear();
            GridColumn col;

            if (PrefC.HasClinicsEnabled)
            {
                col = new GridColumn(Lan.g(this, "Clinic"), 100);
                gridMain.ListGridColumns.Add(col);
            }
            col = new GridColumn(Lan.g(this, "Date Time Created"), 150);
            gridMain.ListGridColumns.Add(col);
            col = new GridColumn(Lan.g(this, "Appt Date Time"), 150);
            gridMain.ListGridColumns.Add(col);
            col = new GridColumn(Lan.g(this, "Patient Name"), 150);
            gridMain.ListGridColumns.Add(col);
            col = new GridColumn(Lan.g(this, "Patient DOB"), 100);
            gridMain.ListGridColumns.Add(col);
            col = new GridColumn(Lan.g(this, "Confirmation Status"), 150);
            gridMain.ListGridColumns.Add(col);
            col = new GridColumn(Lan.g(this, "Appt Note"), 300);
            gridMain.ListGridColumns.Add(col);
            //Rows
            gridMain.ListGridRows.Clear();
            DataColumnCollection columns = table.Columns;

            foreach (DataRow row in table.Rows)
            {
                GridCell[] cellsArray = new GridCell[gridMain.ListGridColumns.Count];
                GridRow    newRow     = new GridRow();
                if (PrefC.HasClinicsEnabled)
                {
                    newRow.Cells.Add(row["ClinicDesc"].ToString());
                }
                newRow.Cells.Add(PIn.Date(row["DateTimeCreated"].ToString()).ToString("d"));
                newRow.Cells.Add(row["AptDateTime"].ToString());
                newRow.Cells.Add(row["PatName"].ToString());
                newRow.Cells.Add(PIn.Date(row["Birthdate"].ToString()).ToString("d"));
                newRow.Cells.Add(Defs.GetDef(DefCat.ApptConfirmed, PIn.Long(row["Confirmed"].ToString())).ItemName);
                newRow.Cells.Add(row["Note"].ToString());
                newRow.Tag = row["AptNum"].ToString();
                gridMain.ListGridRows.Add(newRow);
            }
            gridMain.EndUpdate();
        }
예제 #4
0
        private void FillGrid()
        {
            gridMain.BeginUpdate();
            GridColumn col = new GridColumn("Date", 70);

            gridMain.ListGridColumns.Add(col);
            col = new GridColumn("Patient", 100);
            gridMain.ListGridColumns.Add(col);
            col = new GridColumn("Category", 80);
            gridMain.ListGridColumns.Add(col);
            col = new GridColumn("Total Cost", 80);
            gridMain.ListGridColumns.Add(col);
            col = new GridColumn("Balance", 80);
            gridMain.ListGridColumns.Add(col);
            col = new GridColumn("Due Now", 80);
            gridMain.ListGridColumns.Add(col);
            List <long>     listPayPlanNums = _listValidPayPlans.Select(x => x.PayPlanNum).ToList();
            List <PaySplit> listPaySplits   = PaySplits.GetForPayPlans(listPayPlanNums);
            List <Patient>  listPats        = Patients.GetLimForPats(_listValidPayPlans.Select(x => x.PatNum).ToList());

            for (int i = 0; i < _listValidPayPlans.Count; i++)
            {
                //no db calls are made in this loop because we have all the necessary information already.
                PayPlan planCur = _listValidPayPlans[i];
                Patient patCur  = listPats.Where(x => x.PatNum == planCur.PatNum).FirstOrDefault();
                GridRow row     = new GridRow();
                row.Cells.Add(planCur.PayPlanDate.ToShortDateString());       //date
                row.Cells.Add(patCur.LName + ", " + patCur.FName);            //patient
                if (planCur.PlanCategory == 0)
                {
                    row.Cells.Add(Lan.g(this, "None"));
                }
                else
                {
                    row.Cells.Add(Defs.GetDef(DefCat.PayPlanCategories, planCur.PlanCategory).ItemName);
                }
                row.Cells.Add(PayPlans.GetTotalCost(planCur.PayPlanNum, _listPayPlanCharges).ToString("F"));               //total cost
                row.Cells.Add(PayPlans.GetBalance(planCur.PayPlanNum, _listPayPlanCharges, listPaySplits).ToString("F"));  //balance
                row.Cells.Add(PayPlans.GetDueNow(planCur.PayPlanNum, _listPayPlanCharges, listPaySplits).ToString("F"));   //due now
                row.Tag = planCur.PayPlanNum;
                gridMain.ListGridRows.Add(row);
            }
            gridMain.EndUpdate();
        }
예제 #5
0
        private void FillGrid()
        {
            List <DiscountPlan>    listDiscountPlans  = DiscountPlans.GetAll(checkShowHidden.Checked);
            Dictionary <long, int> dictPatientsOnPlan = DiscountPlans.GetPatCountsForPlans(listDiscountPlans.Select(x => x.DiscountPlanNum).ToList());

            listDiscountPlans.Sort(DiscountPlanComparer);
            gridMain.BeginUpdate();
            gridMain.ListGridColumns.Clear();
            gridMain.ListGridColumns.Add(new GridColumn(Lan.g("TableDiscountPlans", "Description"), 200));
            gridMain.ListGridColumns.Add(new GridColumn(Lan.g("TableDiscountPlans", "Fee Schedule"), 170));
            gridMain.ListGridColumns.Add(new GridColumn(Lan.g("TableDiscountPlans", "Adjustment Type"), checkShowHidden.Checked ? 150 : 170));
            gridMain.ListGridColumns.Add(new GridColumn(Lan.g("TableDiscountPlans", "Pats"), 40));
            if (checkShowHidden.Checked)
            {
                gridMain.ListGridColumns.Add(new GridColumn(Lan.g("TableDiscountPlans", "Hidden"), 20, HorizontalAlignment.Center));
            }
            gridMain.ListGridRows.Clear();
            GridRow row;
            int     selectedIdx = -1;

            for (int i = 0; i < listDiscountPlans.Count; i++)
            {
                Def adjType = Defs.GetDef(DefCat.AdjTypes, listDiscountPlans[i].DefNum);
                row = new GridRow();
                row.Cells.Add(listDiscountPlans[i].Description);
                row.Cells.Add(FeeScheds.GetDescription(listDiscountPlans[i].FeeSchedNum));
                row.Cells.Add((adjType == null) ? "" : adjType.ItemName);
                row.Cells.Add(dictPatientsOnPlan.ContainsKey(listDiscountPlans[i].DiscountPlanNum)
                                        ? dictPatientsOnPlan[listDiscountPlans[i].DiscountPlanNum].ToString() : "0");
                if (checkShowHidden.Checked)
                {
                    row.Cells.Add(listDiscountPlans[i].IsHidden ? "X" : "");
                }
                row.Tag = listDiscountPlans[i];
                gridMain.ListGridRows.Add(row);
                if (SelectedPlan != null && listDiscountPlans[i].DiscountPlanNum == SelectedPlan.DiscountPlanNum)
                {
                    selectedIdx = i;
                }
            }
            gridMain.EndUpdate();
            gridMain.SetSelected(selectedIdx, true);
        }
예제 #6
0
 public void RecalculateAdjAmt(double remBefore)
 {
     if (AdjAmtType == AdjAmtType.FixedAmt)
     {
         Adj.AdjAmt = AdjAmtOrPerc;
     }
     else if (AdjAmtType == AdjAmtType.PercentOfRemBal)
     {
         Adj.AdjAmt = Math.Round((AdjAmtOrPerc / 100) * remBefore, 2);
     }
     else if (AdjAmtType == AdjAmtType.PercentOfFee)
     {
         Adj.AdjAmt = Math.Round((AdjAmtOrPerc / 100) * Proc.ProcFee, 2);
     }
     if ((Defs.GetDef(DefCat.AdjTypes, Adj.AdjType)).ItemValue == "-")              //uses the cache
     {
         Adj.AdjAmt = Adj.AdjAmt * -1;
     }
 }
예제 #7
0
 ///<summary>Fill the rest of the UI with the current bridge settings.</summary>
 private void FillSettings()
 {
     //Set Enabled
     checkEnabled.Checked = Programs.IsEnabled(ProgramName.AvaTax);
     //Set radio buttons
     if (AvaTax.IsProduction)
     {
         radioProdEnv.Checked = true;
     }
     else
     {
         radioTestEnv.Checked = true;
     }
     //Set username and password
     textUsername.Text = ProgramProperties.GetPropVal(ProgramName.AvaTax, ProgramProperties.PropertyDescs.Username);
     textPassword.Text = ProgramProperties.GetPropVal(ProgramName.AvaTax, ProgramProperties.PropertyDescs.Password);
     //Fill Log Level options
     listBoxLogLevel.Items.Clear();
     foreach (LogLevel lv in Enum.GetValues(typeof(LogLevel)))
     {
         ODBoxItem <LogLevel> currentItem = new ODBoxItem <LogLevel>(lv.ToString(), lv);
         listBoxLogLevel.Items.Add(currentItem);
         if (currentItem.Tag == AvaTax.LogDetailLevel)
         {
             listBoxLogLevel.SelectedItem = currentItem;
         }
     }
     //Set company code and sales tax def
     textCompanyCode.Text             = AvaTax.CompanyCode;
     _defCurrentSalesTaxAdjType       = Defs.GetDef(DefCat.AdjTypes, AvaTax.SalesTaxAdjType);
     textAdjType.Text                 = _defCurrentSalesTaxAdjType.ItemName;
     _defCurrentSalesTaxReturnAdjType = Defs.GetDef(DefCat.AdjTypes, AvaTax.SalesTaxReturnAdjType) ?? new Def();
     textReturnAdjType.Text           = _defCurrentSalesTaxReturnAdjType.ItemName;
     _patFieldDefCurrentTaxExempt     = AvaTax.TaxExemptPatField;
     textTaxExempt.Text               = (_patFieldDefCurrentTaxExempt != null) ? _patFieldDefCurrentTaxExempt.FieldName : "";
     validTaxLockDate.Text            = AvaTax.TaxLockDate.ToShortDateString();
     //Set list of procCodes
     textPrePayCodes.Text   = ProgramProperties.GetPropVal(ProgramName.AvaTax, "Prepay Proc Codes");
     textDiscountCodes.Text = ProgramProperties.GetPropVal(ProgramName.AvaTax, "Discount Proc Codes");
     //Set the list of overrides
     textOverrides.Text = ProgramProperties.GetPropVal(ProgramName.AvaTax, "Tax Code Overrides");
 }
예제 #8
0
        ///<summary>Returns true if the patient's billing type matches the autocondition billing type.</summary>
        private static bool BillingTypeComparison(AutomationCondition autoCond, long patNum)
        {
            Patient pat         = Patients.GetPat(patNum);
            Def     patBillType = Defs.GetDef(DefCat.BillingTypes, pat.BillingType);

            if (patBillType == null)
            {
                return(false);
            }
            switch (autoCond.Comparison)
            {
            case AutoCondComparison.Equals:
                return(patBillType.ItemName.ToLower() == autoCond.CompareString.ToLower());

            case AutoCondComparison.Contains:
                return(patBillType.ItemName.ToLower().Contains(autoCond.CompareString.ToLower()));

            default:
                return(false);
            }
        }
        ///<summary>Removes 'Do not send eConfirmations' from the confirmed status for 'eConfirm Sent' if multiple eConfirmations are set up.</summary>
        private void CheckMultipleEConfirms()
        {
            int           countEConfirm          = _listRulesClinic?.Count(x => x.TypeCur == ApptReminderType.ConfirmationFutureDay) ?? 0;
            string        confStatusEConfirmSent = Defs.GetDef(DefCat.ApptConfirmed, PrefC.GetLong(PrefName.ApptEConfirmStatusSent)).ItemName;
            List <string> listExclude            = PrefC.GetString(PrefName.ApptConfirmExcludeESend)
                                                   .Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries).ToList();

            if (ApptReminderRuleCur.TypeCur == ApptReminderType.ConfirmationFutureDay
                //And there is more than 1 eConfirmation rule.
                && (countEConfirm > 1 || (countEConfirm == 1 && ApptReminderRuleCur.ApptReminderRuleNum == 0))
                //And the confirmed status for 'eConfirm Sent' is marked 'Do not send eConfirmations'
                && listExclude.Contains(PrefC.GetString(PrefName.ApptEConfirmStatusSent))
                //Ask them to fix their exclude send statuses
                && MessageBox.Show(Lans.g(this, "Appointments will not receive multiple eConfirmations if the '") + confStatusEConfirmSent + "' " +
                                   Lans.g(this, "status is set as 'Don't Send'. Would you like to remove 'Don't Send' from that status?"),
                                   "", MessageBoxButtons.YesNo) == DialogResult.Yes)
            {
                listExclude.RemoveAll(x => x == PrefC.GetString(PrefName.ApptEConfirmStatusSent));
                IsPrefsChanged |= Prefs.UpdateString(PrefName.ApptConfirmExcludeESend, string.Join(",", listExclude));
            }
        }
예제 #10
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 " + Defs.GetDef(DefCat.Diagnosis, procOld.Dx).ItemName
                           + " to " + Defs.GetDef(DefCat.Diagnosis, procCur.Dx).ItemName + ".";
            }
            if (procOld.Priority != procCur.Priority)
            {
                if (Changes != "")
                {
                    Changes += "\r\n";
                }
                Changes += "Priority changed from " + ((procOld.Priority != 0)?Defs.GetDef(DefCat.TxPriorities, procOld.Priority).ItemName:"no priority")
                           + " to " + ((procCur.Priority != 0)?Defs.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.GetAbbr(procOld.ClinicNum) + " to " + Clinics.GetAbbr(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?Defs.GetDef(DefCat.BillingTypes,procOld.BillingTypeOne).ItemName:"none")
            //		+" to "+(procCur.BillingTypeOne!=0?Defs.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?Defs.GetDef(DefCat.BillingTypes,procOld.BillingTypeTwo).ItemName:"none")
            //		+" to "+(procCur.BillingTypeTwo!=0?Defs.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);
        }
        ///<summary>Fills the paysplit grid.</summary>
        private void FillGridSplits()
        {
            //Fill left grid with paysplits created
            gridSplits.BeginUpdate();
            gridSplits.ListGridColumns.Clear();
            gridSplits.ListGridColumns.Add(new GridColumn(Lan.g(this, "Date"), 65, HorizontalAlignment.Center));
            gridSplits.ListGridColumns.Add(new GridColumn(Lan.g(this, "Prov"), 40));
            if (PrefC.HasClinicsEnabled)             //Clinics
            {
                gridSplits.ListGridColumns.Add(new GridColumn(Lan.g(this, "Clinic"), 40));
            }
            gridSplits.ListGridColumns.Add(new GridColumn(Lan.g(this, "Patient"), 100));
            gridSplits.ListGridColumns.Add(new GridColumn(Lan.g(this, "ProcCode"), 60));
            gridSplits.ListGridColumns.Add(new GridColumn(Lan.g(this, "Type"), 100));
            gridSplits.ListGridColumns.Add(new GridColumn(Lan.g(this, "Amount"), 55, HorizontalAlignment.Right));
            gridSplits.ListGridRows.Clear();
            GridRow row;
            decimal splitTotal = 0;
            Dictionary <long, Procedure> dictProcs = Procedures.GetManyProc(_listSplitsCur.Where(x => x.ProcNum > 0).Select(x => x.ProcNum).Distinct().ToList(), false).ToDictionary(x => x.ProcNum);

            for (int i = 0; i < _listSplitsCur.Count; i++)
            {
                splitTotal += (decimal)_listSplitsCur[i].SplitAmt;
                row         = new GridRow();
                row.Tag     = _listSplitsCur[i];
                row.Cells.Add(_listSplitsCur[i].DatePay.ToShortDateString()); //Date
                row.Cells.Add(Providers.GetAbbr(_listSplitsCur[i].ProvNum));  //Prov
                if (PrefC.HasClinicsEnabled)                                  //Clinics
                {
                    if (_listSplitsCur[i].ClinicNum != 0)
                    {
                        row.Cells.Add(Clinics.GetClinic(_listSplitsCur[i].ClinicNum).Description);                        //Clinic
                    }
                    else
                    {
                        row.Cells.Add("");                        //Clinic
                    }
                }
                Patient patCur;
                if (!_dictPatients.TryGetValue(_listSplitsCur[i].PatNum, out patCur))
                {
                    patCur = Patients.GetPat(_listSplitsCur[i].PatNum);
                }
                row.Cells.Add(patCur.GetNameFL());                //Patient
                Procedure proc = new Procedure();
                if (_listSplitsCur[i].ProcNum > 0 && !dictProcs.TryGetValue(_listSplitsCur[i].ProcNum, out proc))
                {
                    proc = Procedures.GetOneProc(_listSplitsCur[i].ProcNum, false);
                }
                row.Cells.Add(ProcedureCodes.GetStringProcCode(proc?.CodeNum ?? 0));              //ProcCode
                string type = "";
                if (_listSplitsCur[i].PayPlanNum != 0)
                {
                    type += "PayPlanCharge";                  //Type
                    if (_listSplitsCur[i].IsInterestSplit && _listSplitsCur[i].ProcNum == 0 && _listSplitsCur[i].ProvNum != 0)
                    {
                        type += " (interest)";
                    }
                }
                if (_listSplitsCur[i].ProcNum != 0)               //Procedure
                {
                    string procDesc = Procedures.GetDescription(proc ?? new Procedure());
                    if (type != "")
                    {
                        type += "\r\n";
                    }
                    type += "Proc: " + procDesc;                //Type
                }
                if (_listSplitsCur[i].ProvNum == 0)             //Unattached split
                {
                    if (type != "")
                    {
                        type += "\r\n";
                    }
                    type += "Unallocated";                  //Type
                }
                if (_listSplitsCur[i].ProvNum != 0 && _listSplitsCur[i].UnearnedType != 0)
                {
                    if (type != "")
                    {
                        type += "\r\n";
                    }
                    type += Defs.GetDef(DefCat.PaySplitUnearnedType, _listSplitsCur[i].UnearnedType).ItemName;
                }
                row.Cells.Add(type);
                if (row.Cells[row.Cells.Count - 1].Text == "Unallocated")
                {
                    row.Cells[row.Cells.Count - 1].ColorText = Color.Red;
                }
                row.Cells.Add(_listSplitsCur[i].SplitAmt.ToString("f"));                //Amount
                gridSplits.ListGridRows.Add(row);
            }
            gridSplits.EndUpdate();
            textSplitTotal.Text = splitTotal.ToString("f");
            FillGridCharges();
        }