private void FormInsSelectSubscr_Load(object sender, System.EventArgs e)
        {
            SubList = InsSubs.GetListForSubscriber(Subscriber);
            List <InsPlan> planList = InsPlans.RefreshForSubList(SubList);
            //PatPlan[] patPlanArray;
            string  str;
            InsPlan plan;

            if (!InsSubs.ValidatePlanNumForList(SubList.Select(x => x.InsSubNum).ToList()))             //If !isValid, any links should have been fixed and we now need to update our list.
            {
                SubList = InsSubs.GetListForSubscriber(Subscriber);
            }
            for (int i = 0; i < SubList.Count; i++)
            {
                plan = InsPlans.GetPlan(SubList[i].PlanNum, planList);
                str  = InsPlans.GetCarrierName(SubList[i].PlanNum, planList);
                if (plan.GroupNum != "")
                {
                    str += Lan.g(this, " group:") + plan.GroupNum;
                }
                int countPatPlans = PatPlans.GetCountBySubNum(SubList[i].InsSubNum);
                if (countPatPlans == 0)
                {
                    str += " " + Lan.g(this, "(not in use)");
                }
                listPlans.Items.Add(str);
            }
        }
 private InsPlan InsertOrUpdateInsPlan(InsPlan insPlan, Hx834_Member member, Carrier carrier, bool isInsertAllowed = true)
 {
     //The code below mimics how insurance plans are created in ContrFamily.ToolButIns_Click().
     if (insPlan == null)
     {
         insPlan = new InsPlan();
         if (member.InsFiling != null)
         {
             insPlan.FilingCode = member.InsFiling.InsFilingCodeNum;
         }
         insPlan.GroupName            = "";
         insPlan.GroupNum             = member.GroupNum;
         insPlan.PlanNote             = "";
         insPlan.FeeSched             = 0;
         insPlan.PlanType             = "";
         insPlan.ClaimFormNum         = PrefC.GetLong(PrefName.DefaultClaimForm);
         insPlan.UseAltCode           = false;
         insPlan.ClaimsUseUCR         = false;
         insPlan.CopayFeeSched        = 0;
         insPlan.EmployerNum          = 0;
         insPlan.CarrierNum           = carrier.CarrierNum;
         insPlan.AllowedFeeSched      = 0;
         insPlan.TrojanID             = "";
         insPlan.DivisionNo           = "";
         insPlan.IsMedical            = false;
         insPlan.FilingCode           = 0;
         insPlan.DentaideCardSequence = 0;
         insPlan.ShowBaseUnits        = false;
         insPlan.CodeSubstNone        = false;
         insPlan.IsHidden             = false;
         insPlan.MonthRenew           = 0;
         insPlan.FilingCodeSubtype    = 0;
         insPlan.CanadianPlanFlag     = "";
         insPlan.CobRule            = EnumCobRule.Basic;
         insPlan.HideFromVerifyList = false;
         if (isInsertAllowed)
         {
             InsPlans.Insert(insPlan);
             SecurityLogs.MakeLogEntry(Permissions.InsPlanCreate, 0, "Insurance plan for carrier '" + carrier.CarrierName + "' and groupnum "
                                       + "'" + insPlan.GroupNum + "' created from Import Ins Plans 834.", insPlan.PlanNum, LogSources.InsPlanImport834,
                                       DateTime.MinValue);   //new insplan, no date needed
         }
     }
     else
     {
         InsPlan insPlanOld = insPlan.Copy();
         if (member.InsFiling != null)
         {
             insPlan.FilingCode = member.InsFiling.InsFilingCodeNum;
         }
         insPlan.GroupNum = member.GroupNum;
         if (OpenDentBusiness.Crud.InsPlanCrud.UpdateComparison(insPlan, insPlanOld))
         {
             InsPlans.Update(insPlan, insPlanOld);
             SecurityLogs.MakeLogEntry(Permissions.InsPlanEdit, 0, "Insurance plan for carrier '" + carrier.CarrierName + "' and groupnum "
                                       + "'" + insPlan.GroupNum + "' edited from Import Ins Plans 834.", insPlan.PlanNum, LogSources.InsPlanImport834, insPlanOld.SecDateTEdit);
         }
     }
     return(insPlan);
 }
Example #3
0
        private void gridMain_CellDoubleClick(object sender, ODGridClickEventArgs e)
        {
            InsPlan plan = InsPlans.GetPlan(PIn.Long(table.Rows[e.Row]["PlanNum"].ToString()), null);

            if (plan == null || plan.PlanNum == 0)
            {
                MsgBox.Show(this, "Insurance plan selected no longer exists.");
                FillGrid();
                return;
            }
            if (IsSelectMode)
            {
                SelectedPlan = plan.Copy();
                DialogResult = DialogResult.OK;
                return;
            }
            FormInsPlan FormIP = new FormInsPlan(plan, null, null);

            FormIP.ShowDialog();
            if (FormIP.DialogResult != DialogResult.OK)
            {
                return;
            }
            FillGrid();
        }
Example #4
0
        private void butRecall_Click(object sender, System.EventArgs e)
        {
            Procedure[] procList   = Procedures.Refresh(PatCur.PatNum);
            Recall[]    recallList = Recalls.GetList(new int[] { PatCur.PatNum });     //get the recall for this pt
            if (recallList.Length == 0)
            {
                MsgBox.Show(this, "This patient does not have any recall due.");
                return;
            }
            Recall recallCur = recallList[0];

            InsPlan[]   planList = InsPlans.Refresh(FamCur);
            Appointment apt      = Appointments.CreateRecallApt(PatCur, procList, recallCur, planList);

            AptSelected = apt.AptNum;
            oResult     = OtherResult.PinboardAndSearch;
            if (recallCur.DateDue < DateTime.Today)
            {
                DateJumpToString = DateTime.Today.ToShortDateString();              //they are overdue
            }
            else
            {
                DateJumpToString = recallCur.DateDue.ToShortDateString();
            }
            DialogResult = DialogResult.OK;
        }
Example #5
0
        public void RefreshInsurance(Patient pat, List <InsPlan> listInsPlans, List <InsSub> listInsSubs, List <PatPlan> listPatPlans, List <Benefit> listBenefits)
        {
            textFamPriMax.Text = "";
            textFamPriDed.Text = "";
            textFamSecMax.Text = "";
            textFamSecDed.Text = "";
            if (pat == null)
            {
                return;
            }
            double  maxFam = 0;
            double  maxInd = 0;
            double  dedFam = 0;
            InsPlan PlanCur;            //=new InsPlan();
            InsSub  SubCur;

            if (listPatPlans.Count > 0)
            {
                SubCur  = InsSubs.GetSub(listPatPlans[0].InsSubNum, listInsSubs);
                PlanCur = InsPlans.GetPlan(SubCur.PlanNum, listInsPlans);
                maxFam  = Benefits.GetAnnualMaxDisplay(listBenefits, PlanCur.PlanNum, listPatPlans[0].PatPlanNum, true);
                maxInd  = Benefits.GetAnnualMaxDisplay(listBenefits, PlanCur.PlanNum, listPatPlans[0].PatPlanNum, false);
                if (maxFam == -1)
                {
                    textFamPriMax.Text = "";
                }
                else
                {
                    textFamPriMax.Text = maxFam.ToString("F");
                }
                //deductible:
                dedFam = Benefits.GetDeductGeneralDisplay(listBenefits, PlanCur.PlanNum, listPatPlans[0].PatPlanNum, BenefitCoverageLevel.Family);
                if (dedFam != -1)
                {
                    textFamPriDed.Text = dedFam.ToString("F");
                }
            }
            if (listPatPlans.Count > 1)
            {
                SubCur  = InsSubs.GetSub(listPatPlans[1].InsSubNum, listInsSubs);
                PlanCur = InsPlans.GetPlan(SubCur.PlanNum, listInsPlans);
                //max=Benefits.GetAnnualMaxDisplay(listBenefits,PlanCur.PlanNum,listPatPlans[1].PatPlanNum);
                maxFam = Benefits.GetAnnualMaxDisplay(listBenefits, PlanCur.PlanNum, listPatPlans[1].PatPlanNum, true);
                maxInd = Benefits.GetAnnualMaxDisplay(listBenefits, PlanCur.PlanNum, listPatPlans[1].PatPlanNum, false);
                if (maxFam == -1)
                {
                    textFamSecMax.Text = "";
                }
                else
                {
                    textFamSecMax.Text = maxFam.ToString("F");
                }
                //deductible:
                dedFam = Benefits.GetDeductGeneralDisplay(listBenefits, PlanCur.PlanNum, listPatPlans[1].PatPlanNum, BenefitCoverageLevel.Family);
                if (dedFam != -1)
                {
                    textFamSecDed.Text = dedFam.ToString("F");
                }
            }
        }
Example #6
0
 ///<summary></summary>
 public FormInsPlanSelect(long patNum)
 {
     InitializeComponent();
     PatNum = patNum;
     //usage: eg. from coverage.  Since can be totally new subscriber, get all plans for them.
     FamCur              = Patients.GetFamily(PatNum);
     PatCur              = FamCur.GetPatient(PatNum);
     SubList             = InsSubs.RefreshForFam(FamCur);
     PlanList            = InsPlans.RefreshForSubList(SubList);
     _listPatCurPatPlans = PatPlans.Refresh(PatNum);
     if (_listPatCurPatPlans.Count == 1)
     {
         try {
             PatRelat     = _listPatCurPatPlans[0].Relationship;
             SelectedSub  = SubList.FirstOrDefault(x => x.InsSubNum == _listPatCurPatPlans[0].InsSubNum);
             SelectedPlan = InsPlans.GetPlan(SelectedSub.PlanNum, PlanList);
             if (SelectedSub == null || SelectedPlan == null)
             {
                 throw new ApplicationException();
             }
         }
         catch {
             PatRelat     = 0;
             SelectedSub  = null;
             SelectedPlan = null;
         }
     }
     //tbPlans.CellDoubleClicked += new OpenDental.ContrTable.CellEventHandler(tbPlans_CellDoubleClicked);
     Lan.F(this);
 }
Example #7
0
        ///<summary>Retrieves data and uses them to create new PayPlanExtended objects.
        ///Heavy lifting (db calls and double loops) done here once upon load.  This also gets called if the user clicks "Refresh Data".</summary>
        private bool LoadData()
        {
            List <PayPlan>       listPayPlans;
            List <PayPlanCharge> listPayPlanCharges;
            List <ClaimProc>     listPayPlanClaimProcs;
            List <Patient>       listPatients;
            List <InsPlan>       listInsPlans;

            listPayPlans = PayPlans.GetAllOpenInsPayPlans();
            if (listPayPlans.Count == 0)
            {
                MsgBox.Show(this, "There are no insurance payment plans past due.");
                return(false);
            }
            listPayPlanCharges    = PayPlanCharges.GetForPayPlans(listPayPlans.Select(x => x.PayPlanNum).ToList()).Where(x => x.ChargeType == PayPlanChargeType.Debit).ToList();
            listPayPlanClaimProcs = ClaimProcs.GetForPayPlans(listPayPlans.Select(x => x.PayPlanNum).ToList()
                                                              , new List <ClaimProcStatus>()
            {
                ClaimProcStatus.Received, ClaimProcStatus.Supplemental
            });
            listPatients         = Patients.GetLimForPats(listPayPlans.Select(x => x.PatNum).ToList());
            listInsPlans         = InsPlans.GetPlans(listPayPlans.Select(x => x.PlanNum).ToList());
            _listPayPlanExtended = new List <PayPlanExtended>();
            foreach (PayPlan plan in listPayPlans)
            {
                //for each payplan, create a PayPlanExtended object which contains all of the payment plan's information and it's charges.
                //pass in the plan, the list of associated charges, and the list of associated claimprocs (payments).
                _listPayPlanExtended.Add(new PayPlanExtended(plan,
                                                             listPatients.FirstOrDefault(x => x.PatNum == plan.PatNum),
                                                             listPayPlanCharges.Where(x => x.PayPlanNum == plan.PayPlanNum).ToList(),
                                                             listPayPlanClaimProcs.Where(x => x.PayPlanNum == plan.PayPlanNum).ToList(),
                                                             listInsPlans.FirstOrDefault(x => x.PlanNum == plan.PlanNum)));
            }
            return(true);
        }
Example #8
0
 private void FormRecallListEdit_Load(object sender, System.EventArgs e)
 {
     contrAccount3.ViewingInRecall = true;
     contrAccount3.InstantClasses();
     contrAccount3.ModuleSelected(RecallCur.PatNum);
     //also refreshes these internal classes:family,patients,procedures,insplans
     //and these global classes:claims,adjustments
     //paysplits,covpats and patientnotes.
     FamCur               = Patients.GetFamily(RecallCur.PatNum);
     PatCur               = FamCur.GetPatient(RecallCur.PatNum);
     PlanList             = InsPlans.Refresh(FamCur);
     ProcList             = Procedures.Refresh(PatCur.PatNum);
     Text                 = "Recall for " + PatCur.GetNameLF();
     textCreditType.Text  = PatCur.CreditType;
     textBillingType.Text = DefB.GetName(DefCat.BillingTypes, PatCur.BillingType);
     //textPriIns.Text=InsPlans.GetDescript(PatCur.PriPlanNum,FamCur,PlanList);
     textHmPhone.Text       = PatCur.HmPhone;
     textWkPhone.Text       = PatCur.WkPhone;
     textWirelessPhone.Text = PatCur.WirelessPhone;
     textEmail.Text         = PatCur.Email;
     textAddrNotes.Text     = PatCur.AddrNote;
     for (int i = 0; i < Enum.GetNames(typeof(ContactMethod)).Length; i++)
     {
         comboRecallMethod.Items.Add(Lan.g("enumContactMethod", Enum.GetNames(typeof(ContactMethod))[i]));
     }
     comboRecallMethod.SelectedIndex = (int)PatCur.PreferRecallMethod;
     FillRecall();
 }
        private void OnLabels_Click()
        {
            if (gridMain.SelectedIndices.Length == 0)
            {
                MessageBox.Show(Lan.g(this, "Please select an item first."));
                return;
            }
            PrintDocument pd = new PrintDocument();          //only used to pass printerName

            if (!Printers.SetPrinter(pd, PrintSituation.LabelSingle))
            {
                return;
            }
            Carrier carrier;
            Claim   claim;
            InsPlan plan;

            for (int i = 0; i < gridMain.SelectedIndices.Length; i++)
            {
                claim   = Claims.GetClaim(listQueue[gridMain.SelectedIndices[i]].ClaimNum);
                plan    = InsPlans.GetPlan(claim.PlanNum, new InsPlan[] {});
                carrier = Carriers.GetCarrier(plan.CarrierNum);
                LabelSingle label = new LabelSingle();
                if (!label.PrintIns(carrier, pd.PrinterSettings.PrinterName))
                {
                    return;
                }
            }
        }
 private void FormInsSelectSubscr_Load(object sender, System.EventArgs e)
 {
     PlanList = InsPlans.GetListForSubscriber(Subscriber);
     for (int i = 0; i < PlanList.Length; i++)
     {
         listPlans.Items.Add(InsPlans.GetCarrierName(PlanList[i].PlanNum, PlanList));
     }
 }
Example #11
0
        private void gridMain_CellDoubleClick(object sender, ODGridClickEventArgs e)
        {
            InsPlan     plan   = InsPlans.GetPlan(SubList[e.Row].PlanNum, PlanList);
            FormInsPlan FormIP = new FormInsPlan(plan, null, SubList[e.Row]);

            FormIP.ShowDialog();
            FillGrid();
        }
Example #12
0
        private void butCombine_Click(object sender, System.EventArgs e)
        {
            if (gridMain.SelectedIndices.Length < 2)
            {
                MessageBox.Show(Lan.g(this, "Please select multiple items first while holding down the control key."));
                return;
            }
            if (MessageBox.Show(Lan.g(this, "Combine all these carriers into a single carrier? This will affect all patients using these carriers.  The next window will let you select which carrier to keep when combining."), ""
                                , MessageBoxButtons.OKCancel) != DialogResult.OK)
            {
                return;
            }
            List <long> pickedCarrierNums = new List <long>();

            for (int i = 0; i < gridMain.SelectedIndices.Length; i++)
            {
                pickedCarrierNums.Add(PIn.Long(table.Rows[gridMain.SelectedIndices[i]]["CarrierNum"].ToString()));
            }
            FormCarrierCombine FormCB = new FormCarrierCombine();

            FormCB.CarrierNums = pickedCarrierNums;
            FormCB.ShowDialog();
            if (FormCB.DialogResult != DialogResult.OK)
            {
                return;
            }
            changed = true;
            //int[] combCarrierNums=new int[tbCarriers.SelectedIndices.Length];
            //for(int i=0;i<tbCarriers.SelectedIndices.Length;i++){
            //	carrierNums[i]=Carriers.List[tbCarriers.SelectedIndices[i]].CarrierNum;
            //}
            try{
                //Prepare audit trail entry data, then combine, then make audit trail entries if successful
                List <string>       carrierNames = new List <string>();
                List <List <long> > insPlanNums  = new List <List <long> >();
                string carrierTo = Carriers.GetName(FormCB.PickedCarrierNum);
                for (int i = 0; i < pickedCarrierNums.Count; i++)
                {
                    carrierNames.Add(Carriers.GetName(pickedCarrierNums[i]));
                    insPlanNums.Add(InsPlans.GetPlanNumsByCarrierNum(pickedCarrierNums[i]));
                }
                Carriers.Combine(pickedCarrierNums, FormCB.PickedCarrierNum);
                //Carriers were combined successfully. Loop through all the associated insplans and make a securitylog entry that their carrier changed.
                for (int i = 0; i < insPlanNums.Count; i++)
                {
                    for (int j = 0; j < insPlanNums[i].Count; j++)
                    {
                        SecurityLogs.MakeLogEntry(Permissions.InsPlanChangeCarrierName, 0, Lan.g(this, "Carrier with name ") + " " + carrierNames[i] + " "
                                                  + Lan.g(this, "was merged with") + " " + carrierTo, insPlanNums[i][j]);
                    }
                }
            }
            catch (ApplicationException ex) {
                MessageBox.Show(ex.Message);
                return;
            }
            FillGrid();
        }
Example #13
0
        private void FillGrid()
        {
            SubList = InsSubs.RefreshForFam(FamCur);
            if (!InsSubs.ValidatePlanNumForList(SubList.Select(x => x.InsSubNum).ToList()))
            {
                SubList = InsSubs.RefreshForFam(FamCur);
            }
            PlanList = InsPlans.RefreshForSubList(SubList);
            gridMain.BeginUpdate();
            gridMain.ListGridColumns.Clear();
            GridColumn col;

            //=new ODGridColumn(Lan.g("TableInsPlans","#"),20);
            //gridMain.Columns.Add(col);
            col = new GridColumn(Lan.g("TableInsPlans", "Subscriber"), 140);
            gridMain.ListGridColumns.Add(col);
            col = new GridColumn(Lan.g("TableInsPlans", "Ins Carrier"), 100);
            gridMain.ListGridColumns.Add(col);
            col = new GridColumn(Lan.g("TableInsPlans", "Date Effect."), 90);
            gridMain.ListGridColumns.Add(col);
            col = new GridColumn(Lan.g("TableInsPlans", "Date Term."), 90);
            gridMain.ListGridColumns.Add(col);
            col = new GridColumn(Lan.g("TableInsPlans", "Used By"), 90);
            gridMain.ListGridColumns.Add(col);
            gridMain.ListGridRows.Clear();
            GridRow row;
            //PatPlan[] patPlanArray;
            InsPlan plan;

            for (int i = 0; i < SubList.Count; i++)
            {
                plan = InsPlans.GetPlan(SubList[i].PlanNum, PlanList);
                row  = new GridRow();
                row.Cells.Add(FamCur.GetNameInFamLF(SubList[i].Subscriber));
                row.Cells.Add(Carriers.GetName(plan.CarrierNum));
                if (SubList[i].DateEffective.Year < 1880)
                {
                    row.Cells.Add("");
                }
                else
                {
                    row.Cells.Add(SubList[i].DateEffective.ToString("d"));
                }
                if (SubList[i].DateTerm.Year < 1880)
                {
                    row.Cells.Add("");
                }
                else
                {
                    row.Cells.Add(SubList[i].DateTerm.ToString("d"));
                }
                int countPatPlans = PatPlans.GetCountBySubNum(SubList[i].InsSubNum);
                row.Cells.Add(countPatPlans.ToString());
                gridMain.ListGridRows.Add(row);
            }
            gridMain.EndUpdate();
        }
Example #14
0
        private void FillPlanData()
        {
            gridMain.BeginUpdate();
            gridMain.Columns.Clear();
            ODGridColumn col;

            //col=new ODGridColumn(Lan.g("TableInsPlans","#"),20);
            //gridMain.Columns.Add(col);
            col = new ODGridColumn(Lan.g("TableInsPlans", "Subscriber"), 140);
            gridMain.Columns.Add(col);
            col = new ODGridColumn(Lan.g("TableInsPlans", "Ins Carrier"), 100);
            gridMain.Columns.Add(col);
            col = new ODGridColumn(Lan.g("TableInsPlans", "Date Effect."), 90);
            gridMain.Columns.Add(col);
            col = new ODGridColumn(Lan.g("TableInsPlans", "Date Term."), 90);
            gridMain.Columns.Add(col);
            col = new ODGridColumn(Lan.g("TableInsPlans", "Used By"), 90);
            gridMain.Columns.Add(col);
            gridMain.Rows.Clear();
            ODGridRow row;
            //PatPlan[] patPlanArray;
            InsPlan plan;

            for (int i = 0; i < SubList.Count; i++)
            {
                row = new ODGridRow();
                //row.Cells.Add((i+1).ToString());
                row.Cells.Add(FamCur.GetNameInFamLF(SubList[i].Subscriber));
                plan = InsPlans.GetPlan(SubList[i].PlanNum, PlanList);
                row.Cells.Add(Carriers.GetName(plan.CarrierNum));
                if (SubList[i].DateEffective.Year < 1880)
                {
                    row.Cells.Add("");
                }
                else
                {
                    row.Cells.Add(SubList[i].DateEffective.ToString("d"));
                }
                if (SubList[i].DateTerm.Year < 1880)
                {
                    row.Cells.Add("");
                }
                else
                {
                    row.Cells.Add(SubList[i].DateTerm.ToString("d"));
                }
                int countPatPlans = PatPlans.GetCountBySubNum(SubList[i].InsSubNum);
                row.Cells.Add(countPatPlans.ToString());
                gridMain.Rows.Add(row);
            }
            gridMain.EndUpdate();
            listRelat.Items.Clear();
            for (int i = 0; i < Enum.GetNames(typeof(Relat)).Length; i++)
            {
                listRelat.Items.Add(Lan.g("enumRelat", Enum.GetNames(typeof(Relat))[i]));
            }
        }
Example #15
0
        private void butMerge_Click(object sender, EventArgs e)
        {
            if (gridMain.SelectedIndices.Length < 2)
            {
                MessageBox.Show(Lan.g(this, "Please select at least two items first."));
                return;
            }
            InsPlan[] listSelected = new InsPlan[gridMain.SelectedIndices.Length];
            for (int i = 0; i < listSelected.Length; i++)
            {
                listSelected[i] = InsPlans.GetPlan(PIn.Long(table.Rows[gridMain.SelectedIndices[i]]["PlanNum"].ToString()), null);
                listSelected[i].NumberSubscribers = PIn.Int(table.Rows[gridMain.SelectedIndices[i]]["subscribers"].ToString());
            }
            FormInsPlansMerge FormI = new FormInsPlansMerge();

            FormI.ListAll = listSelected;
            FormI.ShowDialog();
            if (FormI.DialogResult != DialogResult.OK)
            {
                return;
            }
            //Do the merge.
            InsPlan planToMergeTo = FormI.PlanToMergeTo.Copy();

            //List<Benefit> benList=Benefits.RefreshForPlan(planToMergeTo,0);
            Cursor = Cursors.WaitCursor;
            for (int i = 0; i < listSelected.Length; i++)      //loop through each selected plan
            //skip the planToMergeTo, because it's already correct
            {
                if (planToMergeTo.PlanNum == listSelected[i].PlanNum)
                {
                    continue;
                }
                //==Michael - We are changing plans here, but not carriers, so this is not needed:
                //SecurityLogs.MakeLogEntry(Permissions.InsPlanChangeCarrierName
                InsPlans.ChangeReferences(listSelected[i].PlanNum, planToMergeTo.PlanNum);
                Benefits.DeleteForPlan(listSelected[i].PlanNum);
                InsPlans.Delete(listSelected[i].PlanNum);
                //for(int j=0;j<planNums.Count;j++) {
                //InsPlans.ComputeEstimatesForPlan(planNums[j]);
                //Eliminated in 5.0 for speed.
                //}
            }
            FillGrid();
            //highlight the merged plan
            for (int i = 0; i < table.Rows.Count; i++)
            {
                for (int j = 0; j < listSelected.Length; j++)
                {
                    if (table.Rows[i]["PlanNum"].ToString() == listSelected[j].PlanNum.ToString())
                    {
                        gridMain.SetSelected(i, true);
                    }
                }
            }
            Cursor = Cursors.Default;
        }
Example #16
0
 private void FormClaimCreate_Load(object sender, System.EventArgs e)
 {
     //usage: eg. from coverage.  Since can be totally new subscriber, get all plans for them.
     FamCur   = Patients.GetFamily(PatNum);
     PatCur   = FamCur.GetPatient(PatNum);
     SubList  = InsSubs.RefreshForFam(FamCur);
     PlanList = InsPlans.RefreshForSubList(SubList);
     FillPlanData();
     //FillClaimForms();
 }
 /// <summary>Checks if the insurnace plan selected still exists. Returns true if it does, false if it doesn't. If the plan does not exist a message box is popped up
 /// and the selected index is removed from SubList and listPlans </summary>
 private bool VerifyInsPlanExists()
 {
     if (InsPlans.GetPlan(SubList[listPlans.SelectedIndex].PlanNum, new List <InsPlan>()) == null)
     {
         MsgBox.Show(this, "Insurance plan selected no longer exists.");
         SubList.RemoveAt(listPlans.SelectedIndex);
         listPlans.Items.RemoveAt(listPlans.SelectedIndex);
         return(false);
     }
     return(true);
 }
        private void gridClaims_CellDoubleClick(object sender, UI.ODGridClickEventArgs e)
        {
            if (!Security.IsAuthorized(Permissions.ClaimView))
            {
                return;
            }
            Claim claim = Claims.GetClaim(((Claim)gridClaims.ListGridRows[e.Row].Tag).ClaimNum); //This is the easiest way to determine if the claim was deleted.

            if (claim == null)                                                                   //Was deleted.
            {
                MsgBox.Show(this, "Claim has been deleted by another user.");
                gridClaims.BeginUpdate();
                gridClaims.ListGridRows.RemoveAt(e.Row);                //This will also deselect the row.
                gridClaims.EndUpdate();
                return;
            }
            FormClaimEdit formCE = new FormClaimEdit(claim, Patients.GetPat(_patNum), Patients.GetFamily(_patNum));

            formCE.ShowDialog();
            claim = Claims.GetClaim(((Claim)gridClaims.ListGridRows[e.Row].Tag).ClaimNum); //This is the easiest way to determine if the claim was deleted.
            if (claim == null)                                                             //Was deleted.
            {
                gridClaims.BeginUpdate();
                gridClaims.ListGridRows.RemoveAt(e.Row);                //This will also deselect the row.
                gridClaims.EndUpdate();
                return;
            }
            if (formCE.DialogResult == DialogResult.OK)
            {
                //Update row
                UI.GridRow row = new UI.GridRow();
                row.Tag = claim;
                row.Cells.Add(claim.DateService.ToShortDateString());                           //DOS
                row.Cells.Add(Carriers.GetName(InsPlans.RefreshOne(claim.PlanNum).CarrierNum)); //Carrier
                row.Cells.Add(Claims.GetClaimStatusString(claim.ClaimStatus));                  //Status
                if (PrefC.HasClinicsEnabled)                                                    //Using clinics
                {
                    Clinic clinic = Clinics.GetClinic(claim.ClinicNum);
                    if (clinic == null)
                    {
                        row.Cells.Add("");                        //Clinic
                    }
                    else
                    {
                        row.Cells.Add(clinic.Description);                        //Clinic
                    }
                }
                row.Cells.Add(claim.ClaimFee.ToString("f"));                //Claimfee
                gridClaims.BeginUpdate();
                gridClaims.ListGridRows[e.Row] = row;
                gridClaims.EndUpdate();
                gridClaims.SetSelected(e.Row, true);               //Reselect Row
            }
        }
Example #19
0
        private void checkIsHidden_Click(object sender, EventArgs e)
        {
            //Don't allow fees to be hidden if they are in use by a provider.
            if (!checkIsHidden.Checked)
            {
                return;                //Unhiding a fee. OK.
            }
            if (FeeSchedCur.FeeSchedType != FeeScheduleType.Normal)
            {
                return;                //Not Normal fee. Not in use by a provider.
            }
            List <InsPlan> listInsPlanForFeeSched = InsPlans.GetForFeeSchedNum(FeeSchedCur.FeeSchedNum);

            if (listInsPlanForFeeSched.Count > 0)
            {
                string insPlanMsg = Lan.g(this, "This fee schedule is tied to") + " "
                                    + listInsPlanForFeeSched.Count + " " + Lan.g(this, "insurance plans.") + " " + Lan.g(this, "Continue?");
                if (!MsgBox.Show(this, MsgBoxButtons.OKCancel, insPlanMsg))
                {
                    checkIsHidden.Checked = false;
                    return;
                }
            }
            string providersUsingFee = "";

            for (int i = 0; i < _listProviders.Count; i++)
            {
                if (FeeSchedCur.FeeSchedNum == _listProviders[i].FeeSched)
                {
                    if (providersUsingFee != "")                  //There is a name before this on the list
                    {
                        providersUsingFee += ", ";
                    }
                    providersUsingFee += _listProviders[i].Abbr;
                }
            }
            if (providersUsingFee != "")
            {
                MessageBox.Show(Lan.g(this, "Cannot hide. Fee schedule is currently in use by the following providers") + ":\r\n" + providersUsingFee);
                checkIsHidden.Checked = false;
            }
            string patsUsingFee = "";
            //Don't allow fee schedules to be hidden if they are in use by a non-deleted patient.
            List <Patient> listPats = Patients.GetForFeeSched(FeeSchedCur.FeeSchedNum).FindAll(x => x.PatStatus != PatientStatus.Deleted);

            patsUsingFee = string.Join("\r\n", listPats.Select(x => x.LName + ", " + x.FName));
            if (patsUsingFee != "")
            {
                MsgBoxCopyPaste msgBoxCP = new MsgBoxCopyPaste(Lan.g(this, "Cannot hide. Fee schedule currently in use by the following non-deleted patients")
                                                               + ":\r\n" + patsUsingFee);
                msgBoxCP.ShowDialog();
                checkIsHidden.Checked = false;
            }
        }
Example #20
0
        private void butViewInsPlanFrom_Click(object sender, EventArgs e)
        {
            if (_fromInsPlan == null || InsPlans.GetPlan(_fromInsPlan.PlanNum, new List <InsPlan>()) == null)
            {
                MsgBox.Show(this, "Valid insurance plan not selected.\r\nPlease select a valid insurance plan using the picker button.");
                return;
            }
            FormInsPlan formIP = new FormInsPlan(_fromInsPlan, null, null);

            formIP.ShowDialog();
        }
Example #21
0
        private void FormClaimPayTotal_Shown(object sender, EventArgs e)
        {
            int toothIndexOffset = 0;

            if (Clinics.IsMedicalPracticeOrClinic(Clinics.ClinicNum))
            {
                toothIndexOffset = 1;
            }
            InsPlan plan = InsPlans.GetPlan(ClaimProcsToEdit[0].PlanNum, PlanList);

            gridMain.SetSelected(new Point(4 - toothIndexOffset, 0));
        }
Example #22
0
        private void butOK_Click(object sender, System.EventArgs e)
        {
            if (textCarrierName.Text == "")
            {
                MessageBox.Show(Lan.g(this, "Carrier Name cannot be blank."));
                return;
            }
            string carrierNameOld = CarrierCur.CarrierName;

            CarrierCur.CarrierName = textCarrierName.Text;
            CarrierCur.Phone       = textPhone.Text;
            CarrierCur.Address     = textAddress.Text;
            CarrierCur.Address2    = textAddress2.Text;
            CarrierCur.City        = textCity.Text;
            CarrierCur.State       = textState.Text;
            CarrierCur.Zip         = textZip.Text;
            CarrierCur.ElectID     = textElectID.Text;
            CarrierCur.NoSendElect = checkNoSendElect.Checked;
            CarrierCur.IsHidden    = checkIsHidden.Checked;
            CarrierCur.IsCDA       = checkIsCDAnet.Checked;
            if (IsNew)
            {
                try{
                    Carriers.Insert(CarrierCur);
                }
                catch (ApplicationException ex) {
                    MessageBox.Show(ex.Message);
                    return;
                }
            }
            else
            {
                try{
                    Carriers.Update(CarrierCur);
                    //If the carrier name has changed loop through all the insplans that use this carrier and make a securitylog entry.
                    if (carrierNameOld != CarrierCur.CarrierName)
                    {
                        List <long> insPlanNums = InsPlans.GetPlanNumsByCarrierNum(CarrierCur.CarrierNum);
                        for (int i = 0; i < insPlanNums.Count; i++)
                        {
                            SecurityLogs.MakeLogEntry(Permissions.InsPlanChangeCarrierName, 0, Lan.g(this, "Carrier name changed in Edit Carrier window from") + " "
                                                      + carrierNameOld + " " + Lan.g(this, "to") + " " + CarrierCur.CarrierName,
                                                      insPlanNums[i]);
                        }
                    }
                }
                catch (ApplicationException ex) {
                    MessageBox.Show(ex.Message);
                    return;
                }
            }
            DialogResult = DialogResult.OK;
        }
Example #23
0
 public FormEtrans270Edit(long patPlanNum, long planNum, long subNum, bool isDependent, long subPatNum, bool isCoinsuranceInverted)
 {
     InitializeComponent();
     Lan.F(this);
     PatPlanNum               = patPlanNum;
     PlanNum                  = planNum;
     SubNum                   = subNum;
     _isDependent             = isDependent;
     _subPatNum               = subPatNum;
     _isConinsuranceInverted  = isCoinsuranceInverted;
     textCurrentGroupNum.Text = InsPlans.GetPlan(planNum, new List <InsPlan>()).GroupNum;
 }
Example #24
0
 private void gridMain_CellDoubleClick(object sender, OpenDental.UI.ODGridClickEventArgs e)
 {
     if (listRelat.SelectedIndex == -1)
     {
         MessageBox.Show(Lan.g(this, "Please select a relationship first."));
         return;
     }
     PatRelat     = (Relat)listRelat.SelectedIndex;
     SelectedSub  = (InsSub)gridMain.ListGridRows[e.Row].Tag;
     SelectedPlan = InsPlans.GetPlan(SelectedSub.PlanNum, PlanList);
     DialogResult = DialogResult.OK;
 }
Example #25
0
        private void FormClaimPayTotal_Shown(object sender, EventArgs e)
        {
            InsPlan plan = InsPlans.GetPlan(ClaimProcsToEdit[0].PlanNum, PlanList);

            if (plan.AllowedFeeSched != 0)                                                                                 //allowed fee sched
            {
                gridMain.SetSelected(new Point(gridMain.ListGridColumns.GetIndex(Lan.g("TableClaimProc", "Allowed")), 0)); //Allowed, first row.
            }
            else
            {
                gridMain.SetSelected(new Point(gridMain.ListGridColumns.GetIndex(Lan.g("TableClaimProc", "Ins Pay")), 0));              //InsPay, first row.
            }
        }
Example #26
0
        private void FormClaimPayTotal_Shown(object sender, EventArgs e)
        {
            InsPlan plan = InsPlans.GetPlan(ClaimProcsToEdit[0].PlanNum, PlanList);

            if (plan.AllowedFeeSched != 0)             //allowed fee sched
            {
                gridMain.SetSelected(new Point(7, 0)); //Allowed, first row.
            }
            else
            {
                gridMain.SetSelected(new Point(8, 0));               //InsPay, first row.
            }
        }
 private void FormInsPlansSelect_Load(object sender, System.EventArgs e)
 {
     if (!ViewRelat)
     {
         labelRelat.Visible = false;
         listRelat.Visible  = false;
     }
     //usage: eg. from coverage.  Since can be totally new subscriber, get all plans for them.
     FamCur   = Patients.GetFamily(PatNum);
     PatCur   = FamCur.GetPatient(PatNum);
     PlanList = InsPlans.Refresh(FamCur);
     FillPlanData();
 }
Example #28
0
        private void butHide_Click(object sender, EventArgs e)
        {
            int    unusedCount = InsPlans.UnusedGetCount();
            string msgText     = unusedCount.ToString() + " " + Lan.g(this, "plans found that are not in use by any subscribers.  Hide all of them?");

            if (MessageBox.Show(msgText, "", MessageBoxButtons.YesNo) != DialogResult.Yes)
            {
                return;
            }
            InsPlans.UnusedHideAll();
            FillGrid();
            MsgBox.Show(this, "Done.");
        }
Example #29
0
        private void butOK_Click(object sender, System.EventArgs e)
        {
            if (gridMain.Rows.Count == 0)
            {
                MsgBox.Show(this, "No rows to fix.");
                return;
            }
            //if(comboFeeSchedNew.SelectedIndex==0) {
            //	MsgBox.Show(this,"No rows to fix.");
            //	return;
            //}
            if (gridMain.SelectedIndices.Length == 0)
            {
                gridMain.SetSelected(true);
            }
            if (!MsgBox.Show(this, true, "Change the fee schedule for all selected plans to the new fee schedule?"))
            {
                return;
            }
            Cursor = Cursors.WaitCursor;
            long   employerNum;
            string carrierName;
            string groupNum;
            string groupName;
            long   newFeeSchedNum = 0;

            if (comboFeeSchedNew.SelectedIndex != 0)
            {
                newFeeSchedNum = FeeSchedsForType[comboFeeSchedNew.SelectedIndex - 1].FeeSchedNum;
            }
            long oldFeeSchedNum;
            long rowsChanged = 0;

            for (int i = 0; i < gridMain.SelectedIndices.Length; i++)
            {
                oldFeeSchedNum = PIn.Long(table.Rows[gridMain.SelectedIndices[i]]["feeSched"].ToString());
                if (oldFeeSchedNum == newFeeSchedNum)
                {
                    continue;
                }
                employerNum  = PIn.Long(table.Rows[gridMain.SelectedIndices[i]]["EmployerNum"].ToString());
                carrierName  = table.Rows[gridMain.SelectedIndices[i]]["CarrierName"].ToString();
                groupNum     = table.Rows[gridMain.SelectedIndices[i]]["GroupNum"].ToString();
                groupName    = table.Rows[gridMain.SelectedIndices[i]]["GroupName"].ToString();
                rowsChanged += InsPlans.SetFeeSched(employerNum, carrierName, groupNum, groupName, newFeeSchedNum,
                                                    (FeeScheduleType)(listType.SelectedIndex));
            }
            FillGrid();
            Cursor = Cursors.Default;
            MessageBox.Show(Lan.g(this, "Plans changed: ") + rowsChanged.ToString());
        }
        /// <summary>Creates a check for the claim selected. Copied logic from FormClaimEdit.cs</summary>
        private void createCheckToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (!Security.IsAuthorized(Permissions.InsPayCreate))             //date not checked here, but it will be checked when saving the check to prevent backdating
            {
                return;
            }
            if (PrefC.GetBool(PrefName.ClaimPaymentBatchOnly))
            {
                //Is there a permission in the manage module that would block this behavior? Are we sending the user into a TRAP?!
                MsgBox.Show(this, "Please use Batch Insurance in Manage Module to Finalize Payments.");
                return;
            }
            RpUnfinalizedInsPay.UnfinalizedInsPay unfinalPay = (RpUnfinalizedInsPay.UnfinalizedInsPay)gridMain.ListGridRows[gridMain.SelectedIndices[0]].Tag;
            if (unfinalPay.ClaimCur == null)
            {
                MsgBox.Show(this, "Unable to find claim for this partial payment.");
                return;
            }
            List <ClaimProc> listClaimProcForClaim = ClaimProcs.RefreshForClaim(unfinalPay.ClaimCur.ClaimNum);

            if (!listClaimProcForClaim.Any(x => x.Status.In(ClaimProcs.GetInsPaidStatuses())))
            {
                MessageBox.Show(Lan.g(this, "There are no valid received payments for this claim."));
                return;
            }
            ClaimPayment claimPayment = new ClaimPayment();

            claimPayment.CheckDate = MiscData.GetNowDateTime().Date;          //Today's date for easier tracking by the office and to avoid backdating before accounting lock dates.
            claimPayment.IsPartial = true;
            claimPayment.ClinicNum = unfinalPay.ClinicCur.ClinicNum;
            Family         famCur      = Patients.GetFamily(unfinalPay.PatientCur.PatNum);
            List <InsSub>  listInsSub  = InsSubs.RefreshForFam(famCur);
            List <InsPlan> listInsPlan = InsPlans.RefreshForSubList(listInsSub);

            claimPayment.CarrierName = Carriers.GetName(InsPlans.GetPlan(unfinalPay.ClaimCur.PlanNum, listInsPlan).CarrierNum);
            ClaimPayments.Insert(claimPayment);
            double amt = ClaimProcs.AttachAllOutstandingToPayment(claimPayment.ClaimPaymentNum, PrefC.DateClaimReceivedAfter);

            claimPayment.CheckAmt = amt;
            try {
                ClaimPayments.Update(claimPayment);
            }
            catch (ApplicationException ex) {
                MessageBox.Show(ex.Message);
                return;
            }
            FormClaimEdit.FormFinalizePaymentHelper(claimPayment, unfinalPay.ClaimCur, unfinalPay.PatientCur, famCur);
            LoadData();
            FillGrid();
        }