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.Columns.Clear(); ODGridColumn col = new ODGridColumn(Lan.g("TableProcSelect", "Date"), 70); gridMain.Columns.Add(col); col = new ODGridColumn(Lan.g("TableProcSelect", "Prov"), 55); gridMain.Columns.Add(col); col = new ODGridColumn(Lan.g("TableProcSelect", "Code"), 55); gridMain.Columns.Add(col); if (Clinics.IsMedicalPracticeOrClinic(Clinics.ClinicNum)) { col = new ODGridColumn(Lan.g("TableProcSelect", "Description"), 290); gridMain.Columns.Add(col); } else { col = new ODGridColumn(Lan.g("TableProcSelect", "Tooth"), 40); gridMain.Columns.Add(col); col = new ODGridColumn(Lan.g("TableProcSelect", "Description"), 250); gridMain.Columns.Add(col); } if (credCalc == CreditCalcType.ExcludeAll) { col = new ODGridColumn(Lan.g("TableProcSelect", "Amt"), 0, HorizontalAlignment.Right); gridMain.Columns.Add(col); } else { col = new ODGridColumn(Lan.g("TableProcSelect", "Amt Orig"), 60, HorizontalAlignment.Right); gridMain.Columns.Add(col); col = new ODGridColumn(Lan.g("TableProcSelect", "Amt Start"), 60, HorizontalAlignment.Right); gridMain.Columns.Add(col); col = new ODGridColumn(Lan.g("TableProcSelect", "Amt End"), 60, HorizontalAlignment.Right); gridMain.Columns.Add(col); } gridMain.Rows.Clear(); ODGridRow row; foreach (AccountEntry entry in _listAccountCharges) { if (entry.GetType() != typeof(ProcExtended) || Math.Round(entry.AmountEnd, 3) == 0) { continue; } Procedure procCur = ((ProcExtended)entry.Tag).Proc; ProcedureCode procCodeCur = ProcedureCodes.GetProcCode(procCur.CodeNum); row = new ODGridRow(); 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(Tooth.ToInternat(procCur.ToothNum)); } row.Cells.Add(procCodeCur.Descript); 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.Rows.Add(row); } gridMain.EndUpdate(); if (!_isSimpleView) { RefreshBreakdown(); } }
///<summary>Both grid s should be filled with the same columns. This method prevents the need for two nearly identical fill grid patterns.</summary> private void FillGrid(ref ODGrid grid) { grid.BeginUpdate(); grid.ListGridColumns.Clear(); grid.ListGridColumns.Add(new GridColumn(Lan.g(this, "Status"), 40)); grid.ListGridColumns.Add(new GridColumn(Lan.g(this, "Tth"), 30)); grid.ListGridColumns.Add(new GridColumn(Lan.g(this, "Surf"), 40)); grid.ListGridColumns.Add(new GridColumn(Lan.g(this, "Code"), 40)); grid.ListGridColumns.Add(new GridColumn(Lan.g(this, "Description"), 195)); grid.ListGridColumns.Add(new GridColumn(Lan.g(this, "TPs"), 35)); grid.ListGridColumns.Add(new GridColumn(Lan.g(this, "Apt"), 40)); grid.ListGridRows.Clear(); GridRow row; List <Procedure> listProcs; if (grid == gridAll) { listProcs = _listTpProcsAll.FindAll(x => _listTpProcsCur.All(y => x.ProcNum != y.ProcNum)); } else { listProcs = _listTpProcsCur; } foreach (Procedure proc in listProcs) { row = new GridRow(); ProcedureCode proccode = ProcedureCodes.GetProcCode(proc.CodeNum); string description = ProcedureCodes.GetLaymanTerm(proc.CodeNum); if (proccode.IsCanadianLab) { description = "^ ^ " + description; } row.Cells.Add(proc.ProcStatus.ToString()); row.Cells.Add(Tooth.ToInternat(proc.ToothNum)); row.Cells.Add(proc.Surf); row.Cells.Add(proccode.ProcCode); row.Cells.Add(description); row.Cells.Add(_listTpAttachesAll.FindAll(x => x.ProcNum == proc.ProcNum && x.TreatPlanNum != _treatPlanUnassigned.TreatPlanNum).Count.ToString()); string aptStatus = ""; foreach (long aptNum in new[] { proc.AptNum, proc.PlannedAptNum }.Where(x => x > 0)) { Appointment apt = _listAppointments.FirstOrDefault(x => x.AptNum == aptNum); if (apt != null) { switch (apt.AptStatus) { case ApptStatus.UnschedList: aptStatus += "U"; break; case ApptStatus.Scheduled: aptStatus += "S"; break; case ApptStatus.Complete: aptStatus += "C"; break; case ApptStatus.Broken: aptStatus += "B"; break; case ApptStatus.Planned: aptStatus += "P"; break; case ApptStatus.PtNote: case ApptStatus.PtNoteCompleted: case ApptStatus.None: default: aptStatus += "!"; //should never happen break; } } } row.Cells.Add(aptStatus); row.Tag = proc; grid.ListGridRows.Add(row); } grid.EndUpdate(); }
///<summary>Called once for each claim to be created. For claims with a lot of procedures, this may actually create multiple claims. Normally returns empty string unless something went wrong.</summary> public static bool CreateClaim(ClaimSendQueueItem queueItem, int batchNum) { StringBuilder strb = new StringBuilder(); string t = "\t"; strb.Append("110\t111\t112\t118\t203/403\tF108/204/404\t205/405\t206\t207\t208\t209\t210\t211\t212\t215\t217\t219\t406\t408\t409\t410\t411\t413\t414\t415\t416\t418\t419\t420\t421\t422\t423\t424\t425\t426\t428\t429\t430\t432\t433\r\n"); Clearinghouse clearhouse = ClearinghouseL.GetClearinghouse(queueItem.ClearinghouseNum); Claim claim = Claims.GetClaim(queueItem.ClaimNum); Provider provBill = Providers.GetProv(claim.ProvBill); Patient pat = Patients.GetPat(claim.PatNum); InsPlan insplan = InsPlans.GetPlan(claim.PlanNum, new List <InsPlan>()); InsSub insSub = InsSubs.GetSub(claim.InsSubNum, new List <InsSub>()); Carrier carrier = Carriers.GetCarrier(insplan.CarrierNum); List <ClaimProc> claimProcList = ClaimProcs.Refresh(pat.PatNum); List <ClaimProc> claimProcsForClaim = ClaimProcs.GetForSendClaim(claimProcList, claim.ClaimNum); List <Procedure> procList = Procedures.Refresh(claim.PatNum); Procedure proc; ProcedureCode procCode; //ProcedureCode procCode; for (int i = 0; i < claimProcsForClaim.Count; i++) { proc = Procedures.GetProcFromList(procList, claimProcsForClaim[i].ProcNum); //procCode=Pro strb.Append(provBill.SSN + t); //110 strb.Append(provBill.MedicaidID + t); //111 strb.Append(t); //112 strb.Append(t); //118 strb.Append(pat.SSN + t); //203/403 strb.Append(carrier.CarrierName + t); //carrier name? strb.Append(insSub.SubscriberID + t); strb.Append(pat.PatNum.ToString() + t); strb.Append(pat.Birthdate.ToString("dd-MM-yyyy") + t); if (pat.Gender == PatientGender.Female) { strb.Append("2" + t); //"V"+t); } else { strb.Append("1" + t); //M"+t); } strb.Append("1" + t); strb.Append(DutchLName(pat.LName) + t); //last name without prefix strb.Append(DutchLNamePrefix(pat.LName) + t); //prefix strb.Append("2" + t); strb.Append(DutchInitials(pat) + t); //215. initials strb.Append(pat.Zip + t); strb.Append(DutchAddressNumber(pat.Address) + t); //219 house number. Already validated. strb.Append(t); strb.Append(proc.ProcDate.ToString("dd-MM-yyyy") + t); //procDate procCode = ProcedureCodes.GetProcCode(proc.CodeNum); string strProcCode = procCode.ProcCode; if (strProcCode.EndsWith("00")) //ending with 00 indicates it's a lab code. { strb.Append("02" + t); } else { strb.Append("01" + t); //409. Procedure code (01) or lab costs (02) } strb.Append(t); strb.Append(t); strb.Append(strProcCode + t); strb.Append(GetUL(proc, procCode) + t); //414. U/L. strb.Append(Tooth.ToInternat(proc.ToothNum) + t); strb.Append(Tooth.SurfTidyForClaims(proc.Surf, proc.ToothNum) + t); //needs validation strb.Append(t); if (claim.AccidentRelated == "") //not accident { strb.Append("N" + t); } else { strb.Append("J" + t); } strb.Append(pat.SSN + t); strb.Append(t); strb.Append(t); strb.Append(t); strb.Append(proc.ProcFee.ToString("F") + t); strb.Append("1" + t); strb.Append(proc.ProcFee.ToString("F") + t); strb.Append(t); strb.Append(t); strb.Append(proc.ProcFee.ToString("F") + t); strb.Append(t); strb.Append(t); strb.Append("\r\n"); } string saveFolder = clearhouse.ExportPath; if (!Directory.Exists(saveFolder)) { MessageBox.Show(saveFolder + " " + Lan.g("Dutch", "not found.")); return(false); } string saveFile = ODFileUtils.CombinePaths(saveFolder, "claims" + claim.ClaimNum.ToString() + ".txt"); File.WriteAllText(saveFile, strb.ToString()); //MessageBox.Show(strb.ToString()); return(true); }
///<summary></summary> public static bool ConditionIsMet(AutoCondition myAutoCondition, string toothNum, string surf, bool isAdditional, bool willBeMissing, int age) { switch (myAutoCondition) { case AutoCondition.Anterior: return(Tooth.IsAnterior(toothNum)); case AutoCondition.Posterior: return(Tooth.IsPosterior(toothNum)); case AutoCondition.Premolar: return(Tooth.IsPreMolar(toothNum)); case AutoCondition.Molar: return(Tooth.IsMolar(toothNum)); case AutoCondition.One_Surf: return(surf.Length == 1); case AutoCondition.Two_Surf: return(surf.Length == 2); case AutoCondition.Three_Surf: return(surf.Length == 3); case AutoCondition.Four_Surf: return(surf.Length == 4); case AutoCondition.Five_Surf: return(surf.Length == 5); case AutoCondition.First: return(!isAdditional); case AutoCondition.EachAdditional: return(isAdditional); case AutoCondition.Maxillary: return(Tooth.IsMaxillary(toothNum)); case AutoCondition.Mandibular: return(!Tooth.IsMaxillary(toothNum)); case AutoCondition.Primary: return(Tooth.IsPrimary(toothNum)); case AutoCondition.Permanent: return(!Tooth.IsPrimary(toothNum)); case AutoCondition.Pontic: return(willBeMissing); case AutoCondition.Retainer: return(!willBeMissing); case AutoCondition.AgeOver18: return(age > 18); default: return(false); } }
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.Columns.Clear(); ODGridColumn col = new ODGridColumn(Lan.g("TableClaimProc", "Date"), 70); gridMain.Columns.Add(col); col = new ODGridColumn(Lan.g("TableClaimProc", "Prov"), 50); gridMain.Columns.Add(col); col = new ODGridColumn(Lan.g("TableClaimProc", "Code"), 50); gridMain.Columns.Add(col); col = new ODGridColumn(Lan.g("TableClaimProc", "Tth"), 35); gridMain.Columns.Add(col); col = new ODGridColumn(Lan.g("TableClaimProc", "Description"), 120); gridMain.Columns.Add(col); col = new ODGridColumn(Lan.g("TableClaimProc", "Billed"), 55, HorizontalAlignment.Right); gridMain.Columns.Add(col); col = new ODGridColumn(Lan.g("TableClaimProc", "Deduct"), 55, HorizontalAlignment.Right, true); gridMain.Columns.Add(col); col = new ODGridColumn(Lan.g("TableClaimProc", "Allowed"), 55, HorizontalAlignment.Right, true); gridMain.Columns.Add(col); col = new ODGridColumn(Lan.g("TableClaimProc", "Ins Pay"), 55, HorizontalAlignment.Right, true); gridMain.Columns.Add(col); col = new ODGridColumn(Lan.g("TableClaimProc", "Writeoff"), 55, HorizontalAlignment.Right, true); gridMain.Columns.Add(col); col = new ODGridColumn(Lan.g("TableClaimProc", "Status"), 50, HorizontalAlignment.Center); gridMain.Columns.Add(col); col = new ODGridColumn(Lan.g("TableClaimProc", "Pmt"), 30, HorizontalAlignment.Center); gridMain.Columns.Add(col); col = new ODGridColumn(Lan.g("TableClaimProc", "Remarks"), 170, true); gridMain.Columns.Add(col); gridMain.Rows.Clear(); ODGridRow row; Procedure ProcCur; for (int i = 0; i < ClaimProcsToEdit.Length; i++) { row = new ODGridRow(); row.Cells.Add(ClaimProcsToEdit[i].ProcDate.ToShortDateString()); row.Cells.Add(Providers.GetAbbr(ClaimProcsToEdit[i].ProvNum)); if (ClaimProcsToEdit[i].ProcNum == 0) { row.Cells.Add(""); row.Cells.Add(""); row.Cells.Add(Lan.g(this, "Total Payment")); } else { ProcCur = Procedures.GetProcFromList(ProcList, ClaimProcsToEdit[i].ProcNum); row.Cells.Add(ProcedureCodes.GetProcCode(ProcCur.CodeNum).ProcCode); row.Cells.Add(Tooth.ToInternat(ProcCur.ToothNum)); row.Cells.Add(ProcedureCodes.GetProcCode(ProcCur.CodeNum).Descript); } row.Cells.Add(ClaimProcsToEdit[i].FeeBilled.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("Recd"); break; case ClaimProcStatus.NotReceived: row.Cells.Add(""); break; //adjustment would never show here case ClaimProcStatus.Preauth: row.Cells.Add("PreA"); break; case ClaimProcStatus.Supplemental: row.Cells.Add("Supp"); break; case ClaimProcStatus.CapClaim: row.Cells.Add("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(""); } row.Cells.Add(ClaimProcsToEdit[i].Remarks); gridMain.Rows.Add(row); } gridMain.EndUpdate(); FillTotals(); }
///<summary>This is, of course, called when module refreshed. But it's also called when user sets missing teeth or tooth movements. In that case, the Progress notes are not refreshed, so it's a little faster. This also fills in the movement amounts.</summary> private void FillToothChart() { Cursor = Cursors.WaitCursor; toothChart.SuspendLayout(); toothChart.UseInternational = PrefB.GetBool("UseInternationalToothNumbers"); toothChart.ColorBackground = DefB.Long[(int)DefCat.ChartGraphicColors][10].ItemColor; toothChart.ColorText = DefB.Long[(int)DefCat.ChartGraphicColors][11].ItemColor; toothChart.ColorTextHighlight = DefB.Long[(int)DefCat.ChartGraphicColors][12].ItemColor; toothChart.ColorBackHighlight = DefB.Long[(int)DefCat.ChartGraphicColors][13].ItemColor; //remember which teeth were selected ArrayList selectedTeeth = new ArrayList(); //integers 1-32 for (int i = 0; i < toothChart.SelectedTeeth.Length; i++) { selectedTeeth.Add(Tooth.ToInt(toothChart.SelectedTeeth[i])); } toothChart.ResetTeeth(); /*if(PatCur==null) { * toothChart.ResumeLayout(); * FillMovementsAndHidden(); * Cursor=Cursors.Default; * return; * }*/ if (ShowBySelectedTeeth) { for (int i = 0; i < selectedTeeth.Count; i++) { toothChart.SetSelected((int)selectedTeeth[i], true); } } //first, primary. That way, you can still set a primary tooth missing afterwards. for (int i = 0; i < ToothInitialList.Length; i++) { if (ToothInitialList[i].InitialType == ToothInitialType.Primary) { toothChart.SetToPrimary(ToothInitialList[i].ToothNum); } } for (int i = 0; i < ToothInitialList.Length; i++) { switch (ToothInitialList[i].InitialType) { case ToothInitialType.Missing: toothChart.SetInvisible(ToothInitialList[i].ToothNum); break; case ToothInitialType.Hidden: toothChart.HideTooth(ToothInitialList[i].ToothNum); break; //case ToothInitialType.Primary: // break; case ToothInitialType.Rotate: toothChart.MoveTooth(ToothInitialList[i].ToothNum, ToothInitialList[i].Movement, 0, 0, 0, 0, 0); break; case ToothInitialType.TipM: toothChart.MoveTooth(ToothInitialList[i].ToothNum, 0, ToothInitialList[i].Movement, 0, 0, 0, 0); break; case ToothInitialType.TipB: toothChart.MoveTooth(ToothInitialList[i].ToothNum, 0, 0, ToothInitialList[i].Movement, 0, 0, 0); break; case ToothInitialType.ShiftM: toothChart.MoveTooth(ToothInitialList[i].ToothNum, 0, 0, 0, ToothInitialList[i].Movement, 0, 0); break; case ToothInitialType.ShiftO: toothChart.MoveTooth(ToothInitialList[i].ToothNum, 0, 0, 0, 0, ToothInitialList[i].Movement, 0); break; case ToothInitialType.ShiftB: toothChart.MoveTooth(ToothInitialList[i].ToothNum, 0, 0, 0, 0, 0, ToothInitialList[i].Movement); break; } } DrawProcsOfStatus(ProcStat.EO); DrawProcsOfStatus(ProcStat.EC); DrawProcsOfStatus(ProcStat.C); DrawProcsOfStatus(ProcStat.R); DrawProcsOfStatus(ProcStat.TP); toothChart.ResumeLayout(); //FillMovementsAndHidden(); Cursor = Cursors.Default; }
///<summary>Draws the number and the rectangle behind it. Draws in the appropriate color</summary> private void DrawNumber(string tooth_id, bool isSelected, bool isFullRedraw, Graphics g) { if (DesignMode) { return; } if (TcData == null) { return; //trying to fix a designtime bug. } if (!Tooth.IsValidDB(tooth_id)) { return; } if (TcData.ListToothGraphics[tooth_id] == null) { //throw new Exception(tooth_id+" null"); return; //for some reason, it's still getting to here in DesignMode } if (isFullRedraw) //if redrawing all numbers { if (TcData.ListToothGraphics[tooth_id].HideNumber) //and this is a "hidden" number { return; //skip } if (Tooth.IsPrimary(tooth_id) && !TcData.ListToothGraphics[Tooth.PriToPerm(tooth_id)].ShowPrimaryLetter) //but not set to show primary letters { return; } } string displayNum = Tooth.GetToothLabelGraphic(tooth_id, TcData.ToothNumberingNomenclature); float toMm = 1f / TcData.ScaleMmToPix; float labelWidthMm = g.MeasureString(displayNum, Font).Width / TcData.ScaleMmToPix; float labelHeightMm = ((float)Font.Height - .5f) / TcData.ScaleMmToPix; SizeF labelSizeF = new SizeF(labelWidthMm, (float)Font.Height / TcData.ScaleMmToPix); Rectangle rec = TcData.GetNumberRecPix(tooth_id, labelSizeF); //Rectangle recPix=TcData.ConvertRecToPix(recMm); if (isSelected) { g.FillRectangle(new SolidBrush(TcData.ColorBackHighlight), rec); } else { g.FillRectangle(new SolidBrush(TcData.ColorBackground), rec); } if (TcData.ListToothGraphics[tooth_id].HideNumber) //If number is hidden. //do not print string { } else if (Tooth.IsPrimary(tooth_id) && !TcData.ListToothGraphics[Tooth.PriToPerm(tooth_id)].ShowPrimaryLetter) { //do not print string } else if (isSelected) { g.DrawString(displayNum, Font, new SolidBrush(TcData.ColorTextHighlight), rec.X, rec.Y); } else { g.DrawString(displayNum, Font, new SolidBrush(TcData.ColorText), rec.X, rec.Y); } }
///<summary></summary> public void FormDocInfo_Load(object sender, System.EventArgs e) { if (_isOkDisabled) { butOK.Enabled = false; } //if (Docs.Cur.FileName.Equals(null)) listCategory.Items.Clear(); _listImageCatDefs = Defs.GetDefsForCategory(DefCat.ImageCats, true); for (int i = 0; i < _listImageCatDefs.Count; i++) { string folderName = _listImageCatDefs[i].ItemName; listCategory.Items.Add(folderName); if (i == 0 || _listImageCatDefs[i].DefNum == DocCur.DocCategory || folderName == initialSelection) { listCategory.SelectedIndex = i; } } listType.Items.Clear(); listType.Items.AddRange(Enum.GetNames(typeof(ImageType))); listType.SelectedIndex = (int)DocCur.ImgType; textToothNumbers.Text = Tooth.FormatRangeForDisplay(DocCur.ToothNumbers); textDate.Text = DocCur.DateCreated.ToShortDateString(); textTime.Text = DocCur.DateCreated.ToLongTimeString(); textDescript.Text = DocCur.Description; if (PrefC.AtoZfolderUsed == DataStorageType.LocalAtoZ) { string patFolder; if (!TryGetPatientFolder(out patFolder)) { return; } textFileName.Text = ODFileUtils.CombinePaths(patFolder, DocCur.FileName); if (File.Exists(textFileName.Text)) { FileInfo fileInfo = new FileInfo(textFileName.Text); textSize.Text = fileInfo.Length.ToString("n0"); } } else if (CloudStorage.IsCloudStorage) { string patFolder; if (!TryGetPatientFolder(out patFolder)) { return; } textFileName.Text = ODFileUtils.CombinePaths(patFolder, DocCur.FileName, '/'); } else { labelFileName.Visible = false; textFileName.Visible = false; butOpen.Visible = false; textSize.Text = DocCur.RawBase64.Length.ToString("n0"); } textToothNumbers.Text = Tooth.FormatRangeForDisplay(DocCur.ToothNumbers); //textNote.Text=DocCur.Note; if (Clinics.IsMedicalPracticeOrClinic(Clinics.ClinicNum)) { labelToothNums.Visible = false; textToothNumbers.Visible = false; } }
private void CreateIndividual(ReportSimpleGrid report) { //added Procnum to retrieve all codes report.Query = "SELECT procedurelog.ProcDate," + DbHelper.Concat("patient.LName", "', '", "patient.FName", "' '", "patient.MiddleI") + " " + "AS plfname, procedurecode.ProcCode," + "procedurelog.ToothNum,procedurecode.Descript,provider.Abbr," + "procedurelog.ClinicNum," + "procedurelog.ProcFee-IFNULL(SUM(claimproc.WriteOff),0) "; //\"$fee\" " //if no writeoff, then subtract 0 if (DataConnection.DBtype == DatabaseType.MySql) { report.Query += "$fee "; } else //Oracle needs quotes. { report.Query += "\"$fee\" "; } report.Query += "FROM patient,procedurecode,provider,procedurelog " + "LEFT JOIN claimproc ON procedurelog.ProcNum=claimproc.ProcNum " + "AND claimproc.Status='7' " //only CapComplete writeoffs are subtracted here. + "WHERE procedurelog.ProcStatus = '2' " + "AND patient.PatNum=procedurelog.PatNum " + "AND procedurelog.CodeNum=procedurecode.CodeNum " + "AND provider.ProvNum=procedurelog.ProvNum " + whereProv + whereClin + "AND procedurecode.ProcCode LIKE '%" + POut.String(textCode.Text) + "%' " + "AND " + DbHelper.DateColumn("procedurelog.ProcDate") + " >= " + POut.Date(date1.SelectionStart) + " " + "AND " + DbHelper.DateColumn("procedurelog.ProcDate") + " <= " + POut.Date(date2.SelectionStart) + " " + "GROUP BY procedurelog.ProcNum " + "ORDER BY " + DbHelper.DateColumn("procedurelog.ProcDate") + ",plfname,procedurecode.ProcCode,ToothNum"; FormQuery2 = new FormQuery(report); FormQuery2.IsReport = true; DataTable table = report.GetTempTable(); report.TableQ = new DataTable(null); int colI = 7; if (!PrefC.GetBool(PrefName.EasyNoClinics)) { colI = 8; } for (int i = 0; i < colI; i++) //add columns { report.TableQ.Columns.Add(new System.Data.DataColumn()); //blank columns } report.InitializeColumns(); DataRow row; decimal dec = 0; decimal total = 0; for (int i = 0; i < table.Rows.Count; i++) { row = report.TableQ.NewRow(); //create new row called 'row' based on structure of TableQ row[0] = PIn.Date(table.Rows[i][0].ToString()).ToShortDateString(); row[1] = table.Rows[i][1].ToString(); //name row[2] = table.Rows[i][2].ToString(); //adacode row[3] = Tooth.ToInternat(table.Rows[i][3].ToString()); //tooth row[4] = table.Rows[i][4].ToString(); //descript row[5] = table.Rows[i][5].ToString(); //prov if (!PrefC.GetBool(PrefName.EasyNoClinics)) { row[6] = Clinics.GetDesc(PIn.Long(table.Rows[i][6].ToString())); //clinic dec = PIn.Decimal(table.Rows[i][7].ToString()); //fee row[7] = dec.ToString("n"); } else { dec = PIn.Decimal(table.Rows[i][7].ToString()); //fee row[6] = dec.ToString("n"); } total += dec; report.TableQ.Rows.Add(row); } if (!PrefC.GetBool(PrefName.EasyNoClinics)) { report.ColTotal[7] = total; } else { report.ColTotal[6] = total; } FormQuery2.ResetGrid(); report.Title = "Daily Procedures"; report.SubTitle.Add(PrefC.GetString(PrefName.PracticeTitle)); report.SubTitle.Add(date1.SelectionStart.ToString("d") + " - " + date2.SelectionStart.ToString("d")); if (checkAllProv.Checked) { report.SubTitle.Add(Lan.g(this, "All Providers")); } else { string provNames = ""; for (int i = 0; i < listProv.SelectedIndices.Count; i++) { if (i > 0) { provNames += ", "; } provNames += ProviderC.ListShort[listProv.SelectedIndices[i]].Abbr; } report.SubTitle.Add(provNames); } if (!PrefC.GetBool(PrefName.EasyNoClinics)) { if (checkAllClin.Checked) { report.SubTitle.Add(Lan.g(this, "All Clinics")); } else { string clinNames = ""; for (int i = 0; i < listClin.SelectedIndices.Count; i++) { if (i > 0) { clinNames += ", "; } if (listClin.SelectedIndices[i] == 0) { clinNames += Lan.g(this, "Unassigned"); } else { clinNames += Clinics.List[listClin.SelectedIndices[i] - 1].Description; } } report.SubTitle.Add(clinNames); } } report.SetColumn(this, 0, "Date", 80); report.SetColumn(this, 1, "Patient Name", 130); report.SetColumn(this, 2, "ADA Code", 75); report.SetColumn(this, 3, "Tooth", 45); report.SetColumn(this, 4, "Description", 200); report.SetColumn(this, 5, "Provider", 50); if (!PrefC.GetBool(PrefName.EasyNoClinics)) { report.SetColumn(this, 6, "Clinic", 70); report.SetColumn(this, 7, "Fee", 90, HorizontalAlignment.Right); } else { report.SetColumn(this, 6, "Fee", 90, HorizontalAlignment.Right); } FormQuery2.ShowDialog(); DialogResult = DialogResult.OK; }
private void FillProcedure() { if (PaySplitCur.ProcNum == 0) { textProcDate2.Text = ""; textProcProv.Text = ""; textProcTooth.Text = ""; textProcDescription.Text = ""; ProcFee = 0; textProcFee.Text = ""; ProcInsPaid = 0; textProcInsPaid.Text = ""; ProcInsEst = 0; textProcInsEst.Text = ""; ProcAdj = 0; textProcAdj.Text = ""; ProcPrevPaid = 0; textProcPrevPaid.Text = ""; ProcPaidHere = 0; textProcPaidHere.Text = ""; labelProcRemain.Text = ""; //butAttach.Enabled=true; //butDetach.Enabled=false; //ComputeProcTotals(); return; } Procedure ProcCur = Procedures.GetOneProc(PaySplitCur.ProcNum, false); ClaimProc[] ClaimProcList = ClaimProcs.Refresh(ProcCur.PatNum); Adjustment[] AdjustmentList = Adjustments.Refresh(ProcCur.PatNum); PaySplit[] PaySplitList = PaySplits.Refresh(ProcCur.PatNum); textProcDate.Text = ProcCur.ProcDate.ToShortDateString(); textProcDate2.Text = ProcCur.ProcDate.ToShortDateString(); textProcProv.Text = Providers.GetAbbr(ProcCur.ProvNum); textProcTooth.Text = Tooth.ToInternat(ProcCur.ToothNum); textProcDescription.Text = ProcedureCodes.GetProcCode(ProcCur.ADACode).Descript; ProcFee = ProcCur.ProcFee; ProcInsPaid = -ClaimProcs.ProcInsPay(ClaimProcList, ProcCur.ProcNum); ProcInsEst = -ClaimProcs.ProcEstNotReceived(ClaimProcList, ProcCur.ProcNum); ProcAdj = Adjustments.GetTotForProc(ProcCur.ProcNum, AdjustmentList); //next line will still work even if IsNew ProcPrevPaid = -PaySplits.GetTotForProc(ProcCur.ProcNum, PaySplitList, PaySplitCur.SplitNum); textProcFee.Text = ProcFee.ToString("F"); if (ProcInsPaid == 0) { textProcInsPaid.Text = ""; } else { textProcInsPaid.Text = ProcInsPaid.ToString("F"); } if (ProcInsEst == 0) { textProcInsEst.Text = ""; } else { textProcInsEst.Text = ProcInsEst.ToString("F"); } if (ProcAdj == 0) { textProcAdj.Text = ""; } else { textProcAdj.Text = ProcAdj.ToString("F"); } if (ProcPrevPaid == 0) { textProcPrevPaid.Text = ""; } else { textProcPrevPaid.Text = ProcPrevPaid.ToString("F"); } ComputeProcTotals(); //butAttach.Enabled=false; //butDetach.Enabled=true; }
private void butApptProcs_Click(object sender, EventArgs e) { if (!MsgBox.Show(this, MsgBoxButtons.OKCancel, "This will fix procedure descriptions in the Appt module that aren't correctly showing tooth numbers.\r\nContinue?")) { return; } Cursor = Cursors.WaitCursor; //The ApptProcDescript region is also in FormProcEdit.SaveAndClose() and FormDatabaseMaintenance.butApptProcs_Click() Make any changes there as well. #region ApptProcDescript List <long> aptNums = new List <long>(); Appointment[] aptList = Appointments.GetForPeriod(DateTime.Now.Date.AddMonths(-6), DateTime.MaxValue.AddDays(-10)); for (int i = 0; i < aptList.Length; i++) { aptNums.Add(aptList[i].AptNum); } List <Procedure> procsMultApts = Procedures.GetProcsMultApts(aptNums); for (int i = 0; i < aptList.Length; i++) { Appointment newApt = aptList[i].Clone(); newApt.ProcDescript = ""; Procedure[] procsForOne = Procedures.GetProcsOneApt(aptList[i].AptNum, procsMultApts); string procDescript = ""; for (int j = 0; j < procsForOne.Length; j++) { ProcedureCode procCode = ProcedureCodes.GetProcCodeFromDb(procsForOne[j].CodeNum); if (j > 0) { procDescript += ", "; } switch (procCode.TreatArea) { case TreatmentArea.Surf: procDescript += "#" + Tooth.GetToothLabel(procsForOne[j].ToothNum) + "-" + procsForOne[j].Surf + "-"; //""#12-MOD-" break; case TreatmentArea.Tooth: procDescript += "#" + Tooth.GetToothLabel(procsForOne[j].ToothNum) + "-"; //"#12-" break; case TreatmentArea.Quad: procDescript += procsForOne[j].Surf + "-"; //"UL-" break; case TreatmentArea.Sextant: procDescript += "S" + procsForOne[j].Surf + "-"; //"S2-" break; case TreatmentArea.Arch: procDescript += procsForOne[j].Surf + "-"; //"U-" break; case TreatmentArea.ToothRange: break; default: //area 3 or 0 (mouth) break; } procDescript += procCode.AbbrDesc; } newApt.ProcDescript = procDescript; Appointments.Update(newApt, aptList[i]); } #endregion Cursor = Cursors.Default; MsgBox.Show(this, "Done. Please refresh Appt module to see the changes."); }
//Seeding everything except Identity tables (Roles, Logins and Claims) private void SeedAll(ApplicationDbContext context) { var passwordHasher = new PasswordHasher(); var upLeft1 = new Tooth { ToothPosition = ToothPosition.gl1, ToothState = ToothState.H }; var upLeft2 = new Tooth { ToothPosition = ToothPosition.gl2, ToothState = ToothState.H }; var upLeft3 = new Tooth { ToothPosition = ToothPosition.gl3, ToothState = ToothState.H }; var upLeft4 = new Tooth { ToothPosition = ToothPosition.gl4, ToothState = ToothState.H }; var upLeft5 = new Tooth { ToothPosition = ToothPosition.gl5, ToothState = ToothState.H }; var upLeft6 = new Tooth { ToothPosition = ToothPosition.gl6, ToothState = ToothState.H }; var upLeft7 = new Tooth { ToothPosition = ToothPosition.gl7, ToothState = ToothState.H }; var upLeft8 = new Tooth { ToothPosition = ToothPosition.gl8, ToothState = ToothState.H }; var upRight1 = new Tooth { ToothPosition = ToothPosition.gd1, ToothState = ToothState.H }; var upRight2 = new Tooth { ToothPosition = ToothPosition.gd2, ToothState = ToothState.H }; var upRight3 = new Tooth { ToothPosition = ToothPosition.gd3, ToothState = ToothState.H }; var upRight4 = new Tooth { ToothPosition = ToothPosition.gd4, ToothState = ToothState.H }; var upRight5 = new Tooth { ToothPosition = ToothPosition.gd5, ToothState = ToothState.H }; var upRight6 = new Tooth { ToothPosition = ToothPosition.gd6, ToothState = ToothState.H }; var upRight7 = new Tooth { ToothPosition = ToothPosition.gd7, ToothState = ToothState.H }; var upRight8 = new Tooth { ToothPosition = ToothPosition.gd8, ToothState = ToothState.H }; var downLeft1 = new Tooth { ToothPosition = ToothPosition.dl1, ToothState = ToothState.H }; var downLeft2 = new Tooth { ToothPosition = ToothPosition.dl2, ToothState = ToothState.H }; var downLeft3 = new Tooth { ToothPosition = ToothPosition.dl3, ToothState = ToothState.C2 }; var downLeft4 = new Tooth { ToothPosition = ToothPosition.dl4, ToothState = ToothState.H }; var downLeft5 = new Tooth { ToothPosition = ToothPosition.dl5, ToothState = ToothState.C1 }; var downLeft6 = new Tooth { ToothPosition = ToothPosition.dl6, ToothState = ToothState.H }; var downLeft7 = new Tooth { ToothPosition = ToothPosition.dl7, ToothState = ToothState.H }; var downLeft8 = new Tooth { ToothPosition = ToothPosition.dl8, ToothState = ToothState.C1 }; var downRight1 = new Tooth { ToothPosition = ToothPosition.dd1, ToothState = ToothState.Cu }; var downRight2 = new Tooth { ToothPosition = ToothPosition.dd2, ToothState = ToothState.H }; var downRight3 = new Tooth { ToothPosition = ToothPosition.dd3, ToothState = ToothState.H }; var downRight4 = new Tooth { ToothPosition = ToothPosition.dd4, ToothState = ToothState.C1 }; var downRight5 = new Tooth { ToothPosition = ToothPosition.dd5, ToothState = ToothState.No }; var downRight6 = new Tooth { ToothPosition = ToothPosition.dd6, ToothState = ToothState.CC3 }; var downRight7 = new Tooth { ToothPosition = ToothPosition.dd7, ToothState = ToothState.H }; var downRight8 = new Tooth { ToothPosition = ToothPosition.dd8, ToothState = ToothState.H }; //kicked out //var medicalRecord01 = new MedicalRecord //{ // DateCreated = DateTime.Now, // Description = "Vadjena trica donja lijeva", // ToothPosition = ToothPosition.dd3, // ToothState = ToothState.CC1 //}; var medicalRecord02 = new MedicalRecord { DateCreated = DateTime.Now, Description = "Radjena krunica gornje lijeve sestice", ToothPosition = ToothPosition.dd7, ToothState = ToothState.Cu }; var patient = new Patient { UserName = "******", PasswordHash = passwordHasher.HashPassword("P@ssw0rd"), FirstName = "Omer", LastName = "Ahmetagic", DateOfBirth = new DateTime(1987, 4, 3), Address = "Brcanska 2", DateCreated = DateTime.Now, EmploymentStatus = EmploymentStatus.Student, Email = "*****@*****.**", PhoneNumber = "062/064-064", SecurityStamp = "dcvfgdve", MedicalHistory = new MedicalHistory { Note = "Patient's teeth are just awesome and he is ready to get married.", MedicalRecords = new List <MedicalRecord>() { medicalRecord02 }, Teeth = new List <Tooth>() { upLeft1, upLeft2, upLeft3, upLeft4, upLeft5, upLeft6, upLeft7, upLeft8, upRight1, upRight2, upRight3, upRight4, upRight5, upRight6, upRight7, upRight8, downLeft1, downLeft2, downLeft3 , downLeft4, downLeft5, downLeft6, downLeft7, downLeft8, downRight1, downRight2, downRight3, downRight4, downRight5 , downRight6, downRight7, downRight8 } } }; var patient5 = new Patient { UserName = "******", PasswordHash = passwordHasher.HashPassword("P@ssw0rd"), FirstName = "Meho", LastName = "Mehiæ", DateOfBirth = new DateTime(1987, 4, 3), Address = "Brcanska 2", DateCreated = DateTime.Now, EmploymentStatus = EmploymentStatus.Student, Email = "*****@*****.**", PhoneNumber = "062/064-064", SecurityStamp = "dcvfgddwve", MedicalHistory = new MedicalHistory { Note = "Patient's teeth are just awesome and he is ready to get married..", Teeth = new List <Tooth>() { upLeft1, upLeft2, upLeft3, upLeft4, upLeft5, upLeft6, upLeft7, upLeft8, upRight1, upRight2, upRight3, upRight4, upRight5, upRight6, upRight7, upRight8, downLeft1, downLeft2, downLeft3 , downLeft4, downLeft5, downLeft6, downLeft7, downLeft8, downRight1, downRight2, downRight3, downRight4, downRight5 , downRight6, downRight7, downRight8 } } }; //var downRight222 = new Tooth //{ // ToothPosition = ToothPosition.dd3, // ToothState = ToothState.No //}; var upRight222 = new Tooth { ToothPosition = ToothPosition.gd5, ToothState = ToothState.C1 }; var medicalRecord11 = new MedicalRecord { DateCreated = DateTime.Now, Description = "Vadjena trica donja desna" }; var medicalRecord12 = new MedicalRecord { DateCreated = DateTime.Now, Description = "Zalivena gornja desna petica" }; var appointment = new Appointment { Id = Guid.NewGuid().ToString(), Description = "Emire pomozi, boli me sestica", Title = "Treba mi izvaditi zub", Start = new DateTime(2016, 12, 2, 14, 0, 0), End = new DateTime(2016, 12, 2, 15, 0, 0), IsAccepted = true }; var appointment2 = new Appointment { Id = Guid.NewGuid().ToString(), Description = "Damire pomozi, dodje mi da se ubijem, ja ne znam ko sam", Title = "Treba me roknuti", Start = new DateTime(2016, 12, 3, 15, 0, 0), End = new DateTime(2016, 12, 3, 16, 0, 0), IsAccepted = false }; var appointment3 = new Appointment { Id = Guid.NewGuid().ToString(), Description = "Boli me sestica sutra", Title = "Nemam pojma sta hocu", Start = new DateTime(2016, 12, 1, 15, 0, 0), End = new DateTime(2016, 12, 1, 17, 0, 0), IsAccepted = false }; var patient2 = new Patient { UserName = "******", PasswordHash = passwordHasher.HashPassword("P@ssw0rd"), FirstName = "Jusuf", LastName = "Koric", DateOfBirth = new DateTime(1993, 4, 3), Address = "Butmirska Neka 12", DateCreated = DateTime.Now, EmploymentStatus = EmploymentStatus.Student, Email = "*****@*****.**", PhoneNumber = "062/064-064", SecurityStamp = "f1f65sadfafjsadasdamsoa", MedicalHistory = new MedicalHistory { PatientId = patient.Id, Note = "Patient's teeth are very good, but since he is awesome looking, he is ready to get married.", MedicalRecords = new List <MedicalRecord>() { medicalRecord11, medicalRecord12 }, Teeth = new List <Tooth>() { upRight222 } }, Appointments = new List <Appointment>() { appointment, appointment3 } }; //samac var upRight33 = new Tooth { ToothPosition = ToothPosition.gd2, ToothState = ToothState.C1 }; var upRight31 = new Tooth { ToothPosition = ToothPosition.gd1, ToothState = ToothState.H }; var downRight33 = new Tooth { ToothPosition = ToothPosition.dd3, ToothState = ToothState.H }; var medicalRecord31 = new MedicalRecord { DateCreated = DateTime.Now, Description = "Zalivena gornja desna dvica", ToothPosition = ToothPosition.dd8, ToothState = ToothState.H }; var patient3 = new Patient { UserName = "******", PasswordHash = passwordHasher.HashPassword("P@ssw0rd"), FirstName = "Sami", LastName = "Yusuf", DateOfBirth = new DateTime(1973, 4, 3), Address = "Londonska 3", DateCreated = DateTime.Now, EmploymentStatus = EmploymentStatus.Employed, SecurityStamp = "fakjhdfiasndgsakjfalfjsadasdamsoa", Email = "*****@*****.**", PhoneNumber = "0699/064-064", EmailConfirmed = true, MedicalHistory = new MedicalHistory { Note = "Patient's teeth are excellent, he can perform good on stage.", MedicalRecords = new List <MedicalRecord>() { medicalRecord31 }, Teeth = new List <Tooth>() { upRight33, upRight31, downRight3 } }, Appointments = new List <Appointment>() { appointment2 } }; var dentist = new Dentist { FirstName = "Emir", LastName = "Hodzic", UserName = "******", PasswordHash = passwordHasher.HashPassword("P@ssw0rd"), DateOfBirth = new DateTime(1992, 3, 20), EmploymentStatus = EmploymentStatus.Employed, PhoneNumber = "+38762876923", Email = "*****@*****.**", Address = "Igmanskih Bataljona 27", Place = "Hrasnicka cesta 13", DateCreated = DateTime.Now, EmailConfirmed = true, SecurityStamp = "fakjhdfiasndgsakjfalfjmsoa", Patients = new List <Patient>() { patient, patient2 }, Schedule = new Schedule { Appointments = new List <Appointment>() { appointment, appointment3 } } }; var dentist2 = new Dentist { FirstName = "Damir", LastName = "Metiljevic", UserName = "******", PasswordHash = passwordHasher.HashPassword("P@ssw0rd"), DateOfBirth = new DateTime(1992, 3, 20), EmploymentStatus = EmploymentStatus.Unemployed, PhoneNumber = "+38762123456", Email = "*****@*****.**", Address = "Mumijevi 12", Place = "Ilidzanska cesma 123", DateCreated = DateTime.Now, EmailConfirmed = true, SecurityStamp = "fafgsddggggb", Patients = new List <Patient>() { patient3 }, Schedule = new Schedule { Appointments = new List <Appointment>() { appointment2 } } }; var newNote1 = new Note { Id = Guid.NewGuid().ToString(), DateCreated = DateTime.Now, Comment = "This is just some dummy text to fill in this field with the text, and this text makes no sense at all but it does not matter", Title = "Great news!", }; var newNote2 = new Note { Id = Guid.NewGuid().ToString(), DateCreated = DateTime.Now, Comment = "This is just some extra dummy text to fill in this field with the text, and this text makes no sense at all but it does not matter", Title = "Great update!", }; var newNote3 = new Note { Id = Guid.NewGuid().ToString(), DateCreated = DateTime.Now, Comment = "This is just extra extra dummy text to fill in this field with the text, and this text makes no sense at all but it does not matter. ", Title = "Great feature!", }; var newNote4 = new Note { Id = Guid.NewGuid().ToString(), DateCreated = DateTime.Now, Comment = "This is dummy dummy text to fill in this field with the text, and this text makes no sense at all but it does not matter. This is just extra extra dummy text to fill in this field with the text, and this text makes no sense at all but it does not matter. This is just extra extra dummy text to fill in this field with the text, and this text makes no sense at all but it does not matter", Title = "Great info!", }; var admin = new Admin { FirstName = "Admin", LastName = "Adminic", UserName = "******", PasswordHash = passwordHasher.HashPassword("P@ssw0rd"), DateOfBirth = new DateTime(1992, 3, 20), EmploymentStatus = EmploymentStatus.Unemployed, PhoneNumber = "+38762123456", Email = "*****@*****.**", Address = "Mumijevi 12", //Place = "Ilidzanska cesma 123", DateCreated = DateTime.Now, EmailConfirmed = true, SecurityStamp = "fafgsddggsafwefaggb", //Patients = new List<Patient>() { patient3 } Notes = new List <Note>() { newNote1, newNote2, newNote3, newNote4 } }; context.Users.AddOrUpdate(dentist); context.Users.AddOrUpdate(dentist2); context.Users.AddOrUpdate(patient); context.Users.AddOrUpdate(patient2); context.Users.AddOrUpdate(patient3); context.Users.AddOrUpdate(patient5); context.Users.AddOrUpdate(admin); //Assign Dentist role between two functions "SaveChanges()" in order to make it work context.SaveChanges(); var userStore = new UserStore <Dentist>(context); var userManager = new UserManager <Dentist>(userStore); userManager.AddToRole(dentist.Id, "Dentist"); userManager.AddToRole(dentist2.Id, "Dentist"); var userStore2 = new UserStore <Patient>(context); var userManager2 = new UserManager <Patient>(userStore2); var userStore3 = new UserStore <Admin>(context); var userManager3 = new UserManager <Admin>(userStore3); userManager2.AddToRole(patient.Id, "Patient"); userManager2.AddToRole(patient2.Id, "Patient"); userManager2.AddToRole(patient3.Id, "Patient"); userManager2.AddToRole(patient5.Id, "Patient"); userManager3.AddToRole(admin.Id, "Admin"); context.SaveChanges(); }
private void butOK_Click(object sender, System.EventArgs e) { if (textDate.errorProvider1.GetError(textDate) != "") { MessageBox.Show(Lan.g(this, "Please fix data entry errors first.")); return; } if (textDate.Text == "") { MsgBox.Show(this, "Please enter a date."); return; } if (textTime.Text == "") { MsgBox.Show(this, "Please enter a time."); return; } DateTime time; if (!DateTime.TryParse(textTime.Text, out time)) { MsgBox.Show(this, "Please enter a valid time."); return; } //We had a security bug where users could change the date to a more recent date, and then subsequently delete. //The code below is for that specific scenario. DateTime dateTimeEntered = PIn.DateT(textDate.Text + " " + textTime.Text); if (dateTimeEntered > DocCur.DateCreated) { //user is trying to change the date to some date after the previously linked date //is the new doc date allowed? if (!Security.IsAuthorized(Permissions.ImageDelete, DocCur.DateCreated, true)) { //suppress the default security message above (it's too confusing for this case) and generate our own here MessageBox.Show(this, Lan.g(this, "Not allowed to future date this image from") + ": " + "\r\n" + DocCur.DateCreated.ToString() + " to " + dateTimeEntered.ToString() + "\r\n\r\n" + Lan.g(this, "A user with the SecurityAdmin permission must grant you access for") + ":\r\n" + GroupPermissions.GetDesc(Permissions.ImageDelete)); return; } } try{ DocCur.ToothNumbers = Tooth.FormatRangeForDb(textToothNumbers.Text); } catch (ApplicationException ex) { MessageBox.Show(ex.Message); return; } DocCur.DocCategory = _listImageCatDefs[listCategory.SelectedIndex].DefNum; DocCur.ImgType = (ImageType)listType.SelectedIndex; DocCur.Description = textDescript.Text; DocCur.DateCreated = dateTimeEntered; try{ //incomplete DocCur.ToothNumbers = Tooth.FormatRangeForDb(textToothNumbers.Text); } catch (ApplicationException ex) { MessageBox.Show(ex.Message); return; } //DocCur.Note=textNote.Text; //Docs.Cur.LastAltered=DateTime.Today; //if(IsNew){ // DocCur.Insert(PatCur); //} //else{ if (Documents.Update(DocCur, DocOld)) { ImageStore.LogDocument(Lan.g(this, "Document Edited") + ": ", Permissions.ImageEdit, DocCur, DocOld.DateTStamp); } //} DialogResult = DialogResult.OK; }
private void FillGrid() { List <Procedure> entireList = Procedures.Refresh(AptCur.PatNum); ProcList = new List <Procedure>(); bool isPlanned = AptCur.AptStatus == ApptStatus.Planned; ApptStatus apptStatus = AptCur.AptStatus; for (int i = 0; i < entireList.Count; i++) { //We want all unattached completed procs with same date as appt. //but only if one of these types if (apptStatus == ApptStatus.Scheduled || apptStatus == ApptStatus.Complete || apptStatus == ApptStatus.ASAP || apptStatus == ApptStatus.Broken) { if (entireList[i].AptNum == 0 && entireList[i].ProcStatus == ProcStat.C && entireList[i].ProcDate.Date == AptCur.AptDateTime.Date) { ProcList.Add(entireList[i]); } } //otherwise, we only want TP procs that are not attached to this appointment. //As for TP procs attached to other appointments, we will show this to the user and warn them about it, //but we won't filter them out. if (entireList[i].ProcStatus != ProcStat.TP) { continue; } if (isPlanned) { if (entireList[i].PlannedAptNum == AptCur.AptNum) { continue; } } else { if (entireList[i].AptNum == AptCur.AptNum) { continue; } } ProcList.Add(entireList[i]); } gridMain.BeginUpdate(); gridMain.Columns.Clear(); ODGridColumn col; col = new ODGridColumn(Lan.g("TableProcSelect", "OtherAppt"), 70, HorizontalAlignment.Center); gridMain.Columns.Add(col); col = new ODGridColumn(Lan.g("TableProcSelect", "Code"), 55); gridMain.Columns.Add(col); col = new ODGridColumn(Lan.g("TableProcSelect", "Priority"), 55); gridMain.Columns.Add(col); col = new ODGridColumn(Lan.g("TableProcSelect", "Tooth"), 50); gridMain.Columns.Add(col); col = new ODGridColumn(Lan.g("TableProcSelect", "Description"), 250); gridMain.Columns.Add(col); col = new ODGridColumn(Lan.g("TableProcSelect", "Fee"), 60, HorizontalAlignment.Right); gridMain.Columns.Add(col); gridMain.Rows.Clear(); ODGridRow row; for (int i = 0; i < ProcList.Count; i++) { row = new ODGridRow(); if (ProcList[i].ProcStatus == ProcStat.C) //so unattached { row.Cells.Add(""); } else if (isPlanned && ProcList[i].PlannedAptNum != 0) { row.Cells.Add("X"); } else if (!isPlanned && ProcList[i].AptNum != 0) { row.Cells.Add("X"); } else { row.Cells.Add(""); } row.Cells.Add(ProcedureCodes.GetStringProcCode(ProcList[i].CodeNum)); row.Cells.Add(DefC.GetName(DefCat.TxPriorities, ProcList[i].Priority)); row.Cells.Add(Tooth.ToInternat(ProcList[i].ToothNum)); row.Cells.Add(ProcedureCodes.GetLaymanTerm(ProcList[i].CodeNum)); row.Cells.Add(ProcList[i].ProcFee.ToString("F")); gridMain.Rows.Add(row); } gridMain.EndUpdate(); }
private void CreateIndividual() { ReportComplex report = new ReportComplex(true, false); bool isAnyClinicMedical = false; //Used to determine whether or not to display 'Tooth' column if (AnyClinicSelectedIsMedical()) { isAnyClinicMedical = true; } DataTable table = new DataTable(); try { table = RpProcSheet.GetIndividualTable(date1.SelectionStart, date2.SelectionStart, _listProvNums, _listClinicNums, textCode.Text, isAnyClinicMedical, checkAllProv.Checked, PrefC.HasClinicsEnabled); } catch (Exception ex) { report.CloseProgressBar(); string text = Lan.g(this, "Error getting report data:") + " " + ex.Message + "\r\n\r\n" + ex.StackTrace; MsgBoxCopyPaste msgBox = new MsgBoxCopyPaste(text); msgBox.ShowDialog(); return; } if (table.Columns.Contains("ToothNum")) { foreach (DataRow row in table.Rows) { row["ToothNum"] = Tooth.GetToothLabel(row["ToothNum"].ToString()); } } string subtitleProvs = ConstructProviderSubtitle(); string subtitleClinics = ConstructClinicSubtitle(); Font font = new Font("Tahoma", 9); Font fontBold = new Font("Tahoma", 9, FontStyle.Bold); Font fontTitle = new Font("Tahoma", 17, FontStyle.Bold); Font fontSubTitle = new Font("Tahoma", 10, FontStyle.Bold); report.ReportName = Lan.g(this, "Daily Procedures"); report.AddTitle("Title", Lan.g(this, "Daily Procedures"), fontTitle); report.AddSubTitle("Practice Title", PrefC.GetString(PrefName.PracticeTitle), fontSubTitle); report.AddSubTitle("Dates of Report", date1.SelectionStart.ToString("d") + " - " + date2.SelectionStart.ToString("d"), fontSubTitle); report.AddSubTitle("Providers", subtitleProvs, fontSubTitle); if (PrefC.HasClinicsEnabled) { report.AddSubTitle("Clinics", subtitleClinics, fontSubTitle); } QueryObject query = report.AddQuery(table, Lan.g(this, "Date") + ": " + DateTimeOD.Today.ToString("d")); query.AddColumn(Lan.g(this, "Date"), 90, FieldValueType.Date, font); query.GetColumnDetail(Lan.g(this, "Date")).StringFormat = "d"; query.AddColumn(Lan.g(this, "Patient Name"), 150, FieldValueType.String, font); if (isAnyClinicMedical) { query.AddColumn(Lan.g(this, "Code"), 140, FieldValueType.String, font); } else { query.AddColumn(Lan.g(this, "Code"), 70, FieldValueType.String, font); query.AddColumn("Tooth", 40, FieldValueType.String, font); } query.AddColumn(Lan.g(this, "Description"), 140, FieldValueType.String, font); query.AddColumn(Lan.g(this, "Provider"), 80, FieldValueType.String, font); if (PrefC.HasClinicsEnabled) { query.AddColumn(Lan.g(this, "Clinic"), 100, FieldValueType.String, font); } query.AddColumn(Lan.g(this, "Fee"), 80, FieldValueType.Number, font); report.AddPageNum(font); if (!report.SubmitQueries()) { return; } FormReportComplex FormR = new FormReportComplex(report); FormR.ShowDialog(); DialogResult = DialogResult.OK; }
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(); }
///<summary>Procedure will have a completed status. For surfaces, since the scripts are faulty, pass in the exact surfaces that should be in the db, no validation will be done, and those exact same surfaces are what will go out on claim.</summary> public static Procedure AddProc(string procCode, long patNum, DateTime procDate, string toothNum, string surf, double fee, string typeCodes, long provNum) { Procedure proc = new Procedure(); ProcedureCode procedureCode = ProcedureCodes.GetProcCode(procCode); //procnum proc.PatNum = patNum; //aptnum proc.CodeNum = procedureCode.CodeNum; proc.ProcDate = procDate; proc.DateTP = proc.ProcDate; proc.ProcFee = fee; switch (toothNum) { case "": proc.ToothNum = ""; proc.Surf = surf; break; case "10": proc.ToothNum = ""; proc.Surf = "UR"; break; case "20": proc.ToothNum = ""; proc.Surf = "UL"; break; case "30": proc.ToothNum = ""; proc.Surf = "LL"; break; case "40": proc.ToothNum = ""; proc.Surf = "LR"; break; default: proc.ToothNum = Tooth.FromInternat(toothNum); proc.Surf = surf; //Tooth.SurfTidyFromDisplayToDb(surf,proc.ToothNum); break; } //ToothRange proc.Priority = 0; proc.ProcStatus = ProcStat.C; proc.ProvNum = provNum; proc.Note = ""; proc.ClinicNum = 0; //proc.Dx proc.MedicalCode = ""; proc.BaseUnits = 0; proc.SiteNum = 0; //nextaptnum proc.CanadianTypeCodes = typeCodes; Procedures.Insert(proc); //if an extraction, then mark previous procs hidden. Skip. //Recalls.Synch(PatCur.PatNum);//skip //Procedures.ComputeEstimates(proc,patNum,new List<ClaimProc>(),true,planList,patPlanList,benefitList,age); return(proc); }