///<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); }
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); }
///<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(); } } }
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); } }