///<summary>Returns a list of limited versions of ProcTP corresponding to the Procedures in listProcs. Intended to mimic the logic in ///ContrTreat.LoadActiveTP, on a limited data basis in order to extract the necessary data to create a ToothChart.</summary> private List <ProcTP> GetTreatProcTPs(List <Procedure> listProcsAll) { List <Procedure> listProcs = listProcsAll.FindAll(x => x.ProcStatus.In(ProcStat.TP, ProcStat.TPi)); List <ProcTP> listProcTPs = new List <ProcTP>(); foreach (Procedure proc in listProcs) { ProcTP procTP = new ProcTP(); procTP.ProcNumOrig = proc.ProcNum; procTP.ToothNumTP = Tooth.ToInternat(proc.ToothNum); procTP.ProcCode = ProcedureCodes.GetStringProcCode(proc.CodeNum); if (ProcedureCodes.GetProcCode(proc.CodeNum).TreatArea == TreatmentArea.Surf) { procTP.Surf = Tooth.SurfTidyFromDbToDisplay(proc.Surf, proc.ToothNum); } else { procTP.Surf = proc.Surf; //for UR, L, etc. } listProcTPs.Add(procTP); } return(listProcTPs); }
private void FillGrid() { CreditCalcType credCalc; if (_isSimpleView) { credCalc = CreditCalcType.ExcludeAll; groupBreakdown.Visible = false; groupCreditLogic.Visible = false; } else if (radioIncludeAllCredits.Checked) { credCalc = CreditCalcType.IncludeAll; } else if (radioOnlyAllocatedCredits.Checked) { credCalc = CreditCalcType.AllocatedOnly; } else { credCalc = CreditCalcType.ExcludeAll; } _listAccountCharges = AccountModules.GetListUnpaidAccountCharges(_listProcedures, _listAdjustments, _listPaySplits, _listClaimProcs, _listPayPlanCharges, _listInsPayAsTotal, credCalc, ListSplitsCur); gridMain.BeginUpdate(); gridMain.ListGridColumns.Clear(); GridColumn col = new GridColumn(Lan.g("TableProcSelect", "Date"), 70); gridMain.ListGridColumns.Add(col); col = new GridColumn(Lan.g("TableProcSelect", "Prov"), 55); gridMain.ListGridColumns.Add(col); col = new GridColumn(Lan.g("TableProcSelect", "Code"), 55); gridMain.ListGridColumns.Add(col); if (Clinics.IsMedicalPracticeOrClinic(Clinics.ClinicNum)) { col = new GridColumn(Lan.g("TableProcSelect", "Description"), 290); gridMain.ListGridColumns.Add(col); } else { col = new GridColumn(Lan.g("TableProcSelect", "Tooth"), 40); gridMain.ListGridColumns.Add(col); col = new GridColumn(Lan.g("TableProcSelect", "Description"), 250); gridMain.ListGridColumns.Add(col); } if (credCalc == CreditCalcType.ExcludeAll) { col = new GridColumn(Lan.g("TableProcSelect", "Amt"), 0, HorizontalAlignment.Right); gridMain.ListGridColumns.Add(col); } else { col = new GridColumn(Lan.g("TableProcSelect", "Amt Orig"), 60, HorizontalAlignment.Right); gridMain.ListGridColumns.Add(col); col = new GridColumn(Lan.g("TableProcSelect", "Amt Start"), 60, HorizontalAlignment.Right); gridMain.ListGridColumns.Add(col); col = new GridColumn(Lan.g("TableProcSelect", "Amt End"), 60, HorizontalAlignment.Right); gridMain.ListGridColumns.Add(col); } gridMain.ListGridRows.Clear(); GridRow row; foreach (AccountEntry entry in _listAccountCharges) { if ((entry.GetType() != typeof(ProcExtended) || Math.Round(entry.AmountEnd, 3) == 0) && credCalc != CreditCalcType.ExcludeAll) { continue; } Procedure procCur = ((ProcExtended)entry.Tag).Proc; ProcedureCode procCodeCur = ProcedureCodes.GetProcCode(procCur.CodeNum); row = new GridRow(); row.Cells.Add(procCur.ProcDate.ToShortDateString()); row.Cells.Add(Providers.GetAbbr(entry.ProvNum)); row.Cells.Add(procCodeCur.ProcCode); if (!Clinics.IsMedicalPracticeOrClinic(Clinics.ClinicNum)) { row.Cells.Add(procCur.ToothNum == "" ? Tooth.SurfTidyFromDbToDisplay(procCur.Surf, procCur.ToothNum) : Tooth.ToInternat(procCur.ToothNum)); } string descriptionText = ""; if (procCur.ProcStatus == ProcStat.TP) { descriptionText = "(TP) "; } descriptionText += procCodeCur.Descript; row.Cells.Add(descriptionText); row.Cells.Add(entry.AmountOriginal.ToString("f")); if (credCalc != CreditCalcType.ExcludeAll) { row.Cells.Add(entry.AmountStart.ToString("f")); row.Cells.Add(entry.AmountEnd.ToString("f")); } row.Tag = entry; gridMain.ListGridRows.Add(row); } gridMain.EndUpdate(); if (!_isSimpleView) { RefreshBreakdown(); } }
private void FillGrid() { //Changes made in this window do not get saved until after this window closes. //But if you double click on a row, then you will end up saving. That shouldn't hurt anything, but could be improved. //also calculates totals for this "payment" //the payment itself is imaginary and is simply the sum of the claimprocs on this form gridMain.BeginUpdate(); gridMain.ListGridColumns.Clear(); List <string> listDefDescripts = new List <string>(); listDefDescripts.Add("None"); for (int i = 0; i < _listClaimPaymentTrackingDefs.Count; i++) { listDefDescripts.Add(_listClaimPaymentTrackingDefs[i].ItemName); } GridColumn col = new GridColumn(Lan.g("TableClaimProc", "Date"), 66); gridMain.ListGridColumns.Add(col); col = new GridColumn(Lan.g("TableClaimProc", "Prov"), 50); gridMain.ListGridColumns.Add(col); if (Clinics.IsMedicalPracticeOrClinic(Clinics.ClinicNum)) { col = new GridColumn(Lan.g("TableClaimProc", "Code"), 75); gridMain.ListGridColumns.Add(col); } else { col = new GridColumn(Lan.g("TableClaimProc", "Code"), 50); gridMain.ListGridColumns.Add(col); col = new GridColumn(Lan.g("TableClaimProc", "Tth"), 25); gridMain.ListGridColumns.Add(col); } col = new GridColumn(Lan.g("TableClaimProc", "Description"), 130); gridMain.ListGridColumns.Add(col); col = new GridColumn(Lan.g("TableClaimProc", "Fee"), 62, HorizontalAlignment.Right); gridMain.ListGridColumns.Add(col); col = new GridColumn(Lan.g("TableClaimProc", "Billed to Ins"), 75, HorizontalAlignment.Right); gridMain.ListGridColumns.Add(col); if (CultureInfo.CurrentCulture.Name.EndsWith("CA")) //Canadian. en-CA or fr-CA { col = new GridColumn(Lan.g("TableClaimProc", "Labs"), 62, HorizontalAlignment.Right); gridMain.ListGridColumns.Add(col); } col = new GridColumn(Lan.g("TableClaimProc", "Deduct"), 62, HorizontalAlignment.Right, true); gridMain.ListGridColumns.Add(col); col = new GridColumn(Lan.g("TableClaimProc", "Allowed"), 62, HorizontalAlignment.Right, true); gridMain.ListGridColumns.Add(col); col = new GridColumn(Lan.g("TableClaimProc", "Ins Pay"), 62, HorizontalAlignment.Right, true); gridMain.ListGridColumns.Add(col); col = new GridColumn(Lan.g("TableClaimProc", "Writeoff"), 62, HorizontalAlignment.Right, _isWriteOffEditable); gridMain.ListGridColumns.Add(col); col = new GridColumn(Lan.g("TableClaimProc", "Status"), 50, HorizontalAlignment.Center); gridMain.ListGridColumns.Add(col); col = new GridColumn(Lan.g("TableClaimProc", "Pmt"), 62, HorizontalAlignment.Center); gridMain.ListGridColumns.Add(col); col = new GridColumn(Lan.g("TableClaimProc", "Pay Tracking"), 90) { ListDisplayStrings = listDefDescripts, DropDownWidth = 160 }; gridMain.ListGridColumns.Add(col); col = new GridColumn(Lan.g("TableClaimProc", "Remarks"), 0, true); gridMain.ListGridColumns.Add(col); gridMain.ListGridRows.Clear(); GridRow row; Procedure ProcCur; for (int i = 0; i < ClaimProcsToEdit.Length; i++) { row = new GridRow(); if (ClaimProcsToEdit[i].ProcNum == 0) //Total payment //We want to always show the "Payment Date" instead of the procedure date for total payments because they are not associated to procedures. { row.Cells.Add(ClaimProcsToEdit[i].DateCP.ToShortDateString()); } else { row.Cells.Add(ClaimProcsToEdit[i].ProcDate.ToShortDateString()); } row.Cells.Add(Providers.GetAbbr(ClaimProcsToEdit[i].ProvNum)); string procFee = ""; if (ClaimProcsToEdit[i].ProcNum == 0) { row.Cells.Add(""); if (!Clinics.IsMedicalPracticeOrClinic(Clinics.ClinicNum)) { row.Cells.Add(""); } row.Cells.Add(Lan.g(this, "Total Payment")); } else { ProcCur = Procedures.GetProcFromList(ProcList, ClaimProcsToEdit[i].ProcNum); //will return a new procedure if none found. procFee = ProcCur.ProcFeeTotal.ToString("F"); ProcedureCode procCode = ProcedureCodes.GetProcCode(ProcCur.CodeNum); row.Cells.Add(procCode.ProcCode); if (!Clinics.IsMedicalPracticeOrClinic(Clinics.ClinicNum)) { row.Cells.Add(ProcCur.ToothNum == "" ? Tooth.SurfTidyFromDbToDisplay(ProcCur.Surf, ProcCur.ToothNum) : Tooth.ToInternat(ProcCur.ToothNum)); } string descript = procCode.Descript; if (procCode.IsCanadianLab) { descript = "^ ^ " + descript; } row.Cells.Add(descript); } row.Cells.Add(procFee); row.Cells.Add(ClaimProcsToEdit[i].FeeBilled.ToString("F")); if (CultureInfo.CurrentCulture.Name.EndsWith("CA")) //Canadian. en-CA or fr-CA { decimal labFeesForProc = 0; List <Procedure> labFeeProcs = Procedures.GetCanadianLabFees(ClaimProcsToEdit[i].ProcNum, ProcList); for (int j = 0; j < labFeeProcs.Count; j++) { labFeesForProc += (decimal)labFeeProcs[j].ProcFee; } row.Cells.Add(labFeesForProc.ToString("F")); } row.Cells.Add(ClaimProcsToEdit[i].DedApplied.ToString("F")); if (ClaimProcsToEdit[i].AllowedOverride == -1) { row.Cells.Add(""); } else { row.Cells.Add(ClaimProcsToEdit[i].AllowedOverride.ToString("F")); } row.Cells.Add(ClaimProcsToEdit[i].InsPayAmt.ToString("F")); row.Cells.Add(ClaimProcsToEdit[i].WriteOff.ToString("F")); switch (ClaimProcsToEdit[i].Status) { case ClaimProcStatus.Received: row.Cells.Add(Lan.g("TableClaimProc", "Recd")); break; case ClaimProcStatus.NotReceived: row.Cells.Add(""); break; //adjustment would never show here case ClaimProcStatus.Preauth: row.Cells.Add(Lan.g("TableClaimProc", "PreA")); break; case ClaimProcStatus.Supplemental: row.Cells.Add(Lan.g("TableClaimProc", "Supp")); break; case ClaimProcStatus.CapClaim: row.Cells.Add(Lan.g("TableClaimProc", "Cap")); break; //Estimate would never show here //Cap would never show here } if (ClaimProcsToEdit[i].ClaimPaymentNum > 0) { row.Cells.Add("X"); } else { row.Cells.Add(""); } bool isDefPresent = false; for (int j = 0; j < _listClaimPaymentTrackingDefs.Count; j++) { if (ClaimProcsToEdit[i].ClaimPaymentTracking == _listClaimPaymentTrackingDefs[j].DefNum) { row.Cells.Add(_listClaimPaymentTrackingDefs[j].ItemName); row.Cells[row.Cells.Count - 1].ComboSelectedIndex = j + 1; isDefPresent = true; break; } } if (!isDefPresent) //The ClaimPaymentTracking definition has been hidden or ClaimPaymentTracking==0 { row.Cells.Add(""); row.Cells[row.Cells.Count - 1].ComboSelectedIndex = 0; } row.Cells.Add(ClaimProcsToEdit[i].Remarks); gridMain.ListGridRows.Add(row); } gridMain.EndUpdate(); FillTotals(); }