///<summary>Makes the "Before" and "After" columns human-readable for certain logs.</summary> private void TranslateBeforeAndAfter() { foreach (InsEditLog logCur in _listLogs) { long beforeKey = PIn.Long(logCur.OldValue, false); long afterKey = PIn.Long(logCur.NewValue, false); switch (logCur.FieldName) { case "CarrierNum": if (logCur.LogType == InsEditLogType.Carrier) { break; } string carrierNameBefore = Carriers.GetCarrier(beforeKey).CarrierName; string carrierNameAfter = Carriers.GetCarrier(afterKey).CarrierName; if (logCur.LogType == InsEditLogType.InsPlan && carrierNameBefore == carrierNameAfter) //Edits to carrier. { break; //Don't translate CarrierNum to CarrierName when both carriers have the same name, loses too much useful detail. } logCur.OldValue = beforeKey == 0 ? logCur.OldValue : carrierNameBefore; logCur.NewValue = afterKey == 0 ? logCur.NewValue : carrierNameAfter; break; case "EmployerNum": if (logCur.LogType == InsEditLogType.Employer) { break; } logCur.OldValue = beforeKey == 0 ? logCur.OldValue : Employers.GetName(beforeKey); logCur.NewValue = afterKey == 0 ? logCur.NewValue : Employers.GetName(afterKey); break; case "FeeSched": case "CopayFeeSched": case "AllowedFeeSched": logCur.OldValue = beforeKey == 0 ? logCur.OldValue : FeeScheds.GetDescription(beforeKey); logCur.NewValue = afterKey == 0 ? logCur.NewValue : FeeScheds.GetDescription(afterKey); break; case "BenefitType": logCur.OldValue = beforeKey == 0 ? logCur.OldValue : Enum.GetName(typeof(InsBenefitType), beforeKey); logCur.NewValue = afterKey == 0 ? logCur.NewValue : Enum.GetName(typeof(InsBenefitType), afterKey); break; case "CovCatNum": logCur.OldValue = beforeKey == 0 ? logCur.OldValue : CovCats.GetDesc(beforeKey); logCur.NewValue = afterKey == 0 ? logCur.NewValue : CovCats.GetDesc(afterKey); break; case "CodeNum": logCur.OldValue = beforeKey == 0 ? logCur.OldValue : ProcedureCodes.GetStringProcCode(beforeKey); logCur.NewValue = afterKey == 0 ? logCur.NewValue : ProcedureCodes.GetStringProcCode(afterKey); break; default: break; } } }
///<summary>Makes the "Before" and "After" columns human-readable for certain logs.</summary> private void TranslateBeforeAndAfter() { foreach (InsEditLog logCur in _listLogs) { long beforeKey = PIn.Long(logCur.OldValue, false); long afterKey = PIn.Long(logCur.NewValue, false); switch (logCur.FieldName) { case "CarrierNum": if (logCur.LogType == InsEditLogType.Carrier) { break; } logCur.OldValue = beforeKey == 0 ? logCur.OldValue : Carriers.GetCarrier(beforeKey).CarrierName; logCur.NewValue = afterKey == 0 ? logCur.NewValue : Carriers.GetCarrier(afterKey).CarrierName; break; case "EmployerNum": if (logCur.LogType == InsEditLogType.Employer) { break; } logCur.OldValue = beforeKey == 0 ? logCur.OldValue : Employers.GetName(beforeKey); logCur.NewValue = afterKey == 0 ? logCur.NewValue : Employers.GetName(afterKey); break; case "FeeSched": case "CopayFeeSched": case "AllowedFeeSched": logCur.OldValue = beforeKey == 0 ? logCur.OldValue : FeeScheds.GetDescription(beforeKey); logCur.NewValue = afterKey == 0 ? logCur.NewValue : FeeScheds.GetDescription(afterKey); break; case "BenefitType": logCur.OldValue = beforeKey == 0 ? logCur.OldValue : Enum.GetName(typeof(InsBenefitType), beforeKey); logCur.NewValue = afterKey == 0 ? logCur.NewValue : Enum.GetName(typeof(InsBenefitType), afterKey); break; case "CovCatNum": logCur.OldValue = beforeKey == 0 ? logCur.OldValue : CovCats.GetDesc(beforeKey); logCur.NewValue = afterKey == 0 ? logCur.NewValue : CovCats.GetDesc(afterKey); break; case "CodeNum": logCur.OldValue = beforeKey == 0 ? logCur.OldValue : ProcedureCodes.GetStringProcCode(beforeKey); logCur.NewValue = afterKey == 0 ? logCur.NewValue : ProcedureCodes.GetStringProcCode(afterKey); break; default: break; } } }
private void butChangePlanFrom_Click(object sender, EventArgs e) { FormDiscountPlans FormDPs = new FormDiscountPlans(); FormDPs.IsSelectionMode = true; if (FormDPs.ShowDialog() == DialogResult.OK) { _planFrom = FormDPs.SelectedPlan; textDescriptionFrom.Text = _planFrom.Description; textFeeSchedFrom.Text = FeeScheds.GetDescription(_planFrom.FeeSchedNum); textAdjTypeFrom.Text = Defs.GetName(DefCat.AdjTypes, _planFrom.DefNum); } CheckUIState(); }
private void FillGrid() { List <DiscountPlan> listDiscountPlans = DiscountPlans.GetAll(checkShowHidden.Checked); Dictionary <long, int> dictPatientsOnPlan = DiscountPlans.GetPatCountsForPlans(listDiscountPlans.Select(x => x.DiscountPlanNum).ToList()); listDiscountPlans.Sort(DiscountPlanComparer); gridMain.BeginUpdate(); gridMain.ListGridColumns.Clear(); gridMain.ListGridColumns.Add(new GridColumn(Lan.g("TableDiscountPlans", "Description"), 200)); gridMain.ListGridColumns.Add(new GridColumn(Lan.g("TableDiscountPlans", "Fee Schedule"), 170)); gridMain.ListGridColumns.Add(new GridColumn(Lan.g("TableDiscountPlans", "Adjustment Type"), checkShowHidden.Checked ? 150 : 170)); gridMain.ListGridColumns.Add(new GridColumn(Lan.g("TableDiscountPlans", "Pats"), 40)); if (checkShowHidden.Checked) { gridMain.ListGridColumns.Add(new GridColumn(Lan.g("TableDiscountPlans", "Hidden"), 20, HorizontalAlignment.Center)); } gridMain.ListGridRows.Clear(); GridRow row; int selectedIdx = -1; for (int i = 0; i < listDiscountPlans.Count; i++) { Def adjType = Defs.GetDef(DefCat.AdjTypes, listDiscountPlans[i].DefNum); row = new GridRow(); row.Cells.Add(listDiscountPlans[i].Description); row.Cells.Add(FeeScheds.GetDescription(listDiscountPlans[i].FeeSchedNum)); row.Cells.Add((adjType == null) ? "" : adjType.ItemName); row.Cells.Add(dictPatientsOnPlan.ContainsKey(listDiscountPlans[i].DiscountPlanNum) ? dictPatientsOnPlan[listDiscountPlans[i].DiscountPlanNum].ToString() : "0"); if (checkShowHidden.Checked) { row.Cells.Add(listDiscountPlans[i].IsHidden ? "X" : ""); } row.Tag = listDiscountPlans[i]; gridMain.ListGridRows.Add(row); if (SelectedPlan != null && listDiscountPlans[i].DiscountPlanNum == SelectedPlan.DiscountPlanNum) { selectedIdx = i; } } gridMain.EndUpdate(); gridMain.SetSelected(selectedIdx, true); }
private void butExport_Click(object sender, EventArgs e) { Cursor = Cursors.WaitCursor; SaveFileDialog Dlg = new SaveFileDialog(); if (Directory.Exists(PrefC.GetString(PrefName.ExportPath))) { Dlg.InitialDirectory = PrefC.GetString(PrefName.ExportPath); } else if (Directory.Exists("C:\\")) { Dlg.InitialDirectory = "C:\\"; } Dlg.FileName = "Fees" + FeeScheds.GetDescription(SchedNum) + ".txt"; if (Dlg.ShowDialog() != DialogResult.OK) { Cursor = Cursors.Default; return; } //MessageBox.Show(Dlg.FileName);//includes full path //OverwritePrompt is already set to true DataTable table = ProcedureCodes.GetProcTable("", "", "", new List <long>(), SchedNum, 0, 0); double fee; using (StreamWriter sr = File.CreateText(Dlg.FileName)){ for (int i = 0; i < table.Rows.Count; i++) { sr.Write(PIn.String(table.Rows[i]["ProcCode"].ToString()) + "\t"); fee = PIn.Double(table.Rows[i]["FeeAmt1"].ToString()); if (fee != -1) { sr.Write(fee.ToString("n")); } sr.Write("\t"); sr.Write(PIn.String(table.Rows[i]["AbbrDesc"].ToString()) + "\t"); sr.WriteLine(PIn.String(table.Rows[i]["Descript"].ToString())); } } Cursor = Cursors.Default; DialogResult = DialogResult.OK; }
private void FillGridGroups() { gridGroups.BeginUpdate(); gridGroups.ListGridColumns.Clear(); GridColumn col; col = new GridColumn(Lan.g(this, "Group Name"), 200); gridGroups.ListGridColumns.Add(col); col = new GridColumn(Lan.g(this, "Fee Schedule"), 75); gridGroups.ListGridColumns.Add(col); gridGroups.ListGridRows.Clear(); GridRow row; foreach (FeeSchedGroup feeSchedGroupCur in _listFeeSchedGroupsFiltered) { row = new GridRow(); row.Cells.Add(feeSchedGroupCur.Description); row.Cells.Add(FeeScheds.GetDescription(feeSchedGroupCur.FeeSchedNum)); //Returns empty string if the FeeSched couldn't be found. row.Tag = feeSchedGroupCur; gridGroups.ListGridRows.Add(row); } gridGroups.EndUpdate(); }
///<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 butImport_Click(object sender, EventArgs e) { if (!MsgBox.Show(this, true, "If you want a clean slate, the current fee schedule should be cleared first. When imported, any fees that are found in the text file will overwrite values of the current fee schedule showing in the main window. Are you sure you want to continue?")) { return; } Cursor = Cursors.WaitCursor; OpenFileDialog Dlg = new OpenFileDialog(); if (Directory.Exists(PrefC.GetString(PrefName.ExportPath))) { Dlg.InitialDirectory = PrefC.GetString(PrefName.ExportPath); } else if (Directory.Exists("C:\\")) { Dlg.InitialDirectory = "C:\\"; } if (Dlg.ShowDialog() != DialogResult.OK) { Cursor = Cursors.Default; return; } if (!File.Exists(Dlg.FileName)) { Cursor = Cursors.Default; MsgBox.Show(this, "File not found"); return; } string[] fields; double feeAmt; using (StreamReader sr = new StreamReader(Dlg.FileName)){ string line = sr.ReadLine(); while (line != null) { Cursor = Cursors.WaitCursor; fields = line.Split(new string[1] { "\t" }, StringSplitOptions.None); if (fields.Length > 1) // && fields[1]!=""){//we no longer skip blank fees { if (fields[1] == "") { feeAmt = -1; //triggers deletion of existing fee, but no insert. } else { feeAmt = PIn.Double(fields[1]); } Fees.Import(fields[0], feeAmt, SchedNum); SecurityLogs.MakeLogEntry(Permissions.ProcFeeEdit, 0, Lan.g(this, "Procedure") + ": " + fields[0] + ", " + Lan.g(this, "Fee") + ": " + feeAmt.ToString("c") + ", " + Lan.g(this, "Fee Schedule") + ": " + FeeScheds.GetDescription(SchedNum) + ". " + Lan.g(this, "Fee changed using the Import button in the Fee Tools window."), ProcedureCodes.GetCodeNum(fields[0])); } line = sr.ReadLine(); } } DataValid.SetInvalid(InvalidType.Fees); Cursor = Cursors.Default; DialogResult = DialogResult.OK; }
private void butIncrease_Click(object sender, System.EventArgs e) { int percent = 0; if (textPercent.Text == "") { MsgBox.Show(this, "Please enter a percent first."); return; } try{ percent = System.Convert.ToInt32(textPercent.Text); } catch { MsgBox.Show(this, "Percent is not a valid number."); return; } if (percent < -99 || percent > 99) { MsgBox.Show(this, "Percent must be between -99 and 99."); return; } if (!MsgBox.Show(this, true, "This will overwrite all values of the current fee schedule showing in the main window. For this reason, you should be working on a copy. Are you sure you want to continue?")) { return; } int round = 0; if (radioDime.Checked) { round = 1; } if (radioPenny.Checked) { round = 2; } Fees.Increase(SchedNum, percent, round); Fees.RefreshCache(); for (int i = 0; i < Fees.Listt.Count; i++) { if (Fees.Listt[i].FeeSched != SchedNum) { continue; } if (Fees.Listt[i].Amount == 0) { continue; } SecurityLogs.MakeLogEntry(Permissions.ProcFeeEdit, 0, Lan.g(this, "Procedure") + ": " + ProcedureCodes.GetStringProcCode(Fees.Listt[i].CodeNum) + ", " + Lan.g(this, "Fee") + ": " + Fees.Listt[i].Amount.ToString("c") + ", " + Lan.g(this, "Fee Schedule") + ": " + FeeScheds.GetDescription(Fees.Listt[i].FeeSched) + ". " + Lan.g(this, "Fee increased by") + " " + ((float)percent / 100.0f).ToString("p") + " " + Lan.g(this, " using the increase button in the Fee Tools window.") , Fees.Listt[i].CodeNum); } DialogResult = DialogResult.OK; }
private void butCopy_Click(object sender, System.EventArgs e) { if (comboCopyFrom.SelectedIndex == -1) { MsgBox.Show(this, "Please pick a fee schedule first."); return; } if (!MsgBox.Show(this, true, "This will overwrite all values of the current fee schedule showing in the main window. Are you sure you want to continue?")) { return; } //clear current Fees.ClearFeeSched(SchedNum); //copy any values over Fees.CopyFees(FeeSchedC.ListShort[comboCopyFrom.SelectedIndex].FeeSchedNum, SchedNum); for (int i = 0; i < Fees.Listt.Count; i++) { //ignore all but the OLD fee schedule. if (Fees.Listt[i].FeeSched != FeeSchedC.ListShort[comboCopyFrom.SelectedIndex].FeeSchedNum) { continue; } SecurityLogs.MakeLogEntry(Permissions.ProcFeeEdit, 0, Lan.g(this, "Procedure") + ": " + ProcedureCodes.GetStringProcCode(Fees.Listt[i].CodeNum) + ", " + Lan.g(this, "Fee") + ": " + Fees.Listt[i].Amount.ToString("c") + ", " + Lan.g(this, "Fee Schedule") + ": " + FeeScheds.GetDescription(Fees.Listt[i].FeeSched) + ". " + Lan.g(this, "Fee copied from") + " " + FeeScheds.GetDescription(FeeSchedC.ListShort[comboCopyFrom.SelectedIndex].FeeSchedNum) + " " + Lan.g(this, "using Fee Tools."), Fees.Listt[i].CodeNum); } DialogResult = DialogResult.OK; }
private void butOK_Click(object sender, System.EventArgs e) { if (textFee.errorProvider1.GetError(textFee) != "") { MessageBox.Show(Lan.g(this, "Please fix data entry error first.")); return; } DateTime datePrevious = FeeCur.SecDateTEdit; if (textFee.Text == "") { Fees.Delete(FeeCur); } else { FeeCur.Amount = PIn.Double(textFee.Text); //Fee object always created and inserted externally first 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, "Manual edit in Edit Fee window."), FeeCur.CodeNum, DateTime.MinValue); SecurityLogs.MakeLogEntry(Permissions.LogFeeEdit, 0, Lan.g(this, "Fee Updated"), FeeCur.FeeNum, datePrevious); //FeeCur.UseDefaultCov=checkDefCov.Checked; //FeeCur.UseDefaultFee=checkDefFee.Checked; DialogResult = DialogResult.OK; }
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); } }
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); } 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); } //Fees.Refresh();//redundant? DataValid.SetInvalid(InvalidType.Fees); }
private void butOK_Click(object sender, System.EventArgs e) { long feeSched = FeeSchedC.ListShort[listFeeSched.SelectedIndex].FeeSchedNum; string catName = ""; //string to hold current category name Fees fee = new Fees(); ReportSimpleGrid report = new ReportSimpleGrid(); report.Query = "SELECT procedurecode.ProcCode,fee.Amount,' ',procedurecode.Descript," + "procedurecode.AbbrDesc FROM procedurecode,fee " + "WHERE procedurecode.CodeNum=fee.CodeNum AND fee.FeeSched='" + feeSched.ToString() + "' ORDER BY procedurecode.ProcCode"; FormQuery2 = new FormQuery(report); FormQuery2.IsReport = true; if (radioCode.Checked == true) { FormQuery2.SubmitReportQuery(); report.Title = "Procedure Codes"; report.SubTitle.Add(PrefC.GetString(PrefName.PracticeTitle)); report.SubTitle.Add(FeeScheds.GetDescription(feeSched)); report.SetColumn(this, 0, "Code", 70); report.SetColumn(this, 1, "Fee Amount", 70, HorizontalAlignment.Right); report.SetColumn(this, 2, " ", 80); //otherwise, the amount gets bunched up next to the description. report.SetColumn(this, 3, "Description", 200); report.SetColumn(this, 4, "Abbr Description", 200); FormQuery2.ShowDialog(); DialogResult = DialogResult.OK; } else //categories //report.SubmitTemp();//create TableTemp which is not actually used { ProcedureCode[] ProcList = ProcedureCodes.GetProcList(); report.TableQ = new DataTable(null); for (int i = 0; i < 5; i++) //add columns { report.TableQ.Columns.Add(new System.Data.DataColumn()); //blank columns } report.InitializeColumns(); DataRow row = report.TableQ.NewRow();//add first row by hand to get value for temp row[0] = DefC.GetName(DefCat.ProcCodeCats, ProcList[0].ProcCat); catName = row[0].ToString(); row[1] = ProcList[0].ProcCode; row[2] = ProcList[0].Descript; row[3] = ProcList[0].AbbrDesc; row[4] = ((double)Fees.GetAmount0(ProcList[0].CodeNum, feeSched)).ToString("F"); report.ColTotal[4] += PIn.Decimal(row[4].ToString()); report.TableQ.Rows.Add(row); for (int i = 1; i < ProcList.Length; i++) //loop through data rows { row = report.TableQ.NewRow(); //create new row called 'row' based on structure of TableQ row[0] = DefC.GetName(DefCat.ProcCodeCats, ProcList[i].ProcCat); if (catName == row[0].ToString()) { row[0] = ""; } else { catName = row[0].ToString(); } row[1] = ProcList[i].ProcCode.ToString(); row[2] = ProcList[i].Descript; row[3] = ProcList[i].AbbrDesc.ToString(); row[4] = ((double)Fees.GetAmount0(ProcList[i].CodeNum, feeSched)).ToString("F"); //report.ColTotal[4]+=PIn.PDouble(row[4].ToString()); report.TableQ.Rows.Add(row); } FormQuery2.ResetGrid(); //this is a method in FormQuery2; report.Title = "Procedure Codes"; report.SubTitle.Add(PrefC.GetString(PrefName.PracticeTitle)); report.SubTitle.Add(FeeScheds.GetDescription(feeSched)); report.ColPos[0] = 20; report.ColPos[1] = 120; report.ColPos[2] = 270; report.ColPos[3] = 470; report.ColPos[4] = 620; report.ColPos[5] = 770; report.ColCaption[0] = "Category"; report.ColCaption[1] = "Code"; report.ColCaption[2] = "Description"; report.ColCaption[3] = "Abbr Description"; report.ColCaption[4] = "Fee Amount"; report.ColAlign[4] = HorizontalAlignment.Right; FormQuery2.ShowDialog(); DialogResult = DialogResult.OK; } }
private void FillGrid() { gridMain.BeginUpdate(); gridMain.Columns.Clear(); ODGridColumn col; if (PrefC.GetBool(PrefName.EasyNoClinics)) { col = new ODGridColumn(Lan.g("TableProcCodeEditMore", "Schedule"), 200); gridMain.Columns.Add(col); col = new ODGridColumn(Lan.g("TableProcCodeEditMore", "Provider"), 135); gridMain.Columns.Add(col); } else //Using clinics. { col = new ODGridColumn(Lan.g("TableProcCodeEditMore", "Schedule"), 130); gridMain.Columns.Add(col); col = new ODGridColumn(Lan.g("TableProcCodeEditMore", "Clinic"), 130); gridMain.Columns.Add(col); col = new ODGridColumn(Lan.g("TableProcCodeEditMore", "Provider"), 75); gridMain.Columns.Add(col); } col = new ODGridColumn(Lan.g("TableProcCodeEditMore", "Amount"), 100, HorizontalAlignment.Right); gridMain.Columns.Add(col); gridMain.Rows.Clear(); ODGridRow row; long lastFeeSched = 0; for (int i = 0; i < _listFees.Count; i++) { row = new ODGridRow(); if (_listFees[i].FeeSched != lastFeeSched) { row.Cells.Add(FeeScheds.GetDescription(_listFees[i].FeeSched)); row.Bold = true; lastFeeSched = _listFees[i].FeeSched; row.ColorBackG = Color.LightBlue; if (_listFees[i].ClinicNum != 0 || _listFees[i].ProvNum != 0) //FeeSched change, but not with a default fee. Insert placeholder row. { if (!PrefC.GetBool(PrefName.EasyNoClinics)) { row.Cells.Add(""); } row.Cells.Add(""); row.Cells.Add(""); Fee fee = new Fee(); fee.FeeSched = _listFees[i].FeeSched; row.Tag = fee; gridMain.Rows.Add(row); //Now that we have a placeholder for the default fee (none was found), go about adding the next row (non-default fee). row = new ODGridRow(); row.Cells.Add(""); } } else { row.Cells.Add(""); } row.Tag = _listFees[i]; if (!PrefC.GetBool(PrefName.EasyNoClinics)) //Using clinics { row.Cells.Add(Clinics.GetAbbr(_listFees[i].ClinicNum)); //Returns "" if invalid clinicnum (ie. 0) } row.Cells.Add(Providers.GetAbbr(_listFees[i].ProvNum)); //Returns "" if invalid provnum (ie. 0) row.Cells.Add(_listFees[i].Amount.ToString("n")); gridMain.Rows.Add(row); } gridMain.EndUpdate(); }