Esempio n. 1
0
        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;
                }
            }
        }
Esempio n. 2
0
 private void butOK_Click(object sender, System.EventArgs e)
 {
     if (!SaveGridChanges())
     {
         return;
     }
     if (!ValidateTotals())
     {
         MsgBox.Show(this, "One or more column totals exceed the maximum allowed value, please fix data entry errors.");
         return;
     }
     SaveAllowedFees();
     if (PrefC.GetBool(PrefName.ClaimSnapshotEnabled))
     {
         Claim claimCur = Claims.GetClaim(_listClaimProcsOld[0].ClaimNum);
         if (claimCur.ClaimType != "PreAuth")
         {
             ClaimSnapshots.CreateClaimSnapshot(_listClaimProcsOld, ClaimSnapshotTrigger.InsPayment, claimCur.ClaimType);
         }
     }
     ClaimTrackings.InsertClaimProcReceived(ClaimProcsToEdit[0].ClaimNum, Security.CurUser.UserNum);
     //Make audit trail entries if writeoff or inspayamt's were changed. The claimprocs are updated outside of this form,
     //but all of the information we need for audit trail logging lives inside the form so we do it here.
     MakeAuditTrailEntries();
     DialogResult = DialogResult.OK;
 }
Esempio n. 3
0
        private void gridMain_CellDoubleClick(object sender, ODGridClickEventArgs e)
        {
            if (!Security.IsAuthorized(Permissions.ClaimView))
            {
                return;
            }
            Claim claim = Claims.GetClaim(((UnsentInsClaim)gridMain.Rows[e.Row].Tag).ClaimNum);

            if (claim == null)
            {
                MsgBox.Show(this, "The claim has been deleted.");
                FillGrid();
                return;
            }
            Patient       pat    = Patients.GetPat(claim.PatNum);
            Family        fam    = Patients.GetFamily(pat.PatNum);
            FormClaimEdit FormCE = new FormClaimEdit(claim, pat, fam);

            FormCE.IsNew = false;
            FormCE.ShowDialog();
            if (FormCE.DialogResult == DialogResult.OK)
            {
                FillGrid();                //FillGrid() is necessary here as we are allowing the user to open up claim details and they could change the claim status or claim type.
                return;
            }
        }
Esempio n. 4
0
        private void butRun_Click(object sender, EventArgs e)
        {
            List <ClaimPaySplit> splits = Claims.GetInsPayNotAttachedForFixTool();

            if (splits.Count == 0)
            {
                MsgBox.Show(this, "There are currently no insurance payments that are not attached to an insurance check.");
                return;
            }
            Cursor = Cursors.WaitCursor;
            for (int i = 0; i < splits.Count; i++)
            {
                Claim        claim = Claims.GetClaim(splits[i].ClaimNum);
                ClaimPayment cp    = new ClaimPayment();
                cp.CheckDate   = claim.DateService;
                cp.CheckAmt    = splits[i].InsPayAmt;
                cp.ClinicNum   = claim.ClinicNum;
                cp.CarrierName = splits[i].Carrier;
                ClaimPayments.Insert(cp);
                List <ClaimProc> claimP = ClaimProcs.RefreshForClaim(splits[i].ClaimNum);
                for (int j = 0; j < claimP.Count; j++)
                {
                    claimP[j].DateCP          = claim.DateService;
                    claimP[j].ClaimPaymentNum = cp.ClaimPaymentNum;
                    ClaimProcs.Update(claimP[j]);
                }
            }
            Cursor = Cursors.Default;
            MessageBox.Show(Lan.g(this, "Insurance checks created: ") + splits.Count);
        }
Esempio n. 5
0
        private void gridMain_CellDoubleClick(object sender, ODGridClickEventArgs e)
        {
            Claim         claim  = Claims.GetClaim(PIn.Long(Table.Rows[e.Row]["ClaimNum"].ToString()));
            Patient       pat    = Patients.GetPat(claim.PatNum);
            Family        fam    = Patients.GetFamily(pat.PatNum);
            FormClaimEdit FormCE = new FormClaimEdit(claim, pat, fam);

            FormCE.IsNew = false;
            FormCE.ShowDialog();
        }
Esempio n. 6
0
        private void butRun_Click(object sender, EventArgs e)
        {
            List <ClaimPaySplit> splits = Claims.GetInsPayNotAttachedForFixTool();

            if (splits.Count == 0)
            {
                MsgBox.Show(this, "There are currently no insurance payments that are not attached to an insurance check.");
                DialogResult = DialogResult.OK;              //Close the window because there is nothing else to do
                return;
            }
            Cursor = Cursors.WaitCursor;
            string   invalidClaimDate = "";
            DateTime curDate          = MiscData.GetNowDateTime().Date;

            for (int i = 0; i < splits.Count; i++)
            {
                Claim claim = Claims.GetClaim(splits[i].ClaimNum);
                if (claim == null)
                {
                    continue;
                }
                if (claim.DateReceived.Date > curDate && !PrefC.GetBool(PrefName.AllowFutureInsPayments) && !PrefC.GetBool(PrefName.FutureTransDatesAllowed))
                {
                    invalidClaimDate += "\r\n" + Lan.g(this, "PatNum") + " " + claim.PatNum + ", " + claim.DateService.ToShortDateString();
                    continue;
                }
                ClaimPayment cp = new ClaimPayment();
                cp.CheckDate   = claim.DateReceived;
                cp.CheckAmt    = splits[i].InsPayAmt;
                cp.ClinicNum   = claim.ClinicNum;
                cp.CarrierName = splits[i].Carrier;
                cp.PayType     = Defs.GetFirstForCategory(DefCat.InsurancePaymentType, true).DefNum;
                ClaimPayments.Insert(cp);
                List <ClaimProc> claimP = ClaimProcs.RefreshForClaim(splits[i].ClaimNum);
                for (int j = 0; j < claimP.Count; j++)
                {
                    if (claimP[j].ClaimPaymentNum != 0 || claimP[j].InsPayAmt == 0) //If claimpayment already attached to claimproc or ins didn't pay.
                    {
                        continue;                                                   //Do not change
                    }
                    claimP[j].DateCP          = claim.DateReceived;
                    claimP[j].ClaimPaymentNum = cp.ClaimPaymentNum;
                    ClaimProcs.Update(claimP[j]);
                }
            }
            Cursor = Cursors.Default;
            if (invalidClaimDate != "")
            {
                invalidClaimDate = "\r\n" + Lan.g(this, "Cannot make future-dated insurance payments for these claims:") + invalidClaimDate;
            }
            MsgBoxCopyPaste messageBox = new MsgBoxCopyPaste(Lan.g(this, "Insurance checks created:") + " " + splits.Count + invalidClaimDate);

            messageBox.Show();
            DialogResult = DialogResult.OK;          //Close the window because there is nothing else to do
        }
        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
            }
        }
 /// <summary>Opens the current selected claim.</summary>
 private void openClaimToolStripMenuItem_Click(object sender, EventArgs e)
 {
     if (!Security.IsAuthorized(Permissions.ClaimView))
     {
         return;
     }
     RpUnfinalizedInsPay.UnfinalizedInsPay unfinalPay = (RpUnfinalizedInsPay.UnfinalizedInsPay)gridMain.ListGridRows[gridMain.SelectedIndices[0]].Tag;
     //Refresh claim from database.  Will return null if not in db, or unfinalPay.ClaimCur already null.
     unfinalPay.ClaimCur = Claims.GetClaim(unfinalPay.ClaimCur?.ClaimNum ?? 0);
     if (unfinalPay.ClaimCur == null)
     {
         MsgBox.Show(this, "Claim has been deleted by another user.");
     }
     else
     {
         Family        famCur = Patients.GetFamily(unfinalPay.PatientCur.PatNum);
         FormClaimEdit FormCE = new FormClaimEdit(unfinalPay.ClaimCur, unfinalPay.PatientCur, famCur);
         FormCE.ShowDialog();
     }
     LoadData();
     FillGrid();
 }
Esempio n. 9
0
        ///<summary>Click method used by all gridClaimDetails right click options.</summary>
        private void gridClaimDetails_RightClickHelper(object sender, EventArgs e)
        {
            int index = gridClaimDetails.GetSelectedIndex();

            if (index == -1)           //Should not happen, menu item is only enabled when exactly 1 row is selected.
            {
                return;
            }
            Hx835_Claim claimPaid     = (Hx835_Claim)gridClaimDetails.ListGridRows[index].Tag;
            int         menuItemIndex = ((MenuItem)sender).Index;  //sender is the selected menuItem

            #region Go To Account
            if (menuItemIndex == 0)
            {
                if (claimPaid.ClaimNum != 0)
                {
                    Claim claim = Claims.GetClaim(claimPaid.ClaimNum);
                    if (claim != null)
                    {
                        GotoModule.GotoAccount(claim.PatNum);
                        return;
                    }
                }
                PtTableSearchParams ptTableSearchParams = new PtTableSearchParams(false, claimPaid.PatientName.Lname, claimPaid.PatientName.Fname, "", "", false,
                                                                                  "", "", "", "", "", 0, false, false, DateTime.MinValue, 0, "", "", "", "", "", "", "");
                DataTable ptTable = Patients.GetPtDataTable(ptTableSearchParams);              //Mimics FormPatientSelect.cs
                if (ptTable.Rows.Count == 0)
                {
                    MsgBox.Show(this, "Patient could not be found.  Please manually attach to a claim and try again.");
                }
                else if (ptTable.Rows.Count == 1)
                {
                    GotoModule.GotoAccount(PIn.Long(ptTable.Rows[0]["PatNum"].ToString()));
                }
                else
                {
                    MsgBox.Show(this, "Multiple patients with same name found.  Please manually attach to a claim and try again.");
                }
            }
            #endregion
            #region Add Tracking Status
            else if (menuItemIndex == 1)
            {
                Claim claim          = claimPaid.GetClaimFromDb();
                bool  isAttachNeeded = (!claimPaid.IsAttachedToClaim);
                if (claim == null)               //Not found in db.
                {
                    claim = ClaimSelectionHelper(claimPaid);
                    if (claim != null)                   //A claim was selected.
                    {
                        isAttachNeeded = true;           //Hard attach selected claim to db claim, since user manually picked matching claim.
                    }
                }
                if (claim == null)               //Claim not found and user did not select one.
                {
                    return;
                }
                CreateAttachForClaim(claimPaid, claim.ClaimNum, isAttachNeeded);
                if (FormClaimEdit.AddClaimCustomTracking(claim, claimPaid.GetRemarks()))                //A tracking status was chosen and the tracking status contains an error code.
                {
                    DetachClaimHelper(new List <int> {
                        index
                    });                                                            //Detach claim from ERA for convenience.
                }
                FillClaimDetails();
            }
            #endregion
        }
Esempio n. 10
0
        public void butWriteOff_Click(object sender, System.EventArgs e)
        {
            DialogResult dresWriteoff = DialogResult.Cancel;

            if (CultureInfo.CurrentCulture.Name.EndsWith("CA"))             //Canadian. en-CA or fr-CA
            {
                dresWriteoff = MessageBox.Show(
                    Lan.g(this, "Write off unpaid amounts on labs and procedures?") + "\r\n"
                    + Lan.g(this, "Choose Yes to write off unpaid amounts on both labs and procedures.") + "\r\n"
                    + Lan.g(this, "Choose No to write off unpaid amounts on procedures only."), "", MessageBoxButtons.YesNoCancel);
                if (dresWriteoff != DialogResult.Yes && dresWriteoff != DialogResult.No)             //Cancel
                {
                    return;
                }
            }
            else              //United States
            {
                if (MessageBox.Show(Lan.g(this, "Write off unpaid amount on each procedure?"), "", MessageBoxButtons.OKCancel) != DialogResult.OK)
                {
                    return;
                }
            }
            if (!SaveGridChanges())
            {
                return;
            }
            if (CultureInfo.CurrentCulture.Name.EndsWith("CA") && dresWriteoff == DialogResult.Yes) //Canadian. en-CA or fr-CA
            {
                Claim     claim       = Claims.GetClaim(ClaimProcsToEdit[0].ClaimNum);              //There should be at least one, since a claim can only be created with one or more procedures.
                ClaimProc cpTotalLabs = new ClaimProc();
                cpTotalLabs.ClaimNum  = claim.ClaimNum;
                cpTotalLabs.PatNum    = claim.PatNum;
                cpTotalLabs.ProvNum   = claim.ProvTreat;
                cpTotalLabs.Status    = ClaimProcStatus.Received;
                cpTotalLabs.PlanNum   = claim.PlanNum;
                cpTotalLabs.InsSubNum = claim.InsSubNum;
                cpTotalLabs.DateCP    = DateTimeOD.Today;
                cpTotalLabs.ProcDate  = claim.DateService;
                cpTotalLabs.DateEntry = DateTime.Now;
                cpTotalLabs.ClinicNum = claim.ClinicNum;
                cpTotalLabs.WriteOff  = 0;
                cpTotalLabs.InsPayAmt = 0;
                for (int i = 0; i < ClaimProcsToEdit.Length; i++)
                {
                    ClaimProc claimProc      = ClaimProcsToEdit[i];
                    double    procLabInsPaid = 0;
                    if (claimProc.InsPayAmt > claimProc.FeeBilled)
                    {
                        procLabInsPaid      = claimProc.InsPayAmt - claimProc.FeeBilled;               //The amount of exceess greater than the fee billed.
                        claimProc.InsPayAmt = claimProc.FeeBilled;
                    }
                    List <Procedure> listProcLabs = Procedures.GetCanadianLabFees(claimProc.ProcNum);                 //0, 1 or 2 lab fees per procedure
                    double           procLabTotal = 0;
                    for (int j = 0; j < listProcLabs.Count; j++)
                    {
                        procLabTotal += listProcLabs[j].ProcFee;
                    }
                    if (procLabInsPaid > procLabTotal)                   //Could happen if the user enters a payment amount greater than the fee billed and lab fees added together.
                    {
                        procLabInsPaid = procLabTotal;
                    }
                    cpTotalLabs.InsPayAmt += procLabInsPaid;
                    cpTotalLabs.WriteOff  += procLabTotal - procLabInsPaid;
                }
                if (cpTotalLabs.InsPayAmt > 0 || cpTotalLabs.WriteOff > 0)             //These amounts will both be zero if there are no lab fees on any of the procedures.  These amounts should never be negative.
                {
                    ClaimProcs.Insert(cpTotalLabs);
                }
            }
            //fix later: does not take into account other payments.
            double           unpaidAmt = 0;
            List <Procedure> ProcList  = Procedures.Refresh(PatCur.PatNum);

            for (int i = 0; i < ClaimProcsToEdit.Length; i++)
            {
                //ClaimProcsToEdit guaranteed to only contain claimprocs for procedures before this form loads, payments are not in the list
                unpaidAmt = Procedures.GetProcFromList(ProcList, ClaimProcsToEdit[i].ProcNum).ProcFee
                            //((Procedure)Procedures.HList[ClaimProcsToEdit[i].ProcNum]).ProcFee
                            - ClaimProcsToEdit[i].DedApplied
                            - ClaimProcsToEdit[i].InsPayAmt;
                if (unpaidAmt > 0)
                {
                    ClaimProcsToEdit[i].WriteOff = unpaidAmt;
                }
            }
            FillGrid();
        }