private void gridSupplementalInfo_CellDoubleClick(object sender, ODGridClickEventArgs e) { Hx835_Info info = (Hx835_Info)gridSupplementalInfo.Rows[e.Row].Tag; MsgBoxCopyPaste msgbox = new MsgBoxCopyPaste(info.FieldName + "\r\n" + info.FieldValue); msgbox.Show(this); //This window is just used to display information. }
private void gridProcedureAdjustments_CellDoubleClick(object sender, ODGridClickEventArgs e) { Hx835_Adj adj = (Hx835_Adj)gridProcedureAdjustments.Rows[e.Row].Tag; MsgBoxCopyPaste msgbox = new MsgBoxCopyPaste(adj.AdjCode + " " + adj.AdjustRemarks + "\r\r" + adj.ReasonDescript + "\r\n" + adj.AdjAmt.ToString("f2")); msgbox.Show(this); //This window is just used to display information. }
private void gridRemarks_CellDoubleClick(object sender, ODGridClickEventArgs e) { string remark = (string)gridRemarks.Rows[e.Row].Tag; MsgBoxCopyPaste msgbox = new MsgBoxCopyPaste(remark); msgbox.Show(this); //This window is just used to display information. }
private void butRun_Click(object sender, EventArgs e) { List <ClaimPaySplit> splits = Claims.GetInsPayNotAttachedForFixTool(); if (splits.Count == 0) { MsgBox.Show(this, "There are currently no insurance payments that are not attached to an insurance check."); DialogResult = DialogResult.OK; //Close the window because there is nothing else to do return; } Cursor = Cursors.WaitCursor; string invalidClaimDate = ""; DateTime curDate = MiscData.GetNowDateTime().Date; for (int i = 0; i < splits.Count; i++) { Claim claim = Claims.GetClaim(splits[i].ClaimNum); if (claim == null) { continue; } if (claim.DateReceived.Date > curDate && !PrefC.GetBool(PrefName.AllowFutureInsPayments) && !PrefC.GetBool(PrefName.FutureTransDatesAllowed)) { invalidClaimDate += "\r\n" + Lan.g(this, "PatNum") + " " + claim.PatNum + ", " + claim.DateService.ToShortDateString(); continue; } ClaimPayment cp = new ClaimPayment(); cp.CheckDate = claim.DateReceived; cp.CheckAmt = splits[i].InsPayAmt; cp.ClinicNum = claim.ClinicNum; cp.CarrierName = splits[i].Carrier; cp.PayType = Defs.GetFirstForCategory(DefCat.InsurancePaymentType, true).DefNum; ClaimPayments.Insert(cp); List <ClaimProc> claimP = ClaimProcs.RefreshForClaim(splits[i].ClaimNum); for (int j = 0; j < claimP.Count; j++) { if (claimP[j].ClaimPaymentNum != 0 || claimP[j].InsPayAmt == 0) //If claimpayment already attached to claimproc or ins didn't pay. { continue; //Do not change } claimP[j].DateCP = claim.DateReceived; claimP[j].ClaimPaymentNum = cp.ClaimPaymentNum; ClaimProcs.Update(claimP[j]); } } Cursor = Cursors.Default; if (invalidClaimDate != "") { invalidClaimDate = "\r\n" + Lan.g(this, "Cannot make future-dated insurance payments for these claims:") + invalidClaimDate; } MsgBoxCopyPaste messageBox = new MsgBoxCopyPaste(Lan.g(this, "Insurance checks created:") + " " + splits.Count + invalidClaimDate); messageBox.Show(); DialogResult = DialogResult.OK; //Close the window because there is nothing else to do }
private void butGenerateQuery_Click(object sender, EventArgs e) { if (!Validation()) { return; } string queryStr = RpAging.GetQueryString(GetParamsFromForm()); MsgBoxCopyPaste msgBox = new MsgBoxCopyPaste(queryStr); msgBox.Show(this); }
private void gridProviderAdjustments_CellDoubleClick(object sender, ODGridClickEventArgs e) { Hx835_ProvAdj provAdj = (Hx835_ProvAdj)gridProviderAdjustments.ListGridRows[e.Row].Tag; MsgBoxCopyPaste msgbox = new MsgBoxCopyPaste( provAdj.Npi + "\r\n" + provAdj.DateFiscalPeriod.ToShortDateString() + "\r\n" + provAdj.ReasonCode + " " + provAdj.ReasonCodeDescript + "\r\n" + provAdj.RefIdentification + "\r\n" + provAdj.AdjAmt.ToString("f2")); msgbox.Show(this); //This window is just used to display information. }
private void butGenerateQuery_Click(object sender, EventArgs e) { if (!Validation()) { return; } DateTime asOfDate = PIn.Date(textDate.Text); List <long> listProvNums = new List <long>(); List <long> listClinicNums = new List <long>(); List <long> listBillingTypeDefNums = new List <long>(); AgeOfAccount accountAge = GenerateLists(listProvNums, listClinicNums, listBillingTypeDefNums); bool isForInsAging = false; string queryStr = RpAging.GetQueryString(asOfDate, checkAgeWriteoffs.Checked, checkHasDateLastPay.Checked, radioGroupByFam.Checked, checkOnlyNeg.Checked, accountAge, checkIncludeNeg.Checked, checkExcludeInactive.Checked, checkBadAddress.Checked, listProvNums, listClinicNums, listBillingTypeDefNums, checkExcludeArchive.Checked, checkIncludeInsNoBal.Checked, checkOnlyInsNoBal.Checked, checkAgeNegAdjs.Checked, isForInsAging, checkAgePatPayPlanPayments.Checked); MsgBoxCopyPaste msgBox = new MsgBoxCopyPaste(queryStr); msgBox.Show(this); }
private void gridMain_CellDoubleClick(object sender, ODGridClickEventArgs e) { MethodInfo method = _listDbmMethodsGrid[e.Row]; if (!DatabaseMaintenances.MethodHasBreakDown(method)) { return; } //We know that this method supports giving the user a break down and shall call the method's fix section where the break down results should be. //TODO: Make sure that DBM methods with break downs ALWAYS have the break down in the fix section. if (_patNum < 1) { MsgBox.Show(this, "Select a patient first."); return; } DbmMethodAttr methodAttributes = (DbmMethodAttr)Attribute.GetCustomAttribute(method, typeof(DbmMethodAttr)); //We always send verbose and modeCur into all DBM methods. List <object> parameters = new List <object>() { checkShow.Checked, DbmMode.Breakdown }; //There are optional paramaters available to some methods and adding them in the following order is very important. if (methodAttributes.HasPatNum) { parameters.Add(_patNum); } Cursor = Cursors.WaitCursor; string result = (string)method.Invoke(null, parameters.ToArray()); if (result == "") //Only possible if running a check / fix in non-verbose mode and nothing happened or needs to happen. { result = Lan.g("FormDatabaseMaintenance", "Done. No maintenance needed."); } SaveLogToFile(method.Name + ":\r\n" + result); //Show the result of the dbm method in a simple copy paste msg box. MsgBoxCopyPaste msgBoxCP = new MsgBoxCopyPaste(result); Cursor = Cursors.Default; msgBoxCP.Show(); //Let this window be non-modal so that they can keep it open while they fix their problems. }
private void butExport_Click(object sender, EventArgs e) { string strCcdValidationErrors = EhrCCD.ValidateSettings(); if (strCcdValidationErrors != "") //Do not even try to export if global settings are invalid. { MessageBox.Show(strCcdValidationErrors); //We do not want to use translations here, because the text is dynamic. The errors are generated in the business layer, and Lan.g() is not available there. return; } FolderBrowserDialog dlg = new FolderBrowserDialog(); DialogResult result = dlg.ShowDialog(); if (result != DialogResult.OK) { return; } DateTime dateNow = DateTime.Now; string folderPath = ODFileUtils.CombinePaths(dlg.SelectedPath, (dateNow.Year + "_" + dateNow.Month + "_" + dateNow.Day)); if (Directory.Exists(folderPath)) { int loopCount = 1; while (Directory.Exists(folderPath + "_" + loopCount)) { loopCount++; } folderPath = folderPath + "_" + loopCount; } try { Directory.CreateDirectory(folderPath); } catch { MessageBox.Show("Error, Could not create folder"); return; } this.Cursor = Cursors.WaitCursor; Patient patCur; string fileName; int numSkipped = 0; //Number of patients skipped. Set to -1 if only one patient was selected and had CcdValidationErrors. string patientsSkipped = ""; //Names of the patients that were skipped, so we can tell the user which ones didn't export correctly. for (int i = 0; i < gridMain.SelectedIndices.Length; i++) { patCur = Patients.GetPat((long)gridMain.Rows[gridMain.SelectedIndices[i]].Tag); //Cannot use GetLim because more information is needed in the CCD message generation below. strCcdValidationErrors = EhrCCD.ValidatePatient(patCur); if (strCcdValidationErrors != "") { if (gridMain.SelectedIndices.Length == 1) { numSkipped = -1; //Set to -1 so we know below to not show the "exported" message. MessageBox.Show(Lan.g(this, "Patient not exported due to the following errors") + ":\r\n" + strCcdValidationErrors); continue; } //If one patient is missing the required information for export, then simply skip the patient. We do not want to popup a message, //because it would be hard to get through the export if many patients were missing required information. numSkipped++; patientsSkipped += "\r\n" + patCur.LName + ", " + patCur.FName; continue; } fileName = ""; string lName = patCur.LName; for (int j = 0; j < lName.Length; j++) //Strip all non-letters from FName { if (Char.IsLetter(lName, j)) { fileName += lName.Substring(j, 1); } } fileName += "_"; string fName = patCur.FName; for (int k = 0; k < fName.Length; k++) //Strip all non-letters from LName { if (Char.IsLetter(fName, k)) { fileName += fName.Substring(k, 1); } } fileName += "_" + patCur.PatNum; //LName_FName_PatNum string ccd = EhrCCD.GeneratePatientExport(patCur); try { File.WriteAllText(ODFileUtils.CombinePaths(folderPath, fileName + ".xml"), ccd); } catch { MessageBox.Show("Error, Could not create xml file"); this.Cursor = Cursors.Default; return; } } if (numSkipped == -1) //Will be -1 if only one patient was selected, and it did not export correctly. { this.Cursor = Cursors.Default; return; //Don't display "Exported" to the user because the CCD was not exported. } try { File.WriteAllText(ODFileUtils.CombinePaths(folderPath, "CCD.xsl"), FormEHR.GetEhrResource("CCD")); } catch { MessageBox.Show("Error, Could not create stylesheet file"); } string strMsg = Lan.g(this, "Exported"); if (numSkipped > 0) { strMsg += ". " + Lan.g(this, "Patients skipped due to missing information") + ": " + numSkipped + patientsSkipped; MsgBoxCopyPaste msgCP = new MsgBoxCopyPaste(strMsg); msgCP.Show(); } else { MessageBox.Show(strMsg); } this.Cursor = Cursors.Default; }
private void butRawMessage_Click(object sender, EventArgs e) { MsgBoxCopyPaste msgbox = new MsgBoxCopyPaste(MessageText835); msgbox.Show(this); //This window is just used to display information. }
private void Run(DbmMode modeCur) { if (_patNum < 1) { MsgBox.Show(this, "Select a patient first."); return; } Cursor = Cursors.WaitCursor; //Clear out the result column for all rows before every "run" for (int i = 0; i < gridMain.Rows.Count; i++) { gridMain.Rows[i].Cells[2].Text = ""; //Don't use UpdateResultTextForRow here because users will see the rows clearing out one by one. } bool verbose = checkShow.Checked; StringBuilder logText = new StringBuilder(); //Create a thread that will show a window and then stay open until the closing phrase is thrown from this form. Action actionCloseCheckTableProgress = ODProgressOld.ShowProgressStatus("CheckTableProgress", this); ODTuple <string, bool> tableCheckResult = DatabaseMaintenances.MySQLTables(verbose, modeCur); actionCloseCheckTableProgress(); logText.Append(tableCheckResult.Item1); //No database maintenance methods should be run unless this passes. if (!tableCheckResult.Item2) { Cursor = Cursors.Default; MsgBoxCopyPaste msgBoxCP = new MsgBoxCopyPaste(tableCheckResult.Item1); //the Tuples result is already translated. msgBoxCP.Show(); //Let this window be non-modal so that they can keep it open while they fix their problems. return; } if (gridMain.SelectedIndices.Length < 1) { //No rows are selected so the user wants to run all checks. gridMain.SetSelected(true); } string result; int[] selectedIndices = gridMain.SelectedIndices; for (int i = 0; i < selectedIndices.Length; i++) { long userNum = 0; DbmMethodAttr methodAttributes = (DbmMethodAttr)Attribute.GetCustomAttribute(_listDbmMethodsGrid[selectedIndices[i]], typeof(DbmMethodAttr)); //We always send verbose and modeCur into all DBM methods. List <object> parameters = new List <object>() { verbose, modeCur }; //There are optional paramaters available to some methods and adding them in the following order is very important. if (methodAttributes.HasUserNum) { parameters.Add(userNum); } if (methodAttributes.HasPatNum) { parameters.Add(_patNum); } gridMain.ScrollToIndexBottom(selectedIndices[i]); UpdateResultTextForRow(selectedIndices[i], Lan.g("FormDatabaseMaintenance", "Running") + "..."); try { result = (string)_listDbmMethodsGrid[selectedIndices[i]].Invoke(null, parameters.ToArray()); if (modeCur == DbmMode.Fix) { DatabaseMaintenances.UpdateDateLastRun(_listDbmMethodsGrid[selectedIndices[i]].Name); } } catch (Exception ex) { if (ex.InnerException != null) { ExceptionDispatchInfo.Capture(ex.InnerException).Throw(); //This preserves the stack trace of the InnerException. } throw; } string status = ""; if (result == "") //Only possible if running a check / fix in non-verbose mode and nothing happened or needs to happen. { status = Lan.g("FormDatabaseMaintenance", "Done. No maintenance needed."); } UpdateResultTextForRow(selectedIndices[i], result + status); logText.Append(result); } gridMain.SetSelected(selectedIndices, true); //Reselect all rows that were originally selected. try { DatabaseMaintenances.SaveLogToFile(logText.ToString()); } catch (Exception ex) { Cursor = Cursors.Default; MessageBox.Show(ex.Message); } Cursor = Cursors.Default; if (modeCur == DbmMode.Fix) { //_isCacheInvalid=true;//Flag cache to be invalidated on closing. Some DBM fixes alter cached tables. } }
private void FillGrid() { if (textRows.errorProvider1.GetError(textRows) != "") { MsgBox.Show(this, "Please fix data entry errors first."); return; } long userNum = 0; if (comboUser.SelectedIndex > 0) { userNum = _listUserods[comboUser.SelectedIndex - 1].UserNum; } SecurityLog[] logList = null; DateTime datePreviousFrom = PIn.Date(textDateEditedFrom.Text); DateTime datePreviousTo = DateTime.Today; if (textDateEditedTo.Text != "") { datePreviousTo = PIn.Date(textDateEditedTo.Text); } try { if (comboPermission.SelectedIndex == 0) { logList = SecurityLogs.Refresh(PIn.Date(textDateFrom.Text), PIn.Date(textDateTo.Text), Permissions.None, PatNum, userNum, datePreviousFrom, datePreviousTo, checkIncludeArchived.Checked, PIn.Int(textRows.Text)); } else { logList = SecurityLogs.Refresh(PIn.Date(textDateFrom.Text), PIn.Date(textDateTo.Text), (Permissions)Enum.Parse(typeof(Permissions), comboPermission.SelectedItem.ToString()), PatNum, userNum, datePreviousFrom, datePreviousTo, checkIncludeArchived.Checked, PIn.Int(textRows.Text)); } } catch (Exception ex) { FriendlyException.Show(Lan.g(this, "There was a problem refreshing the Audit Trail with the current filters."), ex); logList = new SecurityLog[0]; } grid.BeginUpdate(); grid.Columns.Clear(); grid.Columns.Add(new ODGridColumn(Lan.g("TableAudit", "Date"), 70, GridSortingStrategy.DateParse)); grid.Columns.Add(new ODGridColumn(Lan.g("TableAudit", "Time"), 60, GridSortingStrategy.DateParse)); grid.Columns.Add(new ODGridColumn(Lan.g("TableAudit", "Patient"), 100)); grid.Columns.Add(new ODGridColumn(Lan.g("TableAudit", "User"), 70)); grid.Columns.Add(new ODGridColumn(Lan.g("TableAudit", "Permission"), 190)); grid.Columns.Add(new ODGridColumn(Lan.g("TableAudit", "Computer"), 70)); grid.Columns.Add(new ODGridColumn(Lan.g("TableAudit", "Log Text"), 279)); grid.Columns.Add(new ODGridColumn(Lan.g("TableAudit", "Last Edit"), 100)); grid.Rows.Clear(); ODGridRow row; foreach (SecurityLog logCur in logList) { row = new ODGridRow(); row.Cells.Add(logCur.LogDateTime.ToShortDateString()); row.Cells.Add(logCur.LogDateTime.ToShortTimeString()); row.Cells.Add(logCur.PatientName); //user might be null due to old bugs. row.Cells.Add(Userods.GetUser(logCur.UserNum)?.UserName ?? "unknown"); if (logCur.PermType == Permissions.ChartModule) { row.Cells.Add("ChartModuleViewed"); } else if (logCur.PermType == Permissions.FamilyModule) { row.Cells.Add("FamilyModuleViewed"); } else if (logCur.PermType == Permissions.AccountModule) { row.Cells.Add("AccountModuleViewed"); } else if (logCur.PermType == Permissions.ImagesModule) { row.Cells.Add("ImagesModuleViewed"); } else if (logCur.PermType == Permissions.TPModule) { row.Cells.Add("TreatmentPlanModuleViewed"); } else { row.Cells.Add(logCur.PermType.ToString()); } row.Cells.Add(logCur.CompName); if (logCur.PermType != Permissions.UserQuery) { row.Cells.Add(logCur.LogText); } else { //Only display the first snipet of very long queries. User can double click to view. row.Cells.Add(logCur.LogText.Left(200, true)); row.Tag = (Action)(() => { MsgBoxCopyPaste formText = new MsgBoxCopyPaste(logCur.LogText); formText.NormalizeContent(); formText.Show(); }); } if (logCur.DateTPrevious.Year < 1880) { row.Cells.Add(""); } else { row.Cells.Add(logCur.DateTPrevious.ToString()); } //Get the hash for the audit log entry from the database and rehash to compare if (logCur.LogHash != SecurityLogHashes.GetHashString(logCur)) { row.ColorText = Color.Red; //Bad hash or no hash entry at all. This prevents users from deleting the entire hash table to make the audit trail look valid and encrypted. //historical entries will show as red. } grid.Rows.Add(row); } grid.EndUpdate(); grid.ScrollToEnd(); }
private void butYes_Click(object sender, System.EventArgs e) { //Customers have been complaining about procedurelog entries changing their CodeNum column to 0. //Based on a security log provided by a customer, we were able to determine that this is one of two potential violators. //The following code is here simply to try and get the user to call us so that we can have proof and hopefully find the core of the issue. try { if (_verifyCode < 1) { throw new ApplicationException("Invalid Verify Code"); } } catch (ApplicationException ae) { string error = "Please notify support with the following information.\r\n" + "Error: " + ae.Message + "\r\n" + "_verifyCode: " + _verifyCode.ToString() + "\r\n" + "_procCur.CodeNum: " + (_procCur == null ? "NULL" : _procCur.CodeNum.ToString()) + "\r\n" + "_procCodeCur.CodeNum: " + (_procCodeCur == null ? "NULL" : _procCodeCur.CodeNum.ToString()) + "\r\n" + "\r\n" + "StackTrace:\r\n" + ae.StackTrace; MsgBoxCopyPaste MsgBCP = new MsgBoxCopyPaste(error); MsgBCP.Text = "Fatal Error!!!"; MsgBCP.Show(); //Use .Show() to make it easy for the user to keep this window open while they call in. return; } //Moved from FormProcEdit.SaveAndClose() in version 16.3+ Procedure procOld = _procCur.Copy(); _procCur.CodeNum = _verifyCode; if (new[] { ProcStat.TP, ProcStat.C, ProcStat.TPi }.Contains(_procCur.ProcStatus)) //Only change the fee if Complete or TP { InsSub prisub = null; InsPlan priplan = null; if (_listPatPlans.Count > 0) { prisub = InsSubs.GetSub(_listPatPlans[0].InsSubNum, _listInsSubs); priplan = InsPlans.GetPlan(prisub.PlanNum, _listInsPlans); } _procCur.ProcFee = Fees.GetAmount0(_procCur.CodeNum, FeeScheds.GetFeeSched(_patCur, _listInsPlans, _listPatPlans, _listInsSubs, _procCur.ProvNum), _procCur.ClinicNum, _procCur.ProvNum); if (priplan != null && priplan.PlanType == "p") //PPO { double standardfee = Fees.GetAmount0(_procCur.CodeNum, Providers.GetProv(Patients.GetProvNum(_patCur)).FeeSched, _procCur.ClinicNum, _procCur.ProvNum); _procCur.ProcFee = Math.Max(_procCur.ProcFee, standardfee); } } Procedures.Update(_procCur, procOld); //Compute estimates required, otherwise if adding through quick add, it could have incorrect WO or InsEst if code changed. Procedures.ComputeEstimates(_procCur, _patCur.PatNum, _listClaimProcs, false, _listInsPlans, _listPatPlans, _listBenefits, _patCur.Age, _listInsSubs); Recalls.Synch(_procCur.PatNum); if (_procCur.ProcStatus.In(ProcStat.C, ProcStat.EO, ProcStat.EC)) { string logText = _procCodeCur.ProcCode + " (" + _procCur.ProcStatus + "), "; if (_teethText != null && _teethText.Trim() != "") { logText += Lan.g(this, "Teeth") + ": " + _teethText + ", "; } logText += Lan.g(this, "Fee") + ": " + _procCur.ProcFee.ToString("F") + ", " + _procCodeCur.Descript; Permissions perm = Permissions.ProcComplEdit; if (_procCur.ProcStatus.In(ProcStat.EO, ProcStat.EC)) { perm = Permissions.ProcExistingEdit; } SecurityLogs.MakeLogEntry(perm, _patCur.PatNum, logText); } DialogResult = DialogResult.OK; }