Пример #1
0
        private void gridFees_CellDoubleClick(object sender, OpenDental.UI.ODGridClickEventArgs e)
        {
            Fee FeeCur = Fees.GetFeeByOrder(ProcCode.ADACode, e.Row);
            //tbFees.SelectedRow=e.Row;
            //tbFees.ColorRow(e.Row,Color.LightGray);
            FormFeeEdit FormFE = new FormFeeEdit();

            if (FeeCur == null)
            {
                FeeCur          = new Fee();
                FeeCur.ADACode  = ProcCode.ADACode;
                FeeCur.FeeSched = DefB.Short[(int)DefCat.FeeSchedNames][e.Row].DefNum;
                Fees.Insert(FeeCur);
                FormFE.IsNew = true;
            }
            FormFE.FeeCur = FeeCur;
            FormFE.ShowDialog();
            if (FormFE.DialogResult == DialogResult.OK)
            {
                FeeChanged = true;
            }
            Fees.Refresh();
            //tbFees.SelectedRow=-1;
            FillFees();
        }
Пример #2
0
 ///<summary>Copies any fee objects over to the new fee schedule.  Usually run ClearFeeSched first.  Be careful exactly which int's you supply.</summary>
 public static void CopyFees(int fromSchedI, int toSchedNum)
 {
     //Fee fee;
     Fee[] feeArray = new Fee[HList[fromSchedI].Values.Count];
     HList[fromSchedI].Values.CopyTo(feeArray, 0);
     for (int i = 0; i < feeArray.Length; i++)
     {
         //fee=((Fee)HList[fromSchedI].Values  [i]).Copy();
         feeArray[i].FeeSched = toSchedNum;
         Fees.Insert(feeArray[i]);
     }
 }
Пример #3
0
        private void gridMain_CellDoubleClick(object sender, UI.ODGridClickEventArgs e)
        {
            Fee         fee    = (Fee)gridMain.Rows[e.Row].Tag;
            FormFeeEdit FormFE = new FormFeeEdit();

            if (fee.FeeNum == 0)
            {
                FormFE.IsNew = true;
                fee.CodeNum  = _procCode.CodeNum;
                Fees.Insert(fee);                //Pre-insert the fee before opening the edit window.
            }
            FormFE.FeeCur = fee;
            FormFE.ShowDialog();
            if (FormFE.DialogResult == DialogResult.OK)
            {
                //FormFE could have manipulated the fee.  Refresh our local cache and grids to reflect the changes.
                FillAndSortListFees();
                FillGrid();
            }
        }
Пример #4
0
        ///<summary>If the named fee schedule does not exist, then it will be created.  It always returns the defnum for the feesched used, regardless of whether it already existed.  procCode must have already been tested for valid code, and feeSchedName must not be blank.</summary>
        public static long ImportTrojan(string procCode, double amt, string feeSchedName)
        {
            FeeSched feeSched = FeeScheds.GetByExactName(feeSchedName);

            //if isManaged, then this should be done differently from here on out.
            if (feeSched == null)
            {
                //add the new fee schedule
                feeSched              = new FeeSched();
                feeSched.ItemOrder    = FeeSchedC.ListLong.Count;
                feeSched.Description  = feeSchedName;
                feeSched.FeeSchedType = FeeScheduleType.Normal;
                //feeSched.IsNew=true;
                FeeScheds.Insert(feeSched);
                //Cache.Refresh(InvalidType.FeeScheds);
                //Fees.Refresh();
                DataValid.SetInvalid(InvalidType.FeeScheds, InvalidType.Fees);
            }
            if (feeSched.IsHidden)
            {
                feeSched.IsHidden = false;              //unhide it
                FeeScheds.Update(feeSched);
                DataValid.SetInvalid(InvalidType.FeeScheds);
            }
            Fee fee = Fees.GetFee(ProcedureCodes.GetCodeNum(procCode), feeSched.FeeSchedNum);

            if (fee == null)
            {
                fee          = new Fee();
                fee.Amount   = amt;
                fee.FeeSched = feeSched.FeeSchedNum;
                fee.CodeNum  = ProcedureCodes.GetCodeNum(procCode);
                Fees.Insert(fee);
            }
            else
            {
                fee.Amount = amt;
                Fees.Update(fee);
            }
            return(feeSched.FeeSchedNum);
        }
Пример #5
0
        ///<summary></summary>
        public static void ImportFees(string fileName, long feeSchedNum, long clinicNum, long provNum)
        {
            List <Fee> listFees = Fees.GetListExact(feeSchedNum, clinicNum, provNum);

            string[] fields;
            int      counter   = 0;
            int      lineCount = File.ReadAllLines(fileName).Length;     //quick and dirty

            using (StreamReader sr = new StreamReader(fileName)) {
                string line = sr.ReadLine();
                while (line != null)
                {
                    fields = line.Split(new string[1] {
                        "\t"
                    }, StringSplitOptions.None);
                    if (fields.Length < 2)                  // && fields[1]!=""){//we no longer skip blank fees
                    {
                        line = sr.ReadLine();
                        continue;
                    }
                    long codeNum = ProcedureCodes.GetCodeNum(fields[0]);
                    if (codeNum == 0)
                    {
                        line = sr.ReadLine();
                        continue;
                    }
                    Fee      fee          = Fees.GetFee(codeNum, feeSchedNum, clinicNum, provNum, listFees);
                    string   feeOldStr    = "";
                    DateTime datePrevious = DateTime.MinValue;
                    if (fee != null)
                    {
                        feeOldStr    = "Old Fee: " + fee.Amount.ToString("c") + ", ";
                        datePrevious = fee.SecDateTEdit;
                    }
                    if (fields[1] == "")                   //an empty entry will delete an existing fee, but not insert a blank override
                    {
                        if (fee == null)                   //nothing to do
                        //counter++;
                        //line=sr.ReadLine();
                        //continue;
                        {
                        }
                        else
                        {
                            //doesn't matter if the existing fee is an override or not.
                            Fees.Delete(fee);
                            SecurityLogs.MakeLogEntry(Permissions.ProcFeeEdit, 0, "Procedure: " + fields[0] + ", "
                                                      + feeOldStr
                                                      //+", Deleted Fee: "+fee.Amount.ToString("c")+", "
                                                      + "Fee Schedule: " + FeeScheds.GetDescription(feeSchedNum) + ". "
                                                      + "Fee deleted using the Import button in the Fee Tools window.", codeNum,
                                                      DateTime.MinValue);
                            SecurityLogs.MakeLogEntry(Permissions.LogFeeEdit, 0, "Fee deleted", fee.FeeNum, datePrevious);
                        }
                    }
                    else                      //value found
                    {
                        if (fee == null)      //no current fee
                        {
                            fee           = new Fee();
                            fee.Amount    = PIn.Double(fields[1]);
                            fee.FeeSched  = feeSchedNum;
                            fee.CodeNum   = codeNum;
                            fee.ClinicNum = clinicNum;                          //Either 0 because you're importing on an HQ schedule or local clinic because the feesched is localizable.
                            fee.ProvNum   = provNum;
                            Fees.Insert(fee);
                        }
                        else
                        {
                            fee.Amount = PIn.Double(fields[1]);
                            Fees.Update(fee);
                        }
                        SecurityLogs.MakeLogEntry(Permissions.ProcFeeEdit, 0, "Procedure: " + fields[0] + ", "
                                                  + feeOldStr
                                                  + ", New Fee: " + fee.Amount.ToString("c") + ", "
                                                  + "Fee Schedule: " + FeeScheds.GetDescription(feeSchedNum) + ". "
                                                  + "Fee changed using the Import button in the Fee Tools window.", codeNum,
                                                  DateTime.MinValue);
                        SecurityLogs.MakeLogEntry(Permissions.LogFeeEdit, 0, "Fee changed", fee.FeeNum, datePrevious);
                    }
                    //FeeSchedEvent.Fire(ODEventType.FeeSched,new ProgressBarHelper("Importing fees...",));
                    double percent = (double)counter * 100d / (double)lineCount;
                    counter++;
                    FeeSchedEvent.Fire(ODEventType.FeeSched, new ProgressBarHelper(
                                           "Importing fees...", ((int)percent).ToString(), blockValue: (int)percent, progressStyle: ProgBarStyle.Continuous));
                    line = sr.ReadLine();
                }
            }
        }
Пример #6
0
        private void gridMain_CellDoubleClick(object sender, ODGridClickEventArgs e)
        {
            if (IsSelectionMode)
            {
                SelectedADA  = ProcTable.Rows[e.Row]["ADACode"].ToString();
                DialogResult = DialogResult.OK;
                return;
            }
            //else not selecting a code
            if (!Security.IsAuthorized(Permissions.Setup, DateTime.MinValue, true))
            {
                return;
            }
            string ada = ProcTable.Rows[e.Row]["ADACode"].ToString();

            if (e.Col > 3)          //if double clicked on a fee
            {
                Fee FeeCur   = null;
                int feesched = 0;
                if (e.Col == 4)
                {
                    FeeCur   = Fees.GetFeeByOrder(ada, listFeeSched.SelectedIndex);
                    feesched = DefB.Short[(int)DefCat.FeeSchedNames][listFeeSched.SelectedIndex].DefNum;
                }
                if (e.Col == 5)
                {
                    if (comboCompare1.SelectedIndex == 0)
                    {
                        return;
                    }
                    FeeCur   = Fees.GetFeeByOrder(ada, comboCompare1.SelectedIndex - 1);
                    feesched = DefB.Short[(int)DefCat.FeeSchedNames][comboCompare1.SelectedIndex - 1].DefNum;
                }
                if (e.Col == 6)
                {
                    if (comboCompare2.SelectedIndex == 0)
                    {
                        return;
                    }
                    FeeCur   = Fees.GetFeeByOrder(ada, comboCompare2.SelectedIndex - 1);
                    feesched = DefB.Short[(int)DefCat.FeeSchedNames][comboCompare2.SelectedIndex - 1].DefNum;
                }
                FormFeeEdit FormFE = new FormFeeEdit();
                if (FeeCur == null)
                {
                    FeeCur          = new Fee();
                    FeeCur.ADACode  = ada;
                    FeeCur.FeeSched = feesched;
                    Fees.Insert(FeeCur);
                    FormFE.IsNew = true;
                }
                FormFE.FeeCur = FeeCur;
                FormFE.ShowDialog();
                if (FormFE.DialogResult == DialogResult.OK)
                {
                    Fees.Refresh();
                    changed = true;
                    FillGrid();
                }
            }
            else              //not on a fee: Edit code instead
            {
                FormProcCodeEdit FormPCE = new FormProcCodeEdit(ProcedureCodes.GetProcCode(ada));
                FormPCE.IsNew = false;
                FormPCE.ShowDialog();
                if (FormPCE.DialogResult == DialogResult.OK)
                {
                    //ProcedureCodes.Refresh();
                    changed = true;
                    //Fees.Refresh();//fees were already refreshed within procCodeEdit
                    FillGrid();
                }
            }
        }
Пример #7
0
        private void SaveAllowedFees()
        {
            //if no allowed fees entered, then nothing to do
            bool allowedFeesEntered = false;

            for (int i = 0; i < gridMain.Rows.Count; i++)
            {
                if (gridMain.Rows[i].Cells[7].Text != "")
                {
                    allowedFeesEntered = true;
                    break;
                }
            }
            if (!allowedFeesEntered)
            {
                return;
            }
            //if no allowed fee schedule, then nothing to do
            InsPlan plan = InsPlans.GetPlan(ClaimProcsToEdit[0].PlanNum, PlanList);

            if (plan.AllowedFeeSched == 0)          //no allowed fee sched
            //plan.PlanType!="p" && //not ppo, and
            {
                return;
            }
            //ask user if they want to save the fees
            if (!MsgBox.Show(this, true, "Save the allowed amounts to the allowed fee schedule?"))
            {
                return;
            }
            //select the feeSchedule
            long feeSched = -1;

            //if(plan.PlanType=="p"){//ppo
            //	feeSched=plan.FeeSched;
            //}
            //else if(plan.AllowedFeeSched!=0){//an allowed fee schedule exists
            feeSched = plan.AllowedFeeSched;
            //}
            if (FeeScheds.GetIsHidden(feeSched))
            {
                MsgBox.Show(this, "Allowed fee schedule is hidden, so no changes can be made.");
                return;
            }
            Fee              FeeCur = null;
            long             codeNum;
            List <Procedure> ProcList = Procedures.Refresh(PatCur.PatNum);
            Procedure        proc;

            for (int i = 0; i < ClaimProcsToEdit.Length; i++)
            {
                //this gives error message if proc not found:
                proc    = Procedures.GetProcFromList(ProcList, ClaimProcsToEdit[i].ProcNum);
                codeNum = proc.CodeNum;
                if (codeNum == 0)
                {
                    continue;
                }
                FeeCur = Fees.GetFee(codeNum, feeSched);
                if (FeeCur == null)
                {
                    FeeCur          = new Fee();
                    FeeCur.FeeSched = feeSched;
                    FeeCur.CodeNum  = codeNum;
                    FeeCur.Amount   = PIn.Double(gridMain.Rows[i].Cells[7].Text);
                    Fees.Insert(FeeCur);
                }
                else
                {
                    FeeCur.Amount = PIn.Double(gridMain.Rows[i].Cells[7].Text);
                    Fees.Update(FeeCur);
                }
            }
            //Fees.Refresh();//redundant?
            DataValid.SetInvalid(InvalidType.Fees);
        }
Пример #8
0
        private void SaveAllowedFees()
        {
            //if no allowed fees entered, then nothing to do
            bool allowedFeesEntered = false;

            for (int i = 0; i < gridMain.ListGridRows.Count; i++)
            {
                if (gridMain.ListGridRows[i].Cells[gridMain.ListGridColumns.GetIndex(Lan.g("TableClaimProc", "Allowed"))].Text != "")
                {
                    allowedFeesEntered = true;
                    break;
                }
            }
            if (!allowedFeesEntered)
            {
                return;
            }
            //if no allowed fee schedule, then nothing to do
            InsPlan plan = InsPlans.GetPlan(ClaimProcsToEdit[0].PlanNum, PlanList);

            if (plan.AllowedFeeSched == 0)          //no allowed fee sched
            //plan.PlanType!="p" && //not ppo, and
            {
                return;
            }
            //ask user if they want to save the fees
            if (!MsgBox.Show(this, true, "Save the allowed amounts to the allowed fee schedule?"))
            {
                return;
            }
            //select the feeSchedule
            long feeSched = -1;

            //if(plan.PlanType=="p"){//ppo
            //	feeSched=plan.FeeSched;
            //}
            //else if(plan.AllowedFeeSched!=0){//an allowed fee schedule exists
            feeSched = plan.AllowedFeeSched;
            //}
            if (FeeScheds.GetIsHidden(feeSched))
            {
                MsgBox.Show(this, "Allowed fee schedule is hidden, so no changes can be made.");
                return;
            }
            Fee              FeeCur = null;
            long             codeNum;
            List <Procedure> ProcList = Procedures.Refresh(PatCur.PatNum);
            Procedure        proc;
            List <long>      invalidFeeSchedNums = new List <long>();

            for (int i = 0; i < ClaimProcsToEdit.Length; i++)
            {
                proc    = Procedures.GetProcFromList(ProcList, ClaimProcsToEdit[i].ProcNum);
                codeNum = proc.CodeNum;
                //ProcNum not found or 0 for payments
                if (codeNum == 0)
                {
                    continue;
                }
                if (gridMain.ListGridRows[i].Cells[gridMain.ListGridColumns.GetIndex(Lan.g("TableClaimProc", "Allowed"))].Text.Trim() == "" &&         //Nothing is entered in allowed
                    _listClaimProcsOld[i].AllowedOverride == -1)                      //And there was not originally a value in the allowed column
                {
                    continue;
                }
                DateTime datePrevious = DateTime.MinValue;
                FeeCur = Fees.GetFee(codeNum, feeSched, proc.ClinicNum, proc.ProvNum);
                if (FeeCur == null)
                {
                    FeeSched feeSchedObj = FeeScheds.GetFirst(x => x.FeeSchedNum == feeSched);
                    FeeCur           = new Fee();
                    FeeCur.FeeSched  = feeSched;
                    FeeCur.CodeNum   = codeNum;
                    FeeCur.ClinicNum = (feeSchedObj.IsGlobal) ? 0 : proc.ClinicNum;
                    FeeCur.ProvNum   = (feeSchedObj.IsGlobal) ? 0 : proc.ProvNum;
                    FeeCur.Amount    = PIn.Double(gridMain.ListGridRows[i].Cells[gridMain.ListGridColumns.GetIndex(Lan.g("TableClaimProc", "Allowed"))].Text);
                    Fees.Insert(FeeCur);
                }
                else
                {
                    datePrevious  = FeeCur.SecDateTEdit;
                    FeeCur.Amount = PIn.Double(gridMain.ListGridRows[i].Cells[gridMain.ListGridColumns.GetIndex(Lan.g("TableClaimProc", "Allowed"))].Text);
                    Fees.Update(FeeCur);
                }
                SecurityLogs.MakeLogEntry(Permissions.ProcFeeEdit, 0, Lan.g(this, "Procedure") + ": " + ProcedureCodes.GetStringProcCode(FeeCur.CodeNum)
                                          + ", " + Lan.g(this, "Fee") + ": " + FeeCur.Amount.ToString("c") + ", " + Lan.g(this, "Fee Schedule") + " " + FeeScheds.GetDescription(FeeCur.FeeSched)
                                          + ". " + Lan.g(this, "Automatic change to allowed fee in Enter Payment window.  Confirmed by user."), FeeCur.CodeNum, DateTime.MinValue);
                SecurityLogs.MakeLogEntry(Permissions.LogFeeEdit, 0, Lan.g(this, "Fee Updated"), FeeCur.FeeNum, datePrevious);
                invalidFeeSchedNums.Add(FeeCur.FeeSched);
            }
        }